@polyester/sdk 0.36.0-devnet-20261117035807 → 0.36.0-devnet-20261118141710
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 +66 -8
- package/dist/catalogs/index.d.ts +2 -2
- package/dist/catalogs/snapshot-validation.js +10 -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/catalogs/zipper-supply.d.ts +2 -0
- package/dist/catalogs/zipper-supply.d.ts.map +1 -1
- package/dist/catalogs/zipper-supply.js +7 -5
- package/dist/catalogs/zipper-supply.js.map +1 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +679 -13
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.js +355 -97
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +33 -4
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.js +23 -2
- package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -1
- package/dist/gen/auth/v1/activity_pb.d.ts +148 -0
- package/dist/gen/auth/v1/activity_pb.d.ts.map +1 -0
- package/dist/gen/auth/v1/activity_pb.js +40 -0
- package/dist/gen/auth/v1/activity_pb.js.map +1 -0
- package/dist/gen/auth/v1/api_keys_pb.d.ts +10 -4
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +3 -1
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +61 -5
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +23 -6
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.d.ts +140 -2
- package/dist/gen/auth/v1/mfa_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.js +80 -8
- package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +18 -3
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +18 -3
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +36 -15
- 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 +15 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +6 -2
- 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 +104 -6
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +49 -3
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +76 -3
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js +46 -2
- package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
- package/dist/gen/index.d.ts +3 -1
- package/dist/gen/index.js +4 -2
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +21 -139
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +16 -17
- package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
- package/dist/gen/ledger/read/v1/statement_export_pb.d.ts +236 -20
- package/dist/gen/ledger/read/v1/statement_export_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/statement_export_pb.js +44 -10
- package/dist/gen/ledger/read/v1/statement_export_pb.js.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts +9 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.js +9 -1
- package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/asset_info_pb.d.ts +158 -7
- package/dist/gen/marketdata/v1/asset_info_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/asset_info_pb.js +56 -6
- package/dist/gen/marketdata/v1/asset_info_pb.js.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +45 -6
- package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.js +23 -5
- package/dist/gen/notifications/v1/notifications_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +105 -29
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +14 -2
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +50 -20
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/polyester/api/options_pb.d.ts +11 -2
- package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
- package/dist/gen/polyester/api/options_pb.js +13 -3
- package/dist/gen/polyester/api/options_pb.js.map +1 -1
- package/dist/gen/privatews/v1/private_ws_pb.d.ts +13 -3
- package/dist/gen/privatews/v1/private_ws_pb.d.ts.map +1 -1
- package/dist/gen/privatews/v1/private_ws_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +126 -10
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +14 -6
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts +665 -0
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js +216 -0
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +166 -52
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +50 -12
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/system/v1/system_pb.d.ts +49 -2
- package/dist/gen/system/v1/system_pb.d.ts.map +1 -1
- package/dist/gen/system/v1/system_pb.js +18 -6
- package/dist/gen/system/v1/system_pb.js.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +150 -71
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js +56 -34
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +117 -16
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +45 -2
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +13 -9
- package/dist/realtime/client.js +5 -1
- package/dist/realtime/client.js.map +1 -1
- package/dist/realtime/snapshot-then-stream.js +5 -3
- package/dist/realtime/snapshot-then-stream.js.map +1 -1
- package/dist/services/account-activity/account-activity.d.ts +22 -0
- package/dist/services/account-activity/account-activity.d.ts.map +1 -0
- package/dist/services/account-activity/account-activity.js +32 -0
- package/dist/services/account-activity/account-activity.js.map +1 -0
- package/dist/services/account-activity/account-activity.schemas.d.ts +78 -0
- package/dist/services/account-activity/account-activity.schemas.d.ts.map +1 -0
- package/dist/services/account-activity/account-activity.schemas.js +44 -0
- package/dist/services/account-activity/account-activity.schemas.js.map +1 -0
- package/dist/services/account-activity/account-activity.types.d.ts +2 -0
- package/dist/services/account-activity/service.d.ts +8 -0
- package/dist/services/account-activity/service.d.ts.map +1 -0
- package/dist/services/account-activity/service.js +9 -0
- package/dist/services/account-activity/service.js.map +1 -0
- package/dist/services/address-book/address-book.schemas.js +2 -2
- package/dist/services/api-keys/api-keys.schemas.js +2 -2
- package/dist/services/assistant/assistant-events.schemas.d.ts +81 -81
- package/dist/services/assistant/assistant.codecs.d.ts +7 -2
- package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
- package/dist/services/assistant/assistant.codecs.js +18 -2
- package/dist/services/assistant/assistant.codecs.js.map +1 -1
- package/dist/services/assistant/assistant.d.ts +29 -2
- package/dist/services/assistant/assistant.d.ts.map +1 -1
- package/dist/services/assistant/assistant.js +44 -2
- package/dist/services/assistant/assistant.js.map +1 -1
- package/dist/services/assistant/assistant.schemas.d.ts +111 -6
- package/dist/services/assistant/assistant.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant.schemas.js +74 -6
- package/dist/services/assistant/assistant.schemas.js.map +1 -1
- package/dist/services/assistant/assistant.types.d.ts +3 -3
- 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.schemas.d.ts +15 -13
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
- package/dist/services/balances/balances.d.ts +1 -13
- package/dist/services/balances/balances.d.ts.map +1 -1
- package/dist/services/balances/balances.js +1 -45
- package/dist/services/balances/balances.js.map +1 -1
- package/dist/services/balances/balances.schemas.d.ts +1 -67
- package/dist/services/balances/balances.schemas.d.ts.map +1 -1
- package/dist/services/balances/balances.schemas.js +1 -22
- 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.schemas.d.ts +10 -10
- package/dist/services/changelog/changelog.schemas.d.ts +38 -38
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +3 -3
- package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +11 -11
- package/dist/services/dust-conversion/dust-conversion.schemas.d.ts.map +1 -1
- package/dist/services/dust-conversion/dust-conversion.schemas.js +1 -1
- package/dist/services/dust-conversion/dust-conversion.schemas.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.codecs.d.ts +11 -6
- package/dist/services/internal-transfers/internal-transfers.codecs.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.codecs.js +6 -6
- package/dist/services/internal-transfers/internal-transfers.codecs.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.d.ts +17 -10
- package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.js +21 -10
- package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +43 -31
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js +23 -12
- package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.types.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.d.ts +1 -1
- package/dist/services/lifecycle/lifecycle.js +2 -3
- package/dist/services/lifecycle/lifecycle.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +40 -40
- package/dist/services/market-data/market-data.codecs.d.ts +8 -0
- package/dist/services/market-data/market-data.codecs.d.ts.map +1 -0
- package/dist/services/market-data/market-data.codecs.js +7 -1
- package/dist/services/market-data/market-data.codecs.js.map +1 -1
- package/dist/services/market-data/market-data.d.ts +3 -2
- package/dist/services/market-data/market-data.d.ts.map +1 -1
- package/dist/services/market-data/market-data.js +3 -2
- package/dist/services/market-data/market-data.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.d.ts +332 -4
- package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +56 -8
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.types.d.ts +3 -2
- package/dist/services/notifications/notifications.codecs.d.ts +1 -1
- package/dist/services/notifications/notifications.codecs.d.ts.map +1 -1
- package/dist/services/notifications/notifications.codecs.js +2 -1
- package/dist/services/notifications/notifications.codecs.js.map +1 -1
- package/dist/services/notifications/notifications.d.ts +4 -2
- package/dist/services/notifications/notifications.d.ts.map +1 -1
- package/dist/services/notifications/notifications.js +4 -2
- package/dist/services/notifications/notifications.js.map +1 -1
- package/dist/services/notifications/notifications.schemas.d.ts +63 -7
- package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
- package/dist/services/notifications/notifications.schemas.js +5 -0
- package/dist/services/notifications/notifications.schemas.js.map +1 -1
- package/dist/services/orderbook/orderbook.js +3 -2
- package/dist/services/orderbook/orderbook.js.map +1 -1
- package/dist/services/orders/order-enums.codecs.d.ts +2 -0
- package/dist/services/orders/order-errors.schemas.d.ts +50 -5
- package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
- package/dist/services/orders/order-errors.schemas.js +13 -3
- package/dist/services/orders/order-errors.schemas.js.map +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +310 -70
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +58 -11
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +13 -13
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
- package/dist/services/policies/shared.codecs.js +12 -6
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/shared.js +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +9 -9
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +4 -30
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
- package/dist/services/price-alerts/price-alerts.d.ts +5 -2
- package/dist/services/price-alerts/price-alerts.d.ts.map +1 -1
- package/dist/services/price-alerts/price-alerts.js +5 -2
- package/dist/services/price-alerts/price-alerts.js.map +1 -1
- package/dist/services/price-alerts/price-alerts.schemas.js +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +4 -4
- package/dist/services/social-verification/social-verification.schemas.d.ts +9 -0
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +9 -2
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/statement-exports/statement-exports.codecs.d.ts +3 -2
- package/dist/services/statement-exports/statement-exports.codecs.d.ts.map +1 -1
- package/dist/services/statement-exports/statement-exports.codecs.js +2 -1
- package/dist/services/statement-exports/statement-exports.codecs.js.map +1 -1
- package/dist/services/statement-exports/statement-exports.d.ts +25 -10
- package/dist/services/statement-exports/statement-exports.d.ts.map +1 -1
- package/dist/services/statement-exports/statement-exports.js +33 -10
- package/dist/services/statement-exports/statement-exports.js.map +1 -1
- package/dist/services/statement-exports/statement-exports.schemas.d.ts +38 -10
- package/dist/services/statement-exports/statement-exports.schemas.d.ts.map +1 -1
- package/dist/services/statement-exports/statement-exports.schemas.js +25 -6
- package/dist/services/statement-exports/statement-exports.schemas.js.map +1 -1
- package/dist/services/statement-exports/statement-exports.types.d.ts +2 -2
- package/dist/services/subaccounts/subaccounts.codecs.js +112 -38
- package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.d.ts +2 -1
- package/dist/services/subaccounts/subaccounts.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.js +3 -3
- package/dist/services/subaccounts/subaccounts.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +12 -5
- package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.js +10 -3
- package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
- package/dist/services/system/system.d.ts +12 -1
- package/dist/services/system/system.d.ts.map +1 -1
- package/dist/services/system/system.js +5 -0
- package/dist/services/system/system.js.map +1 -1
- package/dist/services/system/system.schemas.d.ts +13 -13
- package/dist/services/system/system.types.d.ts +2 -2
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts +8 -0
- package/dist/services/trading-withdraws/trading-withdraws.codecs.d.ts.map +1 -0
- package/dist/services/trading-withdraws/trading-withdraws.codecs.js +7 -1
- package/dist/services/trading-withdraws/trading-withdraws.codecs.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +2 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +2 -1
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +15 -0
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +16 -2
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -1
- package/dist/services/transfers/transfers.schemas.d.ts +4 -4
- package/dist/services/triggers/trigger-child-order.schemas.js +1 -1
- package/dist/services/triggers/trigger-child-order.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +10 -10
- package/dist/services/triggers/triggers-output.schemas.d.ts +170 -52
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +13 -3
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/services/triggers/triggers.codecs.d.ts +10 -0
- package/dist/services/triggers/triggers.codecs.d.ts.map +1 -0
- package/dist/services/triggers/triggers.codecs.js +7 -1
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts +2 -2
- package/dist/services/triggers/triggers.js +2 -2
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/services/zipper/zipper.d.ts.map +1 -1
- package/dist/services/zipper/zipper.js +13 -7
- package/dist/services/zipper/zipper.js.map +1 -1
- package/dist/services/zipper/zipper.schemas.d.ts +7 -2
- package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
- package/dist/services/zipper/zipper.schemas.js +29 -9
- 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 +16 -2
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +27 -4
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +10 -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/auth.js +6 -0
- package/dist/shared/error-details/auth.js.map +1 -1
- package/dist/shared/errors.d.ts +5 -1
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +3 -0
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/ledger-codes.d.ts +3 -1
- package/dist/shared/ledger-codes.d.ts.map +1 -1
- package/dist/shared/ledger-codes.js +6 -3
- package/dist/shared/ledger-codes.js.map +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +3 -1
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { formatId } from "../../utils/base58-id.js";
|
|
|
2
2
|
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
|
-
import { ASSISTANT_ACCOUNT_SELECTION_VALUES, ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ASSISTANT_KEY_VIEW_VALUES, AccountSelectionCodec, ApprovalDecisionCodec, AssistantKeyStateCodec, AssistantKeyViewCodec, DisplaySettingCodec, MemoryKindCodec, MessageRoleCodec } from "./assistant.codecs.js";
|
|
5
|
+
import { ASSISTANT_ACCOUNT_SELECTION_VALUES, ASSISTANT_APPROVAL_DECISION_VALUES, ASSISTANT_DISPLAY_SETTING_VALUES, ASSISTANT_KEY_VIEW_VALUES, AccountSelectionCodec, ApprovalDecisionCodec, AssistantKeyStateCodec, AssistantKeyViewCodec, DisplaySettingCodec, FundingModeCodec, MemoryKindCodec, MessageRoleCodec, ModelKeyCheckCodec } from "./assistant.codecs.js";
|
|
6
6
|
import { bytesToHex } from "@noble/hashes/utils.js";
|
|
7
7
|
import * as v from "valibot";
|
|
8
8
|
//#region src/services/assistant/assistant.schemas.ts
|
|
@@ -38,8 +38,27 @@ const CurrentPageInputSchema = v.strictObject({
|
|
|
38
38
|
const SendAssistantMessageInputSchema = v.pipe(v.strictObject({
|
|
39
39
|
/** Conversation to continue; omit to start a new one. */
|
|
40
40
|
conversationId: v.optional(idInputSchema("conversationId")),
|
|
41
|
-
/**
|
|
42
|
-
text
|
|
41
|
+
/**
|
|
42
|
+
* Message text, plain text or Markdown, at most 16000 characters. Required unless
|
|
43
|
+
* `images` are attached; with images, it is the question about them.
|
|
44
|
+
*/
|
|
45
|
+
text: v.optional(v.pipe(v.string(), v.maxLength(16e3))),
|
|
46
|
+
/**
|
|
47
|
+
* Images the message shows the assistant, such as a screenshot, in the order the user
|
|
48
|
+
* attached them: PNG, JPEG or WebP, at most 4, each at most 10 MiB. Covered by
|
|
49
|
+
* `idempotencyKey`.
|
|
50
|
+
*/
|
|
51
|
+
images: v.optional(v.array(v.strictObject({
|
|
52
|
+
data: v.instance(Uint8Array),
|
|
53
|
+
/** `"image/png"`, `"image/jpeg"` or `"image/webp"`, matching `data`. */
|
|
54
|
+
mimeType: v.string()
|
|
55
|
+
}))),
|
|
56
|
+
/**
|
|
57
|
+
* Send only while this run is still the conversation's latest, e.g. the run of the
|
|
58
|
+
* answer a follow-up button sits under; otherwise nothing is recorded and the call fails
|
|
59
|
+
* with `CONVERSATION_ADVANCED`. Needs `conversationId`. Covered by `idempotencyKey`.
|
|
60
|
+
*/
|
|
61
|
+
expectedLatestRunId: v.optional(idInputSchema("expectedLatestRunId")),
|
|
43
62
|
/** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */
|
|
44
63
|
idempotencyKey: IdempotencyKeySchema,
|
|
45
64
|
/**
|
|
@@ -66,7 +85,7 @@ const SendAssistantMessageInputSchema = v.pipe(v.strictObject({
|
|
|
66
85
|
* `display_setting_action` asks, each once. Omit for none.
|
|
67
86
|
*/
|
|
68
87
|
displaySettings: v.optional(v.pipe(v.array(v.picklist(ASSISTANT_DISPLAY_SETTING_VALUES)), v.check((items) => new Set(items).size === items.length, "Display settings must be distinct."), v.transform((items) => items.map((item) => DisplaySettingCodec.inputToProto[item]))))
|
|
69
|
-
}), v.check((input) => input.accountSelection === void 0 || input.subaccountId === void 0, "Omit subaccountId when accountSelection is \"none\"."));
|
|
88
|
+
}), v.check((input) => input.accountSelection === void 0 || input.subaccountId === void 0, "Omit subaccountId when accountSelection is \"none\"."), v.check((input) => Boolean(input.text || input.images?.length), "A message needs text, images or both."));
|
|
70
89
|
const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema("runId") });
|
|
71
90
|
const WatchAssistantRunInputSchema = v.pipe(v.strictObject({
|
|
72
91
|
runId: idInputSchema("runId"),
|
|
@@ -93,6 +112,10 @@ const DeleteAssistantMemoryInputSchema = v.strictObject({ memoryId: idInputSchem
|
|
|
93
112
|
const PrepareAssistantKeysInputSchema = v.pipe(v.strictObject({
|
|
94
113
|
/** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */
|
|
95
114
|
accounts: v.pipe(v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })), v.minLength(1, "At least one account is required."), v.maxLength(64, "At most 64 accounts are allowed.")) }), v.check(({ accounts }) => new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length, "Each account may be named only once."));
|
|
115
|
+
const GetAssistantMessageImageInputSchema = v.strictObject({ imageId: idInputSchema("imageId") });
|
|
116
|
+
const SetAssistantModelKeyInputSchema = v.strictObject({
|
|
117
|
+
/** An OpenAI secret API key (`sk-...`). Never logged or returned. */
|
|
118
|
+
apiKey: v.pipe(v.string(), v.minLength(1)) });
|
|
96
119
|
const CompleteAssistantKeysInputSchema = v.strictObject({ setupId: idInputSchema("setupId") });
|
|
97
120
|
function optionalId(id) {
|
|
98
121
|
return id ? formatId(id) : void 0;
|
|
@@ -114,7 +137,20 @@ function formatMessage(m) {
|
|
|
114
137
|
text: m.text,
|
|
115
138
|
createdAt: tsObjToMs(m.createdAt),
|
|
116
139
|
/** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */
|
|
117
|
-
runId: formatId(m.runId)
|
|
140
|
+
runId: formatId(m.runId),
|
|
141
|
+
/** A user message's images, in the order sent; read each with `getMessageImage`. */
|
|
142
|
+
images: m.images.map(formatMessageImage)
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
function formatMessageImage(i) {
|
|
146
|
+
return {
|
|
147
|
+
imageId: formatId(i.imageId),
|
|
148
|
+
/** `"image/png"`, `"image/jpeg"` or `"image/webp"`. */
|
|
149
|
+
mimeType: i.mimeType,
|
|
150
|
+
/** Pixels; an image over 2000 pixels on a side is stored scaled down to fit. */
|
|
151
|
+
width: i.width,
|
|
152
|
+
height: i.height,
|
|
153
|
+
sizeBytes: i.sizeBytes
|
|
118
154
|
};
|
|
119
155
|
}
|
|
120
156
|
function formatMemory(m) {
|
|
@@ -166,6 +202,38 @@ function formatPrepareAssistantKeysResult(r) {
|
|
|
166
202
|
expiresAt: tsObjToMs(r.expiresAt)
|
|
167
203
|
};
|
|
168
204
|
}
|
|
205
|
+
/** The caller's own OpenAI API key as the assistant shows it; the key itself is never returned. */
|
|
206
|
+
function formatModelKey(k) {
|
|
207
|
+
return {
|
|
208
|
+
/** The key's last four characters, e.g. `"x7Qa"`. */
|
|
209
|
+
suffix: k?.suffix ?? "",
|
|
210
|
+
addedAt: tsObjToMs(k?.addedAt),
|
|
211
|
+
/** The last check with OpenAI: on save, when OpenAI refused it in a run, and on recovery. */
|
|
212
|
+
lastCheck: enumLabel(ModelKeyCheckCodec.protoToOutput, k?.lastCheck ?? 0),
|
|
213
|
+
checkedAt: tsObjToMs(k?.checkedAt)
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
/** Credits are the main account's, shared by every subaccount. */
|
|
217
|
+
function formatAssistantUsage(r) {
|
|
218
|
+
return {
|
|
219
|
+
/** With `"own_key"`, messages use no credits. */
|
|
220
|
+
fundingMode: FundingModeCodec.protoToOutput[r.fundingMode] ?? "credits",
|
|
221
|
+
/** Omitted when the tier could not be read; VIP 0's free credits then apply. */
|
|
222
|
+
vipTier: r.vipTier,
|
|
223
|
+
/** Today's free credits. */
|
|
224
|
+
freeCredits: Number(r.freeCredits),
|
|
225
|
+
/** Rounded down; may exceed `freeCredits`, as an answer started with credits left finishes. */
|
|
226
|
+
freeCreditsUsed: Number(r.freeCreditsUsed),
|
|
227
|
+
freeCreditsLeft: Number(r.freeCreditsLeft),
|
|
228
|
+
/** Epoch ms of the next 00:00 UTC; unused credits do not carry over. */
|
|
229
|
+
resetsAt: tsObjToMs(r.resetsAt),
|
|
230
|
+
/** The next VIP tier's daily free credits; omitted at the top tier or an unknown tier. */
|
|
231
|
+
nextTier: r.nextTier && {
|
|
232
|
+
vipTier: r.nextTier.vipTier,
|
|
233
|
+
dailyFreeCredits: Number(r.nextTier.dailyFreeCredits)
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
169
237
|
/** US dollars as a decimal string with at most 2 decimal places, e.g. `"5000"` or `"250.50"`. */
|
|
170
238
|
const UsdLimitInputSchema = v.pipe(v.string(), v.trim(), v.regex(/^\d+(\.\d{1,2})?$/, "limit must be US dollars with at most 2 decimal places"));
|
|
171
239
|
const SetTelegramApprovalLimitsInputSchema = v.strictObject({
|
|
@@ -181,6 +249,6 @@ function formatTelegramApprovalLimits(limits) {
|
|
|
181
249
|
};
|
|
182
250
|
}
|
|
183
251
|
//#endregion
|
|
184
|
-
export { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, ListAssistantConversationsInputSchema, ListAssistantKeysInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatConversation, formatMemory, formatMessage, formatPrepareAssistantKeysResult, formatPreparedAssistantKey, formatTelegramApprovalLimits };
|
|
252
|
+
export { AssistantRunIdInputSchema, CompleteAssistantKeysInputSchema, DecideAssistantApprovalInputSchema, DeleteAssistantMemoryInputSchema, GetAssistantMessageImageInputSchema, ListAssistantConversationsInputSchema, ListAssistantKeysInputSchema, ListAssistantMemoriesInputSchema, ListAssistantMessagesInputSchema, PrepareAssistantKeysInputSchema, SendAssistantMessageInputSchema, SetAssistantModelKeyInputSchema, SetTelegramApprovalLimitsInputSchema, WatchAssistantRunInputSchema, formatAssistantKey, formatAssistantUsage, formatConversation, formatMemory, formatMessage, formatMessageImage, formatModelKey, formatPrepareAssistantKeysResult, formatPreparedAssistantKey, formatTelegramApprovalLimits };
|
|
185
253
|
|
|
186
254
|
//# sourceMappingURL=assistant.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assistant.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport type * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { idInputSchema, optionalSubaccountIdInputSchema } from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n ASSISTANT_ACCOUNT_SELECTION_VALUES,\n ASSISTANT_KEY_VIEW_VALUES,\n AccountSelectionCodec,\n AssistantKeyViewCodec,\n ASSISTANT_APPROVAL_DECISION_VALUES,\n ASSISTANT_DISPLAY_SETTING_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\n DisplaySettingCodec,\n MemoryKindCodec,\n MessageRoleCodec,\n} from \"./assistant.codecs.js\";\n\nconst IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction pageInputEntries(maxLimit: number) {\n return {\n /** Page size; omit for the server default. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),\n /** The previous page's `nextPageToken`. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n };\n}\n\nconst DestinationInputSchema = v.strictObject({\n /** The client's id for the place, e.g. `\"page-subaccounts\"`: lowercase letters, digits and hyphens. */\n id: v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destination id must be 1-64 of a-z, 0-9, -\"),\n ),\n /** Its name as the client shows it, 1 to 80 characters. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n /** What the user does there, at most 200 characters. */\n description: v.optional(v.pipe(v.string(), v.maxLength(200)), \"\"),\n});\n\n/**\n * The page the user is on, named by its template and title, never by its address: never send the\n * URL, its query or fragment, or any id or symbol taken from the path.\n */\nconst CurrentPageInputSchema = v.strictObject({\n /** The page's `destinations` id, when it is one of them. */\n destinationId: v.optional(\n v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destinationId must be 1-64 of a-z, 0-9, -\"),\n ),\n ),\n /** Route template with bracketed parameters, e.g. `\"/account/settings/[section]\"`. */\n route: v.pipe(\n v.string(),\n v.regex(\n /^\\/[A-Za-z0-9/\\-_.[\\]]{0,199}$/,\n \"route must start with / and use at most 200 of A-Z, a-z, 0-9, /, -, _, ., [, ]\",\n ),\n ),\n /** The page's title as the client shows it, 1 to 80 characters; never the user's own data. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n});\n\nexport const SendAssistantMessageInputSchema = v.pipe(\n v.strictObject({\n /** Conversation to continue; omit to start a new one. */\n conversationId: v.optional(idInputSchema(\"conversationId\")),\n /** Message text, plain text or Markdown, 1 to 16000 characters. */\n text: v.pipe(v.string(), v.minLength(1), v.maxLength(16_000)),\n /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */\n idempotencyKey: IdempotencyKeySchema,\n /**\n * Trading account the run reads and acts on. Omit for the main account: the run then\n * reads it (balances, trading accounts, API keys, price alerts, fees and permissions)\n * but places, changes and cancels nothing, and asks the user to pick a trading account.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\n /**\n * `\"none\"` for a run that reads no account, such as when the user has given the\n * assistant access to no account; `subaccountId` must then be omitted. Omit to read the\n * `subaccountId` account or the main account. Covered by `idempotencyKey`.\n */\n accountSelection: v.pipe(\n v.optional(v.picklist(ASSISTANT_ACCOUNT_SELECTION_VALUES)),\n v.transform((value) => (value ? AccountSelectionCodec.inputToProto[value] : undefined)),\n ),\n /** Places in the client the run may suggest, at most 100, each id once. */\n destinations: v.optional(\n v.pipe(\n v.array(DestinationInputSchema),\n v.maxLength(100, \"At most 100 destinations are allowed.\"),\n v.check(\n (items) => new Set(items.map((d) => d.id)).size === items.length,\n \"Destination ids must be distinct.\",\n ),\n ),\n ),\n /**\n * The page the user is on as they send the message; omit for a client without pages.\n * Covered by `idempotencyKey`: a retry must send the page the first attempt sent.\n */\n page: v.optional(CurrentPageInputSchema),\n /**\n * Display settings the client offers now and will change when a run's\n * `display_setting_action` asks, each once. Omit for none.\n */\n displaySettings: v.optional(\n v.pipe(\n v.array(v.picklist(ASSISTANT_DISPLAY_SETTING_VALUES)),\n v.check(\n (items) => new Set(items).size === items.length,\n \"Display settings must be distinct.\",\n ),\n v.transform((items) => items.map((item) => DisplaySettingCodec.inputToProto[item])),\n ),\n ),\n }),\n v.check(\n (input) => input.accountSelection === undefined || input.subaccountId === undefined,\n 'Omit subaccountId when accountSelection is \"none\".',\n ),\n);\n\nexport type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;\n\nexport const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema(\"runId\") });\n\nexport type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;\n\nexport const WatchAssistantRunInputSchema = v.pipe(\n v.strictObject({\n runId: idInputSchema(\"runId\"),\n /** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */\n afterSeq: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n 0,\n ),\n }),\n v.transform(({ runId, afterSeq }) => ({ runId, afterSeq: BigInt(afterSeq) })),\n);\n\nexport type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;\n\nexport const DecideAssistantApprovalInputSchema = v.pipe(\n v.strictObject({\n approvalId: idInputSchema(\"approvalId\"),\n decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES),\n }),\n v.transform(({ approvalId, decision }) => ({\n approvalId,\n decision: ApprovalDecisionCodec.inputToProto[decision],\n })),\n);\n\nexport type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;\n\nexport const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));\n\nexport type ListAssistantConversationsInput = v.InferInput<\n typeof ListAssistantConversationsInputSchema\n>;\n\nexport const ListAssistantMessagesInputSchema = v.strictObject({\n conversationId: idInputSchema(\"conversationId\"),\n ...pageInputEntries(200),\n});\n\nexport type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;\n\nexport const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));\n\nexport type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;\n\nexport const DeleteAssistantMemoryInputSchema = v.strictObject({\n memoryId: idInputSchema(\"memoryId\"),\n});\n\nexport type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;\n\nexport const PrepareAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */\n accounts: v.pipe(\n v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })),\n v.minLength(1, \"At least one account is required.\"),\n v.maxLength(64, \"At most 64 accounts are allowed.\"),\n ),\n }),\n v.check(\n ({ accounts }) =>\n new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length,\n \"Each account may be named only once.\",\n ),\n);\n\nexport type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;\n\nexport const CompleteAssistantKeysInputSchema = v.strictObject({\n setupId: idInputSchema(\"setupId\"),\n});\n\nexport type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;\n\n/* ---------- outputs ---------- */\n\nfunction optionalId(id: bigint | undefined): string | undefined {\n return id ? formatId(id) : undefined;\n}\n\nexport function formatConversation(c: Proto.Conversation) {\n return {\n conversationId: formatId(c.conversationId),\n /** Empty until a title is available. */\n title: c.title,\n createdAt: tsObjToMs(c.createdAt),\n updatedAt: tsObjToMs(c.updatedAt),\n };\n}\n\nexport type AssistantConversation = ReturnType<typeof formatConversation>;\n\nexport function formatMessage(m: Proto.Message) {\n return {\n messageId: formatId(m.messageId),\n role: enumLabel(MessageRoleCodec.protoToOutput, m.role),\n /** Markdown. For an assistant message, its run's final text. */\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */\n runId: formatId(m.runId),\n };\n}\n\nexport type AssistantMessage = ReturnType<typeof formatMessage>;\n\nexport function formatMemory(m: Proto.Memory) {\n return {\n memoryId: formatId(m.memoryId),\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Omitted when the conversation it was learned in is unknown. */\n conversationId: optionalId(m.conversationId),\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n };\n}\n\nexport type AssistantMemory = ReturnType<typeof formatMemory>;\n\nexport function formatAssistantKey(k: Proto.AssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n keyId: k.keyId,\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state),\n /**\n * The subaccount's name; only from `listKeys({ view: \"full\" })`. Empty for the main\n * account, an unnamed subaccount, or a name that could not be read.\n */\n label: k.label,\n };\n}\n\nexport const ListAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** `\"full\"` adds each key's account name as `label`. */\n view: v.optional(v.picklist(ASSISTANT_KEY_VIEW_VALUES)),\n }),\n v.transform(({ view }) => ({\n view: view ? AssistantKeyViewCodec.inputToProto[view] : undefined,\n })),\n);\n\nexport type ListAssistantKeysInput = v.InferInput<typeof ListAssistantKeysInputSchema>;\n\nexport type AssistantKey = ReturnType<typeof formatAssistantKey>;\n\nexport function formatPreparedAssistantKey(k: Proto.PreparedAssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n /** Pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationProof: k.registrationProof,\n /** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationDeadline: tsObjToMs(k.registrationDeadline),\n };\n}\n\nexport type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;\n\nexport function formatPrepareAssistantKeysResult(r: Proto.PrepareAssistantKeysResponse) {\n return {\n setupId: formatId(r.setupId),\n /** One key per requested account, in request order. */\n keys: r.keys.map(formatPreparedAssistantKey),\n /** Epoch ms after which the keys can no longer be registered. */\n expiresAt: tsObjToMs(r.expiresAt),\n };\n}\n\nexport type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;\n\n/** `nextPageToken` is empty when no more results exist. */\nexport type ListAssistantConversationsResult = {\n conversations: AssistantConversation[];\n nextPageToken: string;\n};\nexport type ListAssistantMessagesResult = { messages: AssistantMessage[]; nextPageToken: string };\nexport type ListAssistantMemoriesResult = { memories: AssistantMemory[]; nextPageToken: string };\n\n/** US dollars as a decimal string with at most 2 decimal places, e.g. `\"5000\"` or `\"250.50\"`. */\nconst UsdLimitInputSchema = v.pipe(\n v.string(),\n v.trim(),\n v.regex(/^\\d+(\\.\\d{1,2})?$/, \"limit must be US dollars with at most 2 decimal places\"),\n);\n\nexport const SetTelegramApprovalLimitsInputSchema = v.strictObject({\n /** Largest notional value of one approval from Telegram. `\"0\"` allows none; omit for no limit. */\n perApprovalUsd: v.optional(UsdLimitInputSchema),\n /** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */\n dailyUsd: v.optional(UsdLimitInputSchema),\n});\n\nexport type SetTelegramApprovalLimitsInput = v.InferInput<\n typeof SetTelegramApprovalLimitsInputSchema\n>;\n\n/** Limits on what the caller may approve from Telegram, in US dollars; `null` is no limit. */\nexport type TelegramApprovalLimits = {\n perApprovalUsd: string | null;\n dailyUsd: string | null;\n};\n\nexport function formatTelegramApprovalLimits(\n limits: Proto.TelegramApprovalLimits | undefined,\n): TelegramApprovalLimits {\n return {\n perApprovalUsd: limits?.perApprovalUsd ?? null,\n dailyUsd: limits?.dailyUsd ?? null,\n };\n}\n"],"mappings":";;;;;;;;AAqBA,MAAM,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAExE,SAAS,iBAAiB,UAAkB;CACxC,OAAO;;EAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,QAAQ,CAAC,CAAC;;EAEtF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;CACtD;AACJ;AAEA,MAAM,yBAAyB,EAAE,aAAa;;CAE1C,IAAI,EAAE,KACF,EAAE,OAAO,GACT,EAAE,MAAM,qBAAqB,4CAA4C,CAC7E;;CAEA,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;;CAEzD,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,GAAG,CAAC,GAAG,EAAE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W,EAAE,YAAY;EACvC,kBAAkB,EAAE;EACpB,cAAc,WAAW,EAAE,gBAAgB;;EAE3C,mBAAmB,EAAE;;EAErB,sBAAsB,UAAU,EAAE,oBAAoB;CAC1D;AACJ;AAIA,SAAgB,iCAAiC,GAAuC;CACpF,OAAO;EACH,SAAS,SAAS,EAAE,OAAO;;EAE3B,MAAM,EAAE,KAAK,IAAI,0BAA0B;;EAE3C,WAAW,UAAU,EAAE,SAAS;CACpC;AACJ;;AAaA,MAAM,sBAAsB,EAAE,KAC1B,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,MAAM,qBAAqB,wDAAwD,CACzF;AAEA,MAAa,uCAAuC,EAAE,aAAa;;CAE/D,gBAAgB,EAAE,SAAS,mBAAmB;;CAE9C,UAAU,EAAE,SAAS,mBAAmB;AAC5C,CAAC;AAYD,SAAgB,6BACZ,QACsB;CACtB,OAAO;EACH,gBAAgB,QAAQ,kBAAkB;EAC1C,UAAU,QAAQ,YAAY;CAClC;AACJ"}
|
|
1
|
+
{"version":3,"file":"assistant.schemas.js","names":[],"sources":["../../../src/services/assistant/assistant.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport type * as Proto from \"../../gen/ai/v1/assistant_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { idInputSchema, optionalSubaccountIdInputSchema } from \"../../shared/schemas.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport { tsObjToMs } from \"../../utils/time.js\";\nimport {\n ASSISTANT_ACCOUNT_SELECTION_VALUES,\n ASSISTANT_KEY_VIEW_VALUES,\n AccountSelectionCodec,\n AssistantKeyViewCodec,\n ASSISTANT_APPROVAL_DECISION_VALUES,\n ASSISTANT_DISPLAY_SETTING_VALUES,\n ApprovalDecisionCodec,\n AssistantKeyStateCodec,\n DisplaySettingCodec,\n FundingModeCodec,\n MemoryKindCodec,\n MessageRoleCodec,\n ModelKeyCheckCodec,\n} from \"./assistant.codecs.js\";\n\nconst IdempotencyKeySchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nfunction pageInputEntries(maxLimit: number) {\n return {\n /** Page size; omit for the server default. */\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(maxLimit))),\n /** The previous page's `nextPageToken`. */\n pageToken: v.optional(v.pipe(v.string(), v.trim())),\n };\n}\n\nconst DestinationInputSchema = v.strictObject({\n /** The client's id for the place, e.g. `\"page-subaccounts\"`: lowercase letters, digits and hyphens. */\n id: v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destination id must be 1-64 of a-z, 0-9, -\"),\n ),\n /** Its name as the client shows it, 1 to 80 characters. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n /** What the user does there, at most 200 characters. */\n description: v.optional(v.pipe(v.string(), v.maxLength(200)), \"\"),\n});\n\n/**\n * The page the user is on, named by its template and title, never by its address: never send the\n * URL, its query or fragment, or any id or symbol taken from the path.\n */\nconst CurrentPageInputSchema = v.strictObject({\n /** The page's `destinations` id, when it is one of them. */\n destinationId: v.optional(\n v.pipe(\n v.string(),\n v.regex(/^[a-z0-9-]{1,64}$/, \"destinationId must be 1-64 of a-z, 0-9, -\"),\n ),\n ),\n /** Route template with bracketed parameters, e.g. `\"/account/settings/[section]\"`. */\n route: v.pipe(\n v.string(),\n v.regex(\n /^\\/[A-Za-z0-9/\\-_.[\\]]{0,199}$/,\n \"route must start with / and use at most 200 of A-Z, a-z, 0-9, /, -, _, ., [, ]\",\n ),\n ),\n /** The page's title as the client shows it, 1 to 80 characters; never the user's own data. */\n title: v.pipe(v.string(), v.minLength(1), v.maxLength(80)),\n});\n\nexport const SendAssistantMessageInputSchema = v.pipe(\n v.strictObject({\n /** Conversation to continue; omit to start a new one. */\n conversationId: v.optional(idInputSchema(\"conversationId\")),\n /**\n * Message text, plain text or Markdown, at most 16000 characters. Required unless\n * `images` are attached; with images, it is the question about them.\n */\n text: v.optional(v.pipe(v.string(), v.maxLength(16_000))),\n /**\n * Images the message shows the assistant, such as a screenshot, in the order the user\n * attached them: PNG, JPEG or WebP, at most 4, each at most 10 MiB. Covered by\n * `idempotencyKey`.\n */\n images: v.optional(\n v.array(\n v.strictObject({\n data: v.instance(Uint8Array),\n /** `\"image/png\"`, `\"image/jpeg\"` or `\"image/webp\"`, matching `data`. */\n mimeType: v.string(),\n }),\n ),\n ),\n /**\n * Send only while this run is still the conversation's latest, e.g. the run of the\n * answer a follow-up button sits under; otherwise nothing is recorded and the call fails\n * with `CONVERSATION_ADVANCED`. Needs `conversationId`. Covered by `idempotencyKey`.\n */\n expectedLatestRunId: v.optional(idInputSchema(\"expectedLatestRunId\")),\n /** Client-chosen key, unique per caller. Repeat the request unchanged to resolve an unknown outcome. */\n idempotencyKey: IdempotencyKeySchema,\n /**\n * Trading account the run reads and acts on. Omit for the main account: the run then\n * reads it (balances, trading accounts, API keys, price alerts, fees and permissions)\n * but places, changes and cancels nothing, and asks the user to pick a trading account.\n */\n subaccountId: optionalSubaccountIdInputSchema(),\n /**\n * `\"none\"` for a run that reads no account, such as when the user has given the\n * assistant access to no account; `subaccountId` must then be omitted. Omit to read the\n * `subaccountId` account or the main account. Covered by `idempotencyKey`.\n */\n accountSelection: v.pipe(\n v.optional(v.picklist(ASSISTANT_ACCOUNT_SELECTION_VALUES)),\n v.transform((value) => (value ? AccountSelectionCodec.inputToProto[value] : undefined)),\n ),\n /** Places in the client the run may suggest, at most 100, each id once. */\n destinations: v.optional(\n v.pipe(\n v.array(DestinationInputSchema),\n v.maxLength(100, \"At most 100 destinations are allowed.\"),\n v.check(\n (items) => new Set(items.map((d) => d.id)).size === items.length,\n \"Destination ids must be distinct.\",\n ),\n ),\n ),\n /**\n * The page the user is on as they send the message; omit for a client without pages.\n * Covered by `idempotencyKey`: a retry must send the page the first attempt sent.\n */\n page: v.optional(CurrentPageInputSchema),\n /**\n * Display settings the client offers now and will change when a run's\n * `display_setting_action` asks, each once. Omit for none.\n */\n displaySettings: v.optional(\n v.pipe(\n v.array(v.picklist(ASSISTANT_DISPLAY_SETTING_VALUES)),\n v.check(\n (items) => new Set(items).size === items.length,\n \"Display settings must be distinct.\",\n ),\n v.transform((items) => items.map((item) => DisplaySettingCodec.inputToProto[item])),\n ),\n ),\n }),\n v.check(\n (input) => input.accountSelection === undefined || input.subaccountId === undefined,\n 'Omit subaccountId when accountSelection is \"none\".',\n ),\n v.check(\n (input) => Boolean(input.text || input.images?.length),\n \"A message needs text, images or both.\",\n ),\n);\n\nexport type SendAssistantMessageInput = v.InferInput<typeof SendAssistantMessageInputSchema>;\n\nexport const AssistantRunIdInputSchema = v.strictObject({ runId: idInputSchema(\"runId\") });\n\nexport type AssistantRunIdInput = v.InferInput<typeof AssistantRunIdInputSchema>;\n\nexport const WatchAssistantRunInputSchema = v.pipe(\n v.strictObject({\n runId: idInputSchema(\"runId\"),\n /** Return events after this seq. 0 (default) replays the run; pass the last seq received to resume. */\n afterSeq: v.optional(\n v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),\n 0,\n ),\n }),\n v.transform(({ runId, afterSeq }) => ({ runId, afterSeq: BigInt(afterSeq) })),\n);\n\nexport type WatchAssistantRunInput = v.InferInput<typeof WatchAssistantRunInputSchema>;\n\nexport const DecideAssistantApprovalInputSchema = v.pipe(\n v.strictObject({\n approvalId: idInputSchema(\"approvalId\"),\n decision: v.picklist(ASSISTANT_APPROVAL_DECISION_VALUES),\n }),\n v.transform(({ approvalId, decision }) => ({\n approvalId,\n decision: ApprovalDecisionCodec.inputToProto[decision],\n })),\n);\n\nexport type DecideAssistantApprovalInput = v.InferInput<typeof DecideAssistantApprovalInputSchema>;\n\nexport const ListAssistantConversationsInputSchema = v.strictObject(pageInputEntries(100));\n\nexport type ListAssistantConversationsInput = v.InferInput<\n typeof ListAssistantConversationsInputSchema\n>;\n\nexport const ListAssistantMessagesInputSchema = v.strictObject({\n conversationId: idInputSchema(\"conversationId\"),\n ...pageInputEntries(200),\n});\n\nexport type ListAssistantMessagesInput = v.InferInput<typeof ListAssistantMessagesInputSchema>;\n\nexport const ListAssistantMemoriesInputSchema = v.strictObject(pageInputEntries(200));\n\nexport type ListAssistantMemoriesInput = v.InferInput<typeof ListAssistantMemoriesInputSchema>;\n\nexport const DeleteAssistantMemoryInputSchema = v.strictObject({\n memoryId: idInputSchema(\"memoryId\"),\n});\n\nexport type DeleteAssistantMemoryInput = v.InferInput<typeof DeleteAssistantMemoryInputSchema>;\n\nexport const PrepareAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** 1 to 64 accounts, each once. An entry without `subaccountId` is the main account. */\n accounts: v.pipe(\n v.array(v.strictObject({ subaccountId: optionalSubaccountIdInputSchema() })),\n v.minLength(1, \"At least one account is required.\"),\n v.maxLength(64, \"At most 64 accounts are allowed.\"),\n ),\n }),\n v.check(\n ({ accounts }) =>\n new Set(accounts.map((a) => a.subaccountId ?? 0n)).size === accounts.length,\n \"Each account may be named only once.\",\n ),\n);\n\nexport type PrepareAssistantKeysInput = v.InferInput<typeof PrepareAssistantKeysInputSchema>;\n\nexport const GetAssistantMessageImageInputSchema = v.strictObject({\n imageId: idInputSchema(\"imageId\"),\n});\n\nexport type GetAssistantMessageImageInput = v.InferInput<\n typeof GetAssistantMessageImageInputSchema\n>;\n\nexport const SetAssistantModelKeyInputSchema = v.strictObject({\n /** An OpenAI secret API key (`sk-...`). Never logged or returned. */\n apiKey: v.pipe(v.string(), v.minLength(1)),\n});\n\nexport type SetAssistantModelKeyInput = v.InferInput<typeof SetAssistantModelKeyInputSchema>;\n\nexport const CompleteAssistantKeysInputSchema = v.strictObject({\n setupId: idInputSchema(\"setupId\"),\n});\n\nexport type CompleteAssistantKeysInput = v.InferInput<typeof CompleteAssistantKeysInputSchema>;\n\n/* ---------- outputs ---------- */\n\nfunction optionalId(id: bigint | undefined): string | undefined {\n return id ? formatId(id) : undefined;\n}\n\nexport function formatConversation(c: Proto.Conversation) {\n return {\n conversationId: formatId(c.conversationId),\n /** Empty until a title is available. */\n title: c.title,\n createdAt: tsObjToMs(c.createdAt),\n updatedAt: tsObjToMs(c.updatedAt),\n };\n}\n\nexport type AssistantConversation = ReturnType<typeof formatConversation>;\n\nexport function formatMessage(m: Proto.Message) {\n return {\n messageId: formatId(m.messageId),\n role: enumLabel(MessageRoleCodec.protoToOutput, m.role),\n /** Markdown. For an assistant message, its run's final text. */\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Replay this run with `watchRun` from `afterSeq: 0` to show its tool activity and views. */\n runId: formatId(m.runId),\n /** A user message's images, in the order sent; read each with `getMessageImage`. */\n images: m.images.map(formatMessageImage),\n };\n}\n\nexport function formatMessageImage(i: Proto.MessageImage) {\n return {\n imageId: formatId(i.imageId),\n /** `\"image/png\"`, `\"image/jpeg\"` or `\"image/webp\"`. */\n mimeType: i.mimeType,\n /** Pixels; an image over 2000 pixels on a side is stored scaled down to fit. */\n width: i.width,\n height: i.height,\n sizeBytes: i.sizeBytes,\n };\n}\n\nexport type AssistantMessageImage = ReturnType<typeof formatMessageImage>;\n\nexport type AssistantMessage = ReturnType<typeof formatMessage>;\n\nexport function formatMemory(m: Proto.Memory) {\n return {\n memoryId: formatId(m.memoryId),\n text: m.text,\n createdAt: tsObjToMs(m.createdAt),\n /** Omitted when the conversation it was learned in is unknown. */\n conversationId: optionalId(m.conversationId),\n kind: enumLabel(MemoryKindCodec.protoToOutput, m.kind),\n };\n}\n\nexport type AssistantMemory = ReturnType<typeof formatMemory>;\n\nexport function formatAssistantKey(k: Proto.AssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n keyId: k.keyId,\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n state: enumLabel(AssistantKeyStateCodec.protoToOutput, k.state),\n /**\n * The subaccount's name; only from `listKeys({ view: \"full\" })`. Empty for the main\n * account, an unnamed subaccount, or a name that could not be read.\n */\n label: k.label,\n };\n}\n\nexport const ListAssistantKeysInputSchema = v.pipe(\n v.strictObject({\n /** `\"full\"` adds each key's account name as `label`. */\n view: v.optional(v.picklist(ASSISTANT_KEY_VIEW_VALUES)),\n }),\n v.transform(({ view }) => ({\n view: view ? AssistantKeyViewCodec.inputToProto[view] : undefined,\n })),\n);\n\nexport type ListAssistantKeysInput = v.InferInput<typeof ListAssistantKeysInputSchema>;\n\nexport type AssistantKey = ReturnType<typeof formatAssistantKey>;\n\nexport function formatPreparedAssistantKey(k: Proto.PreparedAssistantKey) {\n return {\n /** Omitted for the main account. */\n subaccountId: optionalId(k.subaccountId),\n publicKeyEd25519: k.publicKeyEd25519,\n publicKeyHex: bytesToHex(k.publicKeyEd25519),\n /** Pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationProof: k.registrationProof,\n /** Epoch ms; pass unchanged to `apiKeys.setAssistantKeys`. */\n registrationDeadline: tsObjToMs(k.registrationDeadline),\n };\n}\n\nexport type PreparedAssistantKey = ReturnType<typeof formatPreparedAssistantKey>;\n\nexport function formatPrepareAssistantKeysResult(r: Proto.PrepareAssistantKeysResponse) {\n return {\n setupId: formatId(r.setupId),\n /** One key per requested account, in request order. */\n keys: r.keys.map(formatPreparedAssistantKey),\n /** Epoch ms after which the keys can no longer be registered. */\n expiresAt: tsObjToMs(r.expiresAt),\n };\n}\n\nexport type PrepareAssistantKeysResult = ReturnType<typeof formatPrepareAssistantKeysResult>;\n\n/** The caller's own OpenAI API key as the assistant shows it; the key itself is never returned. */\nexport function formatModelKey(k: Proto.ModelKey | undefined) {\n return {\n /** The key's last four characters, e.g. `\"x7Qa\"`. */\n suffix: k?.suffix ?? \"\",\n addedAt: tsObjToMs(k?.addedAt),\n /** The last check with OpenAI: on save, when OpenAI refused it in a run, and on recovery. */\n lastCheck: enumLabel(ModelKeyCheckCodec.protoToOutput, k?.lastCheck ?? 0),\n checkedAt: tsObjToMs(k?.checkedAt),\n };\n}\n\nexport type AssistantModelKey = ReturnType<typeof formatModelKey>;\n\n/** Credits are the main account's, shared by every subaccount. */\nexport function formatAssistantUsage(r: Proto.GetUsageResponse) {\n return {\n /** With `\"own_key\"`, messages use no credits. */\n fundingMode: FundingModeCodec.protoToOutput[r.fundingMode] ?? \"credits\",\n /** Omitted when the tier could not be read; VIP 0's free credits then apply. */\n vipTier: r.vipTier,\n /** Today's free credits. */\n freeCredits: Number(r.freeCredits),\n /** Rounded down; may exceed `freeCredits`, as an answer started with credits left finishes. */\n freeCreditsUsed: Number(r.freeCreditsUsed),\n freeCreditsLeft: Number(r.freeCreditsLeft),\n /** Epoch ms of the next 00:00 UTC; unused credits do not carry over. */\n resetsAt: tsObjToMs(r.resetsAt),\n /** The next VIP tier's daily free credits; omitted at the top tier or an unknown tier. */\n nextTier: r.nextTier && {\n vipTier: r.nextTier.vipTier,\n dailyFreeCredits: Number(r.nextTier.dailyFreeCredits),\n },\n };\n}\n\nexport type AssistantUsage = ReturnType<typeof formatAssistantUsage>;\n\n/** `nextPageToken` is empty when no more results exist. */\nexport type ListAssistantConversationsResult = {\n conversations: AssistantConversation[];\n nextPageToken: string;\n};\nexport type ListAssistantMessagesResult = { messages: AssistantMessage[]; nextPageToken: string };\nexport type ListAssistantMemoriesResult = { memories: AssistantMemory[]; nextPageToken: string };\n\n/** US dollars as a decimal string with at most 2 decimal places, e.g. `\"5000\"` or `\"250.50\"`. */\nconst UsdLimitInputSchema = v.pipe(\n v.string(),\n v.trim(),\n v.regex(/^\\d+(\\.\\d{1,2})?$/, \"limit must be US dollars with at most 2 decimal places\"),\n);\n\nexport const SetTelegramApprovalLimitsInputSchema = v.strictObject({\n /** Largest notional value of one approval from Telegram. `\"0\"` allows none; omit for no limit. */\n perApprovalUsd: v.optional(UsdLimitInputSchema),\n /** Largest total notional value approved from Telegram in any rolling 24 hours; omit for no limit. */\n dailyUsd: v.optional(UsdLimitInputSchema),\n});\n\nexport type SetTelegramApprovalLimitsInput = v.InferInput<\n typeof SetTelegramApprovalLimitsInputSchema\n>;\n\n/** Limits on what the caller may approve from Telegram, in US dollars; `null` is no limit. */\nexport type TelegramApprovalLimits = {\n perApprovalUsd: string | null;\n dailyUsd: string | null;\n};\n\nexport function formatTelegramApprovalLimits(\n limits: Proto.TelegramApprovalLimits | undefined,\n): TelegramApprovalLimits {\n return {\n perApprovalUsd: limits?.perApprovalUsd ?? null,\n dailyUsd: limits?.dailyUsd ?? null,\n };\n}\n"],"mappings":";;;;;;;;AAuBA,MAAM,uBAAuB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAExE,SAAS,iBAAiB,UAAkB;CACxC,OAAO;;EAEH,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,QAAQ,CAAC,CAAC;;EAEtF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;CACtD;AACJ;AAEA,MAAM,yBAAyB,EAAE,aAAa;;CAE1C,IAAI,EAAE,KACF,EAAE,OAAO,GACT,EAAE,MAAM,qBAAqB,4CAA4C,CAC7E;;CAEA,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;;CAEzD,aAAa,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,GAAG,CAAC,GAAG,EAAE;AACpE,CAAC;;;;;AAMD,MAAM,yBAAyB,EAAE,aAAa;;CAE1C,eAAe,EAAE,SACb,EAAE,KACE,EAAE,OAAO,GACT,EAAE,MAAM,qBAAqB,2CAA2C,CAC5E,CACJ;;CAEA,OAAO,EAAE,KACL,EAAE,OAAO,GACT,EAAE,MACE,kCACA,gFACJ,CACJ;;CAEA,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,EAAE,CAAC;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GACP,EAAE,MAAM,qBAAqB,wDAAwD,CACzF;AAEA,MAAa,uCAAuC,EAAE,aAAa;;CAE/D,gBAAgB,EAAE,SAAS,mBAAmB;;CAE9C,UAAU,EAAE,SAAS,mBAAmB;AAC5C,CAAC;AAYD,SAAgB,6BACZ,QACsB;CACtB,OAAO;EACH,gBAAgB,QAAQ,kBAAkB;EAC1C,UAAU,QAAQ,YAAY;CAClC;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AssistantApprovalPreview, AssistantOrderPreview, AssistantRunEvent, AssistantView } from "./assistant-events.schemas.js";
|
|
2
|
-
import { AssistantAccountSelection, AssistantApprovalDecision, AssistantApprovalStatus, AssistantDisplaySetting, AssistantFailureCategory, AssistantKeyState, AssistantKeyView, AssistantMemoryKind, AssistantMessageRole, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./assistant.codecs.js";
|
|
3
|
-
import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantRunIdInput, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput } from "./assistant.schemas.js";
|
|
4
|
-
export type { AssistantAccountSelection, AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantDisplaySetting, AssistantFailureCategory, AssistantKey, AssistantKeyState, AssistantKeyView, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageRole, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput };
|
|
2
|
+
import { AssistantAccountSelection, AssistantApprovalDecision, AssistantApprovalStatus, AssistantDisplaySetting, AssistantFailureCategory, AssistantFundingMode, AssistantKeyState, AssistantKeyView, AssistantMemoryKind, AssistantMessageRole, AssistantModelKeyCheck, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy } from "./assistant.codecs.js";
|
|
3
|
+
import { AssistantConversation, AssistantKey, AssistantMemory, AssistantMessage, AssistantMessageImage, AssistantModelKey, AssistantRunIdInput, AssistantUsage, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, GetAssistantMessageImageInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetAssistantModelKeyInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput } from "./assistant.schemas.js";
|
|
4
|
+
export type { AssistantAccountSelection, AssistantApprovalDecision, AssistantApprovalPreview, AssistantApprovalStatus, AssistantConversation, AssistantDisplaySetting, AssistantFailureCategory, AssistantFundingMode, AssistantKey, AssistantKeyState, AssistantKeyView, AssistantMemory, AssistantMemoryKind, AssistantMessage, AssistantMessageImage, AssistantMessageRole, AssistantModelKey, AssistantModelKeyCheck, AssistantOrderPreview, AssistantOrderPriceField, AssistantPriceOffsetDirection, AssistantPriceRounding, AssistantReferencePriceSource, AssistantRunEvent, AssistantRunIdInput, AssistantTriggerChangeAction, AssistantTriggerDirection, AssistantUnfilledSlicePolicy, AssistantUsage, AssistantView, CompleteAssistantKeysInput, DecideAssistantApprovalInput, DeleteAssistantMemoryInput, GetAssistantMessageImageInput, ListAssistantConversationsInput, ListAssistantConversationsResult, ListAssistantKeysInput, ListAssistantMemoriesInput, ListAssistantMemoriesResult, ListAssistantMessagesInput, ListAssistantMessagesResult, PrepareAssistantKeysInput, PrepareAssistantKeysResult, PreparedAssistantKey, SendAssistantMessageInput, SetAssistantModelKeyInput, SetTelegramApprovalLimitsInput, TelegramApprovalLimits, WatchAssistantRunInput };
|
|
@@ -17,7 +17,9 @@ type AutoWithdrawRunReason = "nothing_to_pay" | "price_unavailable" | "rule_supe
|
|
|
17
17
|
/** Why a step was skipped or failed. Unknown future reasons pass through as strings. */
|
|
18
18
|
type AutoWithdrawStepReason = "below_minimum" | "price_unavailable" | "rule_superseded" | "destination_not_whitelisted" | "destination_cooling_down" |
|
|
19
19
|
/** Withdrawals of the asset to the destination network are suspended; the funds stay for a later run. */
|
|
20
|
-
"route_suspended" |
|
|
20
|
+
"route_suspended" |
|
|
21
|
+
/** The destination route's Zipper `supplyStatus` is `missing` or `stale`; the funds stay for a later run. */
|
|
22
|
+
"supply_unavailable" | "authority_revoked" | "gateway_capacity_insufficient" | "withdrawal_released" | "withdrawal_failed" | (string & {});
|
|
21
23
|
/**
|
|
22
24
|
* Why part or all of an asset's balance would stay on the account in a previewed run. Unknown
|
|
23
25
|
* 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;;;;;;;;;KAoBA"}
|
|
@@ -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 /** 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
|
+
{"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 /** The destination route's Zipper `supplyStatus` is `missing` or `stale`; the funds stay for a later run. */\n | \"supply_unavailable\"\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"}
|
|
@@ -70,6 +70,7 @@ type AutoWithdrawScheduleInput = v.InferInput<typeof AutoWithdrawScheduleInputSc
|
|
|
70
70
|
*/
|
|
71
71
|
declare const AutoWithdrawDestinationInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
72
72
|
readonly assetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
73
|
+
/** Polyester chain ID of the network: a Zipper chain's `chainId`, not its `nativeChainId`. */
|
|
73
74
|
readonly destinationChainId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
74
75
|
readonly destinationAddress: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
75
76
|
readonly minAmount: v.StringSchema<undefined>;
|
|
@@ -139,6 +140,7 @@ declare const SetAutoWithdrawRuleInputSchema: v.SchemaWithPipe<readonly [v.Stric
|
|
|
139
140
|
}>]>;
|
|
140
141
|
readonly destinations: v.SchemaWithPipe<readonly [v.ArraySchema<v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
141
142
|
readonly assetId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
143
|
+
/** Polyester chain ID of the network: a Zipper chain's `chainId`, not its `nativeChainId`. */
|
|
142
144
|
readonly destinationChainId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>]>;
|
|
143
145
|
readonly destinationAddress: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
144
146
|
readonly minAmount: v.StringSchema<undefined>;
|
|
@@ -500,7 +502,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
500
502
|
readonly hi: v.BigintSchema<undefined>;
|
|
501
503
|
readonly lo: v.BigintSchema<undefined>;
|
|
502
504
|
}, undefined>, undefined>;
|
|
503
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "
|
|
505
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted">]>;
|
|
504
506
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
505
507
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
506
508
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -524,7 +526,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
524
526
|
hi: bigint;
|
|
525
527
|
lo: bigint;
|
|
526
528
|
} | undefined;
|
|
527
|
-
state: "unspecified" | "failed" | "
|
|
529
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
528
530
|
reason: AutoWithdrawStepReason | null;
|
|
529
531
|
intentId: string;
|
|
530
532
|
txHash: string;
|
|
@@ -538,7 +540,7 @@ declare const AutoWithdrawStepSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
538
540
|
txHash: string | null;
|
|
539
541
|
assetId: number;
|
|
540
542
|
destinationAddress: string;
|
|
541
|
-
state: "unspecified" | "failed" | "
|
|
543
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
542
544
|
reason: AutoWithdrawStepReason | null;
|
|
543
545
|
}>]>;
|
|
544
546
|
/**
|
|
@@ -581,7 +583,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
581
583
|
readonly hi: v.BigintSchema<undefined>;
|
|
582
584
|
readonly lo: v.BigintSchema<undefined>;
|
|
583
585
|
}, undefined>, undefined>;
|
|
584
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "
|
|
586
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted">]>;
|
|
585
587
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
586
588
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
587
589
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -605,7 +607,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
605
607
|
hi: bigint;
|
|
606
608
|
lo: bigint;
|
|
607
609
|
} | undefined;
|
|
608
|
-
state: "unspecified" | "failed" | "
|
|
610
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
609
611
|
reason: AutoWithdrawStepReason | null;
|
|
610
612
|
intentId: string;
|
|
611
613
|
txHash: string;
|
|
@@ -619,7 +621,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
619
621
|
txHash: string | null;
|
|
620
622
|
assetId: number;
|
|
621
623
|
destinationAddress: string;
|
|
622
|
-
state: "unspecified" | "failed" | "
|
|
624
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
623
625
|
reason: AutoWithdrawStepReason | null;
|
|
624
626
|
}>]>, undefined>;
|
|
625
627
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -652,7 +654,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
652
654
|
txHash: string | null;
|
|
653
655
|
assetId: number;
|
|
654
656
|
destinationAddress: string;
|
|
655
|
-
state: "unspecified" | "failed" | "
|
|
657
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
656
658
|
reason: AutoWithdrawStepReason | null;
|
|
657
659
|
}[];
|
|
658
660
|
createdAt: number;
|
|
@@ -674,7 +676,7 @@ declare const AutoWithdrawRunSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
674
676
|
txHash: string | null;
|
|
675
677
|
assetId: number;
|
|
676
678
|
destinationAddress: string;
|
|
677
|
-
state: "unspecified" | "failed" | "
|
|
679
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
678
680
|
reason: AutoWithdrawStepReason | null;
|
|
679
681
|
}[];
|
|
680
682
|
createdAt: number;
|
|
@@ -714,7 +716,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
714
716
|
readonly hi: v.BigintSchema<undefined>;
|
|
715
717
|
readonly lo: v.BigintSchema<undefined>;
|
|
716
718
|
}, undefined>, undefined>;
|
|
717
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "
|
|
719
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted">]>;
|
|
718
720
|
readonly reason: v.SchemaWithPipe<readonly [v.OptionalSchema<v.StringSchema<undefined>, "">, v.TransformAction<string, AutoWithdrawStepReason | null>]>;
|
|
719
721
|
readonly intentId: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
720
722
|
readonly txHash: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -738,7 +740,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
738
740
|
hi: bigint;
|
|
739
741
|
lo: bigint;
|
|
740
742
|
} | undefined;
|
|
741
|
-
state: "unspecified" | "failed" | "
|
|
743
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
742
744
|
reason: AutoWithdrawStepReason | null;
|
|
743
745
|
intentId: string;
|
|
744
746
|
txHash: string;
|
|
@@ -752,7 +754,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
752
754
|
txHash: string | null;
|
|
753
755
|
assetId: number;
|
|
754
756
|
destinationAddress: string;
|
|
755
|
-
state: "unspecified" | "failed" | "
|
|
757
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
756
758
|
reason: AutoWithdrawStepReason | null;
|
|
757
759
|
}>]>, undefined>;
|
|
758
760
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -785,7 +787,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
785
787
|
txHash: string | null;
|
|
786
788
|
assetId: number;
|
|
787
789
|
destinationAddress: string;
|
|
788
|
-
state: "unspecified" | "failed" | "
|
|
790
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
789
791
|
reason: AutoWithdrawStepReason | null;
|
|
790
792
|
}[];
|
|
791
793
|
createdAt: number;
|
|
@@ -807,7 +809,7 @@ declare const ListAutoWithdrawRunsResultSchema: v.ObjectSchema<{
|
|
|
807
809
|
txHash: string | null;
|
|
808
810
|
assetId: number;
|
|
809
811
|
destinationAddress: string;
|
|
810
|
-
state: "unspecified" | "failed" | "
|
|
812
|
+
state: "unspecified" | "failed" | "pending" | "completed" | "skipped" | "submitting" | "submitted";
|
|
811
813
|
reason: AutoWithdrawStepReason | null;
|
|
812
814
|
}[];
|
|
813
815
|
createdAt: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-withdraw.schemas.d.ts","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"mappings":";;;;;;cA0DM,0BAAwB,EAAA;;;;;KAElB,0BAA0B,EAAE,kBAAkB;;;;;;;cAiC7C,iCAA+B,EAAA,yBAAA,EAAA,0BAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkChC,4BAA4B,EAAE,kBAAkB;;;;;;cAOtD,oCAAkC,EAAA,yBAAA,EAAA
|
|
1
|
+
{"version":3,"file":"auto-withdraw.schemas.d.ts","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"mappings":";;;;;;cA0DM,0BAAwB,EAAA;;;;;KAElB,0BAA0B,EAAE,kBAAkB;;;;;;;cAiC7C,iCAA+B,EAAA,yBAAA,EAAA,0BAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkChC,4BAA4B,EAAE,kBAAkB;;;;;;cAOtD,oCAAkC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;gBAAA;;;;;KA+B5B,+BAA+B,EAAE,kBAAkB;cAElD,gCAA8B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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kCAAgC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMjC,6BAA6B,EAAE,mBAAmB;cAExD,gCAA8B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0CxB,2BAA2B,EAAE,mBAAmB;cAE/C,2BAAyB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAwB1B,sBAAsB,EAAE,mBAAmB"}
|
|
@@ -81,6 +81,7 @@ const AutoWithdrawScheduleInputSchema = v.pipe(v.variant("cadence", [
|
|
|
81
81
|
*/
|
|
82
82
|
const AutoWithdrawDestinationInputSchema = v.pipe(v.strictObject({
|
|
83
83
|
assetId: PositiveUint32InputSchema,
|
|
84
|
+
/** Polyester chain ID of the network: a Zipper chain's `chainId`, not its `nativeChainId`. */
|
|
84
85
|
destinationChainId: v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),
|
|
85
86
|
destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),
|
|
86
87
|
minAmount: v.string(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-withdraw.schemas.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport {\n decimalInputToScaled,\n E18_SCALE,\n scaledToDecimalOutput,\n} from \"../../shared/decimal-surface.js\";\nimport { ValidationError } from \"../../shared/errors.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdOrEmptySchema,\n TimestampMsSchema,\n U128Schema,\n} from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport {\n AUTO_WITHDRAW_WEEKDAY_VALUES,\n AutoWithdrawCadenceCodec,\n AutoWithdrawPreviewStatusCodec,\n AutoWithdrawRunStateCodec,\n AutoWithdrawStepStateCodec,\n AutoWithdrawWeekdayCodec,\n type AutoWithdrawHoldReason,\n type AutoWithdrawPauseReason,\n type AutoWithdrawRunReason,\n type AutoWithdrawStepReason,\n type AutoWithdrawWeekday,\n} from \"./auto-withdraw.codecs.js\";\n\nconst U128_MAX = (1n << 128n) - 1n;\n\n/** Decimal string → 18-decimal U128 integer, exact; throws `ValidationError`. */\nfunction decimalToE18(field: string, value: string): bigint {\n const scaled = decimalInputToScaled(field, value, E18_SCALE);\n if (scaled > U128_MAX) {\n throw new ValidationError(`${field} exceeds the maximum supported value: ${value}`);\n }\n return scaled;\n}\n\nfunction e18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string {\n return scaledToDecimalOutput(fromU128(value), E18_SCALE);\n}\n\n/** Unset means unknown, never zero. */\nfunction optionalE18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string | null {\n return value ? e18ToDecimal(value) : null;\n}\n\nconst AccountScopedInputSchema = v.strictObject({ ...AccountScopeInputEntries });\n\nexport type AutoWithdrawScopedInput = v.InferInput<typeof AccountScopedInputSchema>;\n\nexport const AutoWithdrawScopedInputSchema = v.pipe(\n AccountScopedInputSchema,\n v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })),\n);\n\nconst Uint32InputSchema = v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(PROTOBUF_UINT32_MAX),\n);\nconst MinuteOfDaySchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1439));\nconst MinuteOfHourSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(59));\nconst DayOfMonthSchema = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(31));\nconst WeekdaySchema = v.picklist(AUTO_WITHDRAW_WEEKDAY_VALUES);\nconst AnchorDateSchema = v.pipe(\n v.string(),\n v.trim(),\n v.isoDate(\"anchorDate must be a UTC date, YYYY-MM-DD\"),\n v.check((date) => {\n const parsed = new Date(`${date}T00:00:00Z`);\n return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(date);\n }, \"anchorDate must be a real calendar date\"),\n);\n\n/**\n * A rule's UTC run slot. Each cadence takes only its own fields; any other field is rejected.\n * `minuteOfDay` is minutes after 00:00 UTC (0–1439), `minuteOfHour` 0–59, `dayOfMonth` 1–31\n * (a shorter month runs on its last day), and `anchorDate` is a UTC date in a week a biweekly\n * rule runs.\n */\nexport const AutoWithdrawScheduleInputSchema = v.pipe(\n v.variant(\"cadence\", [\n v.strictObject({ cadence: v.literal(\"hourly\"), minuteOfHour: MinuteOfHourSchema }),\n v.strictObject({ cadence: v.literal(\"daily\"), minuteOfDay: MinuteOfDaySchema }),\n v.strictObject({\n cadence: v.literal(\"weekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n v.strictObject({\n cadence: v.literal(\"biweekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n anchorDate: AnchorDateSchema,\n }),\n v.strictObject({\n cadence: v.literal(\"monthly\"),\n dayOfMonth: DayOfMonthSchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n ]),\n v.transform((schedule) => ({\n cadence: AutoWithdrawCadenceCodec.inputToProto[schedule.cadence],\n weekday:\n \"weekday\" in schedule\n ? AutoWithdrawWeekdayCodec.inputToProto[schedule.weekday]\n : undefined,\n minuteOfDay: \"minuteOfDay\" in schedule ? schedule.minuteOfDay : undefined,\n minuteOfHour: \"minuteOfHour\" in schedule ? schedule.minuteOfHour : undefined,\n dayOfMonth: \"dayOfMonth\" in schedule ? schedule.dayOfMonth : undefined,\n anchorDate: \"anchorDate\" in schedule ? schedule.anchorDate : undefined,\n })),\n);\n\nexport type AutoWithdrawScheduleInput = v.InferInput<typeof AutoWithdrawScheduleInputSchema>;\n\n/**\n * One asset paid in kind to one whitelisted external-chain address. `minAmount` and\n * `maxAmount` are decimal asset amounts (up to 18 decimals); a run pays the balance up to\n * `maxAmount` once it reaches `minAmount`.\n */\nconst AutoWithdrawDestinationInputSchema = v.pipe(\n v.strictObject({\n assetId: PositiveUint32InputSchema,\n destinationChainId: v.pipe(\n v.number(),\n v.integer(),\n v.gtValue(0),\n v.maxValue(Number.MAX_SAFE_INTEGER),\n ),\n destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n minAmount: v.string(),\n maxAmount: v.string(),\n }),\n v.transform(({ minAmount, maxAmount, destinationChainId, ...destination }) => {\n const min = decimalToE18(\"minAmount\", minAmount);\n const max = decimalToE18(\"maxAmount\", maxAmount);\n if (max === 0n || max < min) {\n throw new ValidationError(\n `maxAmount must be greater than 0 and at least minAmount: ${maxAmount}`,\n );\n }\n return {\n ...destination,\n destinationChainId: BigInt(destinationChainId),\n minAmountE18: toU128(min),\n maxAmountE18: toU128(max),\n };\n }),\n);\n\nexport type AutoWithdrawDestinationInput = v.InferInput<typeof AutoWithdrawDestinationInputSchema>;\n\nexport const SetAutoWithdrawRuleInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The version this change replaces: 0 when the account has no rule yet. */\n expectedVersion: Uint32InputSchema,\n schedule: AutoWithdrawScheduleInputSchema,\n destinations: v.pipe(\n v.array(AutoWithdrawDestinationInputSchema),\n v.minLength(1, \"At least one destination is required.\"),\n v.maxLength(32, \"At most 32 destinations are allowed.\"),\n v.check(\n (destinations) =>\n new Set(destinations.map((d) => d.assetId)).size === destinations.length,\n \"At most one destination per asset is allowed.\",\n ),\n ),\n /** Least USD value one payout pays, as a decimal; omit or null for no USD minimum. */\n minUsdValue: v.optional(v.nullable(v.string())),\n }),\n v.transform(({ account, minUsdValue, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n minUsdValueE18:\n minUsdValue == null ? undefined : toU128(decimalToE18(\"minUsdValue\", minUsdValue)),\n })),\n);\n\nexport type SetAutoWithdrawRuleInput = v.InferInput<typeof SetAutoWithdrawRuleInputSchema>;\n\nexport const SetAutoWithdrawRuleEnabledInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The account's latest rule version. */\n expectedVersion: Uint32InputSchema,\n /** `false` pauses the rule; `true` resumes it. */\n enabled: v.boolean(),\n }),\n v.transform(({ account, expectedVersion, enabled }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n expectedVersion,\n enabled,\n })),\n);\n\nexport type SetAutoWithdrawRuleEnabledInput = v.InferInput<\n typeof SetAutoWithdrawRuleEnabledInputSchema\n>;\n\n/** `limit` is 0 through 100; 0 or omitted uses the server default of 20. */\nexport const ListAutoWithdrawRunsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), 0),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListAutoWithdrawRunsInput = v.InferInput<typeof ListAutoWithdrawRunsInputSchema>;\n\ntype ScheduleShape<Weekday> =\n | { cadence: \"hourly\"; minuteOfHour: number }\n | { cadence: \"daily\"; minuteOfDay: number }\n | { cadence: \"weekly\"; weekday: Weekday; minuteOfDay: number }\n | { cadence: \"biweekly\"; weekday: Weekday; minuteOfDay: number; anchorDate: string }\n | { cadence: \"monthly\"; dayOfMonth: number; minuteOfDay: number };\n\n/** A decoded schedule. A cadence this SDK build does not know decodes as `\"unspecified\"`. */\nexport type AutoWithdrawSchedule =\n | ScheduleShape<DecodedEnum<AutoWithdrawWeekday>>\n | { cadence: \"unspecified\" };\n\nconst AutoWithdrawScheduleSchema = v.pipe(\n v.object({\n cadence: v.optional(v.number(), 0),\n weekday: v.optional(v.number(), 0),\n minuteOfDay: v.optional(v.number(), 0),\n minuteOfHour: v.optional(v.number(), 0),\n dayOfMonth: v.optional(v.number(), 0),\n anchorDate: v.optional(v.string(), \"\"),\n }),\n v.transform((s): AutoWithdrawSchedule => {\n const weekday = enumLabel(AutoWithdrawWeekdayCodec.protoToOutput, s.weekday);\n const { minuteOfDay } = s;\n switch (s.cadence) {\n case Proto.AutoWithdrawCadence.HOURLY:\n return { cadence: \"hourly\", minuteOfHour: s.minuteOfHour };\n case Proto.AutoWithdrawCadence.DAILY:\n return { cadence: \"daily\", minuteOfDay };\n case Proto.AutoWithdrawCadence.WEEKLY:\n return { cadence: \"weekly\", weekday, minuteOfDay };\n case Proto.AutoWithdrawCadence.BIWEEKLY:\n return { cadence: \"biweekly\", weekday, minuteOfDay, anchorDate: s.anchorDate };\n case Proto.AutoWithdrawCadence.MONTHLY:\n return { cadence: \"monthly\", dayOfMonth: s.dayOfMonth, minuteOfDay };\n default:\n return { cadence: \"unspecified\" };\n }\n }),\n);\n\nfunction reasonSchema<TReason extends string>() {\n return v.pipe(\n v.optional(v.string(), \"\"),\n v.transform((reason) => (reason ? (reason as TReason) : null)),\n );\n}\n\nconst AutoWithdrawDestinationSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n minAmountE18: v.optional(U128Schema),\n maxAmountE18: v.optional(U128Schema),\n minFloorE18: v.optional(U128Schema),\n }),\n v.transform(\n ({ minAmountE18, maxAmountE18, minFloorE18, destinationChainId, ...destination }) => ({\n ...destination,\n destinationChainId: Number(destinationChainId),\n minAmount: e18ToDecimal(minAmountE18),\n maxAmount: e18ToDecimal(maxAmountE18),\n minFloor: optionalE18ToDecimal(minFloorE18),\n }),\n ),\n);\n\n/**\n * `minFloor` is the least one payout to the destination can pay now (the route's withdrawal\n * minimum, above its current network fee); a new rule's `minAmount` must be at least this\n * floor. It follows the network fee, and is null when the route or fee is unknown: show no\n * floor then, not zero.\n */\nexport type AutoWithdrawDestination = v.InferOutput<typeof AutoWithdrawDestinationSchema>;\n\nconst AutoWithdrawPauseSchema = v.object({\n assetId: v.number(),\n reason: v.pipe(\n v.string(),\n v.transform((reason) => reason as AutoWithdrawPauseReason),\n ),\n pausedAt: TimestampMsSchema,\n});\n\nexport type AutoWithdrawPause = v.InferOutput<typeof AutoWithdrawPauseSchema>;\n\nexport const AutoWithdrawRuleSchema = v.pipe(\n v.object({\n subaccountId: v.optional(PublicIdOrEmptySchema, 0n),\n version: v.number(),\n enabled: v.boolean(),\n schedule: v.optional(AutoWithdrawScheduleSchema),\n destinations: v.array(AutoWithdrawDestinationSchema),\n createdAt: TimestampMsSchema,\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n createdByAccountId: v.optional(PublicIdOrEmptySchema, 0n),\n }),\n v.transform(({ schedule, pause, minUsdValueE18, ...rule }) => ({\n ...rule,\n schedule: schedule ?? ({ cadence: \"unspecified\" } as AutoWithdrawSchedule),\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * One version of an account's rule. `subaccountId` is the public subaccount ID, `\"\"` for the\n * root account; `createdByAccountId` is the public account ID of whoever created the version.\n * Times are epoch milliseconds. `minUsdValue` is null when the rule has no USD minimum. A paused\n * version (`enabled: false`) keeps its schedule and destinations. `pause` is set when the rule\n * paused itself; resuming it or setting a new rule clears it. The rule runs only while\n * `enabled` is true and `pause` is null.\n */\nexport type AutoWithdrawRule = v.InferOutput<typeof AutoWithdrawRuleSchema>;\n\nconst AutoWithdrawStepSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n availableE18: v.optional(U128Schema),\n amountE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n networkFeeE18: v.optional(U128Schema),\n state: enumLabelSchema(AutoWithdrawStepStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawStepReason>(),\n intentId: v.optional(v.string(), \"\"),\n txHash: v.optional(v.string(), \"\"),\n }),\n v.transform(\n ({\n availableE18,\n amountE18,\n valueUsdE18,\n networkFeeE18,\n destinationChainId,\n intentId,\n txHash,\n ...step\n }) => ({\n ...step,\n destinationChainId: Number(destinationChainId),\n available: e18ToDecimal(availableE18),\n amount: e18ToDecimal(amountE18),\n valueUsd: valueUsdE18 ? e18ToDecimal(valueUsdE18) : null,\n networkFee: optionalE18ToDecimal(networkFeeE18),\n intentId: intentId || null,\n txHash: txHash || null,\n }),\n ),\n);\n\n/**\n * One asset's payout in a run. `available`, `amount` and `valueUsd` are decimal strings;\n * `valueUsd` is null when the rule has no USD minimum or no price was available. `networkFee`\n * is the fee charged on the withdrawal: once completed it was taken out of `amount`; once\n * rejected or failed it is the fee kept, not refunded. It is null until the step is final, when\n * the step never reached the withdrawal, or when the fee was not reported.\n */\nexport type AutoWithdrawStep = v.InferOutput<typeof AutoWithdrawStepSchema>;\n\nconst AutoWithdrawRunSchema = v.pipe(\n v.object({\n runSeq: BigIntStringSchema,\n ruleVersion: v.number(),\n scheduledFor: TimestampMsSchema,\n state: enumLabelSchema(AutoWithdrawRunStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawRunReason>(),\n steps: v.array(AutoWithdrawStepSchema),\n createdAt: TimestampMsSchema,\n finishedAt: OptionalTimestampMsSchema,\n }),\n v.transform(({ finishedAt, ...run }) => ({ ...run, finishedAt: finishedAt ?? null })),\n);\n\n/** One scheduled run. Times are epoch milliseconds; `finishedAt` is null while in progress. */\nexport type AutoWithdrawRun = v.InferOutput<typeof AutoWithdrawRunSchema>;\n\nexport const ListAutoWithdrawRunsResultSchema = v.object({\n runs: v.array(AutoWithdrawRunSchema),\n nextPageToken: v.optional(v.string(), \"\"),\n});\n\n/** One page of runs, newest first. An empty `nextPageToken` means no more runs. */\nexport type ListAutoWithdrawRunsResult = v.InferOutput<typeof ListAutoWithdrawRunsResultSchema>;\n\nconst AutoWithdrawPreviewAssetSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.optional(v.bigint(), 0n),\n destinationAddress: v.optional(v.string(), \"\"),\n availableE18: v.optional(U128Schema),\n payableE18: v.optional(U128Schema),\n heldBackE18: v.optional(U128Schema),\n holdReason: reasonSchema<AutoWithdrawHoldReason>(),\n minimumE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n pricedAt: OptionalTimestampMsSchema,\n networkFeeE18: v.optional(U128Schema),\n networkFeeSampledAt: OptionalTimestampMsSchema,\n payableFrom: OptionalTimestampMsSchema,\n }),\n v.transform((asset) => ({\n assetId: asset.assetId,\n destinationChainId:\n asset.destinationChainId === 0n ? null : Number(asset.destinationChainId),\n destinationAddress: asset.destinationAddress || null,\n available: e18ToDecimal(asset.availableE18),\n payable: e18ToDecimal(asset.payableE18),\n heldBack: e18ToDecimal(asset.heldBackE18),\n holdReason: asset.holdReason,\n minimum: optionalE18ToDecimal(asset.minimumE18),\n valueUsd: optionalE18ToDecimal(asset.valueUsdE18),\n pricedAt: asset.pricedAt ?? null,\n networkFee: optionalE18ToDecimal(asset.networkFeeE18),\n networkFeeSampledAt: asset.networkFeeSampledAt ?? null,\n payableFrom: asset.payableFrom ?? null,\n })),\n);\n\n/**\n * What the next run would do with one asset, sized from the balance now. Amounts are decimal\n * strings; `heldBack` is `available` minus `payable`, and `holdReason` says why it stays (null\n * when the whole balance pays). `destinationChainId` and `destinationAddress` are null for an\n * asset the rule pays nowhere. `minimum`, `valueUsd`, `networkFee` and their times are null\n * when unknown, never zero. `payableFrom` is set only while a broker vault's destination cools\n * down. Times are epoch milliseconds.\n */\nexport type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;\n\nexport const AutoWithdrawPreviewSchema = v.pipe(\n v.object({\n status: enumLabelSchema(AutoWithdrawPreviewStatusCodec.protoToOutput),\n nextRunAt: OptionalTimestampMsSchema,\n ruleVersion: v.optional(v.number(), 0),\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n assets: v.array(AutoWithdrawPreviewAssetSchema),\n computedAt: TimestampMsSchema,\n }),\n v.transform(({ nextRunAt, pause, minUsdValueE18, ...preview }) => ({\n ...preview,\n nextRunAt: nextRunAt ?? null,\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * The account's next run as it would go now; balances, prices and fees can change before\n * `nextRunAt`. `nextRunAt` is null without a rule or while it is paused; `ruleVersion` is 0\n * without a rule. `pause` is set only when the rule paused itself. `minUsdValue` is null when\n * there is no USD minimum. Times are epoch milliseconds.\n */\nexport type AutoWithdrawPreview = v.InferOutput<typeof AutoWithdrawPreviewSchema>;\n"],"mappings":";;;;;;;;;;;;AAsCA,MAAM,YAAY,MAAM,QAAQ;;AAGhC,SAAS,aAAa,OAAe,OAAuB;CACxD,MAAM,SAAS,qBAAqB,OAAO,OAAA,EAAgB;CAC3D,IAAI,SAAS,UACT,MAAM,IAAI,gBAAgB,GAAG,MAAM,wCAAwC,OAAO;CAEtF,OAAO;AACX;AAEA,SAAS,aAAa,OAA6D;CAC/E,OAAO,sBAAsB,SAAS,KAAK,GAAA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AS,aAAa,MAAM,UAAU;CACtC,UAAU,aAAa,MAAM,WAAW;CACxC,YAAY,MAAM;CAClB,SAAS,qBAAqB,MAAM,UAAU;CAC9C,UAAU,qBAAqB,MAAM,WAAW;CAChD,UAAU,MAAM,YAAY;CAC5B,YAAY,qBAAqB,MAAM,aAAa;CACpD,qBAAqB,MAAM,uBAAuB;CAClD,aAAa,MAAM,eAAe;AACtC,EAAE,CACN;AAYA,MAAa,4BAA4B,EAAE,KACvC,EAAE,OAAO;CACL,QAAQ,gBAAgB,+BAA+B,aAAa;CACpE,WAAW;CACX,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,CAAC;CACrC,OAAO,EAAE,SAAS,uBAAuB;CACzC,gBAAgB,EAAE,SAAS,UAAU;CACrC,QAAQ,EAAE,MAAM,8BAA8B;CAC9C,YAAY;AAChB,CAAC,GACD,EAAE,WAAW,EAAE,WAAW,OAAO,gBAAgB,GAAG,eAAe;CAC/D,GAAG;CACH,WAAW,aAAa;CACxB,OAAO,SAAS;CAChB,aAAa,SAAS,cAAc,MAAM,KAAK,OAAO,aAAa,cAAc;AACrF,EAAE,CACN"}
|
|
1
|
+
{"version":3,"file":"auto-withdraw.schemas.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport {\n decimalInputToScaled,\n E18_SCALE,\n scaledToDecimalOutput,\n} from \"../../shared/decimal-surface.js\";\nimport { ValidationError } from \"../../shared/errors.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdOrEmptySchema,\n TimestampMsSchema,\n U128Schema,\n} from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport {\n AUTO_WITHDRAW_WEEKDAY_VALUES,\n AutoWithdrawCadenceCodec,\n AutoWithdrawPreviewStatusCodec,\n AutoWithdrawRunStateCodec,\n AutoWithdrawStepStateCodec,\n AutoWithdrawWeekdayCodec,\n type AutoWithdrawHoldReason,\n type AutoWithdrawPauseReason,\n type AutoWithdrawRunReason,\n type AutoWithdrawStepReason,\n type AutoWithdrawWeekday,\n} from \"./auto-withdraw.codecs.js\";\n\nconst U128_MAX = (1n << 128n) - 1n;\n\n/** Decimal string → 18-decimal U128 integer, exact; throws `ValidationError`. */\nfunction decimalToE18(field: string, value: string): bigint {\n const scaled = decimalInputToScaled(field, value, E18_SCALE);\n if (scaled > U128_MAX) {\n throw new ValidationError(`${field} exceeds the maximum supported value: ${value}`);\n }\n return scaled;\n}\n\nfunction e18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string {\n return scaledToDecimalOutput(fromU128(value), E18_SCALE);\n}\n\n/** Unset means unknown, never zero. */\nfunction optionalE18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string | null {\n return value ? e18ToDecimal(value) : null;\n}\n\nconst AccountScopedInputSchema = v.strictObject({ ...AccountScopeInputEntries });\n\nexport type AutoWithdrawScopedInput = v.InferInput<typeof AccountScopedInputSchema>;\n\nexport const AutoWithdrawScopedInputSchema = v.pipe(\n AccountScopedInputSchema,\n v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })),\n);\n\nconst Uint32InputSchema = v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(PROTOBUF_UINT32_MAX),\n);\nconst MinuteOfDaySchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1439));\nconst MinuteOfHourSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(59));\nconst DayOfMonthSchema = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(31));\nconst WeekdaySchema = v.picklist(AUTO_WITHDRAW_WEEKDAY_VALUES);\nconst AnchorDateSchema = v.pipe(\n v.string(),\n v.trim(),\n v.isoDate(\"anchorDate must be a UTC date, YYYY-MM-DD\"),\n v.check((date) => {\n const parsed = new Date(`${date}T00:00:00Z`);\n return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(date);\n }, \"anchorDate must be a real calendar date\"),\n);\n\n/**\n * A rule's UTC run slot. Each cadence takes only its own fields; any other field is rejected.\n * `minuteOfDay` is minutes after 00:00 UTC (0–1439), `minuteOfHour` 0–59, `dayOfMonth` 1–31\n * (a shorter month runs on its last day), and `anchorDate` is a UTC date in a week a biweekly\n * rule runs.\n */\nexport const AutoWithdrawScheduleInputSchema = v.pipe(\n v.variant(\"cadence\", [\n v.strictObject({ cadence: v.literal(\"hourly\"), minuteOfHour: MinuteOfHourSchema }),\n v.strictObject({ cadence: v.literal(\"daily\"), minuteOfDay: MinuteOfDaySchema }),\n v.strictObject({\n cadence: v.literal(\"weekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n v.strictObject({\n cadence: v.literal(\"biweekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n anchorDate: AnchorDateSchema,\n }),\n v.strictObject({\n cadence: v.literal(\"monthly\"),\n dayOfMonth: DayOfMonthSchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n ]),\n v.transform((schedule) => ({\n cadence: AutoWithdrawCadenceCodec.inputToProto[schedule.cadence],\n weekday:\n \"weekday\" in schedule\n ? AutoWithdrawWeekdayCodec.inputToProto[schedule.weekday]\n : undefined,\n minuteOfDay: \"minuteOfDay\" in schedule ? schedule.minuteOfDay : undefined,\n minuteOfHour: \"minuteOfHour\" in schedule ? schedule.minuteOfHour : undefined,\n dayOfMonth: \"dayOfMonth\" in schedule ? schedule.dayOfMonth : undefined,\n anchorDate: \"anchorDate\" in schedule ? schedule.anchorDate : undefined,\n })),\n);\n\nexport type AutoWithdrawScheduleInput = v.InferInput<typeof AutoWithdrawScheduleInputSchema>;\n\n/**\n * One asset paid in kind to one whitelisted external-chain address. `minAmount` and\n * `maxAmount` are decimal asset amounts (up to 18 decimals); a run pays the balance up to\n * `maxAmount` once it reaches `minAmount`.\n */\nconst AutoWithdrawDestinationInputSchema = v.pipe(\n v.strictObject({\n assetId: PositiveUint32InputSchema,\n /** Polyester chain ID of the network: a Zipper chain's `chainId`, not its `nativeChainId`. */\n destinationChainId: v.pipe(\n v.number(),\n v.integer(),\n v.gtValue(0),\n v.maxValue(Number.MAX_SAFE_INTEGER),\n ),\n destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n minAmount: v.string(),\n maxAmount: v.string(),\n }),\n v.transform(({ minAmount, maxAmount, destinationChainId, ...destination }) => {\n const min = decimalToE18(\"minAmount\", minAmount);\n const max = decimalToE18(\"maxAmount\", maxAmount);\n if (max === 0n || max < min) {\n throw new ValidationError(\n `maxAmount must be greater than 0 and at least minAmount: ${maxAmount}`,\n );\n }\n return {\n ...destination,\n destinationChainId: BigInt(destinationChainId),\n minAmountE18: toU128(min),\n maxAmountE18: toU128(max),\n };\n }),\n);\n\nexport type AutoWithdrawDestinationInput = v.InferInput<typeof AutoWithdrawDestinationInputSchema>;\n\nexport const SetAutoWithdrawRuleInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The version this change replaces: 0 when the account has no rule yet. */\n expectedVersion: Uint32InputSchema,\n schedule: AutoWithdrawScheduleInputSchema,\n destinations: v.pipe(\n v.array(AutoWithdrawDestinationInputSchema),\n v.minLength(1, \"At least one destination is required.\"),\n v.maxLength(32, \"At most 32 destinations are allowed.\"),\n v.check(\n (destinations) =>\n new Set(destinations.map((d) => d.assetId)).size === destinations.length,\n \"At most one destination per asset is allowed.\",\n ),\n ),\n /** Least USD value one payout pays, as a decimal; omit or null for no USD minimum. */\n minUsdValue: v.optional(v.nullable(v.string())),\n }),\n v.transform(({ account, minUsdValue, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n minUsdValueE18:\n minUsdValue == null ? undefined : toU128(decimalToE18(\"minUsdValue\", minUsdValue)),\n })),\n);\n\nexport type SetAutoWithdrawRuleInput = v.InferInput<typeof SetAutoWithdrawRuleInputSchema>;\n\nexport const SetAutoWithdrawRuleEnabledInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The account's latest rule version. */\n expectedVersion: Uint32InputSchema,\n /** `false` pauses the rule; `true` resumes it. */\n enabled: v.boolean(),\n }),\n v.transform(({ account, expectedVersion, enabled }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n expectedVersion,\n enabled,\n })),\n);\n\nexport type SetAutoWithdrawRuleEnabledInput = v.InferInput<\n typeof SetAutoWithdrawRuleEnabledInputSchema\n>;\n\n/** `limit` is 0 through 100; 0 or omitted uses the server default of 20. */\nexport const ListAutoWithdrawRunsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), 0),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListAutoWithdrawRunsInput = v.InferInput<typeof ListAutoWithdrawRunsInputSchema>;\n\ntype ScheduleShape<Weekday> =\n | { cadence: \"hourly\"; minuteOfHour: number }\n | { cadence: \"daily\"; minuteOfDay: number }\n | { cadence: \"weekly\"; weekday: Weekday; minuteOfDay: number }\n | { cadence: \"biweekly\"; weekday: Weekday; minuteOfDay: number; anchorDate: string }\n | { cadence: \"monthly\"; dayOfMonth: number; minuteOfDay: number };\n\n/** A decoded schedule. A cadence this SDK build does not know decodes as `\"unspecified\"`. */\nexport type AutoWithdrawSchedule =\n | ScheduleShape<DecodedEnum<AutoWithdrawWeekday>>\n | { cadence: \"unspecified\" };\n\nconst AutoWithdrawScheduleSchema = v.pipe(\n v.object({\n cadence: v.optional(v.number(), 0),\n weekday: v.optional(v.number(), 0),\n minuteOfDay: v.optional(v.number(), 0),\n minuteOfHour: v.optional(v.number(), 0),\n dayOfMonth: v.optional(v.number(), 0),\n anchorDate: v.optional(v.string(), \"\"),\n }),\n v.transform((s): AutoWithdrawSchedule => {\n const weekday = enumLabel(AutoWithdrawWeekdayCodec.protoToOutput, s.weekday);\n const { minuteOfDay } = s;\n switch (s.cadence) {\n case Proto.AutoWithdrawCadence.HOURLY:\n return { cadence: \"hourly\", minuteOfHour: s.minuteOfHour };\n case Proto.AutoWithdrawCadence.DAILY:\n return { cadence: \"daily\", minuteOfDay };\n case Proto.AutoWithdrawCadence.WEEKLY:\n return { cadence: \"weekly\", weekday, minuteOfDay };\n case Proto.AutoWithdrawCadence.BIWEEKLY:\n return { cadence: \"biweekly\", weekday, minuteOfDay, anchorDate: s.anchorDate };\n case Proto.AutoWithdrawCadence.MONTHLY:\n return { cadence: \"monthly\", dayOfMonth: s.dayOfMonth, minuteOfDay };\n default:\n return { cadence: \"unspecified\" };\n }\n }),\n);\n\nfunction reasonSchema<TReason extends string>() {\n return v.pipe(\n v.optional(v.string(), \"\"),\n v.transform((reason) => (reason ? (reason as TReason) : null)),\n );\n}\n\nconst AutoWithdrawDestinationSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n minAmountE18: v.optional(U128Schema),\n maxAmountE18: v.optional(U128Schema),\n minFloorE18: v.optional(U128Schema),\n }),\n v.transform(\n ({ minAmountE18, maxAmountE18, minFloorE18, destinationChainId, ...destination }) => ({\n ...destination,\n destinationChainId: Number(destinationChainId),\n minAmount: e18ToDecimal(minAmountE18),\n maxAmount: e18ToDecimal(maxAmountE18),\n minFloor: optionalE18ToDecimal(minFloorE18),\n }),\n ),\n);\n\n/**\n * `minFloor` is the least one payout to the destination can pay now (the route's withdrawal\n * minimum, above its current network fee); a new rule's `minAmount` must be at least this\n * floor. It follows the network fee, and is null when the route or fee is unknown: show no\n * floor then, not zero.\n */\nexport type AutoWithdrawDestination = v.InferOutput<typeof AutoWithdrawDestinationSchema>;\n\nconst AutoWithdrawPauseSchema = v.object({\n assetId: v.number(),\n reason: v.pipe(\n v.string(),\n v.transform((reason) => reason as AutoWithdrawPauseReason),\n ),\n pausedAt: TimestampMsSchema,\n});\n\nexport type AutoWithdrawPause = v.InferOutput<typeof AutoWithdrawPauseSchema>;\n\nexport const AutoWithdrawRuleSchema = v.pipe(\n v.object({\n subaccountId: v.optional(PublicIdOrEmptySchema, 0n),\n version: v.number(),\n enabled: v.boolean(),\n schedule: v.optional(AutoWithdrawScheduleSchema),\n destinations: v.array(AutoWithdrawDestinationSchema),\n createdAt: TimestampMsSchema,\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n createdByAccountId: v.optional(PublicIdOrEmptySchema, 0n),\n }),\n v.transform(({ schedule, pause, minUsdValueE18, ...rule }) => ({\n ...rule,\n schedule: schedule ?? ({ cadence: \"unspecified\" } as AutoWithdrawSchedule),\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * One version of an account's rule. `subaccountId` is the public subaccount ID, `\"\"` for the\n * root account; `createdByAccountId` is the public account ID of whoever created the version.\n * Times are epoch milliseconds. `minUsdValue` is null when the rule has no USD minimum. A paused\n * version (`enabled: false`) keeps its schedule and destinations. `pause` is set when the rule\n * paused itself; resuming it or setting a new rule clears it. The rule runs only while\n * `enabled` is true and `pause` is null.\n */\nexport type AutoWithdrawRule = v.InferOutput<typeof AutoWithdrawRuleSchema>;\n\nconst AutoWithdrawStepSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n availableE18: v.optional(U128Schema),\n amountE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n networkFeeE18: v.optional(U128Schema),\n state: enumLabelSchema(AutoWithdrawStepStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawStepReason>(),\n intentId: v.optional(v.string(), \"\"),\n txHash: v.optional(v.string(), \"\"),\n }),\n v.transform(\n ({\n availableE18,\n amountE18,\n valueUsdE18,\n networkFeeE18,\n destinationChainId,\n intentId,\n txHash,\n ...step\n }) => ({\n ...step,\n destinationChainId: Number(destinationChainId),\n available: e18ToDecimal(availableE18),\n amount: e18ToDecimal(amountE18),\n valueUsd: valueUsdE18 ? e18ToDecimal(valueUsdE18) : null,\n networkFee: optionalE18ToDecimal(networkFeeE18),\n intentId: intentId || null,\n txHash: txHash || null,\n }),\n ),\n);\n\n/**\n * One asset's payout in a run. `available`, `amount` and `valueUsd` are decimal strings;\n * `valueUsd` is null when the rule has no USD minimum or no price was available. `networkFee`\n * is the fee charged on the withdrawal: once completed it was taken out of `amount`; once\n * rejected or failed it is the fee kept, not refunded. It is null until the step is final, when\n * the step never reached the withdrawal, or when the fee was not reported.\n */\nexport type AutoWithdrawStep = v.InferOutput<typeof AutoWithdrawStepSchema>;\n\nconst AutoWithdrawRunSchema = v.pipe(\n v.object({\n runSeq: BigIntStringSchema,\n ruleVersion: v.number(),\n scheduledFor: TimestampMsSchema,\n state: enumLabelSchema(AutoWithdrawRunStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawRunReason>(),\n steps: v.array(AutoWithdrawStepSchema),\n createdAt: TimestampMsSchema,\n finishedAt: OptionalTimestampMsSchema,\n }),\n v.transform(({ finishedAt, ...run }) => ({ ...run, finishedAt: finishedAt ?? null })),\n);\n\n/** One scheduled run. Times are epoch milliseconds; `finishedAt` is null while in progress. */\nexport type AutoWithdrawRun = v.InferOutput<typeof AutoWithdrawRunSchema>;\n\nexport const ListAutoWithdrawRunsResultSchema = v.object({\n runs: v.array(AutoWithdrawRunSchema),\n nextPageToken: v.optional(v.string(), \"\"),\n});\n\n/** One page of runs, newest first. An empty `nextPageToken` means no more runs. */\nexport type ListAutoWithdrawRunsResult = v.InferOutput<typeof ListAutoWithdrawRunsResultSchema>;\n\nconst AutoWithdrawPreviewAssetSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.optional(v.bigint(), 0n),\n destinationAddress: v.optional(v.string(), \"\"),\n availableE18: v.optional(U128Schema),\n payableE18: v.optional(U128Schema),\n heldBackE18: v.optional(U128Schema),\n holdReason: reasonSchema<AutoWithdrawHoldReason>(),\n minimumE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n pricedAt: OptionalTimestampMsSchema,\n networkFeeE18: v.optional(U128Schema),\n networkFeeSampledAt: OptionalTimestampMsSchema,\n payableFrom: OptionalTimestampMsSchema,\n }),\n v.transform((asset) => ({\n assetId: asset.assetId,\n destinationChainId:\n asset.destinationChainId === 0n ? null : Number(asset.destinationChainId),\n destinationAddress: asset.destinationAddress || null,\n available: e18ToDecimal(asset.availableE18),\n payable: e18ToDecimal(asset.payableE18),\n heldBack: e18ToDecimal(asset.heldBackE18),\n holdReason: asset.holdReason,\n minimum: optionalE18ToDecimal(asset.minimumE18),\n valueUsd: optionalE18ToDecimal(asset.valueUsdE18),\n pricedAt: asset.pricedAt ?? null,\n networkFee: optionalE18ToDecimal(asset.networkFeeE18),\n networkFeeSampledAt: asset.networkFeeSampledAt ?? null,\n payableFrom: asset.payableFrom ?? null,\n })),\n);\n\n/**\n * What the next run would do with one asset, sized from the balance now. Amounts are decimal\n * strings; `heldBack` is `available` minus `payable`, and `holdReason` says why it stays (null\n * when the whole balance pays). `destinationChainId` and `destinationAddress` are null for an\n * asset the rule pays nowhere. `minimum`, `valueUsd`, `networkFee` and their times are null\n * when unknown, never zero. `payableFrom` is set only while a broker vault's destination cools\n * down. Times are epoch milliseconds.\n */\nexport type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;\n\nexport const AutoWithdrawPreviewSchema = v.pipe(\n v.object({\n status: enumLabelSchema(AutoWithdrawPreviewStatusCodec.protoToOutput),\n nextRunAt: OptionalTimestampMsSchema,\n ruleVersion: v.optional(v.number(), 0),\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n assets: v.array(AutoWithdrawPreviewAssetSchema),\n computedAt: TimestampMsSchema,\n }),\n v.transform(({ nextRunAt, pause, minUsdValueE18, ...preview }) => ({\n ...preview,\n nextRunAt: nextRunAt ?? null,\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * The account's next run as it would go now; balances, prices and fees can change before\n * `nextRunAt`. `nextRunAt` is null without a rule or while it is paused; `ruleVersion` is 0\n * without a rule. `pause` is set only when the rule paused itself. `minUsdValue` is null when\n * there is no USD minimum. Times are epoch milliseconds.\n */\nexport type AutoWithdrawPreview = v.InferOutput<typeof AutoWithdrawPreviewSchema>;\n"],"mappings":";;;;;;;;;;;;AAsCA,MAAM,YAAY,MAAM,QAAQ;;AAGhC,SAAS,aAAa,OAAe,OAAuB;CACxD,MAAM,SAAS,qBAAqB,OAAO,OAAA,EAAgB;CAC3D,IAAI,SAAS,UACT,MAAM,IAAI,gBAAgB,GAAG,MAAM,wCAAwC,OAAO;CAEtF,OAAO;AACX;AAEA,SAAS,aAAa,OAA6D;CAC/E,OAAO,sBAAsB,SAAS,KAAK,GAAA,EAAY;AAC3D;;AAGA,SAAS,qBAAqB,OAAoE;CAC9F,OAAO,QAAQ,aAAa,KAAK,IAAI;AACzC;AAEA,MAAM,2BAA2B,EAAE,aAAa,EAAE,GAAG,yBAAyB,CAAC;AAI/E,MAAa,gCAAgC,EAAE,KAC3C,0BACA,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,2BAA2B,OAAO,EAAE,EAAE,CACxF;AAEA,MAAM,oBAAoB,EAAE,KACxB,EAAE,OAAO,GACT,EAAE,QAAQ,GACV,EAAE,SAAS,CAAC,GACZ,EAAE,S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