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 "Generic Message Passing (GMP)" Documentation for SDK V3 #172

Open
@saadahmsiddiqui

Description

@saadahmsiddiqui

Update the page with following contents:

Generic Message Passing (GMP)

Generic messages can be transferred between EVM chains using the Sygma SDK. To facilitate the transfer, the following steps are required:

  1. Specify generic message transfer parameters and create an instance of GenericMessageTransfer using createCrossChainContractCall method from @buildwithsygma/evm package.
  2. Sign and send the transfer transaction.

There are a few requirements for the Destination chain contract function that gets called. Refer to the Generic Message Passing documentation for details.

1. Create and initialize the transfer object

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

  • An EIP1193 compatible EVM provider
  • Environment variable SYGMA_ENV needs to be set as mainnet or testnet
  • Address, ABI of the contract and the function that will be invoked on the destination chain.
const gmpTransfer = await createCrossChainContractCall<
  typeof sepoliaBaseStorageContract,
  "store"
>({
  gasLimit: BigInt(0),
  functionParameters: ["0x<addr1>", "0x<addr2>", BigInt(1)],
  functionName: "store",
  destinationContractAbi: sepoliaBaseStorageContract,
  destinationContractAddress: "0x4bE595ab5A070663B314970Fc10C049BBA0ad489",
  maxFee: BigInt("3000000"),
  source: 11155111, // Sepolia
  destination: 84532, // Base Sepolia
  sourceNetworkProvider: eip1193CompatibleProvider,
  sourceAddress: "<source_evm_wallet_address>",
  resource: "0x0000000000000000000000000000000000000000000000000000000000000600",
});

2. Sign and send the transfer transaction

const transaction = await gmpTransfer.getTransferTransaction();
const tx = await wallet.sendTransaction(transaction);
await tx.wait();

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