@decibeltrade/sdk 0.1.3 → 0.1.5
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.
- package/.turbo/turbo-build.log +5 -4
- package/.turbo/turbo-lint.log +1 -1
- package/dist/admin.d.ts.map +1 -1
- package/dist/admin.js +3 -1
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +21 -2
- package/dist/fee-pay.d.ts.map +1 -1
- package/dist/fee-pay.js +20 -3
- package/dist/read/account-overview/account-overview.reader.d.ts +2 -2
- package/dist/read/account-overview/account-overview.reader.d.ts.map +1 -1
- package/dist/read/account-overview/account-overview.reader.js +86 -18
- package/dist/read/account-overview/account-overview.types.d.ts +5 -0
- package/dist/read/account-overview/account-overview.types.d.ts.map +1 -1
- package/dist/read/account-overview/account-overview.types.js +1 -4
- package/dist/read/base-reader.d.ts +4 -1
- package/dist/read/base-reader.d.ts.map +1 -1
- package/dist/read/candlesticks/candlesticks.reader.d.ts +2 -2
- package/dist/read/candlesticks/candlesticks.reader.d.ts.map +1 -1
- package/dist/read/candlesticks/candlesticks.reader.js +90 -22
- package/dist/read/candlesticks/candlesticks.types.d.ts +7 -0
- package/dist/read/candlesticks/candlesticks.types.d.ts.map +1 -1
- package/dist/read/candlesticks/candlesticks.types.js +1 -4
- package/dist/read/delegations/delegations.reader.d.ts +2 -2
- package/dist/read/delegations/delegations.reader.d.ts.map +1 -1
- package/dist/read/delegations/delegations.reader.js +80 -13
- package/dist/read/delegations/delegations.types.d.ts +2 -1
- package/dist/read/delegations/delegations.types.d.ts.map +1 -1
- package/dist/read/delegations/delegations.types.js +1 -4
- package/dist/read/index.d.ts +7 -0
- package/dist/read/index.d.ts.map +1 -1
- package/dist/read/index.js +16 -0
- package/dist/read/leaderboard/leaderboard.reader.d.ts +2 -2
- package/dist/read/leaderboard/leaderboard.reader.d.ts.map +1 -1
- package/dist/read/leaderboard/leaderboard.reader.js +90 -12
- package/dist/read/leaderboard/leaderboard.types.d.ts +2 -1
- package/dist/read/leaderboard/leaderboard.types.d.ts.map +1 -1
- package/dist/read/leaderboard/leaderboard.types.js +2 -2
- package/dist/read/market-contexts/market-contexts.reader.d.ts +2 -2
- package/dist/read/market-contexts/market-contexts.reader.d.ts.map +1 -1
- package/dist/read/market-contexts/market-contexts.reader.js +79 -15
- package/dist/read/market-contexts/market-contexts.types.js +1 -4
- package/dist/read/market-depth/market-depth.reader.d.ts +2 -2
- package/dist/read/market-depth/market-depth.reader.d.ts.map +1 -1
- package/dist/read/market-depth/market-depth.reader.js +96 -27
- package/dist/read/market-depth/market-depth.types.d.ts +5 -0
- package/dist/read/market-depth/market-depth.types.d.ts.map +1 -1
- package/dist/read/market-depth/market-depth.types.js +1 -4
- package/dist/read/market-prices/market-prices.reader.d.ts +4 -4
- package/dist/read/market-prices/market-prices.reader.d.ts.map +1 -1
- package/dist/read/market-prices/market-prices.reader.js +105 -26
- package/dist/read/market-prices/market-prices.types.d.ts +4 -0
- package/dist/read/market-prices/market-prices.types.d.ts.map +1 -1
- package/dist/read/market-prices/market-prices.types.js +1 -1
- package/dist/read/market-trades/market-trades.reader.d.ts +2 -2
- package/dist/read/market-trades/market-trades.reader.d.ts.map +1 -1
- package/dist/read/market-trades/market-trades.reader.js +89 -21
- package/dist/read/market-trades/market-trades.types.d.ts +5 -0
- package/dist/read/market-trades/market-trades.types.d.ts.map +1 -1
- package/dist/read/market-trades/market-trades.types.js +1 -1
- package/dist/read/markets/markets.reader.d.ts +2 -2
- package/dist/read/markets/markets.reader.d.ts.map +1 -1
- package/dist/read/markets/markets.reader.js +148 -54
- package/dist/read/markets/markets.types.js +1 -1
- package/dist/read/pagination.types.js +7 -8
- package/dist/read/portfolio-chart/portfolio-chart.reader.d.ts +2 -2
- package/dist/read/portfolio-chart/portfolio-chart.reader.d.ts.map +1 -1
- package/dist/read/portfolio-chart/portfolio-chart.reader.js +78 -11
- package/dist/read/portfolio-chart/portfolio-chart.types.d.ts +6 -0
- package/dist/read/portfolio-chart/portfolio-chart.types.d.ts.map +1 -1
- package/dist/read/portfolio-chart/portfolio-chart.types.js +1 -4
- package/dist/read/types.js +1 -1
- package/dist/read/user-active-twaps/user-active-twaps.reader.d.ts +3 -2
- package/dist/read/user-active-twaps/user-active-twaps.reader.d.ts.map +1 -1
- package/dist/read/user-active-twaps/user-active-twaps.reader.js +81 -14
- package/dist/read/user-active-twaps/user-active-twaps.types.d.ts +7 -0
- package/dist/read/user-active-twaps/user-active-twaps.types.d.ts.map +1 -1
- package/dist/read/user-active-twaps/user-active-twaps.types.js +2 -4
- package/dist/read/user-bulk-orders/user-bulk-orders.reader.d.ts +2 -2
- package/dist/read/user-bulk-orders/user-bulk-orders.reader.d.ts.map +1 -1
- package/dist/read/user-bulk-orders/user-bulk-orders.reader.js +81 -14
- package/dist/read/user-bulk-orders/user-bulk-orders.types.d.ts +5 -0
- package/dist/read/user-bulk-orders/user-bulk-orders.types.d.ts.map +1 -1
- package/dist/read/user-bulk-orders/user-bulk-orders.types.js +1 -4
- package/dist/read/user-funding-history/user-funding-history.reader.d.ts +2 -2
- package/dist/read/user-funding-history/user-funding-history.reader.d.ts.map +1 -1
- package/dist/read/user-funding-history/user-funding-history.reader.js +81 -14
- package/dist/read/user-funding-history/user-funding-history.types.d.ts +5 -0
- package/dist/read/user-funding-history/user-funding-history.types.d.ts.map +1 -1
- package/dist/read/user-funding-history/user-funding-history.types.js +1 -4
- package/dist/read/user-notifications/user-notifications.reader.js +27 -7
- package/dist/read/user-notifications/user-notifications.types.d.ts +49 -2
- package/dist/read/user-notifications/user-notifications.types.d.ts.map +1 -1
- package/dist/read/user-notifications/user-notifications.types.js +52 -11
- package/dist/read/user-open-orders/user-open-orders.reader.d.ts +3 -2
- package/dist/read/user-open-orders/user-open-orders.reader.d.ts.map +1 -1
- package/dist/read/user-open-orders/user-open-orders.reader.js +81 -14
- package/dist/read/user-open-orders/user-open-orders.types.d.ts +7 -0
- package/dist/read/user-open-orders/user-open-orders.types.d.ts.map +1 -1
- package/dist/read/user-open-orders/user-open-orders.types.js +2 -4
- package/dist/read/user-order-history/user-order-history.reader.d.ts +2 -2
- package/dist/read/user-order-history/user-order-history.reader.d.ts.map +1 -1
- package/dist/read/user-order-history/user-order-history.reader.js +83 -16
- package/dist/read/user-order-history/user-order-history.types.d.ts +4 -0
- package/dist/read/user-order-history/user-order-history.types.d.ts.map +1 -1
- package/dist/read/user-order-history/user-order-history.types.js +2 -5
- package/dist/read/user-positions/user-positions.reader.d.ts +2 -2
- package/dist/read/user-positions/user-positions.reader.d.ts.map +1 -1
- package/dist/read/user-positions/user-positions.reader.js +90 -22
- package/dist/read/user-positions/user-positions.types.d.ts +12 -11
- package/dist/read/user-positions/user-positions.types.d.ts.map +1 -1
- package/dist/read/user-positions/user-positions.types.js +1 -4
- package/dist/read/user-subaccounts/user-subaccounts.reader.d.ts +2 -2
- package/dist/read/user-subaccounts/user-subaccounts.reader.d.ts.map +1 -1
- package/dist/read/user-subaccounts/user-subaccounts.reader.js +85 -17
- package/dist/read/user-subaccounts/user-subaccounts.types.d.ts +2 -1
- package/dist/read/user-subaccounts/user-subaccounts.types.d.ts.map +1 -1
- package/dist/read/user-subaccounts/user-subaccounts.types.js +1 -4
- package/dist/read/user-trade-history/user-trade-history.reader.d.ts +2 -2
- package/dist/read/user-trade-history/user-trade-history.reader.d.ts.map +1 -1
- package/dist/read/user-trade-history/user-trade-history.reader.js +81 -14
- package/dist/read/user-trade-history/user-trade-history.types.d.ts +5 -0
- package/dist/read/user-trade-history/user-trade-history.types.d.ts.map +1 -1
- package/dist/read/user-trade-history/user-trade-history.types.js +1 -4
- package/dist/read/vaults/vaults.reader.d.ts +7 -4
- package/dist/read/vaults/vaults.reader.d.ts.map +1 -1
- package/dist/read/vaults/vaults.reader.js +146 -42
- package/dist/read/vaults/vaults.types.d.ts +10 -3
- package/dist/read/vaults/vaults.types.d.ts.map +1 -1
- package/dist/read/vaults/vaults.types.js +5 -5
- package/dist/read/ws-subscription.d.ts +1 -1
- package/dist/read/ws-subscription.d.ts.map +1 -1
- package/dist/read/ws-subscription.js +7 -1
- package/dist/subaccount-types.js +1 -4
- package/dist/transaction-builder.js +13 -10
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils.d.ts +4 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/write.d.ts.map +1 -1
- package/dist/write.js +15 -6
- package/package.json +1 -1
- package/readme.md +615 -0
- package/src/abi/json/netna.json +160 -158
- package/src/abi/json/testnet.json +15 -3
- package/src/admin.ts +3 -1
- package/src/constants.ts +21 -1
- package/src/read/index.ts +3 -3
- package/src/read/ws-subscription.ts +7 -1
- package/src/write.ts +10 -6
- package/decibel_transactions.md +0 -1049
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @decibeltrade/sdk@0.1.4 build /Users/sid/Desktop/Decibel/etna/typescript/packages/sdk
|
|
4
|
+
> tsc
|
|
5
|
+
|
package/.turbo/turbo-lint.log
CHANGED
package/dist/admin.d.ts.map
CHANGED
|
@@ -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;
|
|
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;AAIjC,qBAAa,eAAgB,SAAQ,OAAO;IAC1C;;OAEG;IACG,UAAU,CACd,mBAAmB,EAAE,MAAM,EAC3B,yBAAyB,EAAE,MAAM,EACjC,sBAAsB,EAAE,MAAM;IAShC,uBAAuB,IAAI,cAAc;IAanC,uBAAuB,CAAC,mBAAmB,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAuB3E,8BAA8B,CAAC,YAAY,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM;IAQhF,4BAA4B,CAAC,qBAAqB,EAAE,MAAM;IAQ1D,gCAAgC,CACpC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,mBAAmB,UAAO,EAC1B,oBAAoB,SAAI,EACxB,kBAAkB,SAAK;IAoBnB,4BAA4B,CAChC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,mBAAmB,qBAAO,EAC1B,mBAAmB,EAAE,MAAM,EAAE,EAC7B,oBAAoB,EAAE,MAAM,EAC5B,+BAA+B,EAAE,MAAM,EACvC,YAAY,EAAE,MAAM;IAsBhB,4CAA4C,CAChD,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,mBAAmB,qBAAO,EAC1B,mBAAmB,EAAE,MAAM,EAAE,EAC7B,oBAAoB,EAAE,MAAM,EAC5B,+BAA+B,EAAE,MAAM,EACvC,YAAY,EAAE,MAAM,EACpB,oBAAoB,EAAE,MAAM,EAC5B,wBAAwB,EAAE,MAAM,EAChC,mBAAmB,EAAE,MAAM,EAC3B,yBAAyB,EAAE,MAAM;IA0B7B,iDAAiD,CACrD,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,MAAM,EAClB,eAAe,EAAE,MAAM,EACvB,WAAW,EAAE,MAAM,EACnB,mBAAmB,qBAAO,EAC1B,eAAe,EAAE,MAAM,EACvB,oBAAoB,EAAE,MAAM,EAAE,EAC9B,yBAAyB,EAAE,MAAM,EACjC,wBAAwB,EAAE,MAAM,EAChC,oBAAoB,EAAE,MAAM,EAC5B,mBAAmB,EAAE,MAAM,EAC3B,yBAAyB,EAAE,MAAM;IAyB7B,yBAAyB,CAAC,UAAU,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM;IASjE,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE;IASvD,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE;IAQtC,0BAA0B,CAAC,YAAY,EAAE,MAAM,EAAE;IAQjD,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM;IAQ/C,gBAAgB,CAAC,KAAK,EAAE,OAAO;IAQrC;;;;OAIG;IACG,WAAW,CAAC,IAAI,EAAE,cAAc;CAUvC"}
|
package/dist/admin.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.DecibelAdminDex = void 0;
|
|
4
4
|
const ts_sdk_1 = require("@aptos-labs/ts-sdk");
|
|
5
5
|
const base_1 = require("./base");
|
|
6
|
+
const constants_1 = require("./constants");
|
|
6
7
|
const utils_1 = require("./utils");
|
|
7
8
|
class DecibelAdminDex extends base_1.BaseSDK {
|
|
8
9
|
/**
|
|
@@ -21,8 +22,9 @@ class DecibelAdminDex extends base_1.BaseSDK {
|
|
|
21
22
|
return protocolVaultObjectAddr;
|
|
22
23
|
}
|
|
23
24
|
async initializeProtocolVault(collateralTokenAddr, initialFunding) {
|
|
25
|
+
const vaultApiModule = (0, constants_1.getVaultApiModule)(this.config.compatVersion);
|
|
24
26
|
return await this.sendTx({
|
|
25
|
-
function: `${this.config.deployment.package}::
|
|
27
|
+
function: `${this.config.deployment.package}::${vaultApiModule}::create_and_fund_vault`,
|
|
26
28
|
typeArguments: [],
|
|
27
29
|
functionArguments: [
|
|
28
30
|
collateralTokenAddr,
|
package/dist/constants.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { DecibelWsSubscription } from "./read/ws-subscription";
|
|
|
3
3
|
export declare function getUsdcAddress(publisherAddr: string): AccountAddress;
|
|
4
4
|
export declare function getTestcAddress(publisherAddr: string): AccountAddress;
|
|
5
5
|
export declare function getPerpEngineGlobalAddress(publisherAddr: string): AccountAddress;
|
|
6
|
+
export declare enum CompatVersion {
|
|
7
|
+
V0_1 = "v0.1",// decibel-testnet-release-v0.1
|
|
8
|
+
V0_2 = "v0.2"
|
|
9
|
+
}
|
|
10
|
+
export declare const DEFAULT_COMPAT_VERSION = CompatVersion.V0_2;
|
|
6
11
|
export interface DecibelConfig {
|
|
7
12
|
network: Network;
|
|
8
13
|
fullnodeUrl: string;
|
|
@@ -11,6 +16,7 @@ export interface DecibelConfig {
|
|
|
11
16
|
gasStationUrl: string;
|
|
12
17
|
deployment: Deployment;
|
|
13
18
|
chainId?: number;
|
|
19
|
+
compatVersion: CompatVersion;
|
|
14
20
|
}
|
|
15
21
|
export interface DecibelReaderDeps {
|
|
16
22
|
aptos: Aptos;
|
|
@@ -38,4 +44,5 @@ export declare const QUERY_PARAM_KEYS: {
|
|
|
38
44
|
sortDir: string;
|
|
39
45
|
searchTerm: string;
|
|
40
46
|
};
|
|
47
|
+
export declare function getVaultApiModule(compatVersion: CompatVersion): "vault" | "vault_api";
|
|
41
48
|
//# sourceMappingURL=constants.d.ts.map
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -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,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;
|
|
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;CACd;AAED,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;CAC1B;AAGD,eAAO,MAAM,gBAAgB,EAAE,UAK9B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,aAS1B,CAAC;AAGF,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,9 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.QUERY_PARAM_KEYS = exports.NAMED_CONFIGS = exports.DOCKER_CONFIG = exports.LOCAL_CONFIG = exports.TESTNET_CONFIG = exports.TESTNET_DEPLOYMENT = exports.NETNA_CONFIG = exports.NETNA_DEPLOYMENT = void 0;
|
|
3
|
+
exports.QUERY_PARAM_KEYS = exports.NAMED_CONFIGS = exports.DOCKER_CONFIG = exports.LOCAL_CONFIG = exports.TESTNET_CONFIG = exports.TESTNET_DEPLOYMENT = exports.NETNA_CONFIG = exports.NETNA_DEPLOYMENT = exports.DEFAULT_COMPAT_VERSION = exports.CompatVersion = void 0;
|
|
4
4
|
exports.getUsdcAddress = getUsdcAddress;
|
|
5
5
|
exports.getTestcAddress = getTestcAddress;
|
|
6
6
|
exports.getPerpEngineGlobalAddress = getPerpEngineGlobalAddress;
|
|
7
|
+
exports.getVaultApiModule = getVaultApiModule;
|
|
7
8
|
const ts_sdk_1 = require("@aptos-labs/ts-sdk");
|
|
8
9
|
function getUsdcAddress(publisherAddr) {
|
|
9
10
|
return (0, ts_sdk_1.createObjectAddress)(ts_sdk_1.AccountAddress.fromString(publisherAddr), new TextEncoder().encode("USDC"));
|
|
@@ -14,6 +15,12 @@ function getTestcAddress(publisherAddr) {
|
|
|
14
15
|
function getPerpEngineGlobalAddress(publisherAddr) {
|
|
15
16
|
return (0, ts_sdk_1.createObjectAddress)(ts_sdk_1.AccountAddress.fromString(publisherAddr), new TextEncoder().encode("GlobalPerpEngine"));
|
|
16
17
|
}
|
|
18
|
+
var CompatVersion;
|
|
19
|
+
(function (CompatVersion) {
|
|
20
|
+
CompatVersion["V0_1"] = "v0.1";
|
|
21
|
+
CompatVersion["V0_2"] = "v0.2";
|
|
22
|
+
})(CompatVersion || (exports.CompatVersion = CompatVersion = {}));
|
|
23
|
+
exports.DEFAULT_COMPAT_VERSION = CompatVersion.V0_2;
|
|
17
24
|
const NETNA_PACKAGE = "0xb8a5788314451ce4d2fbbad32e1bad88d4184b73943b7fe5166eab93cf1a5a95";
|
|
18
25
|
exports.NETNA_DEPLOYMENT = {
|
|
19
26
|
package: NETNA_PACKAGE,
|
|
@@ -29,6 +36,7 @@ exports.NETNA_CONFIG = {
|
|
|
29
36
|
gasStationUrl: "https://fee-payer-dev-netna-us-central1-410192433417.us-central1.run.app",
|
|
30
37
|
deployment: exports.NETNA_DEPLOYMENT,
|
|
31
38
|
chainId: 205,
|
|
39
|
+
compatVersion: exports.DEFAULT_COMPAT_VERSION,
|
|
32
40
|
};
|
|
33
41
|
const TESTNET_PACKAGE = "0x1f513904b7568445e3c291a6c58cb272db017d8a72aea563d5664666221d5f75";
|
|
34
42
|
exports.TESTNET_DEPLOYMENT = {
|
|
@@ -41,10 +49,11 @@ exports.TESTNET_CONFIG = {
|
|
|
41
49
|
network: ts_sdk_1.Network.TESTNET,
|
|
42
50
|
fullnodeUrl: "https://api.testnet.aptoslabs.com/v1",
|
|
43
51
|
tradingHttpUrl: "https://api.testnet.aptoslabs.com/decibel",
|
|
44
|
-
tradingWsUrl: "wss://api
|
|
52
|
+
tradingWsUrl: "wss://api.testnet.aptoslabs.com/decibel/ws",
|
|
45
53
|
gasStationUrl: "https://fee-payer-staging-testnet-us-central1-502735673999.us-central1.run.app",
|
|
46
54
|
deployment: exports.TESTNET_DEPLOYMENT,
|
|
47
55
|
chainId: 2,
|
|
56
|
+
compatVersion: CompatVersion.V0_1,
|
|
48
57
|
};
|
|
49
58
|
exports.LOCAL_CONFIG = {
|
|
50
59
|
network: ts_sdk_1.Network.CUSTOM,
|
|
@@ -53,6 +62,7 @@ exports.LOCAL_CONFIG = {
|
|
|
53
62
|
tradingWsUrl: "ws://localhost:8083",
|
|
54
63
|
gasStationUrl: "http://localhost:8085",
|
|
55
64
|
deployment: exports.NETNA_DEPLOYMENT,
|
|
65
|
+
compatVersion: exports.DEFAULT_COMPAT_VERSION,
|
|
56
66
|
};
|
|
57
67
|
exports.DOCKER_CONFIG = {
|
|
58
68
|
network: ts_sdk_1.Network.CUSTOM,
|
|
@@ -62,6 +72,7 @@ exports.DOCKER_CONFIG = {
|
|
|
62
72
|
tradingWsUrl: "ws://trading-api-ws:8080",
|
|
63
73
|
gasStationUrl: "http://fee-payer:8080",
|
|
64
74
|
deployment: exports.NETNA_DEPLOYMENT,
|
|
75
|
+
compatVersion: exports.DEFAULT_COMPAT_VERSION,
|
|
65
76
|
};
|
|
66
77
|
exports.NAMED_CONFIGS = {
|
|
67
78
|
netna: exports.NETNA_CONFIG,
|
|
@@ -76,3 +87,11 @@ exports.QUERY_PARAM_KEYS = {
|
|
|
76
87
|
sortDir: "sort_dir",
|
|
77
88
|
searchTerm: "search_term",
|
|
78
89
|
};
|
|
90
|
+
function getVaultApiModule(compatVersion) {
|
|
91
|
+
if (compatVersion === CompatVersion.V0_1) {
|
|
92
|
+
return `vault`;
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
return `vault_api`;
|
|
96
|
+
}
|
|
97
|
+
}
|
package/dist/fee-pay.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee-pay.d.ts","sourceRoot":"","sources":["../src/fee-pay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,
|
|
1
|
+
{"version":3,"file":"fee-pay.d.ts","sourceRoot":"","sources":["../src/fee-pay.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,0BAA0B,EAE1B,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,aAAa,EACrB,WAAW,EAAE,iBAAiB,EAC9B,mBAAmB,EAAE,oBAAoB,GACxC,OAAO,CAAC,0BAA0B,CAAC,CA2CrC"}
|
package/dist/fee-pay.js
CHANGED
|
@@ -9,22 +9,39 @@ exports.submitFeePaidTransaction = submitFeePaidTransaction;
|
|
|
9
9
|
* @returns A promise that resolves to the pending transaction response
|
|
10
10
|
*/
|
|
11
11
|
async function submitFeePaidTransaction(config, transaction, senderAuthenticator) {
|
|
12
|
+
// The fee payer service expects signature and transaction separately as byte arrays
|
|
13
|
+
// Serialize them separately - the fee payer will reconstruct the signed transaction
|
|
12
14
|
const signatureBcs = Array.from(senderAuthenticator.bcsToBytes());
|
|
13
15
|
const transactionBcs = Array.from(transaction.rawTransaction.bcsToBytes());
|
|
14
16
|
const body = JSON.stringify({
|
|
15
17
|
signature: signatureBcs,
|
|
16
18
|
transaction: transactionBcs,
|
|
17
19
|
});
|
|
18
|
-
const
|
|
20
|
+
const url = config.gasStationUrl + "/transactions";
|
|
21
|
+
console.log("\n📤 Fee Payer Request:");
|
|
22
|
+
console.log(` URL: ${url}`);
|
|
23
|
+
console.log(` Method: POST`);
|
|
24
|
+
console.log(` Body size: ${body.length} bytes`);
|
|
25
|
+
console.log(` Signature length: ${signatureBcs.length} bytes`);
|
|
26
|
+
console.log(` Transaction length: ${transactionBcs.length} bytes`);
|
|
27
|
+
console.log(` Body:`, body.substring(0, 500) + "...");
|
|
28
|
+
const response = await fetch(url, {
|
|
19
29
|
method: "POST",
|
|
20
30
|
headers: {
|
|
21
31
|
"Content-Type": "application/json",
|
|
22
32
|
},
|
|
23
33
|
body,
|
|
24
34
|
});
|
|
35
|
+
console.log(`\n📥 Fee Payer Response:`);
|
|
36
|
+
console.log(` Status: ${response.status} ${response.statusText}`);
|
|
37
|
+
console.log(` Headers:`, Object.fromEntries(response.headers.entries()));
|
|
25
38
|
if (!response.ok) {
|
|
39
|
+
const errorText = await response.text();
|
|
40
|
+
console.log(` Error body: ${errorText}`);
|
|
26
41
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
27
42
|
}
|
|
28
|
-
|
|
29
|
-
|
|
43
|
+
const responseData = (await response.json());
|
|
44
|
+
console.log(` Transaction hash: ${responseData.hash}`);
|
|
45
|
+
console.log(` Response:`, JSON.stringify(responseData, null, 2));
|
|
46
|
+
return responseData;
|
|
30
47
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BaseReader } from "../base-reader";
|
|
2
|
-
import {
|
|
2
|
+
import { AccountOverviewRequestArgs, AccountOverviewWsMessage } from "./account-overview.types";
|
|
3
3
|
export declare class AccountOverviewReader extends BaseReader {
|
|
4
4
|
/**
|
|
5
5
|
* Get the account overview for a given user
|
|
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
|
|
9
|
+
getByAddr({ subAddr, volumeWindow, fetchOptions }: AccountOverviewRequestArgs): Promise<{
|
|
10
10
|
perp_equity_balance: number;
|
|
11
11
|
unrealized_pnl: number;
|
|
12
12
|
unrealized_funding_cost: number;
|
|
@@ -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,
|
|
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,35 +1,103 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
28
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.AccountOverviewReader = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
55
|
+
var base_reader_1 = require("../base-reader");
|
|
56
|
+
var account_overview_types_1 = require("./account-overview.types");
|
|
57
|
+
var AccountOverviewReader = /** @class */ (function (_super) {
|
|
58
|
+
__extends(AccountOverviewReader, _super);
|
|
59
|
+
function AccountOverviewReader() {
|
|
60
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
61
|
+
}
|
|
7
62
|
/**
|
|
8
63
|
* Get the account overview for a given user
|
|
9
64
|
* @param subAddr The subaccount address to get the account overview for
|
|
10
65
|
* @returns The account overview for the given subaccount address
|
|
11
66
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
67
|
+
AccountOverviewReader.prototype.getByAddr = function (_a) {
|
|
68
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
69
|
+
var queryParams, response;
|
|
70
|
+
var subAddr = _b.subAddr, volumeWindow = _b.volumeWindow, fetchOptions = _b.fetchOptions;
|
|
71
|
+
return __generator(this, function (_c) {
|
|
72
|
+
switch (_c.label) {
|
|
73
|
+
case 0:
|
|
74
|
+
queryParams = new URLSearchParams({ user: subAddr });
|
|
75
|
+
if (volumeWindow) {
|
|
76
|
+
queryParams.set("volume_window", volumeWindow);
|
|
77
|
+
}
|
|
78
|
+
return [4 /*yield*/, this.getRequest({
|
|
79
|
+
schema: account_overview_types_1.AccountOverviewSchema,
|
|
80
|
+
url: "".concat(this.deps.config.tradingHttpUrl, "/api/v1/account_overviews"),
|
|
81
|
+
queryParams: queryParams,
|
|
82
|
+
options: fetchOptions,
|
|
83
|
+
})];
|
|
84
|
+
case 1:
|
|
85
|
+
response = _c.sent();
|
|
86
|
+
return [2 /*return*/, response.data];
|
|
87
|
+
}
|
|
88
|
+
});
|
|
21
89
|
});
|
|
22
|
-
|
|
23
|
-
}
|
|
90
|
+
};
|
|
24
91
|
/**
|
|
25
92
|
* Subscribe to account overview
|
|
26
93
|
* @param subAddr The subaccount address of the user to subscribe to
|
|
27
94
|
* @param onData Callback function for received account overview data
|
|
28
95
|
* @returns A function to unsubscribe from the account overview updates
|
|
29
96
|
*/
|
|
30
|
-
subscribeByAddr(subAddr, onData) {
|
|
31
|
-
|
|
97
|
+
AccountOverviewReader.prototype.subscribeByAddr = function (subAddr, onData) {
|
|
98
|
+
var topic = "account_overview:".concat(subAddr);
|
|
32
99
|
return this.deps.ws.subscribe(topic, account_overview_types_1.AccountOverviewWsMessageSchema, onData);
|
|
33
|
-
}
|
|
34
|
-
|
|
100
|
+
};
|
|
101
|
+
return AccountOverviewReader;
|
|
102
|
+
}(base_reader_1.BaseReader));
|
|
35
103
|
exports.AccountOverviewReader = AccountOverviewReader;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import z from "zod/v4";
|
|
2
|
+
import { BaseRequestArgs } from "../base-reader";
|
|
3
|
+
export interface AccountOverviewRequestArgs extends BaseRequestArgs {
|
|
4
|
+
subAddr: string;
|
|
5
|
+
volumeWindow?: VolumeWindow;
|
|
6
|
+
}
|
|
2
7
|
export declare const VolumeWindow: {
|
|
3
8
|
readonly SevenDays: "7d";
|
|
4
9
|
readonly FourteenDays: "14d";
|
|
@@ -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,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;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,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.AccountOverviewWsMessageSchema = exports.AccountOverviewSchema = exports.VolumeWindow = void 0;
|
|
7
|
-
|
|
4
|
+
var v4_1 = require("zod/v4");
|
|
8
5
|
exports.VolumeWindow = {
|
|
9
6
|
SevenDays: "7d",
|
|
10
7
|
FourteenDays: "14d",
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { DecibelReaderDeps } from "../constants";
|
|
2
|
-
import { GetRequestArgs, PatchRequestArgs, PostRequestArgs } from "../utils";
|
|
2
|
+
import { FetchOptions, GetRequestArgs, PatchRequestArgs, PostRequestArgs } from "../utils";
|
|
3
|
+
export interface BaseRequestArgs {
|
|
4
|
+
fetchOptions?: FetchOptions;
|
|
5
|
+
}
|
|
3
6
|
export declare class BaseReader {
|
|
4
7
|
protected readonly deps: DecibelReaderDeps;
|
|
5
8
|
constructor(deps: DecibelReaderDeps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-reader.d.ts","sourceRoot":"","sources":["../../src/read/base-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,
|
|
1
|
+
{"version":3,"file":"base-reader.d.ts","sourceRoot":"","sources":["../../src/read/base-reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EACL,YAAY,EAEZ,cAAc,EAEd,gBAAgB,EAEhB,eAAe,EAChB,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,eAAe;IAC9B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,qBAAa,UAAU;IACT,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,iBAAiB;gBAAvB,IAAI,EAAE,iBAAiB;cAEtC,UAAU,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC;;;;;cAO7E,WAAW,CAAC,aAAa,EAAE,IAAI,EAAE,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC;;;;;cAO/E,YAAY,CAAC,aAAa,EACxC,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,EAAE,QAAQ,CAAC;;;;;CAOxD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseReader } from "../base-reader";
|
|
2
|
-
import { CandlestickInterval, CandlestickWsMessage } from "./candlesticks.types";
|
|
2
|
+
import { CandlestickInterval, CandlesticksRequestArgs, CandlestickWsMessage } from "./candlesticks.types";
|
|
3
3
|
export declare class CandlesticksReader extends BaseReader {
|
|
4
4
|
/**
|
|
5
5
|
* Get the candlestick data points for a given market during a given time period
|
|
@@ -9,7 +9,7 @@ export declare class CandlesticksReader extends BaseReader {
|
|
|
9
9
|
* @param endTime The end time of the candlestick data points
|
|
10
10
|
* @returns The candlestick data points for the given market during the given time period
|
|
11
11
|
*/
|
|
12
|
-
getByName(marketName
|
|
12
|
+
getByName({ marketName, interval, startTime, endTime, fetchOptions, }: CandlesticksRequestArgs): Promise<{
|
|
13
13
|
T: number;
|
|
14
14
|
c: number;
|
|
15
15
|
h: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candlesticks.reader.d.ts","sourceRoot":"","sources":["../../../src/read/candlesticks/candlesticks.reader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"candlesticks.reader.d.ts","sourceRoot":"","sources":["../../../src/read/candlesticks/candlesticks.reader.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EACL,mBAAmB,EACnB,uBAAuB,EAEvB,oBAAoB,EAErB,MAAM,sBAAsB,CAAC;AAE9B,qBAAa,kBAAmB,SAAQ,UAAU;IAChD;;;;;;;OAOG;IACG,SAAS,CAAC,EACd,UAAU,EACV,QAAQ,EACR,SAAS,EACT,OAAO,EACP,YAAY,GACb,EAAE,uBAAuB;;;;;;;;;;IAkB1B;;;;;;OAMG;IACH,eAAe,CACb,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,mBAAmB,EAC7B,MAAM,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI;CAO/C"}
|
|
@@ -1,10 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
if (typeof b !== "function" && b !== null)
|
|
11
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
+
extendStatics(d, b);
|
|
13
|
+
function __() { this.constructor = d; }
|
|
14
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
+
};
|
|
16
|
+
})();
|
|
17
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
28
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
2
53
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
54
|
exports.CandlesticksReader = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
55
|
+
var utils_1 = require("../../utils");
|
|
56
|
+
var base_reader_1 = require("../base-reader");
|
|
57
|
+
var candlesticks_types_1 = require("./candlesticks.types");
|
|
58
|
+
var CandlesticksReader = /** @class */ (function (_super) {
|
|
59
|
+
__extends(CandlesticksReader, _super);
|
|
60
|
+
function CandlesticksReader() {
|
|
61
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
62
|
+
}
|
|
8
63
|
/**
|
|
9
64
|
* Get the candlestick data points for a given market during a given time period
|
|
10
65
|
* @param marketName The name of the market to get candlestick data for
|
|
@@ -13,20 +68,32 @@ class CandlesticksReader extends base_reader_1.BaseReader {
|
|
|
13
68
|
* @param endTime The end time of the candlestick data points
|
|
14
69
|
* @returns The candlestick data points for the given market during the given time period
|
|
15
70
|
*/
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
71
|
+
CandlesticksReader.prototype.getByName = function (_a) {
|
|
72
|
+
return __awaiter(this, arguments, void 0, function (_b) {
|
|
73
|
+
var marketAddr, response;
|
|
74
|
+
var marketName = _b.marketName, interval = _b.interval, startTime = _b.startTime, endTime = _b.endTime, fetchOptions = _b.fetchOptions;
|
|
75
|
+
return __generator(this, function (_c) {
|
|
76
|
+
switch (_c.label) {
|
|
77
|
+
case 0:
|
|
78
|
+
marketAddr = (0, utils_1.getMarketAddr)(marketName, this.deps.config.deployment.perpEngineGlobal);
|
|
79
|
+
return [4 /*yield*/, this.getRequest({
|
|
80
|
+
schema: candlesticks_types_1.CandlesticksSchema,
|
|
81
|
+
url: "".concat(this.deps.config.tradingHttpUrl, "/api/v1/candlesticks"),
|
|
82
|
+
queryParams: {
|
|
83
|
+
market: marketAddr.toString(),
|
|
84
|
+
interval: interval,
|
|
85
|
+
startTime: startTime.toString(),
|
|
86
|
+
endTime: endTime.toString(),
|
|
87
|
+
},
|
|
88
|
+
options: fetchOptions,
|
|
89
|
+
})];
|
|
90
|
+
case 1:
|
|
91
|
+
response = _c.sent();
|
|
92
|
+
return [2 /*return*/, response.data];
|
|
93
|
+
}
|
|
94
|
+
});
|
|
27
95
|
});
|
|
28
|
-
|
|
29
|
-
}
|
|
96
|
+
};
|
|
30
97
|
/**
|
|
31
98
|
* Subscribe to candlestick data points for a given market
|
|
32
99
|
* @param marketName The name of the market to subscribe to
|
|
@@ -34,10 +101,11 @@ class CandlesticksReader extends base_reader_1.BaseReader {
|
|
|
34
101
|
* @param onData Callback function for received candlestick data points
|
|
35
102
|
* @returns A function to unsubscribe from the candlestick updates
|
|
36
103
|
*/
|
|
37
|
-
subscribeByName(marketName, interval, onData) {
|
|
38
|
-
|
|
39
|
-
|
|
104
|
+
CandlesticksReader.prototype.subscribeByName = function (marketName, interval, onData) {
|
|
105
|
+
var marketAddr = (0, utils_1.getMarketAddr)(marketName, this.deps.config.deployment.perpEngineGlobal);
|
|
106
|
+
var topic = "market_candlestick:".concat(marketAddr, ":").concat(interval);
|
|
40
107
|
return this.deps.ws.subscribe(topic, candlesticks_types_1.CandlestickWsMessageSchema, onData);
|
|
41
|
-
}
|
|
42
|
-
|
|
108
|
+
};
|
|
109
|
+
return CandlesticksReader;
|
|
110
|
+
}(base_reader_1.BaseReader));
|
|
43
111
|
exports.CandlesticksReader = CandlesticksReader;
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import z from "zod/v4";
|
|
2
|
+
import { BaseRequestArgs } from "../base-reader";
|
|
3
|
+
export interface CandlesticksRequestArgs extends BaseRequestArgs {
|
|
4
|
+
marketName: string;
|
|
5
|
+
interval: CandlestickInterval;
|
|
6
|
+
startTime: number;
|
|
7
|
+
endTime: number;
|
|
8
|
+
}
|
|
2
9
|
export declare const CandlestickInterval: {
|
|
3
10
|
readonly OneMinute: "1m";
|
|
4
11
|
readonly FifteenMinutes: "15m";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candlesticks.types.d.ts","sourceRoot":"","sources":["../../../src/read/candlesticks/candlesticks.types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,eAAO,MAAM,mBAAmB;;;;;;CAMtB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjG,eAAO,MAAM,iBAAiB;;;;;;;;;iBAiB5B,CAAC;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;kBAA6B,CAAC;AAC7D,eAAO,MAAM,0BAA0B;;;;;;;;;;;iBAErC,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"candlesticks.types.d.ts","sourceRoot":"","sources":["../../../src/read/candlesticks/candlesticks.types.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,QAAQ,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEjD,MAAM,WAAW,uBAAwB,SAAQ,eAAe;IAC9D,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,eAAO,MAAM,mBAAmB;;;;;;CAMtB,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjG,eAAO,MAAM,iBAAiB;;;;;;;;;iBAiB5B,CAAC;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;kBAA6B,CAAC;AAC7D,eAAO,MAAM,0BAA0B;;;;;;;;;;;iBAErC,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAC5D,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAC9D,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.CandlestickWsMessageSchema = exports.CandlesticksSchema = exports.CandlestickSchema = exports.CandlestickInterval = void 0;
|
|
7
|
-
|
|
4
|
+
var v4_1 = require("zod/v4");
|
|
8
5
|
exports.CandlestickInterval = {
|
|
9
6
|
OneMinute: "1m",
|
|
10
7
|
FifteenMinutes: "15m",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BaseReader } from "../base-reader";
|
|
2
|
-
import {
|
|
2
|
+
import { DelegationsRequestArgs } from "./delegations.types";
|
|
3
3
|
export declare class DelegationsReader extends BaseReader {
|
|
4
4
|
/**
|
|
5
5
|
* Get all active delegations for a subaccount
|
|
6
6
|
* @param args The arguments containing the subaccount address
|
|
7
7
|
* @returns The list of active delegations for the given subaccount
|
|
8
8
|
*/
|
|
9
|
-
getAll(
|
|
9
|
+
getAll({ subAddr, fetchOptions }: DelegationsRequestArgs): Promise<{
|
|
10
10
|
delegated_account: string;
|
|
11
11
|
permission_type: string;
|
|
12
12
|
expiration_time_s: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delegations.reader.d.ts","sourceRoot":"","sources":["../../../src/read/delegations/delegations.reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"delegations.reader.d.ts","sourceRoot":"","sources":["../../../src/read/delegations/delegations.reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,sBAAsB,EAAqB,MAAM,qBAAqB,CAAC;AAEhF,qBAAa,iBAAkB,SAAQ,UAAU;IAC/C;;;;OAIG;IACG,MAAM,CAAC,EAAE,OAAO,EAAE,YAAY,EAAE,EAAE,sBAAsB;;;;;CAY/D"}
|