Appearance
Token Custody Creation and Fetching its detail
To create a new Token Custody using TradeCms, you should use the createTokenCustody
method provided by the TradeCms SDK. Here is an example of how to do this:
Create Token Custody
javascript
import { TradeCms } from "skc-trade-sdk";
const cms = new TradeCms("https://example.com");
const tokenCustody = await cms.createTokenCustody(
"MyCustody",
"offset-value",
"https://example.com/custody",
"Locked",
"Optional memo"
);
This method requires the following parameters:
name
: The name of the token custody.offset
: An offset value.uri
: The URI associated with the token custody.type
: The type of the token custody.memo
(Optional): An optional memo to attach to the creation request.
After creating the Token Custody, you can retrieve its details using the TokenCustodyContract
. Here is an example of how to initialize the TokenCustodyContract
and fetch the details:
Fetching Details from TokenCustodyContract
javascript
import { ethers } from 'ethers';
import { TokenCustodyContract } from 'skc-sdk';
const provider = new ethers.JsonRpcProvider("http://localhost:8545");
const signer = provider.getSigner();
// Initialize using Provider
const tokenCustodyContract = new TokenCustodyContract("0xTokenCustodyContractAddress", provider, "http://localhost:8545");
// Retrieve Token Details
const details = await tokenCustodyContract.getDetails();
In this example:
- Replace
"0xTokenCustodyContractAddress"
with the actual contract address of the Token Custody. - The
getDetails
method retrieves all relevant details of the token custody.