moonbeam-foundation / xcm-sdk

The Moonbeam XCM SDK enables developers to easily transfer assets between chains, either between parachains or between a parachain and the relay chain, within the Polkadot/Kusama ecosystem. With the SDK, you don't need to worry about determining the multilocation of the origin or destination assets or which extrinsics are used on which networks to
https://moonbeam-foundation.github.io/xcm-sdk/latest/
MIT License
14 stars 9 forks source link

getDecimals/getBalance doesn't need to depend on the signer #151

Closed dev-johnny-gh closed 7 months ago

dev-johnny-gh commented 11 months ago

I was trying to use transfer to bridge xcToken from hydraDX to moonbeam.

In this case, we don't need to depend on the evm decimals/balance.

Another thing is if we have to depend on the evm decimals/balance, can we use ethers JSONRpcProvider instead of signer?

We have the RPC. We can use JSONRpcProvider to get these two data. They don't require an ethers signer. In other words, when I'm trying to transfer xcToken to Moonbeam, I don't need to ask my users to install the metamask wallet or any evm wallet.

getDecimals:

https://github.com/PureStake/xcm-sdk/blob/159ce9ae8f7890a6ef9f0971310ca03b6d3c5495/packages/sdk/src/getTransferData/getTransferData.utils.ts#L41

getBalance:

https://github.com/PureStake/xcm-sdk/blob/159ce9ae8f7890a6ef9f0971310ca03b6d3c5495/packages/sdk/src/getTransferData/getTransferData.utils.ts#L17

ekenigs commented 11 months ago

Hey @duxiaofeng-github, thanks for your feedback. I think it's a valid point. We will try to put the change in our schedule or you are welcome to create a PR.

ekenigs commented 7 months ago

No activity here, so I'm closing it.