aftermath-ts-sdk 1.2.51 → 1.2.52-perps.4

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.
Files changed (214) hide show
  1. package/README.md +62 -28
  2. package/dist/general/apiHelpers/eventsApiHelpers.d.ts +1 -1
  3. package/dist/general/apiHelpers/eventsApiHelpers.d.ts.map +1 -1
  4. package/dist/general/apiHelpers/eventsApiHelpers.js +4 -1
  5. package/dist/general/apiHelpers/transactionsApiHelpers.d.ts +6 -0
  6. package/dist/general/apiHelpers/transactionsApiHelpers.d.ts.map +1 -1
  7. package/dist/general/apiHelpers/transactionsApiHelpers.js +46 -0
  8. package/dist/general/dynamicGas/dynamicGas.d.ts +34 -0
  9. package/dist/general/dynamicGas/dynamicGas.d.ts.map +1 -1
  10. package/dist/general/dynamicGas/dynamicGas.js +34 -0
  11. package/dist/general/dynamicGas/dynamicGasTypes.d.ts +25 -0
  12. package/dist/general/dynamicGas/dynamicGasTypes.d.ts.map +1 -1
  13. package/dist/general/prices/coinGeckoTypes.d.ts +2 -0
  14. package/dist/general/prices/coinGeckoTypes.d.ts.map +1 -1
  15. package/dist/general/prices/prices.d.ts +73 -0
  16. package/dist/general/prices/prices.d.ts.map +1 -1
  17. package/dist/general/prices/prices.js +73 -0
  18. package/dist/general/providers/aftermath.d.ts +107 -27
  19. package/dist/general/providers/aftermath.d.ts.map +1 -1
  20. package/dist/general/providers/aftermath.js +110 -30
  21. package/dist/general/providers/aftermathApi.d.ts +128 -10
  22. package/dist/general/providers/aftermathApi.d.ts.map +1 -1
  23. package/dist/general/providers/aftermathApi.js +133 -14
  24. package/dist/general/types/castingTypes.d.ts +15 -7
  25. package/dist/general/types/castingTypes.d.ts.map +1 -1
  26. package/dist/general/types/castingTypes.js +6 -0
  27. package/dist/general/types/configTypes.d.ts +14 -8
  28. package/dist/general/types/configTypes.d.ts.map +1 -1
  29. package/dist/general/types/generalTypes.d.ts +229 -7
  30. package/dist/general/types/generalTypes.d.ts.map +1 -1
  31. package/dist/general/types/moveErrorsInterface.d.ts +1 -1
  32. package/dist/general/types/moveErrorsInterface.d.ts.map +1 -1
  33. package/dist/general/types/suiTypes.d.ts +0 -16
  34. package/dist/general/types/suiTypes.d.ts.map +1 -1
  35. package/dist/general/types/suiTypes.js +3 -25
  36. package/dist/general/utils/caller.d.ts +6 -3
  37. package/dist/general/utils/caller.d.ts.map +1 -1
  38. package/dist/general/utils/caller.js +22 -4
  39. package/dist/general/utils/casting.d.ts +156 -5
  40. package/dist/general/utils/casting.d.ts.map +1 -1
  41. package/dist/general/utils/casting.js +159 -18
  42. package/dist/general/utils/fixedUtils.d.ts +89 -2
  43. package/dist/general/utils/fixedUtils.d.ts.map +1 -1
  44. package/dist/general/utils/fixedUtils.js +81 -4
  45. package/dist/general/utils/helpers.d.ts +327 -10
  46. package/dist/general/utils/helpers.d.ts.map +1 -1
  47. package/dist/general/utils/helpers.js +409 -91
  48. package/dist/general/utils/iFixedUtils.d.ts +64 -0
  49. package/dist/general/utils/iFixedUtils.d.ts.map +1 -1
  50. package/dist/general/utils/iFixedUtils.js +64 -0
  51. package/dist/general/wallet/wallet.d.ts +76 -1
  52. package/dist/general/wallet/wallet.d.ts.map +1 -1
  53. package/dist/general/wallet/wallet.js +75 -5
  54. package/dist/packages/auth/auth.d.ts +113 -4
  55. package/dist/packages/auth/auth.d.ts.map +1 -1
  56. package/dist/packages/auth/auth.js +190 -59
  57. package/dist/packages/auth/authTypes.d.ts +66 -0
  58. package/dist/packages/auth/authTypes.d.ts.map +1 -1
  59. package/dist/packages/coin/api/coinApi.d.ts.map +1 -1
  60. package/dist/packages/coin/api/coinApi.js +29 -20
  61. package/dist/packages/coin/coin.d.ts +256 -1
  62. package/dist/packages/coin/coin.d.ts.map +1 -1
  63. package/dist/packages/coin/coin.js +246 -15
  64. package/dist/packages/coin/coinTypes.d.ts +95 -0
  65. package/dist/packages/coin/coinTypes.d.ts.map +1 -1
  66. package/dist/packages/dca/api/dcaApi.d.ts +2 -0
  67. package/dist/packages/dca/api/dcaApi.d.ts.map +1 -1
  68. package/dist/packages/dca/api/dcaApi.js +6 -3
  69. package/dist/packages/dca/dca.d.ts +125 -35
  70. package/dist/packages/dca/dca.d.ts.map +1 -1
  71. package/dist/packages/dca/dca.js +135 -43
  72. package/dist/packages/dca/dcaTypes.d.ts +217 -42
  73. package/dist/packages/dca/dcaTypes.d.ts.map +1 -1
  74. package/dist/packages/farms/api/farmsApi.d.ts +725 -58
  75. package/dist/packages/farms/api/farmsApi.d.ts.map +1 -1
  76. package/dist/packages/farms/api/farmsApi.js +1149 -153
  77. package/dist/packages/farms/api/farmsApiCasting.d.ts +34 -18
  78. package/dist/packages/farms/api/farmsApiCasting.d.ts.map +1 -1
  79. package/dist/packages/farms/api/farmsApiCasting.js +218 -17
  80. package/dist/packages/farms/api/farmsApiCastingTypes.d.ts +117 -21
  81. package/dist/packages/farms/api/farmsApiCastingTypes.d.ts.map +1 -1
  82. package/dist/packages/farms/farms.d.ts +200 -12
  83. package/dist/packages/farms/farms.d.ts.map +1 -1
  84. package/dist/packages/farms/farms.js +204 -50
  85. package/dist/packages/farms/farmsStakedPosition.d.ts +143 -8
  86. package/dist/packages/farms/farmsStakedPosition.d.ts.map +1 -1
  87. package/dist/packages/farms/farmsStakedPosition.js +243 -137
  88. package/dist/packages/farms/farmsStakingPool.d.ts +171 -3
  89. package/dist/packages/farms/farmsStakingPool.d.ts.map +1 -1
  90. package/dist/packages/farms/farmsStakingPool.js +233 -73
  91. package/dist/packages/farms/farmsTypes.d.ts +310 -2
  92. package/dist/packages/farms/farmsTypes.d.ts.map +1 -1
  93. package/dist/packages/farms/farmsTypes.js +47 -0
  94. package/dist/packages/faucet/api/faucetApi.d.ts +9 -17
  95. package/dist/packages/faucet/api/faucetApi.d.ts.map +1 -1
  96. package/dist/packages/faucet/api/faucetApi.js +44 -49
  97. package/dist/packages/faucet/api/faucetApiCasting.d.ts.map +1 -1
  98. package/dist/packages/faucet/api/faucetApiCasting.js +8 -5
  99. package/dist/packages/faucet/api/faucetApiCastingTypes.d.ts +1 -4
  100. package/dist/packages/faucet/api/faucetApiCastingTypes.d.ts.map +1 -1
  101. package/dist/packages/faucet/faucet.d.ts +1 -1
  102. package/dist/packages/faucet/faucet.d.ts.map +1 -1
  103. package/dist/packages/faucet/faucet.js +1 -1
  104. package/dist/packages/faucet/faucetTypes.d.ts +2 -3
  105. package/dist/packages/faucet/faucetTypes.d.ts.map +1 -1
  106. package/dist/packages/limitOrders/api/limitOrdersApi.d.ts +12 -0
  107. package/dist/packages/limitOrders/api/limitOrdersApi.d.ts.map +1 -0
  108. package/dist/packages/limitOrders/api/limitOrdersApi.js +25 -0
  109. package/dist/packages/limitOrders/index.d.ts +2 -0
  110. package/dist/packages/limitOrders/index.d.ts.map +1 -0
  111. package/dist/packages/limitOrders/index.js +17 -0
  112. package/dist/packages/limitOrders/limitOrders.d.ts +143 -0
  113. package/dist/packages/limitOrders/limitOrders.d.ts.map +1 -0
  114. package/dist/packages/limitOrders/limitOrders.js +190 -0
  115. package/dist/packages/limitOrders/limitOrdersTypes.d.ts +211 -0
  116. package/dist/packages/limitOrders/limitOrdersTypes.d.ts.map +1 -0
  117. package/dist/packages/multisig/multisig.d.ts +34 -5
  118. package/dist/packages/multisig/multisig.d.ts.map +1 -1
  119. package/dist/packages/multisig/multisig.js +33 -4
  120. package/dist/packages/multisig/multisigTypes.d.ts +17 -0
  121. package/dist/packages/multisig/multisigTypes.d.ts.map +1 -1
  122. package/dist/packages/nftAmm/nftAmm.d.ts +1 -1
  123. package/dist/packages/nftAmm/nftAmm.d.ts.map +1 -1
  124. package/dist/packages/perpetuals/api/perpetualsApi.d.ts +38 -23
  125. package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +1 -1
  126. package/dist/packages/perpetuals/api/perpetualsApi.js +740 -299
  127. package/dist/packages/perpetuals/api/perpetualsApiCasting.d.ts +10 -6
  128. package/dist/packages/perpetuals/api/perpetualsApiCasting.d.ts.map +1 -1
  129. package/dist/packages/perpetuals/api/perpetualsApiCasting.js +112 -42
  130. package/dist/packages/perpetuals/perpetuals.d.ts +33 -4
  131. package/dist/packages/perpetuals/perpetuals.d.ts.map +1 -1
  132. package/dist/packages/perpetuals/perpetuals.js +105 -18
  133. package/dist/packages/perpetuals/perpetualsAccount.d.ts +107 -33
  134. package/dist/packages/perpetuals/perpetualsAccount.d.ts.map +1 -1
  135. package/dist/packages/perpetuals/perpetualsAccount.js +569 -68
  136. package/dist/packages/perpetuals/perpetualsCastingTypes.d.ts +104 -25
  137. package/dist/packages/perpetuals/perpetualsCastingTypes.d.ts.map +1 -1
  138. package/dist/packages/perpetuals/perpetualsMarket.d.ts +31 -9
  139. package/dist/packages/perpetuals/perpetualsMarket.d.ts.map +1 -1
  140. package/dist/packages/perpetuals/perpetualsMarket.js +85 -77
  141. package/dist/packages/perpetuals/perpetualsTypes.d.ts +349 -379
  142. package/dist/packages/perpetuals/perpetualsTypes.d.ts.map +1 -1
  143. package/dist/packages/perpetuals/perpetualsTypes.js +43 -113
  144. package/dist/packages/pools/api/poolsApiCasting.d.ts.map +1 -1
  145. package/dist/packages/pools/api/poolsApiCasting.js +0 -1
  146. package/dist/packages/pools/pool.d.ts +333 -106
  147. package/dist/packages/pools/pool.d.ts.map +1 -1
  148. package/dist/packages/pools/pool.js +347 -119
  149. package/dist/packages/pools/pools.d.ts +307 -39
  150. package/dist/packages/pools/pools.d.ts.map +1 -1
  151. package/dist/packages/pools/pools.js +323 -54
  152. package/dist/packages/pools/poolsTypes.d.ts +267 -2
  153. package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
  154. package/dist/packages/referralVault/referralVault.d.ts +38 -1
  155. package/dist/packages/referralVault/referralVault.d.ts.map +1 -1
  156. package/dist/packages/referralVault/referralVault.js +37 -0
  157. package/dist/packages/router/api/routerApi.d.ts +2 -2
  158. package/dist/packages/router/api/routerApi.d.ts.map +1 -1
  159. package/dist/packages/router/api/routerApi.js +19 -11
  160. package/dist/packages/router/router.d.ts +214 -18
  161. package/dist/packages/router/router.d.ts.map +1 -1
  162. package/dist/packages/router/router.js +216 -20
  163. package/dist/packages/router/routerTypes.d.ts +202 -17
  164. package/dist/packages/router/routerTypes.d.ts.map +1 -1
  165. package/dist/packages/staking/staking.d.ts +306 -45
  166. package/dist/packages/staking/staking.d.ts.map +1 -1
  167. package/dist/packages/staking/staking.js +313 -51
  168. package/dist/packages/staking/stakingTypes.d.ts +431 -6
  169. package/dist/packages/staking/stakingTypes.d.ts.map +1 -1
  170. package/dist/packages/staking/stakingTypes.js +19 -0
  171. package/dist/packages/sui/sui.d.ts +40 -1
  172. package/dist/packages/sui/sui.d.ts.map +1 -1
  173. package/dist/packages/sui/sui.js +39 -0
  174. package/dist/packages/suiFrens/stakedSuiFren.d.ts +1 -1
  175. package/dist/packages/suiFrens/stakedSuiFren.d.ts.map +1 -1
  176. package/dist/packages/suiFrens/suiFren.d.ts +1 -1
  177. package/dist/packages/suiFrens/suiFren.d.ts.map +1 -1
  178. package/dist/packages/suiFrens/suiFrens.d.ts +1 -1
  179. package/dist/packages/suiFrens/suiFrens.d.ts.map +1 -1
  180. package/dist/packages/userData/api/userDataApi.d.ts +6 -0
  181. package/dist/packages/userData/api/userDataApi.d.ts.map +1 -0
  182. package/dist/packages/userData/api/userDataApi.js +12 -0
  183. package/dist/packages/userData/index.d.ts +2 -0
  184. package/dist/packages/userData/index.d.ts.map +1 -0
  185. package/dist/packages/userData/index.js +17 -0
  186. package/dist/packages/userData/userData.d.ts +89 -0
  187. package/dist/packages/userData/userData.d.ts.map +1 -0
  188. package/dist/packages/userData/userData.js +119 -0
  189. package/dist/packages/userData/userDataTypes.d.ts +29 -0
  190. package/dist/packages/userData/userDataTypes.d.ts.map +1 -0
  191. package/dist/types.d.ts.map +1 -1
  192. package/dist/types.js +0 -1
  193. package/package.json +1 -1
  194. package/dist/general/historicalData/historicalData.d.ts +0 -15
  195. package/dist/general/historicalData/historicalData.d.ts.map +0 -1
  196. package/dist/general/historicalData/historicalData.js +0 -45
  197. package/dist/general/historicalData/historicalDataTypes.d.ts +0 -10
  198. package/dist/general/historicalData/historicalDataTypes.d.ts.map +0 -1
  199. package/dist/packages/dca/api/dcaApiCasting.d.ts +0 -11
  200. package/dist/packages/dca/api/dcaApiCasting.d.ts.map +0 -1
  201. package/dist/packages/dca/api/dcaApiCasting.js +0 -186
  202. package/dist/packages/dca/api/dcaApiCastingTypes.d.ts +0 -142
  203. package/dist/packages/dca/api/dcaApiCastingTypes.d.ts.map +0 -1
  204. package/dist/packages/oracle/api/oracleApi.d.ts +0 -13
  205. package/dist/packages/oracle/api/oracleApi.d.ts.map +0 -1
  206. package/dist/packages/oracle/api/oracleApi.js +0 -35
  207. package/dist/packages/oracle/oracle.d.ts +0 -15
  208. package/dist/packages/oracle/oracle.d.ts.map +0 -1
  209. package/dist/packages/oracle/oracle.js +0 -46
  210. package/dist/packages/oracle/oracleTypes.d.ts +0 -2
  211. package/dist/packages/oracle/oracleTypes.d.ts.map +0 -1
  212. package/dist/packages/oracle/oracleTypes.js +0 -2
  213. /package/dist/{general/historicalData/historicalDataTypes.js → packages/limitOrders/limitOrdersTypes.js} +0 -0
  214. /package/dist/packages/{dca/api/dcaApiCastingTypes.js → userData/userDataTypes.js} +0 -0
package/README.md CHANGED
@@ -1,57 +1,91 @@
1
- # Aftermath TypeScript SDK
1
+ # Aftermath SDK
2
2
 
3
- ## Install
3
+ The Aftermath SDK provides easy access to Aftermath Finance's protocols on the Sui blockchain. Please note that not all of our protocols are on Testnet, but all of them are Mainnet.
4
+
5
+ ## Installation
4
6
 
5
7
  ```bash
6
8
  npm i aftermath-ts-sdk
7
9
  ```
8
10
 
9
- ## Usage
10
-
11
- Create an instance of `Aftermath` for ease of use to make calls to our server, or create an instance of `AftermathApi` for finer control of transaction construction.
12
-
13
- ## Aftermath SDK
11
+ ## Quick Start (Aftermath SDK)
14
12
 
15
- ### 1. Create Aftermath provider
13
+ For most integrations, use the Aftermath SDK for simplified access:
16
14
 
17
- ```ts
18
- const afSdk = new Aftermath("MAINNET"); // "MAINNET" | "TESTNET" | "DEVNET"
19
- ```
20
-
21
- ### 2. Create protocol provider
15
+ ```typescript
16
+ const afSdk = new Aftermath("MAINNET"); // "MAINNET" | "TESTNET"
17
+ await afSdk.init(); // initialize provider
22
18
 
23
- ```ts
19
+ // Access protocols
24
20
  const router = afSdk.Router();
25
21
  const pools = afSdk.Pools();
26
22
  const staking = afSdk.Staking();
27
23
  const farms = afSdk.Farms();
24
+ const dca = afSdk.Dca();
28
25
  ```
29
26
 
30
- ## Aftermath API
27
+ ## Advanced Usage (AftermathApi)
31
28
 
32
- ### 1. Create Aftermath Api provider
29
+ For complex transaction construction, use AftermathApi for direct control:
33
30
 
34
- ```ts
35
- const fullnodeEndpoint = "https://fullnode.mainnet.sui.io";
36
- const addresses = {...};
31
+ ```typescript
32
+ const afSdk = new Aftermath("MAINNET");
33
+ const addresses = afSdk.getAddresses();
37
34
 
38
35
  const afApi = new AftermathApi(
39
36
  new SuiClient({
40
37
  transport: new SuiHTTPTransport({
41
- url: fullnodeEndpoint,
38
+ url: "https://fullnode.mainnet.sui.io",
42
39
  }),
43
40
  }),
44
- addresses,
45
- new IndexerCaller("MAINNET"), // "MAINNET" | "TESTNET" | "DEVNET"
41
+ addresses // Configuration addresses
46
42
  );
47
- ```
48
43
 
49
- ### 2. Create protocol provider
50
-
51
- ```ts
44
+ // Access protocol APIs
52
45
  const poolsApi = afApi.Pools();
53
- const stakinApi = afApi.Staking();
46
+ const stakingApi = afApi.Staking();
54
47
  const farmsApi = afApi.Farms();
55
48
  ```
56
49
 
57
- Find the complete documentation for using our router, AMM pools, liquid staking, and more in our [GitBook](https://docs.aftermath.finance/aftermath-typescript-sdk/getting-started).
50
+ ## Available Protocols
51
+
52
+ ### Pools (AMM)
53
+
54
+ - Automated Market Maker pools for trading
55
+ - Support for stable and uncorrelated assets
56
+ - Up to 8 assets per pool
57
+ - [View Pools Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/pools)
58
+
59
+ ### Router
60
+
61
+ - Smart order routing across multiple pools
62
+ - Optimal trade execution via split routes
63
+ - [View Router Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/router)
64
+
65
+ ### Staking
66
+
67
+ - Liquid staking for SUI tokens
68
+ - Earn yield with afSUI
69
+ - [View Staking Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/liquid-staking)
70
+
71
+ ### Farms
72
+
73
+ - Yield farming opportunities
74
+ - Stake LP tokens and earn rewards
75
+ - [View Farms Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/farms)
76
+
77
+ ### DCA (Dollar-Cost Averaging)
78
+
79
+ - Automated periodic investments
80
+ - Reduce impact of market volatility
81
+ - [View DCA Documentation](https://docs.aftermath.finance/developers/aftermath-ts-sdk/products/DCA)
82
+
83
+ ## Rate Limits
84
+
85
+ Default rate limit: 1000 requests per 10 seconds
86
+
87
+ For higher limits, contact us via:
88
+
89
+ - [Telegram](https://t.me/aftermath_fi)
90
+ - [Discord](https://discord.gg/VFqMUqKHF3)
91
+ - [X/Twitter](https://x.com/AftermathFi)
@@ -38,6 +38,6 @@ export declare class EventsApiHelpers {
38
38
  }) => EventType | undefined;
39
39
  static findCastEventInTransactionOrUndefined: <EventTypeOnChain, EventType>(transaction: SuiTransactionBlockResponse, eventType: AnyObjectType | (() => AnyObjectType), castFunction: (eventOnChain: EventTypeOnChain) => EventType) => EventType | undefined;
40
40
  static findCastEventInTransactionsOrUndefined: <EventTypeOnChain, EventType>(transactions: SuiTransactionBlockResponse[], eventType: AnyObjectType | (() => AnyObjectType), castFunction: (eventOnChain: EventTypeOnChain) => EventType) => EventType | undefined;
41
- static createEventType: (packageAddress: string, packageName: string, eventType: string) => string;
41
+ static createEventType: (packageAddress: string, packageName: string, eventType: string, wrapperType?: string) => string;
42
42
  }
43
43
  //# sourceMappingURL=eventsApiHelpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"event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aAAa,CAAC;;sBAc/C;IAEF,OAAc,wBAAwB;gBAI7B,QAAQ,EAAE;mBACP,aAAa,GAAG,CAAC,MAAM,aAAa,CAAC;;gCAM/C;IAEF,OAAc,qCAAqC,6CAIrC,2BAA2B,aAC7B,aAAa,GAAG,CAAC,MAAM,aAAa,CAAC,wFAQ/C;IAEF,OAAc,sCAAsC,8CAIrC,2BAA2B,EAAE,aAChC,aAAa,GAAG,CAAC,MAAM,aAAa,CAAC,wFAgB/C;IAEF,OAAc,eAAe,mBACZ,MAAM,eACT,MAAM,aACR,MAAM,gBACH,MAAM,YAInB;CACF"}
@@ -164,4 +164,7 @@ EventsApiHelpers.findCastEventInTransactionsOrUndefined = (transactions, eventTy
164
164
  .find((event) => event !== undefined);
165
165
  return foundEvent;
166
166
  };
167
- EventsApiHelpers.createEventType = (packageAddress, packageName, eventType) => `${packageAddress}::${packageName}::${eventType}`;
167
+ EventsApiHelpers.createEventType = (packageAddress, packageName, eventType, wrapperType) => {
168
+ const innerType = `${packageAddress}::${packageName}::${eventType}`;
169
+ return wrapperType ? `${wrapperType}<${innerType}>` : innerType;
170
+ };
@@ -44,6 +44,9 @@ export declare class TransactionsApiHelpers {
44
44
  static serviceCoinDataFromCoinTxArgV0: (inputs: {
45
45
  coinTxArg: CoinTransactionObjectArgumentV0 | ObjectId;
46
46
  }) => ServiceCoinData;
47
+ static serviceCoinDataV2FromCoinTxArgV0: (inputs: {
48
+ coinTxArg: CoinTransactionObjectArgumentV0 | ObjectId;
49
+ }) => ServiceCoinDataV2;
47
50
  static coinTxArgFromServiceCoinData: (inputs: {
48
51
  serviceCoinData: ServiceCoinData;
49
52
  }) => TransactionObjectArgument;
@@ -53,6 +56,9 @@ export declare class TransactionsApiHelpers {
53
56
  static coinTxArgFromServiceCoinDataV0: (inputs: {
54
57
  serviceCoinData: ServiceCoinData;
55
58
  }) => CoinTransactionObjectArgumentV0;
59
+ static coinTxArgFromServiceCoinDataV2V0: (inputs: {
60
+ serviceCoinDataV2: ServiceCoinDataV2;
61
+ }) => CoinTransactionObjectArgumentV0;
56
62
  static transferTxMetadata: (inputs: {
57
63
  initTx: Transaction;
58
64
  newTx: Transaction;
@@ -1 +1 @@
1
- {"version":3,"file":"transactionsApiHelpers.d.ts","sourceRoot":"","sources":["../../../src/general/apiHelpers/transactionsApiHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,WAAW,EACX,yBAAyB,EACzB,QAAQ,EAER,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,OAAO,EACP,+BAA+B,EAC/B,QAAQ,EACR,QAAQ,EACR,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EACN,gBAAgB,EAGhB,MAAM,6BAA6B,CAAC;AAErC,qBAAa,sBAAsB;IAKtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAU5C,2BAA2B,WAAkB;QACnD,KAAK,EAAE,gCAAgC,CAAC;QACxC,MAAM,CAAC,EAAE,iBAAiB,CAAC;QAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,KAAG,QAAQ,sBAAsB,CAAC,CAqBjC;IAEK,sBAAsB,WAAkB;QAC9C,EAAE,EAAE,WAAW,CAAC;KAChB,KAAG,QAAQ,WAAW,CAAC,CAsBtB;IAEK,wBAAwB,WAAkB;QAChD,EAAE,EAAE,gBAAgB,CAAC;KACrB,KAAG,QAAQ,gBAAgB,CAAC,CA6B3B;IAEK,+BAA+B,WAAkB;QACvD,EAAE,EAAE,WAAW,GAAG,QAAQ,WAAW,CAAC,CAAC;QACvC,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,QAAQ,qBAAqB,CAAC,CA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AAM,EAAE,gBAAgB,CAAC;QACzB,KAAK,EAAE,gBAAgB,CAAC;KACxB,UA+BC;CACF"}
1
+ {"version":3,"file":"transactionsApiHelpers.d.ts","sourceRoot":"","sources":["../../../src/general/apiHelpers/transactionsApiHelpers.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,mBAAmB,EACnB,WAAW,EACX,yBAAyB,EACzB,QAAQ,EAER,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACN,OAAO,EACP,+BAA+B,EAC/B,QAAQ,EACR,QAAQ,EACR,qBAAqB,EACrB,eAAe,EACf,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,sBAAsB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,gCAAgC,EAAE,MAAM,oBAAoB,CAAC;AAEtE,OAAO,EACN,gBAAgB,EAGhB,MAAM,6BAA6B,CAAC;AAErC,qBAAa,sBAAsB;IAKtB,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,YAAY;IAU5C,2BAA2B,WAAkB;QACnD,KAAK,EAAE,gCAAgC,CAAC;QACxC,MAAM,CAAC,EAAE,iBAAiB,CAAC;QAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,KAAG,QAAQ,sBAAsB,CAAC,CAqBjC;IAEK,sBAAsB,WAAkB;QAC9C,EAAE,EAAE,WAAW,CAAC;KAChB,KAAG,QAAQ,WAAW,CAAC,CAsBtB;IAEK,wBAAwB,WAAkB;QAChD,EAAE,EAAE,gBAAgB,CAAC;KACrB,KAAG,QAAQ,gBAAgB,CAAC,CA6B3B;IAEK,+BAA+B,WAAkB;QACvD,EAAE,EAAE,WAAW,GAAG,QAAQ,WAAW,CAAC,CAAC;QACvC,aAAa,CAAC,EAAE,OAAO,CAAC;KACxB,KAAG,QAAQ,qBAAqB,CAAC,CAQhC;IAEK,iCAAiC,WAAkB;QACzD,EAAE,EAAE,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,CA2CjC;IAuCF,OAAc,kBAAkB,WAAY;QAC3C,MAAM,EAAE,WAAW,CAAC;QACpB,KAAK,EAAE,WAAW,CAAC;KACnB,UAoBC;IAEF,OAAc,oBAAoB,WAAY;QAC7C,MAAM,EAAE,gBAAgB,CAAC;QACzB,KAAK,EAAE,gBAAgB,CAAC;KACxB,UA+BC;CACF"}
@@ -175,6 +175,7 @@ TransactionsApiHelpers.serviceCoinDataV2FromCoinTxArg = (inputs) => {
175
175
  };
176
176
  TransactionsApiHelpers.serviceCoinDataFromCoinTxArgV0 = (inputs) => {
177
177
  const { coinTxArg } = inputs;
178
+ // TODO: handle gas coin
178
179
  if (typeof coinTxArg === "string")
179
180
  return { Coin: utils_1.Helpers.addLeadingZeroesToType(coinTxArg) };
180
181
  if (coinTxArg.kind === "NestedResult")
@@ -186,6 +187,21 @@ TransactionsApiHelpers.serviceCoinDataFromCoinTxArgV0 = (inputs) => {
186
187
  // Input
187
188
  return { [coinTxArg.kind]: coinTxArg.index };
188
189
  };
190
+ TransactionsApiHelpers.serviceCoinDataV2FromCoinTxArgV0 = (inputs) => {
191
+ const { coinTxArg } = inputs;
192
+ // TODO: handle gas coin
193
+ if (typeof coinTxArg === "string")
194
+ // TODO: handle this case better
195
+ throw new Error(`coinTxArg in format ${coinTxArg} not supported`);
196
+ if (coinTxArg.kind === "NestedResult")
197
+ return {
198
+ result: [coinTxArg.index, coinTxArg.resultIndex],
199
+ };
200
+ if (coinTxArg.kind === "Result")
201
+ return { result: coinTxArg.index };
202
+ // Input
203
+ return { input: coinTxArg.index };
204
+ };
189
205
  TransactionsApiHelpers.coinTxArgFromServiceCoinData = (inputs) => {
190
206
  const { serviceCoinData } = inputs;
191
207
  const key = Object.keys(serviceCoinData)[0];
@@ -254,6 +270,36 @@ TransactionsApiHelpers.coinTxArgFromServiceCoinDataV0 = (inputs) => {
254
270
  index: Object.values(serviceCoinData)[0],
255
271
  };
256
272
  };
273
+ TransactionsApiHelpers.coinTxArgFromServiceCoinDataV2V0 = (inputs) => {
274
+ const { serviceCoinDataV2 } = inputs;
275
+ if (typeof serviceCoinDataV2 === "string") {
276
+ throw new Error(`serviceCoinDataV2 format ${JSON.stringify(serviceCoinDataV2)} not supported`);
277
+ }
278
+ const key = Object.keys(serviceCoinDataV2)[0];
279
+ const value = Object.values(serviceCoinDataV2)[0];
280
+ // TODO: handle this cleaner ?
281
+ const kind = key;
282
+ if (kind === "result") {
283
+ if (typeof value === "number") {
284
+ return {
285
+ kind: "Result",
286
+ index: value,
287
+ };
288
+ }
289
+ return {
290
+ kind: "NestedResult",
291
+ index: value[0],
292
+ resultIndex: value[1],
293
+ };
294
+ }
295
+ if (kind === "input" && typeof value === "number") {
296
+ return {
297
+ kind: "Input",
298
+ index: value,
299
+ };
300
+ }
301
+ throw new Error(`serviceCoinDataV2 format ${JSON.stringify(serviceCoinDataV2)} not supported`);
302
+ };
257
303
  // public static mergeCoinsTx(inputs: {
258
304
  // tx: Transaction;
259
305
  // coinType: CoinType;
@@ -3,8 +3,42 @@ import { CoinType } from "../../packages/coin/coinTypes";
3
3
  import { Caller } from "../utils/caller";
4
4
  import { Transaction } from "@mysten/sui/transactions";
5
5
  import { ApiDynamicGasResponse } from "./dynamicGasTypes";
6
+ /**
7
+ * The `DynamicGas` class provides functionality for dynamically determining
8
+ * or attaching a suitable gas payment object to a transaction. This allows
9
+ * for more flexible transaction building when exact gas objects are not
10
+ * predetermined.
11
+ */
6
12
  export declare class DynamicGas extends Caller {
13
+ /**
14
+ * Creates a new `DynamicGas` instance for interacting with dynamic gas endpoints.
15
+ *
16
+ * @param config - Optional caller config, including the Sui network and an access token.
17
+ */
7
18
  constructor(config?: CallerConfig);
19
+ /**
20
+ * Requests the dynamic gas service to set up a transaction with an appropriate gas coin,
21
+ * or sponsor signature if needed, based on the user's wallet and coin type preference.
22
+ *
23
+ * @param inputs - An object containing the `Transaction` to be adjusted, the `walletAddress`, and `gasCoinType`.
24
+ * @returns A promise that resolves to an `ApiDynamicGasResponse`, which includes the new transaction bytes
25
+ * (`txBytes`) and possibly a `sponsoredSignature`.
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * const afSdk = new Aftermath("MAINNET");
30
+ * await afSdk.init(); // initialize provider
31
+ *
32
+ * const dynamicGas = afSdk.DynamicGas();
33
+ *
34
+ * const updatedTx = await dynamicGas.getUseDynamicGasForTx({
35
+ * tx: transactionBlock,
36
+ * walletAddress: "0x<user_address>",
37
+ * gasCoinType: "0x2::sui::SUI"
38
+ * });
39
+ * // updatedTx.txBytes and updatedTx.sponsoredSignature can now be used for signing/execution
40
+ * ```
41
+ */
8
42
  getUseDynamicGasForTx(inputs: {
9
43
  tx: Transaction;
10
44
  walletAddress: SuiAddress;
@@ -1 +1 @@
1
- {"version":3,"file":"dynamicGas.d.ts","sourceRoot":"","sources":["../../../src/general/dynamicGas/dynamicGas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAO,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAqB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE7E,qBAAa,UAAW,SAAQ,MAAM;gBAKzB,MAAM,CAAC,EAAE,YAAY;IAQpB,qBAAqB,CAAC,MAAM,EAAE;QAC1C,EAAE,EAAE,WAAW,CAAC;QAChB,aAAa,EAAE,UAAU,CAAC;QAC1B,WAAW,EAAE,QAAQ,CAAC;KACtB;CAQD"}
1
+ {"version":3,"file":"dynamicGas.d.ts","sourceRoot":"","sources":["../../../src/general/dynamicGas/dynamicGas.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAO,MAAM,uBAAuB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAqB,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE7E;;;;;GAKG;AACH,qBAAa,UAAW,SAAQ,MAAM;IAKrC;;;;OAIG;gBACS,MAAM,CAAC,EAAE,YAAY;IAQjC;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,qBAAqB,CAAC,MAAM,EAAE;QAC1C,EAAE,EAAE,WAAW,CAAC;QAChB,aAAa,EAAE,UAAU,CAAC;QAC1B,WAAW,EAAE,QAAQ,CAAC;KACtB;CAQD"}
@@ -11,16 +11,50 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.DynamicGas = void 0;
13
13
  const caller_1 = require("../utils/caller");
14
+ /**
15
+ * The `DynamicGas` class provides functionality for dynamically determining
16
+ * or attaching a suitable gas payment object to a transaction. This allows
17
+ * for more flexible transaction building when exact gas objects are not
18
+ * predetermined.
19
+ */
14
20
  class DynamicGas extends caller_1.Caller {
15
21
  // =========================================================================
16
22
  // Constructor
17
23
  // =========================================================================
24
+ /**
25
+ * Creates a new `DynamicGas` instance for interacting with dynamic gas endpoints.
26
+ *
27
+ * @param config - Optional caller config, including the Sui network and an access token.
28
+ */
18
29
  constructor(config) {
19
30
  super(config, "dynamic-gas");
20
31
  }
21
32
  // =========================================================================
22
33
  // Tx Setup
23
34
  // =========================================================================
35
+ /**
36
+ * Requests the dynamic gas service to set up a transaction with an appropriate gas coin,
37
+ * or sponsor signature if needed, based on the user's wallet and coin type preference.
38
+ *
39
+ * @param inputs - An object containing the `Transaction` to be adjusted, the `walletAddress`, and `gasCoinType`.
40
+ * @returns A promise that resolves to an `ApiDynamicGasResponse`, which includes the new transaction bytes
41
+ * (`txBytes`) and possibly a `sponsoredSignature`.
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * const afSdk = new Aftermath("MAINNET");
46
+ * await afSdk.init(); // initialize provider
47
+ *
48
+ * const dynamicGas = afSdk.DynamicGas();
49
+ *
50
+ * const updatedTx = await dynamicGas.getUseDynamicGasForTx({
51
+ * tx: transactionBlock,
52
+ * walletAddress: "0x<user_address>",
53
+ * gasCoinType: "0x2::sui::SUI"
54
+ * });
55
+ * // updatedTx.txBytes and updatedTx.sponsoredSignature can now be used for signing/execution
56
+ * ```
57
+ */
24
58
  getUseDynamicGasForTx(inputs) {
25
59
  return __awaiter(this, void 0, void 0, function* () {
26
60
  const { tx, walletAddress, gasCoinType } = inputs;
@@ -1,12 +1,37 @@
1
1
  import { CoinType } from "../../types";
2
2
  import { SerializedTransaction, SuiAddress } from "../types";
3
+ /**
4
+ * Represents the body payload sent to the dynamic gas service,
5
+ * which includes the serialized transaction and any user-provided
6
+ * gas configuration (e.g., coin type).
7
+ */
3
8
  export interface ApiDynamicGasBody {
9
+ /**
10
+ * The serialized transaction block in base64 or similar format.
11
+ */
4
12
  serializedTx: SerializedTransaction;
13
+ /**
14
+ * The address of the user for whom the dynamic gas is being set.
15
+ */
5
16
  walletAddress: SuiAddress;
17
+ /**
18
+ * The coin type to be used for gas payment (e.g., "0x2::sui::SUI").
19
+ */
6
20
  gasCoinType: CoinType;
7
21
  }
22
+ /**
23
+ * Represents the response from the dynamic gas service, typically returning
24
+ * updated transaction bytes and possibly a sponsored signature if the
25
+ * transaction gas is being partially or fully sponsored.
26
+ */
8
27
  export interface ApiDynamicGasResponse {
28
+ /**
29
+ * The modified transaction bytes that incorporate a gas coin or sponsor information.
30
+ */
9
31
  txBytes: SerializedTransaction;
32
+ /**
33
+ * A signature used to sponsor or verify the updated transaction, if applicable.
34
+ */
10
35
  sponsoredSignature: string;
11
36
  }
12
37
  //# sourceMappingURL=dynamicGasTypes.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dynamicGasTypes.d.ts","sourceRoot":"","sources":["../../../src/general/dynamicGas/dynamicGasTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAM7D,MAAM,WAAW,iBAAiB;IACjC,YAAY,EAAE,qBAAqB,CAAC;IACpC,aAAa,EAAE,UAAU,CAAC;IAC1B,WAAW,EAAE,QAAQ,CAAC;CACtB;AAED,MAAM,WAAW,qBAAqB;IACrC,OAAO,EAAE,qBAAqB,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;CAC3B"}
1
+ {"version":3,"file":"dynamicGasTypes.d.ts","sourceRoot":"","sources":["../../../src/general/dynamicGas/dynamicGasTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IACjC;;OAEG;IACH,YAAY,EAAE,qBAAqB,CAAC;IACpC;;OAEG;IACH,aAAa,EAAE,UAAU,CAAC;IAC1B;;OAEG;IACH,WAAW,EAAE,QAAQ,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,qBAAqB;IACrC;;OAEG;IACH,OAAO,EAAE,qBAAqB,CAAC;IAC/B;;OAEG;IACH,kBAAkB,EAAE,MAAM,CAAC;CAC3B"}
@@ -1,6 +1,8 @@
1
1
  import { CoinSymbol, CoinType } from "../../types";
2
+ export type CoinGeckoChain = Lowercase<"Ethereum" | "Arbitrum" | "Bsc" | "Solana" | "Sui" | "Polygon" | "Avalanche" | "Optimism" | "Base">;
2
3
  export type CoinGeckoCoinApiId = string;
3
4
  export interface CoinGeckoCoinData {
5
+ chain: CoinGeckoChain | "";
4
6
  apiId: CoinGeckoCoinApiId;
5
7
  name: string;
6
8
  symbol: CoinSymbol;
@@ -1 +1 @@
1
- {"version":3,"file":"coinGeckoTypes.d.ts","sourceRoot":"","sources":["../../../src/general/prices/coinGeckoTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAUnD,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAMxC,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;CACnB"}
1
+ {"version":3,"file":"coinGeckoTypes.d.ts","sourceRoot":"","sources":["../../../src/general/prices/coinGeckoTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAOnD,MAAM,MAAM,cAAc,GAAG,SAAS,CACnC,UAAU,GACV,UAAU,GACV,KAAK,GACL,QAAQ,GACR,KAAK,GACL,SAAS,GACT,WAAW,GACX,UAAU,GACV,MAAM,CA+CR,CAAC;AAMF,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAMxC,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,cAAc,GAAG,EAAE,CAAC;IAC3B,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,QAAQ,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACvC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;CACnB"}
@@ -1,17 +1,90 @@
1
1
  import { CoinPriceInfo, CoinType, CoinsToPrice, CoinsToPriceInfo } from "../../packages/coin/coinTypes";
2
2
  import { Caller } from "../utils/caller";
3
3
  import { CallerConfig } from "../types";
4
+ /**
5
+ * The `Prices` class provides methods for fetching price information for various
6
+ * coins on the Sui network, including single-coin or multi-coin queries.
7
+ */
4
8
  export declare class Prices extends Caller {
9
+ /**
10
+ * Creates a new `Prices` instance for retrieving coin price data from
11
+ * Aftermath's backend or other data sources.
12
+ *
13
+ * @param config - Optional configuration, including network and access token.
14
+ */
5
15
  constructor(config?: CallerConfig);
16
+ /**
17
+ * Retrieves detailed price information (including current price and 24h change)
18
+ * for a single coin.
19
+ *
20
+ * @param inputs - Contains the `coin` type (e.g., "0x2::sui::SUI").
21
+ * @returns A promise resolving to a `CoinPriceInfo` object.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ *
26
+ * const afSdk = new Aftermath("MAINNET");
27
+ * await afSdk.init(); // initialize provider
28
+ *
29
+ * const prices = afSdk.Prices();
30
+ *
31
+ * const suiPriceInfo = await prices.getCoinPriceInfo({
32
+ * coin: "0x2::sui::SUI"
33
+ * });
34
+ * console.log(suiPriceInfo.price, suiPriceInfo.priceChange24HoursPercentage);
35
+ * ```
36
+ */
6
37
  getCoinPriceInfo(inputs: {
7
38
  coin: CoinType;
8
39
  }): Promise<CoinPriceInfo>;
40
+ /**
41
+ * Retrieves detailed price information for multiple coins simultaneously,
42
+ * returning a record keyed by `CoinType`.
43
+ *
44
+ * @param inputs - An object containing an array of `coins`.
45
+ * @returns A promise resolving to a `CoinsToPriceInfo` mapping each coin type to its price info.
46
+ *
47
+ * @example
48
+ * ```typescript
49
+ * const prices = new Prices();
50
+ * const info = await prices.getCoinsToPriceInfo({
51
+ * coins: ["0x2::sui::SUI", "0x<some_other_coin>"]
52
+ * });
53
+ * console.log(info);
54
+ * ```
55
+ */
9
56
  getCoinsToPriceInfo(inputs: {
10
57
  coins: CoinType[];
11
58
  }): Promise<CoinsToPriceInfo>;
59
+ /**
60
+ * Fetches only the current price in USD for a single coin.
61
+ *
62
+ * @param inputs - Contains the `coin` type.
63
+ * @returns A promise resolving to a `number` representing the price in USD.
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * const prices = new Prices();
68
+ * const suiPrice = await prices.getCoinPrice({ coin: "0x2::sui::SUI" });
69
+ * console.log("SUI price in USD:", suiPrice);
70
+ * ```
71
+ */
12
72
  getCoinPrice(inputs: {
13
73
  coin: CoinType;
14
74
  }): Promise<number>;
75
+ /**
76
+ * Fetches current prices in USD for multiple coins, returning a record keyed by `CoinType`.
77
+ *
78
+ * @param inputs - Contains an array of `coins`.
79
+ * @returns A promise resolving to a `CoinsToPrice` object mapping coin types to their prices in USD.
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * const prices = new Prices();
84
+ * const multiPrices = await prices.getCoinsToPrice({ coins: ["0x2::sui::SUI", "0x<other>"] });
85
+ * console.log(multiPrices["0x2::sui::SUI"]); // e.g. 1.23
86
+ * ```
87
+ */
15
88
  getCoinsToPrice(inputs: {
16
89
  coins: CoinType[];
17
90
  }): Promise<CoinsToPrice>;
@@ -1 +1 @@
1
- {"version":3,"file":"prices.d.ts","sourceRoot":"","sources":["../../../src/general/prices/prices.ts"],"names":[],"mappings":"AACA,OAAO,EACN,aAAa,EAGb,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAO,MAAM,UAAU,CAAC;AAE7C,qBAAa,MAAO,SAAQ,MAAM;gBAKrB,MAAM,CAAC,EAAE,YAAY;IAQpB,gBAAgB,CAAC,MAAM,EAAE;QACrC,IAAI,EAAE,QAAQ,CAAC;KACf,GAAG,OAAO,CAAC,aAAa,CAAC;IAOb,mBAAmB,CAAC,MAAM,EAAE;QACxC,KAAK,EAAE,QAAQ,EAAE,CAAC;KAClB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAIhB,YAAY,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAKzD,eAAe,CAAC,MAAM,EAAE;QACpC,KAAK,EAAE,QAAQ,EAAE,CAAC;KAClB,GAAG,OAAO,CAAC,YAAY,CAAC;CAazB"}
1
+ {"version":3,"file":"prices.d.ts","sourceRoot":"","sources":["../../../src/general/prices/prices.ts"],"names":[],"mappings":"AACA,OAAO,EACN,aAAa,EAGb,QAAQ,EACR,YAAY,EACZ,gBAAgB,EAChB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAO,MAAM,UAAU,CAAC;AAE7C;;;GAGG;AACH,qBAAa,MAAO,SAAQ,MAAM;IAKjC;;;;;OAKG;gBACS,MAAM,CAAC,EAAE,YAAY;IAQjC;;;;;;;;;;;;;;;;;;;;OAoBG;IACU,gBAAgB,CAAC,MAAM,EAAE;QACrC,IAAI,EAAE,QAAQ,CAAC;KACf,GAAG,OAAO,CAAC,aAAa,CAAC;IAO1B;;;;;;;;;;;;;;;OAeG;IACU,mBAAmB,CAAC,MAAM,EAAE;QACxC,KAAK,EAAE,QAAQ,EAAE,CAAC;KAClB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAI7B;;;;;;;;;;;;OAYG;IACU,YAAY,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAKtE;;;;;;;;;;;;OAYG;IACU,eAAe,CAAC,MAAM,EAAE;QACpC,KAAK,EAAE,QAAQ,EAAE,CAAC;KAClB,GAAG,OAAO,CAAC,YAAY,CAAC;CAazB"}
@@ -11,16 +11,47 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Prices = void 0;
13
13
  const caller_1 = require("../utils/caller");
14
+ /**
15
+ * The `Prices` class provides methods for fetching price information for various
16
+ * coins on the Sui network, including single-coin or multi-coin queries.
17
+ */
14
18
  class Prices extends caller_1.Caller {
15
19
  // =========================================================================
16
20
  // Constructor
17
21
  // =========================================================================
22
+ /**
23
+ * Creates a new `Prices` instance for retrieving coin price data from
24
+ * Aftermath's backend or other data sources.
25
+ *
26
+ * @param config - Optional configuration, including network and access token.
27
+ */
18
28
  constructor(config) {
19
29
  super(config, "price-info");
20
30
  }
21
31
  // =========================================================================
22
32
  // Prices
23
33
  // =========================================================================
34
+ /**
35
+ * Retrieves detailed price information (including current price and 24h change)
36
+ * for a single coin.
37
+ *
38
+ * @param inputs - Contains the `coin` type (e.g., "0x2::sui::SUI").
39
+ * @returns A promise resolving to a `CoinPriceInfo` object.
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ *
44
+ * const afSdk = new Aftermath("MAINNET");
45
+ * await afSdk.init(); // initialize provider
46
+ *
47
+ * const prices = afSdk.Prices();
48
+ *
49
+ * const suiPriceInfo = await prices.getCoinPriceInfo({
50
+ * coin: "0x2::sui::SUI"
51
+ * });
52
+ * console.log(suiPriceInfo.price, suiPriceInfo.priceChange24HoursPercentage);
53
+ * ```
54
+ */
24
55
  getCoinPriceInfo(inputs) {
25
56
  return __awaiter(this, void 0, void 0, function* () {
26
57
  const coinsToPriceInfo = yield this.getCoinsToPriceInfo({
@@ -29,17 +60,59 @@ class Prices extends caller_1.Caller {
29
60
  return Object.values(coinsToPriceInfo)[0];
30
61
  });
31
62
  }
63
+ /**
64
+ * Retrieves detailed price information for multiple coins simultaneously,
65
+ * returning a record keyed by `CoinType`.
66
+ *
67
+ * @param inputs - An object containing an array of `coins`.
68
+ * @returns A promise resolving to a `CoinsToPriceInfo` mapping each coin type to its price info.
69
+ *
70
+ * @example
71
+ * ```typescript
72
+ * const prices = new Prices();
73
+ * const info = await prices.getCoinsToPriceInfo({
74
+ * coins: ["0x2::sui::SUI", "0x<some_other_coin>"]
75
+ * });
76
+ * console.log(info);
77
+ * ```
78
+ */
32
79
  getCoinsToPriceInfo(inputs) {
33
80
  return __awaiter(this, void 0, void 0, function* () {
34
81
  return this.fetchApi("", inputs);
35
82
  });
36
83
  }
84
+ /**
85
+ * Fetches only the current price in USD for a single coin.
86
+ *
87
+ * @param inputs - Contains the `coin` type.
88
+ * @returns A promise resolving to a `number` representing the price in USD.
89
+ *
90
+ * @example
91
+ * ```typescript
92
+ * const prices = new Prices();
93
+ * const suiPrice = await prices.getCoinPrice({ coin: "0x2::sui::SUI" });
94
+ * console.log("SUI price in USD:", suiPrice);
95
+ * ```
96
+ */
37
97
  getCoinPrice(inputs) {
38
98
  return __awaiter(this, void 0, void 0, function* () {
39
99
  const priceInfo = yield this.getCoinPriceInfo(inputs);
40
100
  return priceInfo.price;
41
101
  });
42
102
  }
103
+ /**
104
+ * Fetches current prices in USD for multiple coins, returning a record keyed by `CoinType`.
105
+ *
106
+ * @param inputs - Contains an array of `coins`.
107
+ * @returns A promise resolving to a `CoinsToPrice` object mapping coin types to their prices in USD.
108
+ *
109
+ * @example
110
+ * ```typescript
111
+ * const prices = new Prices();
112
+ * const multiPrices = await prices.getCoinsToPrice({ coins: ["0x2::sui::SUI", "0x<other>"] });
113
+ * console.log(multiPrices["0x2::sui::SUI"]); // e.g. 1.23
114
+ * ```
115
+ */
43
116
  getCoinsToPrice(inputs) {
44
117
  return __awaiter(this, void 0, void 0, function* () {
45
118
  const coinsToPriceInfo = yield this.getCoinsToPriceInfo(inputs);