@decibeltrade/sdk 0.2.5 → 0.2.7

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 (53) hide show
  1. package/.github/workflows/npm_publish.yml +58 -0
  2. package/dist/base.d.ts +4 -2
  3. package/dist/base.d.ts.map +1 -1
  4. package/dist/base.js +40 -49
  5. package/dist/constants.d.ts +2 -11
  6. package/dist/constants.d.ts.map +1 -1
  7. package/dist/constants.js +21 -29
  8. package/dist/index.d.ts +1 -0
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +1 -0
  11. package/dist/read/account-overview/account-overview.reader.d.ts +2 -1
  12. package/dist/read/account-overview/account-overview.reader.d.ts.map +1 -1
  13. package/dist/read/account-overview/account-overview.reader.js +4 -3
  14. package/dist/read/account-overview/account-overview.types.d.ts +10 -7
  15. package/dist/read/account-overview/account-overview.types.d.ts.map +1 -1
  16. package/dist/read/account-overview/account-overview.types.js +1 -0
  17. package/dist/read/index.d.ts +9 -2
  18. package/dist/read/index.d.ts.map +1 -1
  19. package/dist/read/index.js +18 -2
  20. package/dist/read/types.d.ts +1 -0
  21. package/dist/read/types.d.ts.map +1 -1
  22. package/dist/read/user-positions/user-positions.types.d.ts +14 -14
  23. package/dist/read/ws-subscription.js +1 -1
  24. package/dist/release-config.d.ts +23 -0
  25. package/dist/release-config.d.ts.map +1 -0
  26. package/dist/release-config.js +34 -0
  27. package/dist/transaction-builder.d.ts +1 -0
  28. package/dist/transaction-builder.d.ts.map +1 -1
  29. package/dist/transaction-builder.js +1 -1
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/dist/utils.d.ts +2 -4
  32. package/dist/utils.d.ts.map +1 -1
  33. package/dist/utils.js +5 -15
  34. package/dist/write.d.ts.map +1 -1
  35. package/dist/write.js +3 -3
  36. package/package.json +33 -25
  37. package/readme.md +1 -1
  38. package/src/base.ts +60 -56
  39. package/src/constants.ts +22 -32
  40. package/src/index.ts +1 -0
  41. package/src/read/account-overview/account-overview.reader.ts +8 -4
  42. package/src/read/account-overview/account-overview.types.ts +2 -0
  43. package/src/read/index.ts +19 -2
  44. package/src/read/types.ts +1 -0
  45. package/src/read/ws-subscription.ts +1 -1
  46. package/src/release-config.ts +47 -0
  47. package/src/transaction-builder.ts +2 -1
  48. package/src/utils.ts +8 -20
  49. package/src/write.ts +9 -3
  50. package/.env +0 -2
  51. package/.turbo/turbo-build.log +0 -4
  52. package/.turbo/turbo-lint$colon$check.log +0 -5
  53. package/.turbo/turbo-lint.log +0 -5
@@ -0,0 +1,58 @@
1
+ name: Publish to npm
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ id-token: write # required for npm OIDC
12
+
13
+ jobs:
14
+ publish:
15
+ runs-on: ubuntu-latest
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - uses: actions/setup-node@v4
21
+ with:
22
+ node-version: "24"
23
+ registry-url: "https://registry.npmjs.org"
24
+
25
+ - name: Check npm version
26
+ id: version
27
+ run: |
28
+ PKG_NAME=$(node -p "require('./package.json').name")
29
+ LOCAL=$(node -p "require('./package.json').version")
30
+ REMOTE=$(npm view "$PKG_NAME" version || echo "0.0.0")
31
+
32
+ echo "📦 Package: $PKG_NAME"
33
+ echo "📄 Local version: $LOCAL"
34
+ echo "🌐 Published version: $REMOTE"
35
+
36
+ if npx semver "$LOCAL" -r ">$REMOTE" >/dev/null; then
37
+ echo "publish=true" >> "$GITHUB_OUTPUT"
38
+ echo "✅ Version is greater — will publish"
39
+ else
40
+ echo "publish=false" >> "$GITHUB_OUTPUT"
41
+ echo "⏭️ Version not greater — skipping publish"
42
+ fi
43
+
44
+ - name: Install dependencies
45
+ if: steps.version.outputs.publish == 'true'
46
+ run: npm install
47
+
48
+ - name: Build
49
+ if: steps.version.outputs.publish == 'true'
50
+ run: npm run build --if-present
51
+
52
+ - name: Test
53
+ if: steps.version.outputs.publish == 'true'
54
+ run: npm test --if-present
55
+
56
+ - name: Publish to npm
57
+ if: steps.version.outputs.publish == 'true'
58
+ run: npm publish --access public
package/dist/base.d.ts CHANGED
@@ -34,9 +34,11 @@ export declare class BaseSDK {
34
34
  */
35
35
  account: Account, opts?: Options);
36
36
  private getABI;
37
- private getSimulatedTx;
38
37
  submitTx(transaction: SimpleTransaction, senderAuthenticator: AccountAuthenticator): Promise<PendingTransactionResponse>;
39
- buildTx(payload: InputGenerateTransactionPayloadData, sender: AccountAddress): Promise<SimpleTransaction>;
38
+ buildTx({ maxGasAmount, gasUnitPrice, ...payload }: InputGenerateTransactionPayloadData & {
39
+ maxGasAmount?: number;
40
+ gasUnitPrice?: number;
41
+ }, sender: AccountAddress): Promise<SimpleTransaction>;
40
42
  protected sendTx(payload: InputGenerateTransactionPayloadData, accountOverride?: Account): Promise<import("@aptos-labs/ts-sdk").CommittedTransactionResponse>;
41
43
  getPrimarySubaccountAddress(addr: AccountAddress | string): `0x${string}`;
42
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,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;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,qBAAa,OAAO;IAahB,QAAQ,CAAC,MAAM,EAAE,aAAa;IAC9B;;OAEG;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,EAAE,eAAe,CAAC;IAClC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,qBAAa,OAAO;IAahB,QAAQ,CAAC,MAAM,EAAE,aAAa;IAC9B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO;IAhB3B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAqB;IAC7C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAwB;IAC5C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA8B;IAC9D;;OAEG;IACI,WAAW,EAAE,MAAM,CAAC;gBAGhB,MAAM,EAAE,aAAa;IAC9B;;OAEG;IACM,OAAO,EAAE,OAAO,EACzB,IAAI,CAAC,EAAE,OAAO;IAyBhB,OAAO,CAAC,MAAM;IAID,QAAQ,CACnB,WAAW,EAAE,iBAAiB,EAC9B,mBAAmB,EAAE,oBAAoB,GACxC,OAAO,CAAC,0BAA0B,CAAC;IAWzB,OAAO,CAClB,EACE,YAAY,EACZ,YAAY,EACZ,GAAG,OAAO,EACX,EAAE,mCAAmC,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,EACzF,MAAM,EAAE,cAAc;cAyDR,MAAM,CAAC,OAAO,EAAE,mCAAmC,EAAE,eAAe,CAAC,EAAE,OAAO;IA2DvF,2BAA2B,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM;CAGjE"}
package/dist/base.js CHANGED
@@ -53,33 +53,6 @@ export class BaseSDK {
53
53
  getABI(functionId) {
54
54
  return this.abi.abis[functionId] ?? null;
55
55
  }
56
- async getSimulatedTx(payload, sender) {
57
- const transaction = await this.aptos.transaction.build.simple({
58
- sender,
59
- data: payload,
60
- });
61
- const [sim] = await this.aptos.transaction.simulate.simple({
62
- transaction,
63
- options: {
64
- estimateMaxGasAmount: true,
65
- estimateGasUnitPrice: true,
66
- },
67
- });
68
- if (typeof sim === "undefined") {
69
- throw new Error("Transaction simulation returned no results");
70
- }
71
- if (!sim.max_gas_amount || !sim.gas_unit_price) {
72
- throw new Error("Transaction simulation returned no results");
73
- }
74
- return await this.aptos.transaction.build.simple({
75
- sender,
76
- data: payload,
77
- options: {
78
- maxGasAmount: Number(sim.max_gas_amount),
79
- gasUnitPrice: Number(sim.gas_unit_price),
80
- },
81
- });
82
- }
83
56
  async submitTx(transaction, senderAuthenticator) {
84
57
  if (this.noFeePayer) {
85
58
  return await this.aptos.transaction.submit.simple({
@@ -91,7 +64,7 @@ export class BaseSDK {
91
64
  return await submitFeePaidTransaction(this.config, transaction, senderAuthenticator);
92
65
  }
93
66
  }
94
- async buildTx(payload, sender) {
67
+ async buildTx({ maxGasAmount, gasUnitPrice, ...payload }, sender) {
95
68
  const functionAbi = "function" in payload ? this.getABI(payload.function) : undefined;
96
69
  const withFeePayer = !this.noFeePayer;
97
70
  const replayProtectionNonce = generateRandomReplayProtectionNonce();
@@ -103,8 +76,7 @@ export class BaseSDK {
103
76
  // If we have functionAbi and chainId, we can use the sync function to generate the transaction
104
77
  // This is faster than the async function
105
78
  if (functionAbi && this.chainId) {
106
- let gasUnitPrice;
107
- if (this.gasPriceManager) {
79
+ if (gasUnitPrice === undefined && this.gasPriceManager) {
108
80
  // 1. Try getting from cache
109
81
  // 2. If not available, try fetching from gasmanager, this also sets the gas price in the cache for future use
110
82
  gasUnitPrice =
@@ -124,6 +96,7 @@ export class BaseSDK {
124
96
  chainId: this.chainId,
125
97
  gasUnitPrice,
126
98
  timeDeltaMs: this.timeDeltaMs,
99
+ maxGasAmount,
127
100
  });
128
101
  }
129
102
  else {
@@ -135,6 +108,8 @@ export class BaseSDK {
135
108
  withFeePayer,
136
109
  options: {
137
110
  replayProtectionNonce,
111
+ maxGasAmount,
112
+ gasUnitPrice,
138
113
  },
139
114
  });
140
115
  }
@@ -143,30 +118,46 @@ export class BaseSDK {
143
118
  async sendTx(payload, accountOverride) {
144
119
  const signer = accountOverride ?? this.account;
145
120
  const sender = signer.accountAddress;
121
+ let transaction = await this.buildTx(payload, sender);
146
122
  if (!this.skipSimulate) {
147
- const transaction = await this.getSimulatedTx(payload, sender);
148
- const senderAuthenticator = this.aptos.transaction.sign({
149
- signer,
123
+ const [sim] = await this.aptos.transaction.simulate.simple({
150
124
  transaction,
125
+ options: {
126
+ estimateMaxGasAmount: true,
127
+ estimateGasUnitPrice: true,
128
+ },
151
129
  });
152
- const pendingTransaction = await this.submitTx(transaction, senderAuthenticator);
153
- return await this.aptos.waitForTransaction({
154
- transactionHash: pendingTransaction.hash,
155
- });
156
- }
157
- else {
158
- const transaction = await this.buildTx(payload, sender);
159
- const senderAuthenticator = this.aptos.transaction.sign({
160
- signer,
161
- transaction,
162
- });
163
- const pendingTransaction = await this.submitTx(transaction, senderAuthenticator);
164
- return await this.aptos.waitForTransaction({
165
- transactionHash: pendingTransaction.hash,
166
- });
130
+ if (typeof sim === "undefined") {
131
+ throw new Error("Transaction simulation returned no results");
132
+ }
133
+ if (!sim.max_gas_amount || !sim.gas_unit_price) {
134
+ throw new Error("Transaction simulation returned no results");
135
+ }
136
+ const simulatedMaxGas = Number(sim.max_gas_amount);
137
+ const simulatedGasPrice = Number(sim.gas_unit_price);
138
+ const defaultMaxGasAmount = this.aptos.config.getDefaultMaxGasAmount();
139
+ // @Todo: Look into this more, maybe we can use the simulation results directly
140
+ // Ensure maxGasAmount is at least the default and add a 2x buffer
141
+ // The simulation might return very low values, so we need to ensure minimums
142
+ const maxGasAmount = Math.max(Math.ceil(simulatedMaxGas * 2), // 2x buffer from simulation
143
+ defaultMaxGasAmount);
144
+ const gasUnitPrice = Math.max(simulatedGasPrice, 1);
145
+ transaction = await this.buildTx({
146
+ ...payload,
147
+ maxGasAmount,
148
+ gasUnitPrice,
149
+ }, sender);
167
150
  }
151
+ const senderAuthenticator = this.aptos.transaction.sign({
152
+ signer,
153
+ transaction,
154
+ });
155
+ const pendingTransaction = await this.submitTx(transaction, senderAuthenticator);
156
+ return await this.aptos.waitForTransaction({
157
+ transactionHash: pendingTransaction.hash,
158
+ });
168
159
  }
169
160
  getPrimarySubaccountAddress(addr) {
170
- return getPrimarySubaccountAddr(addr, this.config);
161
+ return getPrimarySubaccountAddr(addr, this.config.subaccountVariant);
171
162
  }
172
163
  }
@@ -1,17 +1,10 @@
1
1
  import { AccountAddress, Aptos, Network } from "@aptos-labs/ts-sdk";
2
2
  import { DecibelWsSubscription } from "./read/ws-subscription";
3
+ import { CompatVersion, ReleaseConfig } from "./release-config";
3
4
  export declare function getUsdcAddress(publisherAddr: string): AccountAddress;
4
5
  export declare function getTestcAddress(publisherAddr: string): AccountAddress;
5
6
  export declare function getPerpEngineGlobalAddress(publisherAddr: string): AccountAddress;
6
- export declare enum CompatVersion {
7
- V0_0 = "v0.0",// decibel-testnet-release-v0.0
8
- V0_1 = "v0.1",// decibel-testnet-release-v0.1
9
- V0_2 = "v0.2",// decibel-testnet-release-v0.2
10
- V0_3 = "v0.3"
11
- }
12
- export declare const TESTNET_COMPAT_VERSION = CompatVersion.V0_2;
13
- export declare const DEFAULT_COMPAT_VERSION = CompatVersion.V0_3;
14
- export interface DecibelConfig {
7
+ export interface DecibelConfig extends ReleaseConfig {
15
8
  network: Network;
16
9
  fullnodeUrl: string;
17
10
  tradingHttpUrl: string;
@@ -19,7 +12,6 @@ export interface DecibelConfig {
19
12
  gasStationUrl: string;
20
13
  deployment: Deployment;
21
14
  chainId?: number;
22
- compatVersion: CompatVersion;
23
15
  }
24
16
  export interface DecibelReaderDeps {
25
17
  aptos: Aptos;
@@ -33,7 +25,6 @@ export interface Deployment {
33
25
  testc: string;
34
26
  perpEngineGlobal: string;
35
27
  }
36
- export declare const NETNA_DEPLOYMENT: Deployment;
37
28
  export declare const NETNA_CONFIG: DecibelConfig;
38
29
  export declare const TESTNET_DEPLOYMENT: Deployment;
39
30
  export declare const TESTNET_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;AAE/D,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,oBAAY,aAAa;IACvB,IAAI,SAAS,CAAE,+BAA+B;IAC9C,IAAI,SAAS,CAAE,+BAA+B;IAC9C,IAAI,SAAS,CAAE,+BAA+B;IAC9C,IAAI,SAAS;CACd;AAED,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AAEzD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,EAAE,EAAE,qBAAqB,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC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AC1B,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAWD,eAAO,MAAM,YAAY,EAAE,aAS1B,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,UAKhC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAS5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,aAQ1B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,aAS3B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,SAAS,CAKnE,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;CAM5B,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,aAAa,yBAM7D"}
package/dist/constants.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { AccountAddress, createObjectAddress, Network } from "@aptos-labs/ts-sdk";
2
+ import { CompatVersion, PACKAGE, RELEASE_CONFIGS } from "./release-config";
2
3
  export function getUsdcAddress(publisherAddr) {
3
4
  return createObjectAddress(AccountAddress.fromString(publisherAddr), new TextEncoder().encode("USDC"));
4
5
  }
@@ -8,21 +9,13 @@ export function getTestcAddress(publisherAddr) {
8
9
  export function getPerpEngineGlobalAddress(publisherAddr) {
9
10
  return createObjectAddress(AccountAddress.fromString(publisherAddr), new TextEncoder().encode("GlobalPerpEngine"));
10
11
  }
11
- export var CompatVersion;
12
- (function (CompatVersion) {
13
- CompatVersion["V0_0"] = "v0.0";
14
- CompatVersion["V0_1"] = "v0.1";
15
- CompatVersion["V0_2"] = "v0.2";
16
- CompatVersion["V0_3"] = "v0.3";
17
- })(CompatVersion || (CompatVersion = {}));
18
- export const TESTNET_COMPAT_VERSION = CompatVersion.V0_2;
19
- export const DEFAULT_COMPAT_VERSION = CompatVersion.V0_3;
20
- const NETNA_PACKAGE = "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95";
21
- export const NETNA_DEPLOYMENT = {
22
- package: NETNA_PACKAGE,
23
- usdc: getUsdcAddress(NETNA_PACKAGE).toString(),
24
- testc: getTestcAddress(NETNA_PACKAGE).toString(),
25
- perpEngineGlobal: getPerpEngineGlobalAddress(NETNA_PACKAGE).toString(),
12
+ const getDeployment = (pkg) => {
13
+ return {
14
+ package: pkg,
15
+ usdc: getUsdcAddress(pkg).toString(),
16
+ testc: getTestcAddress(pkg).toString(),
17
+ perpEngineGlobal: getPerpEngineGlobalAddress(pkg).toString(),
18
+ };
26
19
  };
27
20
  export const NETNA_CONFIG = {
28
21
  network: Network.CUSTOM,
@@ -30,16 +23,15 @@ export const NETNA_CONFIG = {
30
23
  tradingHttpUrl: "https://api.netna.aptoslabs.com/decibel",
31
24
  tradingWsUrl: "wss://api.netna.aptoslabs.com/decibel/ws",
32
25
  gasStationUrl: "https://fee-payer-dev-netna-us-central1-410192433417.us-central1.run.app",
33
- deployment: NETNA_DEPLOYMENT,
34
- chainId: 207,
35
- compatVersion: DEFAULT_COMPAT_VERSION,
26
+ deployment: getDeployment(PACKAGE.NETNA),
27
+ chainId: 208,
28
+ ...RELEASE_CONFIGS.NETNA,
36
29
  };
37
- const TESTNET_PACKAGE = "0x9f830083a19fb8b87395983ca9edaea2b0379c97be6dfe234bb914e6c6672844";
38
30
  export const TESTNET_DEPLOYMENT = {
39
- package: TESTNET_PACKAGE,
40
- usdc: getUsdcAddress(TESTNET_PACKAGE).toString(),
41
- testc: getTestcAddress(TESTNET_PACKAGE).toString(),
42
- perpEngineGlobal: getPerpEngineGlobalAddress(TESTNET_PACKAGE).toString(),
31
+ package: PACKAGE.TESTNET,
32
+ usdc: getUsdcAddress(PACKAGE.TESTNET).toString(),
33
+ testc: getTestcAddress(PACKAGE.TESTNET).toString(),
34
+ perpEngineGlobal: getPerpEngineGlobalAddress(PACKAGE.TESTNET).toString(),
43
35
  };
44
36
  export const TESTNET_CONFIG = {
45
37
  network: Network.TESTNET,
@@ -47,9 +39,9 @@ export const TESTNET_CONFIG = {
47
39
  tradingHttpUrl: "https://api.testnet.aptoslabs.com/decibel",
48
40
  tradingWsUrl: "wss://api.testnet.aptoslabs.com/decibel/ws",
49
41
  gasStationUrl: "https://fee-payer-staging-testnet-us-central1-502735673999.us-central1.run.app",
50
- deployment: TESTNET_DEPLOYMENT,
42
+ deployment: getDeployment(PACKAGE.TESTNET),
51
43
  chainId: 2,
52
- compatVersion: TESTNET_COMPAT_VERSION,
44
+ ...RELEASE_CONFIGS.TESTNET,
53
45
  };
54
46
  export const LOCAL_CONFIG = {
55
47
  network: Network.CUSTOM,
@@ -57,8 +49,8 @@ export const LOCAL_CONFIG = {
57
49
  tradingHttpUrl: "http://localhost:8084",
58
50
  tradingWsUrl: "ws://localhost:8083",
59
51
  gasStationUrl: "http://localhost:8085",
60
- deployment: NETNA_DEPLOYMENT,
61
- compatVersion: DEFAULT_COMPAT_VERSION,
52
+ deployment: getDeployment(PACKAGE.NETNA),
53
+ ...RELEASE_CONFIGS.LOCAL,
62
54
  };
63
55
  export const DOCKER_CONFIG = {
64
56
  network: Network.CUSTOM,
@@ -67,8 +59,8 @@ export const DOCKER_CONFIG = {
67
59
  // nosemgrep: javascript.lang.security.detect-insecure-websocket.detect-insecure-websocket
68
60
  tradingWsUrl: "ws://trading-api-ws:8080",
69
61
  gasStationUrl: "http://fee-payer:8080",
70
- deployment: NETNA_DEPLOYMENT,
71
- compatVersion: DEFAULT_COMPAT_VERSION,
62
+ deployment: getDeployment(PACKAGE.NETNA),
63
+ ...RELEASE_CONFIGS.DOCKER,
72
64
  };
73
65
  export const NAMED_CONFIGS = {
74
66
  netna: NETNA_CONFIG,
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from "./gas/gas-price-manager";
5
5
  export * from "./order-event.types";
6
6
  export * from "./order-status";
7
7
  export * from "./read/index";
8
+ export * from "./release-config";
8
9
  export * from "./subaccount-types";
9
10
  export * from "./utils";
10
11
  export * from "./write";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ export * from "./gas/gas-price-manager";
5
5
  export * from "./order-event.types";
6
6
  export * from "./order-status";
7
7
  export * from "./read/index";
8
+ export * from "./release-config";
8
9
  export * from "./subaccount-types";
9
10
  export * from "./utils";
10
11
  export * from "./write";
@@ -6,7 +6,7 @@ export declare class AccountOverviewReader extends BaseReader {
6
6
  * @param subAddr The subaccount address to get the account overview for
7
7
  * @returns The account overview for the given subaccount address
8
8
  */
9
- getByAddr({ subAddr, volumeWindow, fetchOptions }: AccountOverviewRequestArgs): Promise<{
9
+ getByAddr({ subAddr, volumeWindow, fetchOptions, includePerformance, }: AccountOverviewRequestArgs): Promise<{
10
10
  perp_equity_balance: number;
11
11
  unrealized_pnl: number;
12
12
  unrealized_funding_cost: number;
@@ -25,6 +25,7 @@ export declare class AccountOverviewReader extends BaseReader {
25
25
  total_margin: number;
26
26
  usdc_cross_withdrawable_balance: number;
27
27
  usdc_isolated_withdrawable_balance: number;
28
+ realized_pnl: number | null;
28
29
  }>;
29
30
  /**
30
31
  * 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,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,0BAA0B;;;;;;;;;;;;;;;;;;;;IAiBnF;;;;;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"}
@@ -6,11 +6,12 @@ export class AccountOverviewReader extends BaseReader {
6
6
  * @param subAddr The subaccount address to get the account overview for
7
7
  * @returns The account overview for the given subaccount address
8
8
  */
9
- async getByAddr({ subAddr, volumeWindow, fetchOptions }) {
9
+ async getByAddr({ subAddr, volumeWindow, fetchOptions, includePerformance, }) {
10
10
  const queryParams = new URLSearchParams({ user: subAddr });
11
- if (volumeWindow) {
11
+ if (volumeWindow)
12
12
  queryParams.set("volume_window", volumeWindow);
13
- }
13
+ if (includePerformance)
14
+ queryParams.set("include_performance", "true");
14
15
  const response = await this.getRequest({
15
16
  schema: AccountOverviewSchema,
16
17
  url: `${this.deps.config.tradingHttpUrl}/api/v1/account_overviews`,
@@ -3,6 +3,7 @@ import { BaseRequestArgs } from "../base-reader";
3
3
  export interface AccountOverviewRequestArgs extends BaseRequestArgs {
4
4
  subAddr: string;
5
5
  volumeWindow?: VolumeWindow;
6
+ includePerformance?: boolean;
6
7
  }
7
8
  export declare const VolumeWindow: {
8
9
  readonly SevenDays: "7d";
@@ -30,26 +31,28 @@ export declare const AccountOverviewSchema: z.ZodObject<{
30
31
  total_margin: z.ZodNumber;
31
32
  usdc_cross_withdrawable_balance: z.ZodNumber;
32
33
  usdc_isolated_withdrawable_balance: z.ZodNumber;
34
+ realized_pnl: z.ZodNullable<z.ZodNumber>;
33
35
  }, z.core.$strip>;
34
36
  export declare const AccountOverviewWsMessageSchema: z.ZodObject<{
35
37
  account_overview: z.ZodObject<{
36
- all_time_return: z.ZodNullable<z.ZodNumber>;
37
- sharpe_ratio: z.ZodNullable<z.ZodNumber>;
38
- max_drawdown: z.ZodNullable<z.ZodNumber>;
39
- weekly_win_rate_12w: z.ZodNullable<z.ZodNumber>;
40
- pnl_90d: z.ZodNullable<z.ZodNumber>;
41
- average_leverage: z.ZodNullable<z.ZodNumber>;
42
- unrealized_pnl: z.ZodNumber;
43
38
  perp_equity_balance: z.ZodNumber;
39
+ unrealized_pnl: z.ZodNumber;
44
40
  unrealized_funding_cost: z.ZodNumber;
45
41
  cross_margin_ratio: z.ZodNumber;
46
42
  maintenance_margin: z.ZodNumber;
47
43
  cross_account_leverage_ratio: z.ZodNullable<z.ZodNumber>;
44
+ all_time_return: z.ZodNullable<z.ZodNumber>;
45
+ pnl_90d: z.ZodNullable<z.ZodNumber>;
46
+ sharpe_ratio: z.ZodNullable<z.ZodNumber>;
47
+ max_drawdown: z.ZodNullable<z.ZodNumber>;
48
+ weekly_win_rate_12w: z.ZodNullable<z.ZodNumber>;
48
49
  average_cash_position: z.ZodNullable<z.ZodNumber>;
50
+ average_leverage: z.ZodNullable<z.ZodNumber>;
49
51
  cross_account_position: z.ZodNumber;
50
52
  total_margin: z.ZodNumber;
51
53
  usdc_cross_withdrawable_balance: z.ZodNumber;
52
54
  usdc_isolated_withdrawable_balance: z.ZodNumber;
55
+ realized_pnl: z.ZodNullable<z.ZodNumber>;
53
56
  }, z.core.$strip>;
54
57
  }, z.core.$strip>;
55
58
  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;CAC7B;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;;;;;;;;;;;;;;;;;;;iBAmBhC,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;;;;;;;;;;;;;;;;;;;;iBAoBhC,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"}
@@ -24,6 +24,7 @@ export const AccountOverviewSchema = z.object({
24
24
  total_margin: z.number(),
25
25
  usdc_cross_withdrawable_balance: z.number(),
26
26
  usdc_isolated_withdrawable_balance: z.number(),
27
+ realized_pnl: z.number().nullable(),
27
28
  });
28
29
  export const AccountOverviewWsMessageSchema = z.object({
29
30
  account_overview: AccountOverviewSchema.omit({ volume: true }),
@@ -74,12 +74,19 @@ export declare class DecibelReadDex {
74
74
  */
75
75
  availableRestrictedMintFor(addr: string | AccountAddress): Promise<number>;
76
76
  /**
77
- * Get the timestamp when the restricted mint limits reset (in seconds).
77
+ * Get the timestamp when the global restricted mint limits for NEW accounts reset (in seconds).
78
78
  *
79
79
  * @remarks This method is temporary and only for use in testnet. The restricted_mint_daily_reset_timestamp
80
80
  * view function is a testnet-only feature and should be removed before mainnet deployment.
81
81
  */
82
- getTriggerResetMintTs(addr: string | AccountAddress): Promise<number>;
82
+ getTriggerResetMintTs(): Promise<number>;
83
+ /**
84
+ * Get the timestamp when the account-specific restricted mint limits reset (in seconds).
85
+ *
86
+ * @remarks This method is temporary and only for use in testnet. The restricted_mint_daily_reset_timestamp_for
87
+ * view function is a testnet-only feature and should be removed before mainnet deployment.
88
+ */
89
+ getAccountTriggerResetMintTs(addr: string | AccountAddress): Promise<number>;
83
90
  tokenBalance(addr: string | AccountAddress, tokenAddr: string | AccountAddress, tokenDecimals: number): Promise<number>;
84
91
  /**
85
92
  * Get the balance of the account
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/read/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAA2C,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,aAAa,E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C,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,iBAAiB,CAAC;IACxC,QAAQ,CAAC,iBAAiB,EAAE,uBAAuB,CAAC;gBAGzC,MAAM,EAAE,aAAa,EAC9B,IAAI,CAAC,EAAE;QACL,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAC;KACzC;IAsCG,qBAAqB;IAarB,yBAAyB;IAWzB,YAAY;IAeZ,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc;IAY/C;;;;;;OAMG;IACG,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAWvC;;;;;;OAMG;IACG,0BAA0B,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAWhF;;;;;OAKG;IACG,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC;IAW9C;;;;;OAKG;IACG,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAW5E,YAAY,CAChB,IAAI,EAAE,MAAM,GAAG,cAAc,EAC7B,SAAS,EAAE,MAAM,GAAG,cAAc,EAClC,aAAa,EAAE,MAAM;IAYvB;;;OAGG;IACG,cAAc,CAAC,IAAI,EAAE,cAAc;IAWzC;;;;;OAKG;IACG,YAAY,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM;IAU3D;;;;OAIG;IACG,kBAAkB,CAAC,IAAI,EAAE,cAAc;;;;;;;;;;CAe9C"}
@@ -164,12 +164,28 @@ export class DecibelReadDex {
164
164
  return Number(result[0]);
165
165
  }
166
166
  /**
167
- * Get the timestamp when the restricted mint limits reset (in seconds).
167
+ * Get the timestamp when the global restricted mint limits for NEW accounts reset (in seconds).
168
168
  *
169
169
  * @remarks This method is temporary and only for use in testnet. The restricted_mint_daily_reset_timestamp
170
170
  * view function is a testnet-only feature and should be removed before mainnet deployment.
171
171
  */
172
- async getTriggerResetMintTs(addr) {
172
+ async getTriggerResetMintTs() {
173
+ const result = await this.deps.aptos.view({
174
+ payload: {
175
+ function: `${this.config.deployment.package}::usdc::restricted_mint_daily_reset_timestamp`,
176
+ typeArguments: [],
177
+ functionArguments: [],
178
+ },
179
+ });
180
+ return Number(result[0]);
181
+ }
182
+ /**
183
+ * Get the timestamp when the account-specific restricted mint limits reset (in seconds).
184
+ *
185
+ * @remarks This method is temporary and only for use in testnet. The restricted_mint_daily_reset_timestamp_for
186
+ * view function is a testnet-only feature and should be removed before mainnet deployment.
187
+ */
188
+ async getAccountTriggerResetMintTs(addr) {
173
189
  const result = await this.deps.aptos.view({
174
190
  payload: {
175
191
  function: `${this.config.deployment.package}::usdc::restricted_mint_daily_reset_timestamp_for`,
@@ -149,6 +149,7 @@ export interface SortParams<T extends string> {
149
149
  sortDir?: SortDirection;
150
150
  }
151
151
  export interface CreateVaultArgs {
152
+ subaccountAddr?: string | null;
152
153
  contributionAssetType?: string;
153
154
  vaultName: string;
154
155
  vaultDescription: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/read/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAG3B,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mCAAmC,CAAC;AAClD,cAAc,iCAAiC,CAAC;AAChD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yCAAyC,CAAC;AACxD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,mDAAmD,CAAC;AAClE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,2CAA2C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