@polyester/sdk 0.36.0-devnet-20261113022813 → 0.36.0-devnet-20261114152753
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 +13 -1
- package/dist/browser-core.js +1 -1
- package/dist/catalogs/index.d.ts +2 -2
- package/dist/catalogs/snapshot-validation.js +3 -1
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/catalogs/zipper-catalog.d.ts +2 -0
- package/dist/catalogs/zipper-catalog.d.ts.map +1 -1
- package/dist/catalogs/zipper-catalog.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +1 -1
- package/dist/gen/ai/v1/assistant_pb.js +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +1 -1
- package/dist/gen/auth/v1/address_book_pb.d.ts +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +6 -6
- package/dist/gen/auth/v1/api_keys_pb.js +5 -5
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +1 -1
- package/dist/gen/auth/v1/mfa_pb.d.ts +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +10 -2
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +9 -1
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +1 -1
- package/dist/gen/auth/v1/resolve_pb.d.ts +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +8 -2
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +8 -2
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/analytics/v1/analytics_read_pb.d.ts +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +1 -1
- package/dist/gen/chain/zipper/v1/reason_pb.d.ts +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +48 -3
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js +36 -2
- package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts +7 -4
- package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js +2 -1
- package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +1 -1
- package/dist/gen/claims/v1/claims_pb.d.ts +1 -1
- package/dist/gen/fees/v1/fees_pb.d.ts +1 -1
- package/dist/gen/index.d.ts +2 -1
- package/dist/gen/index.js +22 -21
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +126 -3
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +17 -3
- package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/asset_info_pb.d.ts +178 -0
- package/dist/gen/marketdata/v1/asset_info_pb.d.ts.map +1 -0
- package/dist/gen/marketdata/v1/asset_info_pb.js +45 -0
- package/dist/gen/marketdata/v1/asset_info_pb.js.map +1 -0
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +13 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +6 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +1 -1
- package/dist/gen/polyester/type/v1/u128_pb.d.ts +1 -1
- package/dist/gen/privatews/v1/private_ws_pb.d.ts +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +1 -1
- package/dist/gen/rewards/v1/rewards_pb.d.ts +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +13 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +12 -0
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +14 -10
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +10 -7
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +3 -3
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js.map +1 -1
- package/dist/gen/swap/v1/swap_pb.d.ts +1 -1
- package/dist/gen/system/v1/system_pb.d.ts +408 -3
- package/dist/gen/system/v1/system_pb.d.ts.map +1 -1
- package/dist/gen/system/v1/system_pb.js +221 -3
- package/dist/gen/system/v1/system_pb.js.map +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +7 -5
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +6 -4
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/gen/vip/v1/vip_pb.d.ts +1 -1
- package/dist/index.d.ts +7 -4
- package/dist/index.js +1 -1
- package/dist/realtime/snapshot-then-stream.js +1 -1
- package/dist/server-core.js +3 -3
- package/dist/services/accounts/accounts.js +1 -1
- package/dist/services/accounts/accounts.schemas.js +1 -1
- package/dist/services/address-book/address-book.js +1 -1
- package/dist/services/api-keys/api-keys.codecs.d.ts +2 -2
- package/dist/services/api-keys/api-keys.codecs.js +2 -2
- package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
- package/dist/services/api-keys/api-keys.js +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +1 -1
- package/dist/services/assistant/assistant-events.schemas.d.ts +96 -67
- package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant.js +1 -1
- package/dist/services/assistant/assistant.schemas.d.ts +1 -1
- package/dist/services/assistant/assistant.schemas.js +1 -1
- package/dist/services/auth/account-signer-auth.js +2 -2
- package/dist/services/auth/auth.js +1 -1
- package/dist/services/auth/profile/profile.js +2 -2
- package/dist/services/auto-withdraw/auto-withdraw.js +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +6 -6
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -1
- package/dist/services/balances/balances.d.ts +12 -1
- package/dist/services/balances/balances.d.ts.map +1 -1
- package/dist/services/balances/balances.js +38 -2
- package/dist/services/balances/balances.js.map +1 -1
- package/dist/services/balances/balances.schemas.d.ts +55 -1
- package/dist/services/balances/balances.schemas.d.ts.map +1 -1
- package/dist/services/balances/balances.schemas.js +22 -1
- package/dist/services/balances/balances.schemas.js.map +1 -1
- package/dist/services/balances/balances.types.d.ts +2 -2
- package/dist/services/candles/candles.js +2 -2
- package/dist/services/chain-analytics/chain-analytics.js +1 -1
- package/dist/services/changelog/changelog.js +1 -1
- package/dist/services/checkpoints/checkpoints.js +1 -1
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +3 -3
- package/dist/services/claims/claims.js +1 -1
- package/dist/services/claims/claims.schemas.js +1 -1
- package/dist/services/deposit/deposit.js +1 -1
- package/dist/services/fees/fees.js +1 -1
- package/dist/services/guard-signer/guard-signer.js +1 -1
- package/dist/services/guard-signer/guard-signer.schemas.js +1 -1
- package/dist/services/heatmap/heatmap.js +2 -2
- package/dist/services/internal-transfers/internal-transfers.js +1 -1
- package/dist/services/lifecycle/lifecycle.js +3 -3
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +53 -53
- package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
- package/dist/services/market-data/market-data.d.ts +7 -1
- package/dist/services/market-data/market-data.d.ts.map +1 -1
- package/dist/services/market-data/market-data.js +14 -3
- package/dist/services/market-data/market-data.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.d.ts +108 -1
- package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +42 -2
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.types.d.ts +2 -2
- package/dist/services/market-overview/market-overview.js +2 -2
- package/dist/services/market-overview/market-overview.schemas.js +1 -1
- package/dist/services/notifications/notifications.js +1 -1
- package/dist/services/notifications/notifications.schemas.d.ts +1 -1
- package/dist/services/orderbook/orderbook.js +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +2 -2
- package/dist/services/orders/order-errors.schemas.js +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +40 -40
- package/dist/services/orders/orders-batch.schemas.js +2 -2
- package/dist/services/orders/orders-input.schemas.d.ts +6 -6
- package/dist/services/orders/orders-input.schemas.js +2 -2
- package/dist/services/orders/orders-modify.schemas.js +2 -2
- package/dist/services/orders/orders-output.schemas.d.ts +11 -11
- package/dist/services/orders/orders-output.schemas.js +1 -1
- package/dist/services/orders/orders-risk.schemas.js +3 -3
- package/dist/services/orders/orders.js +2 -2
- package/dist/services/policies/api-key-policies/api-key-policies.js +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/shared.codecs.js +7 -4
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +2 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
- package/dist/services/price-alerts/price-alerts.js +1 -1
- package/dist/services/rate-limits/rate-limits.js +1 -1
- package/dist/services/rewards/rewards.js +1 -1
- package/dist/services/social-verification/social-verification.js +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +1 -1
- package/dist/services/subaccounts/subaccounts.codecs.js +2 -1
- package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.js +3 -3
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +10 -10
- package/dist/services/system/system.codecs.d.ts +20 -0
- package/dist/services/system/system.codecs.d.ts.map +1 -0
- package/dist/services/system/system.codecs.js +57 -0
- package/dist/services/system/system.codecs.js.map +1 -0
- package/dist/services/system/system.d.ts +7 -0
- package/dist/services/system/system.d.ts.map +1 -1
- package/dist/services/system/system.js +14 -1
- package/dist/services/system/system.js.map +1 -1
- package/dist/services/system/system.schemas.d.ts +234 -0
- package/dist/services/system/system.schemas.d.ts.map +1 -0
- package/dist/services/system/system.schemas.js +78 -0
- package/dist/services/system/system.schemas.js.map +1 -0
- package/dist/services/system/system.types.d.ts +4 -0
- package/dist/services/trades/trades.js +2 -2
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +1 -1
- package/dist/services/trading-withdraws/wallet-message.js +1 -1
- package/dist/services/transfers/transfers.js +2 -2
- package/dist/services/triggers/trigger-child-order.schemas.js +3 -3
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +47 -47
- package/dist/services/triggers/triggers.js +2 -2
- package/dist/services/vip/vip.js +1 -1
- package/dist/services/vip/vip.schemas.d.ts +3 -3
- package/dist/services/vip/vip.schemas.js +1 -1
- package/dist/services/zipper/zipper.js +1 -1
- package/dist/services/zipper/zipper.schemas.d.ts +2 -2
- package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
- package/dist/services/zipper/zipper.schemas.js +10 -3
- package/dist/services/zipper/zipper.schemas.js.map +1 -1
- package/dist/services/zipper/zipper.types.d.ts +2 -2
- package/dist/shared/catalog-config.d.ts +13 -1
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js +6 -1
- package/dist/shared/catalog-config.js.map +1 -1
- package/dist/shared/error-details/alerts.js +1 -1
- package/dist/shared/error-details/assistant.js +1 -1
- package/dist/shared/error-details/auth.js +1 -1
- package/dist/shared/error-details/claims.js +1 -1
- package/dist/shared/error-details/internal-transfer.js +1 -1
- package/dist/shared/error-details/ledger.js +1 -1
- package/dist/shared/error-details/market-overview.js +1 -1
- package/dist/shared/error-details/notifications.js +1 -1
- package/dist/shared/error-details/orders.js +1 -1
- package/dist/shared/error-details/profile.js +1 -1
- package/dist/shared/error-details/rate-limit.js +1 -1
- package/dist/shared/error-details/withdraw.js +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +1 -1
- package/dist/shared/rate-limit.schemas.js +1 -1
- package/dist/utils/cookies.js +1 -1
- package/dist/wired-services.js +17 -17
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant-events.schemas.d.ts","names":[],"sources":["../../../src/services/assistant/assistant-events.schemas.ts"],"mappings":";;;;;;;iBAwLS,mBAAmB,GAAG;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAUlD,oBAAoB,kBAAkB"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { AssistantService as AssistantService$1 } from "../../gen/ai/v1/assistant_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
3
4
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
4
5
|
import { formatId } from "../../utils/base58-id.js";
|
|
5
6
|
import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
6
|
-
import { AssistantService as AssistantService$1 } from "../../gen/ai/v1/assistant_pb.js";
|
|
7
7
|
import { ApprovalStatusCodec } from "./assistant.codecs.js";
|
|
8
8
|
import { formatRunEvent } from "./assistant-events.schemas.js";
|
|
9
9
|
import { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatTelegramApprovalLimits } from "./assistant.schemas.js";
|
|
@@ -144,7 +144,7 @@ declare function formatMemory(m: Memory): {
|
|
|
144
144
|
createdAt: number | undefined;
|
|
145
145
|
/** Omitted when the conversation it was learned in is unknown. */
|
|
146
146
|
conversationId: string | undefined;
|
|
147
|
-
kind: "unspecified" | "
|
|
147
|
+
kind: "unspecified" | "fact" | "planning_figure" | "profile";
|
|
148
148
|
};
|
|
149
149
|
type AssistantMemory = ReturnType<typeof formatMemory>;
|
|
150
150
|
declare function formatAssistantKey(k: AssistantKey$1): {
|
|
@@ -3,8 +3,8 @@ import { tsObjToMs } from "../../utils/time.js";
|
|
|
3
3
|
import { idInputSchema, optionalSubaccountIdInputSchema } from "../../shared/schemas.js";
|
|
4
4
|
import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
5
5
|
import { ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ApprovalDecisionCodec, AssistantKeyStateCodec, DisplaySettingCodec, MemoryKindCodec, MessageRoleCodec } from "./assistant.codecs.js";
|
|
6
|
-
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
7
6
|
import * as v from "valibot";
|
|
7
|
+
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
8
8
|
//#region src/services/assistant/assistant.schemas.ts
|
|
9
9
|
const IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));
|
|
10
10
|
function pageInputEntries(maxLimit) {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { AuthSessionStore } from "./session.js";
|
|
2
|
+
import { getJwtTimeToExpiry, isJwtValid } from "../../utils/jwt.js";
|
|
1
3
|
import { AuthenticationError, ConfigurationError } from "../../shared/errors.js";
|
|
2
4
|
import { toPolyesterError } from "../../shared/connect-error-mapping.js";
|
|
3
5
|
import { AuthService } from "./auth.js";
|
|
4
|
-
import { AuthSessionStore } from "./session.js";
|
|
5
6
|
import { assertAccountSigner, resolveAccountSigner } from "../../account-signer/types.js";
|
|
6
7
|
import { EventEmitter } from "../../utils/event-emitter.js";
|
|
7
|
-
import { getJwtTimeToExpiry, isJwtValid } from "../../utils/jwt.js";
|
|
8
8
|
import { createAuthTokenStorageSetOptions } from "./token-storage.js";
|
|
9
9
|
//#region src/services/auth/account-signer-auth.ts
|
|
10
10
|
/**
|
|
@@ -5,8 +5,8 @@ import { OptionalTimestampMsSchema, PublicIdSchema, TimestampSchema } from "../.
|
|
|
5
5
|
import { ProfileService } from "./profile/profile.js";
|
|
6
6
|
import { MfaSessionInfoSchema } from "../mfa/mfa.schemas.js";
|
|
7
7
|
import { WalletAddressSchema, WalletChallengeMessageSchema, WalletChallengeUriSchema } from "./wallet-challenge.schemas.js";
|
|
8
|
-
import { createClient } from "@connectrpc/connect";
|
|
9
8
|
import * as v from "valibot";
|
|
9
|
+
import { createClient } from "@connectrpc/connect";
|
|
10
10
|
//#region src/services/auth/auth.ts
|
|
11
11
|
const CreateWalletChallengeInputSchema = v.strictObject({
|
|
12
12
|
smartAccountAddress: WalletAddressSchema,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { parse } from "../../../shared/validation.js";
|
|
2
1
|
import { AccountIdentitySchema, ProfileService as ProfileService$1 } from "../../../gen/auth/v1/profile_pb.js";
|
|
2
|
+
import { parse } from "../../../shared/validation.js";
|
|
3
3
|
import { removeUndefined } from "../../../utils/remove-undefined.js";
|
|
4
4
|
import { toConnectCallOptions } from "../../../shared/request-options.js";
|
|
5
5
|
import { AccountIdentitySchema as AccountIdentitySchema$1, ClaimGeneratedUsernameInputSchema, GeneratedUsernameOfferSchema, ProfileSchema, UpdateProfileInputSchema, UsernameHistoryEntrySchema } from "./profile.schemas.js";
|
|
6
|
-
import { createClient } from "@connectrpc/connect";
|
|
7
6
|
import * as v from "valibot";
|
|
7
|
+
import { createClient } from "@connectrpc/connect";
|
|
8
8
|
//#region src/services/auth/profile/profile.ts
|
|
9
9
|
/**
|
|
10
10
|
* Manages the authenticated account's public profile and realtime identity updates.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { AutoWithdrawService as AutoWithdrawService$1 } from "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
1
2
|
import { PolyesterError, RevisionConflictError } from "../../shared/errors.js";
|
|
2
3
|
import { toPolyesterError } from "../../shared/connect-error-mapping.js";
|
|
3
4
|
import { parse } from "../../shared/validation.js";
|
|
4
5
|
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
5
6
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
6
7
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
7
|
-
import { AutoWithdrawService as AutoWithdrawService$1 } from "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
8
8
|
import { AutoWithdrawPreviewSchema, AutoWithdrawRuleSchema, AutoWithdrawScopedInputSchema, ListAutoWithdrawRunsInputSchema, ListAutoWithdrawRunsResultSchema, SetAutoWithdrawRuleEnabledInputSchema, SetAutoWithdrawRuleInputSchema } from "./auto-withdraw.schemas.js";
|
|
9
9
|
import { Code, ConnectError, createClient } from "@connectrpc/connect";
|
|
10
10
|
//#region src/services/auto-withdraw/auto-withdraw.ts
|
|
@@ -559,7 +559,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
559
559
|
seconds: bigint;
|
|
560
560
|
nanos: number;
|
|
561
561
|
}, number>]>;
|
|
562
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "
|
|
562
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped">]>;
|
|
563
563
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
|
|
564
564
|
readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
565
565
|
readonly assetId: v.NumberSchema<undefined>;
|
|
@@ -640,7 +640,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
640
640
|
runSeq: string;
|
|
641
641
|
ruleVersion: number;
|
|
642
642
|
scheduledFor: number;
|
|
643
|
-
state: "unspecified" | "failed" | "
|
|
643
|
+
state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
|
|
644
644
|
reason: AutoWithdrawRunReason | null;
|
|
645
645
|
steps: {
|
|
646
646
|
destinationChainId: number;
|
|
@@ -662,7 +662,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
662
662
|
runSeq: string;
|
|
663
663
|
ruleVersion: number;
|
|
664
664
|
scheduledFor: number;
|
|
665
|
-
state: "unspecified" | "failed" | "
|
|
665
|
+
state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
|
|
666
666
|
reason: AutoWithdrawRunReason | null;
|
|
667
667
|
steps: {
|
|
668
668
|
destinationChainId: number;
|
|
@@ -692,7 +692,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
692
692
|
seconds: bigint;
|
|
693
693
|
nanos: number;
|
|
694
694
|
}, number>]>;
|
|
695
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "
|
|
695
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped">]>;
|
|
696
696
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawRunReason | null>]>;
|
|
697
697
|
readonly steps: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
698
698
|
readonly assetId: v.NumberSchema<undefined>;
|
|
@@ -773,7 +773,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
773
773
|
runSeq: string;
|
|
774
774
|
ruleVersion: number;
|
|
775
775
|
scheduledFor: number;
|
|
776
|
-
state: "unspecified" | "failed" | "
|
|
776
|
+
state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
|
|
777
777
|
reason: AutoWithdrawRunReason | null;
|
|
778
778
|
steps: {
|
|
779
779
|
destinationChainId: number;
|
|
@@ -795,7 +795,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
795
795
|
runSeq: string;
|
|
796
796
|
ruleVersion: number;
|
|
797
797
|
scheduledFor: number;
|
|
798
|
-
state: "unspecified" | "failed" | "
|
|
798
|
+
state: "unspecified" | "failed" | "completed" | "planned" | "paying" | "partially_failed" | "skipped";
|
|
799
799
|
reason: AutoWithdrawRunReason | null;
|
|
800
800
|
steps: {
|
|
801
801
|
destinationChainId: number;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
1
2
|
import { ValidationError } from "../../shared/errors.js";
|
|
2
3
|
import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
|
|
3
4
|
import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdOrEmptySchema, TimestampMsSchema, U128Schema } from "../../shared/schemas.js";
|
|
@@ -6,7 +7,6 @@ import { decimalInputToScaled, scaledToDecimalOutput } from "../../shared/decima
|
|
|
6
7
|
import { PositiveUint32InputSchema } from "../shared.js";
|
|
7
8
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
8
9
|
import { fromU128, toU128 } from "../../utils/u128.js";
|
|
9
|
-
import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
10
10
|
import { AUTO_WITHDRAW_WEEKDAY_VALUES, AutoWithdrawCadenceCodec, AutoWithdrawPreviewStatusCodec, AutoWithdrawRunStateCodec, AutoWithdrawStepStateCodec, AutoWithdrawWeekdayCodec } from "./auto-withdraw.codecs.js";
|
|
11
11
|
import * as v from "valibot";
|
|
12
12
|
//#region src/services/auto-withdraw/auto-withdraw.schemas.ts
|
|
@@ -6,7 +6,7 @@ import { PolyesterRealtime } from "../../realtime/types.js";
|
|
|
6
6
|
import "../../realtime/index.js";
|
|
7
7
|
import { BaseSubscribeInput } from "../../shared/types.js";
|
|
8
8
|
import { SdkScales } from "../../shared/decimal-surface.js";
|
|
9
|
-
import { BalanceHistoryInput, BalanceHistoryResponse, EquityHistoryInput, EquityHistoryResponse, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySnapshotResponse } from "./balances.schemas.js";
|
|
9
|
+
import { BalanceHistoryInput, BalanceHistoryResponse, EquityHistoryInput, EquityHistoryResponse, ExportStatementInput, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySnapshotResponse, StatementPage } from "./balances.schemas.js";
|
|
10
10
|
//#region src/services/balances/balances.d.ts
|
|
11
11
|
interface SubscribeBalancesInput extends BaseSubscribeInput<LedgerBalance> {
|
|
12
12
|
accountId: string;
|
|
@@ -37,6 +37,17 @@ declare class BalancesService {
|
|
|
37
37
|
* Returns current root portfolio equity grouped by logical account and asset.
|
|
38
38
|
*/
|
|
39
39
|
getPortfolioEquitySnapshot(options?: PolyesterRequestOptions): Promise<PortfolioEquitySnapshotResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* Returns one page of the resolved account's statement as CSV: every balance movement in the
|
|
42
|
+
* period, oldest first, with its fee and the balance after it. A page holds at most 2000
|
|
43
|
+
* movements. API keys need `read-statements`. Use `exportStatementCsv` for the whole period.
|
|
44
|
+
*/
|
|
45
|
+
exportStatement(input: ExportStatementInput, options?: PolyesterRequestOptions): Promise<StatementPage>;
|
|
46
|
+
/**
|
|
47
|
+
* Follows `nextPageToken` from the first page and returns the whole statement CSV, header
|
|
48
|
+
* row first. The account is resolved once, so every page reads the same account.
|
|
49
|
+
*/
|
|
50
|
+
exportStatementCsv(input: Omit<ExportStatementInput, "pageToken">, options?: PolyesterRequestOptions): Promise<string>;
|
|
40
51
|
/**
|
|
41
52
|
* 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.
|
|
42
53
|
*/
|
|
@@ -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":";;;;;;;;;;UAqCU,+BAA+B,mBAAmB;EACxD;;;;;cAMS;;EAeL,YAAA,YAAY,mBACZ,UAAU,mBACV,UAAU,gCACV,QAAQ;;;;EAiBN,KACF,QAAO,oBACP,UAAU,0BACX,QAAQ;;;;EAgBL,kBACF,OAAO,qBACP,UAAU,0BACX,QAAQ;;;;EAWL,iBACF,OAAO,oBACP,UAAU,0BACX,QAAQ;;;;EAcL,0BACF,OAAO,6BACP,UAAU,0BACX,QAAQ;;;;EAaL,2BACF,UAAU,0BACX,QAAQ;;;;;;EAcL,gBACF,OAAO,sBACP,UAAU,0BACX,QAAQ;;;;;EAcL,mBACF,OAAO,KAAK,oCACZ,UAAU,0BACX;;;;EAgBH,UAAU,OAAO"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
|
|
4
4
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
5
5
|
import { accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
6
|
-
import { BalanceHistoryInputSchema, BalancesListInputSchema, EquityHistoryInputSchema, PortfolioEquityHistoryInputSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance } from "./balances.schemas.js";
|
|
6
|
+
import { BalanceHistoryInputSchema, BalancesListInputSchema, EquityHistoryInputSchema, ExportStatementInputSchema, PortfolioEquityHistoryInputSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance } from "./balances.schemas.js";
|
|
7
7
|
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
8
8
|
import { createClient } from "@connectrpc/connect";
|
|
9
9
|
//#region src/services/balances/balances.ts
|
|
@@ -76,6 +76,42 @@ var BalancesService = class {
|
|
|
76
76
|
return parse(this.#portfolioEquitySnapshotResponseSchema, res);
|
|
77
77
|
}
|
|
78
78
|
/**
|
|
79
|
+
* Returns one page of the resolved account's statement as CSV: every balance movement in the
|
|
80
|
+
* period, oldest first, with its fee and the balance after it. A page holds at most 2000
|
|
81
|
+
* movements. API keys need `read-statements`. Use `exportStatementCsv` for the whole period.
|
|
82
|
+
*/
|
|
83
|
+
async exportStatement(input, options) {
|
|
84
|
+
const resolved = resolveAccountScopedInput(input, this.#resolver);
|
|
85
|
+
const request = parse(ExportStatementInputSchema, resolved);
|
|
86
|
+
const { csv, nextPageToken } = await this.#client.exportStatement(request, toConnectCallOptions(options));
|
|
87
|
+
return {
|
|
88
|
+
csv,
|
|
89
|
+
nextPageToken
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Follows `nextPageToken` from the first page and returns the whole statement CSV, header
|
|
94
|
+
* row first. The account is resolved once, so every page reads the same account.
|
|
95
|
+
*/
|
|
96
|
+
async exportStatementCsv(input, options) {
|
|
97
|
+
const resolved = resolveAccountScopedInput(input, this.#resolver);
|
|
98
|
+
const pinned = {
|
|
99
|
+
...resolved,
|
|
100
|
+
account: resolved.account ?? "main"
|
|
101
|
+
};
|
|
102
|
+
let csv = "";
|
|
103
|
+
let pageToken = "";
|
|
104
|
+
do {
|
|
105
|
+
const page = await this.exportStatement({
|
|
106
|
+
...pinned,
|
|
107
|
+
pageToken
|
|
108
|
+
}, options);
|
|
109
|
+
csv += page.csv;
|
|
110
|
+
pageToken = page.nextPageToken;
|
|
111
|
+
} while (pageToken);
|
|
112
|
+
return csv;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
79
115
|
* 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.
|
|
80
116
|
*/
|
|
81
117
|
subscribe(input) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.js","names":["#client","Proto.LedgerReadService","#realtime","#resolver","#scales","#balanceHistoryResponseSchema","#equityHistoryResponseSchema","#portfolioEquityHistoryResponseSchema","#portfolioEquitySnapshotResponseSchema","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 { 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 PortfolioEquityHistoryInputSchema,\n createBalanceHistoryResponseSchema,\n createEquityHistoryResponseSchema,\n formatLedgerBalance,\n createPortfolioEquityHistoryResponseSchema,\n createPortfolioEquitySnapshotResponseSchema,\n type LedgerBalance,\n type BalanceHistoryInput,\n type BalanceHistoryResponse,\n type EquityHistoryInput,\n type EquityHistoryResponse,\n type PortfolioEquityHistoryInput,\n type PortfolioEquityHistoryResponse,\n type PortfolioEquitySnapshotResponse,\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 #balanceHistoryResponseSchema: ReturnType<typeof createBalanceHistoryResponseSchema>;\n #equityHistoryResponseSchema: ReturnType<typeof createEquityHistoryResponseSchema>;\n #portfolioEquityHistoryResponseSchema: ReturnType<\n typeof createPortfolioEquityHistoryResponseSchema\n >;\n #portfolioEquitySnapshotResponseSchema: ReturnType<\n typeof createPortfolioEquitySnapshotResponseSchema\n >;\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.#balanceHistoryResponseSchema = createBalanceHistoryResponseSchema();\n this.#equityHistoryResponseSchema = createEquityHistoryResponseSchema(scales);\n this.#portfolioEquityHistoryResponseSchema =\n createPortfolioEquityHistoryResponseSchema(scales);\n this.#portfolioEquitySnapshotResponseSchema =\n createPortfolioEquitySnapshotResponseSchema(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 res.balances.map(formatLedgerBalance);\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 * Returns root portfolio equity history grouped by the master account, leading owned subaccounts, and an optional remaining-subaccounts series.\n */\n async getPortfolioEquityHistory(\n input: PortfolioEquityHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<PortfolioEquityHistoryResponse> {\n await this.#scales.ready();\n const validated = parse(PortfolioEquityHistoryInputSchema, input);\n const res = await this.#client.getPortfolioEquityHistorySeries(\n validated,\n toConnectCallOptions(options),\n );\n return parse(this.#portfolioEquityHistoryResponseSchema, res);\n }\n\n /**\n * Returns current root portfolio equity grouped by logical account and asset.\n */\n async getPortfolioEquitySnapshot(\n options?: PolyesterRequestOptions,\n ): Promise<PortfolioEquitySnapshotResponse> {\n await this.#scales.ready();\n const res = await this.#client.getPortfolioEquitySnapshot(\n {},\n toConnectCallOptions(options),\n );\n return parse(this.#portfolioEquitySnapshotResponseSchema, 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 input.onEvent(formatLedgerBalance(data));\n },\n onConnected: input.onOpen,\n onDisconnected: input.onClose,\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;AAyCA,IAAa,kBAAb,MAA6B;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CAIA,YACI,YACA,UACA,UACA,QACF;EACE,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,YAAY;EACjB,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,gCAAgC,mCAAmC;EACxE,KAAKC,+BAA+B,kCAAkC,MAAM;EAC5E,KAAKC,wCACD,2CAA2C,MAAM;EACrD,KAAKC,yCACD,4CAA4C,MAAM;CAC1D;;;;CAKA,MAAM,KACF,QAA4B,CAAC,GAC7B,SACwB;EACxB,MAAM,KAAKJ,QAAQ,MAAM;EACzB,MAAM,WAAW,0BAA0B,OAAO,KAAKD,SAAS;EAChE,MAAM,YAAY,MAAM,yBAAyB,QAAQ;EAOzD,QAAO,MANW,KAAKH,QAAQ,YAC3B,EACI,cAAc,2BAA2B,UAAU,OAAO,EAC9D,GACA,qBAAqB,OAAO,CAChC,EAAA,CACW,SAAS,IAAI,mBAAmB;CAC/C;;;;CAKA,MAAM,kBACF,OACA,SAC+B;EAC/B,MAAM,KAAKI,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,KAAKK,+BAA+B,GAAG;CACxD;;;;CAKA,MAAM,iBACF,OACA,SAC8B;EAC9B,MAAM,KAAKD,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,KAAKM,8BAA8B,GAAG;CACvD;;;;CAKA,MAAM,0BACF,OACA,SACuC;EACvC,MAAM,KAAKF,QAAQ,MAAM;EACzB,MAAM,YAAY,MAAM,mCAAmC,KAAK;EAChE,MAAM,MAAM,MAAM,KAAKJ,QAAQ,gCAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKO,uCAAuC,GAAG;CAChE;;;;CAKA,MAAM,2BACF,SACwC;EACxC,MAAM,KAAKH,QAAQ,MAAM;EACzB,MAAM,MAAM,MAAM,KAAKJ,QAAQ,2BAC3B,CAAC,GACD,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,KAAKQ,wCAAwC,GAAG;CACjE;;;;CAKA,UAAU,OAA2C;EACjD,MAAM,UAAU,2BAA2B,MAAM,UAAU;EAC3D,OAAO,8BAA8B,KAAKN,WAAW;GACjD;GACA,QAAQO;GACR,aAAa,KAAKL,QAAQ,MAAM;GAChC,gBAAgB,SAAS;IACrB,MAAM,QAAQ,oBAAoB,IAAI,CAAC;GAC3C;GACA,aAAa,MAAM;GACnB,gBAAgB,MAAM;GACtB,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
|
|
1
|
+
{"version":3,"file":"balances.js","names":["#client","Proto.LedgerReadService","#realtime","#resolver","#scales","#balanceHistoryResponseSchema","#equityHistoryResponseSchema","#portfolioEquityHistoryResponseSchema","#portfolioEquitySnapshotResponseSchema","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 { 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 ExportStatementInputSchema,\n PortfolioEquityHistoryInputSchema,\n createBalanceHistoryResponseSchema,\n createEquityHistoryResponseSchema,\n formatLedgerBalance,\n createPortfolioEquityHistoryResponseSchema,\n createPortfolioEquitySnapshotResponseSchema,\n type LedgerBalance,\n type BalanceHistoryInput,\n type BalanceHistoryResponse,\n type EquityHistoryInput,\n type EquityHistoryResponse,\n type ExportStatementInput,\n type StatementPage,\n type PortfolioEquityHistoryInput,\n type PortfolioEquityHistoryResponse,\n type PortfolioEquitySnapshotResponse,\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 #balanceHistoryResponseSchema: ReturnType<typeof createBalanceHistoryResponseSchema>;\n #equityHistoryResponseSchema: ReturnType<typeof createEquityHistoryResponseSchema>;\n #portfolioEquityHistoryResponseSchema: ReturnType<\n typeof createPortfolioEquityHistoryResponseSchema\n >;\n #portfolioEquitySnapshotResponseSchema: ReturnType<\n typeof createPortfolioEquitySnapshotResponseSchema\n >;\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.#balanceHistoryResponseSchema = createBalanceHistoryResponseSchema();\n this.#equityHistoryResponseSchema = createEquityHistoryResponseSchema(scales);\n this.#portfolioEquityHistoryResponseSchema =\n createPortfolioEquityHistoryResponseSchema(scales);\n this.#portfolioEquitySnapshotResponseSchema =\n createPortfolioEquitySnapshotResponseSchema(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 res.balances.map(formatLedgerBalance);\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 * Returns root portfolio equity history grouped by the master account, leading owned subaccounts, and an optional remaining-subaccounts series.\n */\n async getPortfolioEquityHistory(\n input: PortfolioEquityHistoryInput,\n options?: PolyesterRequestOptions,\n ): Promise<PortfolioEquityHistoryResponse> {\n await this.#scales.ready();\n const validated = parse(PortfolioEquityHistoryInputSchema, input);\n const res = await this.#client.getPortfolioEquityHistorySeries(\n validated,\n toConnectCallOptions(options),\n );\n return parse(this.#portfolioEquityHistoryResponseSchema, res);\n }\n\n /**\n * Returns current root portfolio equity grouped by logical account and asset.\n */\n async getPortfolioEquitySnapshot(\n options?: PolyesterRequestOptions,\n ): Promise<PortfolioEquitySnapshotResponse> {\n await this.#scales.ready();\n const res = await this.#client.getPortfolioEquitySnapshot(\n {},\n toConnectCallOptions(options),\n );\n return parse(this.#portfolioEquitySnapshotResponseSchema, res);\n }\n\n /**\n * Returns one page of the resolved account's statement as CSV: every balance movement in the\n * period, oldest first, with its fee and the balance after it. A page holds at most 2000\n * movements. API keys need `read-statements`. Use `exportStatementCsv` for the whole period.\n */\n async exportStatement(\n input: ExportStatementInput,\n options?: PolyesterRequestOptions,\n ): Promise<StatementPage> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(ExportStatementInputSchema, resolved);\n const { csv, nextPageToken } = await this.#client.exportStatement(\n request,\n toConnectCallOptions(options),\n );\n return { csv, nextPageToken };\n }\n\n /**\n * Follows `nextPageToken` from the first page and returns the whole statement CSV, header\n * row first. The account is resolved once, so every page reads the same account.\n */\n async exportStatementCsv(\n input: Omit<ExportStatementInput, \"pageToken\">,\n options?: PolyesterRequestOptions,\n ): Promise<string> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const pinned = { ...resolved, account: resolved.account ?? (\"main\" as const) };\n let csv = \"\";\n let pageToken = \"\";\n do {\n const page = await this.exportStatement({ ...pinned, pageToken }, options);\n csv += page.csv;\n pageToken = page.nextPageToken;\n } while (pageToken);\n return csv;\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 input.onEvent(formatLedgerBalance(data));\n },\n onConnected: input.onOpen,\n onDisconnected: input.onClose,\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;AA4CA,IAAa,kBAAb,MAA6B;CACzB;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CAIA,YACI,YACA,UACA,UACA,QACF;EACE,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,YAAY;EACjB,KAAKC,YAAY;EACjB,KAAKC,UAAU;EACf,KAAKC,gCAAgC,mCAAmC;EACxE,KAAKC,+BAA+B,kCAAkC,MAAM;EAC5E,KAAKC,wCACD,2CAA2C,MAAM;EACrD,KAAKC,yCACD,4CAA4C,MAAM;CAC1D;;;;CAKA,MAAM,KACF,QAA4B,CAAC,GAC7B,SACwB;EACxB,MAAM,KAAKJ,QAAQ,MAAM;EACzB,MAAM,WAAW,0BAA0B,OAAO,KAAKD,SAAS;EAChE,MAAM,YAAY,MAAM,yBAAyB,QAAQ;EAOzD,QAAO,MANW,KAAKH,QAAQ,YAC3B,EACI,cAAc,2BAA2B,UAAU,OAAO,EAC9D,GACA,qBAAqB,OAAO,CAChC,EAAA,CACW,SAAS,IAAI,mBAAmB;CAC/C;;;;CAKA,MAAM,kBACF,OACA,SAC+B;EAC/B,MAAM,KAAKI,QAAQ,MAAM;EACzB,MAAM,WAAW,0BAA0B,OAAO,KAAKD,SAAS;EAChE,MAAM,YAAY,MAAM,2BAA2B,QAAQ;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MAAM,OAAO,MAAM,KAAK,gBAAgB;IAAE,GAAG;IAAQ;GAAU,GAAG,OAAO;GACzE,OAAO,KAAK;GACZ,YAAY,KAAK;EACrB,SAAS;EACT,OAAO;CACX;;;;CAKA,UAAU,OAA2C;EACjD,MAAM,UAAU,2BAA2B,MAAM,UAAU;EAC3D,OAAO,8BAA8B,KAAKD,WAAW;GACjD;GACA,QAAQO;GACR,aAAa,KAAKL,QAAQ,MAAM;GAChC,gBAAgB,SAAS;IACrB,MAAM,QAAQ,oBAAoB,IAAI,CAAC;GAC3C;GACA,aAAa,MAAM;GACnB,gBAAgB,MAAM;GACtB,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
|
|
@@ -75,6 +75,60 @@ declare const BalanceHistoryInputSchema: v.SchemaWithPipe<readonly [v.StrictObje
|
|
|
75
75
|
accountCodes: (AccountCode.FUNDING | AccountCode.TRADING)[];
|
|
76
76
|
}>]>;
|
|
77
77
|
type BalanceHistoryInput = v.InferInput<typeof BalanceHistoryInputSchema>;
|
|
78
|
+
declare const ExportStatementInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
79
|
+
/** Period start, inclusive, in epoch milliseconds (UTC). */
|
|
80
|
+
readonly startTime: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
81
|
+
/** Period end, exclusive, in epoch milliseconds (UTC); at most 366 days after `startTime`. */
|
|
82
|
+
readonly endTime: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
83
|
+
/** Ledger asset ID to cover only that asset; omit or `0` for every asset. */
|
|
84
|
+
readonly assetId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, 0>;
|
|
85
|
+
/** Previous `nextPageToken`; reuse only with the same account, asset and period. */
|
|
86
|
+
readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
|
|
87
|
+
readonly account: v.OptionalSchema<v.UnionSchema<[v.PicklistSchema<["active", "main"], undefined>, v.StrictObjectSchema<{
|
|
88
|
+
readonly subaccountId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
89
|
+
}, undefined>], undefined>, undefined>;
|
|
90
|
+
}, undefined>, v.CheckAction<{
|
|
91
|
+
startTime: number;
|
|
92
|
+
endTime: number;
|
|
93
|
+
assetId: number;
|
|
94
|
+
pageToken: string;
|
|
95
|
+
account?: "active" | "main" | {
|
|
96
|
+
subaccountId: string;
|
|
97
|
+
} | undefined;
|
|
98
|
+
}, "endTime must be after startTime.">, v.CheckAction<{
|
|
99
|
+
startTime: number;
|
|
100
|
+
endTime: number;
|
|
101
|
+
assetId: number;
|
|
102
|
+
pageToken: string;
|
|
103
|
+
account?: "active" | "main" | {
|
|
104
|
+
subaccountId: string;
|
|
105
|
+
} | undefined;
|
|
106
|
+
}, "A statement period is at most 366 days.">, v.TransformAction<{
|
|
107
|
+
startTime: number;
|
|
108
|
+
endTime: number;
|
|
109
|
+
assetId: number;
|
|
110
|
+
pageToken: string;
|
|
111
|
+
account?: "active" | "main" | {
|
|
112
|
+
subaccountId: string;
|
|
113
|
+
} | undefined;
|
|
114
|
+
}, {
|
|
115
|
+
subaccountId: bigint | undefined;
|
|
116
|
+
startTime: import("@bufbuild/protobuf/wkt").Timestamp;
|
|
117
|
+
endTime: import("@bufbuild/protobuf/wkt").Timestamp;
|
|
118
|
+
assetId: number;
|
|
119
|
+
pageToken: string;
|
|
120
|
+
}>]>;
|
|
121
|
+
type ExportStatementInput = v.InferInput<typeof ExportStatementInputSchema>;
|
|
122
|
+
/**
|
|
123
|
+
* One page of an account statement. `csv` is RFC 4180 UTF-8 text with CRLF line endings; only
|
|
124
|
+
* the first page starts with the header row, so concatenating pages in order yields the whole
|
|
125
|
+
* statement. Read columns by header name, since later releases may append columns, and keep
|
|
126
|
+
* amounts as decimal strings. An empty `nextPageToken` means no more pages.
|
|
127
|
+
*/
|
|
128
|
+
interface StatementPage {
|
|
129
|
+
csv: string;
|
|
130
|
+
nextPageToken: string;
|
|
131
|
+
}
|
|
78
132
|
declare function createBalanceHistoryResponseSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
79
133
|
readonly range: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "1d" | "7d" | "30d" | "90d" | "180d" | "365d">]>;
|
|
80
134
|
readonly bucket: v.StringSchema<undefined>;
|
|
@@ -426,5 +480,5 @@ declare function createPortfolioEquitySnapshotResponseSchema(scales: SdkScales):
|
|
|
426
480
|
}>]>;
|
|
427
481
|
type PortfolioEquitySnapshotResponse = v.InferOutput<ReturnType<typeof createPortfolioEquitySnapshotResponseSchema>>;
|
|
428
482
|
//#endregion
|
|
429
|
-
export { BalanceHistoryInput, BalanceHistoryInputSchema, BalanceHistoryResponse, BalanceRange, BalanceRangeSchema, EquityGroupBy, EquityGroupBySchema, EquityHistoryInput, EquityHistoryInputSchema, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, EquitySeriesSchema, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryInputSchema, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySeriesSchema, PortfolioEquitySnapshotResponse, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance };
|
|
483
|
+
export { BalanceHistoryInput, BalanceHistoryInputSchema, BalanceHistoryResponse, BalanceRange, BalanceRangeSchema, EquityGroupBy, EquityGroupBySchema, EquityHistoryInput, EquityHistoryInputSchema, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, EquitySeriesSchema, ExportStatementInput, ExportStatementInputSchema, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryInputSchema, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySeriesSchema, PortfolioEquitySnapshotResponse, StatementPage, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance };
|
|
430
484
|
//# sourceMappingURL=balances.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.schemas.d.ts","names":[],"sources":["../../../src/services/balances/balances.schemas.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"balances.schemas.d.ts","names":[],"sources":["../../../src/services/balances/balances.schemas.ts"],"mappings":";;;;;;;;iBAiEgB,6BAAyB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASzB,oBAAoB,GAAG,eAA+B;KAY1D,gBAAgB,EAAE,YAAY,kBAAkB;cAQ/C,oBAAkB,EAAA;KAEnB,eAAe,EAAE,mBAAmB;cASnC,qBAAmB,EAAA;KAEpB,gBAAgB,EAAE,mBAAmB;cAEpC,2BAAyB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;KAwB1B,sBAAsB,EAAE,kBAAkB;cAOzC,4BAA0B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4B3B,uBAAuB,EAAE,kBAAkB;;;;;;;UAQtC;EACb;EACA;;iBASY,sCAAkC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BtC,yBAAyB,EAAE,YACnC,kBAAkB;cAGT,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;KAwBzB,qBAAqB,EAAE,kBAAkB;cAExC,mCAAiC,EAAA;;;KAIlC,8BAA8B,EAAE,kBAAkB;KAmBlD;EAEF;EACA,aAAa,YAAY;EACzB;;EAGA;EACA;EACA;;cAGG,oBAAkB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKO,UAAA;EAA8B;;iBA2BpD,kCAAkC,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA3B7B,UAAA;IAA8B;;;;;;;;;;;IAA9B,UAAA;IAA8B;;;;;;;;;;;IAA9B,UAAA;IAA8B;;;;KAqDxD,eAAe,EAAE,mBAAmB;KACpC,wBAAwB,EAAE,YAClC,kBAAkB;KAcV;EACJ;EAA0B;EAAmB;;EAC7C;EAA0B;EAAmB;;cAExC,6BAA2B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAQF,UAAA;EAAuC;;iBAY7D,2CAA2C,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAZtC,UAAA;IAAuC;;;;;;;;;;;IAAvC,UAAA;IAAuC;;;;;;;;;;;IAAvC,UAAA;IAAuC;;;;KAqCjE,wBAAwB,EAAE,mBAAmB;KAC7C,iCAAiC,EAAE,YAC3C,kBAAkB;iBA6BN,4CAA4C,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmBjE,kCAAkC,EAAE,YAC5C,kBAAkB"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
|
|
1
2
|
import { PublicIdSchema, U128Schema } from "../../shared/schemas.js";
|
|
2
3
|
import { enumLabel, enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
3
4
|
import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
|
|
4
5
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
6
|
+
import { msToTimestamp } from "../../utils/timestamp.js";
|
|
5
7
|
import { fromU128 } from "../../utils/u128.js";
|
|
6
8
|
import { ACCOUNT_CODE_VALUES, AccountCodeCodec } from "../../shared/ledger-codes.js";
|
|
7
9
|
import { BalanceRangeCodec, EquityGroupByCodec } from "./balances.codecs.js";
|
|
@@ -83,6 +85,25 @@ const BalanceHistoryInputSchema = v.pipe(v.strictObject({
|
|
|
83
85
|
...input,
|
|
84
86
|
subaccountId: accountScopeToSubaccountId(account)
|
|
85
87
|
})));
|
|
88
|
+
/** The longest statement period the server accepts. */
|
|
89
|
+
const MAX_STATEMENT_PERIOD_MS = 316224e5;
|
|
90
|
+
const EpochMsInputSchema = v.pipe(v.number(), v.integer(), v.minValue(0));
|
|
91
|
+
const ExportStatementInputSchema = v.pipe(v.strictObject({
|
|
92
|
+
...AccountScopeInputEntries,
|
|
93
|
+
/** Period start, inclusive, in epoch milliseconds (UTC). */
|
|
94
|
+
startTime: EpochMsInputSchema,
|
|
95
|
+
/** Period end, exclusive, in epoch milliseconds (UTC); at most 366 days after `startTime`. */
|
|
96
|
+
endTime: EpochMsInputSchema,
|
|
97
|
+
/** Ledger asset ID to cover only that asset; omit or `0` for every asset. */
|
|
98
|
+
assetId: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)), 0),
|
|
99
|
+
/** Previous `nextPageToken`; reuse only with the same account, asset and period. */
|
|
100
|
+
pageToken: v.optional(v.pipe(v.string(), v.trim()), "")
|
|
101
|
+
}), v.check(({ startTime, endTime }) => endTime > startTime, "endTime must be after startTime."), v.check(({ startTime, endTime }) => endTime - startTime <= MAX_STATEMENT_PERIOD_MS, "A statement period is at most 366 days."), v.transform(({ account, startTime, endTime, ...input }) => ({
|
|
102
|
+
...input,
|
|
103
|
+
subaccountId: accountScopeToSubaccountId(account),
|
|
104
|
+
startTime: msToTimestamp(startTime),
|
|
105
|
+
endTime: msToTimestamp(endTime)
|
|
106
|
+
})));
|
|
86
107
|
const BalanceSeriesSchema = v.object({
|
|
87
108
|
assetId: v.number(),
|
|
88
109
|
accountCode: v.enum(AccountCodeCodec.inputToProto),
|
|
@@ -256,6 +277,6 @@ function createPortfolioEquitySnapshotResponseSchema(scales) {
|
|
|
256
277
|
})));
|
|
257
278
|
}
|
|
258
279
|
//#endregion
|
|
259
|
-
export { BALANCE_RANGES, BalanceHistoryInputSchema, BalanceRangeSchema, BalancesListInputSchema, EQUITY_GROUP_BYS, EquityGroupBySchema, EquityHistoryInputSchema, EquitySeriesSchema, PortfolioEquityHistoryInputSchema, PortfolioEquitySeriesSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance };
|
|
280
|
+
export { BALANCE_RANGES, BalanceHistoryInputSchema, BalanceRangeSchema, BalancesListInputSchema, EQUITY_GROUP_BYS, EquityGroupBySchema, EquityHistoryInputSchema, EquitySeriesSchema, ExportStatementInputSchema, PortfolioEquityHistoryInputSchema, PortfolioEquitySeriesSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance };
|
|
260
281
|
|
|
261
282
|
//# sourceMappingURL=balances.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.schemas.js","names":[],"sources":["../../../src/services/balances/balances.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport type * as ProtoLedgerRead from \"../../gen/ledger/read/v1/ledger_read_pb.js\";\nimport { fromU128 } from \"../../utils/u128.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport {\n AccountCodeCodec,\n ACCOUNT_CODE_VALUES,\n type AccountCodeValue,\n} from \"../../shared/ledger-codes.js\";\nimport { E18_SCALE, scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { BalanceRangeCodec, EquityGroupByCodec } from \"./balances.codecs.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { PublicIdSchema, U128Schema } from \"../../shared/schemas.js\";\n\n/**\n * Equity history values are quoted in the response's quote currency at a fixed\n * 4-decimal wire scale (proto: \"Equity in quote currency scaled by 1e4\").\n */\nconst EQUITY_SCALE = 4;\n\n/**\n * Balance history buckets use a fixed 7-decimal scale (proto: \"balance in\n * asset units scaled by 1e7\"), unlike live ledger balances which use E18.\n */\nconst BALANCE_HISTORY_SCALE = 7;\n\n/**\n * AssetBalance u128 fields on the ledger wire are always 18-decimal scaled\n * (PolyesterChain base units), independent of per-asset quantityScale used\n * elsewhere for order quantities and transfer inputs.\n */\nconst LedgerBalanceFieldsSchema = v.object({\n assetId: v.number(),\n trading: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n funding: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n reserved: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n available: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n tradingRevision: v.pipe(\n v.optional(v.bigint(), 0n),\n v.transform((value) => value.toString()),\n ),\n fundingRevision: v.pipe(\n v.optional(v.bigint(), 0n),\n v.transform((value) => value.toString()),\n ),\n});\n\nfunction toLedgerBalance(b: v.InferOutput<typeof LedgerBalanceFieldsSchema>) {\n return {\n assetId: b.assetId,\n funding: scaledToDecimalOutput(b.funding ?? 0n, E18_SCALE),\n trading: scaledToDecimalOutput(b.trading ?? 0n, E18_SCALE),\n reserved: scaledToDecimalOutput(b.reserved ?? 0n, E18_SCALE),\n available: scaledToDecimalOutput(b.available ?? 0n, E18_SCALE),\n tradingRevision: b.tradingRevision,\n fundingRevision: b.fundingRevision,\n };\n}\n\nexport function createLedgerBalanceSchema() {\n return v.pipe(LedgerBalanceFieldsSchema, v.transform(toLedgerBalance));\n}\n\n/**\n * Converts a `ledger.read.v1.AssetBalance` message to the `LedgerBalance` that `balances.list`\n * returns. Its U128 amounts are always at the 18-decimal ledger scale, whatever the asset's own\n * decimals, so the result needs no catalog.\n */\nexport function formatLedgerBalance(b: ProtoLedgerRead.AssetBalance): LedgerBalance {\n return toLedgerBalance({\n assetId: b.assetId,\n trading: fromU128(b.trading),\n funding: fromU128(b.funding),\n reserved: fromU128(b.reserved),\n available: fromU128(b.available),\n tradingRevision: (b.tradingRevision ?? 0n).toString(),\n fundingRevision: (b.fundingRevision ?? 0n).toString(),\n });\n}\n\nexport type LedgerBalance = v.InferOutput<ReturnType<typeof createLedgerBalanceSchema>>;\n\nexport const BalancesListInputSchema = v.strictObject(AccountScopeInputEntries);\n\nexport type BalancesListInput = v.InferInput<typeof BalancesListInputSchema>;\n\nexport const BALANCE_RANGES = [\"1d\", \"7d\", \"30d\", \"90d\", \"180d\", \"365d\"] as const;\n\nexport const BalanceRangeSchema = v.picklist(BALANCE_RANGES);\n\nexport type BalanceRange = v.InferOutput<typeof BalanceRangeSchema>;\n\nconst BalanceRangeInputSchema = v.pipe(\n BalanceRangeSchema,\n v.transform((value) => BalanceRangeCodec.inputToProto[value]),\n);\n\nexport const EQUITY_GROUP_BYS = [\"account\", \"asset\"] as const;\n\nexport const EquityGroupBySchema = v.picklist(EQUITY_GROUP_BYS);\n\nexport type EquityGroupBy = v.InferOutput<typeof EquityGroupBySchema>;\n\nexport const BalanceHistoryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n range: BalanceRangeInputSchema,\n ledger: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(4_294_967_295)),\n 0,\n ),\n accountCodes: v.optional(\n v.array(\n v.pipe(\n v.picklist(ACCOUNT_CODE_VALUES),\n v.transform((value) => AccountCodeCodec.inputToProto[value]),\n ),\n ),\n [],\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type BalanceHistoryInput = v.InferInput<typeof BalanceHistoryInputSchema>;\n\nconst BalanceSeriesSchema = v.object({\n assetId: v.number(),\n accountCode: v.enum(AccountCodeCodec.inputToProto),\n balanceQ: v.array(v.bigint()),\n});\n\nexport function createBalanceHistoryResponseSchema() {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n points: v.number(),\n series: v.array(BalanceSeriesSchema),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n points: data.points,\n series: data.series.map((s) => {\n return {\n assetId: s.assetId,\n accountCode: enumLabel(AccountCodeCodec.protoToOutput, s.accountCode),\n balance: s.balanceQ.map((b) => scaledToDecimalOutput(b, BALANCE_HISTORY_SCALE)),\n };\n }),\n })),\n );\n}\n\nexport type BalanceHistoryResponse = v.InferOutput<\n ReturnType<typeof createBalanceHistoryResponseSchema>\n>;\n\nexport const EquityHistoryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n range: BalanceRangeInputSchema,\n accountCodes: v.optional(\n v.array(\n v.pipe(\n v.picklist(ACCOUNT_CODE_VALUES),\n v.transform((value) => AccountCodeCodec.inputToProto[value]),\n ),\n ),\n [],\n ),\n groupBy: v.pipe(\n v.optional(EquityGroupBySchema, \"account\"),\n v.transform((v) => EquityGroupByCodec.inputToProto[v ?? \"account\"]),\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type EquityHistoryInput = v.InferInput<typeof EquityHistoryInputSchema>;\n\nexport const PortfolioEquityHistoryInputSchema = v.strictObject({\n range: BalanceRangeInputSchema,\n});\n\nexport type PortfolioEquityHistoryInput = v.InferInput<typeof PortfolioEquityHistoryInputSchema>;\n\nconst EquitySeriesGroupingSchema = v.union([\n v.object({\n case: v.literal(\"account\"),\n value: v.object({\n accountCode: v.enum(AccountCodeCodec.inputToProto),\n name: v.string(),\n }),\n }),\n v.object({\n case: v.literal(\"asset\"),\n value: v.object({\n id: v.number(),\n symbol: v.string(),\n }),\n }),\n]);\n\nexport type EquitySeriesGrouping =\n | {\n type: \"account\";\n accountCode: DecodedEnum<AccountCodeValue>;\n name: string;\n }\n | {\n type: \"asset\";\n assetId: number;\n symbol: string;\n };\n\nexport const EquitySeriesSchema = v.pipe(\n v.object({\n grouping: EquitySeriesGroupingSchema,\n equityQ: v.array(v.bigint()),\n }),\n v.transform((series): { grouping: EquitySeriesGrouping; equity: string[] } => {\n const equity = series.equityQ.map((value) => scaledToDecimalOutput(value, EQUITY_SCALE));\n if (series.grouping.case === \"account\") {\n return {\n grouping: {\n type: \"account\",\n accountCode: enumLabel(\n AccountCodeCodec.protoToOutput,\n series.grouping.value.accountCode,\n ),\n name: series.grouping.value.name,\n },\n equity,\n };\n }\n\n return {\n grouping: {\n type: \"asset\",\n assetId: series.grouping.value.id,\n symbol: series.grouping.value.symbol,\n },\n equity,\n };\n }),\n);\n\nexport function createEquityHistoryResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n quoteAsset: v.string(),\n points: v.number(),\n series: v.array(EquitySeriesSchema),\n btcPricesQ: v.optional(v.array(v.bigint()), []),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n quoteAsset: data.quoteAsset,\n points: data.points,\n series: data.series,\n // BTC price in USDT at each timestamp, carried as price ticks on the wire.\n btcPrices: data.btcPricesQ.map((value) => scaledToDecimalOutput(value, scales.price())),\n })),\n );\n}\n\nexport type EquitySeries = v.InferOutput<typeof EquitySeriesSchema>;\nexport type EquityHistoryResponse = v.InferOutput<\n ReturnType<typeof createEquityHistoryResponseSchema>\n>;\n\nconst PortfolioAccountGroupingSchema = v.variant(\"remaining\", [\n v.object({\n accountId: PublicIdSchema,\n remaining: v.literal(false),\n }),\n v.object({\n accountId: v.optional(v.never()),\n remaining: v.literal(true),\n }),\n]);\n\nexport type PortfolioEquitySeriesGrouping =\n | { type: \"portfolioAccount\"; accountId: string; remaining: false }\n | { type: \"portfolioAccount\"; accountId?: never; remaining: true };\n\nexport const PortfolioEquitySeriesSchema = v.pipe(\n v.object({\n grouping: v.object({\n case: v.literal(\"portfolioAccount\"),\n value: PortfolioAccountGroupingSchema,\n }),\n equityQ: v.array(v.bigint()),\n }),\n v.transform((series): { grouping: PortfolioEquitySeriesGrouping; equity: string[] } => ({\n grouping: series.grouping.value.remaining\n ? { type: \"portfolioAccount\", remaining: true }\n : {\n type: \"portfolioAccount\",\n accountId: series.grouping.value.accountId,\n remaining: false,\n },\n equity: series.equityQ.map((value) => scaledToDecimalOutput(value, EQUITY_SCALE)),\n })),\n);\n\nexport function createPortfolioEquityHistoryResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n quoteAsset: v.string(),\n points: v.number(),\n series: v.array(PortfolioEquitySeriesSchema),\n btcPricesQ: v.optional(v.array(v.bigint()), []),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n quoteAsset: data.quoteAsset,\n points: data.points,\n series: data.series,\n btcPrices: data.btcPricesQ.map((value) => scaledToDecimalOutput(value, scales.price())),\n })),\n );\n}\n\nexport type PortfolioEquitySeries = v.InferOutput<typeof PortfolioEquitySeriesSchema>;\nexport type PortfolioEquityHistoryResponse = v.InferOutput<\n ReturnType<typeof createPortfolioEquityHistoryResponseSchema>\n>;\n\nconst PortfolioAccountEquitySchema = v.pipe(\n v.object({\n accountId: PublicIdSchema,\n equityQ: v.bigint(),\n topAssetIds: v.array(v.number()),\n }),\n v.transform((account) => ({\n accountId: account.accountId,\n equity: scaledToDecimalOutput(account.equityQ, EQUITY_SCALE),\n topAssetIds: account.topAssetIds,\n })),\n);\n\nconst PortfolioAssetEquitySchema = v.pipe(\n v.object({\n assetId: v.number(),\n balanceQ: v.bigint(),\n equityQ: v.bigint(),\n }),\n v.transform((asset) => ({\n assetId: asset.assetId,\n balance: scaledToDecimalOutput(asset.balanceQ, BALANCE_HISTORY_SCALE),\n equity: scaledToDecimalOutput(asset.equityQ, EQUITY_SCALE),\n })),\n);\n\nexport function createPortfolioEquitySnapshotResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n quoteAsset: v.string(),\n totalEquityQ: v.bigint(),\n accounts: v.array(PortfolioAccountEquitySchema),\n assets: v.array(PortfolioAssetEquitySchema),\n btcPriceQ: v.bigint(),\n }),\n v.transform((snapshot) => ({\n quoteAsset: snapshot.quoteAsset,\n totalEquity: scaledToDecimalOutput(snapshot.totalEquityQ, EQUITY_SCALE),\n accounts: snapshot.accounts,\n assets: snapshot.assets,\n btcPrice: scaledToDecimalOutput(snapshot.btcPriceQ, scales.price()),\n })),\n );\n}\n\nexport type PortfolioEquitySnapshotResponse = v.InferOutput<\n ReturnType<typeof createPortfolioEquitySnapshotResponseSchema>\n>;\n"],"mappings":";;;;;;;;;;;;;AAsBA,MAAM,eAAe;;;;;AAMrB,MAAM,wBAAwB;;;;;;AAO9B,MAAM,4BAA4B,EAAE,OAAO;CACvC,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC7D,SAAS,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC7D,UAAU,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAA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3E,OAAO,EAAE,KACL,EAAE,OAAO;EACL,YAAY,EAAE,OAAO;EACrB,cAAc,EAAE,OAAO;EACvB,UAAU,EAAE,MAAM,4BAA4B;EAC9C,QAAQ,EAAE,MAAM,0BAA0B;EAC1C,WAAW,EAAE,OAAO;CACxB,CAAC,GACD,EAAE,WAAW,cAAc;EACvB,YAAY,SAAS;EACrB,aAAa,sBAAsB,SAAS,cAAc,YAAY;EACtE,UAAU,SAAS;EACnB,QAAQ,SAAS;EACjB,UAAU,sBAAsB,SAAS,WAAW,OAAO,MAAM,CAAC;CACtE,EAAE,CACN;AACJ"}
|
|
1
|
+
{"version":3,"file":"balances.schemas.js","names":[],"sources":["../../../src/services/balances/balances.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport type * as ProtoLedgerRead from \"../../gen/ledger/read/v1/ledger_read_pb.js\";\nimport { fromU128 } from \"../../utils/u128.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport {\n AccountCodeCodec,\n ACCOUNT_CODE_VALUES,\n type AccountCodeValue,\n} from \"../../shared/ledger-codes.js\";\nimport { E18_SCALE, scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { BalanceRangeCodec, EquityGroupByCodec } from \"./balances.codecs.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { PublicIdSchema, U128Schema } from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\n\n/**\n * Equity history values are quoted in the response's quote currency at a fixed\n * 4-decimal wire scale (proto: \"Equity in quote currency scaled by 1e4\").\n */\nconst EQUITY_SCALE = 4;\n\n/**\n * Balance history buckets use a fixed 7-decimal scale (proto: \"balance in\n * asset units scaled by 1e7\"), unlike live ledger balances which use E18.\n */\nconst BALANCE_HISTORY_SCALE = 7;\n\n/**\n * AssetBalance u128 fields on the ledger wire are always 18-decimal scaled\n * (PolyesterChain base units), independent of per-asset quantityScale used\n * elsewhere for order quantities and transfer inputs.\n */\nconst LedgerBalanceFieldsSchema = v.object({\n assetId: v.number(),\n trading: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n funding: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n reserved: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n available: v.pipe(v.optional(U128Schema), v.transform(fromU128)),\n tradingRevision: v.pipe(\n v.optional(v.bigint(), 0n),\n v.transform((value) => value.toString()),\n ),\n fundingRevision: v.pipe(\n v.optional(v.bigint(), 0n),\n v.transform((value) => value.toString()),\n ),\n});\n\nfunction toLedgerBalance(b: v.InferOutput<typeof LedgerBalanceFieldsSchema>) {\n return {\n assetId: b.assetId,\n funding: scaledToDecimalOutput(b.funding ?? 0n, E18_SCALE),\n trading: scaledToDecimalOutput(b.trading ?? 0n, E18_SCALE),\n reserved: scaledToDecimalOutput(b.reserved ?? 0n, E18_SCALE),\n available: scaledToDecimalOutput(b.available ?? 0n, E18_SCALE),\n tradingRevision: b.tradingRevision,\n fundingRevision: b.fundingRevision,\n };\n}\n\nexport function createLedgerBalanceSchema() {\n return v.pipe(LedgerBalanceFieldsSchema, v.transform(toLedgerBalance));\n}\n\n/**\n * Converts a `ledger.read.v1.AssetBalance` message to the `LedgerBalance` that `balances.list`\n * returns. Its U128 amounts are always at the 18-decimal ledger scale, whatever the asset's own\n * decimals, so the result needs no catalog.\n */\nexport function formatLedgerBalance(b: ProtoLedgerRead.AssetBalance): LedgerBalance {\n return toLedgerBalance({\n assetId: b.assetId,\n trading: fromU128(b.trading),\n funding: fromU128(b.funding),\n reserved: fromU128(b.reserved),\n available: fromU128(b.available),\n tradingRevision: (b.tradingRevision ?? 0n).toString(),\n fundingRevision: (b.fundingRevision ?? 0n).toString(),\n });\n}\n\nexport type LedgerBalance = v.InferOutput<ReturnType<typeof createLedgerBalanceSchema>>;\n\nexport const BalancesListInputSchema = v.strictObject(AccountScopeInputEntries);\n\nexport type BalancesListInput = v.InferInput<typeof BalancesListInputSchema>;\n\nexport const BALANCE_RANGES = [\"1d\", \"7d\", \"30d\", \"90d\", \"180d\", \"365d\"] as const;\n\nexport const BalanceRangeSchema = v.picklist(BALANCE_RANGES);\n\nexport type BalanceRange = v.InferOutput<typeof BalanceRangeSchema>;\n\nconst BalanceRangeInputSchema = v.pipe(\n BalanceRangeSchema,\n v.transform((value) => BalanceRangeCodec.inputToProto[value]),\n);\n\nexport const EQUITY_GROUP_BYS = [\"account\", \"asset\"] as const;\n\nexport const EquityGroupBySchema = v.picklist(EQUITY_GROUP_BYS);\n\nexport type EquityGroupBy = v.InferOutput<typeof EquityGroupBySchema>;\n\nexport const BalanceHistoryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n range: BalanceRangeInputSchema,\n ledger: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(4_294_967_295)),\n 0,\n ),\n accountCodes: v.optional(\n v.array(\n v.pipe(\n v.picklist(ACCOUNT_CODE_VALUES),\n v.transform((value) => AccountCodeCodec.inputToProto[value]),\n ),\n ),\n [],\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type BalanceHistoryInput = v.InferInput<typeof BalanceHistoryInputSchema>;\n\n/** The longest statement period the server accepts. */\nconst MAX_STATEMENT_PERIOD_MS = 366 * 24 * 60 * 60 * 1000;\n\nconst EpochMsInputSchema = v.pipe(v.number(), v.integer(), v.minValue(0));\n\nexport const ExportStatementInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** Period start, inclusive, in epoch milliseconds (UTC). */\n startTime: EpochMsInputSchema,\n /** Period end, exclusive, in epoch milliseconds (UTC); at most 366 days after `startTime`. */\n endTime: EpochMsInputSchema,\n /** Ledger asset ID to cover only that asset; omit or `0` for every asset. */\n assetId: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n 0,\n ),\n /** Previous `nextPageToken`; reuse only with the same account, asset and period. */\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.check(({ startTime, endTime }) => endTime > startTime, \"endTime must be after startTime.\"),\n v.check(\n ({ startTime, endTime }) => endTime - startTime <= MAX_STATEMENT_PERIOD_MS,\n \"A statement period is at most 366 days.\",\n ),\n v.transform(({ account, startTime, endTime, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n startTime: msToTimestamp(startTime),\n endTime: msToTimestamp(endTime),\n })),\n);\n\nexport type ExportStatementInput = v.InferInput<typeof ExportStatementInputSchema>;\n\n/**\n * One page of an account statement. `csv` is RFC 4180 UTF-8 text with CRLF line endings; only\n * the first page starts with the header row, so concatenating pages in order yields the whole\n * statement. Read columns by header name, since later releases may append columns, and keep\n * amounts as decimal strings. An empty `nextPageToken` means no more pages.\n */\nexport interface StatementPage {\n csv: string;\n nextPageToken: string;\n}\n\nconst BalanceSeriesSchema = v.object({\n assetId: v.number(),\n accountCode: v.enum(AccountCodeCodec.inputToProto),\n balanceQ: v.array(v.bigint()),\n});\n\nexport function createBalanceHistoryResponseSchema() {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n points: v.number(),\n series: v.array(BalanceSeriesSchema),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n points: data.points,\n series: data.series.map((s) => {\n return {\n assetId: s.assetId,\n accountCode: enumLabel(AccountCodeCodec.protoToOutput, s.accountCode),\n balance: s.balanceQ.map((b) => scaledToDecimalOutput(b, BALANCE_HISTORY_SCALE)),\n };\n }),\n })),\n );\n}\n\nexport type BalanceHistoryResponse = v.InferOutput<\n ReturnType<typeof createBalanceHistoryResponseSchema>\n>;\n\nexport const EquityHistoryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n range: BalanceRangeInputSchema,\n accountCodes: v.optional(\n v.array(\n v.pipe(\n v.picklist(ACCOUNT_CODE_VALUES),\n v.transform((value) => AccountCodeCodec.inputToProto[value]),\n ),\n ),\n [],\n ),\n groupBy: v.pipe(\n v.optional(EquityGroupBySchema, \"account\"),\n v.transform((v) => EquityGroupByCodec.inputToProto[v ?? \"account\"]),\n ),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type EquityHistoryInput = v.InferInput<typeof EquityHistoryInputSchema>;\n\nexport const PortfolioEquityHistoryInputSchema = v.strictObject({\n range: BalanceRangeInputSchema,\n});\n\nexport type PortfolioEquityHistoryInput = v.InferInput<typeof PortfolioEquityHistoryInputSchema>;\n\nconst EquitySeriesGroupingSchema = v.union([\n v.object({\n case: v.literal(\"account\"),\n value: v.object({\n accountCode: v.enum(AccountCodeCodec.inputToProto),\n name: v.string(),\n }),\n }),\n v.object({\n case: v.literal(\"asset\"),\n value: v.object({\n id: v.number(),\n symbol: v.string(),\n }),\n }),\n]);\n\nexport type EquitySeriesGrouping =\n | {\n type: \"account\";\n accountCode: DecodedEnum<AccountCodeValue>;\n name: string;\n }\n | {\n type: \"asset\";\n assetId: number;\n symbol: string;\n };\n\nexport const EquitySeriesSchema = v.pipe(\n v.object({\n grouping: EquitySeriesGroupingSchema,\n equityQ: v.array(v.bigint()),\n }),\n v.transform((series): { grouping: EquitySeriesGrouping; equity: string[] } => {\n const equity = series.equityQ.map((value) => scaledToDecimalOutput(value, EQUITY_SCALE));\n if (series.grouping.case === \"account\") {\n return {\n grouping: {\n type: \"account\",\n accountCode: enumLabel(\n AccountCodeCodec.protoToOutput,\n series.grouping.value.accountCode,\n ),\n name: series.grouping.value.name,\n },\n equity,\n };\n }\n\n return {\n grouping: {\n type: \"asset\",\n assetId: series.grouping.value.id,\n symbol: series.grouping.value.symbol,\n },\n equity,\n };\n }),\n);\n\nexport function createEquityHistoryResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n quoteAsset: v.string(),\n points: v.number(),\n series: v.array(EquitySeriesSchema),\n btcPricesQ: v.optional(v.array(v.bigint()), []),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n quoteAsset: data.quoteAsset,\n points: data.points,\n series: data.series,\n // BTC price in USDT at each timestamp, carried as price ticks on the wire.\n btcPrices: data.btcPricesQ.map((value) => scaledToDecimalOutput(value, scales.price())),\n })),\n );\n}\n\nexport type EquitySeries = v.InferOutput<typeof EquitySeriesSchema>;\nexport type EquityHistoryResponse = v.InferOutput<\n ReturnType<typeof createEquityHistoryResponseSchema>\n>;\n\nconst PortfolioAccountGroupingSchema = v.variant(\"remaining\", [\n v.object({\n accountId: PublicIdSchema,\n remaining: v.literal(false),\n }),\n v.object({\n accountId: v.optional(v.never()),\n remaining: v.literal(true),\n }),\n]);\n\nexport type PortfolioEquitySeriesGrouping =\n | { type: \"portfolioAccount\"; accountId: string; remaining: false }\n | { type: \"portfolioAccount\"; accountId?: never; remaining: true };\n\nexport const PortfolioEquitySeriesSchema = v.pipe(\n v.object({\n grouping: v.object({\n case: v.literal(\"portfolioAccount\"),\n value: PortfolioAccountGroupingSchema,\n }),\n equityQ: v.array(v.bigint()),\n }),\n v.transform((series): { grouping: PortfolioEquitySeriesGrouping; equity: string[] } => ({\n grouping: series.grouping.value.remaining\n ? { type: \"portfolioAccount\", remaining: true }\n : {\n type: \"portfolioAccount\",\n accountId: series.grouping.value.accountId,\n remaining: false,\n },\n equity: series.equityQ.map((value) => scaledToDecimalOutput(value, EQUITY_SCALE)),\n })),\n);\n\nexport function createPortfolioEquityHistoryResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n range: enumLabelSchema(BalanceRangeCodec.protoToOutput),\n bucket: v.string(),\n startTsSec: v.number(),\n endTsSec: v.number(),\n quoteAsset: v.string(),\n points: v.number(),\n series: v.array(PortfolioEquitySeriesSchema),\n btcPricesQ: v.optional(v.array(v.bigint()), []),\n }),\n v.transform((data) => ({\n range: data.range,\n bucket: data.bucket,\n startTsSec: data.startTsSec,\n endTsSec: data.endTsSec,\n quoteAsset: data.quoteAsset,\n points: data.points,\n series: data.series,\n btcPrices: data.btcPricesQ.map((value) => scaledToDecimalOutput(value, scales.price())),\n })),\n );\n}\n\nexport type PortfolioEquitySeries = v.InferOutput<typeof PortfolioEquitySeriesSchema>;\nexport type PortfolioEquityHistoryResponse = v.InferOutput<\n ReturnType<typeof createPortfolioEquityHistoryResponseSchema>\n>;\n\nconst PortfolioAccountEquitySchema = v.pipe(\n v.object({\n accountId: PublicIdSchema,\n equityQ: v.bigint(),\n topAssetIds: v.array(v.number()),\n }),\n v.transform((account) => ({\n accountId: account.accountId,\n equity: scaledToDecimalOutput(account.equityQ, EQUITY_SCALE),\n topAssetIds: account.topAssetIds,\n })),\n);\n\nconst PortfolioAssetEquitySchema = v.pipe(\n v.object({\n assetId: v.number(),\n balanceQ: v.bigint(),\n equityQ: v.bigint(),\n }),\n v.transform((asset) => ({\n assetId: asset.assetId,\n balance: scaledToDecimalOutput(asset.balanceQ, BALANCE_HISTORY_SCALE),\n equity: scaledToDecimalOutput(asset.equityQ, EQUITY_SCALE),\n })),\n);\n\nexport function createPortfolioEquitySnapshotResponseSchema(scales: SdkScales) {\n return v.pipe(\n v.object({\n quoteAsset: v.string(),\n totalEquityQ: v.bigint(),\n accounts: v.array(PortfolioAccountEquitySchema),\n assets: v.array(PortfolioAssetEquitySchema),\n btcPriceQ: v.bigint(),\n }),\n v.transform((snapshot) => ({\n quoteAsset: snapshot.quoteAsset,\n totalEquity: scaledToDecimalOutput(snapshot.totalEquityQ, EQUITY_SCALE),\n accounts: snapshot.accounts,\n assets: snapshot.assets,\n btcPrice: scaledToDecimalOutput(snapshot.btcPriceQ, scales.price()),\n })),\n );\n}\n\nexport type PortfolioEquitySnapshotResponse = v.InferOutput<\n ReturnType<typeof createPortfolioEquitySnapshotResponseSchema>\n>;\n"],"mappings":";;;;;;;;;;;;;;;AAwBA,MAAM,eAAe;;;;;AAMrB,MAAM,wBAAwB;;;;;;AAO9B,MAAM,4BAA4B,EAAE,OAAO;CACvC,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC7D,SAAS,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC7D,UAAU,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC9D,WAAW,EAAE,KAAK,EAAE,SAAS,UAAU,GAAG,EAAE,UAAU,QAAQ,CAAC;CAC/D,iBAAiB,EAAE,KACf,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE,GACzB,EAAE,WAAW,UAAU,MAAM,SAAS,CAAC,CAC3C;CACA,iBAAiB,EAAE,KACf,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE,GACzB,EAAE,WAAW,UAAU,MAAM,SAAS,CAAC,CAC3C;AACJ,CAAC;AAED,SAAS,gBAAgB,GAAoD;CACzE,OAAO;EACH,SAAS,EAAE;EACX,SAAS,sBAAsB,EAAE,WAAW,IAAA,EAAa;EACzD,SAAS,sBAAsB,EAAE,WAAW,IAAA,EAAa;EACzD,UAAU,sBAAsB,EAAE,YAAY,IAAA,EAAa;EAC3D,WAAW,sBAAsB,EAAE,aAAa,IAAA,EAAa;EAC7D,iBAAiB,EAAE;EACnB,iBAAiB,EAAE;CACvB;AACJ;AAEA,SAAgB,4BAA4B;CACxC,OAAO,EAAE,KAAK,2BAA2B,EAAE,UAAU,eAAe,CAAC;AACzE;;;;;;AAOA,SAAg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AE,KACL,EAAE,OAAO;EACL,YAAY,EAAE,OAAO;EACrB,cAAc,EAAE,OAAO;EACvB,UAAU,EAAE,MAAM,4BAA4B;EAC9C,QAAQ,EAAE,MAAM,0BAA0B;EAC1C,WAAW,EAAE,OAAO;CACxB,CAAC,GACD,EAAE,WAAW,cAAc;EACvB,YAAY,SAAS;EACrB,aAAa,sBAAsB,SAAS,cAAc,YAAY;EACtE,UAAU,SAAS;EACnB,QAAQ,SAAS;EACjB,UAAU,sBAAsB,SAAS,WAAW,OAAO,MAAM,CAAC;CACtE,EAAE,CACN;AACJ"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse } from "./balances.schemas.js";
|
|
2
|
-
export type { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse };
|
|
1
|
+
import { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, ExportStatementInput, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse, StatementPage } from "./balances.schemas.js";
|
|
2
|
+
export type { BalanceHistoryInput, BalanceHistoryResponse, BalanceRange, EquityGroupBy, EquityHistoryInput, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, ExportStatementInput, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySnapshotResponse, StatementPage };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { CandlePointSchema, MarketDataService } from "../../gen/marketdata/v1/marketdata_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
4
|
import { SymbolIdInputSchema } from "../shared.js";
|
|
4
|
-
import { CandlePointSchema, MarketDataService } from "../../gen/marketdata/v1/marketdata_pb.js";
|
|
5
5
|
import { TimeframeCodec } from "./candles.codecs.js";
|
|
6
6
|
import { ListCandlesInputSchema, TimeframeSchema, createCandleColumnarIntSchema, createCandleColumnarSchema, formatCandleRow } from "./candles.schemas.js";
|
|
7
7
|
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
8
|
-
import { createClient } from "@connectrpc/connect";
|
|
9
8
|
import * as v from "valibot";
|
|
9
|
+
import { createClient } from "@connectrpc/connect";
|
|
10
10
|
//#region src/services/candles/candles.ts
|
|
11
11
|
const SubscribeCandlesParamsSchema = v.object({
|
|
12
12
|
symbolId: SymbolIdInputSchema,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ChainAnalyticsService as ChainAnalyticsService$1 } from "../../gen/chain/analytics/v1/analytics_read_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { ChainAnalyticsService as ChainAnalyticsService$1 } from "../../gen/chain/analytics/v1/analytics_read_pb.js";
|
|
4
4
|
import { GetUnifiedAssetBalancesInputSchema, GetZippedAssetSupplyGroupInputSchema, GetZippedAssetSupplyInputSchema, createUnifiedAssetBalancesResponseSchema, createZippedAssetSupplyGroupResponseSchema, createZippedAssetSupplyResponseSchema } from "./chain-analytics.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/chain-analytics/chain-analytics.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ChangelogService as ChangelogService$1 } from "../../gen/changelog/v1/changelog_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { ChangelogService as ChangelogService$1 } from "../../gen/changelog/v1/changelog_pb.js";
|
|
4
4
|
import { GetChangelogDeploymentGroupInputSchema, GetChangelogDeploymentGroupResultSchema, GetChangelogPostInputSchema, GetChangelogPostResultSchema, ListChangelogChangesInputSchema, ListChangelogChangesResultSchema, ListChangelogDeploymentGroupsInputSchema, ListChangelogDeploymentGroupsResultSchema, ListChangelogPostsInputSchema, ListChangelogPostsResultSchema } from "./changelog.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/changelog/changelog.ts
|