@polyester/sdk 0.36.0-devnet-20261118141710 → 0.36.0-devnet-20261119010940
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 +32 -2
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +5 -6
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.d.ts +1 -1
- package/dist/gen/auth/v1/address_book_pb.js +1 -1
- package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +70 -9
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +16 -1
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +74 -5
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +58 -6
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/connected_apps_pb.d.ts +382 -0
- package/dist/gen/auth/v1/connected_apps_pb.d.ts.map +1 -0
- package/dist/gen/auth/v1/connected_apps_pb.js +107 -0
- package/dist/gen/auth/v1/connected_apps_pb.js.map +1 -0
- package/dist/gen/auth/v1/mfa_pb.d.ts +2 -140
- package/dist/gen/auth/v1/mfa_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.js +8 -80
- package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +164 -41
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +36 -3
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +4 -4
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +17 -10
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +3 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/fees/v1/fees_pb.d.ts +2 -1
- package/dist/gen/fees/v1/fees_pb.d.ts.map +1 -1
- package/dist/gen/fees/v1/fees_pb.js.map +1 -1
- package/dist/gen/index.d.ts +8 -5
- package/dist/gen/index.js +8 -5
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +3 -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.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts +9 -58
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.js +8 -57
- package/dist/gen/marketdata/v1/heatmap_pb.js.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +141 -4
- package/dist/gen/notifications/v1/notifications_pb.d.ts.map +1 -1
- package/dist/gen/notifications/v1/notifications_pb.js +94 -16
- package/dist/gen/notifications/v1/notifications_pb.js.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +14 -12
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js +6 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +66 -18
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +1 -1
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +8 -0
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/polyester/api/options_pb.d.ts +2 -1
- package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
- package/dist/gen/polyester/api/options_pb.js +2 -1
- package/dist/gen/polyester/api/options_pb.js.map +1 -1
- package/dist/gen/polyester/api/v1/request_error_pb.d.ts +66 -0
- package/dist/gen/polyester/api/v1/request_error_pb.d.ts.map +1 -0
- package/dist/gen/polyester/api/v1/request_error_pb.js +49 -0
- package/dist/gen/polyester/api/v1/request_error_pb.js.map +1 -0
- package/dist/gen/polyester/type/v1/depth_tier_pb.d.ts +98 -0
- package/dist/gen/polyester/type/v1/depth_tier_pb.d.ts.map +1 -0
- package/dist/gen/polyester/type/v1/depth_tier_pb.js +104 -0
- package/dist/gen/polyester/type/v1/depth_tier_pb.js.map +1 -0
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +42 -23
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts.map +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.js +14 -2
- package/dist/gen/ratelimit/v1/ratelimit_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +126 -13
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +100 -28
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +5 -3
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +25 -3
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +18 -1
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/realtime/ready-gated-subscription.js +1 -1
- package/dist/realtime/snapshot-then-stream.js +2 -0
- package/dist/realtime/snapshot-then-stream.js.map +1 -1
- package/dist/services/account-activity/account-activity.schemas.d.ts +4 -4
- package/dist/services/address-book/address-book.js +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/api-keys/api-keys.codecs.d.ts +6 -1
- package/dist/services/api-keys/api-keys.codecs.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.codecs.js +19 -7
- package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
- package/dist/services/api-keys/api-keys.js +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +12 -4
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +15 -6
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/api-keys/api-keys.types.d.ts +2 -2
- package/dist/services/assistant/assistant-events.schemas.d.ts +30 -30
- package/dist/services/assistant/assistant.schemas.d.ts +2 -2
- package/dist/services/auth/auth.d.ts +4 -0
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +12 -2
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +3 -3
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/changelog/changelog.schemas.d.ts +22 -22
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
- package/dist/services/connected-apps/connected-apps.d.ts +46 -0
- package/dist/services/connected-apps/connected-apps.d.ts.map +1 -0
- package/dist/services/connected-apps/connected-apps.js +69 -0
- package/dist/services/connected-apps/connected-apps.js.map +1 -0
- package/dist/services/connected-apps/connected-apps.schemas.d.ts +132 -0
- package/dist/services/connected-apps/connected-apps.schemas.d.ts.map +1 -0
- package/dist/services/connected-apps/connected-apps.schemas.js +68 -0
- package/dist/services/connected-apps/connected-apps.schemas.js.map +1 -0
- package/dist/services/connected-apps/connected-apps.types.d.ts +2 -0
- package/dist/services/connected-apps/service.d.ts +8 -0
- package/dist/services/connected-apps/service.d.ts.map +1 -0
- package/dist/services/connected-apps/service.js +9 -0
- package/dist/services/connected-apps/service.js.map +1 -0
- package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +2 -2
- package/dist/services/heatmap/heatmap.codecs.d.ts +1 -0
- package/dist/services/heatmap/heatmap.codecs.d.ts.map +1 -1
- package/dist/services/heatmap/heatmap.codecs.js +2 -27
- package/dist/services/heatmap/heatmap.codecs.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +9 -8
- package/dist/services/heatmap/heatmap.schemas.d.ts.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.js +4 -3
- package/dist/services/heatmap/heatmap.schemas.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +6 -6
- package/dist/services/lifecycle/lifecycle.js +1 -1
- package/dist/services/lifecycle/lifecycle.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +91 -91
- package/dist/services/notifications/notifications.codecs.d.ts +6 -3
- package/dist/services/notifications/notifications.codecs.d.ts.map +1 -1
- package/dist/services/notifications/notifications.codecs.js +14 -3
- package/dist/services/notifications/notifications.codecs.js.map +1 -1
- package/dist/services/notifications/notifications.schemas.d.ts +97 -3
- package/dist/services/notifications/notifications.schemas.d.ts.map +1 -1
- package/dist/services/notifications/notifications.schemas.js +18 -1
- package/dist/services/notifications/notifications.schemas.js.map +1 -1
- package/dist/services/notifications/notifications.types.d.ts +2 -2
- package/dist/services/orderbook/orderbook.codecs.js +1 -1
- package/dist/services/orderbook/orderbook.codecs.js.map +1 -1
- package/dist/services/orderbook/orderbook.d.ts +2 -2
- package/dist/services/orderbook/orderbook.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.js +8 -10
- package/dist/services/orderbook/orderbook.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +3 -6
- package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.js +5 -5
- package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +9 -9
- package/dist/services/orders/orders-batch.schemas.d.ts +106 -102
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +2 -0
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +23 -15
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +7 -2
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +8 -8
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +47 -43
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.d.ts +4 -1
- package/dist/services/policies/api-key-policies/api-key-policies.d.ts.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.js +5 -2
- package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +25 -15
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +3 -0
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js.map +1 -1
- package/dist/services/policies/shared.codecs.js +25 -5
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +4 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +5 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +11 -3
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +4 -0
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
- package/dist/services/rate-limits/rate-limits.codecs.d.ts +1 -1
- package/dist/services/rate-limits/rate-limits.codecs.js +2 -1
- package/dist/services/rate-limits/rate-limits.codecs.js.map +1 -1
- package/dist/services/rate-limits/rate-limits.schemas.d.ts +4 -4
- package/dist/services/statement-exports/statement-exports.schemas.d.ts +6 -6
- package/dist/services/subaccounts/subaccounts.js +2 -2
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +20 -20
- package/dist/services/system/system.schemas.d.ts +13 -13
- package/dist/services/trades/trades.d.ts.map +1 -1
- package/dist/services/trades/trades.js +12 -4
- package/dist/services/trades/trades.js.map +1 -1
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/transfers/transfers.js +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +57 -57
- package/dist/services/triggers/triggers.codecs.d.ts.map +1 -1
- package/dist/services/triggers/triggers.codecs.js +2 -0
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts.map +1 -1
- package/dist/services/triggers/triggers.js +14 -10
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +5 -2
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/decimal-surface.d.ts +6 -0
- package/dist/shared/decimal-surface.d.ts.map +1 -1
- package/dist/shared/decimal-surface.js +65 -1
- package/dist/shared/decimal-surface.js.map +1 -1
- package/dist/shared/depth-tier.js +46 -0
- package/dist/shared/depth-tier.js.map +1 -0
- package/dist/shared/error-detail.d.ts +6 -0
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +2 -1
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/request.js +16 -0
- package/dist/shared/error-details/request.js.map +1 -0
- package/dist/shared/rate-limit.schemas.d.ts +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +6 -4
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
2
1
|
import "../../gen/auth/v1/policies_pb.js";
|
|
2
|
+
import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
3
3
|
//#region src/services/policies/shared.codecs.ts
|
|
4
4
|
/** Product actions, accepted by sub-account and API-key policies. */
|
|
5
5
|
const PRODUCT_POLICY_ACTION_LABELS = [
|
|
@@ -49,7 +49,21 @@ const ACCOUNT_PERMISSION_POLICY_ACTION_LABELS = [
|
|
|
49
49
|
"read-notifications",
|
|
50
50
|
"read-account-activity"
|
|
51
51
|
];
|
|
52
|
-
|
|
52
|
+
/**
|
|
53
|
+
* Admin permissions, accepted by API-key policies only. They take effect only on an admin key
|
|
54
|
+
* (`purpose: "admin"`), letting it manage the main account's other keys and its sub-accounts'
|
|
55
|
+
* policies without a session.
|
|
56
|
+
*/
|
|
57
|
+
const ADMIN_POLICY_ACTION_LABELS = [
|
|
58
|
+
"manage-api-keys",
|
|
59
|
+
"manage-api-key-policies",
|
|
60
|
+
"manage-subaccount-policies"
|
|
61
|
+
];
|
|
62
|
+
const POLICY_ACTION_LABELS = [
|
|
63
|
+
...PRODUCT_POLICY_ACTION_LABELS,
|
|
64
|
+
...ACCOUNT_PERMISSION_POLICY_ACTION_LABELS,
|
|
65
|
+
...ADMIN_POLICY_ACTION_LABELS
|
|
66
|
+
];
|
|
53
67
|
const PolicyMarketScopeCodec = {
|
|
54
68
|
inputToProto: {
|
|
55
69
|
all: 1,
|
|
@@ -101,7 +115,10 @@ const PolicyActionCodec = {
|
|
|
101
115
|
[39]: "convert-dust",
|
|
102
116
|
[40]: "read-funding-flows",
|
|
103
117
|
[41]: "read-notifications",
|
|
104
|
-
[42]: "read-account-activity"
|
|
118
|
+
[42]: "read-account-activity",
|
|
119
|
+
[43]: "manage-api-keys",
|
|
120
|
+
[44]: "manage-api-key-policies",
|
|
121
|
+
[45]: "manage-subaccount-policies"
|
|
105
122
|
},
|
|
106
123
|
inputToProto: {
|
|
107
124
|
"trade-spot": 1,
|
|
@@ -141,7 +158,10 @@ const PolicyActionCodec = {
|
|
|
141
158
|
"convert-dust": 39,
|
|
142
159
|
"read-funding-flows": 40,
|
|
143
160
|
"read-notifications": 41,
|
|
144
|
-
"read-account-activity": 42
|
|
161
|
+
"read-account-activity": 42,
|
|
162
|
+
"manage-api-keys": 43,
|
|
163
|
+
"manage-api-key-policies": 44,
|
|
164
|
+
"manage-subaccount-policies": 45
|
|
145
165
|
}
|
|
146
166
|
};
|
|
147
167
|
/**
|
|
@@ -157,6 +177,6 @@ function policyActionLabelFor(value) {
|
|
|
157
177
|
return enumLabel(PolicyActionCodec.protoToOutput, value);
|
|
158
178
|
}
|
|
159
179
|
//#endregion
|
|
160
|
-
export { ACCOUNT_PERMISSION_POLICY_ACTION_LABELS, POLICY_ACTION_LABELS, PRODUCT_POLICY_ACTION_LABELS, PolicyActionCodec, PolicyMarketScopeCodec, policyActionLabelFor, policyMarketScopeLabelFor };
|
|
180
|
+
export { ACCOUNT_PERMISSION_POLICY_ACTION_LABELS, ADMIN_POLICY_ACTION_LABELS, POLICY_ACTION_LABELS, PRODUCT_POLICY_ACTION_LABELS, PolicyActionCodec, PolicyMarketScopeCodec, policyActionLabelFor, policyMarketScopeLabelFor };
|
|
161
181
|
|
|
162
182
|
//# sourceMappingURL=shared.codecs.js.map
|
|
@@ -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\n/** Product actions, accepted by sub-account and API-key policies. */\nexport const PRODUCT_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 \"read-statements\",\n \"convert-dust\",\n \"read-funding-flows\",\n] as const;\n\n/**\n * Account permissions, accepted by API-key policies only: a sub-account policy refuses them.\n * Each grants exactly the calls it names, and main-account permissions apply only to keys\n * scoped to the main account.\n */\nexport const ACCOUNT_PERMISSION_POLICY_ACTION_LABELS = [\n \"read-api-keys\",\n \"read-api-policies\",\n \"read-subaccount-policies\",\n \"read-subaccount-permissions\",\n \"read-vip-status\",\n \"read-social-verification\",\n \"read-profile\",\n \"read-account-directory\",\n \"read-withdraw-validation\",\n \"read-daily-claims\",\n \"claim-daily-reward\",\n \"read-checkpoints\",\n \"read-rewards\",\n \"create-deposit-address\",\n \"read-deposit-addresses\",\n \"read-subaccounts\",\n \"read-subaccount-activity\",\n \"read-subaccount-members\",\n \"read-subaccount-invites\",\n \"read-guard-signer-status\",\n \"read-price-alerts\",\n \"manage-price-alerts\",\n \"read-notifications\",\n \"read-account-activity\",\n] as const;\n\nexport const POLICY_ACTION_LABELS = [\n ...PRODUCT_POLICY_ACTION_LABELS,\n ...ACCOUNT_PERMISSION_POLICY_ACTION_LABELS,\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 [Proto.PolicyAction.READ_API_KEYS]: \"read-api-keys\",\n [Proto.PolicyAction.READ_API_POLICIES]: \"read-api-policies\",\n [Proto.PolicyAction.READ_SUBACCOUNT_POLICIES]: \"read-subaccount-policies\",\n [Proto.PolicyAction.READ_SUBACCOUNT_PERMISSIONS]: \"read-subaccount-permissions\",\n [Proto.PolicyAction.READ_VIP_STATUS]: \"read-vip-status\",\n [Proto.PolicyAction.READ_SOCIAL_VERIFICATION]: \"read-social-verification\",\n [Proto.PolicyAction.READ_PROFILE]: \"read-profile\",\n [Proto.PolicyAction.READ_ACCOUNT_DIRECTORY]: \"read-account-directory\",\n [Proto.PolicyAction.READ_WITHDRAW_VALIDATION]: \"read-withdraw-validation\",\n [Proto.PolicyAction.READ_DAILY_CLAIMS]: \"read-daily-claims\",\n [Proto.PolicyAction.CLAIM_DAILY_REWARD]: \"claim-daily-reward\",\n [Proto.PolicyAction.READ_CHECKPOINTS]: \"read-checkpoints\",\n [Proto.PolicyAction.READ_REWARDS]: \"read-rewards\",\n [Proto.PolicyAction.CREATE_DEPOSIT_ADDRESS]: \"create-deposit-address\",\n [Proto.PolicyAction.READ_DEPOSIT_ADDRESSES]: \"read-deposit-addresses\",\n [Proto.PolicyAction.READ_SUBACCOUNTS]: \"read-subaccounts\",\n [Proto.PolicyAction.READ_SUBACCOUNT_ACTIVITY]: \"read-subaccount-activity\",\n [Proto.PolicyAction.READ_SUBACCOUNT_MEMBERS]: \"read-subaccount-members\",\n [Proto.PolicyAction.READ_SUBACCOUNT_INVITES]: \"read-subaccount-invites\",\n [Proto.PolicyAction.READ_GUARD_SIGNER_STATUS]: \"read-guard-signer-status\",\n [Proto.PolicyAction.READ_PRICE_ALERTS]: \"read-price-alerts\",\n [Proto.PolicyAction.MANAGE_PRICE_ALERTS]: \"manage-price-alerts\",\n [Proto.PolicyAction.READ_STATEMENTS]: \"read-statements\",\n [Proto.PolicyAction.CONVERT_DUST]: \"convert-dust\",\n [Proto.PolicyAction.READ_FUNDING_FLOWS]: \"read-funding-flows\",\n [Proto.PolicyAction.READ_NOTIFICATIONS]: \"read-notifications\",\n [Proto.PolicyAction.READ_ACCOUNT_ACTIVITY]: \"read-account-activity\",\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 \"read-api-keys\": Proto.PolicyAction.READ_API_KEYS,\n \"read-api-policies\": Proto.PolicyAction.READ_API_POLICIES,\n \"read-subaccount-policies\": Proto.PolicyAction.READ_SUBACCOUNT_POLICIES,\n \"read-subaccount-permissions\": Proto.PolicyAction.READ_SUBACCOUNT_PERMISSIONS,\n \"read-vip-status\": Proto.PolicyAction.READ_VIP_STATUS,\n \"read-social-verification\": Proto.PolicyAction.READ_SOCIAL_VERIFICATION,\n \"read-profile\": Proto.PolicyAction.READ_PROFILE,\n \"read-account-directory\": Proto.PolicyAction.READ_ACCOUNT_DIRECTORY,\n \"read-withdraw-validation\": Proto.PolicyAction.READ_WITHDRAW_VALIDATION,\n \"read-daily-claims\": Proto.PolicyAction.READ_DAILY_CLAIMS,\n \"claim-daily-reward\": Proto.PolicyAction.CLAIM_DAILY_REWARD,\n \"read-checkpoints\": Proto.PolicyAction.READ_CHECKPOINTS,\n \"read-rewards\": Proto.PolicyAction.READ_REWARDS,\n \"create-deposit-address\": Proto.PolicyAction.CREATE_DEPOSIT_ADDRESS,\n \"read-deposit-addresses\": Proto.PolicyAction.READ_DEPOSIT_ADDRESSES,\n \"read-subaccounts\": Proto.PolicyAction.READ_SUBACCOUNTS,\n \"read-subaccount-activity\": Proto.PolicyAction.READ_SUBACCOUNT_ACTIVITY,\n \"read-subaccount-members\": Proto.PolicyAction.READ_SUBACCOUNT_MEMBERS,\n \"read-subaccount-invites\": Proto.PolicyAction.READ_SUBACCOUNT_INVITES,\n \"read-guard-signer-status\": Proto.PolicyAction.READ_GUARD_SIGNER_STATUS,\n \"read-price-alerts\": Proto.PolicyAction.READ_PRICE_ALERTS,\n \"manage-price-alerts\": Proto.PolicyAction.MANAGE_PRICE_ALERTS,\n \"read-statements\": Proto.PolicyAction.READ_STATEMENTS,\n \"convert-dust\": Proto.PolicyAction.CONVERT_DUST,\n \"read-funding-flows\": Proto.PolicyAction.READ_FUNDING_FLOWS,\n \"read-notifications\": Proto.PolicyAction.READ_NOTIFICATIONS,\n \"read-account-activity\": Proto.PolicyAction.READ_ACCOUNT_ACTIVITY,\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":";;;;AAKA,MAAa,+BAA+B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;;;;;AAOA,MAAa,0CAA0C;CACnD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAEA,MAAa,uBAAuB,CAChC,GAAG,8BACH,GAAG,uCACP;AAMA,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;GACS,KAAA;GACI,KAAA;GACO,KAAA;GACG,KAAA;GACZ,KAAA;GACS,KAAA;GACZ,KAAA;GACU,KAAA;GACE,KAAA;GACP,KAAA;GACC,KAAA;GACF,KAAA;GACJ,KAAA;GACU,KAAA;GACA,KAAA;GACN,KAAA;GACQ,KAAA;GACD,KAAA;GACA,KAAA;GACC,KAAA;GACP,KAAA;GACE,KAAA;GACJ,KAAA;GACH,KAAA;GACM,KAAA;GACA,KAAA;GACG,KAAA;CAChD;CACA,cAAc;EACV,cAAA;EACA,qBAAA;EACA,qBAAA;EACA,iBAAA;EACA,aAAA;EACA,2BAAA;EACA,qBAAA;EACA,uBAAA;EACA,sBAAA;EACA,wBAAA;EACA,MAAA;EACA,iBAAA;EACA,qBAAA;EACA,4BAAA;EACA,+BAAA;EACA,mBAAA;EACA,4BAAA;EACA,gBAAA;EACA,0BAAA;EACA,4BAAA;EACA,qBAAA;EACA,sBAAA;EACA,oBAAA;EACA,gBAAA;EACA,0BAAA;EACA,0BAAA;EACA,oBAAA;EACA,4BAAA;EACA,2BAAA;EACA,2BAAA;EACA,4BAAA;EACA,qBAAA;EACA,uBAAA;EACA,mBAAA;EACA,gBAAA;EACA,sBAAA;EACA,sBAAA;EACA,yBAAA;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
|
+
{"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\n/** Product actions, accepted by sub-account and API-key policies. */\nexport const PRODUCT_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 \"read-statements\",\n \"convert-dust\",\n \"read-funding-flows\",\n] as const;\n\n/**\n * Account permissions, accepted by API-key policies only: a sub-account policy refuses them.\n * Each grants exactly the calls it names, and main-account permissions apply only to keys\n * scoped to the main account.\n */\nexport const ACCOUNT_PERMISSION_POLICY_ACTION_LABELS = [\n \"read-api-keys\",\n \"read-api-policies\",\n \"read-subaccount-policies\",\n \"read-subaccount-permissions\",\n \"read-vip-status\",\n \"read-social-verification\",\n \"read-profile\",\n \"read-account-directory\",\n \"read-withdraw-validation\",\n \"read-daily-claims\",\n \"claim-daily-reward\",\n \"read-checkpoints\",\n \"read-rewards\",\n \"create-deposit-address\",\n \"read-deposit-addresses\",\n \"read-subaccounts\",\n \"read-subaccount-activity\",\n \"read-subaccount-members\",\n \"read-subaccount-invites\",\n \"read-guard-signer-status\",\n \"read-price-alerts\",\n \"manage-price-alerts\",\n \"read-notifications\",\n \"read-account-activity\",\n] as const;\n\n/**\n * Admin permissions, accepted by API-key policies only. They take effect only on an admin key\n * (`purpose: \"admin\"`), letting it manage the main account's other keys and its sub-accounts'\n * policies without a session.\n */\nexport const ADMIN_POLICY_ACTION_LABELS = [\n \"manage-api-keys\",\n \"manage-api-key-policies\",\n \"manage-subaccount-policies\",\n] as const;\n\nexport const POLICY_ACTION_LABELS = [\n ...PRODUCT_POLICY_ACTION_LABELS,\n ...ACCOUNT_PERMISSION_POLICY_ACTION_LABELS,\n ...ADMIN_POLICY_ACTION_LABELS,\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 [Proto.PolicyAction.READ_API_KEYS]: \"read-api-keys\",\n [Proto.PolicyAction.READ_API_POLICIES]: \"read-api-policies\",\n [Proto.PolicyAction.READ_SUBACCOUNT_POLICIES]: \"read-subaccount-policies\",\n [Proto.PolicyAction.READ_SUBACCOUNT_PERMISSIONS]: \"read-subaccount-permissions\",\n [Proto.PolicyAction.READ_VIP_STATUS]: \"read-vip-status\",\n [Proto.PolicyAction.READ_SOCIAL_VERIFICATION]: \"read-social-verification\",\n [Proto.PolicyAction.READ_PROFILE]: \"read-profile\",\n [Proto.PolicyAction.READ_ACCOUNT_DIRECTORY]: \"read-account-directory\",\n [Proto.PolicyAction.READ_WITHDRAW_VALIDATION]: \"read-withdraw-validation\",\n [Proto.PolicyAction.READ_DAILY_CLAIMS]: \"read-daily-claims\",\n [Proto.PolicyAction.CLAIM_DAILY_REWARD]: \"claim-daily-reward\",\n [Proto.PolicyAction.READ_CHECKPOINTS]: \"read-checkpoints\",\n [Proto.PolicyAction.READ_REWARDS]: \"read-rewards\",\n [Proto.PolicyAction.CREATE_DEPOSIT_ADDRESS]: \"create-deposit-address\",\n [Proto.PolicyAction.READ_DEPOSIT_ADDRESSES]: \"read-deposit-addresses\",\n [Proto.PolicyAction.READ_SUBACCOUNTS]: \"read-subaccounts\",\n [Proto.PolicyAction.READ_SUBACCOUNT_ACTIVITY]: \"read-subaccount-activity\",\n [Proto.PolicyAction.READ_SUBACCOUNT_MEMBERS]: \"read-subaccount-members\",\n [Proto.PolicyAction.READ_SUBACCOUNT_INVITES]: \"read-subaccount-invites\",\n [Proto.PolicyAction.READ_GUARD_SIGNER_STATUS]: \"read-guard-signer-status\",\n [Proto.PolicyAction.READ_PRICE_ALERTS]: \"read-price-alerts\",\n [Proto.PolicyAction.MANAGE_PRICE_ALERTS]: \"manage-price-alerts\",\n [Proto.PolicyAction.READ_STATEMENTS]: \"read-statements\",\n [Proto.PolicyAction.CONVERT_DUST]: \"convert-dust\",\n [Proto.PolicyAction.READ_FUNDING_FLOWS]: \"read-funding-flows\",\n [Proto.PolicyAction.READ_NOTIFICATIONS]: \"read-notifications\",\n [Proto.PolicyAction.READ_ACCOUNT_ACTIVITY]: \"read-account-activity\",\n [Proto.PolicyAction.MANAGE_API_KEYS]: \"manage-api-keys\",\n [Proto.PolicyAction.MANAGE_API_KEY_POLICIES]: \"manage-api-key-policies\",\n [Proto.PolicyAction.MANAGE_SUBACCOUNT_POLICIES]: \"manage-subaccount-policies\",\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 \"read-api-keys\": Proto.PolicyAction.READ_API_KEYS,\n \"read-api-policies\": Proto.PolicyAction.READ_API_POLICIES,\n \"read-subaccount-policies\": Proto.PolicyAction.READ_SUBACCOUNT_POLICIES,\n \"read-subaccount-permissions\": Proto.PolicyAction.READ_SUBACCOUNT_PERMISSIONS,\n \"read-vip-status\": Proto.PolicyAction.READ_VIP_STATUS,\n \"read-social-verification\": Proto.PolicyAction.READ_SOCIAL_VERIFICATION,\n \"read-profile\": Proto.PolicyAction.READ_PROFILE,\n \"read-account-directory\": Proto.PolicyAction.READ_ACCOUNT_DIRECTORY,\n \"read-withdraw-validation\": Proto.PolicyAction.READ_WITHDRAW_VALIDATION,\n \"read-daily-claims\": Proto.PolicyAction.READ_DAILY_CLAIMS,\n \"claim-daily-reward\": Proto.PolicyAction.CLAIM_DAILY_REWARD,\n \"read-checkpoints\": Proto.PolicyAction.READ_CHECKPOINTS,\n \"read-rewards\": Proto.PolicyAction.READ_REWARDS,\n \"create-deposit-address\": Proto.PolicyAction.CREATE_DEPOSIT_ADDRESS,\n \"read-deposit-addresses\": Proto.PolicyAction.READ_DEPOSIT_ADDRESSES,\n \"read-subaccounts\": Proto.PolicyAction.READ_SUBACCOUNTS,\n \"read-subaccount-activity\": Proto.PolicyAction.READ_SUBACCOUNT_ACTIVITY,\n \"read-subaccount-members\": Proto.PolicyAction.READ_SUBACCOUNT_MEMBERS,\n \"read-subaccount-invites\": Proto.PolicyAction.READ_SUBACCOUNT_INVITES,\n \"read-guard-signer-status\": Proto.PolicyAction.READ_GUARD_SIGNER_STATUS,\n \"read-price-alerts\": Proto.PolicyAction.READ_PRICE_ALERTS,\n \"manage-price-alerts\": Proto.PolicyAction.MANAGE_PRICE_ALERTS,\n \"read-statements\": Proto.PolicyAction.READ_STATEMENTS,\n \"convert-dust\": Proto.PolicyAction.CONVERT_DUST,\n \"read-funding-flows\": Proto.PolicyAction.READ_FUNDING_FLOWS,\n \"read-notifications\": Proto.PolicyAction.READ_NOTIFICATIONS,\n \"read-account-activity\": Proto.PolicyAction.READ_ACCOUNT_ACTIVITY,\n \"manage-api-keys\": Proto.PolicyAction.MANAGE_API_KEYS,\n \"manage-api-key-policies\": Proto.PolicyAction.MANAGE_API_KEY_POLICIES,\n \"manage-subaccount-policies\": Proto.PolicyAction.MANAGE_SUBACCOUNT_POLICIES,\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":";;;;AAKA,MAAa,+BAA+B;CACxC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;;;;;;AAOA,MAAa,0CAA0C;CACnD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;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ACA,8BAAA;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", "read-auto-withdraw", "manage-auto-withdraw", "swap", "read-statements", "convert-dust", "read-funding-flows", "read-api-keys", "read-api-policies", "read-subaccount-policies", "read-subaccount-permissions", "read-vip-status", "read-social-verification", "read-profile", "read-account-directory", "read-withdraw-validation", "read-daily-claims", "claim-daily-reward", "read-checkpoints", "read-rewards", "create-deposit-address", "read-deposit-addresses", "read-subaccounts", "read-subaccount-activity", "read-subaccount-members", "read-subaccount-invites", "read-guard-signer-status", "read-price-alerts", "manage-price-alerts", "read-notifications", "read-account-activity"], 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", "read-statements", "convert-dust", "read-funding-flows", "read-api-keys", "read-api-policies", "read-subaccount-policies", "read-subaccount-permissions", "read-vip-status", "read-social-verification", "read-profile", "read-account-directory", "read-withdraw-validation", "read-daily-claims", "claim-daily-reward", "read-checkpoints", "read-rewards", "create-deposit-address", "read-deposit-addresses", "read-subaccounts", "read-subaccount-activity", "read-subaccount-members", "read-subaccount-invites", "read-guard-signer-status", "read-price-alerts", "manage-price-alerts", "read-notifications", "read-account-activity", "manage-api-keys", "manage-api-key-policies", "manage-subaccount-policies"], 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>;
|
|
@@ -38,8 +38,11 @@ declare class SubaccountPoliciesService {
|
|
|
38
38
|
delete(policyId: string, options?: PolyesterMutationOptions): Promise<void>;
|
|
39
39
|
/**
|
|
40
40
|
* Attaches a policy to a subaccount. Passing a null policyId clears the explicit binding and restores the system read-only policy.
|
|
41
|
+
* Returns the attached policy's ID: a new copy when `policyId` named a template, else `policyId`; null when cleared.
|
|
41
42
|
*/
|
|
42
|
-
apply(input: v.InferInput<typeof ApplySubaccountPolicyInputSchema>, options?: PolyesterMutationOptions): Promise<
|
|
43
|
+
apply(input: v.InferInput<typeof ApplySubaccountPolicyInputSchema>, options?: PolyesterMutationOptions): Promise<{
|
|
44
|
+
policyId: string | null;
|
|
45
|
+
}>;
|
|
43
46
|
/**
|
|
44
47
|
* Subscribes to private subaccount policy updates for an account and emits normalized policy views.
|
|
45
48
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccount-policies.d.ts","names":[],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"subaccount-policies.d.ts","names":[],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.ts"],"mappings":";;;;;;;;;UA0BU,+BAA+B,mBAAmB;EACxD;;;;;cAMS;;EAML,YAAA,YAAY,mBACZ,UAAU,mBACV,WAAW;;;;EAUT,KACF,QAAO,EAAE,kBAAkB,oCAC3B,UAAU,0BACX,QAAQ;;;;EAaL,IACF,OAAO,EAAE,kBAAkB,iCAC3B,UAAU,0BACX,QAAQ;;;;EAcL,OACF,OAAO,EAAE,kBAAkB,oCAC3B,UAAU,2BACX,QAAQ;;;;EAaL,OACF,OAAO,EAAE,kBAAkB,oCAC3B,UAAU,2BACX,QAAQ;;;;EAaL,OAAO,kBAAkB,UAAU,2BAA2B;;;;;EAY9D,MACF,OAAO,EAAE,kBAAkB,mCAC3B,UAAU,2BACX;IAAU;;;;;EAYb,kBAAkB,OAAO"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { PolicyService, SubaccountPolicyViewSchema } from "../../../gen/auth/v1/policies_pb.js";
|
|
1
2
|
import { parse } from "../../../shared/validation.js";
|
|
2
3
|
import { removeUndefined } from "../../../utils/remove-undefined.js";
|
|
3
4
|
import { toConnectCallOptions } from "../../../shared/request-options.js";
|
|
4
|
-
import {
|
|
5
|
+
import { formatId } from "../../../utils/base58-id.js";
|
|
5
6
|
import { resolveAccountScopedInput } from "../../subaccount-resolver.js";
|
|
6
7
|
import { ApplySubaccountPolicyInputSchema, CreateSubaccountPolicyInputSchema, GetSubaccountPolicyInputSchema, ListSubaccountPoliciesInputSchema, PolicyIdSchema, SubaccountPolicySchema, UpdateSubaccountPolicyInputSchema } from "./subaccount-policies.schemas.js";
|
|
7
8
|
import { createClient } from "@connectrpc/connect";
|
|
@@ -65,10 +66,12 @@ var SubaccountPoliciesService = class {
|
|
|
65
66
|
}
|
|
66
67
|
/**
|
|
67
68
|
* Attaches a policy to a subaccount. Passing a null policyId clears the explicit binding and restores the system read-only policy.
|
|
69
|
+
* Returns the attached policy's ID: a new copy when `policyId` named a template, else `policyId`; null when cleared.
|
|
68
70
|
*/
|
|
69
71
|
async apply(input, options) {
|
|
70
72
|
const validatedInput = parse(ApplySubaccountPolicyInputSchema, input);
|
|
71
|
-
await this.#client.setSubaccountPolicy(removeUndefined(validatedInput), toConnectCallOptions(options));
|
|
73
|
+
const res = await this.#client.setSubaccountPolicy(removeUndefined(validatedInput), toConnectCallOptions(options));
|
|
74
|
+
return { policyId: res.policyId ? formatId(res.policyId) : null };
|
|
72
75
|
}
|
|
73
76
|
/**
|
|
74
77
|
* Subscribes to private subaccount policy updates for an account and emits normalized policy views.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccount-policies.js","names":["#client","Proto.PolicyService","#realtime","#resolver","Proto.SubaccountPolicyViewSchema"],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.ts"],"sourcesContent":["import * as Proto from \"../../../gen/auth/v1/policies_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../../shared/validation.js\";\nimport { removeUndefined } from \"../../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../../shared/request-options.js\";\nimport type { BaseSubscribeInput } from \"../../../shared/types.js\";\nimport type { PolyesterRealtime } from \"../../../realtime/index.js\";\nimport type { AuthApiTransports } from \"../../../shared/transports.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../../subaccount-resolver.js\";\nimport {\n SubaccountPolicySchema,\n CreateSubaccountPolicyInputSchema,\n UpdateSubaccountPolicyInputSchema,\n PolicyIdSchema,\n ApplySubaccountPolicyInputSchema,\n type SubaccountPolicy,\n ListSubaccountPoliciesInputSchema,\n GetSubaccountPolicyInputSchema,\n} from \"./subaccount-policies.schemas.js\";\n\ninterface SubscribePoliciesInput extends BaseSubscribeInput<SubaccountPolicy> {\n accountId: string;\n}\n\n/**\n * Manages reusable subaccount policy templates, assignments, and realtime policy updates.\n */\nexport class SubaccountPoliciesService {\n #client: Client<typeof Proto.PolicyService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.#client = createClient(Proto.PolicyService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n }\n\n /**\n * Returns subaccount policy templates visible to the caller, sorted by ascending policy ID. API keys need `read-subaccount-policies`; a key scoped to a sub-account sees only that sub-account's policy.\n */\n async list(\n input: v.InferInput<typeof ListSubaccountPoliciesInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountPolicy[]> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(ListSubaccountPoliciesInputSchema, resolved);\n const result = await this.#client.listSubaccountPolicies(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountPolicySchema), result.policies);\n }\n\n /**\n * Fetches one subaccount policy template by base58 policy ID and returns null when no policy is returned. API keys need `read-subaccount-policies`.\n */\n async get(\n input: v.InferInput<typeof GetSubaccountPolicyInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountPolicy | null> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetSubaccountPolicyInputSchema, resolved);\n const result = await this.#client.getSubaccountPolicy(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n if (!result.policy) return null;\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Creates a subaccount policy template, optionally attaching it to a target subaccount in the same request.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountPolicy> {\n const validatedInput = parse(CreateSubaccountPolicyInputSchema, input);\n const result = await this.#client.createSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!result.policy) throw new Error(\"Failed to create subaccount policy\");\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Updates selected subaccount policy fields using optimistic concurrency.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountPolicy> {\n const validatedInput = parse(UpdateSubaccountPolicyInputSchema, input);\n const result = await this.#client.updateSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!result.policy) throw new Error(\"Failed to update subaccount policy\");\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Deletes a subaccount policy template when it is not in use.\n */\n async delete(policyId: string, options?: PolyesterMutationOptions): Promise<void> {\n const validatedPolicyId = parse(PolicyIdSchema, policyId);\n await this.#client.deleteSubaccountPolicy(\n { policyId: validatedPolicyId },\n toConnectCallOptions(options),\n );\n }\n\n /**\n * Attaches a policy to a subaccount. Passing a null policyId clears the explicit binding and restores the system read-only policy.\n */\n async apply(\n input: v.InferInput<typeof ApplySubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<
|
|
1
|
+
{"version":3,"file":"subaccount-policies.js","names":["#client","Proto.PolicyService","#realtime","#resolver","Proto.SubaccountPolicyViewSchema"],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.ts"],"sourcesContent":["import * as Proto from \"../../../gen/auth/v1/policies_pb.js\";\nimport { formatId } from \"../../../utils/base58-id.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../../shared/validation.js\";\nimport { removeUndefined } from \"../../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../../shared/request-options.js\";\nimport type { BaseSubscribeInput } from \"../../../shared/types.js\";\nimport type { PolyesterRealtime } from \"../../../realtime/index.js\";\nimport type { AuthApiTransports } from \"../../../shared/transports.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../../subaccount-resolver.js\";\nimport {\n SubaccountPolicySchema,\n CreateSubaccountPolicyInputSchema,\n UpdateSubaccountPolicyInputSchema,\n PolicyIdSchema,\n ApplySubaccountPolicyInputSchema,\n type SubaccountPolicy,\n ListSubaccountPoliciesInputSchema,\n GetSubaccountPolicyInputSchema,\n} from \"./subaccount-policies.schemas.js\";\n\ninterface SubscribePoliciesInput extends BaseSubscribeInput<SubaccountPolicy> {\n accountId: string;\n}\n\n/**\n * Manages reusable subaccount policy templates, assignments, and realtime policy updates.\n */\nexport class SubaccountPoliciesService {\n #client: Client<typeof Proto.PolicyService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.#client = createClient(Proto.PolicyService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n }\n\n /**\n * Returns subaccount policy templates visible to the caller, sorted by ascending policy ID. API keys need `read-subaccount-policies`; a key scoped to a sub-account sees only that sub-account's policy.\n */\n async list(\n input: v.InferInput<typeof ListSubaccountPoliciesInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountPolicy[]> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(ListSubaccountPoliciesInputSchema, resolved);\n const result = await this.#client.listSubaccountPolicies(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountPolicySchema), result.policies);\n }\n\n /**\n * Fetches one subaccount policy template by base58 policy ID and returns null when no policy is returned. API keys need `read-subaccount-policies`.\n */\n async get(\n input: v.InferInput<typeof GetSubaccountPolicyInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountPolicy | null> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetSubaccountPolicyInputSchema, resolved);\n const result = await this.#client.getSubaccountPolicy(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n if (!result.policy) return null;\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Creates a subaccount policy template, optionally attaching it to a target subaccount in the same request.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountPolicy> {\n const validatedInput = parse(CreateSubaccountPolicyInputSchema, input);\n const result = await this.#client.createSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!result.policy) throw new Error(\"Failed to create subaccount policy\");\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Updates selected subaccount policy fields using optimistic concurrency.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountPolicy> {\n const validatedInput = parse(UpdateSubaccountPolicyInputSchema, input);\n const result = await this.#client.updateSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!result.policy) throw new Error(\"Failed to update subaccount policy\");\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Deletes a subaccount policy template when it is not in use.\n */\n async delete(policyId: string, options?: PolyesterMutationOptions): Promise<void> {\n const validatedPolicyId = parse(PolicyIdSchema, policyId);\n await this.#client.deleteSubaccountPolicy(\n { policyId: validatedPolicyId },\n toConnectCallOptions(options),\n );\n }\n\n /**\n * Attaches a policy to a subaccount. Passing a null policyId clears the explicit binding and restores the system read-only policy.\n * Returns the attached policy's ID: a new copy when `policyId` named a template, else `policyId`; null when cleared.\n */\n async apply(\n input: v.InferInput<typeof ApplySubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<{ policyId: string | null }> {\n const validatedInput = parse(ApplySubaccountPolicyInputSchema, input);\n const res = await this.#client.setSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n return { policyId: res.policyId ? formatId(res.policyId) : null };\n }\n\n /**\n * Subscribes to private subaccount policy updates for an account and emits normalized policy views.\n */\n subscribePolicies(input: SubscribePoliciesInput) {\n const channel = `private:auth:subaccount-policies:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountPolicyViewSchema,\n onPublication: (data) => {\n const policy = parse(SubaccountPolicySchema, data);\n input.onEvent(policy);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAiCA,IAAa,4BAAb,MAAuC;CACnC;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAKA,UAAU,aAAaC,eAAqB,WAAW,OAAO;EACnE,KAAKC,YAAY;EACjB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E,UAAU,kBAAkB,GAC9B,qBAAqB,OAAO,CAChC;CACJ;;;;;CAMA,MAAM,MACF,OACA,SACoC;EACpC,MAAM,iBAAiB,MAAM,kCAAkC,KAAK;EACpE,MAAM,MAAM,MAAM,KAAKA,QAAQ,oBAC3B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,OAAO,EAAE,UAAU,IAAI,WAAW,SAAS,IAAI,QAAQ,IAAI,KAAK;CACpE;;;;CAKA,kBAAkB,OAA+B;EAC7C,MAAM,UAAU,oCAAoC,MAAM,UAAU;EAEpE,OAAO,KAAKE,UAAU,oBAAoB;GACtC;GACA,QAAQE;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAM,wBAAwB,IAAI;IACjD,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
|
|
@@ -38,9 +38,11 @@ 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<"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" | "read-statements" | "convert-dust" | "read-funding-flows" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards" | "create-deposit-address" | "read-deposit-addresses" | "read-subaccounts" | "read-subaccount-activity" | "read-subaccount-members" | "read-subaccount-invites" | "read-guard-signer-status" | "read-price-alerts" | "manage-price-alerts" | "read-notifications" | "read-account-activity">[]>]>;
|
|
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" | "read-statements" | "convert-dust" | "read-funding-flows" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards" | "create-deposit-address" | "read-deposit-addresses" | "read-subaccounts" | "read-subaccount-activity" | "read-subaccount-members" | "read-subaccount-invites" | "read-guard-signer-status" | "read-price-alerts" | "manage-price-alerts" | "read-notifications" | "read-account-activity" | "manage-api-keys" | "manage-api-key-policies" | "manage-subaccount-policies">[]>]>;
|
|
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
|
+
/** Template revision this policy was copied at; `"0"` when it is not a copy. */
|
|
45
|
+
readonly sourceTemplateRevision: v.OptionalSchema<v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>, 0n>;
|
|
44
46
|
readonly maxOrderNotional: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
45
47
|
readonly maxOpenOrders: v.NumberSchema<undefined>;
|
|
46
48
|
readonly tradingHalted: v.BooleanSchema<undefined>;
|
|
@@ -79,9 +81,10 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
79
81
|
symbolId: number;
|
|
80
82
|
}[];
|
|
81
83
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
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" | "read-statements" | "convert-dust" | "read-funding-flows" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards" | "create-deposit-address" | "read-deposit-addresses" | "read-subaccounts" | "read-subaccount-activity" | "read-subaccount-members" | "read-subaccount-invites" | "read-guard-signer-status" | "read-price-alerts" | "manage-price-alerts" | "read-notifications" | "read-account-activity">[];
|
|
84
|
+
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" | "read-statements" | "convert-dust" | "read-funding-flows" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards" | "create-deposit-address" | "read-deposit-addresses" | "read-subaccounts" | "read-subaccount-activity" | "read-subaccount-members" | "read-subaccount-invites" | "read-guard-signer-status" | "read-price-alerts" | "manage-price-alerts" | "read-notifications" | "read-account-activity" | "manage-api-keys" | "manage-api-key-policies" | "manage-subaccount-policies">[];
|
|
83
85
|
isTemplate: boolean;
|
|
84
86
|
sourceTemplateId?: string | undefined;
|
|
87
|
+
sourceTemplateRevision: string;
|
|
85
88
|
maxOrderNotional: string;
|
|
86
89
|
maxOpenOrders: number;
|
|
87
90
|
tradingHalted: boolean;
|
|
@@ -104,9 +107,10 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
104
107
|
symbolId: number;
|
|
105
108
|
}[];
|
|
106
109
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
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" | "read-statements" | "convert-dust" | "read-funding-flows" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards" | "create-deposit-address" | "read-deposit-addresses" | "read-subaccounts" | "read-subaccount-activity" | "read-subaccount-members" | "read-subaccount-invites" | "read-guard-signer-status" | "read-price-alerts" | "manage-price-alerts" | "read-notifications" | "read-account-activity">[];
|
|
110
|
+
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" | "read-statements" | "convert-dust" | "read-funding-flows" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards" | "create-deposit-address" | "read-deposit-addresses" | "read-subaccounts" | "read-subaccount-activity" | "read-subaccount-members" | "read-subaccount-invites" | "read-guard-signer-status" | "read-price-alerts" | "manage-price-alerts" | "read-notifications" | "read-account-activity" | "manage-api-keys" | "manage-api-key-policies" | "manage-subaccount-policies">[];
|
|
108
111
|
isTemplate: boolean;
|
|
109
112
|
sourceTemplateId?: string | undefined;
|
|
113
|
+
sourceTemplateRevision: string;
|
|
110
114
|
maxOpenOrders: number;
|
|
111
115
|
tradingHalted: boolean;
|
|
112
116
|
locked: boolean;
|
|
@@ -131,6 +135,8 @@ declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
131
135
|
readonly policyLocked: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
132
136
|
readonly reviewAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
133
137
|
readonly expiresAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
138
|
+
/** A template is applied as a copy, so editing it later changes no sub-account. Main account owner only, never with `subaccountId`. */
|
|
139
|
+
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
134
140
|
readonly subaccountId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
135
141
|
}, undefined>, v.TransformAction<{
|
|
136
142
|
name: string;
|
|
@@ -146,6 +152,7 @@ declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
146
152
|
policyLocked: boolean;
|
|
147
153
|
reviewAt?: number | null | undefined;
|
|
148
154
|
expiresAt?: number | null | undefined;
|
|
155
|
+
isTemplate: boolean;
|
|
149
156
|
subaccountId?: bigint | undefined;
|
|
150
157
|
}, {
|
|
151
158
|
policy: {
|
|
@@ -162,6 +169,7 @@ declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
162
169
|
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 | PolicyAction.READ_STATEMENTS | PolicyAction.CONVERT_DUST | PolicyAction.READ_FUNDING_FLOWS)[];
|
|
163
170
|
maxOpenOrders: number;
|
|
164
171
|
tradingHalted: boolean;
|
|
172
|
+
isTemplate: boolean;
|
|
165
173
|
};
|
|
166
174
|
subaccountId: bigint | undefined;
|
|
167
175
|
}>]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccount-policies.schemas.d.ts","names":[],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.schemas.ts"],"mappings":";;;;cAyCa,mCAAiC,EAAA,yBAAA,EAAA;;;;;;;;;;;cASjC,gCAA8B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;cAgB9B,wBAAsB,EAAA,yBAAA,EAAA
|
|
1
|
+
{"version":3,"file":"subaccount-policies.schemas.d.ts","names":[],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.schemas.ts"],"mappings":";;;;cAyCa,mCAAiC,EAAA,yBAAA,EAAA;;;;;;;;;;;cASjC,gCAA8B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;cAgB9B,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAuCvB,mBAAmB,EAAE,mBAAmB;cAiEvC,mCAAiC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOlC,8BAA8B,EAAE,kBAAkB;cA+DjD,mCAAiC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BlC,8BAA8B,EAAE,kBAAkB;cASjD,kCAAgC,EAAA;;;;KAQjC,6BAA6B,EAAE,kBAAkB"}
|
|
@@ -30,6 +30,8 @@ const SubaccountPolicySchema = v.pipe(v.object({
|
|
|
30
30
|
actions: v.pipe(v.optional(v.array(ProtoPolicyActionEnumSchema), []), v.transform((v) => v.map((action) => policyActionLabelFor(action)))),
|
|
31
31
|
isTemplate: v.optional(v.boolean(), false),
|
|
32
32
|
sourceTemplateId: OptionalPublicIdSchema,
|
|
33
|
+
/** Template revision this policy was copied at; `"0"` when it is not a copy. */
|
|
34
|
+
sourceTemplateRevision: v.optional(BigIntStringSchema, 0n),
|
|
33
35
|
maxOrderNotional: v.pipe(v.bigint(), v.transform((value) => scaledToDecimalOutput(value, 6))),
|
|
34
36
|
maxOpenOrders: v.number(),
|
|
35
37
|
tradingHalted: v.boolean(),
|
|
@@ -64,6 +66,8 @@ const SubaccountPolicyInputBaseSchema = v.strictObject({
|
|
|
64
66
|
policyLocked: v.optional(v.boolean(), false),
|
|
65
67
|
reviewAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),
|
|
66
68
|
expiresAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),
|
|
69
|
+
/** A template is applied as a copy, so editing it later changes no sub-account. Main account owner only, never with `subaccountId`. */
|
|
70
|
+
isTemplate: v.optional(v.boolean(), false),
|
|
67
71
|
subaccountId: optionalSubaccountIdInputSchema()
|
|
68
72
|
});
|
|
69
73
|
function timestampFromMs(value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccount-policies.schemas.js","names":[],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n PolicyMarketScopeEnumSchema,\n ProtoPolicyActionEnumSchema,\n ProtoPolicyMarketScopeEnumSchema,\n SpotMarketRuleSchema,\n SubaccountPolicyActionEnumSchema,\n} from \"../shared.js\";\nimport {\n PolicyMarketScopeCodec,\n PolicyActionCodec,\n policyMarketScopeLabelFor,\n policyActionLabelFor,\n} from \"../shared.codecs.js\";\nimport { idToBigInt } from \"../../../utils/base58-id.js\";\nimport {\n OptionalNumberToIntOrZeroSchema,\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n BigIntStringSchema,\n PublicIdSchema,\n TimestampSchema,\n TimestampMsSchema,\n idInputSchema,\n optionalSubaccountIdInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../../utils/time.js\";\nimport { msToTimestamp } from \"../../../utils/timestamp.js\";\nimport {\n QUOTE_NOTIONAL_SCALE,\n decimalInputToScaled,\n scaledToDecimalOutput,\n} from \"../../../shared/decimal-surface.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../../shared/wire-bounds.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../../shared/account-scope.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../../utils/proto-patch.js\";\n\nexport const ListSubaccountPoliciesInputSchema = v.pipe(\n v.strictObject(AccountScopeInputEntries),\n v.transform(({ account }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListSubaccountPoliciesInput = v.InferInput<typeof ListSubaccountPoliciesInputSchema>;\n\nexport const GetSubaccountPolicyInputSchema = v.pipe(\n v.strictObject({\n policyId: v.pipe(v.string(), v.trim(), v.minLength(1)),\n ...AccountScopeInputEntries,\n }),\n v.transform(({ policyId, account }) => ({\n policyId: idToBigInt(policyId, \"policyId\"),\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type GetSubaccountPolicyInput = v.InferInput<typeof GetSubaccountPolicyInputSchema>;\n\n/**\n * From the backend format to a usable frontend/UI format, so big ints to numbers, etc.\n */\nexport const SubaccountPolicySchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n name: v.string(),\n description: v.string(),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema), []),\n spotMarketScope: v.pipe(\n ProtoPolicyMarketScopeEnumSchema,\n v.transform((v) => policyMarketScopeLabelFor(v)),\n ),\n actions: v.pipe(\n v.optional(v.array(ProtoPolicyActionEnumSchema), []),\n v.transform((v) => v.map((action) => policyActionLabelFor(action))),\n ),\n isTemplate: v.optional(v.boolean(), false),\n sourceTemplateId: OptionalPublicIdSchema,\n maxOrderNotional: v.pipe(\n v.bigint(),\n v.transform((value) => scaledToDecimalOutput(value, QUOTE_NOTIONAL_SCALE)),\n ),\n maxOpenOrders: v.number(),\n tradingHalted: v.boolean(),\n locked: v.boolean(),\n reviewAt: OptionalTimestampMsSchema,\n expiresAt: OptionalTimestampMsSchema,\n createdAt: TimestampMsSchema,\n updatedAt: TimestampSchema,\n revision: BigIntStringSchema,\n }),\n v.transform(({ maxOrderNotional, updatedAt, ...rest }) => ({\n maxOrderSize: maxOrderNotional,\n ...rest,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type SubaccountPolicy = v.InferOutput<typeof SubaccountPolicySchema>;\n\n/**\n * Max spot order notional as a decimal USDT string (e.g. `\"100000.5\"`). The wire\n * field is canonical quote microunits, so `\"100000\"` caps orders at 100,000 USDT.\n * `\"0\"` means no cap.\n */\nconst MaxOrderSizeInputSchema = v.pipe(\n v.string(),\n v.transform((value) => decimalInputToScaled(\"maxOrderSize\", value, QUOTE_NOTIONAL_SCALE)),\n);\n\nconst OptionalMaxOrderSizeInputSchema = v.pipe(\n v.optional(v.nullable(MaxOrderSizeInputSchema), null),\n v.transform((value) => value ?? 0n),\n);\n\nconst SubaccountPolicyInputBaseSchema = v.strictObject({\n name: v.string(),\n description: v.optional(v.string(), \"\"),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema), []),\n spotMarketScope: v.pipe(\n PolicyMarketScopeEnumSchema,\n v.transform((v) => PolicyMarketScopeCodec.inputToProto[v]),\n ),\n actions: v.pipe(\n v.optional(v.array(SubaccountPolicyActionEnumSchema), []),\n v.transform((v) => (v ?? []).map((action) => PolicyActionCodec.inputToProto[action])),\n ),\n maxOrderSize: OptionalMaxOrderSizeInputSchema,\n maxOpenOrders: OptionalNumberToIntOrZeroSchema,\n tradingHalted: v.optional(v.boolean(), false),\n policyLocked: v.optional(v.boolean(), false),\n reviewAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),\n expiresAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),\n subaccountId: optionalSubaccountIdInputSchema(),\n});\n\nfunction timestampFromMs(value: number | null | undefined) {\n if (value == null) return undefined;\n return msToTimestamp(value);\n}\n\nfunction createSubaccountPolicyBaseTransform(\n input: v.InferOutput<typeof SubaccountPolicyInputBaseSchema>,\n) {\n const {\n subaccountId: _subaccountId,\n reviewAt,\n expiresAt,\n maxOrderSize,\n policyLocked,\n ...rest\n } = input;\n return {\n ...rest,\n maxOrderNotional: maxOrderSize,\n locked: policyLocked,\n reviewAt: timestampFromMs(reviewAt),\n expiresAt: timestampFromMs(expiresAt),\n };\n}\n\nexport const CreateSubaccountPolicyInputSchema = v.pipe(\n SubaccountPolicyInputBaseSchema,\n v.transform((input) => ({\n policy: createSubaccountPolicyBaseTransform(input),\n subaccountId: input.subaccountId,\n })),\n);\nexport type SubaccountPolicyCreateInput = v.InferInput<typeof CreateSubaccountPolicyInputSchema>;\n\nconst SubaccountPolicyPatchSchema = v.strictObject({\n name: v.optional(v.string()),\n description: v.optional(v.string()),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema)),\n spotMarketScope: v.optional(PolicyMarketScopeEnumSchema),\n actions: v.optional(v.array(SubaccountPolicyActionEnumSchema)),\n maxOrderSize: v.optional(v.nullable(MaxOrderSizeInputSchema)),\n maxOpenOrders: v.optional(\n v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX))),\n ),\n tradingHalted: v.optional(v.boolean()),\n policyLocked: v.optional(v.boolean()),\n reviewAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),\n expiresAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),\n});\n\ntype SubaccountPolicyPatch = v.InferOutput<typeof SubaccountPolicyPatchSchema>;\n\nconst SUBACCOUNT_POLICY_PATCH_FIELDS = defineProtoPatchFields<SubaccountPolicyPatch>()({\n name: { path: \"name\", encode: (name) => ({ name }) },\n description: { path: \"description\", encode: (description) => ({ description }) },\n spotMarkets: { path: \"spot_markets\", encode: (spotMarkets) => ({ spotMarkets }) },\n spotMarketScope: {\n path: \"spot_market_scope\",\n encode: (scope) => ({ spotMarketScope: PolicyMarketScopeCodec.inputToProto[scope] }),\n },\n actions: {\n path: \"actions\",\n encode: (actions) => ({\n actions: actions.map((action) => PolicyActionCodec.inputToProto[action]),\n }),\n },\n maxOrderSize: {\n path: \"max_order_notional\",\n encode: (value) => ({ maxOrderNotional: value ?? 0n }),\n },\n maxOpenOrders: {\n path: \"max_open_orders\",\n encode: (value) => ({ maxOpenOrders: value ?? 0 }),\n },\n tradingHalted: {\n path: \"trading_halted\",\n encode: (tradingHalted) => ({ tradingHalted }),\n },\n policyLocked: { path: \"locked\", encode: (locked) => ({ locked }) },\n reviewAt: {\n path: \"review_at\",\n encode: (reviewAt) => {\n const timestamp = timestampFromMs(reviewAt);\n return timestamp === undefined ? {} : { reviewAt: timestamp };\n },\n },\n expiresAt: {\n path: \"expires_at\",\n encode: (expiresAt) => {\n const timestamp = timestampFromMs(expiresAt);\n return timestamp === undefined ? {} : { expiresAt: timestamp };\n },\n },\n});\n\nexport const UpdateSubaccountPolicyInputSchema = v.pipe(\n v.strictObject({\n ...SubaccountPolicyPatchSchema.entries,\n policyId: v.pipe(\n v.string(),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n ),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n }),\n v.check(\n ({ policyId: _policyId, expectedRevision: _expectedRevision, ...patch }) =>\n Object.values(patch).some((value) => value !== undefined),\n \"At least one subaccount policy field must be provided\",\n ),\n v.transform(({ policyId, expectedRevision, ...patch }) => {\n const { patch: policy, updateMask } = buildProtoPatch(\n patch,\n SUBACCOUNT_POLICY_PATCH_FIELDS,\n );\n return {\n policyId,\n policy,\n updateMask,\n expectedRevision,\n };\n }),\n);\nexport type SubaccountPolicyUpdateInput = v.InferInput<typeof UpdateSubaccountPolicyInputSchema>;\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\nexport const ApplySubaccountPolicyInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n policyId: v.pipe(\n v.nullable(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? idToBigInt(value, \"policyId\") : undefined)),\n ),\n});\n\nexport type SubaccountPolicyApplyInput = v.InferInput<typeof ApplySubaccountPolicyInputSchema>;\n"],"mappings":";;;;;;;;;;;;AAyCA,MAAa,oCAAoC,EAAE,KAC/C,EAAE,aAAa,wBAAwB,GACvC,EAAE,WAAW,EAAE,eAAe,EAC1B,cAAc,2BAA2B,OAAO,EACpD,EAAE,CACN;AAIA,MAAa,iCAAiC,EAAE,KAC5C,EAAE,aAAa;CACX,UAAU,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;CACrD,GAAG;AACP,CAAC,GACD,EAAE,WAAW,EAAE,UAAU,eAAe;CACpC,UAAU,WAAW,UAAU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UAAU,IAAI,KAAA,CAAU,CAC9E;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"subaccount-policies.schemas.js","names":[],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n PolicyMarketScopeEnumSchema,\n ProtoPolicyActionEnumSchema,\n ProtoPolicyMarketScopeEnumSchema,\n SpotMarketRuleSchema,\n SubaccountPolicyActionEnumSchema,\n} from \"../shared.js\";\nimport {\n PolicyMarketScopeCodec,\n PolicyActionCodec,\n policyMarketScopeLabelFor,\n policyActionLabelFor,\n} from \"../shared.codecs.js\";\nimport { idToBigInt } from \"../../../utils/base58-id.js\";\nimport {\n OptionalNumberToIntOrZeroSchema,\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n BigIntStringSchema,\n PublicIdSchema,\n TimestampSchema,\n TimestampMsSchema,\n idInputSchema,\n optionalSubaccountIdInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../../utils/time.js\";\nimport { msToTimestamp } from \"../../../utils/timestamp.js\";\nimport {\n QUOTE_NOTIONAL_SCALE,\n decimalInputToScaled,\n scaledToDecimalOutput,\n} from \"../../../shared/decimal-surface.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../../shared/wire-bounds.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../../shared/account-scope.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../../utils/proto-patch.js\";\n\nexport const ListSubaccountPoliciesInputSchema = v.pipe(\n v.strictObject(AccountScopeInputEntries),\n v.transform(({ account }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListSubaccountPoliciesInput = v.InferInput<typeof ListSubaccountPoliciesInputSchema>;\n\nexport const GetSubaccountPolicyInputSchema = v.pipe(\n v.strictObject({\n policyId: v.pipe(v.string(), v.trim(), v.minLength(1)),\n ...AccountScopeInputEntries,\n }),\n v.transform(({ policyId, account }) => ({\n policyId: idToBigInt(policyId, \"policyId\"),\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type GetSubaccountPolicyInput = v.InferInput<typeof GetSubaccountPolicyInputSchema>;\n\n/**\n * From the backend format to a usable frontend/UI format, so big ints to numbers, etc.\n */\nexport const SubaccountPolicySchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n name: v.string(),\n description: v.string(),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema), []),\n spotMarketScope: v.pipe(\n ProtoPolicyMarketScopeEnumSchema,\n v.transform((v) => policyMarketScopeLabelFor(v)),\n ),\n actions: v.pipe(\n v.optional(v.array(ProtoPolicyActionEnumSchema), []),\n v.transform((v) => v.map((action) => policyActionLabelFor(action))),\n ),\n isTemplate: v.optional(v.boolean(), false),\n sourceTemplateId: OptionalPublicIdSchema,\n /** Template revision this policy was copied at; `\"0\"` when it is not a copy. */\n sourceTemplateRevision: v.optional(BigIntStringSchema, 0n),\n maxOrderNotional: v.pipe(\n v.bigint(),\n v.transform((value) => scaledToDecimalOutput(value, QUOTE_NOTIONAL_SCALE)),\n ),\n maxOpenOrders: v.number(),\n tradingHalted: v.boolean(),\n locked: v.boolean(),\n reviewAt: OptionalTimestampMsSchema,\n expiresAt: OptionalTimestampMsSchema,\n createdAt: TimestampMsSchema,\n updatedAt: TimestampSchema,\n revision: BigIntStringSchema,\n }),\n v.transform(({ maxOrderNotional, updatedAt, ...rest }) => ({\n maxOrderSize: maxOrderNotional,\n ...rest,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type SubaccountPolicy = v.InferOutput<typeof SubaccountPolicySchema>;\n\n/**\n * Max spot order notional as a decimal USDT string (e.g. `\"100000.5\"`). The wire\n * field is canonical quote microunits, so `\"100000\"` caps orders at 100,000 USDT.\n * `\"0\"` means no cap.\n */\nconst MaxOrderSizeInputSchema = v.pipe(\n v.string(),\n v.transform((value) => decimalInputToScaled(\"maxOrderSize\", value, QUOTE_NOTIONAL_SCALE)),\n);\n\nconst OptionalMaxOrderSizeInputSchema = v.pipe(\n v.optional(v.nullable(MaxOrderSizeInputSchema), null),\n v.transform((value) => value ?? 0n),\n);\n\nconst SubaccountPolicyInputBaseSchema = v.strictObject({\n name: v.string(),\n description: v.optional(v.string(), \"\"),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema), []),\n spotMarketScope: v.pipe(\n PolicyMarketScopeEnumSchema,\n v.transform((v) => PolicyMarketScopeCodec.inputToProto[v]),\n ),\n actions: v.pipe(\n v.optional(v.array(SubaccountPolicyActionEnumSchema), []),\n v.transform((v) => (v ?? []).map((action) => PolicyActionCodec.inputToProto[action])),\n ),\n maxOrderSize: OptionalMaxOrderSizeInputSchema,\n maxOpenOrders: OptionalNumberToIntOrZeroSchema,\n tradingHalted: v.optional(v.boolean(), false),\n policyLocked: v.optional(v.boolean(), false),\n reviewAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),\n expiresAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),\n /** A template is applied as a copy, so editing it later changes no sub-account. Main account owner only, never with `subaccountId`. */\n isTemplate: v.optional(v.boolean(), false),\n subaccountId: optionalSubaccountIdInputSchema(),\n});\n\nfunction timestampFromMs(value: number | null | undefined) {\n if (value == null) return undefined;\n return msToTimestamp(value);\n}\n\nfunction createSubaccountPolicyBaseTransform(\n input: v.InferOutput<typeof SubaccountPolicyInputBaseSchema>,\n) {\n const {\n subaccountId: _subaccountId,\n reviewAt,\n expiresAt,\n maxOrderSize,\n policyLocked,\n ...rest\n } = input;\n return {\n ...rest,\n maxOrderNotional: maxOrderSize,\n locked: policyLocked,\n reviewAt: timestampFromMs(reviewAt),\n expiresAt: timestampFromMs(expiresAt),\n };\n}\n\nexport const CreateSubaccountPolicyInputSchema = v.pipe(\n SubaccountPolicyInputBaseSchema,\n v.transform((input) => ({\n policy: createSubaccountPolicyBaseTransform(input),\n subaccountId: input.subaccountId,\n })),\n);\nexport type SubaccountPolicyCreateInput = v.InferInput<typeof CreateSubaccountPolicyInputSchema>;\n\nconst SubaccountPolicyPatchSchema = v.strictObject({\n name: v.optional(v.string()),\n description: v.optional(v.string()),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema)),\n spotMarketScope: v.optional(PolicyMarketScopeEnumSchema),\n actions: v.optional(v.array(SubaccountPolicyActionEnumSchema)),\n maxOrderSize: v.optional(v.nullable(MaxOrderSizeInputSchema)),\n maxOpenOrders: v.optional(\n v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX))),\n ),\n tradingHalted: v.optional(v.boolean()),\n policyLocked: v.optional(v.boolean()),\n reviewAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),\n expiresAt: v.optional(v.nullable(v.pipe(v.number(), v.integer(), v.minValue(0)))),\n});\n\ntype SubaccountPolicyPatch = v.InferOutput<typeof SubaccountPolicyPatchSchema>;\n\nconst SUBACCOUNT_POLICY_PATCH_FIELDS = defineProtoPatchFields<SubaccountPolicyPatch>()({\n name: { path: \"name\", encode: (name) => ({ name }) },\n description: { path: \"description\", encode: (description) => ({ description }) },\n spotMarkets: { path: \"spot_markets\", encode: (spotMarkets) => ({ spotMarkets }) },\n spotMarketScope: {\n path: \"spot_market_scope\",\n encode: (scope) => ({ spotMarketScope: PolicyMarketScopeCodec.inputToProto[scope] }),\n },\n actions: {\n path: \"actions\",\n encode: (actions) => ({\n actions: actions.map((action) => PolicyActionCodec.inputToProto[action]),\n }),\n },\n maxOrderSize: {\n path: \"max_order_notional\",\n encode: (value) => ({ maxOrderNotional: value ?? 0n }),\n },\n maxOpenOrders: {\n path: \"max_open_orders\",\n encode: (value) => ({ maxOpenOrders: value ?? 0 }),\n },\n tradingHalted: {\n path: \"trading_halted\",\n encode: (tradingHalted) => ({ tradingHalted }),\n },\n policyLocked: { path: \"locked\", encode: (locked) => ({ locked }) },\n reviewAt: {\n path: \"review_at\",\n encode: (reviewAt) => {\n const timestamp = timestampFromMs(reviewAt);\n return timestamp === undefined ? {} : { reviewAt: timestamp };\n },\n },\n expiresAt: {\n path: \"expires_at\",\n encode: (expiresAt) => {\n const timestamp = timestampFromMs(expiresAt);\n return timestamp === undefined ? {} : { expiresAt: timestamp };\n },\n },\n});\n\nexport const UpdateSubaccountPolicyInputSchema = v.pipe(\n v.strictObject({\n ...SubaccountPolicyPatchSchema.entries,\n policyId: v.pipe(\n v.string(),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n ),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n }),\n v.check(\n ({ policyId: _policyId, expectedRevision: _expectedRevision, ...patch }) =>\n Object.values(patch).some((value) => value !== undefined),\n \"At least one subaccount policy field must be provided\",\n ),\n v.transform(({ policyId, expectedRevision, ...patch }) => {\n const { patch: policy, updateMask } = buildProtoPatch(\n patch,\n SUBACCOUNT_POLICY_PATCH_FIELDS,\n );\n return {\n policyId,\n policy,\n updateMask,\n expectedRevision,\n };\n }),\n);\nexport type SubaccountPolicyUpdateInput = v.InferInput<typeof UpdateSubaccountPolicyInputSchema>;\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\nexport const ApplySubaccountPolicyInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n policyId: v.pipe(\n v.nullable(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? idToBigInt(value, \"policyId\") : undefined)),\n ),\n});\n\nexport type SubaccountPolicyApplyInput = v.InferInput<typeof ApplySubaccountPolicyInputSchema>;\n"],"mappings":";;;;;;;;;;;;AAyCA,MAAa,oCAAoC,EAAE,KAC/C,EAAE,aAAa,wBAAwB,GACvC,EAAE,WAAW,EAAE,eAAe,EAC1B,cAAc,2BAA2B,OAAO,EACpD,EAAE,CACN;AAIA,MA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AAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,UAAU,CAAC,GACb,EAAE,WAAW,MAAM,WAAW,GAAG,UAAU,CAAC,CAChD;AAEA,MAAa,mCAAmC,EAAE,aAAa;CAC3D,cAAc,cAAc,cAAc;CAC1C,UAAU,EAAE,KACR,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC,GACvC,EAAE,WAAW,UAAW,QAAQ,WAAW,OAAO,UAAU,IAAI,KAAA,CAAU,CAC9E;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { RateLimitPolicyClass } from "../../shared/rate-limit.schemas.js";
|
|
2
2
|
//#region src/services/rate-limits/rate-limits.codecs.d.ts
|
|
3
|
-
type TradingRateLimitClass = Extract<RateLimitPolicyClass, "unspecified" | "trading_place" | "trading_cancel">;
|
|
3
|
+
type TradingRateLimitClass = Extract<RateLimitPolicyClass, "unspecified" | "trading_place" | "trading_cancel" | "trading_read">;
|
|
4
4
|
//#endregion
|
|
5
5
|
export { TradingRateLimitClass };
|
|
6
6
|
//# sourceMappingURL=rate-limits.codecs.d.ts.map
|
|
@@ -3,7 +3,8 @@ import "../../gen/ratelimit/v1/ratelimit_pb.js";
|
|
|
3
3
|
const TradingRateLimitClassCodec = { protoToOutput: {
|
|
4
4
|
[0]: "unspecified",
|
|
5
5
|
[1]: "trading_place",
|
|
6
|
-
[2]: "trading_cancel"
|
|
6
|
+
[2]: "trading_cancel",
|
|
7
|
+
[3]: "trading_read"
|
|
7
8
|
} };
|
|
8
9
|
//#endregion
|
|
9
10
|
export { TradingRateLimitClassCodec };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rate-limits.codecs.js","names":[],"sources":["../../../src/services/rate-limits/rate-limits.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/ratelimit/v1/ratelimit_pb.js\";\nimport type { RateLimitPolicyClass } from \"../../shared/rate-limit.schemas.js\";\nimport type { ProtoToOutput } from \"../../utils/types.js\";\n\nexport type TradingRateLimitClass = Extract<\n RateLimitPolicyClass,\n \"unspecified\" | \"trading_place\" | \"trading_cancel\"\n>;\n\nexport const TradingRateLimitClassCodec = {\n protoToOutput: {\n [Proto.TradingRateLimitClass.UNSPECIFIED]: \"unspecified\",\n [Proto.TradingRateLimitClass.PLACE]: \"trading_place\",\n [Proto.TradingRateLimitClass.CANCEL]: \"trading_cancel\",\n } satisfies ProtoToOutput<Proto.TradingRateLimitClass, TradingRateLimitClass>,\n} as const;\n"],"mappings":";;AASA,MAAa,6BAA6B,EACtC,eAAe;EACgC,IAAA;EACN,IAAA;EACC,IAAA;
|
|
1
|
+
{"version":3,"file":"rate-limits.codecs.js","names":[],"sources":["../../../src/services/rate-limits/rate-limits.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/ratelimit/v1/ratelimit_pb.js\";\nimport type { RateLimitPolicyClass } from \"../../shared/rate-limit.schemas.js\";\nimport type { ProtoToOutput } from \"../../utils/types.js\";\n\nexport type TradingRateLimitClass = Extract<\n RateLimitPolicyClass,\n \"unspecified\" | \"trading_place\" | \"trading_cancel\" | \"trading_read\"\n>;\n\nexport const TradingRateLimitClassCodec = {\n protoToOutput: {\n [Proto.TradingRateLimitClass.UNSPECIFIED]: \"unspecified\",\n [Proto.TradingRateLimitClass.PLACE]: \"trading_place\",\n [Proto.TradingRateLimitClass.CANCEL]: \"trading_cancel\",\n [Proto.TradingRateLimitClass.READ]: \"trading_read\",\n } satisfies ProtoToOutput<Proto.TradingRateLimitClass, TradingRateLimitClass>,\n} as const;\n"],"mappings":";;AASA,MAAa,6BAA6B,EACtC,eAAe;EACgC,IAAA;EACN,IAAA;EACC,IAAA;EACF,IAAA;AACxC,EACJ"}
|
|
@@ -2,7 +2,7 @@ import { TradingRateLimitClass } from "./rate-limits.codecs.js";
|
|
|
2
2
|
import * as v from "valibot";
|
|
3
3
|
//#region src/services/rate-limits/rate-limits.schemas.d.ts
|
|
4
4
|
declare const TradingRateLimitRuleSchema: v.ObjectSchema<{
|
|
5
|
-
readonly policyClass: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading_place" | "trading_cancel">]>;
|
|
5
|
+
readonly policyClass: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading_place" | "trading_cancel" | "trading_read">]>;
|
|
6
6
|
readonly vipTier: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
7
7
|
readonly quotaWeight: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
8
8
|
readonly periodMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
@@ -19,7 +19,7 @@ declare const RateLimitConfigSchema: v.ObjectSchema<{
|
|
|
19
19
|
nanos: number;
|
|
20
20
|
}, number>]>;
|
|
21
21
|
readonly rules: v.ArraySchema<v.ObjectSchema<{
|
|
22
|
-
readonly policyClass: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading_place" | "trading_cancel">]>;
|
|
22
|
+
readonly policyClass: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading_place" | "trading_cancel" | "trading_read">]>;
|
|
23
23
|
readonly vipTier: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
24
24
|
readonly quotaWeight: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
25
25
|
readonly periodMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
@@ -30,7 +30,7 @@ type RateLimitConfig = v.InferOutput<typeof RateLimitConfigSchema>;
|
|
|
30
30
|
declare const TradingRateLimitsSchema: v.ObjectSchema<{
|
|
31
31
|
/** Rules resolved for the calling API key; informational, not enforced. Only `rules` limit trading. */
|
|
32
32
|
readonly apiKeyRules: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
33
|
-
readonly policyClass: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading_place" | "trading_cancel">]>;
|
|
33
|
+
readonly policyClass: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading_place" | "trading_cancel" | "trading_read">]>;
|
|
34
34
|
readonly vipTier: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
35
35
|
readonly quotaWeight: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
36
36
|
readonly periodMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
@@ -45,7 +45,7 @@ declare const TradingRateLimitsSchema: v.ObjectSchema<{
|
|
|
45
45
|
nanos: number;
|
|
46
46
|
}, number>]>;
|
|
47
47
|
readonly rules: v.ArraySchema<v.ObjectSchema<{
|
|
48
|
-
readonly policyClass: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading_place" | "trading_cancel">]>;
|
|
48
|
+
readonly policyClass: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading_place" | "trading_cancel" | "trading_read">]>;
|
|
49
49
|
readonly vipTier: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
50
50
|
readonly quotaWeight: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
51
51
|
readonly periodMs: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
@@ -90,7 +90,7 @@ declare const StatementExportSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
90
90
|
}, number>]>;
|
|
91
91
|
readonly assetId: v.NumberSchema<undefined>;
|
|
92
92
|
readonly idempotencyKey: v.StringSchema<undefined>;
|
|
93
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
93
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "processing" | "canceled" | "queued" | "ready" | "expired">]>;
|
|
94
94
|
readonly completeThrough: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
95
95
|
readonly seconds: v.BigintSchema<undefined>;
|
|
96
96
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -129,7 +129,7 @@ declare const StatementExportSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
129
129
|
endTime: number;
|
|
130
130
|
assetId: number;
|
|
131
131
|
idempotencyKey: string;
|
|
132
|
-
status: "unspecified" | "
|
|
132
|
+
status: "unspecified" | "failed" | "processing" | "canceled" | "queued" | "ready" | "expired";
|
|
133
133
|
completeThrough: number;
|
|
134
134
|
movements: string;
|
|
135
135
|
bytes: string;
|
|
@@ -148,7 +148,7 @@ declare const StatementExportSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
148
148
|
/** Ledger asset ID the statement is limited to; 0 for every asset. */
|
|
149
149
|
assetId: number;
|
|
150
150
|
idempotencyKey: string;
|
|
151
|
-
status: "unspecified" | "
|
|
151
|
+
status: "unspecified" | "failed" | "processing" | "canceled" | "queued" | "ready" | "expired";
|
|
152
152
|
/**
|
|
153
153
|
* End of what the file covers, exclusive: the earlier of `endTime` and when the export
|
|
154
154
|
* was created. Every movement recorded before both is in the file.
|
|
@@ -187,7 +187,7 @@ declare const ListStatementExportsResultSchema: v.ObjectSchema<{
|
|
|
187
187
|
}, number>]>;
|
|
188
188
|
readonly assetId: v.NumberSchema<undefined>;
|
|
189
189
|
readonly idempotencyKey: v.StringSchema<undefined>;
|
|
190
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
190
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "processing" | "canceled" | "queued" | "ready" | "expired">]>;
|
|
191
191
|
readonly completeThrough: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
192
192
|
readonly seconds: v.BigintSchema<undefined>;
|
|
193
193
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -226,7 +226,7 @@ declare const ListStatementExportsResultSchema: v.ObjectSchema<{
|
|
|
226
226
|
endTime: number;
|
|
227
227
|
assetId: number;
|
|
228
228
|
idempotencyKey: string;
|
|
229
|
-
status: "unspecified" | "
|
|
229
|
+
status: "unspecified" | "failed" | "processing" | "canceled" | "queued" | "ready" | "expired";
|
|
230
230
|
completeThrough: number;
|
|
231
231
|
movements: string;
|
|
232
232
|
bytes: string;
|
|
@@ -245,7 +245,7 @@ declare const ListStatementExportsResultSchema: v.ObjectSchema<{
|
|
|
245
245
|
/** Ledger asset ID the statement is limited to; 0 for every asset. */
|
|
246
246
|
assetId: number;
|
|
247
247
|
idempotencyKey: string;
|
|
248
|
-
status: "unspecified" | "
|
|
248
|
+
status: "unspecified" | "failed" | "processing" | "canceled" | "queued" | "ready" | "expired";
|
|
249
249
|
/**
|
|
250
250
|
* End of what the file covers, exclusive: the earlier of `endTime` and when the export
|
|
251
251
|
* was created. Every movement recorded before both is in the file.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { ApiKeySchema } from "../../gen/auth/v1/api_keys_pb.js";
|
|
2
|
+
import { SubaccountRoleService, SubaccountSchema, SubaccountService, SubaccountViewService } from "../../gen/auth/v1/subaccounts_pb.js";
|
|
1
3
|
import { parse } from "../../shared/validation.js";
|
|
2
4
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
5
|
import { formatId } from "../../utils/base58-id.js";
|
|
4
|
-
import { ApiKeySchema } from "../../gen/auth/v1/api_keys_pb.js";
|
|
5
|
-
import { SubaccountRoleService, SubaccountSchema, SubaccountService, SubaccountViewService } from "../../gen/auth/v1/subaccounts_pb.js";
|
|
6
6
|
import { CreateSubaccountChallengeInputSchema, CreateSubaccountInputSchema, CreateSubaccountResultSchema, EffectiveSubaccountPermissionsSchema, GetSubaccountInputSchema, InviteSubaccountMemberInputSchema, ListSubaccountInvitesInputSchema, RemoveSubaccountMemberInputSchema, RespondSubaccountInviteInputSchema, SetSubaccountMemberMfaRequirementInputSchema, SubaccountActivityEventSchema, SubaccountActivityInputSchema, SubaccountChallengeSchema, SubaccountIdInputSchema, SubaccountInviteSchema, SubaccountMemberSchema, SubaccountMutationResultSchema, SubaccountRoleCatalogSchema, SubaccountSchema as SubaccountSchema$1, UpdateSubaccountInputSchema, UpdateSubaccountMemberRoleInputSchema } from "./subaccounts.schemas.js";
|
|
7
7
|
import { ApiKeySchema as ApiKeySchema$1 } from "../api-keys/api-keys.schemas.js";
|
|
8
8
|
import { createLedgerBalanceSchema } from "../balances/balances.schemas.js";
|