Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update "Substrate token transfers" documentation for SDK V3 #171

Open
saadahmsiddiqui opened this issue Oct 7, 2024 · 0 comments · May be fixed by #175
Open

Update "Substrate token transfers" documentation for SDK V3 #171

saadahmsiddiqui opened this issue Oct 7, 2024 · 0 comments · May be fixed by #175

Comments

@saadahmsiddiqui
Copy link
Member

The title of the page should be renamed to "Substrate Fungible Token Transfers"

Update the page with following contents:

Substrate to EVM Fungible token transfer

Transferring assets from Substrate-based chains to EVM-based chains can be achieved using the Sygma SDK. To facilitate the transfer, the following steps are required:

  1. Specify transfer parameters such as amount, recipient address, token, destination chain and use the method createSubstrateFungibleAssetTransfer from @buildwithsygma/substrate to create an instance of SubstrateFungibleAssetTransfer
  2. Sign and send the transfer transaction using polkadot.js

1. Create and initialize the transfer object

To initialize the asset transfer object, the following parameters need to be supplied:

  • An instance of the PolkadotJS ApiPromise object
  • Environment variable SYGMA_ENV needs to be set as mainnet or testnet
const fungibleTokenTransfer = await createSubstrateFungibleAssetTransfer({
  source: 5232, // Phala
  destination: 1, // Ethereum Mainnet
  sourceNetworkProvider: apiPromise,
  sourceAddress: "<substrate_address>",
  resource: "0x0000000000000000000000000000000000000000000000000000000000000001", // PHA resource ID more resources can be found here: https://github.com/sygmaprotocol/sygma-shared-configuration/blob/main/mainnet/shared-config-mainnet.json
  amount: BigInt(1) * BigInt(1e12),
  destinationAddress: "<evm_recipient_address>",
});

2. Sign and send transfer transaction

const tx = await fungibleTokenTransfer.getTransferTransaction();
await transferTx.signAndSend(account, (results) => {
  const { status } = results;
  console.log(`Current status is ${status.toString()}`);
});

A full example of the above can be found here

@Lykhoyda Lykhoyda linked a pull request Oct 8, 2024 that will close this issue
@Lykhoyda Lykhoyda linked a pull request Oct 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant