UNPKG

aftermath-ts-sdk

Version:
207 lines 8.79 kB
import { ConfigAddresses } from "../types/configTypes"; import { PoolsApi } from "../../packages/pools/api/poolsApi"; import { FaucetApi } from "../../packages/faucet/api/faucetApi"; import { CoinApi } from "../../packages/coin/api/coinApi"; import { DynamicFieldsApiHelpers } from "../apiHelpers/dynamicFieldsApiHelpers"; import { EventsApiHelpers } from "../apiHelpers/eventsApiHelpers"; import { InspectionsApiHelpers } from "../apiHelpers/inspectionsApiHelpers"; import { ObjectsApiHelpers } from "../apiHelpers/objectsApiHelpers"; import { TransactionsApiHelpers } from "../apiHelpers/transactionsApiHelpers"; import { SuiApi } from "../../packages/sui/api/suiApi"; import { WalletApi } from "../wallet/walletApi"; import { RouterApi } from "../../packages/router/api/routerApi"; import { SuiFrensApi } from "../../packages/suiFrens/api/suiFrensApi"; import { StakingApi } from "../../packages/staking/api/stakingApi"; import { NftAmmApi } from "../../packages/nftAmm/api/nftAmmApi"; import { ReferralVaultApi } from "../../packages/referralVault/api/referralVaultApi"; import { ModuleName, MoveErrorCode, ObjectId } from "../../types"; import { PerpetualsApi } from "../../packages/perpetuals/api/perpetualsApi"; import { OracleApi } from "../../packages/oracle/api/oracleApi"; import { FarmsApi } from "../../packages/farms/api/farmsApi"; import { SuiClient } from "@mysten/sui/client"; import { DcaApi } from "../../packages/dca/api/dcaApi"; import { LeveragedStakingApi } from "../../packages/leveragedStaking/api/leveragedStakingApi"; import { NftsApi } from "../nfts/nftsApi"; import { MoveErrorsInterface } from "../types/moveErrorsInterface"; import { MultisigApi } from "../../packages/multisig/api/multisigApi"; import { UserDataApi } from "../../packages/userData/api/userDataApi"; import { LimitOrdersApi } from "../../packages/limitOrders/api/limitOrdersApi"; /** * The `AftermathApi` class is a low-level factory and reference point for * interacting directly with underlying API modules (e.g., PoolsApi, StakingApi). * It encapsulates a configured `SuiClient` and the known `addresses` for the * Aftermath protocol, allowing flexible or advanced usage scenarios. * * @example * ```typescript * import { AftermathApi } from "aftermath-ts-sdk"; * import { SuiClient, SuiHTTPTransport } from "@mysten/sui/client"; * * const addresses = { ... }; // from aftermath.getAddresses() * const suiClient = new SuiClient({ * transport: new SuiHTTPTransport({ * url: "https://fullnode.mainnet.sui.io", * }), * }); * * const afApi = new AftermathApi(suiClient, addresses); * // access protocol APIs * const poolsApi = afApi.Pools(); * ``` */ export declare class AftermathApi { readonly provider: SuiClient; readonly addresses: ConfigAddresses; /** * Static helper references for quick usage without instantiating the class. */ static helpers: { /** Helpers for accessing or iterating over dynamic fields in Sui objects. */ dynamicFields: typeof DynamicFieldsApiHelpers; /** Helpers for working with Sui events and pagination. */ events: typeof EventsApiHelpers; /** Helpers for reading on-chain data in an "inspection" manner (designed for Summaries). */ inspections: typeof InspectionsApiHelpers; /** Helpers for retrieving and parsing Sui objects by ID or type. */ objects: typeof ObjectsApiHelpers; /** Helpers for reading transaction data (by digest, query, etc.). */ transactions: typeof TransactionsApiHelpers; /** Helper for wallet-based operations, separate from the main `Wallet` classes. */ wallet: typeof WalletApi; /** Low-level direct coin operations, separate from the higher-level `Coin` class. */ coin: typeof CoinApi; /** Low-level Sui chain data ops, separate from the higher-level `Sui` class. */ sui: typeof SuiApi; }; /** * Constructs a new instance of the `AftermathApi`, binding the given Sui client * to the known `addresses`. * * @param provider - The `SuiClient` for on-chain queries and transactions. * @param addresses - The config addresses (object IDs, package IDs, etc.) for the Aftermath protocol. */ constructor(provider: SuiClient, addresses: ConfigAddresses); /** * Creates a new `DynamicFieldsApiHelpers` instance for complex object field queries. */ DynamicFields: () => DynamicFieldsApiHelpers; /** * Creates a new `EventsApiHelpers` instance for querying Sui events. */ Events: () => EventsApiHelpers; /** * Creates a new `InspectionsApiHelpers` instance for reading Summaries or inspection data. */ Inspections: () => InspectionsApiHelpers; /** * Creates a new `ObjectsApiHelpers` instance for object retrieval/manipulation. */ Objects: () => ObjectsApiHelpers; /** * Creates a new `TransactionsApiHelpers` instance for querying or parsing transaction data. */ Transactions: () => TransactionsApiHelpers; /** * Creates a new `WalletApi` instance for direct wallet-based operations (fetching balances, etc.). */ Wallet: () => WalletApi; /** * Creates a new `NftsApi` instance for retrieving and interacting with NFT data. */ Nfts: () => NftsApi; /** * Creates a new `CoinApi` instance for detailed coin operations. */ Coin: () => CoinApi; /** * Creates a new `SuiApi` instance for lower-level Sui chain interactions. */ Sui: () => SuiApi; /** * Creates a new `PoolsApi` instance for pool-related interactions (AMM pools, liquidity, etc.). */ Pools: () => PoolsApi; /** * Creates a new `FaucetApi` instance for dispensing tokens on supported dev/test networks. */ Faucet: () => FaucetApi; /** * Creates a new `SuiFrensApi` instance for special social or token gating utilities on Sui. */ SuiFrens: () => SuiFrensApi; /** * Creates a new `StakingApi` instance for advanced or direct staking operations on Sui. */ Staking: () => StakingApi; /** * Creates a new `NftAmmApi` instance for NFT AMM logic (buy, sell, liquidity). */ NftAmm: () => NftAmmApi; /** * Creates a new `ReferralVaultApi` instance for referral-based logic in Aftermath. */ ReferralVault: () => ReferralVaultApi; /** * Creates a new `PerpetualsApi` instance for futures or perpetual derivatives on Sui. */ Perpetuals: () => PerpetualsApi; /** * Creates a new `OracleApi` instance for price or data feed oracles. */ Oracle: () => OracleApi; /** * Creates a new `FarmsApi` instance for yield farming or liquidity mining interactions. */ Farms: () => FarmsApi; /** * Creates a new `DcaApi` instance for dollar-cost averaging logic. */ Dca: () => DcaApi; /** * Creates a new `MultisigApi` instance for multi-signature address creation and management. */ Multisig: () => MultisigApi; /** * Creates a new `LimitOrdersApi` instance for placing limit orders on supported DEX protocols. */ LimitOrders: () => LimitOrdersApi; /** * Creates a new `UserDataApi` instance for managing user-specific data storage or sign-on logic. */ UserData: () => UserDataApi; /** * Creates a new `RouterApi` instance for best-price trade routing across multiple DEX liquidity sources. */ Router: () => RouterApi; /** * Creates a new `LeveragedStakingApi` instance for leveraged staking operations, * optionally using `ScallopProviders` if needed. * * @param ScallopProviders - An optional object containing references to Scallop's Sui modules or providers. */ LeveragedStaking: (ScallopProviders?: any) => LeveragedStakingApi; /** * Attempts to decode a Move error message into a structured error code, * package ID, module name, and descriptive error string. * * @param inputs - An object containing the raw `errorMessage`. * @returns An object with `errorCode`, `packageId`, `module`, and `error` if translation is successful, or `undefined`. * * @example * ```typescript * const errorDecoded = afApi.translateMoveErrorMessage({ errorMessage: "MoveAbort at ..." }); * if (errorDecoded) { * console.log(errorDecoded.errorCode, errorDecoded.error); * } * ``` */ translateMoveErrorMessage: <T extends MoveErrorsInterface>(inputs: { errorMessage: string; }) => { errorCode: MoveErrorCode; packageId: ObjectId; module: ModuleName; error: string; } | undefined; } //# sourceMappingURL=aftermathApi.d.ts.map