@decibeltrade/sdk 0.3.1 → 0.4.1

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 (132) hide show
  1. package/dist/abi/generate-abis.js +2 -2
  2. package/dist/abi/json/mainnet.json +2905 -0
  3. package/dist/abi/json/netna.json +792 -289
  4. package/dist/abi/json/testnet.json +15 -3
  5. package/dist/admin.d.ts +36 -0
  6. package/dist/admin.d.ts.map +1 -1
  7. package/dist/admin.js +84 -0
  8. package/dist/base.d.ts +1 -6
  9. package/dist/base.d.ts.map +1 -1
  10. package/dist/base.js +17 -24
  11. package/dist/constants.d.ts +10 -4
  12. package/dist/constants.d.ts.map +1 -1
  13. package/dist/constants.js +21 -6
  14. package/dist/fee-pay.d.ts +3 -3
  15. package/dist/fee-pay.d.ts.map +1 -1
  16. package/dist/fee-pay.js +26 -49
  17. package/dist/gas/gas-price-manager.d.ts.map +1 -1
  18. package/dist/gas/gas-price-manager.js +3 -1
  19. package/dist/read/account-overview/account-overview.reader.d.ts +2 -0
  20. package/dist/read/account-overview/account-overview.reader.d.ts.map +1 -1
  21. package/dist/read/account-overview/account-overview.types.d.ts +4 -0
  22. package/dist/read/account-overview/account-overview.types.d.ts.map +1 -1
  23. package/dist/read/account-overview/account-overview.types.js +5 -0
  24. package/dist/read/action-utils.d.ts +12 -0
  25. package/dist/read/action-utils.d.ts.map +1 -0
  26. package/dist/read/action-utils.js +13 -0
  27. package/dist/read/base-reader.d.ts +1 -0
  28. package/dist/read/base-reader.d.ts.map +1 -1
  29. package/dist/read/base-reader.js +15 -0
  30. package/dist/read/base-reader.test.d.ts +2 -0
  31. package/dist/read/base-reader.test.d.ts.map +1 -0
  32. package/dist/read/base-reader.test.js +68 -0
  33. package/dist/read/global-points-stats/global-points-stats.reader.d.ts +9 -0
  34. package/dist/read/global-points-stats/global-points-stats.reader.d.ts.map +1 -0
  35. package/dist/read/global-points-stats/global-points-stats.reader.js +12 -0
  36. package/dist/read/global-points-stats/global-points-stats.types.d.ts +9 -0
  37. package/dist/read/global-points-stats/global-points-stats.types.d.ts.map +1 -0
  38. package/dist/read/global-points-stats/global-points-stats.types.js +5 -0
  39. package/dist/read/index.d.ts +13 -0
  40. package/dist/read/index.d.ts.map +1 -1
  41. package/dist/read/index.js +23 -2
  42. package/dist/read/market-depth/market-depth.reader.d.ts +1 -18
  43. package/dist/read/market-depth/market-depth.reader.d.ts.map +1 -1
  44. package/dist/read/market-depth/market-depth.reader.js +18 -20
  45. package/dist/read/market-depth/market-depth.types.d.ts +4 -2
  46. package/dist/read/market-depth/market-depth.types.d.ts.map +1 -1
  47. package/dist/read/market-depth/market-depth.types.js +3 -1
  48. package/dist/read/market-trades/market-trades.reader.d.ts +0 -1
  49. package/dist/read/market-trades/market-trades.reader.d.ts.map +1 -1
  50. package/dist/read/market-trades/market-trades.types.d.ts +0 -3
  51. package/dist/read/market-trades/market-trades.types.d.ts.map +1 -1
  52. package/dist/read/market-trades/market-trades.types.js +0 -1
  53. package/dist/read/points-leaderboard/points-leaderboard.reader.d.ts +21 -0
  54. package/dist/read/points-leaderboard/points-leaderboard.reader.d.ts.map +1 -0
  55. package/dist/read/points-leaderboard/points-leaderboard.reader.js +23 -0
  56. package/dist/read/points-leaderboard/points-leaderboard.types.d.ts +30 -0
  57. package/dist/read/points-leaderboard/points-leaderboard.types.d.ts.map +1 -0
  58. package/dist/read/points-leaderboard/points-leaderboard.types.js +11 -0
  59. package/dist/read/portfolio-chart/portfolio-chart.types.d.ts +1 -1
  60. package/dist/read/portfolio-chart/portfolio-chart.types.d.ts.map +1 -1
  61. package/dist/read/referrals/referrals.reader.d.ts +98 -0
  62. package/dist/read/referrals/referrals.reader.d.ts.map +1 -0
  63. package/dist/read/referrals/referrals.reader.js +92 -0
  64. package/dist/read/referrals/referrals.types.d.ts +136 -0
  65. package/dist/read/referrals/referrals.types.d.ts.map +1 -0
  66. package/dist/read/referrals/referrals.types.js +85 -0
  67. package/dist/read/streaks/streaks.reader.d.ts +19 -0
  68. package/dist/read/streaks/streaks.reader.d.ts.map +1 -0
  69. package/dist/read/streaks/streaks.reader.js +19 -0
  70. package/dist/read/streaks/streaks.types.d.ts +17 -0
  71. package/dist/read/streaks/streaks.types.d.ts.map +1 -0
  72. package/dist/read/streaks/streaks.types.js +10 -0
  73. package/dist/read/tier/tier.reader.d.ts +21 -0
  74. package/dist/read/tier/tier.reader.d.ts.map +1 -0
  75. package/dist/read/tier/tier.reader.js +19 -0
  76. package/dist/read/tier/tier.types.d.ts +25 -0
  77. package/dist/read/tier/tier.types.d.ts.map +1 -0
  78. package/dist/read/tier/tier.types.js +13 -0
  79. package/dist/read/trading-amps/trading-amps.reader.d.ts +18 -0
  80. package/dist/read/trading-amps/trading-amps.reader.d.ts.map +1 -0
  81. package/dist/read/trading-amps/trading-amps.reader.js +23 -0
  82. package/dist/read/trading-amps/trading-amps.types.d.ts +25 -0
  83. package/dist/read/trading-amps/trading-amps.types.d.ts.map +1 -0
  84. package/dist/read/trading-amps/trading-amps.types.js +10 -0
  85. package/dist/read/types.d.ts +6 -0
  86. package/dist/read/types.d.ts.map +1 -1
  87. package/dist/read/types.js +6 -0
  88. package/dist/read/user-funding-history/user-funding-history.reader.d.ts +1 -2
  89. package/dist/read/user-funding-history/user-funding-history.reader.d.ts.map +1 -1
  90. package/dist/read/user-funding-history/user-funding-history.types.d.ts +8 -4
  91. package/dist/read/user-funding-history/user-funding-history.types.d.ts.map +1 -1
  92. package/dist/read/user-funding-history/user-funding-history.types.js +1 -2
  93. package/dist/read/user-notifications/user-notifications.types.d.ts +0 -2
  94. package/dist/read/user-notifications/user-notifications.types.d.ts.map +1 -1
  95. package/dist/read/user-open-orders/user-open-orders.reader.d.ts +0 -2
  96. package/dist/read/user-open-orders/user-open-orders.reader.d.ts.map +1 -1
  97. package/dist/read/user-open-orders/user-open-orders.types.d.ts +0 -6
  98. package/dist/read/user-open-orders/user-open-orders.types.d.ts.map +1 -1
  99. package/dist/read/user-open-orders/user-open-orders.types.js +0 -2
  100. package/dist/read/user-order-history/user-order-history.reader.d.ts +0 -2
  101. package/dist/read/user-order-history/user-order-history.reader.d.ts.map +1 -1
  102. package/dist/read/user-order-history/user-order-history.types.d.ts +0 -6
  103. package/dist/read/user-order-history/user-order-history.types.d.ts.map +1 -1
  104. package/dist/read/user-order-history/user-order-history.types.js +0 -2
  105. package/dist/read/user-positions/user-positions.reader.d.ts +1 -0
  106. package/dist/read/user-positions/user-positions.reader.d.ts.map +1 -1
  107. package/dist/read/user-positions/user-positions.types.d.ts +220 -10
  108. package/dist/read/user-positions/user-positions.types.d.ts.map +1 -1
  109. package/dist/read/user-positions/user-positions.types.js +1 -0
  110. package/dist/read/user-trade-history/user-trade-history.reader.d.ts +5 -2
  111. package/dist/read/user-trade-history/user-trade-history.reader.d.ts.map +1 -1
  112. package/dist/read/user-trade-history/user-trade-history.types.d.ts +36 -9
  113. package/dist/read/user-trade-history/user-trade-history.types.d.ts.map +1 -1
  114. package/dist/read/user-trade-history/user-trade-history.types.js +4 -1
  115. package/dist/read/vaults/vaults.reader.d.ts +2 -0
  116. package/dist/read/vaults/vaults.reader.d.ts.map +1 -1
  117. package/dist/read/vaults/vaults.reader.js +4 -0
  118. package/dist/read/vaults/vaults.types.d.ts +18 -0
  119. package/dist/read/vaults/vaults.types.d.ts.map +1 -1
  120. package/dist/read/vaults/vaults.types.js +17 -0
  121. package/dist/read/ws-subscription.d.ts +1 -1
  122. package/dist/read/ws-subscription.d.ts.map +1 -1
  123. package/dist/read/ws-subscription.js +9 -1
  124. package/dist/release-config.d.ts +2 -0
  125. package/dist/release-config.d.ts.map +1 -1
  126. package/dist/release-config.js +6 -1
  127. package/dist/tsconfig.tsbuildinfo +1 -1
  128. package/dist/write.d.ts +38 -0
  129. package/dist/write.d.ts.map +1 -1
  130. package/dist/write.js +50 -1
  131. package/package.json +1 -1
  132. package/readme.md +7 -48
@@ -2,7 +2,7 @@
2
2
  "packageAddress": "0x952535c3049e52f195f26798c2f1340d7dd5100edbe0f464e520a974d16fbe9f",
3
3
  "network": "testnet",
4
4
  "fullnodeUrl": "https://api.testnet.aptoslabs.com/v1",
5
- "fetchedAt": "2026-02-10T21:49:20.794Z",
5
+ "fetchedAt": "2026-03-02T21:11:52.363Z",
6
6
  "abis": {
7
7
  "0x952535c3049e52f195f26798c2f1340d7dd5100edbe0f464e520a974d16fbe9f::admin_apis::initialize": {
8
8
  "name": "initialize",
@@ -2609,6 +2609,18 @@
2609
2609
  ],
2610
2610
  "return": []
2611
2611
  },
2612
+ "0x952535c3049e52f195f26798c2f1340d7dd5100edbe0f464e520a974d16fbe9f::dex_accounts_entry::admin_create_new_subaccount": {
2613
+ "name": "admin_create_new_subaccount",
2614
+ "visibility": "public",
2615
+ "is_entry": true,
2616
+ "is_view": false,
2617
+ "generic_type_params": [],
2618
+ "params": [
2619
+ "&signer",
2620
+ "address"
2621
+ ],
2622
+ "return": []
2623
+ },
2612
2624
  "0x952535c3049e52f195f26798c2f1340d7dd5100edbe0f464e520a974d16fbe9f::dex_accounts_entry::approve_max_builder_fee_for_subaccount": {
2613
2625
  "name": "approve_max_builder_fee_for_subaccount",
2614
2626
  "visibility": "private",
@@ -2901,8 +2913,8 @@
2901
2913
  "errors": [],
2902
2914
  "summary": {
2903
2915
  "totalModules": 9,
2904
- "totalFunctions": 212,
2905
- "successful": 212,
2916
+ "totalFunctions": 213,
2917
+ "successful": 213,
2906
2918
  "failed": 0
2907
2919
  },
2908
2920
  "modules": [
package/dist/admin.d.ts CHANGED
@@ -30,5 +30,41 @@ export declare class DecibelAdminDex extends BaseSDK {
30
30
  * @returns The balance of USDC for the account
31
31
  */
32
32
  usdcBalance(addr: AccountAddress): Promise<number>;
33
+ /**
34
+ * Get the max open interest for a market (unit-based)
35
+ * @param marketName The market name (e.g., "BTC/USD")
36
+ * @returns The max open interest in szDecimals units as a string to preserve precision
37
+ */
38
+ getMaxOpenInterest(marketName: string): Promise<string>;
39
+ /**
40
+ * Decrease the max open interest for a market (unit-based)
41
+ * @param marketName The market name (e.g., "BTC/USD")
42
+ * @param newOpenInterest The new max open interest in szDecimals units (must be lower than current)
43
+ */
44
+ decreaseMarketOpenInterest(marketName: string, newOpenInterest: number | bigint): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
45
+ /**
46
+ * Increase the max open interest for a market (unit-based)
47
+ * @param marketName The market name (e.g., "BTC/USD")
48
+ * @param newOpenInterest The new max open interest in szDecimals units (must be higher than current)
49
+ */
50
+ increaseMarketOpenInterest(marketName: string, newOpenInterest: number | bigint): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
51
+ /**
52
+ * Get the max notional open interest for a market
53
+ * @param marketName The market name (e.g., "BTC/USD")
54
+ * @returns The max notional open interest in collateral units (USDC decimals) as a string to preserve precision for large values
55
+ */
56
+ getMaxNotionalOpenInterest(marketName: string): Promise<string>;
57
+ /**
58
+ * Decrease the max notional open interest for a market
59
+ * @param marketName The market name (e.g., "BTC/USD")
60
+ * @param newNotionalOpenInterest The new max notional open interest in collateral units (must be lower than current)
61
+ */
62
+ decreaseMarketNotionalOpenInterest(marketName: string, newNotionalOpenInterest: number | bigint): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
63
+ /**
64
+ * Increase the max notional open interest for a market
65
+ * @param marketName The market name (e.g., "BTC/USD")
66
+ * @param newNotionalOpenInterest The new max notional open interest in collateral units (must be higher than current)
67
+ */
68
+ increaseMarketNotionalOpenInterest(marketName: string, newNotionalOpenInterest: number | bigint): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
33
69
  }
34
70
  //# sourceMappingURL=admin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/admin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,oBAAoB,CAAC;AAEzE,OAAO,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAGjC,qBAAa,eAAgB,SAAQ,OAAO;I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4BAA4B,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IASxE;;;;OAIG;IACG,WAAW,CAAC,IAAI,EAAE,cAAc;IAWtC;;;;OAIG;IACG,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAY7D;;;;OAIG;IACG,0BAA0B,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM;IASrF;;;;OAIG;IACG,0BAA0B,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM;IASrF;;;;OAIG;IACG,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAYrE;;;;OAIG;IACG,kCAAkC,CACtC,UAAU,EAAE,MAAM,EAClB,uBAAuB,EAAE,MAAM,GAAG,MAAM;IAU1C;;;;OAIG;IACG,kCAAkC,CACtC,UAAU,EAAE,MAAM,EAClB,uBAAuB,EAAE,MAAM,GAAG,MAAM;CAS3C"}
package/dist/admin.js CHANGED
@@ -237,4 +237,88 @@ export class DecibelAdminDex extends BaseSDK {
237
237
  });
238
238
  return balance[0];
239
239
  }
240
+ /**
241
+ * Get the max open interest for a market (unit-based)
242
+ * @param marketName The market name (e.g., "BTC/USD")
243
+ * @returns The max open interest in szDecimals units as a string to preserve precision
244
+ */
245
+ async getMaxOpenInterest(marketName) {
246
+ const marketAddr = getMarketAddr(marketName, this.config.deployment.perpEngineGlobal);
247
+ const result = await this.aptos.view({
248
+ payload: {
249
+ function: `${this.config.deployment.package}::perp_engine::get_max_open_interest`,
250
+ typeArguments: [],
251
+ functionArguments: [marketAddr.toString()],
252
+ },
253
+ });
254
+ return result[0];
255
+ }
256
+ /**
257
+ * Decrease the max open interest for a market (unit-based)
258
+ * @param marketName The market name (e.g., "BTC/USD")
259
+ * @param newOpenInterest The new max open interest in szDecimals units (must be lower than current)
260
+ */
261
+ async decreaseMarketOpenInterest(marketName, newOpenInterest) {
262
+ const marketAddr = getMarketAddr(marketName, this.config.deployment.perpEngineGlobal);
263
+ return await this.sendTx({
264
+ function: `${this.config.deployment.package}::admin_apis::decrease_market_open_interest`,
265
+ typeArguments: [],
266
+ functionArguments: [marketAddr.toString(), newOpenInterest.toString()],
267
+ });
268
+ }
269
+ /**
270
+ * Increase the max open interest for a market (unit-based)
271
+ * @param marketName The market name (e.g., "BTC/USD")
272
+ * @param newOpenInterest The new max open interest in szDecimals units (must be higher than current)
273
+ */
274
+ async increaseMarketOpenInterest(marketName, newOpenInterest) {
275
+ const marketAddr = getMarketAddr(marketName, this.config.deployment.perpEngineGlobal);
276
+ return await this.sendTx({
277
+ function: `${this.config.deployment.package}::admin_apis::increase_market_open_interest`,
278
+ typeArguments: [],
279
+ functionArguments: [marketAddr.toString(), newOpenInterest.toString()],
280
+ });
281
+ }
282
+ /**
283
+ * Get the max notional open interest for a market
284
+ * @param marketName The market name (e.g., "BTC/USD")
285
+ * @returns The max notional open interest in collateral units (USDC decimals) as a string to preserve precision for large values
286
+ */
287
+ async getMaxNotionalOpenInterest(marketName) {
288
+ const marketAddr = getMarketAddr(marketName, this.config.deployment.perpEngineGlobal);
289
+ const result = await this.aptos.view({
290
+ payload: {
291
+ function: `${this.config.deployment.package}::perp_engine::get_max_notional_open_interest`,
292
+ typeArguments: [],
293
+ functionArguments: [marketAddr.toString()],
294
+ },
295
+ });
296
+ return result[0];
297
+ }
298
+ /**
299
+ * Decrease the max notional open interest for a market
300
+ * @param marketName The market name (e.g., "BTC/USD")
301
+ * @param newNotionalOpenInterest The new max notional open interest in collateral units (must be lower than current)
302
+ */
303
+ async decreaseMarketNotionalOpenInterest(marketName, newNotionalOpenInterest) {
304
+ const marketAddr = getMarketAddr(marketName, this.config.deployment.perpEngineGlobal);
305
+ return await this.sendTx({
306
+ function: `${this.config.deployment.package}::admin_apis::decrease_market_notional_open_interest`,
307
+ typeArguments: [],
308
+ functionArguments: [marketAddr.toString(), newNotionalOpenInterest.toString()],
309
+ });
310
+ }
311
+ /**
312
+ * Increase the max notional open interest for a market
313
+ * @param marketName The market name (e.g., "BTC/USD")
314
+ * @param newNotionalOpenInterest The new max notional open interest in collateral units (must be higher than current)
315
+ */
316
+ async increaseMarketNotionalOpenInterest(marketName, newNotionalOpenInterest) {
317
+ const marketAddr = getMarketAddr(marketName, this.config.deployment.perpEngineGlobal);
318
+ return await this.sendTx({
319
+ function: `${this.config.deployment.package}::admin_apis::increase_market_notional_open_interest`,
320
+ typeArguments: [],
321
+ functionArguments: [marketAddr.toString(), newNotionalOpenInterest.toString()],
322
+ });
323
+ }
240
324
  }
package/dist/base.d.ts CHANGED
@@ -3,7 +3,6 @@ import { DecibelConfig } from "./constants";
3
3
  import { GasPriceManager } from "./gas/gas-price-manager";
4
4
  export interface Options {
5
5
  skipSimulate?: boolean;
6
- noFeePayer?: boolean;
7
6
  nodeApiKey?: string;
8
7
  gasPriceManager?: GasPriceManager;
9
8
  /**
@@ -20,11 +19,7 @@ export declare class BaseSDK {
20
19
  readonly account: Account;
21
20
  readonly aptos: Aptos;
22
21
  readonly skipSimulate: boolean;
23
- readonly noFeePayer: boolean;
24
- /**
25
- * Whether we're using the new GasStationClient (API key based) vs legacy gasStationUrl
26
- */
27
- private readonly useGasStationClient;
22
+ private readonly useGasStation;
28
23
  private readonly chainId;
29
24
  private readonly abi;
30
25
  private readonly gasPriceManager;
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AACA,OAAO,EACL,OAAO,EACP,cAAc,EACd,oBAAoB,EACpB,KAAK,EAGL,mCAAmC,EAGnC,0BAA0B,EAC1B,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAK5B,OAAO,EAAE,aAAa,EAAgC,MAAM,aAAa,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D,MAAM,WAAW,OAAO;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;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AAA;KAAE,EACzF,MAAM,EAAE,cAAc;cAyDR,MAAM,CAAC,OAAO,EAAE,mCAAmC,EAAE,eAAe,CAAC,EAAE,OAAO;IA2DvF,2BAA2B,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;CAOjE"}
package/dist/base.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { GasStationClient, GasStationTransactionSubmitter } from "@aptos-labs/gas-station-client";
2
2
  import { Aptos, AptosConfig, } from "@aptos-labs/ts-sdk";
3
+ import mainnetAbis from "./abi/json/mainnet.json";
3
4
  import netnaAbis from "./abi/json/netna.json";
4
5
  import testnetAbis from "./abi/json/testnet.json";
5
- import { NETNA_CONFIG, TESTNET_CONFIG } from "./constants";
6
- import { submitFeePaidTransaction } from "./fee-pay";
6
+ import { MAINNET_CONFIG, NETNA_CONFIG, TESTNET_CONFIG } from "./constants";
7
7
  import { buildSimpleTransactionSync } from "./transaction-builder";
8
8
  import { generateRandomReplayProtectionNonce, getPrimarySubaccountAddr } from "./utils";
9
9
  const chainIdToAbi = {};
@@ -11,16 +11,14 @@ if (NETNA_CONFIG.chainId)
11
11
  chainIdToAbi[NETNA_CONFIG.chainId] = netnaAbis;
12
12
  if (TESTNET_CONFIG.chainId)
13
13
  chainIdToAbi[TESTNET_CONFIG.chainId] = testnetAbis;
14
+ if (MAINNET_CONFIG.chainId)
15
+ chainIdToAbi[MAINNET_CONFIG.chainId] = mainnetAbis;
14
16
  export class BaseSDK {
15
17
  config;
16
18
  account;
17
19
  aptos;
18
20
  skipSimulate;
19
- noFeePayer;
20
- /**
21
- * Whether we're using the new GasStationClient (API key based) vs legacy gasStationUrl
22
- */
23
- useGasStationClient;
21
+ useGasStation;
24
22
  chainId;
25
23
  abi = netnaAbis;
26
24
  gasPriceManager;
@@ -43,9 +41,8 @@ export class BaseSDK {
43
41
  this.abi = netnaAbis;
44
42
  console.warn("Using NETNA ABI for unsupported chain id, this might cause issues with the transaction builder");
45
43
  }
46
- this.noFeePayer = opts?.noFeePayer ?? false;
47
- this.useGasStationClient = !this.noFeePayer && !!config.gasStationApiKey;
48
- const pluginSettings = this.useGasStationClient && config.gasStationApiKey
44
+ this.useGasStation = !!config.gasStationApiKey;
45
+ const pluginSettings = this.useGasStation && config.gasStationApiKey
49
46
  ? {
50
47
  TRANSACTION_SUBMITTER: new GasStationTransactionSubmitter(new GasStationClient({
51
48
  network: config.network,
@@ -58,7 +55,9 @@ export class BaseSDK {
58
55
  const aptosConfig = new AptosConfig({
59
56
  network: config.network,
60
57
  fullnode: config.fullnodeUrl,
61
- clientConfig: { API_KEY: opts?.nodeApiKey },
58
+ clientConfig: config.additionalHeaders
59
+ ? { HEADERS: config.additionalHeaders }
60
+ : { API_KEY: opts?.nodeApiKey },
62
61
  pluginSettings,
63
62
  });
64
63
  this.aptos = new Aptos(aptosConfig);
@@ -71,22 +70,16 @@ export class BaseSDK {
71
70
  return this.abi.abis[functionId] ?? null;
72
71
  }
73
72
  async submitTx(transaction, senderAuthenticator) {
74
- if (this.noFeePayer || this.useGasStationClient) {
75
- // When using GasStationClient, the plugin handles fee payer signing automatically
76
- // When noFeePayer is true, submit directly without fee payer
77
- return await this.aptos.transaction.submit.simple({
78
- transaction,
79
- senderAuthenticator,
80
- });
81
- }
82
- else {
83
- // Legacy: use custom fee payer service via gasStationUrl
84
- return await submitFeePaidTransaction(this.config, transaction, senderAuthenticator);
85
- }
73
+ // When gasStationApiKey is set, the GasStationTransactionSubmitter plugin
74
+ // handles fee payer signing automatically. Otherwise, submits directly (self-pay).
75
+ return await this.aptos.transaction.submit.simple({
76
+ transaction,
77
+ senderAuthenticator,
78
+ });
86
79
  }
87
80
  async buildTx({ maxGasAmount, gasUnitPrice, ...payload }, sender) {
88
81
  const functionAbi = "function" in payload ? this.getABI(payload.function) : undefined;
89
- const withFeePayer = !this.noFeePayer;
82
+ const withFeePayer = this.useGasStation;
90
83
  const replayProtectionNonce = generateRandomReplayProtectionNonce();
91
84
  // This should never happen, but just in case
92
85
  if (!replayProtectionNonce) {
@@ -10,18 +10,22 @@ export interface DecibelConfig extends ReleaseConfig {
10
10
  tradingHttpUrl: string;
11
11
  tradingWsUrl: string;
12
12
  /**
13
- * Gas station URL. When used with gasStationApiKey, this is the base URL for the Aptos Labs Gas Station API.
14
- * When used without gasStationApiKey, this is the URL for the legacy self-hosted fee payer (local dev only).
15
- * Example: "https://api.netna.aptoslabs.com/gs/v1"
13
+ * Base URL for the Geomi Gas Station API.
14
+ * Example: "https://api.testnet.aptoslabs.com/gs/v1"
16
15
  */
17
16
  gasStationUrl?: string;
18
17
  /**
19
- * API key for Aptos Labs Gas Station Client.
18
+ * API key for Geomi Gas Station Client.
20
19
  * When provided, uses GasStationClient with gasStationUrl as base URL.
21
20
  */
22
21
  gasStationApiKey?: string;
23
22
  deployment: Deployment;
24
23
  chainId?: number;
24
+ /**
25
+ * Additional HTTP headers to include in all requests (Node API, trading API, WebSocket).
26
+ * When set, replaces API key auth. All headers are passed through as-is.
27
+ */
28
+ additionalHeaders?: Record<string, string>;
25
29
  }
26
30
  export interface DecibelReaderDeps {
27
31
  aptos: Aptos;
@@ -38,6 +42,8 @@ export interface Deployment {
38
42
  export declare const NETNA_CONFIG: DecibelConfig;
39
43
  export declare const TESTNET_DEPLOYMENT: Deployment;
40
44
  export declare const TESTNET_CONFIG: DecibelConfig;
45
+ export declare const PREDEPOSIT_DEPLOYMENT: Deployment;
46
+ export declare const PREDEPOSIT_CONFIG: DecibelConfig;
41
47
  export declare const MAINNET_DEPLOYMENT: Deployment;
42
48
  export declare const MAINNET_CONFIG: DecibelConfig;
43
49
  export declare const LOCAL_CONFIG: DecibelConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAuB,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEzF,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EA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F,eAAO,MAAM,kBAAkB,EAAE,UAKhC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAS5B,CAAC;AAIF,eAAO,MAAM,qBAAqB,EAAE,UAKnC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,aAU/B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,UAKhC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAS5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,aAO1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAQ3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,CAOnE,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;CAM5B,CAAC"}
package/dist/constants.js CHANGED
@@ -19,10 +19,10 @@ const getDeployment = (pkg) => {
19
19
  };
20
20
  export const NETNA_CONFIG = {
21
21
  network: Network.CUSTOM,
22
- fullnodeUrl: "https://api.netna.staging.aptoslabs.com/v1",
23
- tradingHttpUrl: "https://api.netna.staging.aptoslabs.com/decibel",
24
- tradingWsUrl: "wss://api.netna.staging.aptoslabs.com/decibel/ws",
25
- gasStationUrl: "https://api.netna.staging.aptoslabs.com/gs/v1",
22
+ fullnodeUrl: "https://api.netna.aptoslabs.com/v1",
23
+ tradingHttpUrl: "https://api.netna.aptoslabs.com/decibel",
24
+ tradingWsUrl: "wss://api.netna.aptoslabs.com/decibel/ws",
25
+ gasStationUrl: "https://api.netna.aptoslabs.com/gs/v1",
26
26
  deployment: getDeployment(PACKAGE.NETNA),
27
27
  chainId: 208,
28
28
  ...RELEASE_CONFIGS.NETNA,
@@ -44,6 +44,22 @@ export const TESTNET_CONFIG = {
44
44
  ...RELEASE_CONFIGS.TESTNET,
45
45
  };
46
46
  const MAINNET_USDC = "0xbae207659db88bea0cbead6da0ed00aac12edcdda169e591cd41c94180b46f3b";
47
+ export const PREDEPOSIT_DEPLOYMENT = {
48
+ package: PACKAGE.PREDEPOSIT,
49
+ usdc: MAINNET_USDC,
50
+ testc: getTestcAddress(PACKAGE.PREDEPOSIT).toString(),
51
+ perpEngineGlobal: getPerpEngineGlobalAddress(PACKAGE.PREDEPOSIT).toString(),
52
+ };
53
+ export const PREDEPOSIT_CONFIG = {
54
+ network: Network.MAINNET,
55
+ fullnodeUrl: "https://api.mainnet.aptoslabs.com/v1",
56
+ tradingHttpUrl: "https://api-http-prod-mainnet-predeposit-asia-northeast1-51995220960.asia-northeast1.run.app",
57
+ tradingWsUrl: "wss://api.mainnet.aptoslabs.com/decibel/ws",
58
+ gasStationUrl: "https://api.mainnet.aptoslabs.com/gs/v1",
59
+ deployment: PREDEPOSIT_DEPLOYMENT,
60
+ chainId: 1,
61
+ ...RELEASE_CONFIGS.PREDEPOSIT,
62
+ };
47
63
  export const MAINNET_DEPLOYMENT = {
48
64
  package: PACKAGE.MAINNET,
49
65
  usdc: MAINNET_USDC,
@@ -65,7 +81,6 @@ export const LOCAL_CONFIG = {
65
81
  fullnodeUrl: "http://localhost:8080/v1",
66
82
  tradingHttpUrl: "http://localhost:8084",
67
83
  tradingWsUrl: "ws://localhost:8083",
68
- gasStationUrl: "http://localhost:8085",
69
84
  deployment: getDeployment(PACKAGE.NETNA),
70
85
  ...RELEASE_CONFIGS.LOCAL,
71
86
  };
@@ -75,7 +90,6 @@ export const DOCKER_CONFIG = {
75
90
  tradingHttpUrl: "http://trading-api-http:8080",
76
91
  // nosemgrep: javascript.lang.security.detect-insecure-websocket.detect-insecure-websocket
77
92
  tradingWsUrl: "ws://trading-api-ws:8080",
78
- gasStationUrl: "http://fee-payer:8080",
79
93
  deployment: getDeployment(PACKAGE.NETNA),
80
94
  ...RELEASE_CONFIGS.DOCKER,
81
95
  };
@@ -84,6 +98,7 @@ export const NAMED_CONFIGS = {
84
98
  local: LOCAL_CONFIG,
85
99
  docker: DOCKER_CONFIG,
86
100
  testnet: TESTNET_CONFIG,
101
+ predeposit: PREDEPOSIT_CONFIG,
87
102
  mainnet: MAINNET_CONFIG,
88
103
  };
89
104
  export const QUERY_PARAM_KEYS = {
package/dist/fee-pay.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { AccountAuthenticator, PendingTransactionResponse, SimpleTransaction } from "@aptos-labs/ts-sdk";
2
2
  import { DecibelConfig } from "./constants";
3
3
  /**
4
- * Submit a transaction with fee payer support.
5
- * Uses GasStationClient when gasStationApiKey is provided, otherwise falls back to legacy gasStationUrl.
4
+ * Submit a transaction with Gas Station fee sponsorship.
5
+ * Requires `gasStationApiKey` in the config.
6
6
  *
7
- * @param config The Decibel configuration
7
+ * @param config The Decibel configuration (must include gasStationApiKey)
8
8
  * @param transaction The transaction to submit
9
9
  * @param senderAuthenticator The sender's authenticator
10
10
  * @returns A promise that resolves to the pending transaction response
@@ -1 +1 @@
1
- {"version":3,"file":"fee-pay.d.ts","sourceRoot":"","sources":["../src/fee-pay.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,iBAAiB,EAC9B,mBAAmB,EAAE,oBAAoB,GACxC,OAAO,CAAC,0BAA0B,CAAC,CAsDrC"}
1
+ {"version":3,"file":"fee-pay.d.ts","sourceRoot":"","sources":["../src/fee-pay.ts"],"names":[],"mappings":"AACA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAC1B,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;;;GAQG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,iBAAiB,EAC9B,mBAAmB,EAAE,oBAAoB,GACxC,OAAO,CAAC,0BAA0B,CAAC,CA8BrC"}
package/dist/fee-pay.js CHANGED
@@ -1,62 +1,39 @@
1
1
  import { GasStationClient } from "@aptos-labs/gas-station-client";
2
2
  import { TransactionResponseType, } from "@aptos-labs/ts-sdk";
3
3
  /**
4
- * Submit a transaction with fee payer support.
5
- * Uses GasStationClient when gasStationApiKey is provided, otherwise falls back to legacy gasStationUrl.
4
+ * Submit a transaction with Gas Station fee sponsorship.
5
+ * Requires `gasStationApiKey` in the config.
6
6
  *
7
- * @param config The Decibel configuration
7
+ * @param config The Decibel configuration (must include gasStationApiKey)
8
8
  * @param transaction The transaction to submit
9
9
  * @param senderAuthenticator The sender's authenticator
10
10
  * @returns A promise that resolves to the pending transaction response
11
11
  */
12
12
  export async function submitFeePaidTransaction(config, transaction, senderAuthenticator) {
13
- // Use GasStationClient when API key is provided
14
- if (config.gasStationApiKey) {
15
- const gasStationClient = new GasStationClient({
16
- network: config.network,
17
- apiKey: config.gasStationApiKey,
18
- // Use gasStationUrl as base URL for custom networks like netna
19
- ...(config.gasStationUrl && { baseUrl: config.gasStationUrl }),
20
- });
21
- const { transactionHash } = await gasStationClient.signAndSubmitTransaction({
22
- transaction,
23
- senderAuthenticator,
24
- });
25
- // Build PendingTransactionResponse from SimpleTransaction.rawTransaction
26
- const rawTxn = transaction.rawTransaction;
27
- return {
28
- type: TransactionResponseType.Pending,
29
- hash: transactionHash,
30
- sender: rawTxn.sender.toString(),
31
- sequence_number: rawTxn.sequence_number.toString(),
32
- max_gas_amount: rawTxn.max_gas_amount.toString(),
33
- gas_unit_price: rawTxn.gas_unit_price.toString(),
34
- expiration_timestamp_secs: rawTxn.expiration_timestamp_secs.toString(),
35
- // Payload not available from gas station response
36
- payload: {},
37
- };
13
+ if (!config.gasStationApiKey) {
14
+ throw new Error("gasStationApiKey is required for fee-paid transactions");
38
15
  }
39
- // Legacy: use custom fee payer service via gasStationUrl (for local dev with self-hosted fee payer)
40
- const gasStationUrl = config.gasStationUrl;
41
- if (!gasStationUrl) {
42
- throw new Error("Either gasStationApiKey or gasStationUrl must be provided");
43
- }
44
- const signatureBcs = Array.from(senderAuthenticator.bcsToBytes());
45
- const transactionBcs = Array.from(transaction.rawTransaction.bcsToBytes());
46
- const body = JSON.stringify({
47
- signature: signatureBcs,
48
- transaction: transactionBcs,
16
+ const gasStationClient = new GasStationClient({
17
+ network: config.network,
18
+ apiKey: config.gasStationApiKey,
19
+ // Use gasStationUrl as base URL for custom networks like netna
20
+ ...(config.gasStationUrl && { baseUrl: config.gasStationUrl }),
49
21
  });
50
- const response = await fetch(gasStationUrl + "/transactions", {
51
- method: "POST",
52
- headers: {
53
- "Content-Type": "application/json",
54
- },
55
- body,
22
+ const { transactionHash } = await gasStationClient.signAndSubmitTransaction({
23
+ transaction,
24
+ senderAuthenticator,
56
25
  });
57
- if (!response.ok) {
58
- throw new Error(`HTTP error! status: ${response.status}`);
59
- }
60
- // TODO(bl): Error handling
61
- return (await response.json());
26
+ // Build PendingTransactionResponse from SimpleTransaction.rawTransaction
27
+ const rawTxn = transaction.rawTransaction;
28
+ return {
29
+ type: TransactionResponseType.Pending,
30
+ hash: transactionHash,
31
+ sender: rawTxn.sender.toString(),
32
+ sequence_number: rawTxn.sequence_number.toString(),
33
+ max_gas_amount: rawTxn.max_gas_amount.toString(),
34
+ gas_unit_price: rawTxn.gas_unit_price.toString(),
35
+ expiration_timestamp_secs: rawTxn.expiration_timestamp_secs.toString(),
36
+ // Payload not available from gas station response
37
+ payload: {},
38
+ };
62
39
  }
@@ -1 +1 @@
1
- {"version":3,"file":"gas-price-manager.d.ts","sourceRoot":"","sources":["../../src/gas/gas-price-manager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,WAAW,YAAY;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,sBAAsB;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,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AS;gBAExB,MAAM,EAAE,aAAa,EAAE,IAAI,CAAC,EAAE,sBAAsB;IAchE,WAAW,IAAI,MAAM,GAAG,SAAS;IAQjC;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBjC,OAAO;IAIP;;OAEG;IACH,OAAO,IAAI,IAAI;IAST,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC;IAMhD;;OAEG;IACG,mBAAmB,IAAI,OAAO,CAAC,MAAM,CAAC;CAmB7C"}
@@ -10,7 +10,9 @@ export class GasPriceManager {
10
10
  this.aptos = new Aptos(new AptosConfig({
11
11
  network: config.network,
12
12
  fullnode: config.fullnodeUrl,
13
- clientConfig: { API_KEY: opts?.nodeApiKey },
13
+ clientConfig: config.additionalHeaders
14
+ ? { HEADERS: config.additionalHeaders }
15
+ : { API_KEY: opts?.nodeApiKey },
14
16
  }));
15
17
  this.refreshIntervalMs = opts?.refreshIntervalMs ?? 60_000; // default to 1 minute
16
18
  this.multiplier = opts?.multiplier ?? 2; // default to 2x multilier to ensure we have enough gas for the transactipon
@@ -29,6 +29,8 @@ export declare class AccountOverviewReader extends BaseReader {
29
29
  liquidation_fees_paid: number | null;
30
30
  liquidation_losses: number | null;
31
31
  net_deposits?: number | null | undefined;
32
+ margin_deficit?: number | undefined;
33
+ vault_equity?: number | null | undefined;
32
34
  }>;
33
35
  /**
34
36
  * Subscribe to account overview
@@ -1 +1 @@
1
- {"version":3,"file":"account-overview.reader.d.ts","sourceRoot":"","sources":["../../../src/read/account-overview/account-overview.reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,0BAA0B,EAE1B,wBAAwB,EAEzB,MAAM,0BAA0B,CAAC;AAElC,qBAAa,qBAAsB,SAAQ,UAAU;IACnD;;;;OAIG;IACG,SAAS,CAAC,EACd,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,kBAAkB,GACnB,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;IAgB7B;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI;CAKlF"}
1
+ {"version":3,"file":"account-overview.reader.d.ts","sourceRoot":"","sources":["../../../src/read/account-overview/account-overview.reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,0BAA0B,EAE1B,wBAAwB,EAEzB,MAAM,0BAA0B,CAAC;AAElC,qBAAa,qBAAsB,SAAQ,UAAU;IACnD;;;;OAIG;IACG,SAAS,CAAC,EACd,OAAO,EACP,YAAY,EACZ,YAAY,EACZ,kBAAkB,GACnB,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;IAgB7B;;;;;OAKG;IACH,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI;CAKlF"}
@@ -32,9 +32,11 @@ export declare const AccountOverviewSchema: z.ZodObject<{
32
32
  total_margin: z.ZodNumber;
33
33
  usdc_cross_withdrawable_balance: z.ZodNumber;
34
34
  usdc_isolated_withdrawable_balance: z.ZodNumber;
35
+ margin_deficit: z.ZodOptional<z.ZodNumber>;
35
36
  realized_pnl: z.ZodNullable<z.ZodNumber>;
36
37
  liquidation_fees_paid: z.ZodNullable<z.ZodNumber>;
37
38
  liquidation_losses: z.ZodNullable<z.ZodNumber>;
39
+ vault_equity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
38
40
  }, z.core.$strip>;
39
41
  export declare const AccountOverviewWsMessageSchema: z.ZodObject<{
40
42
  account_overview: z.ZodObject<{
@@ -56,9 +58,11 @@ export declare const AccountOverviewWsMessageSchema: z.ZodObject<{
56
58
  total_margin: z.ZodNumber;
57
59
  usdc_cross_withdrawable_balance: z.ZodNumber;
58
60
  usdc_isolated_withdrawable_balance: z.ZodNumber;
61
+ margin_deficit: z.ZodOptional<z.ZodNumber>;
59
62
  realized_pnl: z.ZodNullable<z.ZodNumber>;
60
63
  liquidation_fees_paid: z.ZodNullable<z.ZodNumber>;
61
64
  liquidation_losses: z.ZodNullable<z.ZodNumber>;
65
+ vault_equity: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
62
66
  }, z.core.$strip>;
63
67
  }, z.core.$strip>;
64
68
  export type AccountOverview = z.infer<typeof AccountOverviewSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"account-overview.types.d.ts","sourceRoot":"","sources":["../../../src/read/account-overview/account-overview.types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE5E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;iBAwBhC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;iBAEzC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
1
+ {"version":3,"file":"account-overview.types.d.ts","sourceRoot":"","sources":["../../../src/read/account-overview/account-overview.types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,WAAW,0BAA2B,SAAQ,eAAe;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,eAAO,MAAM,YAAY;;;;;CAKf,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC;AAE5E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;iBA6BhC,CAAC;AAEH,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEzC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,MAAM,MAAM,wBAAwB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC"}
@@ -26,9 +26,14 @@ export const AccountOverviewSchema = z.object({
26
26
  total_margin: z.number(),
27
27
  usdc_cross_withdrawable_balance: z.number(),
28
28
  usdc_isolated_withdrawable_balance: z.number(),
29
+ /** Cross-margin deficit: 0 when healthy, negative when the account has a margin hole.
30
+ * When negative, new deposits partially fill this deficit before becoming available to trade. */
31
+ margin_deficit: z.number().optional(), // TODO: Remove optional once back-end is deployed
29
32
  realized_pnl: z.number().nullable(),
30
33
  liquidation_fees_paid: z.number().nullable(),
31
34
  liquidation_losses: z.number().nullable(),
35
+ /** Total USDC value of vault shares held by this account. NULL when not yet available via WebSocket. */
36
+ vault_equity: z.number().nullable().optional(), // TODO: Remove optional once back-end is deployed
32
37
  });
33
38
  export const AccountOverviewWsMessageSchema = z.object({
34
39
  account_overview: AccountOverviewSchema.omit({ volume: true }),
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Extracts the position direction from a trade action.
3
+ *
4
+ * @param action - The trade action (e.g., "CloseLong", "OpenShort")
5
+ * @returns The position direction: "Long" or "Short"
6
+ *
7
+ * @example
8
+ * getPositionDirection("CloseLong") // returns "Long"
9
+ * getPositionDirection("OpenShort") // returns "Short"
10
+ */
11
+ export declare function getPositionDirection(action: string): "Long" | "Short";
12
+ //# sourceMappingURL=action-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-utils.d.ts","sourceRoot":"","sources":["../../src/read/action-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAErE"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Extracts the position direction from a trade action.
3
+ *
4
+ * @param action - The trade action (e.g., "CloseLong", "OpenShort")
5
+ * @returns The position direction: "Long" or "Short"
6
+ *
7
+ * @example
8
+ * getPositionDirection("CloseLong") // returns "Long"
9
+ * getPositionDirection("OpenShort") // returns "Short"
10
+ */
11
+ export function getPositionDirection(action) {
12
+ return action.includes("Long") ? "Long" : "Short";
13
+ }