Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

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

Open
@saadahmsiddiqui

Description

@saadahmsiddiqui

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions