Super Tokens - SDK Core
Perform basic transfers, approvals, token wrapping & unwrapping using the SDK Core
The SuperToken class can also be accessed via the Framework class and allows you read from/write to the blockchain. It also provides write functions for both the CFAV1 and IDAV1 contracts in the context of the token. That is, the token field for these different methods will be the token address specified during the creation of this class.
Framework based initialization
import { Framework } from "@superfluid-finance/sdk-core";
import { ethers } from "ethers";
const provider = new ethers.providers.InfuraProvider(
"matic",
"<INFURA_API_KEY>"
);
const sf = await Framework.create({
networkName: "matic",
provider
});
const usdcx = await sf.loadSuperToken("0xCAa7349CEA390F89641fe306D93591f87595dc1F");Direct Initialization
import { SuperToken } from "@superfluid-finance/sdk-core";
import { ethers } from "ethers";
const provider = new ethers.providers.InfuraProvider(
"matic",
"<INFURA_API_KEY>"
);
const config = {
hostAddress: "0x3E14dC1b13c488a8d5D310918780c983bD5982E7",
cfaV1Address: "0x6EeE6060f715257b970700bc2656De21dEdF074C",
idaV1Address: "0xB0aABBA4B2783A72C52956CDEF62d438ecA2d7a1"
};
const usdcx = await SuperToken.create({
address: "0xCAa7349CEA390F89641fe306D93591f87595dc1F",
config,
networkName: "matic", // you can also pass in chainId instead (e.g. chainId: 137)
provider
});SuperToken Functions
Example Usage
Note: you can also get the underlying Token object which only has ERC20 token read/write methods-this is useful for things like approving token spend to a SuperToken contract prior to upgrading for example.
Last updated
Was this helpful?

