Create an instance of Aftermath for ease of use to make calls to our server, or create an instance of Aftermath API for finer control of transaction construction.
1. Create Aftermath provider
Copy const afSdk = new Aftermath ( "MAINNET" ); // "MAINNET" | "TESTNET" | "DEVNET"
await afSdk .init (); // initialize provider
2. Create protocol provider
Copy const router = afSdk .Router ();
const pools = afSdk .Pools ();
const staking = afSdk .Staking ();
const farms = afSdk .Farms ();
1. Create Aftermath API provider
Copy const fullnodeEndpoint = "https://fullnode.mainnet.sui.io" ;
const addresses = { ... };
const afApi = new AftermathApi (
new SuiClient ({
transport : new SuiHTTPTransport ({
url : fullnodeEndpoint ,
}) ,
}) ,
addresses ,
new IndexerCaller ( "MAINNET" ) , // "MAINNET" | "TESTNET" | "DEVNET"
);
2. Create new protocol provider
Copy const poolsApi = afApi .Pools ();
const stakinApi = afApi .Staking ();
const farmsApi = afApi .Farms ();