Skip to content

Check Attachments of TradeToken

To check the attachments associated with a specific trade token, you can use the getAttachments method provided by the TradeTokenContract class. Here is an example of how to do this:

  1. Import the TradeTokenContract from the skc-sdk.
  2. Initialize the TradeTokenContract with the contract address, a signer or provider, and the RPC URL.
  3. Call the getAttachments method to retrieve and parse all AttachmentAdded events from the contract.

Here is a sample code snippet:

typescript
import { TradeTokenContract } from "skc-sdk";
const provider = new ethers.JsonRpcProvider("http://localhost:8545");
const signer = provider.getSigner();
const tradeToken = new TradeTokenContract("0xYourTradeTokenContractAddress", signer, "http://localhost:8545");
const attachments = await tradeToken.getAttachments();

This code will fetch the attachments associated with the specified trade token contract address.