@polyester/sdk 0.11.0 → 0.13.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.
- package/CHANGELOG.md +22 -0
- package/dist/core-client.d.ts +3 -3
- package/dist/core-client.d.ts.map +1 -1
- package/dist/core-client.js +35 -50
- package/dist/core-client.js.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.d.ts +21 -0
- package/dist/gen/auth/v1/address_book_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.js +1 -1
- package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.d.ts +39 -3
- package/dist/gen/auth/v1/mfa_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.js +1 -1
- package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +2 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +3 -2
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +3 -0
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +347 -5
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +307 -3
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/services/accounts/accounts.d.ts +2 -2
- package/dist/services/accounts/accounts.d.ts.map +1 -1
- package/dist/services/accounts/accounts.js +2 -2
- package/dist/services/accounts/accounts.js.map +1 -1
- package/dist/services/address-book/address-book.d.ts +5 -3
- package/dist/services/address-book/address-book.d.ts.map +1 -1
- package/dist/services/address-book/address-book.js +5 -3
- package/dist/services/address-book/address-book.js.map +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +6 -0
- package/dist/services/address-book/address-book.schemas.d.ts.map +1 -1
- package/dist/services/address-book/address-book.schemas.js +10 -5
- package/dist/services/address-book/address-book.schemas.js.map +1 -1
- package/dist/services/api-keys/api-keys.d.ts +2 -2
- package/dist/services/api-keys/api-keys.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.js +3 -3
- package/dist/services/api-keys/api-keys.js.map +1 -1
- package/dist/services/auth/account-signer-auth.d.ts +3 -2
- package/dist/services/auth/account-signer-auth.d.ts.map +1 -1
- package/dist/services/auth/account-signer-auth.js.map +1 -1
- package/dist/services/auth/auth.d.ts +3 -7
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +1 -1
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auth/profile/profile.d.ts +2 -2
- package/dist/services/auth/profile/profile.d.ts.map +1 -1
- package/dist/services/auth/profile/profile.js +2 -2
- package/dist/services/auth/profile/profile.js.map +1 -1
- package/dist/services/balances/balances.d.ts +2 -2
- package/dist/services/balances/balances.d.ts.map +1 -1
- package/dist/services/balances/balances.js +2 -2
- package/dist/services/balances/balances.js.map +1 -1
- package/dist/services/candles/candles.d.ts +2 -2
- package/dist/services/candles/candles.d.ts.map +1 -1
- package/dist/services/candles/candles.js +2 -2
- package/dist/services/candles/candles.js.map +1 -1
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/chain-analytics/chain-analytics.d.ts +2 -2
- package/dist/services/chain-analytics/chain-analytics.d.ts.map +1 -1
- package/dist/services/chain-analytics/chain-analytics.js +2 -2
- package/dist/services/chain-analytics/chain-analytics.js.map +1 -1
- package/dist/services/deposit/deposit.d.ts +2 -2
- package/dist/services/deposit/deposit.d.ts.map +1 -1
- package/dist/services/deposit/deposit.js +2 -2
- package/dist/services/deposit/deposit.js.map +1 -1
- package/dist/services/fees/fees.d.ts +2 -2
- package/dist/services/fees/fees.d.ts.map +1 -1
- package/dist/services/fees/fees.js +2 -2
- package/dist/services/fees/fees.js.map +1 -1
- package/dist/services/guard-signer/guard-signer.d.ts +2 -2
- package/dist/services/guard-signer/guard-signer.d.ts.map +1 -1
- package/dist/services/guard-signer/guard-signer.js +2 -2
- package/dist/services/guard-signer/guard-signer.js.map +1 -1
- package/dist/services/heatmap/heatmap.d.ts +2 -2
- package/dist/services/heatmap/heatmap.d.ts.map +1 -1
- package/dist/services/heatmap/heatmap.js +2 -2
- package/dist/services/heatmap/heatmap.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +9 -9
- package/dist/services/internal-transfers/internal-transfers.d.ts +2 -2
- package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.js +2 -2
- package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.js +2 -2
- package/dist/services/lifecycle/lifecycle.js.map +1 -1
- package/dist/services/market-data/market-data.d.ts +2 -2
- package/dist/services/market-data/market-data.d.ts.map +1 -1
- package/dist/services/market-data/market-data.js +2 -2
- package/dist/services/market-data/market-data.js.map +1 -1
- package/dist/services/market-overview/market-overview.d.ts +2 -2
- package/dist/services/market-overview/market-overview.d.ts.map +1 -1
- package/dist/services/market-overview/market-overview.js +2 -2
- package/dist/services/market-overview/market-overview.js.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
- package/dist/services/mfa/mfa.d.ts +4 -4
- package/dist/services/mfa/mfa.d.ts.map +1 -1
- package/dist/services/mfa/mfa.js +4 -4
- package/dist/services/mfa/mfa.js.map +1 -1
- package/dist/services/mfa/mfa.schemas.d.ts +132 -4
- package/dist/services/mfa/mfa.schemas.d.ts.map +1 -1
- package/dist/services/mfa/mfa.schemas.js +13 -7
- package/dist/services/mfa/mfa.schemas.js.map +1 -1
- package/dist/services/orderbook/orderbook.d.ts +2 -2
- package/dist/services/orderbook/orderbook.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.js +2 -2
- package/dist/services/orderbook/orderbook.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +6 -6
- package/dist/services/orders/orders.d.ts +2 -2
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +3 -3
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.d.ts +2 -2
- package/dist/services/policies/api-key-policies/api-key-policies.d.ts.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.js +2 -2
- package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +2 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +2 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
- package/dist/services/rate-limits/rate-limits.d.ts +2 -2
- package/dist/services/rate-limits/rate-limits.d.ts.map +1 -1
- package/dist/services/rate-limits/rate-limits.js.map +1 -1
- package/dist/services/social-verification/social-verification.d.ts +2 -2
- package/dist/services/social-verification/social-verification.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.js +2 -2
- package/dist/services/social-verification/social-verification.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.d.ts +3 -3
- package/dist/services/subaccounts/subaccounts.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.js +11 -9
- package/dist/services/subaccounts/subaccounts.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +4 -4
- package/dist/services/trades/trades.d.ts +2 -2
- package/dist/services/trades/trades.d.ts.map +1 -1
- package/dist/services/trades/trades.js +2 -2
- package/dist/services/trades/trades.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +2 -2
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +2 -2
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/transfers/transfers.d.ts +2 -2
- package/dist/services/transfers/transfers.d.ts.map +1 -1
- package/dist/services/transfers/transfers.js +2 -2
- package/dist/services/transfers/transfers.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +365 -18
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +36 -4
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/services/triggers/triggers.codecs.js +51 -1
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts +2 -2
- package/dist/services/triggers/triggers.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +2 -2
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/services/vip/vip.d.ts +2 -2
- package/dist/services/vip/vip.js.map +1 -1
- package/dist/services/whiteboard/whiteboard.d.ts +2 -2
- package/dist/services/whiteboard/whiteboard.d.ts.map +1 -1
- package/dist/services/whiteboard/whiteboard.js +2 -2
- package/dist/services/whiteboard/whiteboard.js.map +1 -1
- package/dist/services/zipper/zipper.d.ts +2 -2
- package/dist/services/zipper/zipper.d.ts.map +1 -1
- package/dist/services/zipper/zipper.js +2 -2
- package/dist/services/zipper/zipper.js.map +1 -1
- package/dist/shared/transports.d.ts +7 -1
- package/dist/shared/transports.d.ts.map +1 -1
- package/dist/shared/transports.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { AuthApiTransports } from "../../../shared/transports.js";
|
|
1
2
|
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../../shared/request-options.js";
|
|
2
3
|
import { PolyesterRealtime } from "../../../realtime/types.js";
|
|
3
4
|
import "../../../realtime/index.js";
|
|
4
5
|
import { BaseSubscribeInput } from "../../../shared/types.js";
|
|
5
6
|
import { AccountIdentity, Profile, UpdateProfileInputSchema, UsernameHistoryEntry } from "./profile.schemas.js";
|
|
6
|
-
import { Transport } from "@connectrpc/connect";
|
|
7
7
|
import * as v from "valibot";
|
|
8
8
|
//#region src/services/auth/profile/profile.d.ts
|
|
9
9
|
interface SubscribeIdentityInput extends BaseSubscribeInput<AccountIdentity> {}
|
|
@@ -12,7 +12,7 @@ interface SubscribeIdentityInput extends BaseSubscribeInput<AccountIdentity> {}
|
|
|
12
12
|
*/
|
|
13
13
|
declare class ProfileService {
|
|
14
14
|
#private;
|
|
15
|
-
constructor(
|
|
15
|
+
constructor(transports: AuthApiTransports, realtime: PolyesterRealtime);
|
|
16
16
|
/**
|
|
17
17
|
* Fetches the caller's public profile, including username eligibility/cooldown, verified social handles, avatar, VIP tier, and account creation timestamp.
|
|
18
18
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"profile.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.ts"],"mappings":";;;;;;;;UAuBU,+BAA+B,mBAAmB;;;;cAK/C;;EAIG,YAAA,YAAY,mBAAmB,UAAU;;;;EAQ/C,IAAI,UAAU,0BAA0B,QAAQ;;;;EAShD,OACF,OAAO,EAAE,kBAAkB,2BAC3B,UAAU,2BACX,QAAQ;;;;EAYL,mBAAmB,UAAU,0BAA0B,QAAQ;;;;EAQrE,kBAAkB,OAAO"}
|
|
@@ -12,8 +12,8 @@ import * as v from "valibot";
|
|
|
12
12
|
var ProfileService = class {
|
|
13
13
|
#client;
|
|
14
14
|
#realtime;
|
|
15
|
-
constructor(
|
|
16
|
-
this.#client = createClient(ProfileService$1,
|
|
15
|
+
constructor(transports, realtime) {
|
|
16
|
+
this.#client = createClient(ProfileService$1, transports.authApi);
|
|
17
17
|
this.#realtime = realtime;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.js","names":["#client","Proto.ProfileService","#realtime","Proto.AccountIdentitySchema","AccountIdentitySchema"],"sources":["../../../../src/services/auth/profile/profile.ts"],"sourcesContent":["import { createClient, type Client
|
|
1
|
+
{"version":3,"file":"profile.js","names":["#client","Proto.ProfileService","#realtime","Proto.AccountIdentitySchema","AccountIdentitySchema"],"sources":["../../../../src/services/auth/profile/profile.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../../gen/auth/v1/profile_pb.js\";\nimport type { AuthApiTransports } from \"../../../shared/transports.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../../shared/validation.js\";\nimport { removeUndefined } from \"../../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../../shared/request-options.js\";\nimport {\n AccountIdentitySchema,\n ProfileSchema,\n UpdateProfileInputSchema,\n UsernameHistoryEntrySchema,\n type AccountIdentity,\n type Profile,\n type UsernameHistoryEntry,\n} from \"./profile.schemas.js\";\nimport type { BaseSubscribeInput } from \"../../../shared/types.js\";\nimport type { PolyesterRealtime } from \"../../../realtime/index.js\";\n\ninterface SubscribeIdentityInput extends BaseSubscribeInput<AccountIdentity> {}\n\n/**\n * Manages the authenticated account's public profile and realtime identity updates.\n */\nexport class ProfileService {\n #client: Client<typeof Proto.ProfileService>;\n #realtime: PolyesterRealtime;\n\n constructor(transports: AuthApiTransports, realtime: PolyesterRealtime) {\n this.#client = createClient(Proto.ProfileService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Fetches the caller's public profile, including username eligibility/cooldown, verified social handles, avatar, VIP tier, and account creation timestamp.\n */\n async get(options?: PolyesterRequestOptions): Promise<Profile> {\n const res = await this.#client.getProfile({}, toConnectCallOptions(options));\n if (!res) throw new Error(\"Profile not found\");\n return parse(ProfileSchema, res);\n }\n\n /**\n * Updates only the provided mutable profile fields; omitted fields are unchanged, while present empty strings clear optional text fields such as bio, website, Twitter, and avatar URL.\n */\n async update(\n input: v.InferInput<typeof UpdateProfileInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Profile> {\n const validatedInput = parse(UpdateProfileInputSchema, input);\n const res = await this.#client.updateProfile(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(ProfileSchema, res);\n }\n\n /**\n * Returns the caller's recent username changes, newest first, capped at 20 entries.\n */\n async getUsernameHistory(options?: PolyesterRequestOptions): Promise<UsernameHistoryEntry[]> {\n const res = await this.#client.getUsernameHistory({}, toConnectCallOptions(options));\n return parse(v.array(UsernameHistoryEntrySchema), res.history);\n }\n\n /**\n * Subscribes to public identity updates and emits normalized account identity records with base58 account IDs, username, avatar URL, and root smart-account address.\n */\n subscribeIdentity(input: SubscribeIdentityInput): () => void {\n const channel = \"public:identity:updates:proto\";\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.AccountIdentitySchema,\n onPublication: (data) => {\n const identity = parse(AccountIdentitySchema, data);\n input.onEvent(identity);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;AA4BA,IAAa,iBAAb,MAA4B;CACxB;CACA;CAEA,YAAY,YAA+B,UAA6B;EACpE,KAAKA,UAAU,aAAaC,kBAAsB,WAAW,OAAO;EACpE,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,IAAI,SAAqD;EAC3D,MAAM,MAAM,MAAM,KAAKF,QAAQ,WAAW,CAAC,GAAG,qBAAqB,OAAO,CAAC;EAC3E,IAAI,CAAC,KAAK,MAAM,IAAI,MAAM,mBAAmB;EAC7C,OAAO,MAAM,eAAe,GAAG;CACnC;;;;CAKA,MAAM,OACF,OACA,SACgB;EAChB,MAAM,iBAAiB,MAAM,0BAA0B,KAAK;EAC5D,MAAM,MAAM,MAAM,KAAKA,QAAQ,cAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,eAAe,GAAG;CACnC;;;;CAKA,MAAM,mBAAmB,SAAoE;EACzF,MAAM,MAAM,MAAM,KAAKA,QAAQ,mBAAmB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACnF,OAAO,MAAM,EAAE,MAAM,0BAA0B,GAAG,IAAI,OAAO;CACjE;;;;CAKA,kBAAkB,OAA2C;EAEzD,OAAO,KAAKE,UAAU,oBAAoB;GACtC,SAAA;GACA,QAAQC;GACR,gBAAgB,SAAS;IACrB,MAAM,WAAW,MAAMC,yBAAuB,IAAI;IAClD,MAAM,QAAQ,QAAQ;GAC1B;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AuthApiTransports } from "../../shared/transports.js";
|
|
1
2
|
import { PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
2
3
|
import { AccountScopedInput } from "../../shared/account-scope.js";
|
|
3
4
|
import { SubaccountResolver } from "../subaccount-resolver.js";
|
|
@@ -6,7 +7,6 @@ import "../../realtime/index.js";
|
|
|
6
7
|
import { BaseSubscribeInput } from "../../shared/types.js";
|
|
7
8
|
import { SdkScales } from "../../shared/decimal-surface.js";
|
|
8
9
|
import { BalanceHistoryInput, BalanceHistoryResponse, EquityHistoryInput, EquityHistoryResponse, LedgerBalance } from "./balances.schemas.js";
|
|
9
|
-
import { Transport } from "@connectrpc/connect";
|
|
10
10
|
//#region src/services/balances/balances.d.ts
|
|
11
11
|
interface SubscribeBalancesInput extends BaseSubscribeInput<LedgerBalance> {
|
|
12
12
|
accountId: string;
|
|
@@ -16,7 +16,7 @@ interface SubscribeBalancesInput extends BaseSubscribeInput<LedgerBalance> {
|
|
|
16
16
|
*/
|
|
17
17
|
declare class BalancesService {
|
|
18
18
|
#private;
|
|
19
|
-
constructor(
|
|
19
|
+
constructor(transports: AuthApiTransports, realtime: PolyesterRealtime, resolver: SubaccountResolver | undefined, scales: SdkScales);
|
|
20
20
|
/**
|
|
21
21
|
* Returns current asset balances for the resolved root account or subaccount, including trading, funding, reserved, and available amounts as decimal strings.
|
|
22
22
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.d.ts","names":[],"sources":["../../../src/services/balances/balances.ts"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"balances.d.ts","names":[],"sources":["../../../src/services/balances/balances.ts"],"mappings":";;;;;;;;;;UA6BU,+BAA+B,mBAAmB;EACxD;;;;;cAMS;;EAUL,YAAA,YAAY,mBACZ,UAAU,mBACV,UAAU,gCACV,QAAQ;;;;EAcN,KACF,QAAO,oBACP,UAAU,0BACX,QAAQ;;;;EAgBL,kBACF,OAAO,qBACP,UAAU,0BACX,QAAQ;;;;EAWL,iBACF,OAAO,oBACP,UAAU,0BACX,QAAQ;;;;EAcX,UAAU,OAAO"}
|
|
@@ -19,8 +19,8 @@ var BalancesService = class {
|
|
|
19
19
|
#ledgerBalanceSchema;
|
|
20
20
|
#balanceHistoryResponseSchema;
|
|
21
21
|
#equityHistoryResponseSchema;
|
|
22
|
-
constructor(
|
|
23
|
-
this.#client = createClient(LedgerReadService,
|
|
22
|
+
constructor(transports, realtime, resolver, scales) {
|
|
23
|
+
this.#client = createClient(LedgerReadService, transports.authApi);
|
|
24
24
|
this.#realtime = realtime;
|
|
25
25
|
this.#resolver = resolver;
|
|
26
26
|
this.#scales = scales;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.js","names":["#client","Proto.LedgerReadService","#realtime","#resolver","#scales","#ledgerBalanceSchema","#balanceHistoryResponseSchema","#equityHistoryResponseSchema","Proto.AssetBalanceSchema"],"sources":["../../../src/services/balances/balances.ts"],"sourcesContent":["import * as Proto from \"../../gen/ledger/read/v1/ledger_read_pb.js\";\nimport { createClient, type Client
|
|
1
|
+
{"version":3,"file":"balances.js","names":["#client","Proto.LedgerReadService","#realtime","#resolver","#scales","#ledgerBalanceSchema","#balanceHistoryResponseSchema","#equityHistoryResponseSchema","Proto.AssetBalanceSchema"],"sources":["../../../src/services/balances/balances.ts"],"sourcesContent":["import * as Proto from \"../../gen/ledger/read/v1/ledger_read_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport { connectReadyGatedProtoChannel } from \"../../realtime/ready-gated-subscription.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { accountScopeToSubaccountId, type AccountScopedInput } from \"../../shared/account-scope.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport {\n BalanceHistoryInputSchema,\n BalancesListInputSchema,\n EquityHistoryInputSchema,\n createBalanceHistoryResponseSchema,\n createEquityHistoryResponseSchema,\n createLedgerBalanceSchema,\n type LedgerBalance,\n type BalanceHistoryInput,\n type BalanceHistoryResponse,\n type EquityHistoryInput,\n type EquityHistoryResponse,\n} from \"./balances.schemas.js\";\n\ninterface SubscribeBalancesInput extends BaseSubscribeInput<LedgerBalance> {\n accountId: string;\n}\n\n/**\n * Reads and streams ledger balances plus balance and equity history for the authenticated account scope.\n */\nexport class BalancesService {\n #client: Client<typeof Proto.LedgerReadService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n #scales: SdkScales;\n #ledgerBalanceSchema: ReturnType<typeof createLedgerBalanceSchema>;\n #balanceHistoryResponseSchema: ReturnType<typeof createBalanceHistoryResponseSchema>;\n #equityHistoryResponseSchema: ReturnType<typeof createEquityHistoryResponseSchema>;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver: SubaccountResolver | undefined,\n scales: SdkScales,\n ) {\n this.#client = createClient(Proto.LedgerReadService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n this.#scales = scales;\n this.#ledgerBalanceSchema = createLedgerBalanceSchema();\n this.#balanceHistoryResponseSchema = createBalanceHistoryResponseSchema();\n this.#equityHistoryResponseSchema = createEquityHistoryResponseSchema(scales);\n }\n\n /**\n * Returns current asset balances for the resolved root account or subaccount, including trading, funding, reserved, and available amounts as decimal strings.\n */\n async list(\n input: AccountScopedInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<LedgerBalance[]> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validated = parse(BalancesListInputSchema, resolved);\n const res = await this.#client.getBalances(\n {\n subaccountId: accountScopeToSubaccountId(validated.account),\n },\n toConnectCallOptions(options),\n );\n return parse(v.array(this.#ledgerBalanceSchema), res.balances);\n }\n\n /**\n * Returns columnar balance history for the resolved account scope over a selected range, optionally filtered by a non-negative integer ledger asset ID and account buckets. Ledger 0 or omission includes all assets.\n */\n async getBalanceHistory(\n input: BalanceHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<BalanceHistoryResponse> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validated = parse(BalanceHistoryInputSchema, resolved);\n const res = await this.#client.getBalanceHistory(validated, toConnectCallOptions(options));\n return parse(this.#balanceHistoryResponseSchema, res);\n }\n\n /**\n * Returns equity history series for the resolved account scope over a selected range, optionally grouped by account or asset and filtered by account buckets.\n */\n async getEquityHistory(\n input: EquityHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<EquityHistoryResponse> {\n await this.#scales.ready();\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const validated = parse(EquityHistoryInputSchema, resolved);\n const res = await this.#client.getEquityHistorySeries(\n validated,\n toConnectCallOptions(options),\n );\n return parse(this.#equityHistoryResponseSchema, res);\n }\n\n /**\n * Subscribes to private balance updates on private:ledger:balances:{accountId}:proto and emits every balance record as a decimal-string row. Records for assets unknown to the catalog route a CatalogLookupError to onError.\n */\n subscribe(input: SubscribeBalancesInput): () => void {\n const channel = `private:ledger:balances:${input.accountId}:proto`;\n return connectReadyGatedProtoChannel(this.#realtime, {\n channel,\n schema: Proto.AssetBalanceSchema,\n ready: () => this.#scales.ready(),\n onPublication: (data) => {\n const b = parse(this.#ledgerBalanceSchema, data);\n input.onEvent(b);\n },\n onConnected: input.onOpen,\n onDisconnected: input.onClose,\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAoCA,IAAa,kBAAb,MAA6B;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACA,QACF;EACE,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,YAAY;EACjB,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,uBAAuB,0BAA0B;EACtD,KAAKC,gCAAgC,mCAAmC;EACxE,KAAKC,+BAA+B,kCAAkC,MAAM;CAChF;;;;CAKA,MAAM,KACF,QAA4B,CAAC,GAC7B,SACwB;EACxB,MAAM,KAAKH,QAAQ,MAAM;EACzB,MAAM,WAAW,0BAA0B,OAAO,KAAKD,SAAS;EAChE,MAAM,YAAY,MAAM,yBAAyB,QAAQ;EACzD,MAAM,MAAM,MAAM,KAAKH,QAAQ,YAC3B,EACI,cAAc,2BAA2B,UAAU,OAAO,EAC9D,GACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,EAAE,MAAM,KAAKK,oBAAoB,GAAG,IAAI,QAAQ;CACjE;;;;CAKA,MAAM,kBACF,OACA,SAC+B;EAC/B,MAAM,KAAKD,QAAQ,MAAM;EACzB,MAAM,WAAW,0BAA0B,OAAO,KAAKD,SAAS;EAChE,MAAM,YAAY,MAAM,2BAA2B,QAAQ;EAC3D,MAAM,MAAM,MAAM,KAAKH,QAAQ,kBAAkB,WAAW,qBAAqB,OAAO,CAAC;EACzF,OAAO,MAAM,KAAKM,+BAA+B,GAAG;CACxD;;;;CAKA,MAAM,iBACF,OACA,SAC8B;EAC9B,MAAM,KAAKF,QAAQ,MAAM;EACzB,MAAM,WAAW,0BAA0B,OAAO,KAAKD,SAAS;EAChE,MAAM,YAAY,MAAM,0BAA0B,QAAQ;EAC1D,MAAM,MAAM,MAAM,KAAKH,QAAQ,uBAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKO,8BAA8B,GAAG;CACvD;;;;CAKA,UAAU,OAA2C;EACjD,MAAM,UAAU,2BAA2B,MAAM,UAAU;EAC3D,OAAO,8BAA8B,KAAKL,WAAW;GACjD;GACA,QAAQM;GACR,aAAa,KAAKJ,QAAQ,MAAM;GAChC,gBAAgB,SAAS;IACrB,MAAM,IAAI,MAAM,KAAKC,sBAAsB,IAAI;IAC/C,MAAM,QAAQ,CAAC;GACnB;GACA,aAAa,MAAM;GACnB,gBAAgB,MAAM;GACtB,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { PublicApiTransports } from "../../shared/transports.js";
|
|
1
2
|
import { PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
2
3
|
import { PolyesterRealtime } from "../../realtime/types.js";
|
|
3
4
|
import { BaseSubscribeInput } from "../../shared/types.js";
|
|
4
5
|
import { SdkScales } from "../../shared/decimal-surface.js";
|
|
5
6
|
import { Candle, CandleColumnar, CandleColumnarInt, CandleInt, GetCandlesColumnsInput, GetCandlesInput, Timeframe } from "./candles.schemas.js";
|
|
6
|
-
import { Transport } from "@connectrpc/connect";
|
|
7
7
|
//#region src/services/candles/candles.d.ts
|
|
8
8
|
interface SubscribeCandlesInput extends BaseSubscribeInput<Candle> {
|
|
9
9
|
symbolId: number;
|
|
@@ -18,7 +18,7 @@ interface SubscribeCandlesIntsInput extends BaseSubscribeInput<CandleInt> {
|
|
|
18
18
|
*/
|
|
19
19
|
declare class CandlesService {
|
|
20
20
|
#private;
|
|
21
|
-
constructor(
|
|
21
|
+
constructor(transports: PublicApiTransports, realtime: PolyesterRealtime, scales: SdkScales);
|
|
22
22
|
/**
|
|
23
23
|
* Returns OHLCV candles for a symbol/timeframe request, mapped into row objects with symbol id and timeframe. The proto response is newest-first and may include incomplete/reference data depending on input flags.
|
|
24
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candles.d.ts","names":[],"sources":["../../../src/services/candles/candles.ts"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"candles.d.ts","names":[],"sources":["../../../src/services/candles/candles.ts"],"mappings":";;;;;;;UA+BU,8BAA8B,mBAAmB;EACvD;EACA,WAAW;;UAGL,kCAAkC,mBAAmB;EAC3D;EACA,WAAW;;;;;cAWF;;EASG,YAAA,YAAY,qBAAqB,UAAU,mBAAmB,QAAQ;;;;EAa5E,KAAK,OAAO,iBAAiB,UAAU,0BAA0B,QAAQ;;;;EAiBzE,aACF,OAAO,wBACP,UAAU,0BACX,QAAQ;;;;EAaL,iBACF,OAAO,wBACP,UAAU,0BACX,QAAQ;;;;EAaX,UAAU,OAAO;;;;EAOjB,cAAc,OAAO"}
|
|
@@ -22,8 +22,8 @@ var CandlesService = class {
|
|
|
22
22
|
#rowIntSchema;
|
|
23
23
|
#columnarSchema;
|
|
24
24
|
#columnarIntSchema;
|
|
25
|
-
constructor(
|
|
26
|
-
this.#client = createClient(MarketDataService,
|
|
25
|
+
constructor(transports, realtime, scales) {
|
|
26
|
+
this.#client = createClient(MarketDataService, transports.publicApi);
|
|
27
27
|
this.#realtime = realtime;
|
|
28
28
|
this.#scales = scales;
|
|
29
29
|
this.#rowSchema = createCandleRowSchema(scales);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candles.js","names":["#client","Proto.MarketDataService","#realtime","#scales","#rowSchema","#rowIntSchema","#columnarSchema","#columnarIntSchema","CandlePointSchema","#subscribeWithSchema","Proto.CandlePointSchema"],"sources":["../../../src/services/candles/candles.ts"],"sourcesContent":["import { createClient, type Client
|
|
1
|
+
{"version":3,"file":"candles.js","names":["#client","Proto.MarketDataService","#realtime","#scales","#rowSchema","#rowIntSchema","#columnarSchema","#columnarIntSchema","CandlePointSchema","#subscribeWithSchema","Proto.CandlePointSchema"],"sources":["../../../src/services/candles/candles.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/marketdata/v1/marketdata_pb.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { PolyesterRealtime } from \"../../realtime/types.js\";\nimport { connectReadyGatedProtoChannel } from \"../../realtime/ready-gated-subscription.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { PublicApiTransports } from \"../../shared/transports.js\";\nimport {\n type CandleColumnar,\n createCandleRowSchema,\n createCandleRowIntSchema,\n createCandleColumnarSchema,\n createCandleColumnarIntSchema,\n CandlePointSchema,\n TimeframeSchema,\n type Candle,\n type CandleInt,\n type Timeframe,\n type CandleColumnarInt,\n type GetCandlesInput,\n type GetCandlesColumnsInput,\n ListCandlesInputSchema,\n} from \"./candles.schemas.js\";\nimport { TimeframeCodec } from \"./candles.codecs.js\";\n\ninterface SubscribeCandlesInput extends BaseSubscribeInput<Candle> {\n symbolId: number;\n timeframe: Timeframe;\n}\n\ninterface SubscribeCandlesIntsInput extends BaseSubscribeInput<CandleInt> {\n symbolId: number;\n timeframe: Timeframe;\n}\n\nconst SubscribeCandlesParamsSchema = v.object({\n symbolId: v.pipe(v.number(), v.integer(), v.gtValue(0)),\n timeframe: TimeframeSchema,\n});\n\n/**\n * Reads and streams public spot OHLCV candle data in row and columnar formats.\n */\nexport class CandlesService {\n #client: Client<typeof Proto.MarketDataService>;\n #realtime: PolyesterRealtime;\n #scales: SdkScales;\n #rowSchema: ReturnType<typeof createCandleRowSchema>;\n #rowIntSchema: ReturnType<typeof createCandleRowIntSchema>;\n #columnarSchema: ReturnType<typeof createCandleColumnarSchema>;\n #columnarIntSchema: ReturnType<typeof createCandleColumnarIntSchema>;\n\n constructor(transports: PublicApiTransports, realtime: PolyesterRealtime, scales: SdkScales) {\n this.#client = createClient(Proto.MarketDataService, transports.publicApi);\n this.#realtime = realtime;\n this.#scales = scales;\n this.#rowSchema = createCandleRowSchema(scales);\n this.#rowIntSchema = createCandleRowIntSchema(scales);\n this.#columnarSchema = createCandleColumnarSchema(scales);\n this.#columnarIntSchema = createCandleColumnarIntSchema(scales);\n }\n\n /**\n * Returns OHLCV candles for a symbol/timeframe request, mapped into row objects with symbol id and timeframe. The proto response is newest-first and may include incomplete/reference data depending on input flags.\n */\n async list(input: GetCandlesInput, options?: PolyesterRequestOptions): Promise<Candle[]> {\n const validatedInput = parse(ListCandlesInputSchema, input);\n await this.#scales.ready();\n const res = await this.#client.getCandles(validatedInput, toConnectCallOptions(options));\n const candles = parse(v.optional(v.array(CandlePointSchema), []), res.candles);\n return candles.map((c) =>\n parse(this.#rowSchema, {\n ...c,\n symbolId: res.symbolId,\n timeframe: res.timeframe,\n }),\n );\n }\n\n /**\n * Returns candle data in chart-friendly column arrays ordered oldest-first by bucket start time. This preserves decimal-string SDK formatting from the columnar schema.\n */\n async listColumnar(\n input: GetCandlesColumnsInput,\n options?: PolyesterRequestOptions,\n ): Promise<CandleColumnar> {\n const validatedInput = parse(ListCandlesInputSchema, input);\n await this.#scales.ready();\n const res = await this.#client.getCandlesColumns(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(this.#columnarSchema, res);\n }\n\n /**\n * Returns the same columnar candle series keyed by numeric bucket-start seconds (`tsSec`) instead of `time`.\n */\n async listColumnarInts(\n input: GetCandlesColumnsInput,\n options?: PolyesterRequestOptions,\n ): Promise<CandleColumnarInt> {\n const validatedInput = parse(ListCandlesInputSchema, input);\n await this.#scales.ready();\n const res = await this.#client.getCandlesColumns(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(this.#columnarIntSchema, res);\n }\n\n /**\n * Subscribes to live candle updates on public:spot:market:candles:{timeframe}:{symbolId}:proto and emits row-form candles.\n */\n subscribe(input: SubscribeCandlesInput): () => void {\n return this.#subscribeWithSchema(input, this.#rowSchema);\n }\n\n /**\n * Subscribes to the same live candle channel as subscribe and emits row candles parsed through the row-int schema.\n */\n subscribeInts(input: SubscribeCandlesIntsInput): () => void {\n return this.#subscribeWithSchema(input, this.#rowIntSchema);\n }\n\n #subscribeWithSchema(\n input: SubscribeCandlesInput | SubscribeCandlesIntsInput,\n schema: ReturnType<typeof createCandleRowSchema>,\n ): () => void {\n const params = parse(SubscribeCandlesParamsSchema, {\n symbolId: input.symbolId,\n timeframe: input.timeframe,\n });\n const protoTimeframe = TimeframeCodec.inputToProto[params.timeframe];\n const channel = `public:spot:market:candles:${params.timeframe}:${params.symbolId}:proto`;\n return connectReadyGatedProtoChannel(this.#realtime, {\n channel,\n schema: Proto.CandlePointSchema,\n ready: () => this.#scales.ready(),\n onPublication: (data) => {\n const point = parse(CandlePointSchema, data);\n const candle = parse(schema, {\n ...point,\n symbolId: params.symbolId,\n timeframe: protoTimeframe,\n });\n input.onEvent(candle);\n },\n onConnected: input.onOpen,\n onDisconnected: input.onClose,\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;AAyCA,MAAM,+BAA+B,EAAE,OAAO;CAC1C,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,QAAQ,CAAC,CAAC;CACtD,WAAW;AACf,CAAC;;;;AAKD,IAAa,iBAAb,MAA4B;CACxB;CACA;CACA;CACA;CACA;CACA;CACA;CAEA,YAAY,YAAiC,UAA6B,QAAmB;EACzF,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,SAAS;EACzE,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,aAAa,sBAAsB,MAAM;EAC9C,KAAKC,gBAAgB,yBAAyB,MAAM;EACpD,KAAKC,kBAAkB,2BAA2B,MAAM;EACxD,KAAKC,qBAAqB,8BAA8B,MAAM;CAClE;;;;CAKA,MAAM,KAAK,OAAwB,SAAsD;EACrF,MAAM,iBAAiB,MAAM,wBAAwB,KAAK;EAC1D,MAAM,KAAKJ,QAAQ,MAAM;EACzB,MAAM,MAAM,MAAM,KAAKH,QAAQ,WAAW,gBAAgB,qBAAqB,OAAO,CAAC;EAEvF,OADgB,MAAM,EAAE,SAAS,EAAE,MAAMQ,mBAAiB,GAAG,CAAC,CAAC,GAAG,IAAI,OACzD,CAAC,CAAC,KAAK,MAChB,MAAM,KAAKJ,YAAY;GACnB,GAAG;GACH,UAAU,IAAI;GACd,WAAW,IAAI;EACnB,CAAC,CACL;CACJ;;;;CAKA,MAAM,aACF,OACA,SACuB;EACvB,MAAM,iBAAiB,MAAM,wBAAwB,KAAK;EAC1D,MAAM,KAAKD,QAAQ,MAAM;EACzB,MAAM,MAAM,MAAM,KAAKH,QAAQ,kBAC3B,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKM,iBAAiB,GAAG;CAC1C;;;;CAKA,MAAM,iBACF,OACA,SAC0B;EAC1B,MAAM,iBAAiB,MAAM,wBAAwB,KAAK;EAC1D,MAAM,KAAKH,QAAQ,MAAM;EACzB,MAAM,MAAM,MAAM,KAAKH,QAAQ,kBAC3B,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKO,oBAAoB,GAAG;CAC7C;;;;CAKA,UAAU,OAA0C;EAChD,OAAO,KAAKE,qBAAqB,OAAO,KAAKL,UAAU;CAC3D;;;;CAKA,cAAc,OAA8C;EACxD,OAAO,KAAKK,qBAAqB,OAAO,KAAKJ,aAAa;CAC9D;CAEA,qBACI,OACA,QACU;EACV,MAAM,SAAS,MAAM,8BAA8B;GAC/C,UAAU,MAAM;GAChB,WAAW,MAAM;EACrB,CAAC;EACD,MAAM,iBAAiB,eAAe,aAAa,OAAO;EAC1D,MAAM,UAAU,8BAA8B,OAAO,UAAU,GAAG,OAAO,SAAS;EAClF,OAAO,8BAA8B,KAAKH,WAAW;GACjD;GACA,QAAQQ;GACR,aAAa,KAAKP,QAAQ,MAAM;GAChC,gBAAgB,SAAS;IACrB,MAAM,QAAQ,MAAMK,qBAAmB,IAAI;IAC3C,MAAM,SAAS,MAAM,QAAQ;KACzB,GAAG;KACH,UAAU,OAAO;KACjB,WAAW;IACf,CAAC;IACD,MAAM,QAAQ,MAAM;GACxB;GACA,aAAa,MAAM;GACnB,gBAAgB,MAAM;GACtB,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
|
|
@@ -11,7 +11,7 @@ type TimestampInit = {
|
|
|
11
11
|
};
|
|
12
12
|
declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
13
13
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
14
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "
|
|
14
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">>]>;
|
|
15
15
|
readonly tsSec: v.BigintSchema<undefined>;
|
|
16
16
|
readonly open: v.BigintSchema<undefined>;
|
|
17
17
|
readonly high: v.BigintSchema<undefined>;
|
|
@@ -21,7 +21,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
21
21
|
readonly isClosed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
22
22
|
}, undefined>, v.TransformAction<{
|
|
23
23
|
symbolId: number;
|
|
24
|
-
timeframe: DecodedEnum<"1d" | "
|
|
24
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
25
25
|
tsSec: bigint;
|
|
26
26
|
open: bigint;
|
|
27
27
|
high: bigint;
|
|
@@ -31,7 +31,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
31
31
|
isClosed: boolean;
|
|
32
32
|
}, {
|
|
33
33
|
symbolId: number;
|
|
34
|
-
timeframe: DecodedEnum<"1d" | "
|
|
34
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
35
35
|
time: number;
|
|
36
36
|
open: string;
|
|
37
37
|
high: string;
|
|
@@ -43,7 +43,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
43
43
|
declare const createCandleRowIntSchema: typeof createCandleRowSchema;
|
|
44
44
|
declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
45
45
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
46
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "
|
|
46
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">>]>;
|
|
47
47
|
readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
48
48
|
readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
49
49
|
readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
@@ -59,7 +59,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
59
59
|
readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
60
60
|
}, undefined>, v.TransformAction<{
|
|
61
61
|
symbolId: number;
|
|
62
|
-
timeframe: DecodedEnum<"1d" | "
|
|
62
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
63
63
|
tsSec: bigint[];
|
|
64
64
|
open: bigint[];
|
|
65
65
|
high: bigint[];
|
|
@@ -75,7 +75,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
75
75
|
nextPageToken: string;
|
|
76
76
|
}, {
|
|
77
77
|
symbolId: number;
|
|
78
|
-
timeframe: DecodedEnum<"1d" | "
|
|
78
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
79
79
|
time: number[];
|
|
80
80
|
open: string[];
|
|
81
81
|
high: string[];
|
|
@@ -94,7 +94,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
94
94
|
}>]>;
|
|
95
95
|
declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
96
96
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
97
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "
|
|
97
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">>]>;
|
|
98
98
|
readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
99
99
|
readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
100
100
|
readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
@@ -110,7 +110,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
110
110
|
readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
111
111
|
}, undefined>, v.TransformAction<{
|
|
112
112
|
symbolId: number;
|
|
113
|
-
timeframe: DecodedEnum<"1d" | "
|
|
113
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
114
114
|
tsSec: bigint[];
|
|
115
115
|
open: bigint[];
|
|
116
116
|
high: bigint[];
|
|
@@ -126,7 +126,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
126
126
|
nextPageToken: string;
|
|
127
127
|
}, {
|
|
128
128
|
symbolId: number;
|
|
129
|
-
timeframe: DecodedEnum<"1d" | "
|
|
129
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
130
130
|
tsSec: number[];
|
|
131
131
|
open: string[];
|
|
132
132
|
high: string[];
|
|
@@ -149,7 +149,7 @@ type CandleColumnar = v.InferOutput<ReturnType<typeof createCandleColumnarSchema
|
|
|
149
149
|
type CandleColumnarInt = v.InferOutput<ReturnType<typeof createCandleColumnarIntSchema>>;
|
|
150
150
|
declare function createListCandlesInputSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
151
151
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>]>;
|
|
152
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "5m", "15m", "30m", "1h", "4h", "12h", "1d", "1w", "1mo"], undefined>, v.TransformAction<"1d" | "
|
|
152
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "5m", "15m", "30m", "1h", "4h", "12h", "1d", "1w", "1mo"], undefined>, v.TransformAction<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo", Timeframe$1.SEC_1 | Timeframe$1.MIN_1 | Timeframe$1.MIN_5 | Timeframe$1.MIN_15 | Timeframe$1.MIN_30 | Timeframe$1.HOUR_1 | Timeframe$1.HOUR_4 | Timeframe$1.DAY_1 | Timeframe$1.HOUR_12 | Timeframe$1.WEEK_1 | Timeframe$1.MONTH_1>]>;
|
|
153
153
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 10000, undefined>]>, undefined>;
|
|
154
154
|
readonly includeIncomplete: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
155
155
|
readonly includeReference: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { PublicApiTransports } from "../../shared/transports.js";
|
|
1
2
|
import { PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
2
3
|
import { SdkScales } from "../../shared/decimal-surface.js";
|
|
3
4
|
import { GetUnifiedAssetBalancesInput, GetZippedAssetSupplyGroupInput, GetZippedAssetSupplyInput, UnifiedAssetBalancesResponse, ZippedAssetSupplyGroupResponse, ZippedAssetSupplyResponse } from "./chain-analytics.schemas.js";
|
|
4
|
-
import { Transport } from "@connectrpc/connect";
|
|
5
5
|
//#region src/services/chain-analytics/chain-analytics.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Reads public chain analytics chart series.
|
|
8
8
|
*/
|
|
9
9
|
declare class ChainAnalyticsService {
|
|
10
10
|
#private;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(transports: PublicApiTransports, scales: SdkScales);
|
|
12
12
|
/**
|
|
13
13
|
* Returns route-scoped zToken supply chart columns for one zipped asset.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-analytics.d.ts","names":[],"sources":["../../../src/services/chain-analytics/chain-analytics.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"chain-analytics.d.ts","names":[],"sources":["../../../src/services/chain-analytics/chain-analytics.ts"],"mappings":";;;;;;;;cA2Ba;;EAIG,YAAA,YAAY,qBAAqB,QAAQ;;;;EAQ/C,qBACF,OAAO,2BACP,UAAU,0BACX,QAAQ;;;;EAaL,0BACF,OAAO,gCACP,UAAU,0BACX,QAAQ;;;;EAaL,wBACF,OAAO,8BACP,UAAU,0BACX,QAAQ"}
|
|
@@ -10,8 +10,8 @@ import { createClient } from "@connectrpc/connect";
|
|
|
10
10
|
var ChainAnalyticsService = class {
|
|
11
11
|
#client;
|
|
12
12
|
#scales;
|
|
13
|
-
constructor(
|
|
14
|
-
this.#client = createClient(ChainAnalyticsService$1,
|
|
13
|
+
constructor(transports, scales) {
|
|
14
|
+
this.#client = createClient(ChainAnalyticsService$1, transports.publicApi);
|
|
15
15
|
this.#scales = scales;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain-analytics.js","names":["#client","Proto.ChainAnalyticsService","#scales"],"sources":["../../../src/services/chain-analytics/chain-analytics.ts"],"sourcesContent":["import * as Proto from \"../../gen/chain/analytics/v1/analytics_read_pb.js\";\nimport { createClient, type Client
|
|
1
|
+
{"version":3,"file":"chain-analytics.js","names":["#client","Proto.ChainAnalyticsService","#scales"],"sources":["../../../src/services/chain-analytics/chain-analytics.ts"],"sourcesContent":["import * as Proto from \"../../gen/chain/analytics/v1/analytics_read_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { SdkScales } from \"../../shared/decimal-surface.js\";\nimport type { PublicApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n GetUnifiedAssetBalancesInputSchema,\n GetZippedAssetSupplyGroupInputSchema,\n GetZippedAssetSupplyInputSchema,\n createUnifiedAssetBalancesResponseSchema,\n createZippedAssetSupplyGroupResponseSchema,\n createZippedAssetSupplyResponseSchema,\n type GetUnifiedAssetBalancesInput,\n type GetZippedAssetSupplyGroupInput,\n type GetZippedAssetSupplyInput,\n type UnifiedAssetBalancesResponse,\n type ZippedAssetSupplyGroupResponse,\n type ZippedAssetSupplyResponse,\n} from \"./chain-analytics.schemas.js\";\n\n/**\n * Reads public chain analytics chart series.\n */\nexport class ChainAnalyticsService {\n #client: Client<typeof Proto.ChainAnalyticsService>;\n #scales: SdkScales;\n\n constructor(transports: PublicApiTransports, scales: SdkScales) {\n this.#client = createClient(Proto.ChainAnalyticsService, transports.publicApi);\n this.#scales = scales;\n }\n\n /**\n * Returns route-scoped zToken supply chart columns for one zipped asset.\n */\n async getZippedAssetSupply(\n input: GetZippedAssetSupplyInput,\n options?: PolyesterRequestOptions,\n ): Promise<ZippedAssetSupplyResponse> {\n const parsedInput = parse(GetZippedAssetSupplyInputSchema, input);\n await this.#scales.ready();\n const response = await this.#client.getZippedAssetSupply(\n parsedInput,\n toConnectCallOptions(options),\n );\n return parse(createZippedAssetSupplyResponseSchema(this.#scales), response);\n }\n\n /**\n * Returns grouped zToken supply chart columns for all zipped assets in one group.\n */\n async getZippedAssetSupplyGroup(\n input: GetZippedAssetSupplyGroupInput,\n options?: PolyesterRequestOptions,\n ): Promise<ZippedAssetSupplyGroupResponse> {\n const parsedInput = parse(GetZippedAssetSupplyGroupInputSchema, input);\n await this.#scales.ready();\n const response = await this.#client.getZippedAssetSupplyGroup(\n parsedInput,\n toConnectCallOptions(options),\n );\n return parse(createZippedAssetSupplyGroupResponseSchema(this.#scales), response);\n }\n\n /**\n * Returns total public unified-asset balance chart columns.\n */\n async getUnifiedAssetBalances(\n input: GetUnifiedAssetBalancesInput,\n options?: PolyesterRequestOptions,\n ): Promise<UnifiedAssetBalancesResponse> {\n const parsedInput = parse(GetUnifiedAssetBalancesInputSchema, input);\n await this.#scales.ready();\n const response = await this.#client.getUnifiedAssetBalances(\n parsedInput,\n toConnectCallOptions(options),\n );\n return parse(createUnifiedAssetBalancesResponseSchema(this.#scales), response);\n }\n}\n"],"mappings":";;;;;;;;;AA2BA,IAAa,wBAAb,MAAmC;CAC/B;CACA;CAEA,YAAY,YAAiC,QAAmB;EAC5D,KAAKA,UAAU,aAAaC,yBAA6B,WAAW,SAAS;EAC7E,KAAKC,UAAU;CACnB;;;;CAKA,MAAM,qBACF,OACA,SACkC;EAClC,MAAM,cAAc,MAAM,iCAAiC,KAAK;EAChE,MAAM,KAAKA,QAAQ,MAAM;EACzB,MAAM,WAAW,MAAM,KAAKF,QAAQ,qBAChC,aACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,sCAAsC,KAAKE,OAAO,GAAG,QAAQ;CAC9E;;;;CAKA,MAAM,0BACF,OACA,SACuC;EACvC,MAAM,cAAc,MAAM,sCAAsC,KAAK;EACrE,MAAM,KAAKA,QAAQ,MAAM;EACzB,MAAM,WAAW,MAAM,KAAKF,QAAQ,0BAChC,aACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,2CAA2C,KAAKE,OAAO,GAAG,QAAQ;CACnF;;;;CAKA,MAAM,wBACF,OACA,SACqC;EACrC,MAAM,cAAc,MAAM,oCAAoC,KAAK;EACnE,MAAM,KAAKA,QAAQ,MAAM;EACzB,MAAM,WAAW,MAAM,KAAKF,QAAQ,wBAChC,aACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,yCAAyC,KAAKE,OAAO,GAAG,QAAQ;CACjF;AACJ"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { AuthApiTransports } from "../../shared/transports.js";
|
|
1
2
|
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
2
3
|
import { SubaccountResolver } from "../subaccount-resolver.js";
|
|
3
4
|
import { CreateDepositAddressInput, DepositAddress, ListDepositAddressesInput } from "./deposit.schemas.js";
|
|
4
|
-
import { Transport } from "@connectrpc/connect";
|
|
5
5
|
//#region src/services/deposit/deposit.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Manages chain deposit addresses for root accounts and subaccounts.
|
|
8
8
|
*/
|
|
9
9
|
declare class DepositService {
|
|
10
10
|
#private;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(transports: AuthApiTransports, resolver?: SubaccountResolver);
|
|
12
12
|
/**
|
|
13
13
|
* Creates or returns the deposit address assigned to the resolved account target for a selected chain. Returns null if the backend response does not include an address.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deposit.d.ts","names":[],"sources":["../../../src/services/deposit/deposit.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"deposit.d.ts","names":[],"sources":["../../../src/services/deposit/deposit.ts"],"mappings":";;;;;;;;cAwBa;;EAIG,YAAA,YAAY,mBAAmB,WAAW;;;;EAQhD,cACF,OAAO,2BACP,UAAU,2BACX,QAAQ;;;;EAcL,cACF,QAAO,2BACP,UAAU,0BACX,QAAQ"}
|
|
@@ -12,8 +12,8 @@ import { createClient } from "@connectrpc/connect";
|
|
|
12
12
|
var DepositService = class {
|
|
13
13
|
#client;
|
|
14
14
|
#resolver;
|
|
15
|
-
constructor(
|
|
16
|
-
this.#client = createClient(DepositAddressService,
|
|
15
|
+
constructor(transports, resolver) {
|
|
16
|
+
this.#client = createClient(DepositAddressService, transports.authApi);
|
|
17
17
|
this.#resolver = resolver;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deposit.js","names":["#client","Proto.DepositAddressService","#resolver"],"sources":["../../../src/services/deposit/deposit.ts"],"sourcesContent":["import { createClient, type Client
|
|
1
|
+
{"version":3,"file":"deposit.js","names":["#client","Proto.DepositAddressService","#resolver"],"sources":["../../../src/services/deposit/deposit.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/chain/deposit/v1/deposit_pb.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n CreateDepositAddressInputSchema,\n DepositAddressSchema,\n DepositAddressesSchema,\n ListDepositAddressesInputSchema,\n type CreateDepositAddressInput,\n type ListDepositAddressesInput,\n type DepositAddress,\n} from \"./deposit.schemas.js\";\n\n/**\n * Manages chain deposit addresses for root accounts and subaccounts.\n */\nexport class DepositService {\n #client: Client<typeof Proto.DepositAddressService>;\n #resolver?: SubaccountResolver;\n\n constructor(transports: AuthApiTransports, resolver?: SubaccountResolver) {\n this.#client = createClient(Proto.DepositAddressService, transports.authApi);\n this.#resolver = resolver;\n }\n\n /**\n * Creates or returns the deposit address assigned to the resolved account target for a selected chain. Returns null if the backend response does not include an address.\n */\n async createAddress(\n input: CreateDepositAddressInput,\n options?: PolyesterMutationOptions,\n ): Promise<DepositAddress | null> {\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(CreateDepositAddressInputSchema, resolvedInput);\n const res = await this.#client.createDepositAddress(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!res.depositAddress) return null;\n return parse(DepositAddressSchema, res.depositAddress);\n }\n\n /**\n * Lists known deposit addresses for the resolved account target, optionally filtered by chain. Results are ordered by ascending chain id in the generated proto contract.\n */\n async listAddresses(\n input: ListDepositAddressesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<DepositAddress[]> {\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(ListDepositAddressesInputSchema, resolvedInput);\n const res = await this.#client.listDepositAddresses(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(DepositAddressesSchema, res.depositAddresses);\n }\n}\n"],"mappings":";;;;;;;;;;;AAwBA,IAAa,iBAAb,MAA4B;CACxB;CACA;CAEA,YAAY,YAA+B,UAA+B;EACtE,KAAKA,UAAU,aAAaC,uBAA6B,WAAW,OAAO;EAC3E,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,cACF,OACA,SAC8B;EAC9B,MAAM,gBAAgB,0BAA0B,OAAO,KAAKA,SAAS;EACrE,MAAM,iBAAiB,MAAM,iCAAiC,aAAa;EAC3E,MAAM,MAAM,MAAM,KAAKF,QAAQ,qBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,IAAI,gBAAgB,OAAO;EAChC,OAAO,MAAM,sBAAsB,IAAI,cAAc;CACzD;;;;CAKA,MAAM,cACF,QAAmC,CAAC,GACpC,SACyB;EACzB,MAAM,gBAAgB,0BAA0B,OAAO,KAAKE,SAAS;EACrE,MAAM,iBAAiB,MAAM,iCAAiC,aAAa;EAC3E,MAAM,MAAM,MAAM,KAAKF,QAAQ,qBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,wBAAwB,IAAI,gBAAgB;CAC7D;AACJ"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { AuthApiTransports } from "../../shared/transports.js";
|
|
1
2
|
import { PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
2
3
|
import { SubaccountResolver } from "../subaccount-resolver.js";
|
|
3
4
|
import { GetSpotFeeRatesInput, SpotFeeRate } from "./fees.schemas.js";
|
|
4
|
-
import { Transport } from "@connectrpc/connect";
|
|
5
5
|
//#region src/services/fees/fees.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Reads authenticated effective spot trading fee rates.
|
|
8
8
|
*/
|
|
9
9
|
declare class FeesService {
|
|
10
10
|
#private;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(transports: AuthApiTransports, resolver?: SubaccountResolver);
|
|
12
12
|
/**
|
|
13
13
|
* Returns effective maker and taker spot fee rates for the resolved account target, optionally filtered by market identifier.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees.d.ts","names":[],"sources":["../../../src/services/fees/fees.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"fees.d.ts","names":[],"sources":["../../../src/services/fees/fees.ts"],"mappings":";;;;;;;;cAoBa;;EAIG,YAAA,YAAY,mBAAmB,WAAW;;;;EAQhD,aACF,QAAO,sBACP,UAAU,0BACX,QAAQ"}
|
|
@@ -12,8 +12,8 @@ import { createClient } from "@connectrpc/connect";
|
|
|
12
12
|
var FeesService = class {
|
|
13
13
|
#client;
|
|
14
14
|
#resolver;
|
|
15
|
-
constructor(
|
|
16
|
-
this.#client = createClient(FeeService,
|
|
15
|
+
constructor(transports, resolver) {
|
|
16
|
+
this.#client = createClient(FeeService, transports.authApi);
|
|
17
17
|
this.#resolver = resolver;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees.js","names":["#client","Proto.FeeService","#resolver"],"sources":["../../../src/services/fees/fees.ts"],"sourcesContent":["import { createClient, type Client
|
|
1
|
+
{"version":3,"file":"fees.js","names":["#client","Proto.FeeService","#resolver"],"sources":["../../../src/services/fees/fees.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/fees/v1/fees_pb.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n GetSpotFeeRatesInputSchema,\n SpotFeeRatesSchema,\n type GetSpotFeeRatesInput,\n type SpotFeeRate,\n} from \"./fees.schemas.js\";\n\n/**\n * Reads authenticated effective spot trading fee rates.\n */\nexport class FeesService {\n #client: Client<typeof Proto.FeeService>;\n #resolver?: SubaccountResolver;\n\n constructor(transports: AuthApiTransports, resolver?: SubaccountResolver) {\n this.#client = createClient(Proto.FeeService, transports.authApi);\n this.#resolver = resolver;\n }\n\n /**\n * Returns effective maker and taker spot fee rates for the resolved account target, optionally filtered by market identifier.\n */\n async getSpotRates(\n input: GetSpotFeeRatesInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<SpotFeeRate[]> {\n const resolvedInput = resolveAccountScopedInput(input, this.#resolver);\n const validatedInput = parse(GetSpotFeeRatesInputSchema, resolvedInput);\n const res = await this.#client.getSpotFeeRates(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return parse(SpotFeeRatesSchema, res.feeRates);\n }\n}\n"],"mappings":";;;;;;;;;;;AAoBA,IAAa,cAAb,MAAyB;CACrB;CACA;CAEA,YAAY,YAA+B,UAA+B;EACtE,KAAKA,UAAU,aAAaC,YAAkB,WAAW,OAAO;EAChE,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,aACF,QAA8B,CAAC,GAC/B,SACsB;EACtB,MAAM,gBAAgB,0BAA0B,OAAO,KAAKA,SAAS;EACrE,MAAM,iBAAiB,MAAM,4BAA4B,aAAa;EACtE,MAAM,MAAM,MAAM,KAAKF,QAAQ,gBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,oBAAoB,IAAI,QAAQ;CACjD;AACJ"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import { AuthApiTransports } from "../../shared/transports.js";
|
|
1
2
|
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
2
3
|
import { SubaccountResolver } from "../subaccount-resolver.js";
|
|
3
4
|
import { BatchGuardApprovals, BatchSignProtectedActionInput, CreateGuardSignerWalletResult, ExportGuardSignerWalletResult, GuardApproval, GuardSignerScopedInput, GuardSignerStatus, RotateGuardSignerWalletResult, SignProtectedActionInput } from "./guard-signer.schemas.js";
|
|
4
|
-
import { Transport } from "@connectrpc/connect";
|
|
5
5
|
//#region src/services/guard-signer/guard-signer.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Manages backend guard signer wallets and approval signatures for protected Polyester account actions.
|
|
8
8
|
*/
|
|
9
9
|
declare class GuardSignerService {
|
|
10
10
|
#private;
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(transports: AuthApiTransports, resolver?: SubaccountResolver);
|
|
12
12
|
/**
|
|
13
13
|
* Creates a guard signer wallet for the resolved account target and returns the generated signer EVM address.
|
|
14
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard-signer.d.ts","names":[],"sources":["../../../src/services/guard-signer/guard-signer.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"guard-signer.d.ts","names":[],"sources":["../../../src/services/guard-signer/guard-signer.ts"],"mappings":";;;;;;;;cA6Ca;;EAIG,YAAA,YAAY,mBAAmB,WAAW;;;;EAQhD,aACF,QAAO,wBACP,UAAU,2BACX,QAAQ;;;;EAYL,UACF,QAAO,wBACP,UAAU,0BACX,QAAQ;;;;EAiBL,oBACF,OAAO,0BACP,UAAU,2BACX,QAAQ;;;;EAYL,0BACF,OAAO,+BACP,UAAU,2BACX,QAAQ;;;;EAiBL,aACF,QAAO,wBACP,UAAU,2BACX,QAAQ;;;;EAYL,aACF,QAAO,wBACP,UAAU,2BACX,QAAQ;UASH"}
|
|
@@ -17,8 +17,8 @@ function isGuardSignerWalletNotFoundError(err) {
|
|
|
17
17
|
var GuardSignerService = class {
|
|
18
18
|
#client;
|
|
19
19
|
#resolver;
|
|
20
|
-
constructor(
|
|
21
|
-
this.#client = createClient(GuardSignerService$1,
|
|
20
|
+
constructor(transports, resolver) {
|
|
21
|
+
this.#client = createClient(GuardSignerService$1, transports.authApi);
|
|
22
22
|
this.#resolver = resolver;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"guard-signer.js","names":["#client","Proto.GuardSignerService","#resolver"],"sources":["../../../src/services/guard-signer/guard-signer.ts"],"sourcesContent":["import { createClient, type Client
|
|
1
|
+
{"version":3,"file":"guard-signer.js","names":["#client","Proto.GuardSignerService","#resolver"],"sources":["../../../src/services/guard-signer/guard-signer.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/chain/guard/v1/guard_signer_pb.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../subaccount-resolver.js\";\nimport type { AccountScopedInput } from \"../../shared/account-scope.js\";\nimport {\n BatchGuardApprovalsSchema,\n BatchSignProtectedActionInputSchema,\n CreateGuardSignerWalletResultSchema,\n ExportGuardSignerWalletResultSchema,\n GuardApprovalSchema,\n GuardSignerScopedInputSchema,\n GuardSignerStatusSchema,\n RotateGuardSignerWalletResultSchema,\n SignProtectedActionInputSchema,\n type BatchGuardApprovals,\n type BatchSignProtectedActionInput,\n type CreateGuardSignerWalletResult,\n type ExportGuardSignerWalletResult,\n type GuardApproval,\n type GuardSignerScopedInput,\n type GuardSignerStatus,\n type RotateGuardSignerWalletResult,\n type SignProtectedActionInput,\n} from \"./guard-signer.schemas.js\";\nimport { formatConnectError, isResourceNotFoundError } from \"../../utils/errors.js\";\nimport { parse } from \"../../shared/validation.js\";\n\nconst GUARD_SIGNER_WALLET_NOT_FOUND_MESSAGE = \"guard signer wallet not found\";\n\nfunction isGuardSignerWalletNotFoundError(err: unknown): boolean {\n return formatConnectError(err, \"\")\n .toLowerCase()\n .includes(GUARD_SIGNER_WALLET_NOT_FOUND_MESSAGE);\n}\n\n/**\n * Manages backend guard signer wallets and approval signatures for protected Polyester account actions.\n */\nexport class GuardSignerService {\n #client: Client<typeof Proto.GuardSignerService>;\n #resolver?: SubaccountResolver;\n\n constructor(transports: AuthApiTransports, resolver?: SubaccountResolver) {\n this.#client = createClient(Proto.GuardSignerService, transports.authApi);\n this.#resolver = resolver;\n }\n\n /**\n * Creates a guard signer wallet for the resolved account target and returns the generated signer EVM address.\n */\n async createWallet(\n input: GuardSignerScopedInput = {},\n options?: PolyesterMutationOptions,\n ): Promise<CreateGuardSignerWalletResult> {\n const request = parse(GuardSignerScopedInputSchema, this.resolveInput(input));\n const response = await this.#client.createGuardSignerWallet(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(CreateGuardSignerWalletResultSchema, response);\n }\n\n /**\n * Returns stored and live guard signer status for the resolved account target, including signer address, on-chain signer, initialization state, nonce, and nonce space. Returns null when the backend reports the wallet is not found.\n */\n async getStatus(\n input: GuardSignerScopedInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<GuardSignerStatus | null> {\n const request = parse(GuardSignerScopedInputSchema, this.resolveInput(input));\n try {\n const response = await this.#client.getGuardSignerStatus(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return response.status ? parse(GuardSignerStatusSchema, response.status) : null;\n } catch (err) {\n if (isResourceNotFoundError(err) || isGuardSignerWalletNotFoundError(err)) return null;\n throw err;\n }\n }\n\n /**\n * Creates one guard approval signature for a supported protected action, such as whitelist updates or whitelist requirement changes. Returns null if the backend response has no approval payload.\n */\n async signProtectedAction(\n input: SignProtectedActionInput,\n options?: PolyesterMutationOptions,\n ): Promise<GuardApproval | null> {\n const request = parse(SignProtectedActionInputSchema, this.resolveInput(input));\n const response = await this.#client.signProtectedAction(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return response.approval ? parse(GuardApprovalSchema, response.approval) : null;\n }\n\n /**\n * Creates ordered guard approval signatures for a batch of protected actions and verifies the backend returned one approval per requested action.\n */\n async batchSignProtectedActions(\n input: BatchSignProtectedActionInput,\n options?: PolyesterMutationOptions,\n ): Promise<BatchGuardApprovals> {\n const request = parse(BatchSignProtectedActionInputSchema, this.resolveInput(input));\n const response = await this.#client.batchSignProtectedActions(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n\n if (response.approvals.length !== input.actions.length) {\n throw new Error(\"Backend returned a mismatched number of GuardSigner approvals.\");\n }\n\n return parse(BatchGuardApprovalsSchema, response);\n }\n\n /**\n * Generates a backend-managed replacement guard signer for the resolved account target and returns the new signer address plus the rotation approval payload.\n */\n async rotateWallet(\n input: GuardSignerScopedInput = {},\n options?: PolyesterMutationOptions,\n ): Promise<RotateGuardSignerWalletResult> {\n const request = parse(GuardSignerScopedInputSchema, this.resolveInput(input));\n const response = await this.#client.rotateGuardSignerWallet(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(RotateGuardSignerWalletResultSchema, response);\n }\n\n /**\n * Exports guard signer private key material for the resolved account target after owner authorization and fresh step-up, returning the backend export response.\n */\n async exportWallet(\n input: GuardSignerScopedInput = {},\n options?: PolyesterMutationOptions,\n ): Promise<ExportGuardSignerWalletResult> {\n const request = parse(GuardSignerScopedInputSchema, this.resolveInput(input));\n const response = await this.#client.exportGuardSignerWallet(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(ExportGuardSignerWalletResultSchema, response);\n }\n\n private resolveInput<TInput extends AccountScopedInput>(input: TInput): TInput {\n return resolveAccountScopedInput(input, this.#resolver);\n }\n}\n"],"mappings":";;;;;;;;;AAkCA,MAAM,wCAAwC;AAE9C,SAAS,iCAAiC,KAAuB;CAC7D,OAAO,mBAAmB,KAAK,EAAE,CAAC,CAC7B,YAAY,CAAC,CACb,SAAS,qCAAqC;AACvD;;;;AAKA,IAAa,qBAAb,MAAgC;CAC5B;CACA;CAEA,YAAY,YAA+B,UAA+B;EACtE,KAAKA,UAAU,aAAaC,sBAA0B,WAAW,OAAO;EACxE,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,aACF,QAAgC,CAAC,GACjC,SACsC;EACtC,MAAM,UAAU,MAAM,8BAA8B,KAAK,aAAa,KAAK,CAAC;EAC5E,MAAM,WAAW,MAAM,KAAKF,QAAQ,wBAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,qCAAqC,QAAQ;CAC9D;;;;CAKA,MAAM,UACF,QAAgC,CAAC,GACjC,SACiC;EACjC,MAAM,UAAU,MAAM,8BAA8B,KAAK,aAAa,KAAK,CAAC;EAC5E,IAAI;GACA,MAAM,WAAW,MAAM,KAAKA,QAAQ,qBAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;GACA,OAAO,SAAS,SAAS,MAAM,yBAAyB,SAAS,MAAM,IAAI;EAC/E,SAAS,KAAK;GACV,IAAI,wBAAwB,GAAG,KAAK,iCAAiC,GAAG,GAAG,OAAO;GAClF,MAAM;EACV;CACJ;;;;CAKA,MAAM,oBACF,OACA,SAC6B;EAC7B,MAAM,UAAU,MAAM,gCAAgC,KAAK,aAAa,KAAK,CAAC;EAC9E,MAAM,WAAW,MAAM,KAAKA,QAAQ,oBAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,SAAS,WAAW,MAAM,qBAAqB,SAAS,QAAQ,IAAI;CAC/E;;;;CAKA,MAAM,0BACF,OACA,SAC4B;EAC5B,MAAM,UAAU,MAAM,qCAAqC,KAAK,aAAa,KAAK,CAAC;EACnF,MAAM,WAAW,MAAM,KAAKA,QAAQ,0BAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EAEA,IAAI,SAAS,UAAU,WAAW,MAAM,QAAQ,QAC5C,MAAM,IAAI,MAAM,gEAAgE;EAGpF,OAAO,MAAM,2BAA2B,QAAQ;CACpD;;;;CAKA,MAAM,aACF,QAAgC,CAAC,GACjC,SACsC;EACtC,MAAM,UAAU,MAAM,8BAA8B,KAAK,aAAa,KAAK,CAAC;EAC5E,MAAM,WAAW,MAAM,KAAKA,QAAQ,wBAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,qCAAqC,QAAQ;CAC9D;;;;CAKA,MAAM,aACF,QAAgC,CAAC,GACjC,SACsC;EACtC,MAAM,UAAU,MAAM,8BAA8B,KAAK,aAAa,KAAK,CAAC;EAC5E,MAAM,WAAW,MAAM,KAAKA,QAAQ,wBAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,qCAAqC,QAAQ;CAC9D;CAEA,aAAwD,OAAuB;EAC3E,OAAO,0BAA0B,OAAO,KAAKE,SAAS;CAC1D;AACJ"}
|