aftermath-ts-sdk 1.2.64 → 1.2.65

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 (114) hide show
  1. package/dist/general/dynamicGas/dynamicGas.d.ts +34 -0
  2. package/dist/general/dynamicGas/dynamicGas.d.ts.map +1 -1
  3. package/dist/general/dynamicGas/dynamicGas.js +34 -0
  4. package/dist/general/dynamicGas/dynamicGasTypes.d.ts +25 -0
  5. package/dist/general/dynamicGas/dynamicGasTypes.d.ts.map +1 -1
  6. package/dist/general/prices/prices.d.ts +73 -0
  7. package/dist/general/prices/prices.d.ts.map +1 -1
  8. package/dist/general/prices/prices.js +73 -0
  9. package/dist/general/providers/aftermath.d.ts +106 -25
  10. package/dist/general/providers/aftermath.d.ts.map +1 -1
  11. package/dist/general/providers/aftermath.js +108 -27
  12. package/dist/general/providers/aftermathApi.d.ts +127 -8
  13. package/dist/general/providers/aftermathApi.d.ts.map +1 -1
  14. package/dist/general/providers/aftermathApi.js +132 -12
  15. package/dist/general/types/castingTypes.d.ts +0 -7
  16. package/dist/general/types/castingTypes.d.ts.map +1 -1
  17. package/dist/general/types/castingTypes.js +6 -0
  18. package/dist/general/types/generalTypes.d.ts +228 -7
  19. package/dist/general/types/generalTypes.d.ts.map +1 -1
  20. package/dist/general/types/suiTypes.d.ts +0 -16
  21. package/dist/general/types/suiTypes.d.ts.map +1 -1
  22. package/dist/general/types/suiTypes.js +3 -25
  23. package/dist/general/utils/casting.d.ts +159 -3
  24. package/dist/general/utils/casting.d.ts.map +1 -1
  25. package/dist/general/utils/casting.js +162 -16
  26. package/dist/general/utils/fixedUtils.d.ts +89 -2
  27. package/dist/general/utils/fixedUtils.d.ts.map +1 -1
  28. package/dist/general/utils/fixedUtils.js +81 -4
  29. package/dist/general/utils/helpers.d.ts +320 -9
  30. package/dist/general/utils/helpers.d.ts.map +1 -1
  31. package/dist/general/utils/helpers.js +350 -89
  32. package/dist/general/utils/iFixedUtils.d.ts +64 -0
  33. package/dist/general/utils/iFixedUtils.d.ts.map +1 -1
  34. package/dist/general/utils/iFixedUtils.js +64 -0
  35. package/dist/general/wallet/wallet.d.ts +75 -0
  36. package/dist/general/wallet/wallet.d.ts.map +1 -1
  37. package/dist/general/wallet/wallet.js +75 -5
  38. package/dist/packages/auth/auth.d.ts +113 -0
  39. package/dist/packages/auth/auth.d.ts.map +1 -1
  40. package/dist/packages/auth/auth.js +129 -15
  41. package/dist/packages/auth/authTypes.d.ts +66 -0
  42. package/dist/packages/auth/authTypes.d.ts.map +1 -1
  43. package/dist/packages/coin/coin.d.ts +250 -0
  44. package/dist/packages/coin/coin.d.ts.map +1 -1
  45. package/dist/packages/coin/coin.js +238 -14
  46. package/dist/packages/coin/coinTypes.d.ts +93 -0
  47. package/dist/packages/coin/coinTypes.d.ts.map +1 -1
  48. package/dist/packages/dca/dca.d.ts +124 -35
  49. package/dist/packages/dca/dca.d.ts.map +1 -1
  50. package/dist/packages/dca/dca.js +127 -37
  51. package/dist/packages/dca/dcaTypes.d.ts +213 -28
  52. package/dist/packages/dca/dcaTypes.d.ts.map +1 -1
  53. package/dist/packages/farms/farms.d.ts +184 -1
  54. package/dist/packages/farms/farms.d.ts.map +1 -1
  55. package/dist/packages/farms/farms.js +185 -11
  56. package/dist/packages/farms/farmsStakedPosition.d.ts +140 -6
  57. package/dist/packages/farms/farmsStakedPosition.d.ts.map +1 -1
  58. package/dist/packages/farms/farmsStakedPosition.js +189 -144
  59. package/dist/packages/farms/farmsStakingPool.d.ts +161 -1
  60. package/dist/packages/farms/farmsStakingPool.d.ts.map +1 -1
  61. package/dist/packages/farms/farmsStakingPool.js +176 -70
  62. package/dist/packages/farms/farmsTypes.d.ts +283 -2
  63. package/dist/packages/farms/farmsTypes.d.ts.map +1 -1
  64. package/dist/packages/farms/farmsTypes.js +18 -0
  65. package/dist/packages/limitOrders/limitOrders.d.ts +108 -21
  66. package/dist/packages/limitOrders/limitOrders.d.ts.map +1 -1
  67. package/dist/packages/limitOrders/limitOrders.js +110 -22
  68. package/dist/packages/limitOrders/limitOrdersTypes.d.ts +142 -0
  69. package/dist/packages/limitOrders/limitOrdersTypes.d.ts.map +1 -1
  70. package/dist/packages/multisig/multisig.d.ts +33 -4
  71. package/dist/packages/multisig/multisig.d.ts.map +1 -1
  72. package/dist/packages/multisig/multisig.js +33 -4
  73. package/dist/packages/multisig/multisigTypes.d.ts +17 -0
  74. package/dist/packages/multisig/multisigTypes.d.ts.map +1 -1
  75. package/dist/packages/perpetuals/api/perpetualsApi.d.ts.map +1 -1
  76. package/dist/packages/pools/pool.d.ts +327 -85
  77. package/dist/packages/pools/pool.d.ts.map +1 -1
  78. package/dist/packages/pools/pool.js +333 -91
  79. package/dist/packages/pools/pools.d.ts +299 -37
  80. package/dist/packages/pools/pools.d.ts.map +1 -1
  81. package/dist/packages/pools/pools.js +306 -52
  82. package/dist/packages/pools/poolsTypes.d.ts +267 -2
  83. package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
  84. package/dist/packages/referralVault/referralVault.d.ts +37 -0
  85. package/dist/packages/referralVault/referralVault.d.ts.map +1 -1
  86. package/dist/packages/referralVault/referralVault.js +37 -0
  87. package/dist/packages/router/router.d.ts +213 -17
  88. package/dist/packages/router/router.d.ts.map +1 -1
  89. package/dist/packages/router/router.js +214 -18
  90. package/dist/packages/router/routerTypes.d.ts +198 -14
  91. package/dist/packages/router/routerTypes.d.ts.map +1 -1
  92. package/dist/packages/staking/staking.d.ts +301 -43
  93. package/dist/packages/staking/staking.d.ts.map +1 -1
  94. package/dist/packages/staking/staking.js +308 -51
  95. package/dist/packages/staking/stakingTypes.d.ts +426 -6
  96. package/dist/packages/staking/stakingTypes.d.ts.map +1 -1
  97. package/dist/packages/staking/stakingTypes.js +19 -0
  98. package/dist/packages/sui/sui.d.ts +39 -0
  99. package/dist/packages/sui/sui.d.ts.map +1 -1
  100. package/dist/packages/sui/sui.js +39 -0
  101. package/dist/packages/userData/userData.d.ts +66 -12
  102. package/dist/packages/userData/userData.d.ts.map +1 -1
  103. package/dist/packages/userData/userData.js +66 -12
  104. package/dist/packages/userData/userDataTypes.d.ts +19 -0
  105. package/dist/packages/userData/userDataTypes.d.ts.map +1 -1
  106. package/dist/types.d.ts.map +1 -1
  107. package/dist/types.js +0 -1
  108. package/package.json +1 -1
  109. package/dist/general/historicalData/historicalData.d.ts +0 -15
  110. package/dist/general/historicalData/historicalData.d.ts.map +0 -1
  111. package/dist/general/historicalData/historicalData.js +0 -45
  112. package/dist/general/historicalData/historicalDataTypes.d.ts +0 -10
  113. package/dist/general/historicalData/historicalDataTypes.d.ts.map +0 -1
  114. package/dist/general/historicalData/historicalDataTypes.js +0 -2
@@ -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,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);
@@ -10,7 +10,6 @@ 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
14
  import { Oracle } from "../../packages/oracle/oracle";
16
15
  import { Farms } from "../../packages/farms/farms";
@@ -21,10 +20,13 @@ import { Multisig } from "../../packages/multisig/multisig";
21
20
  import { LimitOrders } from "../../packages/limitOrders/limitOrders";
22
21
  import { UserData } from "../../packages/userData/userData";
23
22
  /**
24
- * @class Aftermath Provider
23
+ * The `Aftermath` class serves as the primary entry point for interacting with
24
+ * the Aftermath Finance protocols and utilities on the Sui blockchain.
25
+ * It provides various sub-providers (e.g. `Router`, `Staking`, `Farms`)
26
+ * initialized under the specified network environment (MAINNET, TESTNET, etc).
25
27
  *
26
28
  * @example
27
- * ```
29
+ * ```typescript
28
30
  * // Create provider
29
31
  * const aftermath = new Aftermath("MAINNET");
30
32
  * // Create package provider
@@ -40,74 +42,153 @@ export declare class Aftermath extends Caller {
40
42
  private readonly network?;
41
43
  private Provider?;
42
44
  /**
43
- * Creates `Aftermath` provider to call api.
45
+ * Creates an `Aftermath` provider instance to call the Aftermath Finance APIs
46
+ * and interact with Sui-based protocols.
44
47
  *
45
- * @param network - The Sui network to interact with
46
- * @returns New `Aftermath` instance
48
+ * @param network - The target Sui network ("MAINNET", "TESTNET", "DEVNET", or "LOCAL").
49
+ * @param Provider - Optionally pass a custom `AftermathApi` instance if you already have one.
47
50
  */
48
51
  constructor(network?: SuiNetwork | undefined, Provider?: AftermathApi | undefined);
52
+ /**
53
+ * Initializes the Aftermath provider by fetching addresses from the backend
54
+ * and configuring the Sui fullnode client. This method must be called before
55
+ * performing many API operations.
56
+ *
57
+ * @param inputs - Optional object allowing you to override the default `fullnodeUrl`.
58
+ * @example
59
+ * ```typescript
60
+ * const afSdk = new Aftermath("MAINNET");
61
+ * await afSdk.init(); // sets up internal providers
62
+ * ```
63
+ */
49
64
  init(inputs?: {
50
65
  fullnodeUrl: Url;
51
66
  }): Promise<void>;
52
67
  /**
53
- * Retrieves the addresses from the Aftermath API.
54
- * @returns A promise that resolves to a ConfigAddresses object.
68
+ * Retrieves the Aftermath-specific on-chain addresses (object IDs, packages, etc.).
69
+ *
70
+ * @returns A `ConfigAddresses` object containing relevant addresses for the protocol.
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * const addresses = await aftermath.getAddresses();
75
+ * console.log(addresses); // { routerPackageId: "...", someOtherPackageId: "..." }
76
+ * ```
55
77
  */
56
78
  getAddresses(): Promise<ConfigAddresses>;
79
+ /**
80
+ * Returns the base URL used for Aftermath API calls.
81
+ *
82
+ * @returns The base URL for this instance's API.
83
+ *
84
+ * @example
85
+ * ```typescript
86
+ * const apiBaseUrl = aftermath.getApiBaseUrl();
87
+ * console.log(apiBaseUrl); // "https://api.after..."
88
+ * ```
89
+ */
57
90
  getApiBaseUrl(): string | undefined;
58
91
  /**
59
- * Returns an instance of the Pools class.
60
- * @returns {Pools} An instance of the Pools class.
92
+ * Returns an instance of the `Pools` class, which handles DEX pool operations
93
+ * within the Aftermath platform (if supported).
61
94
  */
62
95
  Pools: () => Pools;
63
96
  /**
64
- * Creates a new instance of the Staking class.
65
- * @returns A new instance of the Staking class.
97
+ * Returns an instance of the `Staking` class for Aftermath's staking and unstaking features.
66
98
  */
67
99
  Staking: () => Staking;
100
+ /**
101
+ * Returns an instance of `LeveragedStaking` for advanced leveraged staking workflows (if supported).
102
+ */
68
103
  LeveragedStaking: () => LeveragedStaking;
104
+ /**
105
+ * Returns an instance of `SuiFrens`, a specialized package for social or utility services.
106
+ */
69
107
  SuiFrens: () => SuiFrens;
108
+ /**
109
+ * Returns an instance of `Faucet`, allowing test/dev networks to dispense tokens.
110
+ */
70
111
  Faucet: () => Faucet;
71
112
  /**
72
- * Creates a new instance of the Router class with the current network.
73
- * @returns A new instance of the Router class.
113
+ * Returns an instance of the `Router` class, which handles smart order routing
114
+ * across multiple DEX protocols.
74
115
  */
75
116
  Router: () => Router;
117
+ /**
118
+ * Returns an instance of `NftAmm`, which supports NFT AMM (automated market maker) features.
119
+ */
76
120
  NftAmm: () => NftAmm;
121
+ /**
122
+ * Returns an instance of `ReferralVault` for referral-based interactions in the protocol.
123
+ */
77
124
  ReferralVault: () => ReferralVault;
125
+ /**
126
+ * Returns an instance of `Perpetuals` for futures or perpetual contract interactions.
127
+ */
78
128
  Perpetuals: () => Perpetuals;
129
+ /**
130
+ * Returns an instance of `Oracle`, which provides price oracles or other data feed services.
131
+ */
79
132
  Oracle: () => Oracle;
80
133
  /**
81
- * Creates a new instance of the Farms class.
82
- * @returns A new instance of the Farms class.
134
+ * Returns an instance of `Farms` for yield farming or liquidity mining functionalities.
83
135
  */
84
136
  Farms: () => Farms;
85
137
  /**
86
- * Creates a new instance of the DCA class.
87
- * @returns A new instance of the DCA class.
138
+ * Returns an instance of the `Dca` class, supporting dollar-cost averaging logic.
88
139
  */
89
140
  Dca: () => Dca;
141
+ /**
142
+ * Returns an instance of `Multisig`, enabling multi-signature address creation and management.
143
+ */
90
144
  Multisig: () => Multisig;
145
+ /**
146
+ * Returns an instance of `LimitOrders`, supporting limit order placement on certain DEX protocols.
147
+ */
91
148
  LimitOrders: () => LimitOrders;
149
+ /**
150
+ * Returns an instance of `UserData` for creating and managing user-specific data or key storage.
151
+ */
92
152
  UserData: () => UserData;
153
+ /**
154
+ * Returns an instance of `Sui` for low-level Sui chain information and utilities.
155
+ */
93
156
  Sui: () => Sui;
157
+ /**
158
+ * Returns an instance of `Prices`, which provides coin price data from external or internal feeds.
159
+ */
94
160
  Prices: () => Prices;
95
161
  /**
96
- * Creates a new instance of the Wallet class.
97
- * @param address - The address of the wallet.
98
- * @returns A new instance of the Wallet class.
162
+ * Creates a new `Wallet` instance for a specific user address, enabling you to fetch balances,
163
+ * transaction history, etc.
164
+ *
165
+ * @param address - The Sui address of the wallet (e.g., "0x<32_byte_hex>").
99
166
  */
100
167
  Wallet: (address: SuiAddress) => Wallet;
101
168
  /**
102
- * Creates a new instance of the Coin class.
103
- * @param coinType The type of coin to create.
104
- * @returns A new instance of the Coin class.
169
+ * Returns an instance of the `Coin` class, which handles coin metadata, decimal conversions,
170
+ * and other coin-related utilities for a specified `CoinType`.
171
+ *
172
+ * @param coinType - Optionally specify a coin type for immediate usage in coin methods.
105
173
  */
106
174
  Coin: (coinType?: CoinType) => Coin;
107
- HistoricalData: () => HistoricalData;
175
+ /**
176
+ * Returns an instance of `DynamicGas`, enabling dynamic assignment of gas
177
+ * objects or sponsored transactions for user operations.
178
+ */
108
179
  DynamicGas: () => DynamicGas;
180
+ /**
181
+ * Returns an instance of `Auth`, handling user authentication or token-based flows (if applicable).
182
+ */
109
183
  Auth: () => Auth;
184
+ /**
185
+ * Exposes a set of helper functions for general-purpose usage across
186
+ * the Aftermath ecosystem. Includes utilities for math, logging, etc.
187
+ */
110
188
  static helpers: typeof Helpers;
189
+ /**
190
+ * Exposes a set of casting utilities for data type conversions (e.g., BigInt <-> fixed).
191
+ */
111
192
  static casting: typeof Casting;
112
193
  }
113
194
  //# sourceMappingURL=aftermath.d.ts.map
@@ -1 +1 @@
1
-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