Skip to content

Commit

Permalink
Merge pull request #83 from CityOfZion/CU-86duaznam
Browse files Browse the repository at this point in the history
CU-86duaznam - BSEthereum - Error when making a transaction with NeoX…
  • Loading branch information
lopescode authored Aug 7, 2024
2 parents e8848ae + 7602c1c commit 96b7a35
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 2 additions & 0 deletions packages/bs-ethereum/src/BSEthereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,11 @@ export class BSEthereum<BSCustomName extends string = string>
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, [
Expand Down
16 changes: 16 additions & 0 deletions packages/bs-ethereum/src/__tests__/BSEthereum.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

0 comments on commit 96b7a35

Please sign in to comment.