@decibeltrade/sdk 0.3.0 → 0.4.0

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 (138) hide show
  1. package/dist/abi/json/netna.json +795 -280
  2. package/dist/abi/json/testnet.json +734 -507
  3. package/dist/admin.d.ts +43 -5
  4. package/dist/admin.d.ts.map +1 -1
  5. package/dist/admin.js +114 -11
  6. package/dist/base.d.ts +1 -6
  7. package/dist/base.d.ts.map +1 -1
  8. package/dist/base.js +13 -23
  9. package/dist/constants.d.ts +12 -4
  10. package/dist/constants.d.ts.map +1 -1
  11. package/dist/constants.js +40 -7
  12. package/dist/fee-pay.d.ts +3 -3
  13. package/dist/fee-pay.d.ts.map +1 -1
  14. package/dist/fee-pay.js +26 -49
  15. package/dist/gas/gas-price-manager.d.ts.map +1 -1
  16. package/dist/gas/gas-price-manager.js +3 -1
  17. package/dist/read/account-overview/account-overview.reader.d.ts +2 -0
  18. package/dist/read/account-overview/account-overview.reader.d.ts.map +1 -1
  19. package/dist/read/account-overview/account-overview.types.d.ts +4 -0
  20. package/dist/read/account-overview/account-overview.types.d.ts.map +1 -1
  21. package/dist/read/account-overview/account-overview.types.js +5 -0
  22. package/dist/read/action-utils.d.ts +12 -0
  23. package/dist/read/action-utils.d.ts.map +1 -0
  24. package/dist/read/action-utils.js +13 -0
  25. package/dist/read/base-reader.d.ts +1 -0
  26. package/dist/read/base-reader.d.ts.map +1 -1
  27. package/dist/read/base-reader.js +15 -0
  28. package/dist/read/base-reader.test.d.ts +2 -0
  29. package/dist/read/base-reader.test.d.ts.map +1 -0
  30. package/dist/read/base-reader.test.js +68 -0
  31. package/dist/read/global-points-stats/global-points-stats.reader.d.ts +9 -0
  32. package/dist/read/global-points-stats/global-points-stats.reader.d.ts.map +1 -0
  33. package/dist/read/global-points-stats/global-points-stats.reader.js +12 -0
  34. package/dist/read/global-points-stats/global-points-stats.types.d.ts +9 -0
  35. package/dist/read/global-points-stats/global-points-stats.types.d.ts.map +1 -0
  36. package/dist/read/global-points-stats/global-points-stats.types.js +5 -0
  37. package/dist/read/index.d.ts +15 -0
  38. package/dist/read/index.d.ts.map +1 -1
  39. package/dist/read/index.js +27 -3
  40. package/dist/read/market-depth/market-depth.reader.d.ts +1 -17
  41. package/dist/read/market-depth/market-depth.reader.d.ts.map +1 -1
  42. package/dist/read/market-depth/market-depth.reader.js +18 -20
  43. package/dist/read/market-depth/market-depth.types.d.ts +5 -2
  44. package/dist/read/market-depth/market-depth.types.d.ts.map +1 -1
  45. package/dist/read/market-depth/market-depth.types.js +4 -1
  46. package/dist/read/market-trades/market-trades.reader.d.ts +0 -1
  47. package/dist/read/market-trades/market-trades.reader.d.ts.map +1 -1
  48. package/dist/read/market-trades/market-trades.types.d.ts +0 -3
  49. package/dist/read/market-trades/market-trades.types.d.ts.map +1 -1
  50. package/dist/read/market-trades/market-trades.types.js +0 -1
  51. package/dist/read/points-leaderboard/points-leaderboard.reader.d.ts +21 -0
  52. package/dist/read/points-leaderboard/points-leaderboard.reader.d.ts.map +1 -0
  53. package/dist/read/points-leaderboard/points-leaderboard.reader.js +23 -0
  54. package/dist/read/points-leaderboard/points-leaderboard.types.d.ts +30 -0
  55. package/dist/read/points-leaderboard/points-leaderboard.types.d.ts.map +1 -0
  56. package/dist/read/points-leaderboard/points-leaderboard.types.js +11 -0
  57. package/dist/read/portfolio-chart/portfolio-chart.types.d.ts +1 -1
  58. package/dist/read/portfolio-chart/portfolio-chart.types.d.ts.map +1 -1
  59. package/dist/read/referrals/referrals.reader.d.ts +98 -0
  60. package/dist/read/referrals/referrals.reader.d.ts.map +1 -0
  61. package/dist/read/referrals/referrals.reader.js +92 -0
  62. package/dist/read/referrals/referrals.types.d.ts +136 -0
  63. package/dist/read/referrals/referrals.types.d.ts.map +1 -0
  64. package/dist/read/referrals/referrals.types.js +85 -0
  65. package/dist/read/streaks/streaks.reader.d.ts +19 -0
  66. package/dist/read/streaks/streaks.reader.d.ts.map +1 -0
  67. package/dist/read/streaks/streaks.reader.js +19 -0
  68. package/dist/read/streaks/streaks.types.d.ts +17 -0
  69. package/dist/read/streaks/streaks.types.d.ts.map +1 -0
  70. package/dist/read/streaks/streaks.types.js +10 -0
  71. package/dist/read/tier/tier.reader.d.ts +21 -0
  72. package/dist/read/tier/tier.reader.d.ts.map +1 -0
  73. package/dist/read/tier/tier.reader.js +19 -0
  74. package/dist/read/tier/tier.types.d.ts +25 -0
  75. package/dist/read/tier/tier.types.d.ts.map +1 -0
  76. package/dist/read/tier/tier.types.js +13 -0
  77. package/dist/read/trading-amps/trading-amps.reader.d.ts +18 -0
  78. package/dist/read/trading-amps/trading-amps.reader.d.ts.map +1 -0
  79. package/dist/read/trading-amps/trading-amps.reader.js +23 -0
  80. package/dist/read/trading-amps/trading-amps.types.d.ts +25 -0
  81. package/dist/read/trading-amps/trading-amps.types.d.ts.map +1 -0
  82. package/dist/read/trading-amps/trading-amps.types.js +10 -0
  83. package/dist/read/trading-points/trading-points.reader.d.ts +18 -0
  84. package/dist/read/trading-points/trading-points.reader.d.ts.map +1 -0
  85. package/dist/read/trading-points/trading-points.reader.js +19 -0
  86. package/dist/read/trading-points/trading-points.types.d.ts +21 -0
  87. package/dist/read/trading-points/trading-points.types.d.ts.map +1 -0
  88. package/dist/read/trading-points/trading-points.types.js +10 -0
  89. package/dist/read/types.d.ts +7 -0
  90. package/dist/read/types.d.ts.map +1 -1
  91. package/dist/read/types.js +7 -0
  92. package/dist/read/user-funding-history/user-funding-history.reader.d.ts +1 -2
  93. package/dist/read/user-funding-history/user-funding-history.reader.d.ts.map +1 -1
  94. package/dist/read/user-funding-history/user-funding-history.types.d.ts +8 -4
  95. package/dist/read/user-funding-history/user-funding-history.types.d.ts.map +1 -1
  96. package/dist/read/user-funding-history/user-funding-history.types.js +1 -2
  97. package/dist/read/user-notifications/user-notifications.types.d.ts +1 -2
  98. package/dist/read/user-notifications/user-notifications.types.d.ts.map +1 -1
  99. package/dist/read/user-open-orders/user-open-orders.reader.d.ts +1 -2
  100. package/dist/read/user-open-orders/user-open-orders.reader.d.ts.map +1 -1
  101. package/dist/read/user-open-orders/user-open-orders.reader.js +1 -1
  102. package/dist/read/user-open-orders/user-open-orders.types.d.ts +3 -6
  103. package/dist/read/user-open-orders/user-open-orders.types.d.ts.map +1 -1
  104. package/dist/read/user-open-orders/user-open-orders.types.js +1 -2
  105. package/dist/read/user-order-history/user-order-history.reader.d.ts +1 -2
  106. package/dist/read/user-order-history/user-order-history.reader.d.ts.map +1 -1
  107. package/dist/read/user-order-history/user-order-history.reader.js +1 -1
  108. package/dist/read/user-order-history/user-order-history.types.d.ts +3 -6
  109. package/dist/read/user-order-history/user-order-history.types.d.ts.map +1 -1
  110. package/dist/read/user-order-history/user-order-history.types.js +1 -2
  111. package/dist/read/user-positions/user-positions.reader.d.ts +1 -0
  112. package/dist/read/user-positions/user-positions.reader.d.ts.map +1 -1
  113. package/dist/read/user-positions/user-positions.types.d.ts +220 -10
  114. package/dist/read/user-positions/user-positions.types.d.ts.map +1 -1
  115. package/dist/read/user-positions/user-positions.types.js +1 -0
  116. package/dist/read/user-trade-history/user-trade-history.reader.d.ts +5 -2
  117. package/dist/read/user-trade-history/user-trade-history.reader.d.ts.map +1 -1
  118. package/dist/read/user-trade-history/user-trade-history.types.d.ts +36 -9
  119. package/dist/read/user-trade-history/user-trade-history.types.d.ts.map +1 -1
  120. package/dist/read/user-trade-history/user-trade-history.types.js +4 -1
  121. package/dist/read/vaults/vaults.reader.d.ts +6 -4
  122. package/dist/read/vaults/vaults.reader.d.ts.map +1 -1
  123. package/dist/read/vaults/vaults.reader.js +4 -0
  124. package/dist/read/vaults/vaults.types.d.ts +30 -12
  125. package/dist/read/vaults/vaults.types.d.ts.map +1 -1
  126. package/dist/read/vaults/vaults.types.js +20 -3
  127. package/dist/read/ws-subscription.d.ts +1 -1
  128. package/dist/read/ws-subscription.d.ts.map +1 -1
  129. package/dist/read/ws-subscription.js +9 -1
  130. package/dist/release-config.d.ts +5 -2
  131. package/dist/release-config.d.ts.map +1 -1
  132. package/dist/release-config.js +15 -5
  133. package/dist/tsconfig.tsbuildinfo +1 -1
  134. package/dist/write.d.ts +12 -0
  135. package/dist/write.d.ts.map +1 -1
  136. package/dist/write.js +24 -7
  137. package/package.json +1 -1
  138. package/readme.md +7 -48
package/dist/admin.d.ts CHANGED
@@ -4,7 +4,7 @@ export declare class DecibelAdminDex extends BaseSDK {
4
4
  /**
5
5
  * Initialize the global vault system. Only callable by the admin account.
6
6
  */
7
- initialize(collateralTokenAddr: string, collateralBalanceDecimals: number, backstopLiquidatorAddr: string): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
7
+ initialize(collateralTokenAddr: string, backstopLiquidatorAddr: string): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
8
8
  getProtocolVaultAddress(): AccountAddress;
9
9
  initializeProtocolVault(collateralTokenAddr: string, initialFunding: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
10
10
  delegateProtocolVaultTradingTo(vaultAddress: string, accountToDelegateTo: string): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
@@ -12,21 +12,59 @@ export declare class DecibelAdminDex extends BaseSDK {
12
12
  authorizeOracleAndMarkUpdate(internalOracleUpdater: string): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
13
13
  addAccessControlAdmin(delegatedAdmin: string): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
14
14
  addMarketListAdmin(delegatedAdmin: string): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
15
- registerMarketWithInternalOracle(name: string, szDecimals: number, minSize: number, lotSize: number, tickerSize: number, maxOpenInterest: number, maxLeverage: number, taker_in_next_block?: boolean, initial_oracle_price?: number, max_staleness_secs?: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
16
- registerMarketWithPythOracle(name: string, szDecimals: number, minSize: number, lotSize: number, tickerSize: number, maxOpenInterest: number, maxLeverage: number, taker_in_next_block: boolean | undefined, pythIdentifierBytes: number[], pythMaxStalenessSecs: number, pythConfidenceIntervalThreshold: number, pythDecimals: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
17
- registerMarketWithCompositeOraclePrimaryPyth(name: string, szDecimals: number, minSize: number, lotSize: number, tickerSize: number, maxOpenInterest: number, maxLeverage: number, taker_in_next_block: boolean | undefined, pythIdentifierBytes: number[], pythMaxStalenessSecs: number, pythConfidenceIntervalThreshold: number, pythDecimals: number, internalInitialPrice: number, internalMaxStalenessSecs: number, oraclesDeviationBps: number, consecutiveDeviationCount: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
18
- registerMarketWithCompositeOraclePrimaryChainlink(name: string, szDecimals: number, minSize: number, lotSize: number, tickerSize: number, maxOpenInterest: number, maxLeverage: number, taker_in_next_block: boolean | undefined, rescaleDecimals: number, chainlinkFeedIdBytes: number[], chainlinkMaxStalenessSecs: number, internalMaxStalenessSecs: number, internalInitialPrice: number, oraclesDeviationBps: number, consecutiveDeviationCount: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
15
+ addMarketRiskGovernor(delegatedAdmin: string): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
16
+ registerMarketWithInternalOracle(name: string, szDecimals: number, minSize: number, lotSize: number, tickerSize: number, maxOpenInterest: number, maxLeverage: number, marginCallFeePct: number, taker_in_next_block?: boolean, initial_oracle_price?: number, max_staleness_secs?: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
17
+ registerMarketWithPythOracle(name: string, szDecimals: number, minSize: number, lotSize: number, tickerSize: number, maxOpenInterest: number, maxLeverage: number, marginCallFeePct: number, taker_in_next_block: boolean | undefined, pythIdentifierBytes: number[], pythMaxStalenessSecs: number, pythConfidenceIntervalThreshold: number, pythDecimals: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
18
+ registerMarketWithCompositeOraclePrimaryPyth(name: string, szDecimals: number, minSize: number, lotSize: number, tickerSize: number, maxOpenInterest: number, maxLeverage: number, marginCallFeePct: number, taker_in_next_block: boolean | undefined, pythIdentifierBytes: number[], pythMaxStalenessSecs: number, pythConfidenceIntervalThreshold: number, pythDecimals: number, internalInitialPrice: number, internalMaxStalenessSecs: number, oraclesDeviationBps: number, consecutiveDeviationCount: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
19
+ registerMarketWithCompositeOraclePrimaryChainlink(name: string, szDecimals: number, minSize: number, lotSize: number, tickerSize: number, maxOpenInterest: number, maxLeverage: number, marginCallFeePct: number, taker_in_next_block: boolean | undefined, rescaleDecimals: number, chainlinkFeedIdBytes: number[], chainlinkMaxStalenessSecs: number, internalMaxStalenessSecs: number, internalInitialPrice: number, oraclesDeviationBps: number, consecutiveDeviationCount: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
19
20
  updateInternalOraclePrice(marketName: string, oraclePrice: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
20
21
  updatePythOraclePrice(marketName: string, vaa: number[]): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
21
22
  updatePriceToPythOnly(vaas: number[][]): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
22
23
  updatePriceToChainlinkOnly(signedReport: number[]): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
23
24
  mintUsdc(toAddr: AccountAddress, amount: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
24
25
  setPublicMinting(allow: boolean): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
26
+ setMarketAdlTriggerThreshold(marketName: string, threshold: number): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
25
27
  /**
26
28
  * Get the balance of USDC for an account
27
29
  * @param addr The account address to get the balance for
28
30
  * @returns The balance of USDC for the account
29
31
  */
30
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>;
31
69
  }
32
70
  //# sourceMappingURL=admin.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"admin.d.ts","sourceRoot":"","sources":["../src/adm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AAM,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
@@ -5,11 +5,11 @@ export class DecibelAdminDex extends BaseSDK {
5
5
  /**
6
6
  * Initialize the global vault system. Only callable by the admin account.
7
7
  */
8
- async initialize(collateralTokenAddr, collateralBalanceDecimals, backstopLiquidatorAddr) {
8
+ async initialize(collateralTokenAddr, backstopLiquidatorAddr) {
9
9
  return await this.sendTx({
10
10
  function: `${this.config.deployment.package}::admin_apis::initialize`,
11
11
  typeArguments: [],
12
- functionArguments: [collateralTokenAddr, collateralBalanceDecimals, backstopLiquidatorAddr],
12
+ functionArguments: [collateralTokenAddr, backstopLiquidatorAddr],
13
13
  });
14
14
  }
15
15
  getProtocolVaultAddress() {
@@ -22,7 +22,7 @@ export class DecibelAdminDex extends BaseSDK {
22
22
  function: `${this.config.deployment.package}::vault_api::create_and_fund_vault`,
23
23
  typeArguments: [],
24
24
  functionArguments: [
25
- null,
25
+ this.getPrimarySubaccountAddress(this.account.accountAddress),
26
26
  collateralTokenAddr,
27
27
  "Decibel Protocol Vault",
28
28
  "(description)",
@@ -41,14 +41,14 @@ export class DecibelAdminDex extends BaseSDK {
41
41
  }
42
42
  async delegateProtocolVaultTradingTo(vaultAddress, accountToDelegateTo) {
43
43
  return await this.sendTx({
44
- function: `${this.config.deployment.package}::vault::delegate_dex_actions_to`,
44
+ function: `${this.config.deployment.package}::vault_admin_api::delegate_dex_actions_to`,
45
45
  typeArguments: [],
46
46
  functionArguments: [vaultAddress, accountToDelegateTo, undefined],
47
47
  });
48
48
  }
49
49
  async updateVaultUseGlobalRedemptionSlippageAdjustment(vaultAddress, useGlobalRedemptionSlippageAdjustment) {
50
50
  return await this.sendTx({
51
- function: `${this.config.deployment.package}::vault::update_vault_use_global_redemption_slippage_adjustment`,
51
+ function: `${this.config.deployment.package}::vault_admin_api::update_vault_use_global_redemption_slippage_adjustment`,
52
52
  typeArguments: [],
53
53
  functionArguments: [vaultAddress, useGlobalRedemptionSlippageAdjustment],
54
54
  });
@@ -74,7 +74,14 @@ export class DecibelAdminDex extends BaseSDK {
74
74
  functionArguments: [delegatedAdmin],
75
75
  });
76
76
  }
77
- async registerMarketWithInternalOracle(name, szDecimals, minSize, lotSize, tickerSize, maxOpenInterest, maxLeverage, taker_in_next_block = true, initial_oracle_price = 1, max_staleness_secs = 60) {
77
+ async addMarketRiskGovernor(delegatedAdmin) {
78
+ return await this.sendTx({
79
+ function: `${this.config.deployment.package}::admin_apis::add_market_risk_governor`,
80
+ typeArguments: [],
81
+ functionArguments: [delegatedAdmin],
82
+ });
83
+ }
84
+ async registerMarketWithInternalOracle(name, szDecimals, minSize, lotSize, tickerSize, maxOpenInterest, maxLeverage, marginCallFeePct, taker_in_next_block = true, initial_oracle_price = 1, max_staleness_secs = 60) {
78
85
  return await this.sendTx({
79
86
  function: `${this.config.deployment.package}::admin_apis::register_market_with_internal_oracle`,
80
87
  typeArguments: [],
@@ -86,13 +93,14 @@ export class DecibelAdminDex extends BaseSDK {
86
93
  tickerSize,
87
94
  maxOpenInterest,
88
95
  maxLeverage,
96
+ marginCallFeePct,
89
97
  taker_in_next_block,
90
98
  initial_oracle_price,
91
99
  max_staleness_secs,
92
100
  ],
93
101
  });
94
102
  }
95
- async registerMarketWithPythOracle(name, szDecimals, minSize, lotSize, tickerSize, maxOpenInterest, maxLeverage, taker_in_next_block = true, pythIdentifierBytes, pythMaxStalenessSecs, pythConfidenceIntervalThreshold, pythDecimals) {
103
+ async registerMarketWithPythOracle(name, szDecimals, minSize, lotSize, tickerSize, maxOpenInterest, maxLeverage, marginCallFeePct, taker_in_next_block = true, pythIdentifierBytes, pythMaxStalenessSecs, pythConfidenceIntervalThreshold, pythDecimals) {
96
104
  return await this.sendTx({
97
105
  function: `${this.config.deployment.package}::admin_apis::register_market_with_pyth_oracle`,
98
106
  typeArguments: [],
@@ -104,6 +112,7 @@ export class DecibelAdminDex extends BaseSDK {
104
112
  tickerSize,
105
113
  maxOpenInterest,
106
114
  maxLeverage,
115
+ marginCallFeePct,
107
116
  taker_in_next_block,
108
117
  pythIdentifierBytes,
109
118
  pythMaxStalenessSecs,
@@ -112,7 +121,7 @@ export class DecibelAdminDex extends BaseSDK {
112
121
  ],
113
122
  });
114
123
  }
115
- async registerMarketWithCompositeOraclePrimaryPyth(name, szDecimals, minSize, lotSize, tickerSize, maxOpenInterest, maxLeverage, taker_in_next_block = true, pythIdentifierBytes, pythMaxStalenessSecs, pythConfidenceIntervalThreshold, pythDecimals, internalInitialPrice, internalMaxStalenessSecs, oraclesDeviationBps, consecutiveDeviationCount) {
124
+ async registerMarketWithCompositeOraclePrimaryPyth(name, szDecimals, minSize, lotSize, tickerSize, maxOpenInterest, maxLeverage, marginCallFeePct, taker_in_next_block = true, pythIdentifierBytes, pythMaxStalenessSecs, pythConfidenceIntervalThreshold, pythDecimals, internalInitialPrice, internalMaxStalenessSecs, oraclesDeviationBps, consecutiveDeviationCount) {
116
125
  return await this.sendTx({
117
126
  function: `${this.config.deployment.package}::admin_apis::register_market_with_composite_oracle_primary_pyth`,
118
127
  typeArguments: [],
@@ -124,6 +133,7 @@ export class DecibelAdminDex extends BaseSDK {
124
133
  tickerSize,
125
134
  maxOpenInterest,
126
135
  maxLeverage,
136
+ marginCallFeePct,
127
137
  taker_in_next_block,
128
138
  pythIdentifierBytes,
129
139
  pythMaxStalenessSecs,
@@ -136,7 +146,7 @@ export class DecibelAdminDex extends BaseSDK {
136
146
  ],
137
147
  });
138
148
  }
139
- async registerMarketWithCompositeOraclePrimaryChainlink(name, szDecimals, minSize, lotSize, tickerSize, maxOpenInterest, maxLeverage, taker_in_next_block = true, rescaleDecimals, chainlinkFeedIdBytes, chainlinkMaxStalenessSecs, internalMaxStalenessSecs, internalInitialPrice, oraclesDeviationBps, consecutiveDeviationCount) {
149
+ async registerMarketWithCompositeOraclePrimaryChainlink(name, szDecimals, minSize, lotSize, tickerSize, maxOpenInterest, maxLeverage, marginCallFeePct, taker_in_next_block = true, rescaleDecimals, chainlinkFeedIdBytes, chainlinkMaxStalenessSecs, internalMaxStalenessSecs, internalInitialPrice, oraclesDeviationBps, consecutiveDeviationCount) {
140
150
  return await this.sendTx({
141
151
  function: `${this.config.deployment.package}::admin_apis::register_market_with_composite_oracle_primary_chainlink`,
142
152
  typeArguments: [],
@@ -148,6 +158,7 @@ export class DecibelAdminDex extends BaseSDK {
148
158
  tickerSize,
149
159
  maxOpenInterest,
150
160
  maxLeverage,
161
+ marginCallFeePct,
151
162
  taker_in_next_block,
152
163
  chainlinkFeedIdBytes,
153
164
  chainlinkMaxStalenessSecs,
@@ -164,7 +175,7 @@ export class DecibelAdminDex extends BaseSDK {
164
175
  return await this.sendTx({
165
176
  function: `${this.config.deployment.package}::admin_apis::update_mark_for_internal_oracle`,
166
177
  typeArguments: [],
167
- functionArguments: [marketAddr, oraclePrice, [], true],
178
+ functionArguments: [marketAddr, oraclePrice, [], [], true],
168
179
  });
169
180
  }
170
181
  async updatePythOraclePrice(marketName, vaa) {
@@ -172,7 +183,7 @@ export class DecibelAdminDex extends BaseSDK {
172
183
  return await this.sendTx({
173
184
  function: `${this.config.deployment.package}::admin_apis::update_mark_for_pyth_oracle`,
174
185
  typeArguments: [],
175
- functionArguments: [marketAddr, vaa, [], true],
186
+ functionArguments: [marketAddr, vaa, [], [], true],
176
187
  });
177
188
  }
178
189
  async updatePriceToPythOnly(vaas) {
@@ -203,6 +214,14 @@ export class DecibelAdminDex extends BaseSDK {
203
214
  functionArguments: [allow],
204
215
  });
205
216
  }
217
+ async setMarketAdlTriggerThreshold(marketName, threshold) {
218
+ const marketAddr = getMarketAddr(marketName, this.config.deployment.perpEngineGlobal);
219
+ return await this.sendTx({
220
+ function: `${this.config.deployment.package}::admin_apis::set_market_adl_trigger_threshold`,
221
+ typeArguments: [],
222
+ functionArguments: [marketAddr, threshold],
223
+ });
224
+ }
206
225
  /**
207
226
  * Get the balance of USDC for an account
208
227
  * @param addr The account address to get the balance for
@@ -218,4 +237,88 @@ export class DecibelAdminDex extends BaseSDK {
218
237
  });
219
238
  return balance[0];
220
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
+ }
221
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;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC;;;OAGG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CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;CAOjE"}
package/dist/base.js CHANGED
@@ -3,7 +3,6 @@ import { Aptos, AptosConfig, } from "@aptos-labs/ts-sdk";
3
3
  import netnaAbis from "./abi/json/netna.json";
4
4
  import testnetAbis from "./abi/json/testnet.json";
5
5
  import { NETNA_CONFIG, TESTNET_CONFIG } from "./constants";
6
- import { submitFeePaidTransaction } from "./fee-pay";
7
6
  import { buildSimpleTransactionSync } from "./transaction-builder";
8
7
  import { generateRandomReplayProtectionNonce, getPrimarySubaccountAddr } from "./utils";
9
8
  const chainIdToAbi = {};
@@ -16,11 +15,7 @@ export class BaseSDK {
16
15
  account;
17
16
  aptos;
18
17
  skipSimulate;
19
- noFeePayer;
20
- /**
21
- * Whether we're using the new GasStationClient (API key based) vs legacy gasStationUrl
22
- */
23
- useGasStationClient;
18
+ useGasStation;
24
19
  chainId;
25
20
  abi = netnaAbis;
26
21
  gasPriceManager;
@@ -43,9 +38,8 @@ export class BaseSDK {
43
38
  this.abi = netnaAbis;
44
39
  console.warn("Using NETNA ABI for unsupported chain id, this might cause issues with the transaction builder");
45
40
  }
46
- this.noFeePayer = opts?.noFeePayer ?? false;
47
- this.useGasStationClient = !this.noFeePayer && !!config.gasStationApiKey;
48
- const pluginSettings = this.useGasStationClient && config.gasStationApiKey
41
+ this.useGasStation = !!config.gasStationApiKey;
42
+ const pluginSettings = this.useGasStation && config.gasStationApiKey
49
43
  ? {
50
44
  TRANSACTION_SUBMITTER: new GasStationTransactionSubmitter(new GasStationClient({
51
45
  network: config.network,
@@ -58,7 +52,9 @@ export class BaseSDK {
58
52
  const aptosConfig = new AptosConfig({
59
53
  network: config.network,
60
54
  fullnode: config.fullnodeUrl,
61
- clientConfig: { API_KEY: opts?.nodeApiKey },
55
+ clientConfig: config.additionalHeaders
56
+ ? { HEADERS: config.additionalHeaders }
57
+ : { API_KEY: opts?.nodeApiKey },
62
58
  pluginSettings,
63
59
  });
64
60
  this.aptos = new Aptos(aptosConfig);
@@ -71,22 +67,16 @@ export class BaseSDK {
71
67
  return this.abi.abis[functionId] ?? null;
72
68
  }
73
69
  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
- }
70
+ // When gasStationApiKey is set, the GasStationTransactionSubmitter plugin
71
+ // handles fee payer signing automatically. Otherwise, submits directly (self-pay).
72
+ return await this.aptos.transaction.submit.simple({
73
+ transaction,
74
+ senderAuthenticator,
75
+ });
86
76
  }
87
77
  async buildTx({ maxGasAmount, gasUnitPrice, ...payload }, sender) {
88
78
  const functionAbi = "function" in payload ? this.getABI(payload.function) : undefined;
89
- const withFeePayer = !this.noFeePayer;
79
+ const withFeePayer = this.useGasStation;
90
80
  const replayProtectionNonce = generateRandomReplayProtectionNonce();
91
81
  // This should never happen, but just in case
92
82
  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,10 @@ 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;
47
+ export declare const MAINNET_DEPLOYMENT: Deployment;
48
+ export declare const MAINNET_CONFIG: DecibelConfig;
41
49
  export declare const LOCAL_CONFIG: DecibelConfig;
42
50
  export declare const DOCKER_CONFIG: DecibelConfig;
43
51
  export declare const NAMED_CONFIGS: Record<string, DecibelConfig | undefined>;
@@ -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,EAA4B,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAE3E,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,kBAKnD;AAED,wBAAgB,eAAe,CAAC,aAAa,EAAE,MAAM,kBAKpD;AAED,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,MAAM,kBAK/D;AAED,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,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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,
@@ -38,17 +38,49 @@ export const TESTNET_CONFIG = {
38
38
  fullnodeUrl: "https://api.testnet.aptoslabs.com/v1",
39
39
  tradingHttpUrl: "https://api.testnet.aptoslabs.com/decibel",
40
40
  tradingWsUrl: "wss://api.testnet.aptoslabs.com/decibel/ws",
41
- gasStationUrl: "https://fee-payer-staging-testnet-us-central1-502735673999.us-central1.run.app",
41
+ gasStationUrl: "https://api.testnet.aptoslabs.com/gs/v1",
42
42
  deployment: getDeployment(PACKAGE.TESTNET),
43
43
  chainId: 2,
44
44
  ...RELEASE_CONFIGS.TESTNET,
45
45
  };
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
+ };
63
+ export const MAINNET_DEPLOYMENT = {
64
+ package: PACKAGE.MAINNET,
65
+ usdc: MAINNET_USDC,
66
+ testc: getTestcAddress(PACKAGE.MAINNET).toString(),
67
+ perpEngineGlobal: getPerpEngineGlobalAddress(PACKAGE.MAINNET).toString(),
68
+ };
69
+ export const MAINNET_CONFIG = {
70
+ network: Network.MAINNET,
71
+ fullnodeUrl: "https://api.mainnet.aptoslabs.com/v1",
72
+ tradingHttpUrl: "https://api.mainnet.aptoslabs.com/decibel",
73
+ tradingWsUrl: "wss://api.mainnet.aptoslabs.com/decibel/ws",
74
+ gasStationUrl: "https://api.mainnet.aptoslabs.com/gs/v1",
75
+ deployment: MAINNET_DEPLOYMENT,
76
+ chainId: 1,
77
+ ...RELEASE_CONFIGS.MAINNET,
78
+ };
46
79
  export const LOCAL_CONFIG = {
47
80
  network: Network.CUSTOM,
48
81
  fullnodeUrl: "http://localhost:8080/v1",
49
82
  tradingHttpUrl: "http://localhost:8084",
50
83
  tradingWsUrl: "ws://localhost:8083",
51
- gasStationUrl: "http://localhost:8085",
52
84
  deployment: getDeployment(PACKAGE.NETNA),
53
85
  ...RELEASE_CONFIGS.LOCAL,
54
86
  };
@@ -58,7 +90,6 @@ export const DOCKER_CONFIG = {
58
90
  tradingHttpUrl: "http://trading-api-http:8080",
59
91
  // nosemgrep: javascript.lang.security.detect-insecure-websocket.detect-insecure-websocket
60
92
  tradingWsUrl: "ws://trading-api-ws:8080",
61
- gasStationUrl: "http://fee-payer:8080",
62
93
  deployment: getDeployment(PACKAGE.NETNA),
63
94
  ...RELEASE_CONFIGS.DOCKER,
64
95
  };
@@ -67,6 +98,8 @@ export const NAMED_CONFIGS = {
67
98
  local: LOCAL_CONFIG,
68
99
  docker: DOCKER_CONFIG,
69
100
  testnet: TESTNET_CONFIG,
101
+ predeposit: PREDEPOSIT_CONFIG,
102
+ mainnet: MAINNET_CONFIG,
70
103
  };
71
104
  export const QUERY_PARAM_KEYS = {
72
105
  offset: "offset",
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"}