Skip to content

Prepare Transaction for Token Exchange

To prepare a transaction for a token exchange, you can use the prepareTxTokenExchange method from the TradeCms class. Here is an example of how to do it:

Import the necessary module and initialize the TradeCms instance

javascript
import { TradeCms } from "skc-trade-sdk";
const cms = new TradeCms("https://example.com");

Prepare the transaction data

javascript
const preparedExchangeTx = await cms.prepareTxTokenExchange(
  "methodName", // Name of the method to call on the contract
  { arg1: "value1", arg2: "value2" }, // Arguments to pass to the method
  "token-exchange-id", // Token Exchange identifier
  "Optional memo" // Optional memo to attach to the transaction
);

This method prepares the transaction data for a specific token exchange operation in the CMS. The parameters include the method name, arguments, token exchange ID, and an optional memo.