Developers Forum for XinFin XDC Network

ismail-ctrl
ismail-ctrl

Posted on • Updated on

[WIP] Creating transactions from xinfin sdk

I'm working on integrating xrc20 tokens, we are using

const { Transaction } = require('@ethereumjs/tx') to construct transactions but the issue is that it fails for xdc tokens with error

 `Uncaught Error: Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: xdc49d3f7543335cf38fa10889ccff10207e22110b5`
Enter fullscreen mode Exit fullscreen mode

Is there an alternative library to use for xinfin tokens (xrc20) as the above code is used for erc20 tokens which has been working fine for years. I working on this on behalf of a crypto exchange which is interested in integrating xrc20 tokens onto their platform.

Thanks!

Discussion (7)

Collapse
gzliudan profile image
Daniel Liu

Which RPC are you using?

Collapse
sean_ profile image
Sean

He was using rpc.xinfin.network earlier and then I recommended using erpc.xinfin.network or rpc.xdc.org which are both 0x compatible but he said he is still facing the same issue

Collapse
gzliudan profile image
Daniel Liu

You can use earpc.xinfin.network/ or erpc.xinfin.network/. Please check configuration carefully if still face xdc-prefix problem again.

Thread Thread
ismailctrl profile image
ismail-ctrl Author

Hi am now testing the apothem network with cifi contract.
Im getting the following error from the explorer

explorer.apothem.network/txs/0x4c9...

im using rpc.apothem.network as the rpc and chainId = 51

Thread Thread
gzliudan profile image
Daniel Liu

Can you verify and publish the source codes of contract 0x3CB8fb59815A8a69c197fd46b112Dd70EBF0CDEa ?

Thread Thread
ismailctrl profile image
ismail-ctrl Author

Seems like the issue was with cifi contract, as I tried with PLI token and it worked fine.

explorer.apothem.network/txs/0xddf...

Thread Thread
gzliudan profile image
Daniel Liu

Which versions of solidity are your contracts using?