diff --git a/common/changes/@cityofzion/bs-ethereum/CU-86duaznam_2024-08-07-16-15.json b/common/changes/@cityofzion/bs-ethereum/CU-86duaznam_2024-08-07-16-15.json new file mode 100644 index 0000000..5645945 --- /dev/null +++ b/common/changes/@cityofzion/bs-ethereum/CU-86duaznam_2024-08-07-16-15.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@cityofzion/bs-ethereum", + "comment": "Fix error when making a transaction with NeoX on TestNet", + "type": "patch" + } + ], + "packageName": "@cityofzion/bs-ethereum" +} \ No newline at end of file diff --git a/packages/bs-ethereum/src/BSEthereum.ts b/packages/bs-ethereum/src/BSEthereum.ts index 74d5071..6857d06 100644 --- a/packages/bs-ethereum/src/BSEthereum.ts +++ b/packages/bs-ethereum/src/BSEthereum.ts @@ -178,9 +178,11 @@ export class BSEthereum const isNative = BSEthereumHelper.normalizeHash(this.feeToken.hash) === BSEthereumHelper.normalizeHash(param.intent.tokenHash) if (isNative) { + const gasPrice = await provider.getGasPrice() transactionParams = { to: param.intent.receiverAddress, value: amount, + gasPrice, } } else { const contract = new ethers.Contract(param.intent.tokenHash, [ diff --git a/packages/bs-ethereum/src/__tests__/BSEthereum.spec.ts b/packages/bs-ethereum/src/__tests__/BSEthereum.spec.ts index 80c5d44..5a95b4f 100644 --- a/packages/bs-ethereum/src/__tests__/BSEthereum.spec.ts +++ b/packages/bs-ethereum/src/__tests__/BSEthereum.spec.ts @@ -190,4 +190,20 @@ describe('BSEthereum', () => { expect(transactionHash).toEqual(expect.any(String)) }) + + it.skip('Should be able to transfer a native token using a EVM', async () => { + const service = new BSEthereum('neo3', BSEthereumHelper.NEOX_TESTNET_NETWORK) + const account = service.generateAccountFromKey(process.env.TESTNET_PRIVATE_KEY as string) + const transactionHash = await service.transfer({ + senderAccount: account, + intent: { + amount: '0.00000001', + receiverAddress: '0x82B5Cd984880C8A821429cFFf89f36D35BaeBE89', + tokenDecimals: 18, + tokenHash: '-', + }, + }) + + expect(transactionHash).toEqual(expect.any(String)) + }, 60000) })