入门

适用于 Sui 的 Aftermath Finance 官方脚本类型SDK

安装

npm i aftermath-ts-sdk

使用方法

创建一个 Aftermath 实例,以便于调用我们的服务器,或创建一个 Aftermath API 实例,以便更精细地控制事务构建。

Aftermath SDK

1.创建 Aftermath provider

const afSdk = new Aftermath("MAINNET"); // "MAINNET" | "TESTNET" | "DEVNET"
await afSdk.init(); // initialize provider

2.创建 new protocol provider

const router = afSdk.Router();

const pools = afSdk.Pools();

const staking = afSdk.Staking();

const farms = afSdk.Farms();

Aftermath API

1.创建 Aftermath API provider

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.创建 new protocol provider

const poolsApi = afApi.Pools();

const stakinApi = afApi.Staking();

const farmsApi = afApi.Farms();

Last updated