aftermath-ts-sdk
Version:
Aftermath TypeScript SDK
194 lines • 7.54 kB
TypeScript
import { Pools } from "../../packages/pools/pools";
import { CoinType, ConfigAddresses, SuiAddress, SuiNetwork, Url } from "../../types";
import { Wallet } from "../wallet/wallet";
import { SuiFrens } from "../../packages/suiFrens/suiFrens";
import { Coin } from "../../packages/coin/coin";
import { Faucet } from "../../packages/faucet/faucet";
import { Staking } from "../../packages/staking/staking";
import { Helpers } from "../utils/helpers";
import { Casting } from "../utils/casting";
import { Caller } from "../utils/caller";
import { Prices } from "../prices/prices";
import { Auth, LeveragedStaking, NftAmm, ReferralVault, Router, Sui } from "../../packages";
import { Perpetuals } from "../../packages/perpetuals";
import { Oracle } from "../../packages/oracle/oracle";
import { Farms } from "../../packages/farms/farms";
import { DynamicGas } from "../dynamicGas/dynamicGas";
import { AftermathApi } from "./aftermathApi";
import { Dca } from "../../packages/dca/dca";
import { Multisig } from "../../packages/multisig/multisig";
import { LimitOrders } from "../../packages/limitOrders/limitOrders";
import { UserData } from "../../packages/userData/userData";
/**
* The `Aftermath` class serves as the primary entry point for interacting with
* the Aftermath Finance protocols and utilities on the Sui blockchain.
* It provides various sub-providers (e.g. `Router`, `Staking`, `Farms`)
* initialized under the specified network environment (MAINNET, TESTNET, etc).
*
* @example
* ```typescript
* // Create provider
* const aftermath = new Aftermath("MAINNET");
* // Create package provider
* const router = aftermath.Router();
* // Call sdk from package provider
* const supportedCoins = await router.getSupportedCoins();
*
* // Or do it all in one go
* const supportedCoins = await (new Aftermath("MAINNET")).Router().getSupportedCoins();
* ```
*/
export declare class Aftermath extends Caller {
private readonly network?;
private Provider?;
/**
* Creates an `Aftermath` provider instance to call the Aftermath Finance APIs
* and interact with Sui-based protocols.
*
* @param network - The target Sui network ("MAINNET", "TESTNET", "DEVNET", or "LOCAL").
* @param Provider - Optionally pass a custom `AftermathApi` instance if you already have one.
*/
constructor(network?: SuiNetwork | undefined, Provider?: AftermathApi | undefined);
/**
* Initializes the Aftermath provider by fetching addresses from the backend
* and configuring the Sui fullnode client. This method must be called before
* performing many API operations.
*
* @param inputs - Optional object allowing you to override the default `fullnodeUrl`.
* @example
* ```typescript
* const afSdk = new Aftermath("MAINNET");
* await afSdk.init(); // sets up internal providers
* ```
*/
init(inputs?: {
fullnodeUrl: Url;
}): Promise<void>;
/**
* Retrieves the Aftermath-specific on-chain addresses (object IDs, packages, etc.).
*
* @returns A `ConfigAddresses` object containing relevant addresses for the protocol.
*
* @example
* ```typescript
* const addresses = await aftermath.getAddresses();
* console.log(addresses); // { routerPackageId: "...", someOtherPackageId: "..." }
* ```
*/
getAddresses(): Promise<ConfigAddresses>;
/**
* Returns the base URL used for Aftermath API calls.
*
* @returns The base URL for this instance's API.
*
* @example
* ```typescript
* const apiBaseUrl = aftermath.getApiBaseUrl();
* console.log(apiBaseUrl); // "https://api.after..."
* ```
*/
getApiBaseUrl(): string | undefined;
/**
* Returns an instance of the `Pools` class, which handles DEX pool operations
* within the Aftermath platform (if supported).
*/
Pools: () => Pools;
/**
* Returns an instance of the `Staking` class for Aftermath's staking and unstaking features.
*/
Staking: () => Staking;
/**
* Returns an instance of `LeveragedStaking` for advanced leveraged staking workflows (if supported).
*/
LeveragedStaking: () => LeveragedStaking;
/**
* Returns an instance of `SuiFrens`, a specialized package for social or utility services.
*/
SuiFrens: () => SuiFrens;
/**
* Returns an instance of `Faucet`, allowing test/dev networks to dispense tokens.
*/
Faucet: () => Faucet;
/**
* Returns an instance of the `Router` class, which handles smart order routing
* across multiple DEX protocols.
*/
Router: () => Router;
/**
* Returns an instance of `NftAmm`, which supports NFT AMM (automated market maker) features.
*/
NftAmm: () => NftAmm;
/**
* Returns an instance of `ReferralVault` for referral-based interactions in the protocol.
*/
ReferralVault: () => ReferralVault;
/**
* Returns an instance of `Perpetuals` for futures or perpetual contract interactions.
*/
Perpetuals: () => Perpetuals;
/**
* Returns an instance of `Oracle`, which provides price oracles or other data feed services.
*/
Oracle: () => Oracle;
/**
* Returns an instance of `Farms` for yield farming or liquidity mining functionalities.
*/
Farms: () => Farms;
/**
* Returns an instance of the `Dca` class, supporting dollar-cost averaging logic.
*/
Dca: () => Dca;
/**
* Returns an instance of `Multisig`, enabling multi-signature address creation and management.
*/
Multisig: () => Multisig;
/**
* Returns an instance of `LimitOrders`, supporting limit order placement on certain DEX protocols.
*/
LimitOrders: () => LimitOrders;
/**
* Returns an instance of `UserData` for creating and managing user-specific data or key storage.
*/
UserData: () => UserData;
/**
* Returns an instance of `Sui` for low-level Sui chain information and utilities.
*/
Sui: () => Sui;
/**
* Returns an instance of `Prices`, which provides coin price data from external or internal feeds.
*/
Prices: () => Prices;
/**
* Creates a new `Wallet` instance for a specific user address, enabling you to fetch balances,
* transaction history, etc.
*
* @param address - The Sui address of the wallet (e.g., "0x<32_byte_hex>").
*/
Wallet: (address: SuiAddress) => Wallet;
/**
* Returns an instance of the `Coin` class, which handles coin metadata, decimal conversions,
* and other coin-related utilities for a specified `CoinType`.
*
* @param coinType - Optionally specify a coin type for immediate usage in coin methods.
*/
Coin: (coinType?: CoinType) => Coin;
/**
* Returns an instance of `DynamicGas`, enabling dynamic assignment of gas
* objects or sponsored transactions for user operations.
*/
DynamicGas: () => DynamicGas;
/**
* Returns an instance of `Auth`, handling user authentication or token-based flows (if applicable).
*/
Auth: () => Auth;
/**
* Exposes a set of helper functions for general-purpose usage across
* the Aftermath ecosystem. Includes utilities for math, logging, etc.
*/
static helpers: typeof Helpers;
/**
* Exposes a set of casting utilities for data type conversions (e.g., BigInt <-> fixed).
*/
static casting: typeof Casting;
}
//# sourceMappingURL=aftermath.d.ts.map