aftermath-ts-sdk 1.2.51 → 1.2.52-perps.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +62 -28
- package/dist/general/apiHelpers/eventsApiHelpers.d.ts +1 -1
- package/dist/general/apiHelpers/eventsApiHelpers.d.ts.map +1 -1
- package/dist/general/apiHelpers/eventsApiHelpers.js +4 -1
- package/dist/general/apiHelpers/transactionsApiHelpers.d.ts +6 -0
- package/dist/general/apiHelpers/transactionsApiHelpers.d.ts.map +1 -1
- package/dist/general/apiHelpers/transactionsApiHelpers.js +46 -0
- package/dist/general/dynamicGas/dynamicGas.d.ts +34 -0
- package/dist/general/dynamicGas/dynamicGas.d.ts.map +1 -1
- package/dist/general/dynamicGas/dynamicGas.js +34 -0
- package/dist/general/dynamicGas/dynamicGasTypes.d.ts +25 -0
- package/dist/general/dynamicGas/dynamicGasTypes.d.ts.map +1 -1
- package/dist/general/prices/coinGeckoTypes.d.ts +2 -0
- package/dist/general/prices/coinGeckoTypes.d.ts.map +1 -1
- package/dist/general/prices/prices.d.ts +73 -0
- package/dist/general/prices/prices.d.ts.map +1 -1
- package/dist/general/prices/prices.js +73 -0
- package/dist/general/providers/aftermath.d.ts +107 -27
- package/dist/general/providers/aftermath.d.ts.map +1 -1
- package/dist/general/providers/aftermath.js +110 -30
- package/dist/general/providers/aftermathApi.d.ts +128 -10
- package/dist/general/providers/aftermathApi.d.ts.map +1 -1
- package/dist/general/providers/aftermathApi.js +133 -14
- package/dist/general/types/castingTypes.d.ts +15 -7
- package/dist/general/types/castingTypes.d.ts.map +1 -1
- package/dist/general/types/castingTypes.js +6 -0
- package/dist/general/types/configTypes.d.ts +14 -8
- package/dist/general/types/configTypes.d.ts.map +1 -1
- package/dist/general/types/generalTypes.d.ts +229 -7
- package/dist/general/types/generalTypes.d.ts.map +1 -1
- package/dist/general/types/moveErrorsInterface.d.ts +1 -1
- package/dist/general/types/moveErrorsInterface.d.ts.map +1 -1
- package/dist/general/types/suiTypes.d.ts +0 -16
- package/dist/general/types/suiTypes.d.ts.map +1 -1
- package/dist/general/types/suiTypes.js +3 -25
- package/dist/general/utils/caller.d.ts +6 -3
- package/dist/general/utils/caller.d.ts.map +1 -1
- package/dist/general/utils/caller.js +22 -4
- package/dist/general/utils/casting.d.ts +156 -5
- package/dist/general/utils/casting.d.ts.map +1 -1
- package/dist/general/utils/casting.js +159 -18
- package/dist/general/utils/fixedUtils.d.ts +89 -2
- package/dist/general/utils/fixedUtils.d.ts.map +1 -1
- package/dist/general/utils/fixedUtils.js +81 -4
- package/dist/general/utils/helpers.d.ts +327 -10
- package/dist/general/utils/helpers.d.ts.map +1 -1
- package/dist/general/utils/helpers.js +409 -91
- package/dist/general/utils/iFixedUtils.d.ts +64 -0
- package/dist/general/utils/iFixedUtils.d.ts.map +1 -1
- package/dist/general/utils/iFixedUtils.js +64 -0
- package/dist/general/wallet/wallet.d.ts +76 -1
- package/dist/general/wallet/wallet.d.ts.map +1 -1
- package/dist/general/wallet/wallet.js +75 -5
- package/dist/packages/auth/auth.d.ts +113 -4
- package/dist/packages/auth/auth.d.ts.map +1 -1
- package/dist/packages/auth/auth.js +190 -59
- package/dist/packages/auth/authTypes.d.ts +66 -0
- package/dist/packages/auth/authTypes.d.ts.map +1 -1
- package/dist/packages/coin/api/coinApi.d.ts.map +1 -1
- package/dist/packages/coin/api/coinApi.js +29 -20
- package/dist/packages/coin/coin.d.ts +256 -1
- package/dist/packages/coin/coin.d.ts.map +1 -1
- package/dist/packages/coin/coin.js +246 -15
- package/dist/packages/coin/coinTypes.d.ts +95 -0
- package/dist/packages/coin/coinTypes.d.ts.map +1 -1
- package/dist/packages/dca/api/dcaApi.d.ts +2 -0
- package/dist/packages/dca/api/dcaApi.d.ts.map +1 -1
- package/dist/packages/dca/api/dcaApi.js +6 -3
- package/dist/packages/dca/dca.d.ts +125 -35
- package/dist/packages/dca/dca.d.ts.map +1 -1
- package/dist/packages/dca/dca.js +135 -43
- package/dist/packages/dca/dcaTypes.d.ts +217 -42
- package/dist/packages/dca/dcaTypes.d.ts.map +1 -1
- package/dist/packages/farms/api/farmsApi.d.ts +725 -58
- package/dist/packages/farms/api/farmsApi.d.ts.map +1 -1
- package/dist/packages/farms/api/farmsApi.js +1149 -153
- package/dist/packages/farms/api/farmsApiCasting.d.ts +34 -18
- package/dist/packages/farms/api/farmsApiCasting.d.ts.map +1 -1
- package/dist/packages/farms/api/farmsApiCasting.js +218 -17
- package/dist/packages/farms/api/farmsApiCastingTypes.d.ts +117 -21
- package/dist/packages/farms/api/farmsApiCastingTypes.d.ts.map +1 -1
- package/dist/packages/farms/farms.d.ts +200 -12
- package/dist/packages/farms/farms.d.ts.map +1 -1
- package/dist/packages/farms/farms.js +204 -50
- package/dist/packages/farms/farmsStakedPosition.d.ts +143 -8
- package/dist/packages/farms/farmsStakedPosition.d.ts.map +1 -1
- package/dist/packages/farms/farmsStakedPosition.js +243 -137
- package/dist/packages/farms/farmsStakingPool.d.ts +171 -3
- package/dist/packages/farms/farmsStakingPool.d.ts.map +1 -1
- package/dist/packages/farms/farmsStakingPool.js +233 -73
- package/dist/packages/farms/farmsTypes.d.ts +310 -2
- package/dist/packages/farms/farmsTypes.d.ts.map +1 -1
- package/dist/packages/farms/farmsTypes.js +47 -0
- package/dist/packages/faucet/api/faucetApi.d.ts +9 -17
- package/dist/packages/faucet/api/faucetApi.d.ts.map +1 -1
- package/dist/packages/faucet/api/faucetApi.js +44 -49
- package/dist/packages/faucet/api/faucetApiCasting.d.ts.map +1 -1
- package/dist/packages/faucet/api/faucetApiCasting.js +8 -5
- package/dist/packages/faucet/api/faucetApiCastingTypes.d.ts +1 -4
- package/dist/packages/faucet/api/faucetApiCastingTypes.d.ts.map +1 -1
- package/dist/packages/faucet/faucet.d.ts +1 -1
- package/dist/packages/faucet/faucet.d.ts.map +1 -1
- package/dist/packages/faucet/faucet.js +1 -1
- package/dist/packages/faucet/faucetTypes.d.ts +2 -3
- package/dist/packages/faucet/faucetTypes.d.ts.map +1 -1
- package/dist/packages/limitOrders/api/limitOrdersApi.d.ts +12 -0
- package/dist/packages/limitOrders/api/limitOrdersApi.d.ts.map +1 -0
- package/dist/packages/limitOrders/api/limitOrdersApi.js +25 -0
- package/dist/packages/limitOrders/index.d.ts +2 -0
- package/dist/packages/limitOrders/index.d.ts.map +1 -0
- package/dist/packages/limitOrders/index.js +17 -0
- package/dist/packages/limitOrders/limitOrders.d.ts +143 -0
- package/dist/packages/limitOrders/limitOrders.d.ts.map +1 -0
- package/dist/packages/limitOrders/limitOrders.js +190 -0
- package/dist/packages/limitOrders/limitOrdersTypes.d.ts +211 -0
- package/dist/packages/limitOrders/limitOrdersTypes.d.ts.map +1 -0
- package/dist/packages/multisig/multisig.d.ts +34 -5
- package/dist/packages/multisig/multisig.d.ts.map +1 -1
- package/dist/packages/multisig/multisig.js +33 -4
- package/dist/packages/multisig/multisigTypes.d.ts +17 -0
- package/dist/packages/multisig/multisigTypes.d.ts.map +1 -1
- package/dist/packages/nftAmm/nftAmm.d.ts +1 -1
- package/dist/packages/nftAmm/nftAmm.d.ts.map +1 -1
- package/dist/packages/perpetuals/api/perpetualsApi.d.ts +38 -23
- package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +1 -1
- package/dist/packages/perpetuals/api/perpetualsApi.js +740 -299
- package/dist/packages/perpetuals/api/perpetualsApiCasting.d.ts +10 -6
- package/dist/packages/perpetuals/api/perpetualsApiCasting.d.ts.map +1 -1
- package/dist/packages/perpetuals/api/perpetualsApiCasting.js +112 -42
- package/dist/packages/perpetuals/perpetuals.d.ts +33 -4
- package/dist/packages/perpetuals/perpetuals.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetuals.js +105 -18
- package/dist/packages/perpetuals/perpetualsAccount.d.ts +107 -33
- package/dist/packages/perpetuals/perpetualsAccount.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsAccount.js +569 -68
- package/dist/packages/perpetuals/perpetualsCastingTypes.d.ts +104 -25
- package/dist/packages/perpetuals/perpetualsCastingTypes.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsMarket.d.ts +31 -9
- package/dist/packages/perpetuals/perpetualsMarket.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsMarket.js +85 -77
- package/dist/packages/perpetuals/perpetualsTypes.d.ts +348 -380
- package/dist/packages/perpetuals/perpetualsTypes.d.ts.map +1 -1
- package/dist/packages/perpetuals/perpetualsTypes.js +43 -113
- package/dist/packages/pools/api/poolsApiCasting.d.ts.map +1 -1
- package/dist/packages/pools/api/poolsApiCasting.js +0 -1
- package/dist/packages/pools/pool.d.ts +333 -106
- package/dist/packages/pools/pool.d.ts.map +1 -1
- package/dist/packages/pools/pool.js +347 -119
- package/dist/packages/pools/pools.d.ts +307 -39
- package/dist/packages/pools/pools.d.ts.map +1 -1
- package/dist/packages/pools/pools.js +323 -54
- package/dist/packages/pools/poolsTypes.d.ts +267 -2
- package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
- package/dist/packages/referralVault/referralVault.d.ts +38 -1
- package/dist/packages/referralVault/referralVault.d.ts.map +1 -1
- package/dist/packages/referralVault/referralVault.js +37 -0
- package/dist/packages/router/api/routerApi.d.ts +2 -2
- package/dist/packages/router/api/routerApi.d.ts.map +1 -1
- package/dist/packages/router/api/routerApi.js +19 -11
- package/dist/packages/router/router.d.ts +214 -18
- package/dist/packages/router/router.d.ts.map +1 -1
- package/dist/packages/router/router.js +216 -20
- package/dist/packages/router/routerTypes.d.ts +202 -17
- package/dist/packages/router/routerTypes.d.ts.map +1 -1
- package/dist/packages/staking/staking.d.ts +306 -45
- package/dist/packages/staking/staking.d.ts.map +1 -1
- package/dist/packages/staking/staking.js +313 -51
- package/dist/packages/staking/stakingTypes.d.ts +431 -6
- package/dist/packages/staking/stakingTypes.d.ts.map +1 -1
- package/dist/packages/staking/stakingTypes.js +19 -0
- package/dist/packages/sui/sui.d.ts +40 -1
- package/dist/packages/sui/sui.d.ts.map +1 -1
- package/dist/packages/sui/sui.js +39 -0
- package/dist/packages/suiFrens/stakedSuiFren.d.ts +1 -1
- package/dist/packages/suiFrens/stakedSuiFren.d.ts.map +1 -1
- package/dist/packages/suiFrens/suiFren.d.ts +1 -1
- package/dist/packages/suiFrens/suiFren.d.ts.map +1 -1
- package/dist/packages/suiFrens/suiFrens.d.ts +1 -1
- package/dist/packages/suiFrens/suiFrens.d.ts.map +1 -1
- package/dist/packages/userData/api/userDataApi.d.ts +6 -0
- package/dist/packages/userData/api/userDataApi.d.ts.map +1 -0
- package/dist/packages/userData/api/userDataApi.js +12 -0
- package/dist/packages/userData/index.d.ts +2 -0
- package/dist/packages/userData/index.d.ts.map +1 -0
- package/dist/packages/userData/index.js +17 -0
- package/dist/packages/userData/userData.d.ts +89 -0
- package/dist/packages/userData/userData.d.ts.map +1 -0
- package/dist/packages/userData/userData.js +119 -0
- package/dist/packages/userData/userDataTypes.d.ts +29 -0
- package/dist/packages/userData/userDataTypes.d.ts.map +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +0 -1
- package/package.json +1 -1
- package/dist/general/historicalData/historicalData.d.ts +0 -15
- package/dist/general/historicalData/historicalData.d.ts.map +0 -1
- package/dist/general/historicalData/historicalData.js +0 -45
- package/dist/general/historicalData/historicalDataTypes.d.ts +0 -10
- package/dist/general/historicalData/historicalDataTypes.d.ts.map +0 -1
- package/dist/packages/dca/api/dcaApiCasting.d.ts +0 -11
- package/dist/packages/dca/api/dcaApiCasting.d.ts.map +0 -1
- package/dist/packages/dca/api/dcaApiCasting.js +0 -186
- package/dist/packages/dca/api/dcaApiCastingTypes.d.ts +0 -142
- package/dist/packages/dca/api/dcaApiCastingTypes.d.ts.map +0 -1
- package/dist/packages/oracle/api/oracleApi.d.ts +0 -13
- package/dist/packages/oracle/api/oracleApi.d.ts.map +0 -1
- package/dist/packages/oracle/api/oracleApi.js +0 -35
- package/dist/packages/oracle/oracle.d.ts +0 -15
- package/dist/packages/oracle/oracle.d.ts.map +0 -1
- package/dist/packages/oracle/oracle.js +0 -46
- package/dist/packages/oracle/oracleTypes.d.ts +0 -2
- package/dist/packages/oracle/oracleTypes.d.ts.map +0 -1
- package/dist/packages/oracle/oracleTypes.js +0 -2
- /package/dist/{general/historicalData/historicalDataTypes.js → packages/limitOrders/limitOrdersTypes.js} +0 -0
- /package/dist/packages/{dca/api/dcaApiCastingTypes.js → userData/userDataTypes.js} +0 -0
|
@@ -10,19 +10,22 @@ import { Casting } from "../utils/casting";
|
|
|
10
10
|
import { Caller } from "../utils/caller";
|
|
11
11
|
import { Prices } from "../prices/prices";
|
|
12
12
|
import { Auth, LeveragedStaking, NftAmm, ReferralVault, Router, Sui } from "../../packages";
|
|
13
|
-
import { HistoricalData } from "../historicalData/historicalData";
|
|
14
13
|
import { Perpetuals } from "../../packages/perpetuals";
|
|
15
|
-
import { Oracle } from "../../packages/oracle/oracle";
|
|
16
14
|
import { Farms } from "../../packages/farms/farms";
|
|
17
15
|
import { DynamicGas } from "../dynamicGas/dynamicGas";
|
|
18
16
|
import { AftermathApi } from "./aftermathApi";
|
|
19
17
|
import { Dca } from "../../packages/dca/dca";
|
|
20
18
|
import { Multisig } from "../../packages/multisig/multisig";
|
|
19
|
+
import { LimitOrders } from "../../packages/limitOrders/limitOrders";
|
|
20
|
+
import { UserData } from "../../packages/userData/userData";
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
22
|
+
* The `Aftermath` class serves as the primary entry point for interacting with
|
|
23
|
+
* the Aftermath Finance protocols and utilities on the Sui blockchain.
|
|
24
|
+
* It provides various sub-providers (e.g. `Router`, `Staking`, `Farms`)
|
|
25
|
+
* initialized under the specified network environment (MAINNET, TESTNET, etc).
|
|
23
26
|
*
|
|
24
27
|
* @example
|
|
25
|
-
* ```
|
|
28
|
+
* ```typescript
|
|
26
29
|
* // Create provider
|
|
27
30
|
* const aftermath = new Aftermath("MAINNET");
|
|
28
31
|
* // Create package provider
|
|
@@ -38,72 +41,149 @@ export declare class Aftermath extends Caller {
|
|
|
38
41
|
private readonly network?;
|
|
39
42
|
private Provider?;
|
|
40
43
|
/**
|
|
41
|
-
* Creates `Aftermath` provider to call
|
|
44
|
+
* Creates an `Aftermath` provider instance to call the Aftermath Finance APIs
|
|
45
|
+
* and interact with Sui-based protocols.
|
|
42
46
|
*
|
|
43
|
-
* @param network - The Sui network
|
|
44
|
-
* @
|
|
47
|
+
* @param network - The target Sui network ("MAINNET", "TESTNET", "DEVNET", or "LOCAL").
|
|
48
|
+
* @param Provider - Optionally pass a custom `AftermathApi` instance if you already have one.
|
|
45
49
|
*/
|
|
46
50
|
constructor(network?: SuiNetwork | undefined, Provider?: AftermathApi | undefined);
|
|
51
|
+
/**
|
|
52
|
+
* Initializes the Aftermath provider by fetching addresses from the backend
|
|
53
|
+
* and configuring the Sui fullnode client. This method must be called before
|
|
54
|
+
* performing many API operations.
|
|
55
|
+
*
|
|
56
|
+
* @param inputs - Optional object allowing you to override the default `fullnodeUrl`.
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
60
|
+
* await afSdk.init(); // sets up internal providers
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
47
63
|
init(inputs?: {
|
|
48
64
|
fullnodeUrl: Url;
|
|
49
65
|
}): Promise<void>;
|
|
50
66
|
/**
|
|
51
|
-
* Retrieves the addresses
|
|
52
|
-
*
|
|
67
|
+
* Retrieves the Aftermath-specific on-chain addresses (object IDs, packages, etc.).
|
|
68
|
+
*
|
|
69
|
+
* @returns A `ConfigAddresses` object containing relevant addresses for the protocol.
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* const addresses = await aftermath.getAddresses();
|
|
74
|
+
* console.log(addresses); // { routerPackageId: "...", someOtherPackageId: "..." }
|
|
75
|
+
* ```
|
|
53
76
|
*/
|
|
54
77
|
getAddresses(): Promise<ConfigAddresses>;
|
|
78
|
+
/**
|
|
79
|
+
* Returns the base URL used for Aftermath API calls.
|
|
80
|
+
*
|
|
81
|
+
* @returns The base URL for this instance's API.
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* ```typescript
|
|
85
|
+
* const apiBaseUrl = aftermath.getApiBaseUrl();
|
|
86
|
+
* console.log(apiBaseUrl); // "https://api.after..."
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
55
89
|
getApiBaseUrl(): string | undefined;
|
|
56
90
|
/**
|
|
57
|
-
* Returns an instance of the Pools class
|
|
58
|
-
*
|
|
91
|
+
* Returns an instance of the `Pools` class, which handles DEX pool operations
|
|
92
|
+
* within the Aftermath platform (if supported).
|
|
59
93
|
*/
|
|
60
94
|
Pools: () => Pools;
|
|
61
95
|
/**
|
|
62
|
-
*
|
|
63
|
-
* @returns A new instance of the Staking class.
|
|
96
|
+
* Returns an instance of the `Staking` class for Aftermath's staking and unstaking features.
|
|
64
97
|
*/
|
|
65
98
|
Staking: () => Staking;
|
|
99
|
+
/**
|
|
100
|
+
* Returns an instance of `LeveragedStaking` for advanced leveraged staking workflows (if supported).
|
|
101
|
+
*/
|
|
66
102
|
LeveragedStaking: () => LeveragedStaking;
|
|
103
|
+
/**
|
|
104
|
+
* Returns an instance of `SuiFrens`, a specialized package for social or utility services.
|
|
105
|
+
*/
|
|
67
106
|
SuiFrens: () => SuiFrens;
|
|
107
|
+
/**
|
|
108
|
+
* Returns an instance of `Faucet`, allowing test/dev networks to dispense tokens.
|
|
109
|
+
*/
|
|
68
110
|
Faucet: () => Faucet;
|
|
69
111
|
/**
|
|
70
|
-
*
|
|
71
|
-
*
|
|
112
|
+
* Returns an instance of the `Router` class, which handles smart order routing
|
|
113
|
+
* across multiple DEX protocols.
|
|
72
114
|
*/
|
|
73
115
|
Router: () => Router;
|
|
116
|
+
/**
|
|
117
|
+
* Returns an instance of `NftAmm`, which supports NFT AMM (automated market maker) features.
|
|
118
|
+
*/
|
|
74
119
|
NftAmm: () => NftAmm;
|
|
120
|
+
/**
|
|
121
|
+
* Returns an instance of `ReferralVault` for referral-based interactions in the protocol.
|
|
122
|
+
*/
|
|
75
123
|
ReferralVault: () => ReferralVault;
|
|
124
|
+
/**
|
|
125
|
+
* Returns an instance of `Perpetuals` for futures or perpetual contract interactions.
|
|
126
|
+
*/
|
|
76
127
|
Perpetuals: () => Perpetuals;
|
|
77
|
-
Oracle: () => Oracle;
|
|
78
128
|
/**
|
|
79
|
-
*
|
|
80
|
-
* @returns A new instance of the Farms class.
|
|
129
|
+
* Returns an instance of `Farms` for yield farming or liquidity mining functionalities.
|
|
81
130
|
*/
|
|
82
131
|
Farms: () => Farms;
|
|
83
132
|
/**
|
|
84
|
-
*
|
|
85
|
-
* @returns A new instance of the DCA class.
|
|
133
|
+
* Returns an instance of the `Dca` class, supporting dollar-cost averaging logic.
|
|
86
134
|
*/
|
|
87
135
|
Dca: () => Dca;
|
|
136
|
+
/**
|
|
137
|
+
* Returns an instance of `Multisig`, enabling multi-signature address creation and management.
|
|
138
|
+
*/
|
|
88
139
|
Multisig: () => Multisig;
|
|
140
|
+
/**
|
|
141
|
+
* Returns an instance of `LimitOrders`, supporting limit order placement on certain DEX protocols.
|
|
142
|
+
*/
|
|
143
|
+
LimitOrders: () => LimitOrders;
|
|
144
|
+
/**
|
|
145
|
+
* Returns an instance of `UserData` for creating and managing user-specific data or key storage.
|
|
146
|
+
*/
|
|
147
|
+
UserData: () => UserData;
|
|
148
|
+
/**
|
|
149
|
+
* Returns an instance of `Sui` for low-level Sui chain information and utilities.
|
|
150
|
+
*/
|
|
89
151
|
Sui: () => Sui;
|
|
152
|
+
/**
|
|
153
|
+
* Returns an instance of `Prices`, which provides coin price data from external or internal feeds.
|
|
154
|
+
*/
|
|
90
155
|
Prices: () => Prices;
|
|
91
156
|
/**
|
|
92
|
-
* Creates a new instance
|
|
93
|
-
*
|
|
94
|
-
*
|
|
157
|
+
* Creates a new `Wallet` instance for a specific user address, enabling you to fetch balances,
|
|
158
|
+
* transaction history, etc.
|
|
159
|
+
*
|
|
160
|
+
* @param address - The Sui address of the wallet (e.g., "0x<32_byte_hex>").
|
|
95
161
|
*/
|
|
96
162
|
Wallet: (address: SuiAddress) => Wallet;
|
|
97
163
|
/**
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
164
|
+
* Returns an instance of the `Coin` class, which handles coin metadata, decimal conversions,
|
|
165
|
+
* and other coin-related utilities for a specified `CoinType`.
|
|
166
|
+
*
|
|
167
|
+
* @param coinType - Optionally specify a coin type for immediate usage in coin methods.
|
|
101
168
|
*/
|
|
102
169
|
Coin: (coinType?: CoinType) => Coin;
|
|
103
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Returns an instance of `DynamicGas`, enabling dynamic assignment of gas
|
|
172
|
+
* objects or sponsored transactions for user operations.
|
|
173
|
+
*/
|
|
104
174
|
DynamicGas: () => DynamicGas;
|
|
175
|
+
/**
|
|
176
|
+
* Returns an instance of `Auth`, handling user authentication or token-based flows (if applicable).
|
|
177
|
+
*/
|
|
105
178
|
Auth: () => Auth;
|
|
179
|
+
/**
|
|
180
|
+
* Exposes a set of helper functions for general-purpose usage across
|
|
181
|
+
* the Aftermath ecosystem. Includes utilities for math, logging, etc.
|
|
182
|
+
*/
|
|
106
183
|
static helpers: typeof Helpers;
|
|
184
|
+
/**
|
|
185
|
+
* Exposes a set of casting utilities for data type conversions (e.g., BigInt <-> fixed).
|
|
186
|
+
*/
|
|
107
187
|
static casting: typeof Casting;
|
|
108
188
|
}
|
|
109
189
|
//# sourceMappingURL=aftermath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aftermath.d.ts","sourceRoot":"","sources":["../../../src/general/providers/aftermath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EACN,QAAQ,EACR,eAAe,EACf,UAAU,EACV,UAAU,EACV,GAAG,EACH,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACN,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,MAAM,EACN,GAAG,EACH,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"aftermath.d.ts","sourceRoot":"","sources":["../../../src/general/providers/aftermath.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EACN,QAAQ,EACR,eAAe,EACf,UAAU,EACV,UAAU,EACV,GAAG,EACH,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EACN,IAAI,EACJ,gBAAgB,EAChB,MAAM,EACN,aAAa,EACb,MAAM,EACN,GAAG,EACH,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,OAAO,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAE5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,SAAU,SAAQ,MAAM;IAanC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC;IACzB,OAAO,CAAC,QAAQ,CAAC;IATlB;;;;;;OAMG;gBAEe,OAAO,CAAC,wBAAY,EAC7B,QAAQ,CAAC,0BAAc;IAYhC;;;;;;;;;;;OAWG;IACU,IAAI,CAAC,MAAM,CAAC,EAAE;QAAE,WAAW,EAAE,GAAG,CAAA;KAAE;IAyB/C;;;;;;;;;;OAUG;IACU,YAAY;IAIzB;;;;;;;;;;OAUG;IACI,aAAa;IAYpB;;;OAGG;IACI,KAAK,cAA+C;IAE3D;;OAEG;IACI,OAAO,gBAAiD;IAE/D;;OAEG;IACI,gBAAgB,yBAA2C;IAElE;;OAEG;IACI,QAAQ,iBAAkD;IAEjE;;OAEG;IACI,MAAM,eAAgD;IAE7D;;;OAGG;IACI,MAAM,eAAiC;IAC9C;;OAEG;IACI,MAAM,eAAgD;IAE7D;;OAEG;IACI,aAAa,sBAAuD;IAE3E;;OAEG;IACI,UAAU,mBAAoD;IAErE;;OAEG;IACI,KAAK,cAA+C;IAE3D;;OAEG;IACI,GAAG,YAA8B;IAExC;;OAEG;IACI,QAAQ,iBAAkD;IAEjE;;OAEG;IACI,WAAW,oBAAsC;IAExD;;OAEG;IACI,QAAQ,iBAAmC;IAMlD;;OAEG;IACI,GAAG,YAA6C;IAEvD;;OAEG;IACI,MAAM,eAAiC;IAE9C;;;;;OAKG;IACI,MAAM,YAAa,UAAU,YACa;IAEjD;;;;;OAKG;IACI,IAAI,cAAe,QAAQ,UACc;IAEhD;;;OAGG;IACI,UAAU,mBAAqC;IAEtD;;OAEG;IACI,IAAI,aAA+B;IAM1C;;;OAGG;IACH,OAAc,OAAO,iBAAW;IAEhC;;OAEG;IACH,OAAc,OAAO,iBAAW;CAChC"}
|
|
@@ -21,21 +21,23 @@ const casting_1 = require("../utils/casting");
|
|
|
21
21
|
const caller_1 = require("../utils/caller");
|
|
22
22
|
const prices_1 = require("../prices/prices");
|
|
23
23
|
const packages_1 = require("../../packages");
|
|
24
|
-
const historicalData_1 = require("../historicalData/historicalData");
|
|
25
24
|
const perpetuals_1 = require("../../packages/perpetuals");
|
|
26
|
-
const oracle_1 = require("../../packages/oracle/oracle");
|
|
27
|
-
// import { PriceFeeds } from "../priceFeeds/priceFeeds";
|
|
28
25
|
const farms_1 = require("../../packages/farms/farms");
|
|
29
26
|
const dynamicGas_1 = require("../dynamicGas/dynamicGas");
|
|
30
27
|
const aftermathApi_1 = require("./aftermathApi");
|
|
31
28
|
const client_1 = require("@mysten/sui/client");
|
|
32
29
|
const dca_1 = require("../../packages/dca/dca");
|
|
33
30
|
const multisig_1 = require("../../packages/multisig/multisig");
|
|
31
|
+
const limitOrders_1 = require("../../packages/limitOrders/limitOrders");
|
|
32
|
+
const userData_1 = require("../../packages/userData/userData");
|
|
34
33
|
/**
|
|
35
|
-
*
|
|
34
|
+
* The `Aftermath` class serves as the primary entry point for interacting with
|
|
35
|
+
* the Aftermath Finance protocols and utilities on the Sui blockchain.
|
|
36
|
+
* It provides various sub-providers (e.g. `Router`, `Staking`, `Farms`)
|
|
37
|
+
* initialized under the specified network environment (MAINNET, TESTNET, etc).
|
|
36
38
|
*
|
|
37
39
|
* @example
|
|
38
|
-
* ```
|
|
40
|
+
* ```typescript
|
|
39
41
|
* // Create provider
|
|
40
42
|
* const aftermath = new Aftermath("MAINNET");
|
|
41
43
|
* // Create package provider
|
|
@@ -52,10 +54,11 @@ class Aftermath extends caller_1.Caller {
|
|
|
52
54
|
// Constructor
|
|
53
55
|
// =========================================================================
|
|
54
56
|
/**
|
|
55
|
-
* Creates `Aftermath` provider to call
|
|
57
|
+
* Creates an `Aftermath` provider instance to call the Aftermath Finance APIs
|
|
58
|
+
* and interact with Sui-based protocols.
|
|
56
59
|
*
|
|
57
|
-
* @param network - The Sui network
|
|
58
|
-
* @
|
|
60
|
+
* @param network - The target Sui network ("MAINNET", "TESTNET", "DEVNET", or "LOCAL").
|
|
61
|
+
* @param Provider - Optionally pass a custom `AftermathApi` instance if you already have one.
|
|
59
62
|
*/
|
|
60
63
|
constructor(network, Provider) {
|
|
61
64
|
super({
|
|
@@ -71,67 +74,118 @@ class Aftermath extends caller_1.Caller {
|
|
|
71
74
|
// Packages
|
|
72
75
|
// =========================================================================
|
|
73
76
|
/**
|
|
74
|
-
* Returns an instance of the Pools class
|
|
75
|
-
*
|
|
77
|
+
* Returns an instance of the `Pools` class, which handles DEX pool operations
|
|
78
|
+
* within the Aftermath platform (if supported).
|
|
76
79
|
*/
|
|
77
80
|
this.Pools = () => new pools_1.Pools(this.config, this.Provider);
|
|
78
81
|
/**
|
|
79
|
-
*
|
|
80
|
-
* @returns A new instance of the Staking class.
|
|
82
|
+
* Returns an instance of the `Staking` class for Aftermath's staking and unstaking features.
|
|
81
83
|
*/
|
|
82
84
|
this.Staking = () => new staking_1.Staking(this.config, this.Provider);
|
|
85
|
+
/**
|
|
86
|
+
* Returns an instance of `LeveragedStaking` for advanced leveraged staking workflows (if supported).
|
|
87
|
+
*/
|
|
83
88
|
this.LeveragedStaking = () => new packages_1.LeveragedStaking(this.config);
|
|
89
|
+
/**
|
|
90
|
+
* Returns an instance of `SuiFrens`, a specialized package for social or utility services.
|
|
91
|
+
*/
|
|
84
92
|
this.SuiFrens = () => new suiFrens_1.SuiFrens(this.config, this.Provider);
|
|
93
|
+
/**
|
|
94
|
+
* Returns an instance of `Faucet`, allowing test/dev networks to dispense tokens.
|
|
95
|
+
*/
|
|
85
96
|
this.Faucet = () => new faucet_1.Faucet(this.config, this.Provider);
|
|
86
97
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
98
|
+
* Returns an instance of the `Router` class, which handles smart order routing
|
|
99
|
+
* across multiple DEX protocols.
|
|
89
100
|
*/
|
|
90
101
|
this.Router = () => new packages_1.Router(this.config);
|
|
102
|
+
/**
|
|
103
|
+
* Returns an instance of `NftAmm`, which supports NFT AMM (automated market maker) features.
|
|
104
|
+
*/
|
|
91
105
|
this.NftAmm = () => new packages_1.NftAmm(this.config, this.Provider);
|
|
106
|
+
/**
|
|
107
|
+
* Returns an instance of `ReferralVault` for referral-based interactions in the protocol.
|
|
108
|
+
*/
|
|
92
109
|
this.ReferralVault = () => new packages_1.ReferralVault(this.config, this.Provider);
|
|
93
|
-
this.Perpetuals = () => new perpetuals_1.Perpetuals(this.config);
|
|
94
|
-
this.Oracle = () => new oracle_1.Oracle(this.config, this.Provider);
|
|
95
110
|
/**
|
|
96
|
-
*
|
|
97
|
-
|
|
111
|
+
* Returns an instance of `Perpetuals` for futures or perpetual contract interactions.
|
|
112
|
+
*/
|
|
113
|
+
this.Perpetuals = () => new perpetuals_1.Perpetuals(this.config, this.Provider);
|
|
114
|
+
/**
|
|
115
|
+
* Returns an instance of `Farms` for yield farming or liquidity mining functionalities.
|
|
98
116
|
*/
|
|
99
117
|
this.Farms = () => new farms_1.Farms(this.config, this.Provider);
|
|
100
118
|
/**
|
|
101
|
-
*
|
|
102
|
-
* @returns A new instance of the DCA class.
|
|
119
|
+
* Returns an instance of the `Dca` class, supporting dollar-cost averaging logic.
|
|
103
120
|
*/
|
|
104
121
|
this.Dca = () => new dca_1.Dca(this.config);
|
|
122
|
+
/**
|
|
123
|
+
* Returns an instance of `Multisig`, enabling multi-signature address creation and management.
|
|
124
|
+
*/
|
|
105
125
|
this.Multisig = () => new multisig_1.Multisig(this.config, this.Provider);
|
|
126
|
+
/**
|
|
127
|
+
* Returns an instance of `LimitOrders`, supporting limit order placement on certain DEX protocols.
|
|
128
|
+
*/
|
|
129
|
+
this.LimitOrders = () => new limitOrders_1.LimitOrders(this.config);
|
|
130
|
+
/**
|
|
131
|
+
* Returns an instance of `UserData` for creating and managing user-specific data or key storage.
|
|
132
|
+
*/
|
|
133
|
+
this.UserData = () => new userData_1.UserData(this.config);
|
|
106
134
|
// =========================================================================
|
|
107
135
|
// General
|
|
108
136
|
// =========================================================================
|
|
137
|
+
/**
|
|
138
|
+
* Returns an instance of `Sui` for low-level Sui chain information and utilities.
|
|
139
|
+
*/
|
|
109
140
|
this.Sui = () => new packages_1.Sui(this.config, this.Provider);
|
|
141
|
+
/**
|
|
142
|
+
* Returns an instance of `Prices`, which provides coin price data from external or internal feeds.
|
|
143
|
+
*/
|
|
110
144
|
this.Prices = () => new prices_1.Prices(this.config);
|
|
111
145
|
/**
|
|
112
|
-
* Creates a new instance
|
|
113
|
-
*
|
|
114
|
-
*
|
|
146
|
+
* Creates a new `Wallet` instance for a specific user address, enabling you to fetch balances,
|
|
147
|
+
* transaction history, etc.
|
|
148
|
+
*
|
|
149
|
+
* @param address - The Sui address of the wallet (e.g., "0x<32_byte_hex>").
|
|
115
150
|
*/
|
|
116
151
|
this.Wallet = (address) => new wallet_1.Wallet(address, this.config, this.Provider);
|
|
117
152
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
153
|
+
* Returns an instance of the `Coin` class, which handles coin metadata, decimal conversions,
|
|
154
|
+
* and other coin-related utilities for a specified `CoinType`.
|
|
155
|
+
*
|
|
156
|
+
* @param coinType - Optionally specify a coin type for immediate usage in coin methods.
|
|
121
157
|
*/
|
|
122
158
|
this.Coin = (coinType) => new coin_1.Coin(coinType, this.config, this.Provider);
|
|
123
|
-
|
|
124
|
-
|
|
159
|
+
/**
|
|
160
|
+
* Returns an instance of `DynamicGas`, enabling dynamic assignment of gas
|
|
161
|
+
* objects or sponsored transactions for user operations.
|
|
162
|
+
*/
|
|
125
163
|
this.DynamicGas = () => new dynamicGas_1.DynamicGas(this.config);
|
|
164
|
+
/**
|
|
165
|
+
* Returns an instance of `Auth`, handling user authentication or token-based flows (if applicable).
|
|
166
|
+
*/
|
|
126
167
|
this.Auth = () => new packages_1.Auth(this.config);
|
|
127
168
|
}
|
|
128
169
|
// =========================================================================
|
|
129
170
|
// Public Methods
|
|
130
171
|
// =========================================================================
|
|
172
|
+
/**
|
|
173
|
+
* Initializes the Aftermath provider by fetching addresses from the backend
|
|
174
|
+
* and configuring the Sui fullnode client. This method must be called before
|
|
175
|
+
* performing many API operations.
|
|
176
|
+
*
|
|
177
|
+
* @param inputs - Optional object allowing you to override the default `fullnodeUrl`.
|
|
178
|
+
* @example
|
|
179
|
+
* ```typescript
|
|
180
|
+
* const afSdk = new Aftermath("MAINNET");
|
|
181
|
+
* await afSdk.init(); // sets up internal providers
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
131
184
|
init(inputs) {
|
|
132
185
|
var _a;
|
|
133
186
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
187
|
const addresses = yield this.getAddresses();
|
|
188
|
+
// Determine the fullnode URL based on the chosen network or user override
|
|
135
189
|
const fullnodeUrl = (_a = inputs === null || inputs === void 0 ? void 0 : inputs.fullnodeUrl) !== null && _a !== void 0 ? _a : (this.network === "LOCAL"
|
|
136
190
|
? "http://127.0.0.1:9000"
|
|
137
191
|
: this.network === "DEVNET"
|
|
@@ -139,6 +193,7 @@ class Aftermath extends caller_1.Caller {
|
|
|
139
193
|
: this.network === "TESTNET"
|
|
140
194
|
? "https://fullnode.testnet.sui.io:443"
|
|
141
195
|
: "https://fullnode.mainnet.sui.io:443");
|
|
196
|
+
// Create a new AftermathApi provider
|
|
142
197
|
this.Provider = new aftermathApi_1.AftermathApi(new client_1.SuiClient({
|
|
143
198
|
transport: new client_1.SuiHTTPTransport({
|
|
144
199
|
url: fullnodeUrl,
|
|
@@ -147,14 +202,32 @@ class Aftermath extends caller_1.Caller {
|
|
|
147
202
|
});
|
|
148
203
|
}
|
|
149
204
|
/**
|
|
150
|
-
* Retrieves the addresses
|
|
151
|
-
*
|
|
205
|
+
* Retrieves the Aftermath-specific on-chain addresses (object IDs, packages, etc.).
|
|
206
|
+
*
|
|
207
|
+
* @returns A `ConfigAddresses` object containing relevant addresses for the protocol.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```typescript
|
|
211
|
+
* const addresses = await aftermath.getAddresses();
|
|
212
|
+
* console.log(addresses); // { routerPackageId: "...", someOtherPackageId: "..." }
|
|
213
|
+
* ```
|
|
152
214
|
*/
|
|
153
215
|
getAddresses() {
|
|
154
216
|
return __awaiter(this, void 0, void 0, function* () {
|
|
155
217
|
return this.fetchApi("addresses");
|
|
156
218
|
});
|
|
157
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Returns the base URL used for Aftermath API calls.
|
|
222
|
+
*
|
|
223
|
+
* @returns The base URL for this instance's API.
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const apiBaseUrl = aftermath.getApiBaseUrl();
|
|
228
|
+
* console.log(apiBaseUrl); // "https://api.after..."
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
158
231
|
getApiBaseUrl() {
|
|
159
232
|
return this.apiBaseUrl;
|
|
160
233
|
}
|
|
@@ -163,5 +236,12 @@ exports.Aftermath = Aftermath;
|
|
|
163
236
|
// =========================================================================
|
|
164
237
|
// Utils
|
|
165
238
|
// =========================================================================
|
|
239
|
+
/**
|
|
240
|
+
* Exposes a set of helper functions for general-purpose usage across
|
|
241
|
+
* the Aftermath ecosystem. Includes utilities for math, logging, etc.
|
|
242
|
+
*/
|
|
166
243
|
Aftermath.helpers = helpers_1.Helpers;
|
|
244
|
+
/**
|
|
245
|
+
* Exposes a set of casting utilities for data type conversions (e.g., BigInt <-> fixed).
|
|
246
|
+
*/
|
|
167
247
|
Aftermath.casting = casting_1.Casting;
|
|
@@ -17,7 +17,6 @@ import { NftAmmApi } from "../../packages/nftAmm/api/nftAmmApi";
|
|
|
17
17
|
import { ReferralVaultApi } from "../../packages/referralVault/api/referralVaultApi";
|
|
18
18
|
import { ModuleName, MoveErrorCode, ObjectId } from "../../types";
|
|
19
19
|
import { PerpetualsApi } from "../../packages/perpetuals/api/perpetualsApi";
|
|
20
|
-
import { OracleApi } from "../../packages/oracle/api/oracleApi";
|
|
21
20
|
import { FarmsApi } from "../../packages/farms/api/farmsApi";
|
|
22
21
|
import { SuiClient } from "@mysten/sui/client";
|
|
23
22
|
import { SuiClient as SuiClientV0 } from "@mysten/sui.js/client";
|
|
@@ -26,57 +25,176 @@ import { LeveragedStakingApi } from "../../packages/leveragedStaking/api/leverag
|
|
|
26
25
|
import { NftsApi } from "../nfts/nftsApi";
|
|
27
26
|
import { MoveErrorsInterface } from "../types/moveErrorsInterface";
|
|
28
27
|
import { MultisigApi } from "../../packages/multisig/api/multisigApi";
|
|
28
|
+
import { UserDataApi } from "../../packages/userData/api/userDataApi";
|
|
29
|
+
import { LimitOrdersApi } from "../../packages/limitOrders/api/limitOrdersApi";
|
|
29
30
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
31
|
+
* The `AftermathApi` class is a low-level factory and reference point for
|
|
32
|
+
* interacting directly with underlying API modules (e.g., PoolsApi, StakingApi).
|
|
33
|
+
* It encapsulates a configured `SuiClient` and the known `addresses` for the
|
|
34
|
+
* Aftermath protocol, allowing flexible or advanced usage scenarios.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* import { AftermathApi } from "aftermath-ts-sdk";
|
|
39
|
+
* import { SuiClient, SuiHTTPTransport } from "@mysten/sui/client";
|
|
40
|
+
*
|
|
41
|
+
* const addresses = { ... }; // from aftermath.getAddresses()
|
|
42
|
+
* const suiClient = new SuiClient({
|
|
43
|
+
* transport: new SuiHTTPTransport({
|
|
44
|
+
* url: "https://fullnode.mainnet.sui.io",
|
|
45
|
+
* }),
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* const afApi = new AftermathApi(suiClient, addresses);
|
|
49
|
+
* // access protocol APIs
|
|
50
|
+
* const poolsApi = afApi.Pools();
|
|
51
|
+
* ```
|
|
32
52
|
*/
|
|
33
53
|
export declare class AftermathApi {
|
|
34
54
|
readonly provider: SuiClient;
|
|
35
55
|
readonly addresses: ConfigAddresses;
|
|
36
56
|
readonly providerV0?: SuiClientV0 | undefined;
|
|
57
|
+
/**
|
|
58
|
+
* Static helper references for quick usage without instantiating the class.
|
|
59
|
+
*/
|
|
37
60
|
static helpers: {
|
|
61
|
+
/** Helpers for accessing or iterating over dynamic fields in Sui objects. */
|
|
38
62
|
dynamicFields: typeof DynamicFieldsApiHelpers;
|
|
63
|
+
/** Helpers for working with Sui events and pagination. */
|
|
39
64
|
events: typeof EventsApiHelpers;
|
|
65
|
+
/** Helpers for reading on-chain data in an "inspection" manner (designed for Summaries). */
|
|
40
66
|
inspections: typeof InspectionsApiHelpers;
|
|
67
|
+
/** Helpers for retrieving and parsing Sui objects by ID or type. */
|
|
41
68
|
objects: typeof ObjectsApiHelpers;
|
|
69
|
+
/** Helpers for reading transaction data (by digest, query, etc.). */
|
|
42
70
|
transactions: typeof TransactionsApiHelpers;
|
|
71
|
+
/** Helper for wallet-based operations, separate from the main `Wallet` classes. */
|
|
43
72
|
wallet: typeof WalletApi;
|
|
73
|
+
/** Low-level direct coin operations, separate from the higher-level `Coin` class. */
|
|
44
74
|
coin: typeof CoinApi;
|
|
75
|
+
/** Low-level Sui chain data ops, separate from the higher-level `Sui` class. */
|
|
45
76
|
sui: typeof SuiApi;
|
|
46
77
|
};
|
|
47
78
|
/**
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
79
|
+
* Constructs a new instance of the `AftermathApi`, binding the given Sui client
|
|
80
|
+
* to the known `addresses`. Optionally, a `providerV0` can be passed for
|
|
81
|
+
* legacy transaction building or older Sui libraries.
|
|
82
|
+
*
|
|
83
|
+
* @param provider - The `SuiClient` for on-chain queries and transactions.
|
|
84
|
+
* @param addresses - The config addresses (object IDs, package IDs, etc.) for the Aftermath protocol.
|
|
85
|
+
* @param providerV0 - An optional legacy `SuiClient` from `@mysten/sui.js/client`.
|
|
52
86
|
*/
|
|
53
87
|
constructor(provider: SuiClient, addresses: ConfigAddresses, providerV0?: SuiClientV0 | undefined);
|
|
88
|
+
/**
|
|
89
|
+
* Creates a new `DynamicFieldsApiHelpers` instance for complex object field queries.
|
|
90
|
+
*/
|
|
54
91
|
DynamicFields: () => DynamicFieldsApiHelpers;
|
|
92
|
+
/**
|
|
93
|
+
* Creates a new `EventsApiHelpers` instance for querying Sui events.
|
|
94
|
+
*/
|
|
55
95
|
Events: () => EventsApiHelpers;
|
|
96
|
+
/**
|
|
97
|
+
* Creates a new `InspectionsApiHelpers` instance for reading Summaries or inspection data.
|
|
98
|
+
*/
|
|
56
99
|
Inspections: () => InspectionsApiHelpers;
|
|
100
|
+
/**
|
|
101
|
+
* Creates a new `ObjectsApiHelpers` instance for object retrieval/manipulation.
|
|
102
|
+
*/
|
|
57
103
|
Objects: () => ObjectsApiHelpers;
|
|
104
|
+
/**
|
|
105
|
+
* Creates a new `TransactionsApiHelpers` instance for querying or parsing transaction data.
|
|
106
|
+
*/
|
|
58
107
|
Transactions: () => TransactionsApiHelpers;
|
|
108
|
+
/**
|
|
109
|
+
* Creates a new `WalletApi` instance for direct wallet-based operations (fetching balances, etc.).
|
|
110
|
+
*/
|
|
59
111
|
Wallet: () => WalletApi;
|
|
112
|
+
/**
|
|
113
|
+
* Creates a new `NftsApi` instance for retrieving and interacting with NFT data.
|
|
114
|
+
*/
|
|
60
115
|
Nfts: () => NftsApi;
|
|
116
|
+
/**
|
|
117
|
+
* Creates a new `CoinApi` instance for detailed coin operations.
|
|
118
|
+
*/
|
|
61
119
|
Coin: () => CoinApi;
|
|
120
|
+
/**
|
|
121
|
+
* Creates a new `SuiApi` instance for lower-level Sui chain interactions.
|
|
122
|
+
*/
|
|
62
123
|
Sui: () => SuiApi;
|
|
124
|
+
/**
|
|
125
|
+
* Creates a new `PoolsApi` instance for pool-related interactions (AMM pools, liquidity, etc.).
|
|
126
|
+
*/
|
|
63
127
|
Pools: () => PoolsApi;
|
|
128
|
+
/**
|
|
129
|
+
* Creates a new `FaucetApi` instance for dispensing tokens on supported dev/test networks.
|
|
130
|
+
*/
|
|
64
131
|
Faucet: () => FaucetApi;
|
|
132
|
+
/**
|
|
133
|
+
* Creates a new `SuiFrensApi` instance for special social or token gating utilities on Sui.
|
|
134
|
+
*/
|
|
65
135
|
SuiFrens: () => SuiFrensApi;
|
|
136
|
+
/**
|
|
137
|
+
* Creates a new `StakingApi` instance for advanced or direct staking operations on Sui.
|
|
138
|
+
*/
|
|
66
139
|
Staking: () => StakingApi;
|
|
140
|
+
/**
|
|
141
|
+
* Creates a new `NftAmmApi` instance for NFT AMM logic (buy, sell, liquidity).
|
|
142
|
+
*/
|
|
67
143
|
NftAmm: () => NftAmmApi;
|
|
144
|
+
/**
|
|
145
|
+
* Creates a new `ReferralVaultApi` instance for referral-based logic in Aftermath.
|
|
146
|
+
*/
|
|
68
147
|
ReferralVault: () => ReferralVaultApi;
|
|
148
|
+
/**
|
|
149
|
+
* Creates a new `PerpetualsApi` instance for futures or perpetual derivatives on Sui.
|
|
150
|
+
*/
|
|
69
151
|
Perpetuals: () => PerpetualsApi;
|
|
70
|
-
|
|
152
|
+
/**
|
|
153
|
+
* Creates a new `FarmsApi` instance for yield farming or liquidity mining interactions.
|
|
154
|
+
*/
|
|
71
155
|
Farms: () => FarmsApi;
|
|
156
|
+
/**
|
|
157
|
+
* Creates a new `DcaApi` instance for dollar-cost averaging logic.
|
|
158
|
+
*/
|
|
72
159
|
Dca: () => DcaApi;
|
|
160
|
+
/**
|
|
161
|
+
* Creates a new `MultisigApi` instance for multi-signature address creation and management.
|
|
162
|
+
*/
|
|
73
163
|
Multisig: () => MultisigApi;
|
|
74
164
|
/**
|
|
75
|
-
* Creates a new instance
|
|
76
|
-
|
|
165
|
+
* Creates a new `LimitOrdersApi` instance for placing limit orders on supported DEX protocols.
|
|
166
|
+
*/
|
|
167
|
+
LimitOrders: () => LimitOrdersApi;
|
|
168
|
+
/**
|
|
169
|
+
* Creates a new `UserDataApi` instance for managing user-specific data storage or sign-on logic.
|
|
170
|
+
*/
|
|
171
|
+
UserData: () => UserDataApi;
|
|
172
|
+
/**
|
|
173
|
+
* Creates a new `RouterApi` instance for best-price trade routing across multiple DEX liquidity sources.
|
|
77
174
|
*/
|
|
78
175
|
Router: () => RouterApi;
|
|
176
|
+
/**
|
|
177
|
+
* Creates a new `LeveragedStakingApi` instance for leveraged staking operations,
|
|
178
|
+
* optionally using `ScallopProviders` if needed.
|
|
179
|
+
*
|
|
180
|
+
* @param ScallopProviders - An optional object containing references to Scallop's Sui modules or providers.
|
|
181
|
+
*/
|
|
79
182
|
LeveragedStaking: (ScallopProviders?: any) => LeveragedStakingApi;
|
|
183
|
+
/**
|
|
184
|
+
* Attempts to decode a Move error message into a structured error code,
|
|
185
|
+
* package ID, module name, and descriptive error string.
|
|
186
|
+
*
|
|
187
|
+
* @param inputs - An object containing the raw `errorMessage`.
|
|
188
|
+
* @returns An object with `errorCode`, `packageId`, `module`, and `error` if translation is successful, or `undefined`.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```typescript
|
|
192
|
+
* const errorDecoded = afApi.translateMoveErrorMessage({ errorMessage: "MoveAbort at ..." });
|
|
193
|
+
* if (errorDecoded) {
|
|
194
|
+
* console.log(errorDecoded.errorCode, errorDecoded.error);
|
|
195
|
+
* }
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
80
198
|
translateMoveErrorMessage: <T extends MoveErrorsInterface>(inputs: {
|
|
81
199
|
errorMessage: string;
|
|
82
200
|
}) => {
|