@polyester/sdk 0.36.0-devnet-20261115165158 → 0.36.0-devnet-20261116002603
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 +38 -4
- package/dist/browser-core.js +1 -1
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +83 -5
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.js +67 -11
- package/dist/gen/ai/v1/assistant_pb.js.map +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 +5 -5
- package/dist/gen/auth/v1/api_keys_pb.js +4 -4
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +27 -2
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +18 -1
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.d.ts +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +19 -2
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +18 -1
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +8 -12
- package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/profile_pb.js +1 -1
- package/dist/gen/auth/v1/profile_pb.js.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.d.ts +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +45 -11
- package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +18 -2
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +16 -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 +229 -39
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js +34 -10
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +13 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.js +13 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +7 -4
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +11 -2
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +10 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/reason_pb.d.ts +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +11 -7
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js +2 -2
- package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts +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 +3 -1
- package/dist/gen/index.js +23 -21
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +58 -17
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +32 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
- package/dist/gen/ledger/read/v1/statement_export_pb.d.ts +424 -0
- package/dist/gen/ledger/read/v1/statement_export_pb.d.ts.map +1 -0
- package/dist/gen/ledger/read/v1/statement_export_pb.js +154 -0
- package/dist/gen/ledger/read/v1/statement_export_pb.js.map +1 -0
- package/dist/gen/marketdata/v1/asset_info_pb.d.ts +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +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 +29 -5
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +1 -1
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +3 -2
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +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 +13 -8
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts.map +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.js.map +1 -1
- package/dist/gen/rewards/v1/rewards_pb.d.ts +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +23 -11
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +4 -2
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +48 -12
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +35 -6
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +1 -1
- package/dist/gen/swap/v1/swap_pb.d.ts +1 -1
- package/dist/gen/system/v1/system_pb.d.ts +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +1 -1
- package/dist/gen/transfer/v1/dust_conversion_pb.d.ts +741 -0
- package/dist/gen/transfer/v1/dust_conversion_pb.d.ts.map +1 -0
- package/dist/gen/transfer/v1/dust_conversion_pb.js +235 -0
- package/dist/gen/transfer/v1/dust_conversion_pb.js.map +1 -0
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +368 -4
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js +166 -4
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +11 -6
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +4 -2
- 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 +13 -7
- 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.js +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +1 -1
- package/dist/services/assistant/assistant-events.schemas.d.ts +29 -29
- package/dist/services/assistant/assistant.codecs.d.ts +7 -1
- package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
- package/dist/services/assistant/assistant.codecs.js +5 -1
- package/dist/services/assistant/assistant.codecs.js.map +1 -1
- package/dist/services/assistant/assistant.d.ts +4 -3
- package/dist/services/assistant/assistant.d.ts.map +1 -1
- package/dist/services/assistant/assistant.js +7 -5
- package/dist/services/assistant/assistant.js.map +1 -1
- package/dist/services/assistant/assistant.schemas.d.ts +40 -3
- package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant.schemas.js +19 -5
- package/dist/services/assistant/assistant.schemas.js.map +1 -1
- package/dist/services/assistant/assistant.types.d.ts +3 -3
- package/dist/services/auth/account-signer-auth.js +2 -2
- package/dist/services/auth/auth.js +1 -1
- package/dist/services/auth/profile/profile.d.ts +1 -1
- package/dist/services/auth/profile/profile.js +3 -3
- package/dist/services/auth/profile/profile.js.map +1 -1
- package/dist/services/auth/profile/profile.schemas.d.ts +0 -1
- package/dist/services/auth/profile/profile.schemas.d.ts.map +1 -1
- package/dist/services/auth/profile/profile.schemas.js +0 -1
- package/dist/services/auth/profile/profile.schemas.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +3 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.js +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +22 -22
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -1
- package/dist/services/balances/balances.d.ts +4 -3
- package/dist/services/balances/balances.d.ts.map +1 -1
- package/dist/services/balances/balances.js +13 -5
- package/dist/services/balances/balances.js.map +1 -1
- package/dist/services/balances/balances.schemas.d.ts +30 -5
- package/dist/services/balances/balances.schemas.d.ts.map +1 -1
- package/dist/services/balances/balances.schemas.js +5 -9
- 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/candles/candles.schemas.d.ts +10 -10
- package/dist/services/chain-analytics/chain-analytics.js +1 -1
- package/dist/services/changelog/changelog.js +1 -1
- package/dist/services/changelog/changelog.schemas.d.ts +22 -22
- package/dist/services/checkpoints/checkpoints.js +1 -1
- package/dist/services/claims/claims.js +1 -1
- package/dist/services/claims/claims.schemas.d.ts +2 -2
- package/dist/services/claims/claims.schemas.js +1 -1
- package/dist/services/deposit/deposit.js +1 -1
- package/dist/services/dust-conversion/dust-conversion.codecs.d.ts +22 -0
- package/dist/services/dust-conversion/dust-conversion.codecs.d.ts.map +1 -0
- package/dist/services/dust-conversion/dust-conversion.codecs.js +22 -0
- package/dist/services/dust-conversion/dust-conversion.codecs.js.map +1 -0
- package/dist/services/dust-conversion/dust-conversion.d.ts +59 -0
- package/dist/services/dust-conversion/dust-conversion.d.ts.map +1 -0
- package/dist/services/dust-conversion/dust-conversion.js +87 -0
- package/dist/services/dust-conversion/dust-conversion.js.map +1 -0
- package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +561 -0
- package/dist/services/dust-conversion/dust-conversion.schemas.d.ts.map +1 -0
- package/dist/services/dust-conversion/dust-conversion.schemas.js +190 -0
- package/dist/services/dust-conversion/dust-conversion.schemas.js.map +1 -0
- package/dist/services/dust-conversion/dust-conversion.types.d.ts +3 -0
- package/dist/services/dust-conversion/service.d.ts +8 -0
- package/dist/services/dust-conversion/service.d.ts.map +1 -0
- package/dist/services/dust-conversion/service.js +9 -0
- package/dist/services/dust-conversion/service.js.map +1 -0
- 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.codecs.d.ts +13 -1
- package/dist/services/internal-transfers/internal-transfers.codecs.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.codecs.js +22 -2
- package/dist/services/internal-transfers/internal-transfers.codecs.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.d.ts +14 -2
- package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.js +30 -4
- package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +265 -5
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js +62 -4
- package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.types.d.ts +3 -3
- package/dist/services/lifecycle/lifecycle.codecs.d.ts +1 -1
- package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.codecs.js +1 -0
- package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.d.ts +26 -8
- package/dist/services/lifecycle/lifecycle.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.js +42 -10
- package/dist/services/lifecycle/lifecycle.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +108 -84
- package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.js +45 -46
- package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.types.d.ts +2 -2
- package/dist/services/lifecycle/service.js +1 -1
- package/dist/services/lifecycle/service.js.map +1 -1
- package/dist/services/market-data/market-data.js +3 -3
- 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/orderbook/orderbook.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.js +3 -2
- package/dist/services/orderbook/orderbook.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +10 -0
- package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.js +4 -1
- package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +11 -1
- package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
- package/dist/services/orders/order-errors.schemas.js +12 -2
- package/dist/services/orders/order-errors.schemas.js.map +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +67 -27
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +2 -2
- package/dist/services/orders/orders-identifiers.schemas.js +2 -1
- package/dist/services/orders/orders-identifiers.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +11 -4
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +3 -2
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-modify.schemas.js +2 -2
- package/dist/services/orders/orders-output.schemas.d.ts +14 -14
- 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 +10 -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/price-alerts/price-alerts.schemas.d.ts +10 -10
- package/dist/services/rate-limits/rate-limits.d.ts +4 -1
- package/dist/services/rate-limits/rate-limits.d.ts.map +1 -1
- package/dist/services/rate-limits/rate-limits.js +5 -2
- package/dist/services/rate-limits/rate-limits.js.map +1 -1
- package/dist/services/rate-limits/rate-limits.schemas.d.ts +1 -0
- package/dist/services/rate-limits/rate-limits.schemas.d.ts.map +1 -1
- package/dist/services/rate-limits/rate-limits.schemas.js +1 -0
- package/dist/services/rate-limits/rate-limits.schemas.js.map +1 -1
- package/dist/services/rewards/rewards.js +1 -1
- package/dist/services/social-verification/social-verification.codecs.js +6 -2
- package/dist/services/social-verification/social-verification.codecs.js.map +1 -1
- package/dist/services/social-verification/social-verification.d.ts +14 -3
- package/dist/services/social-verification/social-verification.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.js +15 -4
- package/dist/services/social-verification/social-verification.js.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.d.ts +13 -3
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +13 -5
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/statement-exports/service.d.ts +8 -0
- package/dist/services/statement-exports/service.d.ts.map +1 -0
- package/dist/services/statement-exports/service.js +9 -0
- package/dist/services/statement-exports/service.js.map +1 -0
- package/dist/services/statement-exports/statement-exports.codecs.d.ts +17 -0
- package/dist/services/statement-exports/statement-exports.codecs.d.ts.map +1 -0
- package/dist/services/statement-exports/statement-exports.codecs.js +19 -0
- package/dist/services/statement-exports/statement-exports.codecs.js.map +1 -0
- package/dist/services/statement-exports/statement-exports.d.ts +34 -0
- package/dist/services/statement-exports/statement-exports.d.ts.map +1 -0
- package/dist/services/statement-exports/statement-exports.js +53 -0
- package/dist/services/statement-exports/statement-exports.js.map +1 -0
- package/dist/services/statement-exports/statement-exports.schemas.d.ts +269 -0
- package/dist/services/statement-exports/statement-exports.schemas.d.ts.map +1 -0
- package/dist/services/statement-exports/statement-exports.schemas.js +98 -0
- package/dist/services/statement-exports/statement-exports.schemas.js.map +1 -0
- package/dist/services/statement-exports/statement-exports.types.d.ts +3 -0
- package/dist/services/subaccounts/subaccounts.codecs.js +3 -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 +13 -13
- package/dist/services/system/system.js +1 -1
- package/dist/services/system/system.schemas.d.ts +7 -7
- package/dist/services/trades/trades.js +2 -2
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- 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 +5 -4
- package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +4 -4
- package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +33 -23
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +2 -2
- package/dist/services/vip/vip.js +1 -1
- 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.map +1 -1
- package/dist/services/zipper/zipper.schemas.js +11 -1
- package/dist/services/zipper/zipper.schemas.js.map +1 -1
- package/dist/shared/account-scope.js +4 -1
- package/dist/shared/account-scope.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +3 -0
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +5 -0
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.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 +8 -3
- package/dist/shared/error-details/auth.js.map +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.js +1 -1
- package/dist/utils/cookies.js +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +21 -17
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.schemas.js","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../../shared/wire-bounds.js\";\nimport { tsObjToMs } from \"../../../utils/time.js\";\n\nexport const ProfileSchema = v.object({\n username: v.string(),\n bio: v.string(),\n website: v.string(),\n twitter: v.string(),\n twitterVerified: v.optional(v.boolean(), false),\n discord: v.string(),\n discordVerified: v.optional(v.boolean(), false),\n avatarUrl: v.string(),\n createdAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n nextUsernameChangeAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n vipTier: v.number(),\n usernameUnlocked: v.optional(v.boolean(), false),\n currentTermsAccepted: v.optional(v.boolean(), false),\n});\n\nexport type Profile = v.InferOutput<typeof ProfileSchema>;\n// Deliberately non-strict: update() accepts a round-tripped Profile\n// ({ ...profile, bio }) and strips its readonly fields instead of rejecting.\nexport const UpdateProfileInputSchema = v.object({\n username: v.optional(v.string()),\n bio: v.optional(v.string()),\n website: v.optional(v.string()),\n
|
|
1
|
+
{"version":3,"file":"profile.schemas.js","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../../shared/wire-bounds.js\";\nimport { tsObjToMs } from \"../../../utils/time.js\";\n\nexport const ProfileSchema = v.object({\n username: v.string(),\n bio: v.string(),\n website: v.string(),\n twitter: v.string(),\n twitterVerified: v.optional(v.boolean(), false),\n discord: v.string(),\n discordVerified: v.optional(v.boolean(), false),\n avatarUrl: v.string(),\n createdAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n nextUsernameChangeAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n vipTier: v.number(),\n usernameUnlocked: v.optional(v.boolean(), false),\n currentTermsAccepted: v.optional(v.boolean(), false),\n});\n\nexport type Profile = v.InferOutput<typeof ProfileSchema>;\n// Deliberately non-strict: update() accepts a round-tripped Profile\n// ({ ...profile, bio }) and strips its readonly fields instead of rejecting. `twitter` is\n// readonly too: only X verification sets it.\nexport const UpdateProfileInputSchema = v.object({\n username: v.optional(v.string()),\n bio: v.optional(v.string()),\n website: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n});\nexport type UpdateProfileInput = v.InferInput<typeof UpdateProfileInputSchema>;\n\nexport const UsernameHistoryEntrySchema = v.object({\n username: v.string(),\n setAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n});\n\nexport type UsernameHistoryEntry = v.InferOutput<typeof UsernameHistoryEntrySchema>;\n\nexport const GeneratedUsernameOfferSchema = v.object({\n usernames: v.array(v.string()),\n offerToken: v.pipe(v.string(), v.minLength(1)),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type GeneratedUsernameOffer = v.InferOutput<typeof GeneratedUsernameOfferSchema>;\n\nexport const ClaimGeneratedUsernameInputSchema = v.strictObject({\n offerToken: v.pipe(v.string(), v.minLength(1)),\n optionIndex: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n});\n\nexport type ClaimGeneratedUsernameInput = v.InferInput<typeof ClaimGeneratedUsernameInputSchema>;\n\nexport const AccountIdentitySchema = v.object({\n accountId: PublicIdSchema,\n username: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n rootSmartAccountAddress: v.string(),\n});\n\nexport type AccountIdentity = v.InferOutput<typeof AccountIdentitySchema>;\n"],"mappings":";;;;;AASA,MAAa,gBAAgB,EAAE,OAAO;CAClC,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,OAAO;CACd,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,KACT,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,sBAAsB,EAAE,KACpB,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,SAAS,EAAE,OAAO;CAClB,kBAAkB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC/C,sBAAsB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AACvD,CAAC;AAMD,MAAa,2BAA2B,EAAE,OAAO;CAC7C,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;CAC1B,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;CAC9B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;AACpC,CAAC;AAGD,MAAa,6BAA6B,EAAE,OAAO;CAC/C,UAAU,EAAE,OAAO;CACnB,OAAO,EAAE,KACL,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;AACJ,CAAC;AAID,MAAa,+BAA+B,EAAE,OAAO;CACjD,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;CAC7B,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,CAAC;CAC7C,WAAW;AACf,CAAC;AAID,MAAa,oCAAoC,EAAE,aAAa;CAC5D,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,CAAC;CAC7C,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,mBAAmB,CAAC;AAC/F,CAAC;AAID,MAAa,wBAAwB,EAAE,OAAO;CAC1C,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,yBAAyB,EAAE,OAAO;AACtC,CAAC"}
|
|
@@ -15,7 +15,9 @@ type AutoWithdrawPauseReason = "destination_not_whitelisted" | "destination_inva
|
|
|
15
15
|
/** Why a run was skipped. Unknown future reasons pass through as strings. */
|
|
16
16
|
type AutoWithdrawRunReason = "nothing_to_pay" | "price_unavailable" | "rule_superseded" | (string & {});
|
|
17
17
|
/** Why a step was skipped or failed. Unknown future reasons pass through as strings. */
|
|
18
|
-
type AutoWithdrawStepReason = "below_minimum" | "price_unavailable" | "rule_superseded" | "destination_not_whitelisted" | "destination_cooling_down" |
|
|
18
|
+
type AutoWithdrawStepReason = "below_minimum" | "price_unavailable" | "rule_superseded" | "destination_not_whitelisted" | "destination_cooling_down" |
|
|
19
|
+
/** Withdrawals of the asset to the destination network are suspended; the funds stay for a later run. */
|
|
20
|
+
"route_suspended" | "authority_revoked" | "gateway_capacity_insufficient" | "withdrawal_released" | "withdrawal_failed" | (string & {});
|
|
19
21
|
/**
|
|
20
22
|
* Why part or all of an asset's balance would stay on the account in a previewed run. Unknown
|
|
21
23
|
* future reasons pass through as strings.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-withdraw.codecs.d.ts","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.codecs.ts"],"mappings":";;cAGa;KAOD,8BAA8B;cAE7B;KASD,8BAA8B;cAE7B;KAQD,+BAA+B;cAE9B;KAQD,gCAAgC;cAE/B;KAOD,oCAAoC;;KAsEpC;;KAOA;;KAOA
|
|
1
|
+
{"version":3,"file":"auto-withdraw.codecs.d.ts","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.codecs.ts"],"mappings":";;cAGa;KAOD,8BAA8B;cAE7B;KASD,8BAA8B;cAE7B;KAQD,+BAA+B;cAE9B;KAQD,gCAAgC;cAE/B;KAOD,oCAAoC;;KAsEpC;;KAOA;;KAOA;;;;;;;KAkBA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-withdraw.codecs.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const AUTO_WITHDRAW_CADENCE_VALUES = [\n \"hourly\",\n \"daily\",\n \"weekly\",\n \"biweekly\",\n \"monthly\",\n] as const;\nexport type AutoWithdrawCadence = (typeof AUTO_WITHDRAW_CADENCE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_WEEKDAY_VALUES = [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\",\n \"saturday\",\n \"sunday\",\n] as const;\nexport type AutoWithdrawWeekday = (typeof AUTO_WITHDRAW_WEEKDAY_VALUES)[number];\n\nexport const AUTO_WITHDRAW_RUN_STATE_VALUES = [\n \"planned\",\n \"paying\",\n \"completed\",\n \"partially_failed\",\n \"failed\",\n \"skipped\",\n] as const;\nexport type AutoWithdrawRunState = (typeof AUTO_WITHDRAW_RUN_STATE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_STEP_STATE_VALUES = [\n \"pending\",\n \"submitting\",\n \"submitted\",\n \"completed\",\n \"failed\",\n \"skipped\",\n] as const;\nexport type AutoWithdrawStepState = (typeof AUTO_WITHDRAW_STEP_STATE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_PREVIEW_STATUS_VALUES = [\n \"will_pay\",\n \"rolls_over\",\n \"no_destination\",\n \"paused\",\n \"no_rule\",\n] as const;\nexport type AutoWithdrawPreviewStatus = (typeof AUTO_WITHDRAW_PREVIEW_STATUS_VALUES)[number];\n\nexport const AutoWithdrawCadenceCodec = {\n inputToProto: {\n hourly: Proto.AutoWithdrawCadence.HOURLY,\n daily: Proto.AutoWithdrawCadence.DAILY,\n weekly: Proto.AutoWithdrawCadence.WEEKLY,\n biweekly: Proto.AutoWithdrawCadence.BIWEEKLY,\n monthly: Proto.AutoWithdrawCadence.MONTHLY,\n } satisfies InputToProto<AutoWithdrawCadence, Proto.AutoWithdrawCadence>,\n} as const;\n\nexport const AutoWithdrawWeekdayCodec = {\n inputToProto: {\n monday: Proto.AutoWithdrawWeekday.MONDAY,\n tuesday: Proto.AutoWithdrawWeekday.TUESDAY,\n wednesday: Proto.AutoWithdrawWeekday.WEDNESDAY,\n thursday: Proto.AutoWithdrawWeekday.THURSDAY,\n friday: Proto.AutoWithdrawWeekday.FRIDAY,\n saturday: Proto.AutoWithdrawWeekday.SATURDAY,\n sunday: Proto.AutoWithdrawWeekday.SUNDAY,\n } satisfies InputToProto<AutoWithdrawWeekday, Proto.AutoWithdrawWeekday>,\n protoToOutput: {\n [Proto.AutoWithdrawWeekday.WEEKDAY_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawWeekday.MONDAY]: \"monday\",\n [Proto.AutoWithdrawWeekday.TUESDAY]: \"tuesday\",\n [Proto.AutoWithdrawWeekday.WEDNESDAY]: \"wednesday\",\n [Proto.AutoWithdrawWeekday.THURSDAY]: \"thursday\",\n [Proto.AutoWithdrawWeekday.FRIDAY]: \"friday\",\n [Proto.AutoWithdrawWeekday.SATURDAY]: \"saturday\",\n [Proto.AutoWithdrawWeekday.SUNDAY]: \"sunday\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawWeekday, AutoWithdrawWeekday>,\n} as const;\n\nexport const AutoWithdrawRunStateCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawRunState.RUN_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawRunState.RUN_PLANNED]: \"planned\",\n [Proto.AutoWithdrawRunState.RUN_PAYING]: \"paying\",\n [Proto.AutoWithdrawRunState.RUN_COMPLETED]: \"completed\",\n [Proto.AutoWithdrawRunState.RUN_PARTIALLY_FAILED]: \"partially_failed\",\n [Proto.AutoWithdrawRunState.RUN_FAILED]: \"failed\",\n [Proto.AutoWithdrawRunState.RUN_SKIPPED]: \"skipped\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawRunState, AutoWithdrawRunState>,\n} as const;\n\nexport const AutoWithdrawStepStateCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawStepState.STEP_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawStepState.STEP_PENDING]: \"pending\",\n [Proto.AutoWithdrawStepState.STEP_SUBMITTING]: \"submitting\",\n [Proto.AutoWithdrawStepState.STEP_SUBMITTED]: \"submitted\",\n [Proto.AutoWithdrawStepState.STEP_COMPLETED]: \"completed\",\n [Proto.AutoWithdrawStepState.STEP_FAILED]: \"failed\",\n [Proto.AutoWithdrawStepState.STEP_SKIPPED]: \"skipped\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawStepState, AutoWithdrawStepState>,\n} as const;\n\nexport const AutoWithdrawPreviewStatusCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawPreviewStatus.PREVIEW_STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawPreviewStatus.WILL_PAY]: \"will_pay\",\n [Proto.AutoWithdrawPreviewStatus.ROLLS_OVER]: \"rolls_over\",\n [Proto.AutoWithdrawPreviewStatus.NO_DESTINATION]: \"no_destination\",\n [Proto.AutoWithdrawPreviewStatus.PAUSED]: \"paused\",\n [Proto.AutoWithdrawPreviewStatus.NO_RULE]: \"no_rule\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawPreviewStatus, AutoWithdrawPreviewStatus>,\n} as const;\n\n/** Why a rule paused itself. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawPauseReason =\n | \"destination_not_whitelisted\"\n | \"destination_invalid\"\n | \"authority_revoked\"\n | (string & {});\n\n/** Why a run was skipped. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawRunReason =\n | \"nothing_to_pay\"\n | \"price_unavailable\"\n | \"rule_superseded\"\n | (string & {});\n\n/** Why a step was skipped or failed. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawStepReason =\n | \"below_minimum\"\n | \"price_unavailable\"\n | \"rule_superseded\"\n | \"destination_not_whitelisted\"\n | \"destination_cooling_down\"\n | \"authority_revoked\"\n | \"gateway_capacity_insufficient\"\n | \"withdrawal_released\"\n | \"withdrawal_failed\"\n | (string & {});\n\n/**\n * Why part or all of an asset's balance would stay on the account in a previewed run. Unknown\n * future reasons pass through as strings.\n */\nexport type AutoWithdrawHoldReason =\n | \"below_minimum\"\n | \"price_unavailable\"\n | \"no_destination\"\n | \"destination_cooling_down\"\n | \"above_max\"\n | \"dust\"\n | (string & {});\n"],"mappings":";;AAYA,MAAa,+BAA+B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAgCA,MAAa,2BAA2B,EACpC,cAAc;CACV,QAAA;CACA,OAAA;CACA,QAAA;CACA,UAAA;CACA,SAAA;AACJ,EACJ;AAEA,MAAa,2BAA2B;CACpC,cAAc;EACV,QAAA;EACA,SAAA;EACA,WAAA;EACA,UAAA;EACA,QAAA;EACA,UAAA;EACA,QAAA;CACJ;CACA,eAAe;GACsC,IAAA;GACb,IAAA;GACC,IAAA;GACE,IAAA;GACD,IAAA;GACF,IAAA;GACE,IAAA;GACF,IAAA;CACxC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EACyC,IAAA;EACV,IAAA;EACD,IAAA;EACG,IAAA;EACO,IAAA;EACV,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,6BAA6B,EACtC,eAAe;EAC2C,IAAA;EACV,IAAA;EACG,IAAA;EACD,IAAA;EACA,IAAA;EACH,IAAA;EACC,IAAA;AAChD,EACJ;AAEA,MAAa,iCAAiC,EAC1C,eAAe;EACmD,IAAA;EAClB,IAAA;EACE,IAAA;EACI,IAAA;EACR,IAAA;EACC,IAAA;AAC/C,EACJ"}
|
|
1
|
+
{"version":3,"file":"auto-withdraw.codecs.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const AUTO_WITHDRAW_CADENCE_VALUES = [\n \"hourly\",\n \"daily\",\n \"weekly\",\n \"biweekly\",\n \"monthly\",\n] as const;\nexport type AutoWithdrawCadence = (typeof AUTO_WITHDRAW_CADENCE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_WEEKDAY_VALUES = [\n \"monday\",\n \"tuesday\",\n \"wednesday\",\n \"thursday\",\n \"friday\",\n \"saturday\",\n \"sunday\",\n] as const;\nexport type AutoWithdrawWeekday = (typeof AUTO_WITHDRAW_WEEKDAY_VALUES)[number];\n\nexport const AUTO_WITHDRAW_RUN_STATE_VALUES = [\n \"planned\",\n \"paying\",\n \"completed\",\n \"partially_failed\",\n \"failed\",\n \"skipped\",\n] as const;\nexport type AutoWithdrawRunState = (typeof AUTO_WITHDRAW_RUN_STATE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_STEP_STATE_VALUES = [\n \"pending\",\n \"submitting\",\n \"submitted\",\n \"completed\",\n \"failed\",\n \"skipped\",\n] as const;\nexport type AutoWithdrawStepState = (typeof AUTO_WITHDRAW_STEP_STATE_VALUES)[number];\n\nexport const AUTO_WITHDRAW_PREVIEW_STATUS_VALUES = [\n \"will_pay\",\n \"rolls_over\",\n \"no_destination\",\n \"paused\",\n \"no_rule\",\n] as const;\nexport type AutoWithdrawPreviewStatus = (typeof AUTO_WITHDRAW_PREVIEW_STATUS_VALUES)[number];\n\nexport const AutoWithdrawCadenceCodec = {\n inputToProto: {\n hourly: Proto.AutoWithdrawCadence.HOURLY,\n daily: Proto.AutoWithdrawCadence.DAILY,\n weekly: Proto.AutoWithdrawCadence.WEEKLY,\n biweekly: Proto.AutoWithdrawCadence.BIWEEKLY,\n monthly: Proto.AutoWithdrawCadence.MONTHLY,\n } satisfies InputToProto<AutoWithdrawCadence, Proto.AutoWithdrawCadence>,\n} as const;\n\nexport const AutoWithdrawWeekdayCodec = {\n inputToProto: {\n monday: Proto.AutoWithdrawWeekday.MONDAY,\n tuesday: Proto.AutoWithdrawWeekday.TUESDAY,\n wednesday: Proto.AutoWithdrawWeekday.WEDNESDAY,\n thursday: Proto.AutoWithdrawWeekday.THURSDAY,\n friday: Proto.AutoWithdrawWeekday.FRIDAY,\n saturday: Proto.AutoWithdrawWeekday.SATURDAY,\n sunday: Proto.AutoWithdrawWeekday.SUNDAY,\n } satisfies InputToProto<AutoWithdrawWeekday, Proto.AutoWithdrawWeekday>,\n protoToOutput: {\n [Proto.AutoWithdrawWeekday.WEEKDAY_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawWeekday.MONDAY]: \"monday\",\n [Proto.AutoWithdrawWeekday.TUESDAY]: \"tuesday\",\n [Proto.AutoWithdrawWeekday.WEDNESDAY]: \"wednesday\",\n [Proto.AutoWithdrawWeekday.THURSDAY]: \"thursday\",\n [Proto.AutoWithdrawWeekday.FRIDAY]: \"friday\",\n [Proto.AutoWithdrawWeekday.SATURDAY]: \"saturday\",\n [Proto.AutoWithdrawWeekday.SUNDAY]: \"sunday\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawWeekday, AutoWithdrawWeekday>,\n} as const;\n\nexport const AutoWithdrawRunStateCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawRunState.RUN_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawRunState.RUN_PLANNED]: \"planned\",\n [Proto.AutoWithdrawRunState.RUN_PAYING]: \"paying\",\n [Proto.AutoWithdrawRunState.RUN_COMPLETED]: \"completed\",\n [Proto.AutoWithdrawRunState.RUN_PARTIALLY_FAILED]: \"partially_failed\",\n [Proto.AutoWithdrawRunState.RUN_FAILED]: \"failed\",\n [Proto.AutoWithdrawRunState.RUN_SKIPPED]: \"skipped\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawRunState, AutoWithdrawRunState>,\n} as const;\n\nexport const AutoWithdrawStepStateCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawStepState.STEP_STATE_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawStepState.STEP_PENDING]: \"pending\",\n [Proto.AutoWithdrawStepState.STEP_SUBMITTING]: \"submitting\",\n [Proto.AutoWithdrawStepState.STEP_SUBMITTED]: \"submitted\",\n [Proto.AutoWithdrawStepState.STEP_COMPLETED]: \"completed\",\n [Proto.AutoWithdrawStepState.STEP_FAILED]: \"failed\",\n [Proto.AutoWithdrawStepState.STEP_SKIPPED]: \"skipped\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawStepState, AutoWithdrawStepState>,\n} as const;\n\nexport const AutoWithdrawPreviewStatusCodec = {\n protoToOutput: {\n [Proto.AutoWithdrawPreviewStatus.PREVIEW_STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.AutoWithdrawPreviewStatus.WILL_PAY]: \"will_pay\",\n [Proto.AutoWithdrawPreviewStatus.ROLLS_OVER]: \"rolls_over\",\n [Proto.AutoWithdrawPreviewStatus.NO_DESTINATION]: \"no_destination\",\n [Proto.AutoWithdrawPreviewStatus.PAUSED]: \"paused\",\n [Proto.AutoWithdrawPreviewStatus.NO_RULE]: \"no_rule\",\n } satisfies ProtoToOutput<Proto.AutoWithdrawPreviewStatus, AutoWithdrawPreviewStatus>,\n} as const;\n\n/** Why a rule paused itself. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawPauseReason =\n | \"destination_not_whitelisted\"\n | \"destination_invalid\"\n | \"authority_revoked\"\n | (string & {});\n\n/** Why a run was skipped. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawRunReason =\n | \"nothing_to_pay\"\n | \"price_unavailable\"\n | \"rule_superseded\"\n | (string & {});\n\n/** Why a step was skipped or failed. Unknown future reasons pass through as strings. */\nexport type AutoWithdrawStepReason =\n | \"below_minimum\"\n | \"price_unavailable\"\n | \"rule_superseded\"\n | \"destination_not_whitelisted\"\n | \"destination_cooling_down\"\n /** Withdrawals of the asset to the destination network are suspended; the funds stay for a later run. */\n | \"route_suspended\"\n | \"authority_revoked\"\n | \"gateway_capacity_insufficient\"\n | \"withdrawal_released\"\n | \"withdrawal_failed\"\n | (string & {});\n\n/**\n * Why part or all of an asset's balance would stay on the account in a previewed run. Unknown\n * future reasons pass through as strings.\n */\nexport type AutoWithdrawHoldReason =\n | \"below_minimum\"\n | \"price_unavailable\"\n | \"no_destination\"\n | \"destination_cooling_down\"\n | \"above_max\"\n | \"dust\"\n | (string & {});\n"],"mappings":";;AAYA,MAAa,+BAA+B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAgCA,MAAa,2BAA2B,EACpC,cAAc;CACV,QAAA;CACA,OAAA;CACA,QAAA;CACA,UAAA;CACA,SAAA;AACJ,EACJ;AAEA,MAAa,2BAA2B;CACpC,cAAc;EACV,QAAA;EACA,SAAA;EACA,WAAA;EACA,UAAA;EACA,QAAA;EACA,UAAA;EACA,QAAA;CACJ;CACA,eAAe;GACsC,IAAA;GACb,IAAA;GACC,IAAA;GACE,IAAA;GACD,IAAA;GACF,IAAA;GACE,IAAA;GACF,IAAA;CACxC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EACyC,IAAA;EACV,IAAA;EACD,IAAA;EACG,IAAA;EACO,IAAA;EACV,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,6BAA6B,EACtC,eAAe;EAC2C,IAAA;EACV,IAAA;EACG,IAAA;EACD,IAAA;EACA,IAAA;EACH,IAAA;EACC,IAAA;AAChD,EACJ;AAEA,MAAa,iCAAiC,EAC1C,eAAe;EACmD,IAAA;EAClB,IAAA;EACE,IAAA;EACI,IAAA;EACR,IAAA;EACC,IAAA;AAC/C,EACJ"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AutoWithdrawService as AutoWithdrawService$1 } from "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
2
1
|
import { PolyesterError, RevisionConflictError } from "../../shared/errors.js";
|
|
3
2
|
import { toPolyesterError } from "../../shared/connect-error-mapping.js";
|
|
4
3
|
import { parse } from "../../shared/validation.js";
|
|
5
4
|
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
6
5
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
7
6
|
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
|
|
@@ -500,7 +500,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
500
500
|
readonly hi: v.BigintSchema<undefined>;
|
|
501
501
|
readonly lo: v.BigintSchema<undefined>;
|
|
502
502
|
}, undefined>, undefined>;
|
|
503
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "
|
|
503
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting">]>;
|
|
504
504
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
505
505
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
506
506
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -524,7 +524,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
524
524
|
hi: bigint;
|
|
525
525
|
lo: bigint;
|
|
526
526
|
} | undefined;
|
|
527
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
527
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
528
528
|
reason: AutoWithdrawStepReason | null;
|
|
529
529
|
intentId: string;
|
|
530
530
|
txHash: string;
|
|
@@ -538,7 +538,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
538
538
|
txHash: string | null;
|
|
539
539
|
assetId: number;
|
|
540
540
|
destinationAddress: string;
|
|
541
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
541
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
542
542
|
reason: AutoWithdrawStepReason | null;
|
|
543
543
|
}>]>;
|
|
544
544
|
/**
|
|
@@ -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>;
|
|
@@ -581,7 +581,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
581
581
|
readonly hi: v.BigintSchema<undefined>;
|
|
582
582
|
readonly lo: v.BigintSchema<undefined>;
|
|
583
583
|
}, undefined>, undefined>;
|
|
584
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "
|
|
584
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting">]>;
|
|
585
585
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
586
586
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
587
587
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -605,7 +605,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
605
605
|
hi: bigint;
|
|
606
606
|
lo: bigint;
|
|
607
607
|
} | undefined;
|
|
608
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
608
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
609
609
|
reason: AutoWithdrawStepReason | null;
|
|
610
610
|
intentId: string;
|
|
611
611
|
txHash: string;
|
|
@@ -619,7 +619,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
619
619
|
txHash: string | null;
|
|
620
620
|
assetId: number;
|
|
621
621
|
destinationAddress: string;
|
|
622
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
622
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
623
623
|
reason: AutoWithdrawStepReason | null;
|
|
624
624
|
}>]>, undefined>;
|
|
625
625
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -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;
|
|
@@ -652,7 +652,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
652
652
|
txHash: string | null;
|
|
653
653
|
assetId: number;
|
|
654
654
|
destinationAddress: string;
|
|
655
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
655
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
656
656
|
reason: AutoWithdrawStepReason | null;
|
|
657
657
|
}[];
|
|
658
658
|
createdAt: 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;
|
|
@@ -674,7 +674,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
674
674
|
txHash: string | null;
|
|
675
675
|
assetId: number;
|
|
676
676
|
destinationAddress: string;
|
|
677
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
677
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
678
678
|
reason: AutoWithdrawStepReason | null;
|
|
679
679
|
}[];
|
|
680
680
|
createdAt: 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>;
|
|
@@ -714,7 +714,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
714
714
|
readonly hi: v.BigintSchema<undefined>;
|
|
715
715
|
readonly lo: v.BigintSchema<undefined>;
|
|
716
716
|
}, undefined>, undefined>;
|
|
717
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "
|
|
717
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting">]>;
|
|
718
718
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
719
719
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
720
720
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -738,7 +738,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
738
738
|
hi: bigint;
|
|
739
739
|
lo: bigint;
|
|
740
740
|
} | undefined;
|
|
741
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
741
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
742
742
|
reason: AutoWithdrawStepReason | null;
|
|
743
743
|
intentId: string;
|
|
744
744
|
txHash: string;
|
|
@@ -752,7 +752,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
752
752
|
txHash: string | null;
|
|
753
753
|
assetId: number;
|
|
754
754
|
destinationAddress: string;
|
|
755
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
755
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
756
756
|
reason: AutoWithdrawStepReason | null;
|
|
757
757
|
}>]>, undefined>;
|
|
758
758
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -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;
|
|
@@ -785,7 +785,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
785
785
|
txHash: string | null;
|
|
786
786
|
assetId: number;
|
|
787
787
|
destinationAddress: string;
|
|
788
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
788
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
789
789
|
reason: AutoWithdrawStepReason | null;
|
|
790
790
|
}[];
|
|
791
791
|
createdAt: 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;
|
|
@@ -807,7 +807,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
807
807
|
txHash: string | null;
|
|
808
808
|
assetId: number;
|
|
809
809
|
destinationAddress: string;
|
|
810
|
-
state: "unspecified" | "failed" | "completed" | "
|
|
810
|
+
state: "unspecified" | "failed" | "completed" | "submitted" | "pending" | "skipped" | "submitting";
|
|
811
811
|
reason: AutoWithdrawStepReason | null;
|
|
812
812
|
}[];
|
|
813
813
|
createdAt: number;
|
|
@@ -923,7 +923,7 @@ declare const AutoWithdrawPreviewAssetSchema: v.SchemaWithPipe<readonly [v.Objec
|
|
|
923
923
|
*/
|
|
924
924
|
type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;
|
|
925
925
|
declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
926
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
926
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule">]>;
|
|
927
927
|
readonly nextRunAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
928
928
|
readonly seconds: v.BigintSchema<undefined>;
|
|
929
929
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -1052,7 +1052,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
1052
1052
|
nanos: number;
|
|
1053
1053
|
}, number>]>;
|
|
1054
1054
|
}, undefined>, v.TransformAction<{
|
|
1055
|
-
status: "unspecified" | "
|
|
1055
|
+
status: "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule";
|
|
1056
1056
|
nextRunAt?: number | undefined;
|
|
1057
1057
|
ruleVersion: number;
|
|
1058
1058
|
pause?: {
|
|
@@ -1088,7 +1088,7 @@ declare const AutoWithdrawPreviewSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
1088
1088
|
pausedAt: number;
|
|
1089
1089
|
} | null;
|
|
1090
1090
|
minUsdValue: string | null;
|
|
1091
|
-
status: "unspecified" | "
|
|
1091
|
+
status: "unspecified" | "paused" | "will_pay" | "rolls_over" | "no_destination" | "no_rule";
|
|
1092
1092
|
ruleVersion: number;
|
|
1093
1093
|
assets: {
|
|
1094
1094
|
assetId: number;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
2
1
|
import { ValidationError } from "../../shared/errors.js";
|
|
3
2
|
import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
|
|
4
3
|
import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdOrEmptySchema, TimestampMsSchema, U128Schema } from "../../shared/schemas.js";
|
|
@@ -7,6 +6,7 @@ import { decimalInputToScaled, scaledToDecimalOutput } from "../../shared/decima
|
|
|
7
6
|
import { PositiveUint32InputSchema } from "../shared.js";
|
|
8
7
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
9
8
|
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, ExportStatementInput, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySnapshotResponse, StatementPage } from "./balances.schemas.js";
|
|
9
|
+
import { BalanceHistoryInput, BalanceHistoryResponse, EquityHistoryInput, EquityHistoryResponse, ExportStatementInput, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryResponse, PortfolioEquitySnapshotResponse, Statement, 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;
|
|
@@ -45,9 +45,10 @@ declare class BalancesService {
|
|
|
45
45
|
exportStatement(input: ExportStatementInput, options?: PolyesterRequestOptions): Promise<StatementPage>;
|
|
46
46
|
/**
|
|
47
47
|
* Follows `nextPageToken` from the first page and returns the whole statement CSV, header
|
|
48
|
-
* row first
|
|
48
|
+
* row first, with `completeThrough`; when it is before `endTime` the statement is partial.
|
|
49
|
+
* The account is resolved once, so every page reads the same account.
|
|
49
50
|
*/
|
|
50
|
-
exportStatementCsv(input: Omit<ExportStatementInput, "pageToken">, options?: PolyesterRequestOptions): Promise<
|
|
51
|
+
exportStatementCsv(input: Omit<ExportStatementInput, "pageToken">, options?: PolyesterRequestOptions): Promise<Statement>;
|
|
51
52
|
/**
|
|
52
53
|
* 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.
|
|
53
54
|
*/
|
|
@@ -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":";;;;;;;;;;UAuCU,+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;;;;;;EAeL,mBACF,OAAO,KAAK,oCACZ,UAAU,0BACX,QAAQ;;;;EAkBX,UAAU,OAAO"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
|
|
2
1
|
import { parse } from "../../shared/validation.js";
|
|
3
2
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
+
import { tsObjToMs } from "../../utils/time.js";
|
|
4
|
+
import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
|
|
4
5
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
5
6
|
import { accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
6
7
|
import { BalanceHistoryInputSchema, BalancesListInputSchema, EquityHistoryInputSchema, ExportStatementInputSchema, PortfolioEquityHistoryInputSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance } from "./balances.schemas.js";
|
|
@@ -83,15 +84,17 @@ var BalancesService = class {
|
|
|
83
84
|
async exportStatement(input, options) {
|
|
84
85
|
const resolved = resolveAccountScopedInput(input, this.#resolver);
|
|
85
86
|
const request = parse(ExportStatementInputSchema, resolved);
|
|
86
|
-
const { csv, nextPageToken } = await this.#client.exportStatement(request, toConnectCallOptions(options));
|
|
87
|
+
const { csv, nextPageToken, completeThrough } = await this.#client.exportStatement(request, toConnectCallOptions(options));
|
|
87
88
|
return {
|
|
88
89
|
csv,
|
|
89
|
-
nextPageToken
|
|
90
|
+
nextPageToken,
|
|
91
|
+
completeThrough: tsObjToMs(completeThrough)
|
|
90
92
|
};
|
|
91
93
|
}
|
|
92
94
|
/**
|
|
93
95
|
* Follows `nextPageToken` from the first page and returns the whole statement CSV, header
|
|
94
|
-
* row first
|
|
96
|
+
* row first, with `completeThrough`; when it is before `endTime` the statement is partial.
|
|
97
|
+
* The account is resolved once, so every page reads the same account.
|
|
95
98
|
*/
|
|
96
99
|
async exportStatementCsv(input, options) {
|
|
97
100
|
const resolved = resolveAccountScopedInput(input, this.#resolver);
|
|
@@ -101,15 +104,20 @@ var BalancesService = class {
|
|
|
101
104
|
};
|
|
102
105
|
let csv = "";
|
|
103
106
|
let pageToken = "";
|
|
107
|
+
let completeThrough;
|
|
104
108
|
do {
|
|
105
109
|
const page = await this.exportStatement({
|
|
106
110
|
...pinned,
|
|
107
111
|
pageToken
|
|
108
112
|
}, options);
|
|
109
113
|
csv += page.csv;
|
|
114
|
+
completeThrough = page.completeThrough;
|
|
110
115
|
pageToken = page.nextPageToken;
|
|
111
116
|
} while (pageToken);
|
|
112
|
-
return
|
|
117
|
+
return {
|
|
118
|
+
csv,
|
|
119
|
+
completeThrough
|
|
120
|
+
};
|
|
113
121
|
}
|
|
114
122
|
/**
|
|
115
123
|
* 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.
|
|
@@ -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 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;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;;;;;;CAOA,MAAM,gBACF,OACA,SACsB;EACtB,MAAM,WAAW,0BAA0B,OAAO,KAAKL,SAAS;EAChE,MAAM,UAAU,MAAM,4BAA4B,QAAQ;EAC1D,MAAM,EAAE,KAAK,kBAAkB,MAAM,KAAKH,QAAQ,gBAC9C,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO;GAAE;GAAK;EAAc;CAChC;;;;;CAMA,MAAM,mBACF,OACA,SACe;EACf,MAAM,WAAW,0BAA0B,OAAO,KAAKG,SAAS;EAChE,MAAM,SAAS;GAAE,GAAG;GAAU,SAAS,SAAS,WAAY;EAAiB;EAC7E,IAAI,MAAM;EACV,IAAI,YAAY;EAChB,GAAG;GACC,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"}
|
|
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 { tsObjToMs } from \"../../utils/time.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 Statement,\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, completeThrough } = await this.#client.exportStatement(\n request,\n toConnectCallOptions(options),\n );\n return { csv, nextPageToken, completeThrough: tsObjToMs(completeThrough) };\n }\n\n /**\n * Follows `nextPageToken` from the first page and returns the whole statement CSV, header\n * row first, with `completeThrough`; when it is before `endTime` the statement is partial.\n * 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<Statement> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const pinned = { ...resolved, account: resolved.account ?? (\"main\" as const) };\n let csv = \"\";\n let pageToken = \"\";\n let completeThrough: number | undefined;\n do {\n const page = await this.exportStatement({ ...pinned, pageToken }, options);\n csv += page.csv;\n completeThrough = page.completeThrough;\n pageToken = page.nextPageToken;\n } while (pageToken);\n return { csv, completeThrough };\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":"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"}
|
|
@@ -128,6 +128,18 @@ type ExportStatementInput = v.InferInput<typeof ExportStatementInputSchema>;
|
|
|
128
128
|
interface StatementPage {
|
|
129
129
|
csv: string;
|
|
130
130
|
nextPageToken: string;
|
|
131
|
+
/**
|
|
132
|
+
* The statement covers movements up to this time (epoch ms, exclusive): the earliest of
|
|
133
|
+
* `endTime`, the first page's request time and the time account history is complete
|
|
134
|
+
* through. Every page carries the same value. Before `endTime`, the statement is partial:
|
|
135
|
+
* the rest appears in a statement requested later.
|
|
136
|
+
*/
|
|
137
|
+
completeThrough: number | undefined;
|
|
138
|
+
}
|
|
139
|
+
/** A whole account statement: every page's CSV and the time it is complete through. */
|
|
140
|
+
interface Statement {
|
|
141
|
+
csv: string;
|
|
142
|
+
completeThrough: number | undefined;
|
|
131
143
|
}
|
|
132
144
|
declare function createBalanceHistoryResponseSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
133
145
|
readonly range: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "1d" | "7d" | "30d" | "90d" | "180d" | "365d">]>;
|
|
@@ -138,7 +150,11 @@ declare function createBalanceHistoryResponseSchema(): v.SchemaWithPipe<readonly
|
|
|
138
150
|
readonly series: v.ArraySchema<v.ObjectSchema<{
|
|
139
151
|
readonly assetId: v.NumberSchema<undefined>;
|
|
140
152
|
readonly accountCode: v.NumberSchema<undefined>;
|
|
141
|
-
|
|
153
|
+
/** One exact 18-decimal U128 balance per point, like live ledger balances. */
|
|
154
|
+
readonly balance: v.ArraySchema<v.ObjectSchema<{
|
|
155
|
+
readonly hi: v.BigintSchema<undefined>;
|
|
156
|
+
readonly lo: v.BigintSchema<undefined>;
|
|
157
|
+
}, undefined>, undefined>;
|
|
142
158
|
}, undefined>, undefined>;
|
|
143
159
|
}, undefined>, v.TransformAction<{
|
|
144
160
|
range: "unspecified" | "1d" | "7d" | "30d" | "90d" | "180d" | "365d";
|
|
@@ -149,7 +165,10 @@ declare function createBalanceHistoryResponseSchema(): v.SchemaWithPipe<readonly
|
|
|
149
165
|
series: {
|
|
150
166
|
assetId: number;
|
|
151
167
|
accountCode: number;
|
|
152
|
-
|
|
168
|
+
balance: {
|
|
169
|
+
hi: bigint;
|
|
170
|
+
lo: bigint;
|
|
171
|
+
}[];
|
|
153
172
|
}[];
|
|
154
173
|
}, {
|
|
155
174
|
range: "unspecified" | "1d" | "7d" | "30d" | "90d" | "180d" | "365d";
|
|
@@ -419,11 +438,17 @@ declare function createPortfolioEquitySnapshotResponseSchema(scales: SdkScales):
|
|
|
419
438
|
}>]>, undefined>;
|
|
420
439
|
readonly assets: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
421
440
|
readonly assetId: v.NumberSchema<undefined>;
|
|
422
|
-
readonly
|
|
441
|
+
readonly balance: v.OptionalSchema<v.ObjectSchema<{
|
|
442
|
+
readonly hi: v.BigintSchema<undefined>;
|
|
443
|
+
readonly lo: v.BigintSchema<undefined>;
|
|
444
|
+
}, undefined>, undefined>;
|
|
423
445
|
readonly equityQ: v.BigintSchema<undefined>;
|
|
424
446
|
}, undefined>, v.TransformAction<{
|
|
425
447
|
assetId: number;
|
|
426
|
-
|
|
448
|
+
balance?: {
|
|
449
|
+
hi: bigint;
|
|
450
|
+
lo: bigint;
|
|
451
|
+
} | undefined;
|
|
427
452
|
equityQ: bigint;
|
|
428
453
|
}, {
|
|
429
454
|
assetId: number;
|
|
@@ -462,5 +487,5 @@ declare function createPortfolioEquitySnapshotResponseSchema(scales: SdkScales):
|
|
|
462
487
|
}>]>;
|
|
463
488
|
type PortfolioEquitySnapshotResponse = v.InferOutput<ReturnType<typeof createPortfolioEquitySnapshotResponseSchema>>;
|
|
464
489
|
//#endregion
|
|
465
|
-
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 };
|
|
490
|
+
export { BalanceHistoryInput, BalanceHistoryInputSchema, BalanceHistoryResponse, BalanceRange, BalanceRangeSchema, EquityGroupBy, EquityGroupBySchema, EquityHistoryInput, EquityHistoryInputSchema, EquityHistoryResponse, EquitySeries, EquitySeriesGrouping, EquitySeriesSchema, ExportStatementInput, ExportStatementInputSchema, LedgerBalance, PortfolioEquityHistoryInput, PortfolioEquityHistoryInputSchema, PortfolioEquityHistoryResponse, PortfolioEquitySeries, PortfolioEquitySeriesGrouping, PortfolioEquitySeriesSchema, PortfolioEquitySnapshotResponse, Statement, StatementPage, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema, formatLedgerBalance };
|
|
466
491
|
//# 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":";;;;;;;;iBA2DgB,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;;;;;;;EAOA;;;UAIa;EACb;EACA;;iBAUY,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"}
|
|
@@ -15,11 +15,6 @@ import * as v from "valibot";
|
|
|
15
15
|
*/
|
|
16
16
|
const EQUITY_SCALE = 4;
|
|
17
17
|
/**
|
|
18
|
-
* Balance history buckets use a fixed 7-decimal scale (proto: "balance in
|
|
19
|
-
* asset units scaled by 1e7"), unlike live ledger balances which use E18.
|
|
20
|
-
*/
|
|
21
|
-
const BALANCE_HISTORY_SCALE = 7;
|
|
22
|
-
/**
|
|
23
18
|
* AssetBalance u128 fields on the ledger wire are always 18-decimal scaled
|
|
24
19
|
* (PolyesterChain base units), independent of per-asset quantityScale used
|
|
25
20
|
* elsewhere for order quantities and transfer inputs.
|
|
@@ -107,7 +102,8 @@ const ExportStatementInputSchema = v.pipe(v.strictObject({
|
|
|
107
102
|
const BalanceSeriesSchema = v.object({
|
|
108
103
|
assetId: v.number(),
|
|
109
104
|
accountCode: v.number(),
|
|
110
|
-
|
|
105
|
+
/** One exact 18-decimal U128 balance per point, like live ledger balances. */
|
|
106
|
+
balance: v.array(U128Schema)
|
|
111
107
|
});
|
|
112
108
|
function createBalanceHistoryResponseSchema() {
|
|
113
109
|
return v.pipe(v.object({
|
|
@@ -127,7 +123,7 @@ function createBalanceHistoryResponseSchema() {
|
|
|
127
123
|
return {
|
|
128
124
|
assetId: s.assetId,
|
|
129
125
|
accountCode: enumLabel(AccountCodeCodec.protoToOutput, s.accountCode),
|
|
130
|
-
balance: s.
|
|
126
|
+
balance: s.balance.map((b) => scaledToDecimalOutput(fromU128(b), 18))
|
|
131
127
|
};
|
|
132
128
|
})
|
|
133
129
|
})));
|
|
@@ -254,11 +250,11 @@ const PortfolioAccountEquitySchema = v.pipe(v.object({
|
|
|
254
250
|
})));
|
|
255
251
|
const PortfolioAssetEquitySchema = v.pipe(v.object({
|
|
256
252
|
assetId: v.number(),
|
|
257
|
-
|
|
253
|
+
balance: v.optional(U128Schema),
|
|
258
254
|
equityQ: v.bigint()
|
|
259
255
|
}), v.transform((asset) => ({
|
|
260
256
|
assetId: asset.assetId,
|
|
261
|
-
balance: scaledToDecimalOutput(asset.
|
|
257
|
+
balance: scaledToDecimalOutput(fromU128(asset.balance), 18),
|
|
262
258
|
equity: scaledToDecimalOutput(asset.equityQ, EQUITY_SCALE)
|
|
263
259
|
})));
|
|
264
260
|
function createPortfolioEquitySnapshotResponseSchema(scales) {
|