@polyester/sdk 0.30.2 → 0.32.0-devnet-20261101180406
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 +124 -0
- package/README.md +7 -0
- package/dist/browser-core.d.ts.map +1 -1
- package/dist/browser-core.js +24 -2
- package/dist/browser-core.js.map +1 -1
- package/dist/catalogs/market-data-catalog.d.ts +2 -0
- package/dist/catalogs/market-data-catalog.d.ts.map +1 -1
- package/dist/catalogs/market-data-catalog.js +1 -0
- package/dist/catalogs/market-data-catalog.js.map +1 -1
- package/dist/catalogs/snapshot-validation.js +6 -0
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/client.d.ts +2 -2
- package/dist/client.js +2 -2
- package/dist/client.js.map +1 -1
- package/dist/core-client.d.ts.map +1 -1
- package/dist/core-client.js +1 -0
- package/dist/core-client.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +6 -3
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +9 -2
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +9 -2
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +26 -2
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +26 -2
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +20 -14
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +20 -3
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/analytics/v1/analytics_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/analytics/v1/analytics_read_pb.js +2 -1
- package/dist/gen/chain/analytics/v1/analytics_read_pb.js.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +10 -6
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js +2 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +32 -2
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js +2 -2
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +19 -3
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.js +18 -2
- package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +840 -0
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -0
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js +351 -0
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -0
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +22 -2
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +17 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/reason_pb.d.ts +14 -0
- package/dist/gen/chain/zipper/v1/reason_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/reason_pb.js +15 -1
- package/dist/gen/chain/zipper/v1/reason_pb.js.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +1121 -0
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts.map +1 -0
- package/dist/gen/checkpoints/v1/checkpoints_pb.js +327 -0
- package/dist/gen/checkpoints/v1/checkpoints_pb.js.map +1 -0
- package/dist/gen/claims/v1/claims_pb.d.ts +61 -4
- package/dist/gen/claims/v1/claims_pb.d.ts.map +1 -1
- package/dist/gen/claims/v1/claims_pb.js +26 -1
- package/dist/gen/claims/v1/claims_pb.js.map +1 -1
- package/dist/gen/fees/v1/fees_pb.d.ts.map +1 -1
- package/dist/gen/fees/v1/fees_pb.js +2 -1
- package/dist/gen/fees/v1/fees_pb.js.map +1 -1
- package/dist/gen/index.d.ts +7 -5
- package/dist/gen/index.js +12 -10
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +38 -2
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts.map +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +13 -7
- package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +248 -27
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +73 -20
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +2 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +16 -4
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +1164 -53
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +959 -42
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +205 -17
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +156 -17
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/polyester/api/options_pb.d.ts +8 -1
- package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
- package/dist/gen/polyester/api/options_pb.js +8 -1
- package/dist/gen/polyester/api/options_pb.js.map +1 -1
- package/dist/gen/privatews/v1/private_ws_pb.d.ts +1419 -0
- package/dist/gen/privatews/v1/private_ws_pb.d.ts.map +1 -0
- package/dist/gen/privatews/v1/private_ws_pb.js +551 -0
- package/dist/gen/privatews/v1/private_ws_pb.js.map +1 -0
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +1 -0
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts.map +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.js +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +2108 -0
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +522 -0
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +2296 -0
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +1014 -0
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -0
- package/dist/gen/swap/v1/swap_pb.d.ts +945 -0
- package/dist/gen/swap/v1/swap_pb.d.ts.map +1 -0
- package/dist/gen/swap/v1/swap_pb.js +426 -0
- package/dist/gen/swap/v1/swap_pb.js.map +1 -0
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +67 -3
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts.map +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.js +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +587 -29
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +420 -19
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/gen/vip/v1/vip_pb.d.ts +95 -7
- package/dist/gen/vip/v1/vip_pb.d.ts.map +1 -1
- package/dist/gen/vip/v1/vip_pb.js +53 -5
- package/dist/gen/vip/v1/vip_pb.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.js +2 -2
- package/dist/realtime/client.d.ts +3 -0
- package/dist/realtime/client.d.ts.map +1 -1
- package/dist/realtime/client.js +76 -24
- package/dist/realtime/client.js.map +1 -1
- package/dist/realtime/index.d.ts +2 -1
- package/dist/realtime/private-orders.d.ts +38 -0
- package/dist/realtime/private-orders.d.ts.map +1 -0
- package/dist/realtime/private-orders.js +594 -0
- package/dist/realtime/private-orders.js.map +1 -0
- package/dist/realtime/ready-gated-subscription.js +10 -4
- package/dist/realtime/ready-gated-subscription.js.map +1 -1
- package/dist/realtime/snapshot-then-stream.js +1 -1
- package/dist/realtime/snapshot-then-stream.js.map +1 -1
- package/dist/realtime/types.d.ts +3 -0
- package/dist/realtime/types.d.ts.map +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/auth/account-signer-auth.d.ts +8 -0
- package/dist/services/auth/account-signer-auth.d.ts.map +1 -1
- package/dist/services/auth/account-signer-auth.js +37 -0
- package/dist/services/auth/account-signer-auth.js.map +1 -1
- package/dist/services/auth/profile/profile.schemas.js +1 -1
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/candles/candles.codecs.js +15 -0
- package/dist/services/candles/candles.codecs.js.map +1 -1
- package/dist/services/candles/candles.schemas.d.ts +13 -13
- package/dist/services/checkpoints/checkpoints.codecs.d.ts +8 -0
- package/dist/services/checkpoints/checkpoints.codecs.d.ts.map +1 -0
- package/dist/services/checkpoints/checkpoints.codecs.js +36 -0
- package/dist/services/checkpoints/checkpoints.codecs.js.map +1 -0
- package/dist/services/checkpoints/checkpoints.d.ts +22 -0
- package/dist/services/checkpoints/checkpoints.d.ts.map +1 -0
- package/dist/services/checkpoints/checkpoints.js +31 -0
- package/dist/services/checkpoints/checkpoints.js.map +1 -0
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +437 -0
- package/dist/services/checkpoints/checkpoints.schemas.d.ts.map +1 -0
- package/dist/services/checkpoints/checkpoints.schemas.js +176 -0
- package/dist/services/checkpoints/checkpoints.schemas.js.map +1 -0
- package/dist/services/checkpoints/checkpoints.types.d.ts +3 -0
- package/dist/services/checkpoints/service.d.ts +8 -0
- package/dist/services/checkpoints/service.d.ts.map +1 -0
- package/dist/services/checkpoints/service.js +9 -0
- package/dist/services/checkpoints/service.js.map +1 -0
- package/dist/services/claims/claims.codecs.d.ts +1 -1
- package/dist/services/claims/claims.codecs.d.ts.map +1 -1
- package/dist/services/claims/claims.codecs.js +2 -1
- package/dist/services/claims/claims.codecs.js.map +1 -1
- package/dist/services/claims/claims.d.ts +13 -5
- package/dist/services/claims/claims.d.ts.map +1 -1
- package/dist/services/claims/claims.js +15 -6
- package/dist/services/claims/claims.js.map +1 -1
- package/dist/services/claims/claims.schemas.d.ts +13 -3
- package/dist/services/claims/claims.schemas.d.ts.map +1 -1
- package/dist/services/claims/claims.schemas.js +10 -4
- package/dist/services/claims/claims.schemas.js.map +1 -1
- package/dist/services/claims/claims.types.d.ts +2 -2
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/lifecycle/lifecycle.codecs.d.ts +1 -1
- package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.codecs.js +4 -2
- package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +89 -39
- package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.js +7 -1
- package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.codecs.js +2 -1
- package/dist/services/market-data/market-data.codecs.js.map +1 -1
- package/dist/services/market-data/market-data.d.ts +10 -1
- package/dist/services/market-data/market-data.d.ts.map +1 -1
- package/dist/services/market-data/market-data.js +21 -9
- package/dist/services/market-data/market-data.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.d.ts +29 -2
- package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +53 -4
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.types.d.ts +2 -2
- package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
- package/dist/services/orderbook/orderbook.d.ts +2 -1
- package/dist/services/orderbook/orderbook.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.js +17 -2
- package/dist/services/orderbook/orderbook.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +5 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.js +2 -0
- package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
- package/dist/services/orders/order-enums.codecs.js +7 -1
- package/dist/services/orders/order-enums.codecs.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +3 -1
- package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
- package/dist/services/orders/order-errors.schemas.js +4 -1
- package/dist/services/orders/order-errors.schemas.js.map +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +343 -22
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +12 -2
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +548 -6
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +23 -5
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-modify.schemas.d.ts +106 -1
- package/dist/services/orders/orders-modify.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-modify.schemas.js +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +78 -59
- package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-output.schemas.js +15 -22
- package/dist/services/orders/orders-output.schemas.js.map +1 -1
- package/dist/services/orders/orders-risk.schemas.d.ts +69 -1
- package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-risk.schemas.js +21 -11
- package/dist/services/orders/orders-risk.schemas.js.map +1 -1
- package/dist/services/orders/orders.codecs.js +26 -2
- package/dist/services/orders/orders.codecs.js.map +1 -1
- package/dist/services/orders/orders.d.ts +31 -5
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +53 -15
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/shared.codecs.js +8 -2
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/shared.d.ts.map +1 -1
- package/dist/services/policies/shared.js +4 -1
- package/dist/services/policies/shared.js.map +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 +1 -1
- package/dist/services/subaccounts/subaccounts.codecs.js +4 -1
- package/dist/services/subaccounts/subaccounts.codecs.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.d.ts +1 -1
- package/dist/services/subaccounts/subaccounts.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.js +1 -2
- package/dist/services/subaccounts/subaccounts.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +18 -18
- package/dist/services/trades/trades.d.ts +2 -0
- package/dist/services/trades/trades.d.ts.map +1 -1
- package/dist/services/trades/trades.js +6 -6
- package/dist/services/trades/trades.js.map +1 -1
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/trades/trades.schemas.js +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +13 -2
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +50 -22
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +12 -0
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +26 -6
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
- package/dist/services/trailing-oneof-inputs.js +6 -1
- package/dist/services/trailing-oneof-inputs.js.map +1 -1
- package/dist/services/transfers/transfers.d.ts +2 -0
- package/dist/services/transfers/transfers.d.ts.map +1 -1
- package/dist/services/transfers/transfers.js +6 -11
- package/dist/services/transfers/transfers.js.map +1 -1
- package/dist/services/transfers/transfers.schemas.d.ts +3 -0
- package/dist/services/transfers/transfers.schemas.d.ts.map +1 -1
- package/dist/services/transfers/transfers.schemas.js +3 -1
- package/dist/services/transfers/transfers.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-child-order.schemas.js +23 -18
- package/dist/services/triggers/trigger-child-order.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +288 -25
- package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +38 -22
- package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +180 -56
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +28 -20
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/services/triggers/triggers.codecs.js +60 -0
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts +6 -2
- package/dist/services/triggers/triggers.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +10 -8
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/services/vip/vip.js +1 -1
- package/dist/services/vip/vip.schemas.d.ts +23 -1
- package/dist/services/vip/vip.schemas.d.ts.map +1 -1
- package/dist/services/vip/vip.schemas.js +20 -2
- package/dist/services/vip/vip.schemas.js.map +1 -1
- package/dist/services/vip/vip.types.d.ts +2 -2
- package/dist/shared/catalog-config.d.ts +14 -2
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js +2 -1
- package/dist/shared/catalog-config.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts +3 -0
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +45 -6
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/errors.d.ts +98 -7
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +108 -4
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/request-options.d.ts +7 -0
- package/dist/shared/request-options.d.ts.map +1 -1
- package/dist/shared/request-options.js +6 -1
- package/dist/shared/request-options.js.map +1 -1
- package/dist/shared/schemas.js +1 -1
- package/dist/shared/subscription-errors.d.ts +6 -6
- package/dist/shared/subscription-errors.d.ts.map +1 -1
- package/dist/shared/subscription-errors.js +32 -30
- package/dist/shared/subscription-errors.js.map +1 -1
- package/dist/shared/transports.d.ts.map +1 -1
- package/dist/shared/transports.js +9 -2
- package/dist/shared/transports.js.map +1 -1
- package/dist/shared/wire-bounds.js +3 -1
- package/dist/shared/wire-bounds.js.map +1 -1
- package/dist/smart-account/index.d.ts +2 -1
- package/dist/smart-account/index.js +2 -1
- package/dist/smart-account/smart-account.d.ts +5 -4
- package/dist/smart-account/smart-account.d.ts.map +1 -1
- package/dist/smart-account/smart-account.js +37 -8
- package/dist/smart-account/smart-account.js.map +1 -1
- package/dist/utils/numbers.js +4 -1
- package/dist/utils/numbers.js.map +1 -1
- package/dist/wired-services.js +5 -5
- package/dist/wired-services.js.map +1 -1
- package/package.json +9 -4
- package/dist/gen/collab/v1/whiteboard_pb.d.ts +0 -829
- package/dist/gen/collab/v1/whiteboard_pb.d.ts.map +0 -1
- package/dist/gen/collab/v1/whiteboard_pb.js +0 -250
- package/dist/gen/collab/v1/whiteboard_pb.js.map +0 -1
- package/dist/gen/layout/v1/layout_pb.d.ts +0 -1289
- package/dist/gen/layout/v1/layout_pb.d.ts.map +0 -1
- package/dist/gen/layout/v1/layout_pb.js +0 -313
- package/dist/gen/layout/v1/layout_pb.js.map +0 -1
- package/dist/gen/polychart/events/v1/polychart_events_pb.d.ts +0 -192
- package/dist/gen/polychart/events/v1/polychart_events_pb.d.ts.map +0 -1
- package/dist/gen/polychart/events/v1/polychart_events_pb.js +0 -57
- package/dist/gen/polychart/events/v1/polychart_events_pb.js.map +0 -1
- package/dist/gen/polychart/v1/polychart_pb.d.ts +0 -1208
- package/dist/gen/polychart/v1/polychart_pb.d.ts.map +0 -1
- package/dist/gen/polychart/v1/polychart_pb.js +0 -244
- package/dist/gen/polychart/v1/polychart_pb.js.map +0 -1
- package/dist/services/whiteboard/service.d.ts +0 -8
- package/dist/services/whiteboard/service.d.ts.map +0 -1
- package/dist/services/whiteboard/service.js +0 -9
- package/dist/services/whiteboard/service.js.map +0 -1
- package/dist/services/whiteboard/whiteboard.codecs.js +0 -55
- package/dist/services/whiteboard/whiteboard.codecs.js.map +0 -1
- package/dist/services/whiteboard/whiteboard.d.ts +0 -42
- package/dist/services/whiteboard/whiteboard.d.ts.map +0 -1
- package/dist/services/whiteboard/whiteboard.js +0 -76
- package/dist/services/whiteboard/whiteboard.js.map +0 -1
- package/dist/services/whiteboard/whiteboard.schemas.d.ts +0 -771
- package/dist/services/whiteboard/whiteboard.schemas.d.ts.map +0 -1
- package/dist/services/whiteboard/whiteboard.schemas.js +0 -132
- package/dist/services/whiteboard/whiteboard.schemas.js.map +0 -1
- package/dist/services/whiteboard/whiteboard.types.d.ts +0 -2
|
@@ -27,7 +27,7 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
27
27
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
28
28
|
}, undefined>, undefined>, readonly []>;
|
|
29
29
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"all" | "allowlist">>]>;
|
|
30
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[]>]>;
|
|
30
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[]>]>;
|
|
31
31
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
32
32
|
readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
|
|
33
33
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -50,7 +50,7 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
50
50
|
symbolId: number;
|
|
51
51
|
}[];
|
|
52
52
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
53
|
-
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
53
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
|
|
54
54
|
isTemplate: boolean;
|
|
55
55
|
sourceTemplateId?: string | undefined;
|
|
56
56
|
createdAt: number;
|
|
@@ -69,7 +69,7 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
69
69
|
symbolId: number;
|
|
70
70
|
}[];
|
|
71
71
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
72
|
-
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
72
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
|
|
73
73
|
isTemplate: boolean;
|
|
74
74
|
sourceTemplateId?: string | undefined;
|
|
75
75
|
createdAt: number;
|
|
@@ -85,7 +85,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
85
85
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
86
86
|
}, undefined>, undefined>, readonly []>;
|
|
87
87
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"all" | "allowlist">>]>;
|
|
88
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[]>]>;
|
|
88
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[]>]>;
|
|
89
89
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
90
90
|
readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
|
|
91
91
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -108,7 +108,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
108
108
|
symbolId: number;
|
|
109
109
|
}[];
|
|
110
110
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
111
|
-
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
111
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
|
|
112
112
|
isTemplate: boolean;
|
|
113
113
|
sourceTemplateId?: string | undefined;
|
|
114
114
|
createdAt: number;
|
|
@@ -127,7 +127,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
127
127
|
symbolId: number;
|
|
128
128
|
}[];
|
|
129
129
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
130
|
-
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
130
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
|
|
131
131
|
isTemplate: boolean;
|
|
132
132
|
sourceTemplateId?: string | undefined;
|
|
133
133
|
createdAt: number;
|
|
@@ -144,7 +144,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
144
144
|
symbolId: number;
|
|
145
145
|
}[];
|
|
146
146
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
147
|
-
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
147
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
|
|
148
148
|
isTemplate: boolean;
|
|
149
149
|
sourceTemplateId?: string | undefined;
|
|
150
150
|
createdAt: number;
|
|
@@ -160,7 +160,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
160
160
|
symbolId: number;
|
|
161
161
|
}[];
|
|
162
162
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
163
|
-
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
163
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
|
|
164
164
|
isTemplate: boolean;
|
|
165
165
|
sourceTemplateId?: string | undefined;
|
|
166
166
|
createdAt: number;
|
|
@@ -174,7 +174,7 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
174
174
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
175
175
|
}, undefined>, undefined>, readonly []>;
|
|
176
176
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["all", "allowlist"], undefined>, v.TransformAction<"all" | "allowlist", MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST>]>;
|
|
177
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, readonly []>, v.TransformAction<("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[]>]>;
|
|
177
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, readonly []>, v.TransformAction<("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[]>]>;
|
|
178
178
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
179
179
|
readonly assignToKeyId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
|
|
180
180
|
}, undefined>, v.TransformAction<{
|
|
@@ -184,7 +184,7 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
184
184
|
symbolId: number;
|
|
185
185
|
}[];
|
|
186
186
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
187
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
|
|
187
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
|
|
188
188
|
isTemplate: boolean;
|
|
189
189
|
assignToKeyId?: string | undefined;
|
|
190
190
|
}, {
|
|
@@ -195,7 +195,7 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
195
195
|
symbolId: number;
|
|
196
196
|
}[];
|
|
197
197
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
198
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
|
|
198
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
|
|
199
199
|
isTemplate: boolean;
|
|
200
200
|
};
|
|
201
201
|
assignToKeyId: string | undefined;
|
|
@@ -210,7 +210,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
210
210
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
211
211
|
}, undefined>, undefined>, undefined>;
|
|
212
212
|
readonly spotMarketScope: v.OptionalSchema<v.PicklistSchema<readonly ["all", "allowlist"], undefined>, undefined>;
|
|
213
|
-
readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, undefined>;
|
|
213
|
+
readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, undefined>;
|
|
214
214
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
215
215
|
}, undefined>, v.CheckAction<{
|
|
216
216
|
policyId: bigint;
|
|
@@ -221,7 +221,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
221
221
|
symbolId: number;
|
|
222
222
|
}[] | undefined;
|
|
223
223
|
spotMarketScope?: "all" | "allowlist" | undefined;
|
|
224
|
-
actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
|
|
224
|
+
actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
|
|
225
225
|
isTemplate?: boolean | undefined;
|
|
226
226
|
}, "At least one API key policy field must be provided">, v.TransformAction<{
|
|
227
227
|
policyId: bigint;
|
|
@@ -232,7 +232,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
232
232
|
symbolId: number;
|
|
233
233
|
}[] | undefined;
|
|
234
234
|
spotMarketScope?: "all" | "allowlist" | undefined;
|
|
235
|
-
actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
|
|
235
|
+
actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
|
|
236
236
|
isTemplate?: boolean | undefined;
|
|
237
237
|
}, {
|
|
238
238
|
policyId: bigint;
|
|
@@ -247,7 +247,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
247
247
|
} & {
|
|
248
248
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
249
249
|
} & {
|
|
250
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
|
|
250
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
|
|
251
251
|
} & {
|
|
252
252
|
isTemplate: boolean;
|
|
253
253
|
}>;
|
|
@@ -22,7 +22,10 @@ const PolicyActionCodec = {
|
|
|
22
22
|
[6]: "read-spot",
|
|
23
23
|
[8]: "read-internal-transfers",
|
|
24
24
|
[11]: "read-address-book",
|
|
25
|
-
[12]: "manage-address-book"
|
|
25
|
+
[12]: "manage-address-book",
|
|
26
|
+
[14]: "read-auto-withdraw",
|
|
27
|
+
[15]: "manage-auto-withdraw",
|
|
28
|
+
[16]: "swap"
|
|
26
29
|
},
|
|
27
30
|
inputToProto: {
|
|
28
31
|
"trade-spot": 1,
|
|
@@ -32,7 +35,10 @@ const PolicyActionCodec = {
|
|
|
32
35
|
"read-spot": 6,
|
|
33
36
|
"read-internal-transfers": 8,
|
|
34
37
|
"read-address-book": 11,
|
|
35
|
-
"manage-address-book": 12
|
|
38
|
+
"manage-address-book": 12,
|
|
39
|
+
"read-auto-withdraw": 14,
|
|
40
|
+
"manage-auto-withdraw": 15,
|
|
41
|
+
swap: 16
|
|
36
42
|
}
|
|
37
43
|
};
|
|
38
44
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.codecs.js","names":[],"sources":["../../../src/services/policies/shared.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/policies_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const POLICY_ACTION_LABELS = [\n \"trade-spot\",\n \"internal-transfer\",\n \"external-withdraw\",\n \"read-balances\",\n \"read-spot\",\n \"read-internal-transfers\",\n \"read-address-book\",\n \"manage-address-book\",\n] as const;\nexport type PolicyActionLabel = (typeof POLICY_ACTION_LABELS)[number];\n\nexport const POLICY_MARKET_SCOPE_LABELS = [\"all\", \"allowlist\"] as const;\nexport type PolicyMarketScopeLabel = (typeof POLICY_MARKET_SCOPE_LABELS)[number];\n\nexport const PolicyMarketScopeCodec = {\n inputToProto: {\n all: Proto.MarketScope_Value.ALL,\n allowlist: Proto.MarketScope_Value.ALLOWLIST,\n } satisfies Record<PolicyMarketScopeLabel, Proto.MarketScope_Value>,\n protoToOutput: {\n [Proto.MarketScope_Value.UNSPECIFIED]: \"unspecified\",\n [Proto.MarketScope_Value.ALL]: \"all\",\n [Proto.MarketScope_Value.ALLOWLIST]: \"allowlist\",\n } satisfies ProtoToOutput<Proto.MarketScope_Value, PolicyMarketScopeLabel>,\n} as const;\n\nexport const PolicyActionCodec = {\n protoToOutput: {\n [Proto.PolicyAction.UNSPECIFIED]: \"unspecified\",\n [Proto.PolicyAction.TRADE_SPOT]: \"trade-spot\",\n [Proto.PolicyAction.INTERNAL_TRANSFER]: \"internal-transfer\",\n [Proto.PolicyAction.EXTERNAL_WITHDRAW]: \"external-withdraw\",\n [Proto.PolicyAction.READ_BALANCES]: \"read-balances\",\n [Proto.PolicyAction.READ_SPOT]: \"read-spot\",\n [Proto.PolicyAction.READ_INTERNAL_TRANSFERS]: \"read-internal-transfers\",\n [Proto.PolicyAction.READ_ADDRESS_BOOK]: \"read-address-book\",\n [Proto.PolicyAction.MANAGE_ADDRESS_BOOK]: \"manage-address-book\",\n } satisfies ProtoToOutput<Proto.PolicyAction, PolicyActionLabel>,\n inputToProto: {\n \"trade-spot\": Proto.PolicyAction.TRADE_SPOT,\n \"internal-transfer\": Proto.PolicyAction.INTERNAL_TRANSFER,\n \"external-withdraw\": Proto.PolicyAction.EXTERNAL_WITHDRAW,\n \"read-balances\": Proto.PolicyAction.READ_BALANCES,\n \"read-spot\": Proto.PolicyAction.READ_SPOT,\n \"read-internal-transfers\": Proto.PolicyAction.READ_INTERNAL_TRANSFERS,\n \"read-address-book\": Proto.PolicyAction.READ_ADDRESS_BOOK,\n \"manage-address-book\": Proto.PolicyAction.MANAGE_ADDRESS_BOOK,\n } satisfies Record<PolicyActionLabel, Proto.PolicyAction>,\n} as const;\n\n/**\n * Returns the display label for a policy market scope.\n */\nexport function policyMarketScopeLabelFor(value: number): DecodedEnum<PolicyMarketScopeLabel> {\n return enumLabel(PolicyMarketScopeCodec.protoToOutput, value);\n}\n\n/**\n * Returns the display label for a policy action.\n */\nexport function policyActionLabelFor(value: number): DecodedEnum<PolicyActionLabel> {\n return enumLabel(PolicyActionCodec.protoToOutput, value);\n}\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"shared.codecs.js","names":[],"sources":["../../../src/services/policies/shared.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/policies_pb.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const POLICY_ACTION_LABELS = [\n \"trade-spot\",\n \"internal-transfer\",\n \"external-withdraw\",\n \"read-balances\",\n \"read-spot\",\n \"read-internal-transfers\",\n \"read-address-book\",\n \"manage-address-book\",\n \"read-auto-withdraw\",\n \"manage-auto-withdraw\",\n \"swap\",\n] as const;\nexport type PolicyActionLabel = (typeof POLICY_ACTION_LABELS)[number];\n\nexport const POLICY_MARKET_SCOPE_LABELS = [\"all\", \"allowlist\"] as const;\nexport type PolicyMarketScopeLabel = (typeof POLICY_MARKET_SCOPE_LABELS)[number];\n\nexport const PolicyMarketScopeCodec = {\n inputToProto: {\n all: Proto.MarketScope_Value.ALL,\n allowlist: Proto.MarketScope_Value.ALLOWLIST,\n } satisfies Record<PolicyMarketScopeLabel, Proto.MarketScope_Value>,\n protoToOutput: {\n [Proto.MarketScope_Value.UNSPECIFIED]: \"unspecified\",\n [Proto.MarketScope_Value.ALL]: \"all\",\n [Proto.MarketScope_Value.ALLOWLIST]: \"allowlist\",\n } satisfies ProtoToOutput<Proto.MarketScope_Value, PolicyMarketScopeLabel>,\n} as const;\n\nexport const PolicyActionCodec = {\n protoToOutput: {\n [Proto.PolicyAction.UNSPECIFIED]: \"unspecified\",\n [Proto.PolicyAction.TRADE_SPOT]: \"trade-spot\",\n [Proto.PolicyAction.INTERNAL_TRANSFER]: \"internal-transfer\",\n [Proto.PolicyAction.EXTERNAL_WITHDRAW]: \"external-withdraw\",\n [Proto.PolicyAction.READ_BALANCES]: \"read-balances\",\n [Proto.PolicyAction.READ_SPOT]: \"read-spot\",\n [Proto.PolicyAction.READ_INTERNAL_TRANSFERS]: \"read-internal-transfers\",\n [Proto.PolicyAction.READ_ADDRESS_BOOK]: \"read-address-book\",\n [Proto.PolicyAction.MANAGE_ADDRESS_BOOK]: \"manage-address-book\",\n [Proto.PolicyAction.READ_AUTO_WITHDRAW]: \"read-auto-withdraw\",\n [Proto.PolicyAction.MANAGE_AUTO_WITHDRAW]: \"manage-auto-withdraw\",\n [Proto.PolicyAction.SWAP]: \"swap\",\n } satisfies ProtoToOutput<Proto.PolicyAction, PolicyActionLabel>,\n inputToProto: {\n \"trade-spot\": Proto.PolicyAction.TRADE_SPOT,\n \"internal-transfer\": Proto.PolicyAction.INTERNAL_TRANSFER,\n \"external-withdraw\": Proto.PolicyAction.EXTERNAL_WITHDRAW,\n \"read-balances\": Proto.PolicyAction.READ_BALANCES,\n \"read-spot\": Proto.PolicyAction.READ_SPOT,\n \"read-internal-transfers\": Proto.PolicyAction.READ_INTERNAL_TRANSFERS,\n \"read-address-book\": Proto.PolicyAction.READ_ADDRESS_BOOK,\n \"manage-address-book\": Proto.PolicyAction.MANAGE_ADDRESS_BOOK,\n \"read-auto-withdraw\": Proto.PolicyAction.READ_AUTO_WITHDRAW,\n \"manage-auto-withdraw\": Proto.PolicyAction.MANAGE_AUTO_WITHDRAW,\n swap: Proto.PolicyAction.SWAP,\n } satisfies Record<PolicyActionLabel, Proto.PolicyAction>,\n} as const;\n\n/**\n * Returns the display label for a policy market scope.\n */\nexport function policyMarketScopeLabelFor(value: number): DecodedEnum<PolicyMarketScopeLabel> {\n return enumLabel(PolicyMarketScopeCodec.protoToOutput, value);\n}\n\n/**\n * Returns the display label for a policy action.\n */\nexport function policyActionLabelFor(value: number): DecodedEnum<PolicyActionLabel> {\n return enumLabel(PolicyActionCodec.protoToOutput, value);\n}\n"],"mappings":";;;AAsBA,MAAa,yBAAyB;CAClC,cAAc;EACV,KAAA;EACA,WAAA;CACJ;CACA,eAAe;GAC4B,IAAA;GACR,IAAA;GACM,IAAA;CACzC;AACJ;AAEA,MAAa,oBAAoB;CAC7B,eAAe;GACuB,IAAA;GACD,IAAA;GACO,IAAA;GACA,IAAA;GACJ,IAAA;GACJ,IAAA;GACc,IAAA;GACN,KAAA;GACE,KAAA;GACD,KAAA;GACE,KAAA;GAChB,KAAA;CAC/B;CACA,cAAc;EACV,cAAA;EACA,qBAAA;EACA,qBAAA;EACA,iBAAA;EACA,aAAA;EACA,2BAAA;EACA,qBAAA;EACA,uBAAA;EACA,sBAAA;EACA,wBAAA;EACA,MAAA;CACJ;AACJ;;;;AAKA,SAAgB,0BAA0B,OAAoD;CAC1F,OAAO,UAAU,uBAAuB,eAAe,KAAK;AAChE;;;;AAKA,SAAgB,qBAAqB,OAA+C;CAChF,OAAO,UAAU,kBAAkB,eAAe,KAAK;AAC3D"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
//#region src/services/policies/shared.d.ts
|
|
3
|
-
declare const PolicyActionEnumSchema: v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>;
|
|
3
|
+
declare const PolicyActionEnumSchema: v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>;
|
|
4
4
|
declare const PolicyMarketScopeEnumSchema: v.PicklistSchema<readonly ["all", "allowlist"], undefined>;
|
|
5
5
|
type PolicyMarketScope = v.InferOutput<typeof PolicyMarketScopeEnumSchema>;
|
|
6
6
|
type PolicyAction = v.InferOutput<typeof PolicyActionEnumSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","names":[],"sources":["../../../src/services/policies/shared.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","names":[],"sources":["../../../src/services/policies/shared.ts"],"mappings":";;cAyBa,wBAAsB,EAAA;cAEtB,6BAA2B,EAAA;KAC5B,oBAAoB,EAAE,mBAAmB;KAEzC,eAAe,EAAE,mBAAmB"}
|
|
@@ -11,7 +11,10 @@ const POLICY_ACTIONS = [
|
|
|
11
11
|
"read-spot",
|
|
12
12
|
"read-internal-transfers",
|
|
13
13
|
"read-address-book",
|
|
14
|
-
"manage-address-book"
|
|
14
|
+
"manage-address-book",
|
|
15
|
+
"read-auto-withdraw",
|
|
16
|
+
"manage-auto-withdraw",
|
|
17
|
+
"swap"
|
|
15
18
|
];
|
|
16
19
|
const POLICY_MARKET_SCOPES = ["all", "allowlist"];
|
|
17
20
|
const ProtoPolicyActionEnumSchema = v.number();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":[],"sources":["../../../src/services/policies/shared.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\n\nexport const SpotMarketRuleSchema = v.object({\n symbolId: SymbolIdInputSchema,\n});\n\nexport const POLICY_ACTIONS = [\n \"trade-spot\",\n \"internal-transfer\",\n \"external-withdraw\",\n \"read-balances\",\n \"read-spot\",\n \"read-internal-transfers\",\n \"read-address-book\",\n \"manage-address-book\",\n] as const;\n\nexport const POLICY_MARKET_SCOPES = [\"all\", \"allowlist\"] as const;\n\nexport const ProtoPolicyActionEnumSchema = v.number();\nexport const PolicyActionEnumSchema = v.picklist(POLICY_ACTIONS);\nexport const ProtoPolicyMarketScopeEnumSchema = v.number();\nexport const PolicyMarketScopeEnumSchema = v.picklist(POLICY_MARKET_SCOPES);\nexport type PolicyMarketScope = v.InferOutput<typeof PolicyMarketScopeEnumSchema>;\n\nexport type PolicyAction = v.InferOutput<typeof PolicyActionEnumSchema>;\n\nexport const PolicyIdSchema = v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n);\n"],"mappings":";;;;AAIA,MAAa,uBAAuB,EAAE,OAAO,EACzC,UAAU,oBACd,CAAC;AAED,MAAa,iBAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAEA,MAAa,uBAAuB,CAAC,OAAO,WAAW;AAEvD,MAAa,8BAA8B,EAAE,OAAO;AACpD,MAAa,yBAAyB,EAAE,SAAS,cAAc;AAC/D,MAAa,mCAAmC,EAAE,OAAO;AACzD,MAAa,8BAA8B,EAAE,SAAS,oBAAoB;AAK1E,MAAa,iBAAiB,EAAE,KAC5B,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,UAAU,CAAC,GACb,EAAE,WAAW,MAAM,WAAW,GAAG,UAAU,CAAC,CAChD"}
|
|
1
|
+
{"version":3,"file":"shared.js","names":[],"sources":["../../../src/services/policies/shared.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\n\nexport const SpotMarketRuleSchema = v.object({\n symbolId: SymbolIdInputSchema,\n});\n\nexport const POLICY_ACTIONS = [\n \"trade-spot\",\n \"internal-transfer\",\n \"external-withdraw\",\n \"read-balances\",\n \"read-spot\",\n \"read-internal-transfers\",\n \"read-address-book\",\n \"manage-address-book\",\n \"read-auto-withdraw\",\n \"manage-auto-withdraw\",\n \"swap\",\n] as const;\n\nexport const POLICY_MARKET_SCOPES = [\"all\", \"allowlist\"] as const;\n\nexport const ProtoPolicyActionEnumSchema = v.number();\nexport const PolicyActionEnumSchema = v.picklist(POLICY_ACTIONS);\nexport const ProtoPolicyMarketScopeEnumSchema = v.number();\nexport const PolicyMarketScopeEnumSchema = v.picklist(POLICY_MARKET_SCOPES);\nexport type PolicyMarketScope = v.InferOutput<typeof PolicyMarketScopeEnumSchema>;\n\nexport type PolicyAction = v.InferOutput<typeof PolicyActionEnumSchema>;\n\nexport const PolicyIdSchema = v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n);\n"],"mappings":";;;;AAIA,MAAa,uBAAuB,EAAE,OAAO,EACzC,UAAU,oBACd,CAAC;AAED,MAAa,iBAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAEA,MAAa,uBAAuB,CAAC,OAAO,WAAW;AAEvD,MAAa,8BAA8B,EAAE,OAAO;AACpD,MAAa,yBAAyB,EAAE,SAAS,cAAc;AAC/D,MAAa,mCAAmC,EAAE,OAAO;AACzD,MAAa,8BAA8B,EAAE,SAAS,oBAAoB;AAK1E,MAAa,iBAAiB,EAAE,KAC5B,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,UAAU,CAAC,GACb,EAAE,WAAW,MAAM,WAAW,GAAG,UAAU,CAAC,CAChD"}
|
|
@@ -38,7 +38,7 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
38
38
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
39
39
|
}, undefined>, undefined>, readonly []>;
|
|
40
40
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"all" | "allowlist">>]>;
|
|
41
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[]>]>;
|
|
41
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[]>]>;
|
|
42
42
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
43
43
|
readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
|
|
44
44
|
readonly maxOrderNotional: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
@@ -79,7 +79,7 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
79
79
|
symbolId: number;
|
|
80
80
|
}[];
|
|
81
81
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
82
|
-
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
82
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
|
|
83
83
|
isTemplate: boolean;
|
|
84
84
|
sourceTemplateId?: string | undefined;
|
|
85
85
|
maxOrderNotional: string;
|
|
@@ -104,7 +104,7 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
104
104
|
symbolId: number;
|
|
105
105
|
}[];
|
|
106
106
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
107
|
-
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
107
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw">[];
|
|
108
108
|
isTemplate: boolean;
|
|
109
109
|
sourceTemplateId?: string | undefined;
|
|
110
110
|
maxOpenOrders: number;
|
|
@@ -124,7 +124,7 @@ declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
124
124
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
125
125
|
}, undefined>, undefined>, readonly []>;
|
|
126
126
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["all", "allowlist"], undefined>, v.TransformAction<"all" | "allowlist", MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST>]>;
|
|
127
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, readonly []>, v.TransformAction<("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[]>]>;
|
|
127
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, readonly []>, v.TransformAction<("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[]>]>;
|
|
128
128
|
readonly maxOrderSize: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, bigint>]>, undefined>, null>, v.TransformAction<bigint | null, bigint>]>;
|
|
129
129
|
readonly maxOpenOrders: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>, null>, v.TransformAction<number | null, number>]>;
|
|
130
130
|
readonly tradingHalted: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
@@ -139,7 +139,7 @@ declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
139
139
|
symbolId: number;
|
|
140
140
|
}[];
|
|
141
141
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
142
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
|
|
142
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
|
|
143
143
|
maxOrderSize: bigint;
|
|
144
144
|
maxOpenOrders: number;
|
|
145
145
|
tradingHalted: boolean;
|
|
@@ -159,7 +159,7 @@ declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
159
159
|
symbolId: number;
|
|
160
160
|
}[];
|
|
161
161
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
162
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
|
|
162
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
|
|
163
163
|
maxOpenOrders: number;
|
|
164
164
|
tradingHalted: boolean;
|
|
165
165
|
};
|
|
@@ -175,7 +175,7 @@ declare const UpdateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
175
175
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
176
176
|
}, undefined>, undefined>, undefined>;
|
|
177
177
|
readonly spotMarketScope: v.OptionalSchema<v.PicklistSchema<readonly ["all", "allowlist"], undefined>, undefined>;
|
|
178
|
-
readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, undefined>;
|
|
178
|
+
readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, undefined>;
|
|
179
179
|
readonly maxOrderSize: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, bigint>]>, undefined>, undefined>;
|
|
180
180
|
readonly maxOpenOrders: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>, undefined>;
|
|
181
181
|
readonly tradingHalted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
@@ -191,7 +191,7 @@ declare const UpdateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
191
191
|
symbolId: number;
|
|
192
192
|
}[] | undefined;
|
|
193
193
|
spotMarketScope?: "all" | "allowlist" | undefined;
|
|
194
|
-
actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
|
|
194
|
+
actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
|
|
195
195
|
maxOrderSize?: bigint | null | undefined;
|
|
196
196
|
maxOpenOrders?: number | null | undefined;
|
|
197
197
|
tradingHalted?: boolean | undefined;
|
|
@@ -207,7 +207,7 @@ declare const UpdateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
207
207
|
symbolId: number;
|
|
208
208
|
}[] | undefined;
|
|
209
209
|
spotMarketScope?: "all" | "allowlist" | undefined;
|
|
210
|
-
actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
|
|
210
|
+
actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
|
|
211
211
|
maxOrderSize?: bigint | null | undefined;
|
|
212
212
|
maxOpenOrders?: number | null | undefined;
|
|
213
213
|
tradingHalted?: boolean | undefined;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { idToBigInt } from "../../../utils/base58-id.js";
|
|
2
|
+
import { PROTOBUF_UINT32_MAX } from "../../../shared/wire-bounds.js";
|
|
2
3
|
import { toIntOrZero } from "../../../utils/numbers.js";
|
|
3
4
|
import { tsObjToMs, tsObjToNsString } from "../../../utils/time.js";
|
|
4
|
-
import { PROTOBUF_UINT32_MAX } from "../../../shared/wire-bounds.js";
|
|
5
5
|
import { BigIntStringSchema, OptionalNumberToIntOrZeroSchema, OptionalPublicIdSchema, OptionalTimestampMsSchema, PublicIdSchema, TimestampMsSchema, TimestampSchema, idInputSchema, optionalSubaccountIdInputSchema, positiveBigintStringInputSchema } from "../../../shared/schemas.js";
|
|
6
6
|
import { decimalInputToScaled, scaledToDecimalOutput } from "../../../shared/decimal-surface.js";
|
|
7
7
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../../shared/account-scope.js";
|
|
@@ -51,7 +51,10 @@ const SubaccountPermissionCodec = { protoToOutput: {
|
|
|
51
51
|
[22]: "create_deposit_address",
|
|
52
52
|
[23]: "read_deposit_addresses",
|
|
53
53
|
[24]: "read_guard_signer_status",
|
|
54
|
-
[25]: "manage_guard_signer"
|
|
54
|
+
[25]: "manage_guard_signer",
|
|
55
|
+
[26]: "read_auto_withdraw",
|
|
56
|
+
[27]: "manage_auto_withdraw",
|
|
57
|
+
[28]: "swap"
|
|
55
58
|
} };
|
|
56
59
|
const InviteActionCodec = { inputToProto: {
|
|
57
60
|
accept: 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccounts.codecs.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\nexport type SubaccountRoleValue = (typeof SUBACCOUNT_ROLE_VALUES)[number];\n\nexport const SUBACCOUNT_PERMISSION_VALUES = [\n \"read_subaccount\",\n \"update_subaccount\",\n \"read_balances\",\n \"read_spot\",\n \"trade_spot\",\n \"read_internal_transfers\",\n \"internal_transfer\",\n \"external_withdraw\",\n \"read_address_book\",\n \"manage_address_book\",\n \"read_members\",\n \"manage_members\",\n \"read_invites\",\n \"manage_invites\",\n \"read_api_keys\",\n \"manage_api_keys\",\n \"read_subaccount_policy\",\n \"manage_subaccount_policy\",\n \"read_activity\",\n \"read_activity_security_details\",\n \"manage_member_mfa_requirement\",\n \"create_deposit_address\",\n \"read_deposit_addresses\",\n \"read_guard_signer_status\",\n \"manage_guard_signer\",\n] as const;\nexport type SubaccountPermissionValue = (typeof SUBACCOUNT_PERMISSION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_ACTION_VALUES = [\"accept\", \"decline\", \"cancel\"] as const;\nexport type SubaccountInviteActionValue = (typeof SUBACCOUNT_INVITE_ACTION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_STATUS_VALUES = [\n \"pending\",\n \"accepted\",\n \"declined\",\n \"cancelled\",\n] as const;\nexport type SubaccountInviteStatusValue = (typeof SUBACCOUNT_INVITE_STATUS_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_DIRECTION_VALUES = [\"\", \"incoming\", \"outgoing\"] as const;\nexport type SubaccountInviteDirectionValue = (typeof SUBACCOUNT_INVITE_DIRECTION_VALUES)[number];\n\nexport const SUBACCOUNT_STATUS_VALUES = [\"active\", \"disabled\"] as const;\nexport type SubaccountStatusValue = (typeof SUBACCOUNT_STATUS_VALUES)[number];\n\nexport const ACTIVITY_ENTITY_KIND_VALUES = [\n \"account\",\n \"session\",\n \"api_key\",\n \"subaccount\",\n \"member\",\n \"policy\",\n \"invite\",\n \"security\",\n \"destination\",\n] as const;\nexport type ActivityEntityKindValue = (typeof ACTIVITY_ENTITY_KIND_VALUES)[number];\n\nexport const ACTIVITY_EVENT_ACTION_VALUES = [\n \"created\",\n \"updated\",\n \"deleted\",\n \"enabled\",\n \"disabled\",\n \"removed\",\n \"role_set\",\n \"received\",\n \"replied\",\n \"failed\",\n \"revoked\",\n \"blocked\",\n \"hold_placed\",\n \"hold_released\",\n] as const;\nexport type ActivityEventActionValue = (typeof ACTIVITY_EVENT_ACTION_VALUES)[number];\n\nexport const ACTIVITY_EVENT_SOURCE_VALUES = [\"web\", \"mobile\", \"api\"] as const;\nexport type ActivityEventSourceValue = (typeof ACTIVITY_EVENT_SOURCE_VALUES)[number];\n\nexport const SubaccountRoleCodec = {\n inputToProto: {\n owner: Proto.SubaccountRole.OWNER,\n admin: Proto.SubaccountRole.ADMIN,\n treasury: Proto.SubaccountRole.TREASURY,\n leveraged_trader: Proto.SubaccountRole.LEVERAGED_TRADER,\n trader: Proto.SubaccountRole.TRADER,\n viewer: Proto.SubaccountRole.VIEWER,\n } satisfies InputToProto<SubaccountRoleValue, Proto.SubaccountRole>,\n protoToOutput: {\n [Proto.SubaccountRole.SUBACCOUNT_ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountRole.OWNER]: \"owner\",\n [Proto.SubaccountRole.ADMIN]: \"admin\",\n [Proto.SubaccountRole.TREASURY]: \"treasury\",\n [Proto.SubaccountRole.LEVERAGED_TRADER]: \"leveraged_trader\",\n [Proto.SubaccountRole.TRADER]: \"trader\",\n [Proto.SubaccountRole.VIEWER]: \"viewer\",\n } satisfies ProtoToOutput<Proto.SubaccountRole, SubaccountRoleValue>,\n} as const;\n\nexport const SubaccountPermissionCodec = {\n protoToOutput: {\n [Proto.SubaccountPermission.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT]: \"read_subaccount\",\n [Proto.SubaccountPermission.UPDATE_SUBACCOUNT]: \"update_subaccount\",\n [Proto.SubaccountPermission.READ_BALANCES]: \"read_balances\",\n [Proto.SubaccountPermission.READ_SPOT]: \"read_spot\",\n [Proto.SubaccountPermission.TRADE_SPOT]: \"trade_spot\",\n [Proto.SubaccountPermission.READ_INTERNAL_TRANSFERS]: \"read_internal_transfers\",\n [Proto.SubaccountPermission.INTERNAL_TRANSFER]: \"internal_transfer\",\n [Proto.SubaccountPermission.EXTERNAL_WITHDRAW]: \"external_withdraw\",\n [Proto.SubaccountPermission.READ_ADDRESS_BOOK]: \"read_address_book\",\n [Proto.SubaccountPermission.MANAGE_ADDRESS_BOOK]: \"manage_address_book\",\n [Proto.SubaccountPermission.READ_MEMBERS]: \"read_members\",\n [Proto.SubaccountPermission.MANAGE_MEMBERS]: \"manage_members\",\n [Proto.SubaccountPermission.READ_INVITES]: \"read_invites\",\n [Proto.SubaccountPermission.MANAGE_INVITES]: \"manage_invites\",\n [Proto.SubaccountPermission.READ_API_KEYS]: \"read_api_keys\",\n [Proto.SubaccountPermission.MANAGE_API_KEYS]: \"manage_api_keys\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT_POLICY]: \"read_subaccount_policy\",\n [Proto.SubaccountPermission.MANAGE_SUBACCOUNT_POLICY]: \"manage_subaccount_policy\",\n [Proto.SubaccountPermission.READ_ACTIVITY]: \"read_activity\",\n [Proto.SubaccountPermission.READ_ACTIVITY_SECURITY_DETAILS]:\n \"read_activity_security_details\",\n [Proto.SubaccountPermission.MANAGE_MEMBER_MFA_REQUIREMENT]: \"manage_member_mfa_requirement\",\n [Proto.SubaccountPermission.CREATE_DEPOSIT_ADDRESS]: \"create_deposit_address\",\n [Proto.SubaccountPermission.READ_DEPOSIT_ADDRESSES]: \"read_deposit_addresses\",\n [Proto.SubaccountPermission.READ_GUARD_SIGNER_STATUS]: \"read_guard_signer_status\",\n [Proto.SubaccountPermission.MANAGE_GUARD_SIGNER]: \"manage_guard_signer\",\n } satisfies ProtoToOutput<Proto.SubaccountPermission, SubaccountPermissionValue>,\n} as const;\n\nexport const InviteActionCodec = {\n inputToProto: {\n accept: Proto.SubaccountInviteAction.ACCEPT,\n decline: Proto.SubaccountInviteAction.DECLINE,\n cancel: Proto.SubaccountInviteAction.CANCEL,\n } satisfies InputToProto<SubaccountInviteActionValue, Proto.SubaccountInviteAction>,\n} as const;\n\nexport const InviteStatusCodec = {\n protoToOutput: {\n [Proto.SubaccountInviteStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountInviteStatus.PENDING]: \"pending\",\n [Proto.SubaccountInviteStatus.ACCEPTED]: \"accepted\",\n [Proto.SubaccountInviteStatus.DECLINED]: \"declined\",\n [Proto.SubaccountInviteStatus.CANCELLED]: \"cancelled\",\n } satisfies ProtoToOutput<Proto.SubaccountInviteStatus, SubaccountInviteStatusValue>,\n} as const;\n\nexport const SubaccountInviteDirectionCodec = {\n inputToProto: {\n \"\": Proto.SubaccountInviteDirection.DIRECTION_UNSPECIFIED,\n incoming: Proto.SubaccountInviteDirection.INCOMING,\n outgoing: Proto.SubaccountInviteDirection.OUTGOING,\n } satisfies InputToProto<SubaccountInviteDirectionValue, Proto.SubaccountInviteDirection>,\n} as const;\n\nexport const SubaccountStatusCodec = {\n inputToProto: {\n active: Proto.SubaccountStatus.ACTIVE,\n disabled: Proto.SubaccountStatus.DISABLED,\n } satisfies InputToProto<SubaccountStatusValue, Proto.SubaccountStatus>,\n protoToOutput: {\n [Proto.SubaccountStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountStatus.ACTIVE]: \"active\",\n [Proto.SubaccountStatus.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.SubaccountStatus, SubaccountStatusValue>,\n} as const;\n\nexport const ActivityEntityKindCodec = {\n protoToOutput: {\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_ACCOUNT]: \"account\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SESSION]: \"session\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_API_KEY]: \"api_key\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SUBACCOUNT]: \"subaccount\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_MEMBER]: \"member\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_POLICY]: \"policy\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_INVITE]: \"invite\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SECURITY]: \"security\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_DESTINATION]: \"destination\",\n } satisfies ProtoToOutput<Proto.ActivityEntityKind, ActivityEntityKindValue>,\n} as const;\n\nexport const ActivityEventActionCodec = {\n protoToOutput: {\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_CREATED]: \"created\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UPDATED]: \"updated\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DELETED]: \"deleted\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ENABLED]: \"enabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DISABLED]: \"disabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REMOVED]: \"removed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ROLE_SET]: \"role_set\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_RECEIVED]: \"received\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REPLIED]: \"replied\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_FAILED]: \"failed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REVOKED]: \"revoked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_BLOCKED]: \"blocked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_PLACED]: \"hold_placed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_RELEASED]: \"hold_released\",\n } satisfies ProtoToOutput<Proto.ActivityEventAction, ActivityEventActionValue>,\n} as const;\n\nexport const ActivityEventSourceCodec = {\n protoToOutput: {\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_WEB]: \"web\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_MOBILE]: \"mobile\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_API]: \"api\",\n } satisfies ProtoToOutput<Proto.ActivityEventSource, ActivityEventSourceValue>,\n} as const;\n"],"mappings":";;AAqDA,MAAa,qCAAqC;CAAC;CAAI;CAAY;AAAU;AAG7E,MAAa,2BAA2B,CAAC,UAAU,UAAU;AAqC7D,MAAa,sBAAsB;CAC/B,cAAc;EACV,OAAA;EACA,OAAA;EACA,UAAA;EACA,kBAAA;EACA,QAAA;EACA,QAAA;CACJ;CACA,eAAe;GACyC,IAAA;GACtB,IAAA;GACA,IAAA;GACG,IAAA;GACQ,IAAA;GACV,IAAA;GACA,IAAA;CACnC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EAC+B,IAAA;EACI,IAAA;EACE,IAAA;EACJ,IAAA;EACJ,IAAA;EACC,IAAA;EACa,IAAA;EACN,IAAA;EACA,IAAA;EACA,IAAA;EACE,KAAA;EACP,KAAA;EACE,KAAA;EACF,KAAA;EACE,KAAA;EACD,KAAA;EACE,KAAA;EACO,KAAA;EACE,KAAA;EACX,KAAA;EAExC,KAAA;EACwD,KAAA;EACP,KAAA;EACA,KAAA;EACE,KAAA;EACL,KAAA;AACtD,EACJ;AAEA,MAAa,oBAAoB,EAC7B,cAAc;CACV,QAAA;CACA,SAAA;CACA,QAAA;AACJ,EACJ;AAEA,MAAa,oBAAoB,EAC7B,eAAe;EACiC,IAAA;EACJ,IAAA;EACC,IAAA;EACA,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,iCAAiC,EAC1C,cAAc;CACV,IAAA;CACA,UAAA;CACA,UAAA;AACJ,EACJ;AAEA,MAAa,wBAAwB;CACjC,cAAc;EACV,QAAA;EACA,UAAA;CACJ;CACA,eAAe;GAC2B,IAAA;GACL,IAAA;GACE,IAAA;CACvC;AACJ;AAEA,MAAa,0BAA0B,EACnC,eAAe;EAC6C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACG,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACE,IAAA;EACG,IAAA;AAC5D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACA,IAAA;EACC,IAAA;EACD,IAAA;EACC,IAAA;EACA,IAAA;EACD,IAAA;EACD,KAAA;EACC,KAAA;EACA,KAAA;EACI,KAAA;EACE,KAAA;AAC/D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACR,IAAA;EACG,IAAA;EACH,IAAA;AACrD,EACJ"}
|
|
1
|
+
{"version":3,"file":"subaccounts.codecs.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\nexport type SubaccountRoleValue = (typeof SUBACCOUNT_ROLE_VALUES)[number];\n\nexport const SUBACCOUNT_PERMISSION_VALUES = [\n \"read_subaccount\",\n \"update_subaccount\",\n \"read_balances\",\n \"read_spot\",\n \"trade_spot\",\n \"read_internal_transfers\",\n \"internal_transfer\",\n \"external_withdraw\",\n \"read_address_book\",\n \"manage_address_book\",\n \"read_members\",\n \"manage_members\",\n \"read_invites\",\n \"manage_invites\",\n \"read_api_keys\",\n \"manage_api_keys\",\n \"read_subaccount_policy\",\n \"manage_subaccount_policy\",\n \"read_activity\",\n \"read_activity_security_details\",\n \"manage_member_mfa_requirement\",\n \"create_deposit_address\",\n \"read_deposit_addresses\",\n \"read_guard_signer_status\",\n \"manage_guard_signer\",\n \"read_auto_withdraw\",\n \"manage_auto_withdraw\",\n \"swap\",\n] as const;\nexport type SubaccountPermissionValue = (typeof SUBACCOUNT_PERMISSION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_ACTION_VALUES = [\"accept\", \"decline\", \"cancel\"] as const;\nexport type SubaccountInviteActionValue = (typeof SUBACCOUNT_INVITE_ACTION_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_STATUS_VALUES = [\n \"pending\",\n \"accepted\",\n \"declined\",\n \"cancelled\",\n] as const;\nexport type SubaccountInviteStatusValue = (typeof SUBACCOUNT_INVITE_STATUS_VALUES)[number];\n\nexport const SUBACCOUNT_INVITE_DIRECTION_VALUES = [\"\", \"incoming\", \"outgoing\"] as const;\nexport type SubaccountInviteDirectionValue = (typeof SUBACCOUNT_INVITE_DIRECTION_VALUES)[number];\n\nexport const SUBACCOUNT_STATUS_VALUES = [\"active\", \"disabled\"] as const;\nexport type SubaccountStatusValue = (typeof SUBACCOUNT_STATUS_VALUES)[number];\n\nexport const ACTIVITY_ENTITY_KIND_VALUES = [\n \"account\",\n \"session\",\n \"api_key\",\n \"subaccount\",\n \"member\",\n \"policy\",\n \"invite\",\n \"security\",\n \"destination\",\n] as const;\nexport type ActivityEntityKindValue = (typeof ACTIVITY_ENTITY_KIND_VALUES)[number];\n\nexport const ACTIVITY_EVENT_ACTION_VALUES = [\n \"created\",\n \"updated\",\n \"deleted\",\n \"enabled\",\n \"disabled\",\n \"removed\",\n \"role_set\",\n \"received\",\n \"replied\",\n \"failed\",\n \"revoked\",\n \"blocked\",\n \"hold_placed\",\n \"hold_released\",\n] as const;\nexport type ActivityEventActionValue = (typeof ACTIVITY_EVENT_ACTION_VALUES)[number];\n\nexport const ACTIVITY_EVENT_SOURCE_VALUES = [\"web\", \"mobile\", \"api\"] as const;\nexport type ActivityEventSourceValue = (typeof ACTIVITY_EVENT_SOURCE_VALUES)[number];\n\nexport const SubaccountRoleCodec = {\n inputToProto: {\n owner: Proto.SubaccountRole.OWNER,\n admin: Proto.SubaccountRole.ADMIN,\n treasury: Proto.SubaccountRole.TREASURY,\n leveraged_trader: Proto.SubaccountRole.LEVERAGED_TRADER,\n trader: Proto.SubaccountRole.TRADER,\n viewer: Proto.SubaccountRole.VIEWER,\n } satisfies InputToProto<SubaccountRoleValue, Proto.SubaccountRole>,\n protoToOutput: {\n [Proto.SubaccountRole.SUBACCOUNT_ROLE_UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountRole.OWNER]: \"owner\",\n [Proto.SubaccountRole.ADMIN]: \"admin\",\n [Proto.SubaccountRole.TREASURY]: \"treasury\",\n [Proto.SubaccountRole.LEVERAGED_TRADER]: \"leveraged_trader\",\n [Proto.SubaccountRole.TRADER]: \"trader\",\n [Proto.SubaccountRole.VIEWER]: \"viewer\",\n } satisfies ProtoToOutput<Proto.SubaccountRole, SubaccountRoleValue>,\n} as const;\n\nexport const SubaccountPermissionCodec = {\n protoToOutput: {\n [Proto.SubaccountPermission.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT]: \"read_subaccount\",\n [Proto.SubaccountPermission.UPDATE_SUBACCOUNT]: \"update_subaccount\",\n [Proto.SubaccountPermission.READ_BALANCES]: \"read_balances\",\n [Proto.SubaccountPermission.READ_SPOT]: \"read_spot\",\n [Proto.SubaccountPermission.TRADE_SPOT]: \"trade_spot\",\n [Proto.SubaccountPermission.READ_INTERNAL_TRANSFERS]: \"read_internal_transfers\",\n [Proto.SubaccountPermission.INTERNAL_TRANSFER]: \"internal_transfer\",\n [Proto.SubaccountPermission.EXTERNAL_WITHDRAW]: \"external_withdraw\",\n [Proto.SubaccountPermission.READ_ADDRESS_BOOK]: \"read_address_book\",\n [Proto.SubaccountPermission.MANAGE_ADDRESS_BOOK]: \"manage_address_book\",\n [Proto.SubaccountPermission.READ_MEMBERS]: \"read_members\",\n [Proto.SubaccountPermission.MANAGE_MEMBERS]: \"manage_members\",\n [Proto.SubaccountPermission.READ_INVITES]: \"read_invites\",\n [Proto.SubaccountPermission.MANAGE_INVITES]: \"manage_invites\",\n [Proto.SubaccountPermission.READ_API_KEYS]: \"read_api_keys\",\n [Proto.SubaccountPermission.MANAGE_API_KEYS]: \"manage_api_keys\",\n [Proto.SubaccountPermission.READ_SUBACCOUNT_POLICY]: \"read_subaccount_policy\",\n [Proto.SubaccountPermission.MANAGE_SUBACCOUNT_POLICY]: \"manage_subaccount_policy\",\n [Proto.SubaccountPermission.READ_ACTIVITY]: \"read_activity\",\n [Proto.SubaccountPermission.READ_ACTIVITY_SECURITY_DETAILS]:\n \"read_activity_security_details\",\n [Proto.SubaccountPermission.MANAGE_MEMBER_MFA_REQUIREMENT]: \"manage_member_mfa_requirement\",\n [Proto.SubaccountPermission.CREATE_DEPOSIT_ADDRESS]: \"create_deposit_address\",\n [Proto.SubaccountPermission.READ_DEPOSIT_ADDRESSES]: \"read_deposit_addresses\",\n [Proto.SubaccountPermission.READ_GUARD_SIGNER_STATUS]: \"read_guard_signer_status\",\n [Proto.SubaccountPermission.MANAGE_GUARD_SIGNER]: \"manage_guard_signer\",\n [Proto.SubaccountPermission.READ_AUTO_WITHDRAW]: \"read_auto_withdraw\",\n [Proto.SubaccountPermission.MANAGE_AUTO_WITHDRAW]: \"manage_auto_withdraw\",\n [Proto.SubaccountPermission.SWAP]: \"swap\",\n } satisfies ProtoToOutput<Proto.SubaccountPermission, SubaccountPermissionValue>,\n} as const;\n\nexport const InviteActionCodec = {\n inputToProto: {\n accept: Proto.SubaccountInviteAction.ACCEPT,\n decline: Proto.SubaccountInviteAction.DECLINE,\n cancel: Proto.SubaccountInviteAction.CANCEL,\n } satisfies InputToProto<SubaccountInviteActionValue, Proto.SubaccountInviteAction>,\n} as const;\n\nexport const InviteStatusCodec = {\n protoToOutput: {\n [Proto.SubaccountInviteStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountInviteStatus.PENDING]: \"pending\",\n [Proto.SubaccountInviteStatus.ACCEPTED]: \"accepted\",\n [Proto.SubaccountInviteStatus.DECLINED]: \"declined\",\n [Proto.SubaccountInviteStatus.CANCELLED]: \"cancelled\",\n } satisfies ProtoToOutput<Proto.SubaccountInviteStatus, SubaccountInviteStatusValue>,\n} as const;\n\nexport const SubaccountInviteDirectionCodec = {\n inputToProto: {\n \"\": Proto.SubaccountInviteDirection.DIRECTION_UNSPECIFIED,\n incoming: Proto.SubaccountInviteDirection.INCOMING,\n outgoing: Proto.SubaccountInviteDirection.OUTGOING,\n } satisfies InputToProto<SubaccountInviteDirectionValue, Proto.SubaccountInviteDirection>,\n} as const;\n\nexport const SubaccountStatusCodec = {\n inputToProto: {\n active: Proto.SubaccountStatus.ACTIVE,\n disabled: Proto.SubaccountStatus.DISABLED,\n } satisfies InputToProto<SubaccountStatusValue, Proto.SubaccountStatus>,\n protoToOutput: {\n [Proto.SubaccountStatus.UNSPECIFIED]: \"unspecified\",\n [Proto.SubaccountStatus.ACTIVE]: \"active\",\n [Proto.SubaccountStatus.DISABLED]: \"disabled\",\n } satisfies ProtoToOutput<Proto.SubaccountStatus, SubaccountStatusValue>,\n} as const;\n\nexport const ActivityEntityKindCodec = {\n protoToOutput: {\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_ACCOUNT]: \"account\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SESSION]: \"session\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_API_KEY]: \"api_key\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SUBACCOUNT]: \"subaccount\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_MEMBER]: \"member\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_POLICY]: \"policy\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_INVITE]: \"invite\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_SECURITY]: \"security\",\n [Proto.ActivityEntityKind.ACTIVITY_ENTITY_DESTINATION]: \"destination\",\n } satisfies ProtoToOutput<Proto.ActivityEntityKind, ActivityEntityKindValue>,\n} as const;\n\nexport const ActivityEventActionCodec = {\n protoToOutput: {\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_CREATED]: \"created\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_UPDATED]: \"updated\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DELETED]: \"deleted\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ENABLED]: \"enabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_DISABLED]: \"disabled\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REMOVED]: \"removed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_ROLE_SET]: \"role_set\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_RECEIVED]: \"received\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REPLIED]: \"replied\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_FAILED]: \"failed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_REVOKED]: \"revoked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_BLOCKED]: \"blocked\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_PLACED]: \"hold_placed\",\n [Proto.ActivityEventAction.ACTIVITY_ACTION_HOLD_RELEASED]: \"hold_released\",\n } satisfies ProtoToOutput<Proto.ActivityEventAction, ActivityEventActionValue>,\n} as const;\n\nexport const ActivityEventSourceCodec = {\n protoToOutput: {\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_WEB]: \"web\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_MOBILE]: \"mobile\",\n [Proto.ActivityEventSource.ACTIVITY_SOURCE_API]: \"api\",\n } satisfies ProtoToOutput<Proto.ActivityEventSource, ActivityEventSourceValue>,\n} as const;\n"],"mappings":";;AAwDA,MAAa,qCAAqC;CAAC;CAAI;CAAY;AAAU;AAG7E,MAAa,2BAA2B,CAAC,UAAU,UAAU;AAqC7D,MAAa,sBAAsB;CAC/B,cAAc;EACV,OAAA;EACA,OAAA;EACA,UAAA;EACA,kBAAA;EACA,QAAA;EACA,QAAA;CACJ;CACA,eAAe;GACyC,IAAA;GACtB,IAAA;GACA,IAAA;GACG,IAAA;GACQ,IAAA;GACV,IAAA;GACA,IAAA;CACnC;AACJ;AAEA,MAAa,4BAA4B,EACrC,eAAe;EAC+B,IAAA;EACI,IAAA;EACE,IAAA;EACJ,IAAA;EACJ,IAAA;EACC,IAAA;EACa,IAAA;EACN,IAAA;EACA,IAAA;EACA,IAAA;EACE,KAAA;EACP,KAAA;EACE,KAAA;EACF,KAAA;EACE,KAAA;EACD,KAAA;EACE,KAAA;EACO,KAAA;EACE,KAAA;EACX,KAAA;EAExC,KAAA;EACwD,KAAA;EACP,KAAA;EACA,KAAA;EACE,KAAA;EACL,KAAA;EACD,KAAA;EACE,KAAA;EAChB,KAAA;AACvC,EACJ;AAEA,MAAa,oBAAoB,EAC7B,cAAc;CACV,QAAA;CACA,SAAA;CACA,QAAA;AACJ,EACJ;AAEA,MAAa,oBAAoB,EAC7B,eAAe;EACiC,IAAA;EACJ,IAAA;EACC,IAAA;EACA,IAAA;EACC,IAAA;AAC9C,EACJ;AAEA,MAAa,iCAAiC,EAC1C,cAAc;CACV,IAAA;CACA,UAAA;CACA,UAAA;AACJ,EACJ;AAEA,MAAa,wBAAwB;CACjC,cAAc;EACV,QAAA;EACA,UAAA;CACJ;CACA,eAAe;GAC2B,IAAA;GACL,IAAA;GACE,IAAA;CACvC;AACJ;AAEA,MAAa,0BAA0B,EACnC,eAAe;EAC6C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACG,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACE,IAAA;EACG,IAAA;AAC5D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACJ,IAAA;EACA,IAAA;EACA,IAAA;EACA,IAAA;EACC,IAAA;EACD,IAAA;EACC,IAAA;EACA,IAAA;EACD,IAAA;EACD,KAAA;EACC,KAAA;EACA,KAAA;EACI,KAAA;EACE,KAAA;AAC/D,EACJ;AAEA,MAAa,2BAA2B,EACpC,eAAe;EAC8C,IAAA;EACR,IAAA;EACG,IAAA;EACH,IAAA;AACrD,EACJ"}
|
|
@@ -33,7 +33,7 @@ declare class SubaccountsService {
|
|
|
33
33
|
subaccounts: v.InferOutput<typeof SubaccountSchema>[];
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
36
|
-
* Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys,
|
|
36
|
+
* Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, members, and outgoing invites; throws if the subaccount is missing.
|
|
37
37
|
*/
|
|
38
38
|
get(input: v.InferInput<typeof SubaccountIdInputSchema>, options?: PolyesterRequestOptions): Promise<Subaccount & {
|
|
39
39
|
apiKeys: ApiKey[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccounts.d.ts","names":[],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"mappings":";;;;;;;;;;;;;;UAsDU,kCAAkC,mBAAmB;EAC3D;;UAGM,8BAA8B,mBA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,0BAC3B,UAAU,0BACX,QAAQ;;;;EAYL,YACF,OAAO,EAAE,kBAAkB,0BAC3B,UAAU,0BACX,QAAQ;;;;EAYL,cACF,OAAO,EAAE,kBAAkB,qCAC3B,UAAU,2BACX,QAAQ;;;;EAYL,WACF,OAAO,EAAE,kBAAkB,gCAC3B,UAAU,0BACX;IAAU,QAAQ;IAAmB;;;;;EAexC,UAAU,OAAO;;;;EAmBjB,iBAAiB,OAAO"}
|
|
@@ -39,7 +39,7 @@ var SubaccountsService = class {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
|
-
* Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys,
|
|
42
|
+
* Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, members, and outgoing invites; throws if the subaccount is missing.
|
|
43
43
|
*/
|
|
44
44
|
async get(input, options) {
|
|
45
45
|
const validatedInput = parse(SubaccountIdInputSchema, input);
|
|
@@ -47,7 +47,6 @@ var SubaccountsService = class {
|
|
|
47
47
|
const res = await this.#viewClient.getSubaccount({
|
|
48
48
|
subaccountId: validatedInput.subaccountId,
|
|
49
49
|
includeApiKeys: true,
|
|
50
|
-
includeBalances: true,
|
|
51
50
|
includeMembers: true,
|
|
52
51
|
includeInvites: true,
|
|
53
52
|
includePolicy: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccounts.js","names":["#client","Proto.SubaccountService","#viewClient","Proto.SubaccountViewService","#publicRoleClient","Proto.SubaccountRoleService","#authRoleClient","#realtime","SubaccountSchema","ApiKeySchema","Proto.SubaccountSchema","ProtoApiKeys.ApiKeySchema"],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoApiKeys from \"../../gen/auth/v1/api_keys_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type ApiKey, ApiKeySchema } from \"../api-keys/index.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport {\n DEFAULT_SUBACCOUNT_POLICY,\n SubaccountPoliciesService,\n type SubaccountPolicy,\n SubaccountPolicySchema,\n} from \"../policies/subaccount-policies/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport type { SubaccountResolver } from \"../subaccount-resolver.js\";\nimport {\n CreateSubaccountChallengeInputSchema,\n CreateSubaccountInputSchema,\n CreateSubaccountResultSchema,\n SubaccountChallengeSchema,\n UpdateSubaccountInputSchema,\n InviteSubaccountMemberInputSchema,\n RemoveSubaccountMemberInputSchema,\n UpdateSubaccountMemberRoleInputSchema,\n ListSubaccountInvitesInputSchema,\n RespondSubaccountInviteInputSchema,\n SubaccountActivityInputSchema,\n SubaccountSchema,\n SubaccountMemberSchema,\n SubaccountInviteSchema,\n SubaccountActivityEventSchema,\n SetSubaccountMemberMfaRequirementInputSchema,\n SubaccountIdInputSchema,\n SubaccountMutationResultSchema,\n SubaccountRoleCatalogSchema,\n EffectiveSubaccountPermissionsSchema,\n type CreateSubaccountResult,\n type SubaccountChallenge,\n type Subaccount,\n type SubaccountMember,\n type SubaccountInvite,\n type SubaccountEvent,\n type SubaccountMutationResult,\n type SubaccountRoleCatalog,\n type EffectiveSubaccountPermissions,\n} from \"./subaccounts.schemas.js\";\n\ninterface SubscribeSubaccountsInput extends BaseSubscribeInput<Subaccount> {\n accountId: string;\n}\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Reads the public role catalog and creates, manages, shares, audits, and subscribes to subaccounts visible to the authenticated caller.\n */\nexport class SubaccountsService {\n readonly policies: SubaccountPoliciesService;\n\n #client: Client<typeof Proto.SubaccountService>;\n #viewClient: Client<typeof Proto.SubaccountViewService>;\n #publicRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #authRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #realtime: PolyesterRealtime;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new SubaccountPoliciesService(transports, realtime, resolver);\n this.#client = createClient(Proto.SubaccountService, transports.authApi);\n this.#viewClient = createClient(Proto.SubaccountViewService, transports.authApi);\n this.#publicRoleClient = createClient(Proto.SubaccountRoleService, transports.publicApi);\n this.#authRoleClient = createClient(Proto.SubaccountRoleService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Returns subaccounts owned by or shared with the caller plus totalCreated, including soft-deleted ones. Use `createChallenge` for the canonical next smart-account address and salt.\n */\n async list(options?: PolyesterRequestOptions): Promise<{\n totalCreated: number;\n subaccounts: v.InferOutput<typeof SubaccountSchema>[];\n }> {\n const res = await this.#client.listSubaccounts({}, toConnectCallOptions(options));\n return {\n totalCreated: res.totalCreated,\n subaccounts: parse(v.array(SubaccountSchema), res.subaccounts),\n };\n }\n\n /**\n * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, balances, members, and outgoing invites; throws if the subaccount is missing.\n */\n async get(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<\n Subaccount & {\n apiKeys: ApiKey[];\n policy: SubaccountPolicy;\n members: SubaccountMember[];\n invites: SubaccountInvite[];\n }\n > {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const subaccountId = formatId(validatedInput.subaccountId);\n const res = await this.#viewClient.getSubaccount(\n {\n subaccountId: validatedInput.subaccountId,\n includeApiKeys: true,\n includeBalances: true,\n includeMembers: true,\n includeInvites: true,\n includePolicy: true,\n invitesDirection: Proto.SubaccountInviteDirection.OUTGOING,\n },\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(`Subaccount not found: ${subaccountId}`);\n\n return {\n ...parse(SubaccountSchema, res.subaccount),\n policy: res.policy\n ? parse(SubaccountPolicySchema, res.policy)\n : DEFAULT_SUBACCOUNT_POLICY,\n apiKeys: parse(v.optional(v.array(ApiKeySchema), []), res.apiKeys),\n members: parse(v.optional(v.array(SubaccountMemberSchema), []), res.members),\n invites: v\n .parse(v.optional(v.array(SubaccountInviteSchema), []), res.invites)\n .filter((invite) => invite.subaccountId === subaccountId),\n };\n }\n\n /**\n * Requests the canonical next smart account and a short-lived EIP-191 authorization message\n * bound to the authenticated root and the selected owner EOA. Sign the exact message through\n * the returned smart account, then pass it to `create`. A new challenge replaces the previous one.\n */\n async createChallenge(\n input: v.InferInput<typeof CreateSubaccountChallengeInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountChallenge> {\n const validatedInput = parse(CreateSubaccountChallengeInputSchema, input);\n const res = await this.#client.createSubaccountChallenge(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountChallengeSchema, res);\n }\n\n /**\n * Creates a new subaccount under the caller's root account using the smart-account address, message, and smart-account signature from `createChallenge`.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CreateSubaccountResult> {\n const validatedInput = parse(CreateSubaccountInputSchema, input);\n const res = await this.#client.createSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(CreateSubaccountResultSchema, res);\n }\n\n /**\n * Updates mutable subaccount display/status fields such as label and active/disabled status.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Subaccount> {\n const validatedInput = parse(UpdateSubaccountInputSchema, input);\n const res = await this.#client.updateSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(\"Failed to update subaccount\");\n return parse(SubaccountSchema, res.subaccount);\n }\n\n /**\n * Creates or refreshes a pending invitation granting a role on a subaccount to another root account.\n */\n async inviteMember(\n input: v.InferInput<typeof InviteSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(InviteSubaccountMemberInputSchema, input);\n const res = await this.#client.inviteSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Removes delegated access for a subaccount member by grantee account ID.\n */\n async removeMember(\n input: v.InferInput<typeof RemoveSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(RemoveSubaccountMemberInputSchema, input);\n const res = await this.#client.removeSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Changes an existing delegated member's role without sending a new invitation.\n */\n async updateMemberRole(\n input: v.InferInput<typeof UpdateSubaccountMemberRoleInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(UpdateSubaccountMemberRoleInputSchema, input);\n const res = await this.#client.updateSubaccountMemberRole(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Enables or disables the owner-controlled MFA requirement for delegated interactive member actions on a subaccount.\n */\n async setMemberMfaRequirement(\n input: v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(SetSubaccountMemberMfaRequirementInputSchema, input);\n const res = await this.#client.setSubaccountMemberMFARequirement(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Returns the caller's subaccount invitations, newest first. Omit `direction` to include both\n * incoming and outgoing invitations, or pass `\"incoming\"` or `\"outgoing\"` to filter.\n */\n async listInvites(\n input: v.InferInput<typeof ListSubaccountInvitesInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountInvite[]> {\n const validatedInput = parse(ListSubaccountInvitesInputSchema, input);\n const res = await this.#client.listSubaccountInvites(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountInviteSchema), res.invites);\n }\n\n /**\n * Returns the public built-in role and permission catalog with display metadata and per-role permission sets.\n */\n async listRoles(options?: PolyesterRequestOptions): Promise<SubaccountRoleCatalog> {\n const res = await this.#publicRoleClient.listSubaccountRoles(\n {},\n toConnectCallOptions(options),\n );\n return parse(SubaccountRoleCatalogSchema, res);\n }\n\n /**\n * Returns the caller's current role, effective role-granted permissions, and attached policy ID for a subaccount.\n */\n async getEffectivePermissions(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<EffectiveSubaccountPermissions> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#authRoleClient.getEffectiveSubaccountPermissions(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(EffectiveSubaccountPermissionsSchema, res);\n }\n\n /**\n * Returns the owner and delegated members for a subaccount, including role and MFA enrollment status.\n */\n async listMembers(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountMember[]> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#client.listSubaccountMembers(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountMemberSchema), res.members);\n }\n\n /**\n * Accepts or rejects an incoming invite, or cancels an outgoing invite, returning the updated invitation.\n */\n async respondInvite(\n input: v.InferInput<typeof RespondSubaccountInviteInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(RespondSubaccountInviteInputSchema, input);\n const res = await this.#client.respondSubaccountInvite(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Returns paginated audit/activity events for a subaccount, newest first, with a non-negative integer limit from 0 through 200 and opaque cursor pagination.\n */\n async listEvents(\n input: v.InferInput<typeof SubaccountActivityInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<{ events: SubaccountEvent[]; nextPageToken: string }> {\n const validatedInput = parse(SubaccountActivityInputSchema, input);\n const res = await this.#viewClient.listSubaccountActivity(\n validatedInput,\n toConnectCallOptions(options),\n );\n return {\n events: parse(v.optional(v.array(SubaccountActivityEventSchema), []), res.events),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Subscribes to private subaccount updates for an account and emits normalized subaccount records.\n */\n subscribe(input: SubscribeSubaccountsInput) {\n const channel = `private:auth:subaccounts:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountSchema,\n onPublication: (data) => {\n const subaccount = parse(SubaccountSchema, data);\n input.onEvent(subaccount);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to private API key updates for an account through the subaccount realtime channel helper.\n */\n subscribeApiKeys(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoApiKeys.ApiKeySchema,\n onPublication: (data) => {\n const apiKey = parse(ApiKeySchema, data);\n input.onEvent(apiKey);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiEA,IAAa,qBAAb,MAAgC;CAC5B;CAEA;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAK,WAAW,IAAI,0BAA0B,YAAY,UAAU,QAAQ;EAC5E,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,cAAc,aAAaC,uBAA6B,WAAW,OAAO;EAC/E,KAAKC,oBAAoB,aAAaC,uBAA6B,WAAW,SAAS;EACvF,KAAKC,kBAAkB,aAAaD,uBAA6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AAoB;GACtC;GACA,QAAQG;GACR,gBAAgB,SAAS;IACrB,MAAM,aAAa,MAAMF,oBAAkB,IAAI;IAC/C,MAAM,QAAQ,UAAU;GAC5B;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;;;;CAKA,iBAAiB,OAA8B;EAC3C,MAAM,UAAU,yBAAyB,MAAM,UAAU;EAEzD,OAAO,KAAKD,UAAU,oBAAoB;GACtC;GACA,QAAQI;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAMF,gBAAc,IAAI;IACvC,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
|
|
1
|
+
{"version":3,"file":"subaccounts.js","names":["#client","Proto.SubaccountService","#viewClient","Proto.SubaccountViewService","#publicRoleClient","Proto.SubaccountRoleService","#authRoleClient","#realtime","SubaccountSchema","ApiKeySchema","Proto.SubaccountSchema","ProtoApiKeys.ApiKeySchema"],"sources":["../../../src/services/subaccounts/subaccounts.ts"],"sourcesContent":["import * as Proto from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport * as ProtoApiKeys from \"../../gen/auth/v1/api_keys_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { type ApiKey, ApiKeySchema } from \"../api-keys/index.js\";\nimport { formatId } from \"../../utils/base58-id.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport {\n DEFAULT_SUBACCOUNT_POLICY,\n SubaccountPoliciesService,\n type SubaccountPolicy,\n SubaccountPolicySchema,\n} from \"../policies/subaccount-policies/index.js\";\nimport type { BaseSubscribeInput } from \"../../shared/types.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport type { SubaccountResolver } from \"../subaccount-resolver.js\";\nimport {\n CreateSubaccountChallengeInputSchema,\n CreateSubaccountInputSchema,\n CreateSubaccountResultSchema,\n SubaccountChallengeSchema,\n UpdateSubaccountInputSchema,\n InviteSubaccountMemberInputSchema,\n RemoveSubaccountMemberInputSchema,\n UpdateSubaccountMemberRoleInputSchema,\n ListSubaccountInvitesInputSchema,\n RespondSubaccountInviteInputSchema,\n SubaccountActivityInputSchema,\n SubaccountSchema,\n SubaccountMemberSchema,\n SubaccountInviteSchema,\n SubaccountActivityEventSchema,\n SetSubaccountMemberMfaRequirementInputSchema,\n SubaccountIdInputSchema,\n SubaccountMutationResultSchema,\n SubaccountRoleCatalogSchema,\n EffectiveSubaccountPermissionsSchema,\n type CreateSubaccountResult,\n type SubaccountChallenge,\n type Subaccount,\n type SubaccountMember,\n type SubaccountInvite,\n type SubaccountEvent,\n type SubaccountMutationResult,\n type SubaccountRoleCatalog,\n type EffectiveSubaccountPermissions,\n} from \"./subaccounts.schemas.js\";\n\ninterface SubscribeSubaccountsInput extends BaseSubscribeInput<Subaccount> {\n accountId: string;\n}\n\ninterface SubscribeApiKeysInput extends BaseSubscribeInput<ApiKey> {\n accountId: string;\n}\n\n/**\n * Reads the public role catalog and creates, manages, shares, audits, and subscribes to subaccounts visible to the authenticated caller.\n */\nexport class SubaccountsService {\n readonly policies: SubaccountPoliciesService;\n\n #client: Client<typeof Proto.SubaccountService>;\n #viewClient: Client<typeof Proto.SubaccountViewService>;\n #publicRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #authRoleClient: Client<typeof Proto.SubaccountRoleService>;\n #realtime: PolyesterRealtime;\n\n constructor(\n transports: AuthAndPublicApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.policies = new SubaccountPoliciesService(transports, realtime, resolver);\n this.#client = createClient(Proto.SubaccountService, transports.authApi);\n this.#viewClient = createClient(Proto.SubaccountViewService, transports.authApi);\n this.#publicRoleClient = createClient(Proto.SubaccountRoleService, transports.publicApi);\n this.#authRoleClient = createClient(Proto.SubaccountRoleService, transports.authApi);\n this.#realtime = realtime;\n }\n\n /**\n * Returns subaccounts owned by or shared with the caller plus totalCreated, including soft-deleted ones. Use `createChallenge` for the canonical next smart-account address and salt.\n */\n async list(options?: PolyesterRequestOptions): Promise<{\n totalCreated: number;\n subaccounts: v.InferOutput<typeof SubaccountSchema>[];\n }> {\n const res = await this.#client.listSubaccounts({}, toConnectCallOptions(options));\n return {\n totalCreated: res.totalCreated,\n subaccounts: parse(v.array(SubaccountSchema), res.subaccounts),\n };\n }\n\n /**\n * Fetches an aggregated subaccount dashboard view with subaccount details, policy, API keys, members, and outgoing invites; throws if the subaccount is missing.\n */\n async get(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<\n Subaccount & {\n apiKeys: ApiKey[];\n policy: SubaccountPolicy;\n members: SubaccountMember[];\n invites: SubaccountInvite[];\n }\n > {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const subaccountId = formatId(validatedInput.subaccountId);\n const res = await this.#viewClient.getSubaccount(\n {\n subaccountId: validatedInput.subaccountId,\n includeApiKeys: true,\n includeMembers: true,\n includeInvites: true,\n includePolicy: true,\n invitesDirection: Proto.SubaccountInviteDirection.OUTGOING,\n },\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(`Subaccount not found: ${subaccountId}`);\n\n return {\n ...parse(SubaccountSchema, res.subaccount),\n policy: res.policy\n ? parse(SubaccountPolicySchema, res.policy)\n : DEFAULT_SUBACCOUNT_POLICY,\n apiKeys: parse(v.optional(v.array(ApiKeySchema), []), res.apiKeys),\n members: parse(v.optional(v.array(SubaccountMemberSchema), []), res.members),\n invites: v\n .parse(v.optional(v.array(SubaccountInviteSchema), []), res.invites)\n .filter((invite) => invite.subaccountId === subaccountId),\n };\n }\n\n /**\n * Requests the canonical next smart account and a short-lived EIP-191 authorization message\n * bound to the authenticated root and the selected owner EOA. Sign the exact message through\n * the returned smart account, then pass it to `create`. A new challenge replaces the previous one.\n */\n async createChallenge(\n input: v.InferInput<typeof CreateSubaccountChallengeInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountChallenge> {\n const validatedInput = parse(CreateSubaccountChallengeInputSchema, input);\n const res = await this.#client.createSubaccountChallenge(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountChallengeSchema, res);\n }\n\n /**\n * Creates a new subaccount under the caller's root account using the smart-account address, message, and smart-account signature from `createChallenge`.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<CreateSubaccountResult> {\n const validatedInput = parse(CreateSubaccountInputSchema, input);\n const res = await this.#client.createSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(CreateSubaccountResultSchema, res);\n }\n\n /**\n * Updates mutable subaccount display/status fields such as label and active/disabled status.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<Subaccount> {\n const validatedInput = parse(UpdateSubaccountInputSchema, input);\n const res = await this.#client.updateSubaccount(\n validatedInput,\n toConnectCallOptions(options),\n );\n if (!res.subaccount) throw new Error(\"Failed to update subaccount\");\n return parse(SubaccountSchema, res.subaccount);\n }\n\n /**\n * Creates or refreshes a pending invitation granting a role on a subaccount to another root account.\n */\n async inviteMember(\n input: v.InferInput<typeof InviteSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(InviteSubaccountMemberInputSchema, input);\n const res = await this.#client.inviteSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Removes delegated access for a subaccount member by grantee account ID.\n */\n async removeMember(\n input: v.InferInput<typeof RemoveSubaccountMemberInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(RemoveSubaccountMemberInputSchema, input);\n const res = await this.#client.removeSubaccountMember(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Changes an existing delegated member's role without sending a new invitation.\n */\n async updateMemberRole(\n input: v.InferInput<typeof UpdateSubaccountMemberRoleInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(UpdateSubaccountMemberRoleInputSchema, input);\n const res = await this.#client.updateSubaccountMemberRole(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Enables or disables the owner-controlled MFA requirement for delegated interactive member actions on a subaccount.\n */\n async setMemberMfaRequirement(\n input: v.InferInput<typeof SetSubaccountMemberMfaRequirementInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountMutationResult> {\n const validatedInput = parse(SetSubaccountMemberMfaRequirementInputSchema, input);\n const res = await this.#client.setSubaccountMemberMFARequirement(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountMutationResultSchema, res);\n }\n\n /**\n * Returns the caller's subaccount invitations, newest first. Omit `direction` to include both\n * incoming and outgoing invitations, or pass `\"incoming\"` or `\"outgoing\"` to filter.\n */\n async listInvites(\n input: v.InferInput<typeof ListSubaccountInvitesInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountInvite[]> {\n const validatedInput = parse(ListSubaccountInvitesInputSchema, input);\n const res = await this.#client.listSubaccountInvites(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountInviteSchema), res.invites);\n }\n\n /**\n * Returns the public built-in role and permission catalog with display metadata and per-role permission sets.\n */\n async listRoles(options?: PolyesterRequestOptions): Promise<SubaccountRoleCatalog> {\n const res = await this.#publicRoleClient.listSubaccountRoles(\n {},\n toConnectCallOptions(options),\n );\n return parse(SubaccountRoleCatalogSchema, res);\n }\n\n /**\n * Returns the caller's current role, effective role-granted permissions, and attached policy ID for a subaccount.\n */\n async getEffectivePermissions(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<EffectiveSubaccountPermissions> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#authRoleClient.getEffectiveSubaccountPermissions(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(EffectiveSubaccountPermissionsSchema, res);\n }\n\n /**\n * Returns the owner and delegated members for a subaccount, including role and MFA enrollment status.\n */\n async listMembers(\n input: v.InferInput<typeof SubaccountIdInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountMember[]> {\n const validatedInput = parse(SubaccountIdInputSchema, input);\n const res = await this.#client.listSubaccountMembers(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountMemberSchema), res.members);\n }\n\n /**\n * Accepts or rejects an incoming invite, or cancels an outgoing invite, returning the updated invitation.\n */\n async respondInvite(\n input: v.InferInput<typeof RespondSubaccountInviteInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountInvite> {\n const validatedInput = parse(RespondSubaccountInviteInputSchema, input);\n const res = await this.#client.respondSubaccountInvite(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(SubaccountInviteSchema, res.invite);\n }\n\n /**\n * Returns paginated audit/activity events for a subaccount, newest first, with a non-negative integer limit from 0 through 200 and opaque cursor pagination.\n */\n async listEvents(\n input: v.InferInput<typeof SubaccountActivityInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<{ events: SubaccountEvent[]; nextPageToken: string }> {\n const validatedInput = parse(SubaccountActivityInputSchema, input);\n const res = await this.#viewClient.listSubaccountActivity(\n validatedInput,\n toConnectCallOptions(options),\n );\n return {\n events: parse(v.optional(v.array(SubaccountActivityEventSchema), []), res.events),\n nextPageToken: res.nextPageToken,\n };\n }\n\n /**\n * Subscribes to private subaccount updates for an account and emits normalized subaccount records.\n */\n subscribe(input: SubscribeSubaccountsInput) {\n const channel = `private:auth:subaccounts:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountSchema,\n onPublication: (data) => {\n const subaccount = parse(SubaccountSchema, data);\n input.onEvent(subaccount);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n\n /**\n * Subscribes to private API key updates for an account through the subaccount realtime channel helper.\n */\n subscribeApiKeys(input: SubscribeApiKeysInput) {\n const channel = `private:auth:api-keys:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: ProtoApiKeys.ApiKeySchema,\n onPublication: (data) => {\n const apiKey = parse(ApiKeySchema, data);\n input.onEvent(apiKey);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;AAiEA,IAAa,qBAAb,MAAgC;CAC5B;CAEA;CACA;CACA;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAK,WAAW,IAAI,0BAA0B,YAAY,UAAU,QAAQ;EAC5E,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;EACvE,KAAKC,cAAc,aAAaC,uBAA6B,WAAW,OAAO;EAC/E,KAAKC,oBAAoB,aAAaC,uBAA6B,WAAW,SAAS;EACvF,KAAKC,kBAAkB,aAAaD,uBAA6B,WAAW,OAAO;EACnF,KAAKE,YAAY;CACrB;;;;CAKA,MAAM,KAAK,SAGR;EACC,MAAM,MAAM,MAAM,KAAKP,QAAQ,gBAAgB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EAChF,OAAO;GACH,cAAc,IAAI;GAClB,aAAa,MAAM,EAAE,MAAMQ,kBAAgB,GAAG,IAAI,WAAW;EACjE;CACJ;;;;CAKA,MAAM,IACF,OACA,SAQF;EACE,MAAM,iBAAiB,MAAM,yBAAyB,KAAK;EAC3D,MAAM,eAAe,SAAS,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