@polyester/sdk 0.35.0-devnet-20261111025029 → 0.35.0-devnet-20261111140253
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 +43 -1
- package/dist/catalogs/index.d.ts +2 -2
- package/dist/catalogs/snapshot-validation.js +7 -3
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +4164 -0
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -0
- package/dist/gen/ai/v1/assistant_pb.js +1174 -0
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -0
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +776 -0
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -0
- package/dist/gen/alerts/v1/price_alerts_pb.js +378 -0
- package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -0
- package/dist/gen/auth/v1/address_book_pb.d.ts +6 -0
- package/dist/gen/auth/v1/address_book_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.js +6 -0
- package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +247 -3
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +81 -2
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +55 -6
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +55 -6
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +186 -14
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +163 -6
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +4 -2
- package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/profile_pb.js.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.d.ts +1 -0
- package/dist/gen/auth/v1/resolve_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +170 -11
- package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js +41 -3
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +25 -9
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +4 -2
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js.map +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +5 -0
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts.map +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +10 -0
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +32 -4
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.js +32 -4
- package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +391 -42
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js +103 -17
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +172 -4
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +63 -2
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +57 -3
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js +41 -3
- package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +2 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.js.map +1 -1
- package/dist/gen/claims/v1/claims_pb.d.ts +20 -3
- package/dist/gen/claims/v1/claims_pb.d.ts.map +1 -1
- package/dist/gen/claims/v1/claims_pb.js +12 -3
- package/dist/gen/claims/v1/claims_pb.js.map +1 -1
- package/dist/gen/index.d.ts +9 -5
- package/dist/gen/index.js +5 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts +52 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.js +52 -1
- package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts +6 -0
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +8 -0
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +29 -8
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +18 -5
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +20 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.js +20 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.js.map +1 -1
- package/dist/gen/rewards/v1/rewards_pb.d.ts +74 -3
- package/dist/gen/rewards/v1/rewards_pb.d.ts.map +1 -1
- package/dist/gen/rewards/v1/rewards_pb.js +16 -4
- package/dist/gen/rewards/v1/rewards_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1268 -67
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +306 -5
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +298 -54
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +183 -37
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +933 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js +292 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js.map +1 -0
- package/dist/gen/system/v1/system_pb.d.ts +77 -0
- package/dist/gen/system/v1/system_pb.d.ts.map +1 -0
- package/dist/gen/system/v1/system_pb.js +34 -0
- package/dist/gen/system/v1/system_pb.js.map +1 -0
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +2 -2
- package/dist/gen/tradews/v1/trade_ws_pb.js.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +101 -2
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js +14 -2
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/vip/v1/vip_pb.d.ts +1 -0
- package/dist/gen/vip/v1/vip_pb.d.ts.map +1 -1
- package/dist/gen/vip/v1/vip_pb.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +2 -2
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/api-keys/api-keys.codecs.js +10 -1
- package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +4 -0
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +3 -1
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +9 -2
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js +9 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.d.ts +15 -4
- package/dist/services/auto-withdraw/auto-withdraw.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.js +24 -8
- package/dist/services/auto-withdraw/auto-withdraw.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +375 -7
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +66 -11
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.types.d.ts +3 -3
- package/dist/services/changelog/changelog.schemas.d.ts +17 -17
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +2 -2
- package/dist/services/claims/claims.d.ts +5 -2
- package/dist/services/claims/claims.d.ts.map +1 -1
- package/dist/services/claims/claims.js +5 -2
- package/dist/services/claims/claims.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.d.ts +13 -4
- package/dist/services/internal-transfers/internal-transfers.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.js +17 -3
- package/dist/services/internal-transfers/internal-transfers.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +59 -4
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js +32 -2
- package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.types.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.codecs.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.codecs.js +3 -1
- package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +114 -90
- package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.js +7 -1
- package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +7 -2
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +2 -2
- package/dist/services/orders/orders-batch.schemas.d.ts +54 -54
- package/dist/services/orders/orders-input.schemas.d.ts +7 -7
- package/dist/services/orders/orders-output.schemas.d.ts +19 -19
- package/dist/services/orders/orders.d.ts +2 -0
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +2 -0
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
- package/dist/services/policies/shared.codecs.js +85 -3
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/shared.d.ts.map +1 -1
- package/dist/services/policies/shared.js +5 -14
- package/dist/services/policies/shared.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +3 -3
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
- package/dist/services/rewards/rewards.d.ts +13 -3
- package/dist/services/rewards/rewards.d.ts.map +1 -1
- package/dist/services/rewards/rewards.js +17 -3
- package/dist/services/rewards/rewards.js.map +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +101 -4
- package/dist/services/rewards/rewards.schemas.d.ts.map +1 -1
- package/dist/services/rewards/rewards.schemas.js +12 -2
- package/dist/services/rewards/rewards.schemas.js.map +1 -1
- package/dist/services/rewards/rewards.types.d.ts +2 -2
- package/dist/services/social-verification/social-verification.codecs.js +13 -5
- package/dist/services/social-verification/social-verification.codecs.js.map +1 -1
- package/dist/services/social-verification/social-verification.d.ts +18 -3
- package/dist/services/social-verification/social-verification.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.js +26 -3
- package/dist/services/social-verification/social-verification.js.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.d.ts +33 -7
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +35 -10
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/social-verification/social-verification.types.d.ts +2 -2
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +17 -17
- package/dist/services/trades/trades.schemas.d.ts +2 -2
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +7 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +11 -1
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +42 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +19 -3
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -2
- package/dist/services/transfers/transfers.schemas.d.ts +4 -4
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +30 -30
- package/dist/services/zipper/zipper.schemas.d.ts +2 -2
- package/dist/services/zipper/zipper.schemas.d.ts.map +1 -1
- package/dist/services/zipper/zipper.schemas.js +13 -2
- package/dist/services/zipper/zipper.schemas.js.map +1 -1
- package/dist/services/zipper/zipper.types.d.ts +2 -2
- package/dist/shared/catalog-config.d.ts +18 -1
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js +7 -1
- package/dist/shared/catalog-config.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +5 -1
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +8 -0
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/claims.js +7 -2
- package/dist/shared/error-details/claims.js.map +1 -1
- package/dist/shared/error-details/withdraw.js +11 -2
- package/dist/shared/error-details/withdraw.js.map +1 -1
- package/dist/shared/errors.d.ts +20 -3
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +17 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/shared/ledger-codes.d.ts +7 -1
- package/dist/shared/ledger-codes.d.ts.map +1 -1
- package/dist/shared/ledger-codes.js +27 -3
- package/dist/shared/ledger-codes.js.map +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +2 -2
- package/dist/shared/rate-limit.schemas.d.ts.map +1 -1
- package/dist/shared/rate-limit.schemas.js +4 -1
- package/dist/shared/rate-limit.schemas.js.map +1 -1
- package/dist/shared/transports.d.ts +2 -1
- package/dist/shared/transports.d.ts.map +1 -1
- package/dist/shared/transports.js.map +1 -1
- package/package.json +1 -1
|
@@ -27,7 +27,7 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
27
27
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
28
28
|
}, undefined>, undefined>, readonly []>;
|
|
29
29
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"all" | "allowlist">>]>;
|
|
30
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"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">[]>]>;
|
|
30
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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">[]>]>;
|
|
31
31
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
32
32
|
readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
|
|
33
33
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -50,7 +50,7 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
50
50
|
symbolId: number;
|
|
51
51
|
}[];
|
|
52
52
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
53
|
-
actions: DecodedEnum<"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">[];
|
|
53
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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">[];
|
|
54
54
|
isTemplate: boolean;
|
|
55
55
|
sourceTemplateId?: string | undefined;
|
|
56
56
|
createdAt: number;
|
|
@@ -69,7 +69,7 @@ declare const ApiKeyPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
69
69
|
symbolId: number;
|
|
70
70
|
}[];
|
|
71
71
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
72
|
-
actions: DecodedEnum<"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">[];
|
|
72
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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">[];
|
|
73
73
|
isTemplate: boolean;
|
|
74
74
|
sourceTemplateId?: string | undefined;
|
|
75
75
|
createdAt: number;
|
|
@@ -85,7 +85,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
85
85
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
86
86
|
}, undefined>, undefined>, readonly []>;
|
|
87
87
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"all" | "allowlist">>]>;
|
|
88
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"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">[]>]>;
|
|
88
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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">[]>]>;
|
|
89
89
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
90
90
|
readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
|
|
91
91
|
readonly createdAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -108,7 +108,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
108
108
|
symbolId: number;
|
|
109
109
|
}[];
|
|
110
110
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
111
|
-
actions: DecodedEnum<"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">[];
|
|
111
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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">[];
|
|
112
112
|
isTemplate: boolean;
|
|
113
113
|
sourceTemplateId?: string | undefined;
|
|
114
114
|
createdAt: number;
|
|
@@ -127,7 +127,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
127
127
|
symbolId: number;
|
|
128
128
|
}[];
|
|
129
129
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
130
|
-
actions: DecodedEnum<"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">[];
|
|
130
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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">[];
|
|
131
131
|
isTemplate: boolean;
|
|
132
132
|
sourceTemplateId?: string | undefined;
|
|
133
133
|
createdAt: number;
|
|
@@ -144,7 +144,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
144
144
|
symbolId: number;
|
|
145
145
|
}[];
|
|
146
146
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
147
|
-
actions: DecodedEnum<"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">[];
|
|
147
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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">[];
|
|
148
148
|
isTemplate: boolean;
|
|
149
149
|
sourceTemplateId?: string | undefined;
|
|
150
150
|
createdAt: number;
|
|
@@ -160,7 +160,7 @@ declare const ListApiKeyPoliciesResponseSchema: v.SchemaWithPipe<readonly [v.Obj
|
|
|
160
160
|
symbolId: number;
|
|
161
161
|
}[];
|
|
162
162
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
163
|
-
actions: DecodedEnum<"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">[];
|
|
163
|
+
actions: DecodedEnum<"swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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">[];
|
|
164
164
|
isTemplate: boolean;
|
|
165
165
|
sourceTemplateId?: string | undefined;
|
|
166
166
|
createdAt: number;
|
|
@@ -174,7 +174,7 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
174
174
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
175
175
|
}, undefined>, undefined>, readonly []>;
|
|
176
176
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["all", "allowlist"], undefined>, v.TransformAction<"all" | "allowlist", MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST>]>;
|
|
177
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, readonly []>, v.TransformAction<("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[]>]>;
|
|
177
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap", "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"], undefined>, undefined>, readonly []>, v.TransformAction<("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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")[], (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_API_KEYS | PolicyAction.READ_API_POLICIES | PolicyAction.READ_SUBACCOUNT_POLICIES | PolicyAction.READ_SUBACCOUNT_PERMISSIONS | PolicyAction.READ_VIP_STATUS | PolicyAction.READ_SOCIAL_VERIFICATION | PolicyAction.READ_PROFILE | PolicyAction.READ_ACCOUNT_DIRECTORY | PolicyAction.READ_WITHDRAW_VALIDATION | PolicyAction.READ_DAILY_CLAIMS | PolicyAction.CLAIM_DAILY_REWARD | PolicyAction.READ_CHECKPOINTS | PolicyAction.READ_REWARDS | PolicyAction.CREATE_DEPOSIT_ADDRESS | PolicyAction.READ_DEPOSIT_ADDRESSES | PolicyAction.READ_SUBACCOUNTS | PolicyAction.READ_SUBACCOUNT_ACTIVITY | PolicyAction.READ_SUBACCOUNT_MEMBERS | PolicyAction.READ_SUBACCOUNT_INVITES | PolicyAction.READ_GUARD_SIGNER_STATUS)[]>]>;
|
|
178
178
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
179
179
|
readonly assignToKeyId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
|
|
180
180
|
}, undefined>, v.TransformAction<{
|
|
@@ -184,7 +184,7 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
184
184
|
symbolId: number;
|
|
185
185
|
}[];
|
|
186
186
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
187
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
|
|
187
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP | PolicyAction.READ_API_KEYS | PolicyAction.READ_API_POLICIES | PolicyAction.READ_SUBACCOUNT_POLICIES | PolicyAction.READ_SUBACCOUNT_PERMISSIONS | PolicyAction.READ_VIP_STATUS | PolicyAction.READ_SOCIAL_VERIFICATION | PolicyAction.READ_PROFILE | PolicyAction.READ_ACCOUNT_DIRECTORY | PolicyAction.READ_WITHDRAW_VALIDATION | PolicyAction.READ_DAILY_CLAIMS | PolicyAction.CLAIM_DAILY_REWARD | PolicyAction.READ_CHECKPOINTS | PolicyAction.READ_REWARDS | PolicyAction.CREATE_DEPOSIT_ADDRESS | PolicyAction.READ_DEPOSIT_ADDRESSES | PolicyAction.READ_SUBACCOUNTS | PolicyAction.READ_SUBACCOUNT_ACTIVITY | PolicyAction.READ_SUBACCOUNT_MEMBERS | PolicyAction.READ_SUBACCOUNT_INVITES | PolicyAction.READ_GUARD_SIGNER_STATUS)[];
|
|
188
188
|
isTemplate: boolean;
|
|
189
189
|
assignToKeyId?: string | undefined;
|
|
190
190
|
}, {
|
|
@@ -195,7 +195,7 @@ declare const CreateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
195
195
|
symbolId: number;
|
|
196
196
|
}[];
|
|
197
197
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
198
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
|
|
198
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP | PolicyAction.READ_API_KEYS | PolicyAction.READ_API_POLICIES | PolicyAction.READ_SUBACCOUNT_POLICIES | PolicyAction.READ_SUBACCOUNT_PERMISSIONS | PolicyAction.READ_VIP_STATUS | PolicyAction.READ_SOCIAL_VERIFICATION | PolicyAction.READ_PROFILE | PolicyAction.READ_ACCOUNT_DIRECTORY | PolicyAction.READ_WITHDRAW_VALIDATION | PolicyAction.READ_DAILY_CLAIMS | PolicyAction.CLAIM_DAILY_REWARD | PolicyAction.READ_CHECKPOINTS | PolicyAction.READ_REWARDS | PolicyAction.CREATE_DEPOSIT_ADDRESS | PolicyAction.READ_DEPOSIT_ADDRESSES | PolicyAction.READ_SUBACCOUNTS | PolicyAction.READ_SUBACCOUNT_ACTIVITY | PolicyAction.READ_SUBACCOUNT_MEMBERS | PolicyAction.READ_SUBACCOUNT_INVITES | PolicyAction.READ_GUARD_SIGNER_STATUS)[];
|
|
199
199
|
isTemplate: boolean;
|
|
200
200
|
};
|
|
201
201
|
assignToKeyId: string | undefined;
|
|
@@ -210,7 +210,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
210
210
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
211
211
|
}, undefined>, undefined>, undefined>;
|
|
212
212
|
readonly spotMarketScope: v.OptionalSchema<v.PicklistSchema<readonly ["all", "allowlist"], undefined>, undefined>;
|
|
213
|
-
readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap"], undefined>, undefined>, undefined>;
|
|
213
|
+
readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book", "read-auto-withdraw", "manage-auto-withdraw", "swap", "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"], undefined>, undefined>, undefined>;
|
|
214
214
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
215
215
|
}, undefined>, v.CheckAction<{
|
|
216
216
|
policyId: bigint;
|
|
@@ -221,7 +221,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
221
221
|
symbolId: number;
|
|
222
222
|
}[] | undefined;
|
|
223
223
|
spotMarketScope?: "all" | "allowlist" | undefined;
|
|
224
|
-
actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
|
|
224
|
+
actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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")[] | undefined;
|
|
225
225
|
isTemplate?: boolean | undefined;
|
|
226
226
|
}, "At least one API key policy field must be provided">, v.TransformAction<{
|
|
227
227
|
policyId: bigint;
|
|
@@ -232,7 +232,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
232
232
|
symbolId: number;
|
|
233
233
|
}[] | undefined;
|
|
234
234
|
spotMarketScope?: "all" | "allowlist" | undefined;
|
|
235
|
-
actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw")[] | undefined;
|
|
235
|
+
actions?: ("swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "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")[] | undefined;
|
|
236
236
|
isTemplate?: boolean | undefined;
|
|
237
237
|
}, {
|
|
238
238
|
policyId: bigint;
|
|
@@ -247,7 +247,7 @@ declare const UpdateApiKeyPolicyInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
247
247
|
} & {
|
|
248
248
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
249
249
|
} & {
|
|
250
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP)[];
|
|
250
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.READ_AUTO_WITHDRAW | PolicyAction.MANAGE_AUTO_WITHDRAW | PolicyAction.SWAP | PolicyAction.READ_API_KEYS | PolicyAction.READ_API_POLICIES | PolicyAction.READ_SUBACCOUNT_POLICIES | PolicyAction.READ_SUBACCOUNT_PERMISSIONS | PolicyAction.READ_VIP_STATUS | PolicyAction.READ_SOCIAL_VERIFICATION | PolicyAction.READ_PROFILE | PolicyAction.READ_ACCOUNT_DIRECTORY | PolicyAction.READ_WITHDRAW_VALIDATION | PolicyAction.READ_DAILY_CLAIMS | PolicyAction.CLAIM_DAILY_REWARD | PolicyAction.READ_CHECKPOINTS | PolicyAction.READ_REWARDS | PolicyAction.CREATE_DEPOSIT_ADDRESS | PolicyAction.READ_DEPOSIT_ADDRESSES | PolicyAction.READ_SUBACCOUNTS | PolicyAction.READ_SUBACCOUNT_ACTIVITY | PolicyAction.READ_SUBACCOUNT_MEMBERS | PolicyAction.READ_SUBACCOUNT_INVITES | PolicyAction.READ_GUARD_SIGNER_STATUS)[];
|
|
251
251
|
} & {
|
|
252
252
|
isTemplate: boolean;
|
|
253
253
|
}>;
|
|
@@ -2,8 +2,8 @@ import { idToBigInt } from "../../../utils/base58-id.js";
|
|
|
2
2
|
import { tsObjToMs, tsObjToNsString } from "../../../utils/time.js";
|
|
3
3
|
import { BigIntStringSchema, OptionalPublicIdSchema, PublicIdSchema, TimestampMsSchema, TimestampSchema, positiveBigintStringInputSchema } from "../../../shared/schemas.js";
|
|
4
4
|
import { buildProtoPatch, defineProtoPatchFields } from "../../../utils/proto-patch.js";
|
|
5
|
-
import { PolicyActionEnumSchema, PolicyMarketScopeEnumSchema, ProtoPolicyActionEnumSchema, ProtoPolicyMarketScopeEnumSchema, SpotMarketRuleSchema } from "../shared.js";
|
|
6
5
|
import { PolicyActionCodec, PolicyMarketScopeCodec, policyActionLabelFor, policyMarketScopeLabelFor } from "../shared.codecs.js";
|
|
6
|
+
import { PolicyActionEnumSchema, PolicyMarketScopeEnumSchema, ProtoPolicyActionEnumSchema, ProtoPolicyMarketScopeEnumSchema, SpotMarketRuleSchema } from "../shared.js";
|
|
7
7
|
import * as v from "valibot";
|
|
8
8
|
//#region src/services/policies/api-key-policies/api-key-policies.schemas.ts
|
|
9
9
|
const OptionalApiKeyContextSchema = v.optional(v.pipe(v.string(), v.trim(), v.minLength(1, "keyId is required")));
|
|
@@ -1,6 +1,48 @@
|
|
|
1
1
|
import { enumLabel } from "../../shared/proto-enum-codec.js";
|
|
2
2
|
import "../../gen/auth/v1/policies_pb.js";
|
|
3
3
|
//#region src/services/policies/shared.codecs.ts
|
|
4
|
+
/** Product actions, accepted by sub-account and API-key policies. */
|
|
5
|
+
const PRODUCT_POLICY_ACTION_LABELS = [
|
|
6
|
+
"trade-spot",
|
|
7
|
+
"internal-transfer",
|
|
8
|
+
"external-withdraw",
|
|
9
|
+
"read-balances",
|
|
10
|
+
"read-spot",
|
|
11
|
+
"read-internal-transfers",
|
|
12
|
+
"read-address-book",
|
|
13
|
+
"manage-address-book",
|
|
14
|
+
"read-auto-withdraw",
|
|
15
|
+
"manage-auto-withdraw",
|
|
16
|
+
"swap"
|
|
17
|
+
];
|
|
18
|
+
/**
|
|
19
|
+
* Account permissions, accepted by API-key policies only: a sub-account policy refuses them.
|
|
20
|
+
* Each grants exactly the calls it names, and main-account permissions apply only to keys
|
|
21
|
+
* scoped to the main account.
|
|
22
|
+
*/
|
|
23
|
+
const ACCOUNT_PERMISSION_POLICY_ACTION_LABELS = [
|
|
24
|
+
"read-api-keys",
|
|
25
|
+
"read-api-policies",
|
|
26
|
+
"read-subaccount-policies",
|
|
27
|
+
"read-subaccount-permissions",
|
|
28
|
+
"read-vip-status",
|
|
29
|
+
"read-social-verification",
|
|
30
|
+
"read-profile",
|
|
31
|
+
"read-account-directory",
|
|
32
|
+
"read-withdraw-validation",
|
|
33
|
+
"read-daily-claims",
|
|
34
|
+
"claim-daily-reward",
|
|
35
|
+
"read-checkpoints",
|
|
36
|
+
"read-rewards",
|
|
37
|
+
"create-deposit-address",
|
|
38
|
+
"read-deposit-addresses",
|
|
39
|
+
"read-subaccounts",
|
|
40
|
+
"read-subaccount-activity",
|
|
41
|
+
"read-subaccount-members",
|
|
42
|
+
"read-subaccount-invites",
|
|
43
|
+
"read-guard-signer-status"
|
|
44
|
+
];
|
|
45
|
+
const POLICY_ACTION_LABELS = [...PRODUCT_POLICY_ACTION_LABELS, ...ACCOUNT_PERMISSION_POLICY_ACTION_LABELS];
|
|
4
46
|
const PolicyMarketScopeCodec = {
|
|
5
47
|
inputToProto: {
|
|
6
48
|
all: 1,
|
|
@@ -25,7 +67,27 @@ const PolicyActionCodec = {
|
|
|
25
67
|
[12]: "manage-address-book",
|
|
26
68
|
[14]: "read-auto-withdraw",
|
|
27
69
|
[15]: "manage-auto-withdraw",
|
|
28
|
-
[16]: "swap"
|
|
70
|
+
[16]: "swap",
|
|
71
|
+
[17]: "read-api-keys",
|
|
72
|
+
[18]: "read-api-policies",
|
|
73
|
+
[19]: "read-subaccount-policies",
|
|
74
|
+
[20]: "read-subaccount-permissions",
|
|
75
|
+
[21]: "read-vip-status",
|
|
76
|
+
[22]: "read-social-verification",
|
|
77
|
+
[23]: "read-profile",
|
|
78
|
+
[24]: "read-account-directory",
|
|
79
|
+
[25]: "read-withdraw-validation",
|
|
80
|
+
[26]: "read-daily-claims",
|
|
81
|
+
[27]: "claim-daily-reward",
|
|
82
|
+
[28]: "read-checkpoints",
|
|
83
|
+
[29]: "read-rewards",
|
|
84
|
+
[10]: "create-deposit-address",
|
|
85
|
+
[30]: "read-deposit-addresses",
|
|
86
|
+
[31]: "read-subaccounts",
|
|
87
|
+
[32]: "read-subaccount-activity",
|
|
88
|
+
[33]: "read-subaccount-members",
|
|
89
|
+
[34]: "read-subaccount-invites",
|
|
90
|
+
[35]: "read-guard-signer-status"
|
|
29
91
|
},
|
|
30
92
|
inputToProto: {
|
|
31
93
|
"trade-spot": 1,
|
|
@@ -38,7 +100,27 @@ const PolicyActionCodec = {
|
|
|
38
100
|
"manage-address-book": 12,
|
|
39
101
|
"read-auto-withdraw": 14,
|
|
40
102
|
"manage-auto-withdraw": 15,
|
|
41
|
-
swap: 16
|
|
103
|
+
swap: 16,
|
|
104
|
+
"read-api-keys": 17,
|
|
105
|
+
"read-api-policies": 18,
|
|
106
|
+
"read-subaccount-policies": 19,
|
|
107
|
+
"read-subaccount-permissions": 20,
|
|
108
|
+
"read-vip-status": 21,
|
|
109
|
+
"read-social-verification": 22,
|
|
110
|
+
"read-profile": 23,
|
|
111
|
+
"read-account-directory": 24,
|
|
112
|
+
"read-withdraw-validation": 25,
|
|
113
|
+
"read-daily-claims": 26,
|
|
114
|
+
"claim-daily-reward": 27,
|
|
115
|
+
"read-checkpoints": 28,
|
|
116
|
+
"read-rewards": 29,
|
|
117
|
+
"create-deposit-address": 10,
|
|
118
|
+
"read-deposit-addresses": 30,
|
|
119
|
+
"read-subaccounts": 31,
|
|
120
|
+
"read-subaccount-activity": 32,
|
|
121
|
+
"read-subaccount-members": 33,
|
|
122
|
+
"read-subaccount-invites": 34,
|
|
123
|
+
"read-guard-signer-status": 35
|
|
42
124
|
}
|
|
43
125
|
};
|
|
44
126
|
/**
|
|
@@ -54,6 +136,6 @@ function policyActionLabelFor(value) {
|
|
|
54
136
|
return enumLabel(PolicyActionCodec.protoToOutput, value);
|
|
55
137
|
}
|
|
56
138
|
//#endregion
|
|
57
|
-
export { PolicyActionCodec, PolicyMarketScopeCodec, policyActionLabelFor, policyMarketScopeLabelFor };
|
|
139
|
+
export { ACCOUNT_PERMISSION_POLICY_ACTION_LABELS, POLICY_ACTION_LABELS, PRODUCT_POLICY_ACTION_LABELS, PolicyActionCodec, PolicyMarketScopeCodec, policyActionLabelFor, policyMarketScopeLabelFor };
|
|
58
140
|
|
|
59
141
|
//# 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\nexport const
|
|
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] 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] 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 } 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 } 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;AACJ;;;;;;AAOA,MAAa,0CAA0C;CACnD;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;CACnD;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;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"], 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-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"], undefined>;
|
|
4
4
|
declare const PolicyMarketScopeEnumSchema: v.PicklistSchema<readonly ["all", "allowlist"], undefined>;
|
|
5
5
|
type PolicyMarketScope = v.InferOutput<typeof PolicyMarketScopeEnumSchema>;
|
|
6
6
|
type PolicyAction = v.InferOutput<typeof PolicyActionEnumSchema>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","names":[],"sources":["../../../src/services/policies/shared.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"shared.d.ts","names":[],"sources":["../../../src/services/policies/shared.ts"],"mappings":";;cAca,wBAAsB,EAAA;cAItB,6BAA2B,EAAA;KAC5B,oBAAoB,EAAE,mBAAmB;KAEzC,eAAe,EAAE,mBAAmB"}
|
|
@@ -1,28 +1,19 @@
|
|
|
1
1
|
import { idToBigInt } from "../../utils/base58-id.js";
|
|
2
2
|
import { SymbolIdInputSchema } from "../shared.js";
|
|
3
|
+
import { POLICY_ACTION_LABELS, PRODUCT_POLICY_ACTION_LABELS } from "./shared.codecs.js";
|
|
3
4
|
import * as v from "valibot";
|
|
4
5
|
//#region src/services/policies/shared.ts
|
|
5
6
|
const SpotMarketRuleSchema = v.object({ symbolId: SymbolIdInputSchema });
|
|
6
|
-
const POLICY_ACTIONS =
|
|
7
|
-
"trade-spot",
|
|
8
|
-
"internal-transfer",
|
|
9
|
-
"external-withdraw",
|
|
10
|
-
"read-balances",
|
|
11
|
-
"read-spot",
|
|
12
|
-
"read-internal-transfers",
|
|
13
|
-
"read-address-book",
|
|
14
|
-
"manage-address-book",
|
|
15
|
-
"read-auto-withdraw",
|
|
16
|
-
"manage-auto-withdraw",
|
|
17
|
-
"swap"
|
|
18
|
-
];
|
|
7
|
+
const POLICY_ACTIONS = POLICY_ACTION_LABELS;
|
|
19
8
|
const POLICY_MARKET_SCOPES = ["all", "allowlist"];
|
|
20
9
|
const ProtoPolicyActionEnumSchema = v.number();
|
|
21
10
|
const PolicyActionEnumSchema = v.picklist(POLICY_ACTIONS);
|
|
11
|
+
/** Sub-account policies take product actions only; the server refuses account permissions. */
|
|
12
|
+
const SubaccountPolicyActionEnumSchema = v.picklist(PRODUCT_POLICY_ACTION_LABELS);
|
|
22
13
|
const ProtoPolicyMarketScopeEnumSchema = v.number();
|
|
23
14
|
const PolicyMarketScopeEnumSchema = v.picklist(POLICY_MARKET_SCOPES);
|
|
24
15
|
const PolicyIdSchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.transform((v) => idToBigInt(v, "policyId")));
|
|
25
16
|
//#endregion
|
|
26
|
-
export { POLICY_ACTIONS, POLICY_MARKET_SCOPES, PolicyActionEnumSchema, PolicyIdSchema, PolicyMarketScopeEnumSchema, ProtoPolicyActionEnumSchema, ProtoPolicyMarketScopeEnumSchema, SpotMarketRuleSchema };
|
|
17
|
+
export { POLICY_ACTIONS, POLICY_MARKET_SCOPES, PolicyActionEnumSchema, PolicyIdSchema, PolicyMarketScopeEnumSchema, ProtoPolicyActionEnumSchema, ProtoPolicyMarketScopeEnumSchema, SpotMarketRuleSchema, SubaccountPolicyActionEnumSchema };
|
|
27
18
|
|
|
28
19
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":[],"sources":["../../../src/services/policies/shared.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\n\nexport const SpotMarketRuleSchema = v.object({\n symbolId: SymbolIdInputSchema,\n});\n\nexport const POLICY_ACTIONS =
|
|
1
|
+
{"version":3,"file":"shared.js","names":[],"sources":["../../../src/services/policies/shared.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\nimport { POLICY_ACTION_LABELS, PRODUCT_POLICY_ACTION_LABELS } from \"./shared.codecs.js\";\n\nexport const SpotMarketRuleSchema = v.object({\n symbolId: SymbolIdInputSchema,\n});\n\nexport const POLICY_ACTIONS = POLICY_ACTION_LABELS;\n\nexport const POLICY_MARKET_SCOPES = [\"all\", \"allowlist\"] as const;\n\nexport const ProtoPolicyActionEnumSchema = v.number();\nexport const PolicyActionEnumSchema = v.picklist(POLICY_ACTIONS);\n/** Sub-account policies take product actions only; the server refuses account permissions. */\nexport const SubaccountPolicyActionEnumSchema = v.picklist(PRODUCT_POLICY_ACTION_LABELS);\nexport const ProtoPolicyMarketScopeEnumSchema = v.number();\nexport const PolicyMarketScopeEnumSchema = v.picklist(POLICY_MARKET_SCOPES);\nexport type PolicyMarketScope = v.InferOutput<typeof PolicyMarketScopeEnumSchema>;\n\nexport type PolicyAction = v.InferOutput<typeof PolicyActionEnumSchema>;\n\nexport const PolicyIdSchema = v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n);\n"],"mappings":";;;;;AAKA,MAAa,uBAAuB,EAAE,OAAO,EACzC,UAAU,oBACd,CAAC;AAED,MAAa,iBAAiB;AAE9B,MAAa,uBAAuB,CAAC,OAAO,WAAW;AAEvD,MAAa,8BAA8B,EAAE,OAAO;AACpD,MAAa,yBAAyB,EAAE,SAAS,cAAc;;AAE/D,MAAa,mCAAmC,EAAE,SAAS,4BAA4B;AACvF,MAAa,mCAAmC,EAAE,OAAO;AACzD,MAAa,8BAA8B,EAAE,SAAS,oBAAoB;AAK1E,MAAa,iBAAiB,EAAE,KAC5B,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,UAAU,CAAC,GACb,EAAE,WAAW,MAAM,WAAW,GAAG,UAAU,CAAC,CAChD"}
|
|
@@ -38,7 +38,7 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
38
38
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
39
39
|
}, undefined>, undefined>, readonly []>;
|
|
40
40
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"all" | "allowlist">>]>;
|
|
41
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.NumberSchema<undefined>, undefined>, readonly []>, v.TransformAction<number[], DecodedEnum<"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">[]>]>;
|
|
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-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">[]>]>;
|
|
42
42
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
43
43
|
readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
|
|
44
44
|
readonly maxOrderNotional: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
@@ -79,7 +79,7 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
79
79
|
symbolId: number;
|
|
80
80
|
}[];
|
|
81
81
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
82
|
-
actions: DecodedEnum<"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">[];
|
|
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-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">[];
|
|
83
83
|
isTemplate: boolean;
|
|
84
84
|
sourceTemplateId?: string | undefined;
|
|
85
85
|
maxOrderNotional: string;
|
|
@@ -104,7 +104,7 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
104
104
|
symbolId: number;
|
|
105
105
|
}[];
|
|
106
106
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
107
|
-
actions: DecodedEnum<"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">[];
|
|
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-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">[];
|
|
108
108
|
isTemplate: boolean;
|
|
109
109
|
sourceTemplateId?: string | undefined;
|
|
110
110
|
maxOpenOrders: number;
|
|
@@ -6,8 +6,8 @@ import { BigIntStringSchema, OptionalNumberToIntOrZeroSchema, OptionalPublicIdSc
|
|
|
6
6
|
import { decimalInputToScaled, scaledToDecimalOutput } from "../../../shared/decimal-surface.js";
|
|
7
7
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../../shared/account-scope.js";
|
|
8
8
|
import { buildProtoPatch, defineProtoPatchFields } from "../../../utils/proto-patch.js";
|
|
9
|
-
import { PolicyActionEnumSchema, PolicyMarketScopeEnumSchema, ProtoPolicyActionEnumSchema, ProtoPolicyMarketScopeEnumSchema, SpotMarketRuleSchema } from "../shared.js";
|
|
10
9
|
import { PolicyActionCodec, PolicyMarketScopeCodec, policyActionLabelFor, policyMarketScopeLabelFor } from "../shared.codecs.js";
|
|
10
|
+
import { PolicyMarketScopeEnumSchema, ProtoPolicyActionEnumSchema, ProtoPolicyMarketScopeEnumSchema, SpotMarketRuleSchema, SubaccountPolicyActionEnumSchema } from "../shared.js";
|
|
11
11
|
import { msToTimestamp } from "../../../utils/timestamp.js";
|
|
12
12
|
import * as v from "valibot";
|
|
13
13
|
//#region src/services/policies/subaccount-policies/subaccount-policies.schemas.ts
|
|
@@ -58,7 +58,7 @@ const SubaccountPolicyInputBaseSchema = v.strictObject({
|
|
|
58
58
|
description: v.optional(v.string(), ""),
|
|
59
59
|
spotMarkets: v.optional(v.array(SpotMarketRuleSchema), []),
|
|
60
60
|
spotMarketScope: v.pipe(PolicyMarketScopeEnumSchema, v.transform((v) => PolicyMarketScopeCodec.inputToProto[v])),
|
|
61
|
-
actions: v.pipe(v.optional(v.array(
|
|
61
|
+
actions: v.pipe(v.optional(v.array(SubaccountPolicyActionEnumSchema), []), v.transform((v) => (v ?? []).map((action) => PolicyActionCodec.inputToProto[action]))),
|
|
62
62
|
maxOrderSize: OptionalMaxOrderSizeInputSchema,
|
|
63
63
|
maxOpenOrders: OptionalNumberToIntOrZeroSchema,
|
|
64
64
|
tradingHalted: v.optional(v.boolean(), false),
|
|
@@ -90,7 +90,7 @@ const SubaccountPolicyPatchSchema = v.strictObject({
|
|
|
90
90
|
description: v.optional(v.string()),
|
|
91
91
|
spotMarkets: v.optional(v.array(SpotMarketRuleSchema)),
|
|
92
92
|
spotMarketScope: v.optional(PolicyMarketScopeEnumSchema),
|
|
93
|
-
actions: v.optional(v.array(
|
|
93
|
+
actions: v.optional(v.array(SubaccountPolicyActionEnumSchema)),
|
|
94
94
|
maxOrderSize: v.optional(v.nullable(MaxOrderSizeInputSchema)),
|
|
95
95
|
maxOpenOrders: v.optional(v.nullable(v.pipe(v.number(), v.maxValue(PROTOBUF_UINT32_MAX)))),
|
|
96
96
|
tradingHalted: v.optional(v.boolean()),
|
|
@@ -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 PolicyActionEnumSchema,\n PolicyMarketScopeEnumSchema,\n ProtoPolicyActionEnumSchema,\n ProtoPolicyMarketScopeEnumSchema,\n SpotMarketRuleSchema,\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 { toIntOrZero } from \"../../../utils/numbers.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(PolicyActionEnumSchema), []),\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(PolicyActionEnumSchema)),\n maxOrderSize: v.optional(v.nullable(MaxOrderSizeInputSchema)),\n maxOpenOrders: v.optional(v.nullable(v.pipe(v.number(), v.maxValue(PROTOBUF_UINT32_MAX)))),\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: toIntOrZero(value) }),\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\nconst DEFAULT_SUBACCOUNT_POLICY_UPDATED_AT = Date.now();\n\nexport const DEFAULT_SUBACCOUNT_POLICY: SubaccountPolicy = {\n id: \"\",\n name: \"Subaccount Policy\",\n description: \"Subaccount Policy description\",\n spotMarkets: [],\n spotMarketScope: \"all\",\n actions: [\"read-balances\", \"read-internal-transfers\", \"read-address-book\", \"read-spot\"],\n maxOrderSize: \"0\",\n maxOpenOrders: 0,\n tradingHalted: false,\n createdAt: DEFAULT_SUBACCOUNT_POLICY_UPDATED_AT,\n updatedAt: DEFAULT_SUBACCOUNT_POLICY_UPDATED_AT,\n updatedAtNs: (BigInt(DEFAULT_SUBACCOUNT_POLICY_UPDATED_AT) * 1_000_000n).toString(),\n isTemplate: false,\n sourceTemplateId: undefined,\n locked: false,\n reviewAt: undefined,\n expiresAt: undefined,\n revision: \"0\",\n};\n"],"mappings":";;;;;;;;;;;;;AA0CA,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,UAAU;CACzC,cAAc,2BAA2B,OAAO;AACpD,EAAE,CACN;;;;AAOA,MAAa,y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IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa,CAAC;CACd,iBAAiB;CACjB,SAAS;EAAC;EAAiB;EAA2B;EAAqB;CAAW;CACtF,cAAc;CACd,eAAe;CACf,eAAe;CACf,WAAW;CACX,WAAW;CACX,cAAc,OAAO,oCAAoC,IAAI,SAAA,CAAY,SAAS;CAClF,YAAY;CACZ,kBAAkB,KAAA;CAClB,QAAQ;CACR,UAAU,KAAA;CACV,WAAW,KAAA;CACX,UAAU;AACd"}
|
|
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 { toIntOrZero } from \"../../../utils/numbers.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(v.nullable(v.pipe(v.number(), v.maxValue(PROTOBUF_UINT32_MAX)))),\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: toIntOrZero(value) }),\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\nconst DEFAULT_SUBACCOUNT_POLICY_UPDATED_AT = Date.now();\n\nexport const DEFAULT_SUBACCOUNT_POLICY: SubaccountPolicy = {\n id: \"\",\n name: \"Subaccount Policy\",\n description: \"Subaccount Policy description\",\n spotMarkets: [],\n spotMarketScope: \"all\",\n actions: [\"read-balances\", \"read-internal-transfers\", \"read-address-book\", \"read-spot\"],\n maxOrderSize: \"0\",\n maxOpenOrders: 0,\n tradingHalted: false,\n createdAt: DEFAULT_SUBACCOUNT_POLICY_UPDATED_AT,\n updatedAt: DEFAULT_SUBACCOUNT_POLICY_UPDATED_AT,\n updatedAtNs: (BigInt(DEFAULT_SUBACCOUNT_POLICY_UPDATED_AT) * 1_000_000n).toString(),\n isTemplate: false,\n sourceTemplateId: undefined,\n locked: false,\n reviewAt: undefined,\n expiresAt: undefined,\n revision: \"0\",\n};\n"],"mappings":";;;;;;;;;;;;;AA0CA,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,UAAU;CACzC,cAAc,2BAA2B,OAAO;AACpD,EAAE,CACN;;;;AAOA,MAAa,yBAAyB,EAAE,KACpC,EAAE,OAAO;CACL,IAAI;CACJ,MAAM,EAAE,OAAO;CACf,aAAa,EAAE,OAAO;CACtB,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,GAAG,CAAC,CAAC;CACzD,iBAAiB,EAAE,KACf,kCACA,EAAE,WAAW,MAAM,0BAA0B,CAAC,CAAC,CACnD;CACA,SAAS,EAAE,KACP,EAAE,SAAS,EAAE,MAAM,2BAA2B,GAAG,CAAC,CAAC,GACnD,EAAE,WAA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-1,10 +1,11 @@
|
|
|
1
1
|
import { AuthApiTransports } from "../../shared/transports.js";
|
|
2
2
|
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { ListRewardAwardsInput, ListRewardAwardsResult, SetRewardDestinationInput, SetRewardDestinationResult } from "./rewards.schemas.js";
|
|
3
|
+
import { AcknowledgeRewardAwardInput, AcknowledgeRewardAwardResult, ListRewardAwardsInput, ListRewardAwardsResult, SetRewardDestinationInput, SetRewardDestinationResult } from "./rewards.schemas.js";
|
|
4
4
|
//#region src/services/rewards/rewards.d.ts
|
|
5
5
|
/**
|
|
6
|
-
* Reads published reward campaign awards for the authenticated root account
|
|
7
|
-
*
|
|
6
|
+
* Reads published reward campaign awards for the authenticated root account, records payout
|
|
7
|
+
* destinations, and acknowledges seen awards. Every call accepts a session JWT. `listAwards` also
|
|
8
|
+
* accepts an API key scoped to the main account whose policy grants `read-rewards`.
|
|
8
9
|
*/
|
|
9
10
|
declare class RewardsService {
|
|
10
11
|
#private;
|
|
@@ -17,6 +18,15 @@ declare class RewardsService {
|
|
|
17
18
|
* Records a write-once payout destination for an award, interpreted in the award's `network`. Pass the award's `fulfillmentRevision` as `expectedRevision` and reuse the same `requestId` when retrying. Requires a fresh step-up proof via `options.stepUpToken`. This does not execute a transfer or mark the award delivered.
|
|
18
19
|
*/
|
|
19
20
|
setDestination(input: SetRewardDestinationInput, options?: PolyesterMutationOptions): Promise<SetRewardDestinationResult>;
|
|
21
|
+
/**
|
|
22
|
+
* Records that the recipient revealed an award (`revealed: true`) or saw a paid award's
|
|
23
|
+
* delivery (`deliverySeen: true`), so other sessions and devices do not show the dialog again.
|
|
24
|
+
* Set at least one. Marks are independent, permanent and idempotent: the first timestamp is
|
|
25
|
+
* kept, `false` leaves a mark unchanged, and a failed call can be retried as is. `deliverySeen`
|
|
26
|
+
* on an award that is not paid fails the whole call with `PreconditionFailedError`. Returns the
|
|
27
|
+
* current award with its marks; fulfillment state and revision are unchanged. Session JWT only.
|
|
28
|
+
*/
|
|
29
|
+
acknowledgeAward(input: AcknowledgeRewardAwardInput, options?: PolyesterRequestOptions): Promise<AcknowledgeRewardAwardResult>;
|
|
20
30
|
}
|
|
21
31
|
//#endregion
|
|
22
32
|
export { RewardsService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rewards.d.ts","names":[],"sources":["../../../src/services/rewards/rewards.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"rewards.d.ts","names":[],"sources":["../../../src/services/rewards/rewards.ts"],"mappings":";;;;;;;;;cA6Ba;;EAGG,YAAA,YAAY;;;;EAOlB,WACF,QAAO,uBACP,UAAU,0BACX,QAAQ;;;;EAYL,eACF,OAAO,2BACP,UAAU,2BACX,QAAQ;;;;;;;;;EAiBL,iBACF,OAAO,6BACP,UAAU,0BACX,QAAQ"}
|