@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
|
@@ -7,7 +7,7 @@ import { PositiveUint32InputSchema } from "../shared.js";
|
|
|
7
7
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
8
8
|
import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
9
9
|
import { fromU128, toU128 } from "../../utils/u128.js";
|
|
10
|
-
import { AUTO_WITHDRAW_WEEKDAY_VALUES, AutoWithdrawCadenceCodec, AutoWithdrawRunStateCodec, AutoWithdrawStepStateCodec, AutoWithdrawWeekdayCodec } from "./auto-withdraw.codecs.js";
|
|
10
|
+
import { AUTO_WITHDRAW_WEEKDAY_VALUES, AutoWithdrawCadenceCodec, AutoWithdrawPreviewStatusCodec, AutoWithdrawRunStateCodec, AutoWithdrawStepStateCodec, AutoWithdrawWeekdayCodec } from "./auto-withdraw.codecs.js";
|
|
11
11
|
import * as v from "valibot";
|
|
12
12
|
//#region src/services/auto-withdraw/auto-withdraw.schemas.ts
|
|
13
13
|
const U128_MAX = (1n << 128n) - 1n;
|
|
@@ -20,6 +20,10 @@ function decimalToE18(field, value) {
|
|
|
20
20
|
function e18ToDecimal(value) {
|
|
21
21
|
return scaledToDecimalOutput(fromU128(value), 18);
|
|
22
22
|
}
|
|
23
|
+
/** Unset means unknown, never zero. */
|
|
24
|
+
function optionalE18ToDecimal(value) {
|
|
25
|
+
return value ? e18ToDecimal(value) : null;
|
|
26
|
+
}
|
|
23
27
|
const AccountScopedInputSchema = v.strictObject({ ...AccountScopeInputEntries });
|
|
24
28
|
const AutoWithdrawScopedInputSchema = v.pipe(AccountScopedInputSchema, v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })));
|
|
25
29
|
const Uint32InputSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX));
|
|
@@ -105,13 +109,16 @@ const SetAutoWithdrawRuleInputSchema = v.pipe(v.strictObject({
|
|
|
105
109
|
subaccountId: accountScopeToSubaccountId(account),
|
|
106
110
|
minUsdValueE18: minUsdValue == null ? void 0 : toU128(decimalToE18("minUsdValue", minUsdValue))
|
|
107
111
|
})));
|
|
108
|
-
const
|
|
112
|
+
const SetAutoWithdrawRuleEnabledInputSchema = v.pipe(v.strictObject({
|
|
109
113
|
...AccountScopeInputEntries,
|
|
110
114
|
/** The account's latest rule version. */
|
|
111
|
-
expectedVersion: Uint32InputSchema
|
|
112
|
-
|
|
115
|
+
expectedVersion: Uint32InputSchema,
|
|
116
|
+
/** `false` pauses the rule; `true` resumes it. */
|
|
117
|
+
enabled: v.boolean()
|
|
118
|
+
}), v.transform(({ account, expectedVersion, enabled }) => ({
|
|
113
119
|
subaccountId: accountScopeToSubaccountId(account),
|
|
114
|
-
expectedVersion
|
|
120
|
+
expectedVersion,
|
|
121
|
+
enabled
|
|
115
122
|
})));
|
|
116
123
|
/** `limit` is 0 through 100; 0 or omitted uses the server default of 20. */
|
|
117
124
|
const ListAutoWithdrawRunsInputSchema = v.pipe(v.strictObject({
|
|
@@ -168,12 +175,14 @@ const AutoWithdrawDestinationSchema = v.pipe(v.object({
|
|
|
168
175
|
destinationChainId: v.bigint(),
|
|
169
176
|
destinationAddress: v.string(),
|
|
170
177
|
minAmountE18: v.optional(U128Schema),
|
|
171
|
-
maxAmountE18: v.optional(U128Schema)
|
|
172
|
-
|
|
178
|
+
maxAmountE18: v.optional(U128Schema),
|
|
179
|
+
minFloorE18: v.optional(U128Schema)
|
|
180
|
+
}), v.transform(({ minAmountE18, maxAmountE18, minFloorE18, destinationChainId, ...destination }) => ({
|
|
173
181
|
...destination,
|
|
174
182
|
destinationChainId: Number(destinationChainId),
|
|
175
183
|
minAmount: e18ToDecimal(minAmountE18),
|
|
176
|
-
maxAmount: e18ToDecimal(maxAmountE18)
|
|
184
|
+
maxAmount: e18ToDecimal(maxAmountE18),
|
|
185
|
+
minFloor: optionalE18ToDecimal(minFloorE18)
|
|
177
186
|
})));
|
|
178
187
|
const AutoWithdrawPauseSchema = v.object({
|
|
179
188
|
assetId: v.number(),
|
|
@@ -188,7 +197,8 @@ const AutoWithdrawRuleSchema = v.pipe(v.object({
|
|
|
188
197
|
destinations: v.array(AutoWithdrawDestinationSchema),
|
|
189
198
|
createdAt: TimestampMsSchema,
|
|
190
199
|
pause: v.optional(AutoWithdrawPauseSchema),
|
|
191
|
-
minUsdValueE18: v.optional(U128Schema)
|
|
200
|
+
minUsdValueE18: v.optional(U128Schema),
|
|
201
|
+
createdByAccountId: v.optional(PublicIdOrEmptySchema, 0n)
|
|
192
202
|
}), v.transform(({ schedule, pause, minUsdValueE18, ...rule }) => ({
|
|
193
203
|
...rule,
|
|
194
204
|
schedule: schedule ?? { cadence: "unspecified" },
|
|
@@ -202,16 +212,18 @@ const AutoWithdrawStepSchema = v.pipe(v.object({
|
|
|
202
212
|
availableE18: v.optional(U128Schema),
|
|
203
213
|
amountE18: v.optional(U128Schema),
|
|
204
214
|
valueUsdE18: v.optional(U128Schema),
|
|
215
|
+
networkFeeE18: v.optional(U128Schema),
|
|
205
216
|
state: enumLabelSchema(AutoWithdrawStepStateCodec.protoToOutput),
|
|
206
217
|
reason: reasonSchema(),
|
|
207
218
|
intentId: v.optional(v.string(), ""),
|
|
208
219
|
txHash: v.optional(v.string(), "")
|
|
209
|
-
}), v.transform(({ availableE18, amountE18, valueUsdE18, destinationChainId, intentId, txHash, ...step }) => ({
|
|
220
|
+
}), v.transform(({ availableE18, amountE18, valueUsdE18, networkFeeE18, destinationChainId, intentId, txHash, ...step }) => ({
|
|
210
221
|
...step,
|
|
211
222
|
destinationChainId: Number(destinationChainId),
|
|
212
223
|
available: e18ToDecimal(availableE18),
|
|
213
224
|
amount: e18ToDecimal(amountE18),
|
|
214
225
|
valueUsd: valueUsdE18 ? e18ToDecimal(valueUsdE18) : null,
|
|
226
|
+
networkFee: optionalE18ToDecimal(networkFeeE18),
|
|
215
227
|
intentId: intentId || null,
|
|
216
228
|
txHash: txHash || null
|
|
217
229
|
})));
|
|
@@ -232,7 +244,50 @@ const ListAutoWithdrawRunsResultSchema = v.object({
|
|
|
232
244
|
runs: v.array(AutoWithdrawRunSchema),
|
|
233
245
|
nextPageToken: v.optional(v.string(), "")
|
|
234
246
|
});
|
|
247
|
+
const AutoWithdrawPreviewAssetSchema = v.pipe(v.object({
|
|
248
|
+
assetId: v.number(),
|
|
249
|
+
destinationChainId: v.optional(v.bigint(), 0n),
|
|
250
|
+
destinationAddress: v.optional(v.string(), ""),
|
|
251
|
+
availableE18: v.optional(U128Schema),
|
|
252
|
+
payableE18: v.optional(U128Schema),
|
|
253
|
+
heldBackE18: v.optional(U128Schema),
|
|
254
|
+
holdReason: reasonSchema(),
|
|
255
|
+
minimumE18: v.optional(U128Schema),
|
|
256
|
+
valueUsdE18: v.optional(U128Schema),
|
|
257
|
+
pricedAt: OptionalTimestampMsSchema,
|
|
258
|
+
networkFeeE18: v.optional(U128Schema),
|
|
259
|
+
networkFeeSampledAt: OptionalTimestampMsSchema,
|
|
260
|
+
payableFrom: OptionalTimestampMsSchema
|
|
261
|
+
}), v.transform((asset) => ({
|
|
262
|
+
assetId: asset.assetId,
|
|
263
|
+
destinationChainId: asset.destinationChainId === 0n ? null : Number(asset.destinationChainId),
|
|
264
|
+
destinationAddress: asset.destinationAddress || null,
|
|
265
|
+
available: e18ToDecimal(asset.availableE18),
|
|
266
|
+
payable: e18ToDecimal(asset.payableE18),
|
|
267
|
+
heldBack: e18ToDecimal(asset.heldBackE18),
|
|
268
|
+
holdReason: asset.holdReason,
|
|
269
|
+
minimum: optionalE18ToDecimal(asset.minimumE18),
|
|
270
|
+
valueUsd: optionalE18ToDecimal(asset.valueUsdE18),
|
|
271
|
+
pricedAt: asset.pricedAt ?? null,
|
|
272
|
+
networkFee: optionalE18ToDecimal(asset.networkFeeE18),
|
|
273
|
+
networkFeeSampledAt: asset.networkFeeSampledAt ?? null,
|
|
274
|
+
payableFrom: asset.payableFrom ?? null
|
|
275
|
+
})));
|
|
276
|
+
const AutoWithdrawPreviewSchema = v.pipe(v.object({
|
|
277
|
+
status: enumLabelSchema(AutoWithdrawPreviewStatusCodec.protoToOutput),
|
|
278
|
+
nextRunAt: OptionalTimestampMsSchema,
|
|
279
|
+
ruleVersion: v.optional(v.number(), 0),
|
|
280
|
+
pause: v.optional(AutoWithdrawPauseSchema),
|
|
281
|
+
minUsdValueE18: v.optional(U128Schema),
|
|
282
|
+
assets: v.array(AutoWithdrawPreviewAssetSchema),
|
|
283
|
+
computedAt: TimestampMsSchema
|
|
284
|
+
}), v.transform(({ nextRunAt, pause, minUsdValueE18, ...preview }) => ({
|
|
285
|
+
...preview,
|
|
286
|
+
nextRunAt: nextRunAt ?? null,
|
|
287
|
+
pause: pause ?? null,
|
|
288
|
+
minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18)
|
|
289
|
+
})));
|
|
235
290
|
//#endregion
|
|
236
|
-
export { AutoWithdrawRuleSchema, AutoWithdrawScheduleInputSchema, AutoWithdrawScopedInputSchema,
|
|
291
|
+
export { AutoWithdrawPreviewSchema, AutoWithdrawRuleSchema, AutoWithdrawScheduleInputSchema, AutoWithdrawScopedInputSchema, ListAutoWithdrawRunsInputSchema, ListAutoWithdrawRunsResultSchema, SetAutoWithdrawRuleEnabledInputSchema, SetAutoWithdrawRuleInputSchema };
|
|
237
292
|
|
|
238
293
|
//# sourceMappingURL=auto-withdraw.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-withdraw.schemas.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport {\n decimalInputToScaled,\n E18_SCALE,\n scaledToDecimalOutput,\n} from \"../../shared/decimal-surface.js\";\nimport { ValidationError } from \"../../shared/errors.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdOrEmptySchema,\n TimestampMsSchema,\n U128Schema,\n} from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport {\n AUTO_WITHDRAW_WEEKDAY_VALUES,\n AutoWithdrawCadenceCodec,\n AutoWithdrawRunStateCodec,\n AutoWithdrawStepStateCodec,\n AutoWithdrawWeekdayCodec,\n type AutoWithdrawPauseReason,\n type AutoWithdrawRunReason,\n type AutoWithdrawStepReason,\n type AutoWithdrawWeekday,\n} from \"./auto-withdraw.codecs.js\";\n\nconst U128_MAX = (1n << 128n) - 1n;\n\n/** Decimal string → 18-decimal U128 integer, exact; throws `ValidationError`. */\nfunction decimalToE18(field: string, value: string): bigint {\n const scaled = decimalInputToScaled(field, value, E18_SCALE);\n if (scaled > U128_MAX) {\n throw new ValidationError(`${field} exceeds the maximum supported value: ${value}`);\n }\n return scaled;\n}\n\nfunction e18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string {\n return scaledToDecimalOutput(fromU128(value), E18_SCALE);\n}\n\nconst AccountScopedInputSchema = v.strictObject({ ...AccountScopeInputEntries });\n\nexport type AutoWithdrawScopedInput = v.InferInput<typeof AccountScopedInputSchema>;\n\nexport const AutoWithdrawScopedInputSchema = v.pipe(\n AccountScopedInputSchema,\n v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })),\n);\n\nconst Uint32InputSchema = v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(PROTOBUF_UINT32_MAX),\n);\nconst MinuteOfDaySchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1439));\nconst MinuteOfHourSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(59));\nconst DayOfMonthSchema = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(31));\nconst WeekdaySchema = v.picklist(AUTO_WITHDRAW_WEEKDAY_VALUES);\nconst AnchorDateSchema = v.pipe(\n v.string(),\n v.trim(),\n v.isoDate(\"anchorDate must be a UTC date, YYYY-MM-DD\"),\n v.check((date) => {\n const parsed = new Date(`${date}T00:00:00Z`);\n return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(date);\n }, \"anchorDate must be a real calendar date\"),\n);\n\n/**\n * A rule's UTC run slot. Each cadence takes only its own fields; any other field is rejected.\n * `minuteOfDay` is minutes after 00:00 UTC (0–1439), `minuteOfHour` 0–59, `dayOfMonth` 1–31\n * (a shorter month runs on its last day), and `anchorDate` is a UTC date in a week a biweekly\n * rule runs.\n */\nexport const AutoWithdrawScheduleInputSchema = v.pipe(\n v.variant(\"cadence\", [\n v.strictObject({ cadence: v.literal(\"hourly\"), minuteOfHour: MinuteOfHourSchema }),\n v.strictObject({ cadence: v.literal(\"daily\"), minuteOfDay: MinuteOfDaySchema }),\n v.strictObject({\n cadence: v.literal(\"weekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n v.strictObject({\n cadence: v.literal(\"biweekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n anchorDate: AnchorDateSchema,\n }),\n v.strictObject({\n cadence: v.literal(\"monthly\"),\n dayOfMonth: DayOfMonthSchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n ]),\n v.transform((schedule) => ({\n cadence: AutoWithdrawCadenceCodec.inputToProto[schedule.cadence],\n weekday:\n \"weekday\" in schedule\n ? AutoWithdrawWeekdayCodec.inputToProto[schedule.weekday]\n : undefined,\n minuteOfDay: \"minuteOfDay\" in schedule ? schedule.minuteOfDay : undefined,\n minuteOfHour: \"minuteOfHour\" in schedule ? schedule.minuteOfHour : undefined,\n dayOfMonth: \"dayOfMonth\" in schedule ? schedule.dayOfMonth : undefined,\n anchorDate: \"anchorDate\" in schedule ? schedule.anchorDate : undefined,\n })),\n);\n\nexport type AutoWithdrawScheduleInput = v.InferInput<typeof AutoWithdrawScheduleInputSchema>;\n\n/**\n * One asset paid in kind to one whitelisted external-chain address. `minAmount` and\n * `maxAmount` are decimal asset amounts (up to 18 decimals); a run pays the balance up to\n * `maxAmount` once it reaches `minAmount`.\n */\nconst AutoWithdrawDestinationInputSchema = v.pipe(\n v.strictObject({\n assetId: PositiveUint32InputSchema,\n destinationChainId: v.pipe(\n v.number(),\n v.integer(),\n v.gtValue(0),\n v.maxValue(Number.MAX_SAFE_INTEGER),\n ),\n destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n minAmount: v.string(),\n maxAmount: v.string(),\n }),\n v.transform(({ minAmount, maxAmount, destinationChainId, ...destination }) => {\n const min = decimalToE18(\"minAmount\", minAmount);\n const max = decimalToE18(\"maxAmount\", maxAmount);\n if (max === 0n || max < min) {\n throw new ValidationError(\n `maxAmount must be greater than 0 and at least minAmount: ${maxAmount}`,\n );\n }\n return {\n ...destination,\n destinationChainId: BigInt(destinationChainId),\n minAmountE18: toU128(min),\n maxAmountE18: toU128(max),\n };\n }),\n);\n\nexport type AutoWithdrawDestinationInput = v.InferInput<typeof AutoWithdrawDestinationInputSchema>;\n\nexport const SetAutoWithdrawRuleInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The version this change replaces: 0 when the account has no rule yet. */\n expectedVersion: Uint32InputSchema,\n schedule: AutoWithdrawScheduleInputSchema,\n destinations: v.pipe(\n v.array(AutoWithdrawDestinationInputSchema),\n v.minLength(1, \"At least one destination is required.\"),\n v.maxLength(32, \"At most 32 destinations are allowed.\"),\n v.check(\n (destinations) =>\n new Set(destinations.map((d) => d.assetId)).size === destinations.length,\n \"At most one destination per asset is allowed.\",\n ),\n ),\n /** Least USD value one payout pays, as a decimal; omit or null for no USD minimum. */\n minUsdValue: v.optional(v.nullable(v.string())),\n }),\n v.transform(({ account, minUsdValue, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n minUsdValueE18:\n minUsdValue == null ? undefined : toU128(decimalToE18(\"minUsdValue\", minUsdValue)),\n })),\n);\n\nexport type SetAutoWithdrawRuleInput = v.InferInput<typeof SetAutoWithdrawRuleInputSchema>;\n\nexport const DisableAutoWithdrawRuleInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The account's latest rule version. */\n expectedVersion: Uint32InputSchema,\n }),\n v.transform(({ account, expectedVersion }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n expectedVersion,\n })),\n);\n\nexport type DisableAutoWithdrawRuleInput = v.InferInput<typeof DisableAutoWithdrawRuleInputSchema>;\n\n/** `limit` is 0 through 100; 0 or omitted uses the server default of 20. */\nexport const ListAutoWithdrawRunsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), 0),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListAutoWithdrawRunsInput = v.InferInput<typeof ListAutoWithdrawRunsInputSchema>;\n\ntype ScheduleShape<Weekday> =\n | { cadence: \"hourly\"; minuteOfHour: number }\n | { cadence: \"daily\"; minuteOfDay: number }\n | { cadence: \"weekly\"; weekday: Weekday; minuteOfDay: number }\n | { cadence: \"biweekly\"; weekday: Weekday; minuteOfDay: number; anchorDate: string }\n | { cadence: \"monthly\"; dayOfMonth: number; minuteOfDay: number };\n\n/** A decoded schedule. A cadence this SDK build does not know decodes as `\"unspecified\"`. */\nexport type AutoWithdrawSchedule =\n | ScheduleShape<DecodedEnum<AutoWithdrawWeekday>>\n | { cadence: \"unspecified\" };\n\nconst AutoWithdrawScheduleSchema = v.pipe(\n v.object({\n cadence: v.optional(v.number(), 0),\n weekday: v.optional(v.number(), 0),\n minuteOfDay: v.optional(v.number(), 0),\n minuteOfHour: v.optional(v.number(), 0),\n dayOfMonth: v.optional(v.number(), 0),\n anchorDate: v.optional(v.string(), \"\"),\n }),\n v.transform((s): AutoWithdrawSchedule => {\n const weekday = enumLabel(AutoWithdrawWeekdayCodec.protoToOutput, s.weekday);\n const { minuteOfDay } = s;\n switch (s.cadence) {\n case Proto.AutoWithdrawCadence.HOURLY:\n return { cadence: \"hourly\", minuteOfHour: s.minuteOfHour };\n case Proto.AutoWithdrawCadence.DAILY:\n return { cadence: \"daily\", minuteOfDay };\n case Proto.AutoWithdrawCadence.WEEKLY:\n return { cadence: \"weekly\", weekday, minuteOfDay };\n case Proto.AutoWithdrawCadence.BIWEEKLY:\n return { cadence: \"biweekly\", weekday, minuteOfDay, anchorDate: s.anchorDate };\n case Proto.AutoWithdrawCadence.MONTHLY:\n return { cadence: \"monthly\", dayOfMonth: s.dayOfMonth, minuteOfDay };\n default:\n return { cadence: \"unspecified\" };\n }\n }),\n);\n\nfunction reasonSchema<TReason extends string>() {\n return v.pipe(\n v.optional(v.string(), \"\"),\n v.transform((reason) => (reason ? (reason as TReason) : null)),\n );\n}\n\nconst AutoWithdrawDestinationSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n minAmountE18: v.optional(U128Schema),\n maxAmountE18: v.optional(U128Schema),\n }),\n v.transform(({ minAmountE18, maxAmountE18, destinationChainId, ...destination }) => ({\n ...destination,\n destinationChainId: Number(destinationChainId),\n minAmount: e18ToDecimal(minAmountE18),\n maxAmount: e18ToDecimal(maxAmountE18),\n })),\n);\n\nexport type AutoWithdrawDestination = v.InferOutput<typeof AutoWithdrawDestinationSchema>;\n\nconst AutoWithdrawPauseSchema = v.object({\n assetId: v.number(),\n reason: v.pipe(\n v.string(),\n v.transform((reason) => reason as AutoWithdrawPauseReason),\n ),\n pausedAt: TimestampMsSchema,\n});\n\nexport type AutoWithdrawPause = v.InferOutput<typeof AutoWithdrawPauseSchema>;\n\nexport const AutoWithdrawRuleSchema = v.pipe(\n v.object({\n subaccountId: v.optional(PublicIdOrEmptySchema, 0n),\n version: v.number(),\n enabled: v.boolean(),\n schedule: v.optional(AutoWithdrawScheduleSchema),\n destinations: v.array(AutoWithdrawDestinationSchema),\n createdAt: TimestampMsSchema,\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n }),\n v.transform(({ schedule, pause, minUsdValueE18, ...rule }) => ({\n ...rule,\n schedule: schedule ?? ({ cadence: \"unspecified\" } as AutoWithdrawSchedule),\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * One version of an account's rule. `subaccountId` is the public subaccount ID, `\"\"` for the\n * root account. Times are epoch milliseconds. `minUsdValue` is null when the rule has no USD\n * minimum; `pause` is set when the rule paused itself, and a new version resumes it.\n */\nexport type AutoWithdrawRule = v.InferOutput<typeof AutoWithdrawRuleSchema>;\n\nconst AutoWithdrawStepSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n availableE18: v.optional(U128Schema),\n amountE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n state: enumLabelSchema(AutoWithdrawStepStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawStepReason>(),\n intentId: v.optional(v.string(), \"\"),\n txHash: v.optional(v.string(), \"\"),\n }),\n v.transform(\n ({\n availableE18,\n amountE18,\n valueUsdE18,\n destinationChainId,\n intentId,\n txHash,\n ...step\n }) => ({\n ...step,\n destinationChainId: Number(destinationChainId),\n available: e18ToDecimal(availableE18),\n amount: e18ToDecimal(amountE18),\n valueUsd: valueUsdE18 ? e18ToDecimal(valueUsdE18) : null,\n intentId: intentId || null,\n txHash: txHash || null,\n }),\n ),\n);\n\n/**\n * One asset's payout in a run. `available`, `amount` and `valueUsd` are decimal strings;\n * `valueUsd` is null when the rule has no USD minimum or no price was available.\n */\nexport type AutoWithdrawStep = v.InferOutput<typeof AutoWithdrawStepSchema>;\n\nconst AutoWithdrawRunSchema = v.pipe(\n v.object({\n runSeq: BigIntStringSchema,\n ruleVersion: v.number(),\n scheduledFor: TimestampMsSchema,\n state: enumLabelSchema(AutoWithdrawRunStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawRunReason>(),\n steps: v.array(AutoWithdrawStepSchema),\n createdAt: TimestampMsSchema,\n finishedAt: OptionalTimestampMsSchema,\n }),\n v.transform(({ finishedAt, ...run }) => ({ ...run, finishedAt: finishedAt ?? null })),\n);\n\n/** One scheduled run. Times are epoch milliseconds; `finishedAt` is null while in progress. */\nexport type AutoWithdrawRun = v.InferOutput<typeof AutoWithdrawRunSchema>;\n\nexport const ListAutoWithdrawRunsResultSchema = v.object({\n runs: v.array(AutoWithdrawRunSchema),\n nextPageToken: v.optional(v.string(), \"\"),\n});\n\n/** One page of runs, newest first. An empty `nextPageToken` means no more runs. */\nexport type ListAutoWithdrawRunsResult = v.InferOutput<typeof ListAutoWithdrawRunsResultSchema>;\n"],"mappings":";;;;;;;;;;;;AAoCA,MAAM,YAAY,MAAM,QAAQ;;AAGhC,SAAS,aAAa,OAAe,OAAuB;CACxD,MAAM,SAAS,qBAAqB,OAAO,OAAA,EAAgB;CAC3D,IAAI,SAAS,UACT,MAAM,IAAI,gBAAgB,GAAG,MAAM,wCAAwC,OAAO;CAEtF,OAAO;AACX;AAEA,SAAS,aAAa,OAA6D;CAC/E,OAAO,sBAAsB,SAAS,KAAK,GAAA,EAAY;AAC3D;AAEA,MAAM,2BAA2B,EAAE,a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,0BAA0B,aAAa;CAC9D,QAAQ,aAAoC;CAC5C,OAAO,EAAE,MAAM,sBAAsB;CACrC,WAAW;CACX,YAAY;AAChB,CAAC,GACD,EAAE,WAAW,EAAE,YAAY,GAAG,WAAW;CAAE,GAAG;CAAK,YAAY,cAAc;AAAK,EAAE,CACxF;AAKA,MAAa,mCAAmC,EAAE,OAAO;CACrD,MAAM,EAAE,MAAM,qBAAqB;CACnC,eAAe,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC5C,CAAC"}
|
|
1
|
+
{"version":3,"file":"auto-withdraw.schemas.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport {\n decimalInputToScaled,\n E18_SCALE,\n scaledToDecimalOutput,\n} from \"../../shared/decimal-surface.js\";\nimport { ValidationError } from \"../../shared/errors.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdOrEmptySchema,\n TimestampMsSchema,\n U128Schema,\n} from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport {\n AUTO_WITHDRAW_WEEKDAY_VALUES,\n AutoWithdrawCadenceCodec,\n AutoWithdrawPreviewStatusCodec,\n AutoWithdrawRunStateCodec,\n AutoWithdrawStepStateCodec,\n AutoWithdrawWeekdayCodec,\n type AutoWithdrawHoldReason,\n type AutoWithdrawPauseReason,\n type AutoWithdrawRunReason,\n type AutoWithdrawStepReason,\n type AutoWithdrawWeekday,\n} from \"./auto-withdraw.codecs.js\";\n\nconst U128_MAX = (1n << 128n) - 1n;\n\n/** Decimal string → 18-decimal U128 integer, exact; throws `ValidationError`. */\nfunction decimalToE18(field: string, value: string): bigint {\n const scaled = decimalInputToScaled(field, value, E18_SCALE);\n if (scaled > U128_MAX) {\n throw new ValidationError(`${field} exceeds the maximum supported value: ${value}`);\n }\n return scaled;\n}\n\nfunction e18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string {\n return scaledToDecimalOutput(fromU128(value), E18_SCALE);\n}\n\n/** Unset means unknown, never zero. */\nfunction optionalE18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string | null {\n return value ? e18ToDecimal(value) : null;\n}\n\nconst AccountScopedInputSchema = v.strictObject({ ...AccountScopeInputEntries });\n\nexport type AutoWithdrawScopedInput = v.InferInput<typeof AccountScopedInputSchema>;\n\nexport const AutoWithdrawScopedInputSchema = v.pipe(\n AccountScopedInputSchema,\n v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })),\n);\n\nconst Uint32InputSchema = v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(PROTOBUF_UINT32_MAX),\n);\nconst MinuteOfDaySchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1439));\nconst MinuteOfHourSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(59));\nconst DayOfMonthSchema = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(31));\nconst WeekdaySchema = v.picklist(AUTO_WITHDRAW_WEEKDAY_VALUES);\nconst AnchorDateSchema = v.pipe(\n v.string(),\n v.trim(),\n v.isoDate(\"anchorDate must be a UTC date, YYYY-MM-DD\"),\n v.check((date) => {\n const parsed = new Date(`${date}T00:00:00Z`);\n return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(date);\n }, \"anchorDate must be a real calendar date\"),\n);\n\n/**\n * A rule's UTC run slot. Each cadence takes only its own fields; any other field is rejected.\n * `minuteOfDay` is minutes after 00:00 UTC (0–1439), `minuteOfHour` 0–59, `dayOfMonth` 1–31\n * (a shorter month runs on its last day), and `anchorDate` is a UTC date in a week a biweekly\n * rule runs.\n */\nexport const AutoWithdrawScheduleInputSchema = v.pipe(\n v.variant(\"cadence\", [\n v.strictObject({ cadence: v.literal(\"hourly\"), minuteOfHour: MinuteOfHourSchema }),\n v.strictObject({ cadence: v.literal(\"daily\"), minuteOfDay: MinuteOfDaySchema }),\n v.strictObject({\n cadence: v.literal(\"weekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n v.strictObject({\n cadence: v.literal(\"biweekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n anchorDate: AnchorDateSchema,\n }),\n v.strictObject({\n cadence: v.literal(\"monthly\"),\n dayOfMonth: DayOfMonthSchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n ]),\n v.transform((schedule) => ({\n cadence: AutoWithdrawCadenceCodec.inputToProto[schedule.cadence],\n weekday:\n \"weekday\" in schedule\n ? AutoWithdrawWeekdayCodec.inputToProto[schedule.weekday]\n : undefined,\n minuteOfDay: \"minuteOfDay\" in schedule ? schedule.minuteOfDay : undefined,\n minuteOfHour: \"minuteOfHour\" in schedule ? schedule.minuteOfHour : undefined,\n dayOfMonth: \"dayOfMonth\" in schedule ? schedule.dayOfMonth : undefined,\n anchorDate: \"anchorDate\" in schedule ? schedule.anchorDate : undefined,\n })),\n);\n\nexport type AutoWithdrawScheduleInput = v.InferInput<typeof AutoWithdrawScheduleInputSchema>;\n\n/**\n * One asset paid in kind to one whitelisted external-chain address. `minAmount` and\n * `maxAmount` are decimal asset amounts (up to 18 decimals); a run pays the balance up to\n * `maxAmount` once it reaches `minAmount`.\n */\nconst AutoWithdrawDestinationInputSchema = v.pipe(\n v.strictObject({\n assetId: PositiveUint32InputSchema,\n destinationChainId: v.pipe(\n v.number(),\n v.integer(),\n v.gtValue(0),\n v.maxValue(Number.MAX_SAFE_INTEGER),\n ),\n destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n minAmount: v.string(),\n maxAmount: v.string(),\n }),\n v.transform(({ minAmount, maxAmount, destinationChainId, ...destination }) => {\n const min = decimalToE18(\"minAmount\", minAmount);\n const max = decimalToE18(\"maxAmount\", maxAmount);\n if (max === 0n || max < min) {\n throw new ValidationError(\n `maxAmount must be greater than 0 and at least minAmount: ${maxAmount}`,\n );\n }\n return {\n ...destination,\n destinationChainId: BigInt(destinationChainId),\n minAmountE18: toU128(min),\n maxAmountE18: toU128(max),\n };\n }),\n);\n\nexport type AutoWithdrawDestinationInput = v.InferInput<typeof AutoWithdrawDestinationInputSchema>;\n\nexport const SetAutoWithdrawRuleInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The version this change replaces: 0 when the account has no rule yet. */\n expectedVersion: Uint32InputSchema,\n schedule: AutoWithdrawScheduleInputSchema,\n destinations: v.pipe(\n v.array(AutoWithdrawDestinationInputSchema),\n v.minLength(1, \"At least one destination is required.\"),\n v.maxLength(32, \"At most 32 destinations are allowed.\"),\n v.check(\n (destinations) =>\n new Set(destinations.map((d) => d.assetId)).size === destinations.length,\n \"At most one destination per asset is allowed.\",\n ),\n ),\n /** Least USD value one payout pays, as a decimal; omit or null for no USD minimum. */\n minUsdValue: v.optional(v.nullable(v.string())),\n }),\n v.transform(({ account, minUsdValue, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n minUsdValueE18:\n minUsdValue == null ? undefined : toU128(decimalToE18(\"minUsdValue\", minUsdValue)),\n })),\n);\n\nexport type SetAutoWithdrawRuleInput = v.InferInput<typeof SetAutoWithdrawRuleInputSchema>;\n\nexport const SetAutoWithdrawRuleEnabledInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The account's latest rule version. */\n expectedVersion: Uint32InputSchema,\n /** `false` pauses the rule; `true` resumes it. */\n enabled: v.boolean(),\n }),\n v.transform(({ account, expectedVersion, enabled }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n expectedVersion,\n enabled,\n })),\n);\n\nexport type SetAutoWithdrawRuleEnabledInput = v.InferInput<\n typeof SetAutoWithdrawRuleEnabledInputSchema\n>;\n\n/** `limit` is 0 through 100; 0 or omitted uses the server default of 20. */\nexport const ListAutoWithdrawRunsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), 0),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListAutoWithdrawRunsInput = v.InferInput<typeof ListAutoWithdrawRunsInputSchema>;\n\ntype ScheduleShape<Weekday> =\n | { cadence: \"hourly\"; minuteOfHour: number }\n | { cadence: \"daily\"; minuteOfDay: number }\n | { cadence: \"weekly\"; weekday: Weekday; minuteOfDay: number }\n | { cadence: \"biweekly\"; weekday: Weekday; minuteOfDay: number; anchorDate: string }\n | { cadence: \"monthly\"; dayOfMonth: number; minuteOfDay: number };\n\n/** A decoded schedule. A cadence this SDK build does not know decodes as `\"unspecified\"`. */\nexport type AutoWithdrawSchedule =\n | ScheduleShape<DecodedEnum<AutoWithdrawWeekday>>\n | { cadence: \"unspecified\" };\n\nconst AutoWithdrawScheduleSchema = v.pipe(\n v.object({\n cadence: v.optional(v.number(), 0),\n weekday: v.optional(v.number(), 0),\n minuteOfDay: v.optional(v.number(), 0),\n minuteOfHour: v.optional(v.number(), 0),\n dayOfMonth: v.optional(v.number(), 0),\n anchorDate: v.optional(v.string(), \"\"),\n }),\n v.transform((s): AutoWithdrawSchedule => {\n const weekday = enumLabel(AutoWithdrawWeekdayCodec.protoToOutput, s.weekday);\n const { minuteOfDay } = s;\n switch (s.cadence) {\n case Proto.AutoWithdrawCadence.HOURLY:\n return { cadence: \"hourly\", minuteOfHour: s.minuteOfHour };\n case Proto.AutoWithdrawCadence.DAILY:\n return { cadence: \"daily\", minuteOfDay };\n case Proto.AutoWithdrawCadence.WEEKLY:\n return { cadence: \"weekly\", weekday, minuteOfDay };\n case Proto.AutoWithdrawCadence.BIWEEKLY:\n return { cadence: \"biweekly\", weekday, minuteOfDay, anchorDate: s.anchorDate };\n case Proto.AutoWithdrawCadence.MONTHLY:\n return { cadence: \"monthly\", dayOfMonth: s.dayOfMonth, minuteOfDay };\n default:\n return { cadence: \"unspecified\" };\n }\n }),\n);\n\nfunction reasonSchema<TReason extends string>() {\n return v.pipe(\n v.optional(v.string(), \"\"),\n v.transform((reason) => (reason ? (reason as TReason) : null)),\n );\n}\n\nconst AutoWithdrawDestinationSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n minAmountE18: v.optional(U128Schema),\n maxAmountE18: v.optional(U128Schema),\n minFloorE18: v.optional(U128Schema),\n }),\n v.transform(\n ({ minAmountE18, maxAmountE18, minFloorE18, destinationChainId, ...destination }) => ({\n ...destination,\n destinationChainId: Number(destinationChainId),\n minAmount: e18ToDecimal(minAmountE18),\n maxAmount: e18ToDecimal(maxAmountE18),\n minFloor: optionalE18ToDecimal(minFloorE18),\n }),\n ),\n);\n\n/**\n * `minFloor` is the least one payout to the destination can pay now (the route's withdrawal\n * minimum, above its current network fee); a new rule's `minAmount` must be at least this\n * floor. It follows the network fee, and is null when the route or fee is unknown: show no\n * floor then, not zero.\n */\nexport type AutoWithdrawDestination = v.InferOutput<typeof AutoWithdrawDestinationSchema>;\n\nconst AutoWithdrawPauseSchema = v.object({\n assetId: v.number(),\n reason: v.pipe(\n v.string(),\n v.transform((reason) => reason as AutoWithdrawPauseReason),\n ),\n pausedAt: TimestampMsSchema,\n});\n\nexport type AutoWithdrawPause = v.InferOutput<typeof AutoWithdrawPauseSchema>;\n\nexport const AutoWithdrawRuleSchema = v.pipe(\n v.object({\n subaccountId: v.optional(PublicIdOrEmptySchema, 0n),\n version: v.number(),\n enabled: v.boolean(),\n schedule: v.optional(AutoWithdrawScheduleSchema),\n destinations: v.array(AutoWithdrawDestinationSchema),\n createdAt: TimestampMsSchema,\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n createdByAccountId: v.optional(PublicIdOrEmptySchema, 0n),\n }),\n v.transform(({ schedule, pause, minUsdValueE18, ...rule }) => ({\n ...rule,\n schedule: schedule ?? ({ cadence: \"unspecified\" } as AutoWithdrawSchedule),\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * One version of an account's rule. `subaccountId` is the public subaccount ID, `\"\"` for the\n * root account; `createdByAccountId` is the public account ID of whoever created the version.\n * Times are epoch milliseconds. `minUsdValue` is null when the rule has no USD minimum. A paused\n * version (`enabled: false`) keeps its schedule and destinations. `pause` is set when the rule\n * paused itself; resuming it or setting a new rule clears it. The rule runs only while\n * `enabled` is true and `pause` is null.\n */\nexport type AutoWithdrawRule = v.InferOutput<typeof AutoWithdrawRuleSchema>;\n\nconst AutoWithdrawStepSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n availableE18: v.optional(U128Schema),\n amountE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n networkFeeE18: v.optional(U128Schema),\n state: enumLabelSchema(AutoWithdrawStepStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawStepReason>(),\n intentId: v.optional(v.string(), \"\"),\n txHash: v.optional(v.string(), \"\"),\n }),\n v.transform(\n ({\n availableE18,\n amountE18,\n valueUsdE18,\n networkFeeE18,\n destinationChainId,\n intentId,\n txHash,\n ...step\n }) => ({\n ...step,\n destinationChainId: Number(destinationChainId),\n available: e18ToDecimal(availableE18),\n amount: e18ToDecimal(amountE18),\n valueUsd: valueUsdE18 ? e18ToDecimal(valueUsdE18) : null,\n networkFee: optionalE18ToDecimal(networkFeeE18),\n intentId: intentId || null,\n txHash: txHash || null,\n }),\n ),\n);\n\n/**\n * One asset's payout in a run. `available`, `amount` and `valueUsd` are decimal strings;\n * `valueUsd` is null when the rule has no USD minimum or no price was available. `networkFee`\n * is the fee charged on the withdrawal: once completed it was taken out of `amount`; once\n * rejected or failed it is the fee kept, not refunded. It is null until the step is final, when\n * the step never reached the withdrawal, or when the fee was not reported.\n */\nexport type AutoWithdrawStep = v.InferOutput<typeof AutoWithdrawStepSchema>;\n\nconst AutoWithdrawRunSchema = v.pipe(\n v.object({\n runSeq: BigIntStringSchema,\n ruleVersion: v.number(),\n scheduledFor: TimestampMsSchema,\n state: enumLabelSchema(AutoWithdrawRunStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawRunReason>(),\n steps: v.array(AutoWithdrawStepSchema),\n createdAt: TimestampMsSchema,\n finishedAt: OptionalTimestampMsSchema,\n }),\n v.transform(({ finishedAt, ...run }) => ({ ...run, finishedAt: finishedAt ?? null })),\n);\n\n/** One scheduled run. Times are epoch milliseconds; `finishedAt` is null while in progress. */\nexport type AutoWithdrawRun = v.InferOutput<typeof AutoWithdrawRunSchema>;\n\nexport const ListAutoWithdrawRunsResultSchema = v.object({\n runs: v.array(AutoWithdrawRunSchema),\n nextPageToken: v.optional(v.string(), \"\"),\n});\n\n/** One page of runs, newest first. An empty `nextPageToken` means no more runs. */\nexport type ListAutoWithdrawRunsResult = v.InferOutput<typeof ListAutoWithdrawRunsResultSchema>;\n\nconst AutoWithdrawPreviewAssetSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.optional(v.bigint(), 0n),\n destinationAddress: v.optional(v.string(), \"\"),\n availableE18: v.optional(U128Schema),\n payableE18: v.optional(U128Schema),\n heldBackE18: v.optional(U128Schema),\n holdReason: reasonSchema<AutoWithdrawHoldReason>(),\n minimumE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n pricedAt: OptionalTimestampMsSchema,\n networkFeeE18: v.optional(U128Schema),\n networkFeeSampledAt: OptionalTimestampMsSchema,\n payableFrom: OptionalTimestampMsSchema,\n }),\n v.transform((asset) => ({\n assetId: asset.assetId,\n destinationChainId:\n asset.destinationChainId === 0n ? null : Number(asset.destinationChainId),\n destinationAddress: asset.destinationAddress || null,\n available: e18ToDecimal(asset.availableE18),\n payable: e18ToDecimal(asset.payableE18),\n heldBack: e18ToDecimal(asset.heldBackE18),\n holdReason: asset.holdReason,\n minimum: optionalE18ToDecimal(asset.minimumE18),\n valueUsd: optionalE18ToDecimal(asset.valueUsdE18),\n pricedAt: asset.pricedAt ?? null,\n networkFee: optionalE18ToDecimal(asset.networkFeeE18),\n networkFeeSampledAt: asset.networkFeeSampledAt ?? null,\n payableFrom: asset.payableFrom ?? null,\n })),\n);\n\n/**\n * What the next run would do with one asset, sized from the balance now. Amounts are decimal\n * strings; `heldBack` is `available` minus `payable`, and `holdReason` says why it stays (null\n * when the whole balance pays). `destinationChainId` and `destinationAddress` are null for an\n * asset the rule pays nowhere. `minimum`, `valueUsd`, `networkFee` and their times are null\n * when unknown, never zero. `payableFrom` is set only while a broker vault's destination cools\n * down. Times are epoch milliseconds.\n */\nexport type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;\n\nexport const AutoWithdrawPreviewSchema = v.pipe(\n v.object({\n status: enumLabelSchema(AutoWithdrawPreviewStatusCodec.protoToOutput),\n nextRunAt: OptionalTimestampMsSchema,\n ruleVersion: v.optional(v.number(), 0),\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n assets: v.array(AutoWithdrawPreviewAssetSchema),\n computedAt: TimestampMsSchema,\n }),\n v.transform(({ nextRunAt, pause, minUsdValueE18, ...preview }) => ({\n ...preview,\n nextRunAt: nextRunAt ?? null,\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * The account's next run as it would go now; balances, prices and fees can change before\n * `nextRunAt`. `nextRunAt` is null without a rule or while it is paused; `ruleVersion` is 0\n * without a rule. `pause` is set only when the rule paused itself. `minUsdValue` is null when\n * there is no USD minimum. Times are epoch milliseconds.\n */\nexport type AutoWithdrawPreview = v.InferOutput<typeof AutoWithdrawPreviewSchema>;\n"],"mappings":";;;;;;;;;;;;AAsCA,MAAM,YAAY,MAAM,QAAQ;;AAGhC,SAAS,aAAa,OAAe,OAAuB;CACxD,MAAM,SAAS,qBAAqB,OAAO,OAAA,EAAgB;CAC3D,IAAI,SAAS,UACT,MAAM,IAAI,gBAAgB,GAAG,MAAM,wCAAwC,OAAO;CAEtF,OAAO;AACX;AAEA,SAAS,aAAa,OAA6D;CAC/E,OAAO,sBAAsB,SAAS,KAAK,GAAA,EAAY;AAC3D;;AAGA,SAAS,qBAAqB,OAAoE;CAC9F,OAAO,QAAQ,aAAa,KAAK,IAAI;AACzC;AAEA,MAAM,2BAA2B,EAAE,aAAa,EAAE,GAAG,yBAAyB,CAAC;AAI/E,MAAa,gCAAgC,EAAE,KAC3C,0BACA,EAAE,WAAW,EAAE,eAAe,EAAE,cAAc,2BAA2B,OAAO,EAAE,EAAE,CACxF;AAEA,MAAM,oBAAoB,EAAE,KACxB,EAAE,OAAO,GACT,EAAE,QAAQ,GACV,EAAE,SAAS,CAAC,GACZ,EAAE,SAAS,mBAAmB,CAClC;AACA,MAAM,oBAAoB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC;AACzF,MAAM,qBAAqB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC;AACxF,MAAM,mBAAmB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,EAAE,CAAC;AACtF,MAAM,gBAAgB,EAAE,SAAS,4BAA4B;AAC7D,MAAM,mBA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RunReason, AutoWithdrawRunState, AutoWithdrawStepReason, AutoWithdrawStepState, AutoWithdrawWeekday } from "./auto-withdraw.codecs.js";
|
|
2
|
-
import { AutoWithdrawDestination, AutoWithdrawDestinationInput, AutoWithdrawPause, AutoWithdrawRule, AutoWithdrawRun, AutoWithdrawSchedule, AutoWithdrawScheduleInput, AutoWithdrawScopedInput, AutoWithdrawStep,
|
|
3
|
-
export type { AutoWithdrawCadence, AutoWithdrawDestination, AutoWithdrawDestinationInput, AutoWithdrawPause, AutoWithdrawPauseReason, AutoWithdrawRule, AutoWithdrawRun, AutoWithdrawRunReason, AutoWithdrawRunState, AutoWithdrawSchedule, AutoWithdrawScheduleInput, AutoWithdrawScopedInput, AutoWithdrawStep, AutoWithdrawStepReason, AutoWithdrawStepState, AutoWithdrawWeekday,
|
|
1
|
+
import { AutoWithdrawCadence, AutoWithdrawHoldReason, AutoWithdrawPauseReason, AutoWithdrawPreviewStatus, AutoWithdrawRunReason, AutoWithdrawRunState, AutoWithdrawStepReason, AutoWithdrawStepState, AutoWithdrawWeekday } from "./auto-withdraw.codecs.js";
|
|
2
|
+
import { AutoWithdrawDestination, AutoWithdrawDestinationInput, AutoWithdrawPause, AutoWithdrawPreview, AutoWithdrawPreviewAsset, AutoWithdrawRule, AutoWithdrawRun, AutoWithdrawSchedule, AutoWithdrawScheduleInput, AutoWithdrawScopedInput, AutoWithdrawStep, ListAutoWithdrawRunsInput, ListAutoWithdrawRunsResult, SetAutoWithdrawRuleEnabledInput, SetAutoWithdrawRuleInput } from "./auto-withdraw.schemas.js";
|
|
3
|
+
export type { AutoWithdrawCadence, AutoWithdrawDestination, AutoWithdrawDestinationInput, AutoWithdrawHoldReason, AutoWithdrawPause, AutoWithdrawPauseReason, AutoWithdrawPreview, AutoWithdrawPreviewAsset, AutoWithdrawPreviewStatus, AutoWithdrawRule, AutoWithdrawRun, AutoWithdrawRunReason, AutoWithdrawRunState, AutoWithdrawSchedule, AutoWithdrawScheduleInput, AutoWithdrawScopedInput, AutoWithdrawStep, AutoWithdrawStepReason, AutoWithdrawStepState, AutoWithdrawWeekday, ListAutoWithdrawRunsInput, ListAutoWithdrawRunsResult, SetAutoWithdrawRuleEnabledInput, SetAutoWithdrawRuleInput };
|
|
@@ -31,7 +31,7 @@ declare const ListChangelogChangesInputSchema: v.SchemaWithPipe<readonly [v.Stri
|
|
|
31
31
|
}, undefined>, v.CheckAction<{
|
|
32
32
|
categories: ("breaking_change" | "new_feature" | "improvement" | "bug_fix")[];
|
|
33
33
|
actionRequired?: boolean | undefined;
|
|
34
|
-
surfaces: ("
|
|
34
|
+
surfaces: ("trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards")[];
|
|
35
35
|
audiences: ("all_users" | "traders" | "market_makers" | "developers")[];
|
|
36
36
|
startTime?: number | undefined;
|
|
37
37
|
endTime?: number | undefined;
|
|
@@ -42,7 +42,7 @@ declare const ListChangelogChangesInputSchema: v.SchemaWithPipe<readonly [v.Stri
|
|
|
42
42
|
}, "endTime: must be after startTime">, v.TransformAction<{
|
|
43
43
|
categories: ("breaking_change" | "new_feature" | "improvement" | "bug_fix")[];
|
|
44
44
|
actionRequired?: boolean | undefined;
|
|
45
|
-
surfaces: ("
|
|
45
|
+
surfaces: ("trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards")[];
|
|
46
46
|
audiences: ("all_users" | "traders" | "market_makers" | "developers")[];
|
|
47
47
|
startTime?: number | undefined;
|
|
48
48
|
endTime?: number | undefined;
|
|
@@ -73,14 +73,14 @@ declare const ChangelogChangeSchema: v.ObjectSchema<{
|
|
|
73
73
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
74
74
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
75
75
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
76
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
76
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards">]>, undefined>, readonly []>;
|
|
77
77
|
}, undefined>;
|
|
78
78
|
type ChangelogChange = v.InferOutput<typeof ChangelogChangeSchema>;
|
|
79
79
|
/** `surface` is the product area the section covers, `"unspecified"` when it spans several. */
|
|
80
80
|
declare const ChangelogSectionSchema: v.ObjectSchema<{
|
|
81
81
|
readonly heading: v.StringSchema<undefined>;
|
|
82
82
|
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
83
|
-
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
83
|
+
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards">]>;
|
|
84
84
|
readonly changes: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
85
85
|
readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
86
86
|
readonly title: v.StringSchema<undefined>;
|
|
@@ -90,7 +90,7 @@ declare const ChangelogSectionSchema: v.ObjectSchema<{
|
|
|
90
90
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
91
91
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
92
92
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
93
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
93
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards">]>, undefined>, readonly []>;
|
|
94
94
|
}, undefined>, undefined>, readonly []>;
|
|
95
95
|
}, undefined>;
|
|
96
96
|
type ChangelogSection = v.InferOutput<typeof ChangelogSectionSchema>;
|
|
@@ -209,7 +209,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
209
209
|
readonly sections: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
210
210
|
readonly heading: v.StringSchema<undefined>;
|
|
211
211
|
readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
212
|
-
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
212
|
+
readonly surface: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards">]>;
|
|
213
213
|
readonly changes: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
214
214
|
readonly id: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
215
215
|
readonly title: v.StringSchema<undefined>;
|
|
@@ -219,7 +219,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
219
219
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
220
220
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
221
221
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
222
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
222
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards">]>, undefined>, readonly []>;
|
|
223
223
|
}, undefined>, undefined>, readonly []>;
|
|
224
224
|
}, undefined>, undefined>, readonly []>;
|
|
225
225
|
}, undefined>, v.TransformAction<{
|
|
@@ -241,7 +241,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
241
241
|
sections: {
|
|
242
242
|
heading: string;
|
|
243
243
|
summary?: string | undefined;
|
|
244
|
-
surface: "unspecified" | "
|
|
244
|
+
surface: "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards";
|
|
245
245
|
changes: {
|
|
246
246
|
id: string;
|
|
247
247
|
title: string;
|
|
@@ -251,14 +251,14 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
251
251
|
actionRequired: boolean;
|
|
252
252
|
migrationGuidance?: string | undefined;
|
|
253
253
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
254
|
-
surfaces: ("unspecified" | "
|
|
254
|
+
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards")[];
|
|
255
255
|
}[];
|
|
256
256
|
}[];
|
|
257
257
|
}, {
|
|
258
258
|
sections: {
|
|
259
259
|
heading: string;
|
|
260
260
|
summary?: string | undefined;
|
|
261
|
-
surface: "unspecified" | "
|
|
261
|
+
surface: "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards";
|
|
262
262
|
changes: {
|
|
263
263
|
id: string;
|
|
264
264
|
title: string;
|
|
@@ -268,7 +268,7 @@ declare const ChangelogPostSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
268
268
|
actionRequired: boolean;
|
|
269
269
|
migrationGuidance?: string | undefined;
|
|
270
270
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
271
|
-
surfaces: ("unspecified" | "
|
|
271
|
+
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards")[];
|
|
272
272
|
}[];
|
|
273
273
|
}[];
|
|
274
274
|
slug: string;
|
|
@@ -296,7 +296,7 @@ declare const ChangelogChangeEntrySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
296
296
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
297
297
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
298
298
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
299
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
299
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards">]>, undefined>, readonly []>;
|
|
300
300
|
}, undefined>;
|
|
301
301
|
readonly postSlug: v.StringSchema<undefined>;
|
|
302
302
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -317,7 +317,7 @@ declare const ChangelogChangeEntrySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
317
317
|
actionRequired: boolean;
|
|
318
318
|
migrationGuidance?: string | undefined;
|
|
319
319
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
320
|
-
surfaces: ("unspecified" | "
|
|
320
|
+
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards")[];
|
|
321
321
|
};
|
|
322
322
|
postSlug: string;
|
|
323
323
|
publishedAt: number;
|
|
@@ -334,7 +334,7 @@ declare const ChangelogChangeEntrySchema: v.SchemaWithPipe<readonly [v.ObjectSch
|
|
|
334
334
|
actionRequired: boolean;
|
|
335
335
|
migrationGuidance?: string | undefined;
|
|
336
336
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
337
|
-
surfaces: ("unspecified" | "
|
|
337
|
+
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards")[];
|
|
338
338
|
}>]>;
|
|
339
339
|
/** A change with the slug, first publication time and section heading of the post that announced it. */
|
|
340
340
|
type ChangelogChangeEntry = v.InferOutput<typeof ChangelogChangeEntrySchema>;
|
|
@@ -349,7 +349,7 @@ declare const ListChangelogChangesResultSchema: v.ObjectSchema<{
|
|
|
349
349
|
readonly actionRequired: v.BooleanSchema<undefined>;
|
|
350
350
|
readonly migrationGuidance: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
351
351
|
readonly audiences: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "all_users" | "traders" | "market_makers" | "developers">]>, undefined>, readonly []>;
|
|
352
|
-
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
352
|
+
readonly surfaces: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards">]>, undefined>, readonly []>;
|
|
353
353
|
}, undefined>;
|
|
354
354
|
readonly postSlug: v.StringSchema<undefined>;
|
|
355
355
|
readonly publishedAt: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -370,7 +370,7 @@ declare const ListChangelogChangesResultSchema: v.ObjectSchema<{
|
|
|
370
370
|
actionRequired: boolean;
|
|
371
371
|
migrationGuidance?: string | undefined;
|
|
372
372
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
373
|
-
surfaces: ("unspecified" | "
|
|
373
|
+
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards")[];
|
|
374
374
|
};
|
|
375
375
|
postSlug: string;
|
|
376
376
|
publishedAt: number;
|
|
@@ -387,7 +387,7 @@ declare const ListChangelogChangesResultSchema: v.ObjectSchema<{
|
|
|
387
387
|
actionRequired: boolean;
|
|
388
388
|
migrationGuidance?: string | undefined;
|
|
389
389
|
audiences: ("unspecified" | "all_users" | "traders" | "market_makers" | "developers")[];
|
|
390
|
-
surfaces: ("unspecified" | "
|
|
390
|
+
surfaces: ("unspecified" | "trading" | "funding" | "accounts" | "api" | "explorer" | "documentation" | "platform" | "market_data" | "quickswap" | "rewards")[];
|
|
391
391
|
}>]>, undefined>, readonly []>;
|
|
392
392
|
readonly nextPageToken: v.StringSchema<undefined>;
|
|
393
393
|
}, undefined>;
|
|
@@ -49,7 +49,7 @@ declare const CheckpointBiggestTradeSchema: v.SchemaWithPipe<readonly [v.ObjectS
|
|
|
49
49
|
side: number;
|
|
50
50
|
at: number;
|
|
51
51
|
}, {
|
|
52
|
-
side: "
|
|
52
|
+
side: "buy" | "sell" | "unspecified";
|
|
53
53
|
symbolId: number;
|
|
54
54
|
symbol: string;
|
|
55
55
|
at: number;
|
|
@@ -229,7 +229,7 @@ declare const CheckpointSchema: v.ObjectSchema<{
|
|
|
229
229
|
side: number;
|
|
230
230
|
at: number;
|
|
231
231
|
}, {
|
|
232
|
-
side: "
|
|
232
|
+
side: "buy" | "sell" | "unspecified";
|
|
233
233
|
symbolId: number;
|
|
234
234
|
symbol: string;
|
|
235
235
|
at: number;
|
|
@@ -4,7 +4,8 @@ import { ClaimDailyRewardInput, ClaimDailyRewardResult, DailyClaimStatus } from
|
|
|
4
4
|
//#region src/services/claims/claims.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Reads and claims daily campaign rewards for the authenticated root account or a subaccount it owns.
|
|
7
|
-
*
|
|
7
|
+
* Calls accept a session JWT, or an API key scoped to the main account whose policy grants
|
|
8
|
+
* `read-daily-claims` (status) or `claim-daily-reward` (claim).
|
|
8
9
|
*/
|
|
9
10
|
declare class ClaimsService {
|
|
10
11
|
#private;
|
|
@@ -18,7 +19,9 @@ declare class ClaimsService {
|
|
|
18
19
|
/**
|
|
19
20
|
* Claims the current UTC day's reward, paid to the root account or to `subaccountId` when it
|
|
20
21
|
* names a subaccount the root account owns. The destination is fixed by the first claim of the
|
|
21
|
-
* day; retrying returns the same claim and destination.
|
|
22
|
+
* day; retrying returns the same claim and destination. A `ClaimOutcomeUnknownError` means the
|
|
23
|
+
* claim is recorded and its payout submitted but not yet confirmed: show it as pending, then
|
|
24
|
+
* poll `getDailyClaimStatus` until its `claimId` is `claimed`, or retry this call.
|
|
22
25
|
*/
|
|
23
26
|
claimDailyReward(input?: ClaimDailyRewardInput, options?: PolyesterMutationOptions): Promise<ClaimDailyRewardResult>;
|
|
24
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claims.d.ts","names":[],"sources":["../../../src/services/claims/claims.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"claims.d.ts","names":[],"sources":["../../../src/services/claims/claims.ts"],"mappings":";;;;;;;;;cAuBa;;EAGG,YAAA,YAAY;;;;;;EASlB,oBAAoB,UAAU,0BAA0B,QAAQ;;;;;;;;EAYhE,iBACF,QAAO,uBACP,UAAU,2BACX,QAAQ"}
|
|
@@ -6,7 +6,8 @@ import { createClient } from "@connectrpc/connect";
|
|
|
6
6
|
//#region src/services/claims/claims.ts
|
|
7
7
|
/**
|
|
8
8
|
* Reads and claims daily campaign rewards for the authenticated root account or a subaccount it owns.
|
|
9
|
-
*
|
|
9
|
+
* Calls accept a session JWT, or an API key scoped to the main account whose policy grants
|
|
10
|
+
* `read-daily-claims` (status) or `claim-daily-reward` (claim).
|
|
10
11
|
*/
|
|
11
12
|
var ClaimsService = class {
|
|
12
13
|
#client;
|
|
@@ -25,7 +26,9 @@ var ClaimsService = class {
|
|
|
25
26
|
/**
|
|
26
27
|
* Claims the current UTC day's reward, paid to the root account or to `subaccountId` when it
|
|
27
28
|
* names a subaccount the root account owns. The destination is fixed by the first claim of the
|
|
28
|
-
* day; retrying returns the same claim and destination.
|
|
29
|
+
* day; retrying returns the same claim and destination. A `ClaimOutcomeUnknownError` means the
|
|
30
|
+
* claim is recorded and its payout submitted but not yet confirmed: show it as pending, then
|
|
31
|
+
* poll `getDailyClaimStatus` until its `claimId` is `claimed`, or retry this call.
|
|
29
32
|
*/
|
|
30
33
|
async claimDailyReward(input = {}, options) {
|
|
31
34
|
const { subaccountId } = parse(ClaimDailyRewardInputSchema, input);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"claims.js","names":["#client","Proto.ClaimsService"],"sources":["../../../src/services/claims/claims.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/claims/v1/claims_pb.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n ClaimDailyRewardInputSchema,\n ClaimDailyRewardResultSchema,\n DailyClaimStatusSchema,\n type ClaimDailyRewardInput,\n type ClaimDailyRewardResult,\n type DailyClaimStatus,\n} from \"./claims.schemas.js\";\n\n/**\n * Reads and claims daily campaign rewards for the authenticated root account or a subaccount it owns.\n *
|
|
1
|
+
{"version":3,"file":"claims.js","names":["#client","Proto.ClaimsService"],"sources":["../../../src/services/claims/claims.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/claims/v1/claims_pb.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n ClaimDailyRewardInputSchema,\n ClaimDailyRewardResultSchema,\n DailyClaimStatusSchema,\n type ClaimDailyRewardInput,\n type ClaimDailyRewardResult,\n type DailyClaimStatus,\n} from \"./claims.schemas.js\";\n\n/**\n * Reads and claims daily campaign rewards for the authenticated root account or a subaccount it owns.\n * Calls accept a session JWT, or an API key scoped to the main account whose policy grants\n * `read-daily-claims` (status) or `claim-daily-reward` (claim).\n */\nexport class ClaimsService {\n #client: Client<typeof Proto.ClaimsService>;\n\n constructor(transports: AuthApiTransports) {\n this.#client = createClient(Proto.ClaimsService, transports.authApi);\n }\n\n /**\n * Returns the current UTC day's available or existing claim and its reset time. A\n * `payout_delayed` claim is recorded and paid automatically once payouts resume;\n * `payoutDelayReason` names the cause, such as `CLAIM_PAYOUT_UNAVAILABLE`.\n */\n async getDailyClaimStatus(options?: PolyesterRequestOptions): Promise<DailyClaimStatus> {\n const response = await this.#client.getDailyClaimStatus({}, toConnectCallOptions(options));\n return parse(DailyClaimStatusSchema, response);\n }\n\n /**\n * Claims the current UTC day's reward, paid to the root account or to `subaccountId` when it\n * names a subaccount the root account owns. The destination is fixed by the first claim of the\n * day; retrying returns the same claim and destination. A `ClaimOutcomeUnknownError` means the\n * claim is recorded and its payout submitted but not yet confirmed: show it as pending, then\n * poll `getDailyClaimStatus` until its `claimId` is `claimed`, or retry this call.\n */\n async claimDailyReward(\n input: ClaimDailyRewardInput = {},\n options?: PolyesterMutationOptions,\n ): Promise<ClaimDailyRewardResult> {\n const { subaccountId } = parse(ClaimDailyRewardInputSchema, input);\n const response = await this.#client.claimDailyReward(\n { subaccountId },\n toConnectCallOptions(options),\n );\n return parse(ClaimDailyRewardResultSchema, response);\n }\n}\n"],"mappings":";;;;;;;;;;;AAuBA,IAAa,gBAAb,MAA2B;CACvB;CAEA,YAAY,YAA+B;EACvC,KAAKA,UAAU,aAAaC,iBAAqB,WAAW,OAAO;CACvE;;;;;;CAOA,MAAM,oBAAoB,SAA8D;EACpF,MAAM,WAAW,MAAM,KAAKD,QAAQ,oBAAoB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACzF,OAAO,MAAM,wBAAwB,QAAQ;CACjD;;;;;;;;CASA,MAAM,iBACF,QAA+B,CAAC,GAChC,SAC+B;EAC/B,MAAM,EAAE,iBAAiB,MAAM,6BAA6B,KAAK;EACjE,MAAM,WAAW,MAAM,KAAKA,QAAQ,iBAChC,EAAE,aAAa,GACf,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,8BAA8B,QAAQ;CACvD;AACJ"}
|
|
@@ -14,7 +14,7 @@ type TimestampInit = {
|
|
|
14
14
|
declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
15
15
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
16
16
|
readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1s" | "1m" | "5m" | "1h", HeatmapInterval>]>;
|
|
17
|
-
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 5 | 10 | 20 | 100 | 500 |
|
|
17
|
+
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 5 | 10 | 20 | 100 | 500 | 1000 | 200 | 50, HeatmapDepth>]>;
|
|
18
18
|
readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
|
|
19
19
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>;
|
|
20
20
|
readonly startTsSec: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
|
|
@@ -227,7 +227,7 @@ type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
|
|
|
227
227
|
declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
228
228
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
229
229
|
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
|
|
230
|
-
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 |
|
|
230
|
+
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 | 5 | 10 | 20 | "unspecified" | 100 | 500 | 1000 | 200 | 50>]>;
|
|
231
231
|
readonly chain: v.OptionalSchema<v.ObjectSchema<{
|
|
232
232
|
readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
|
|
233
233
|
readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
@@ -287,7 +287,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
287
287
|
}, undefined>, v.TransformAction<{
|
|
288
288
|
symbolId: number;
|
|
289
289
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
290
|
-
depth: 1 |
|
|
290
|
+
depth: 1 | 5 | 10 | 20 | "unspecified" | 100 | 500 | 1000 | 200 | 50;
|
|
291
291
|
chain?: {
|
|
292
292
|
baseKeyframe?: {
|
|
293
293
|
tsSec: number;
|
|
@@ -347,7 +347,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
347
347
|
}, {
|
|
348
348
|
symbolId: number;
|
|
349
349
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
350
|
-
depth: 1 |
|
|
350
|
+
depth: 1 | 5 | 10 | 20 | "unspecified" | 100 | 500 | 1000 | 200 | 50;
|
|
351
351
|
chain: {
|
|
352
352
|
baseKeyframe: {
|
|
353
353
|
tsSec: number;
|
|
@@ -1,19 +1,28 @@
|
|
|
1
1
|
import { AuthApiTransports } from "../../shared/transports.js";
|
|
2
|
-
import { PolyesterMutationOptions } from "../../shared/request-options.js";
|
|
2
|
+
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
3
|
import { SubaccountResolver } from "../subaccount-resolver.js";
|
|
4
4
|
import { SdkScales } from "../../shared/decimal-surface.js";
|
|
5
|
-
import { CreateInternalTransferInput, CreateInternalTransferResult } from "./internal-transfers.schemas.js";
|
|
5
|
+
import { CreateInternalTransferInput, CreateInternalTransferResult, GetInternalTransferInput, GetInternalTransferResult } from "./internal-transfers.schemas.js";
|
|
6
6
|
//#region src/services/internal-transfers/internal-transfers.d.ts
|
|
7
7
|
/**
|
|
8
|
-
* Creates authenticated Trading-to-Trading internal transfer requests.
|
|
8
|
+
* Creates and reads authenticated Trading-to-Trading internal transfer requests.
|
|
9
9
|
*/
|
|
10
10
|
declare class InternalTransfersService {
|
|
11
11
|
#private;
|
|
12
12
|
constructor(transports: AuthApiTransports, resolver: SubaccountResolver | undefined, scales: SdkScales);
|
|
13
13
|
/**
|
|
14
|
-
* Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.
|
|
14
|
+
* Creates or returns an idempotent internal transfer from the resolved source account to a destination root account, subaccount, or smart-account address. The request carries asset id, a decimal quantity, and a stable idempotency key; the response includes request/transfer ids, the lifecycle `flowId`, resolved destination, and status. Rejections and failures, such as insufficient funds or a missing step-up, raise errors instead of returning a result.
|
|
15
15
|
*/
|
|
16
16
|
create(input: CreateInternalTransferInput, options?: PolyesterMutationOptions): Promise<CreateInternalTransferResult>;
|
|
17
|
+
/**
|
|
18
|
+
* Reads an accepted transfer of the resolved source account by exactly one of `requestId` or
|
|
19
|
+
* `transferId`, and returns both IDs, the lifecycle `flowId` and the acceptance time. Use it
|
|
20
|
+
* to reconcile a transfer without resubmitting it; pass `flowId` to `lifecycle.getFlow`,
|
|
21
|
+
* whose ledger settlement step carries the transfer ID. An unknown, pending or inaccessible
|
|
22
|
+
* transfer is a `ResourceNotFoundError`, including briefly after a delegate is granted access.
|
|
23
|
+
* Session JWT only; API keys are refused. Moves no money and needs no step-up.
|
|
24
|
+
*/
|
|
25
|
+
get(input: GetInternalTransferInput, options?: PolyesterRequestOptions): Promise<GetInternalTransferResult>;
|
|
17
26
|
}
|
|
18
27
|
//#endregion
|
|
19
28
|
export { InternalTransfersService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-transfers.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"internal-transfers.d.ts","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.ts"],"mappings":";;;;;;;;;cA0Ba;;EAQL,YAAA,YAAY,mBACZ,UAAU,gCACV,QAAQ;;;;EAYN,OACF,OAAO,6BACP,UAAU,2BACX,QAAQ;;;;;;;;;EAmBL,IACF,OAAO,0BACP,UAAU,0BACX,QAAQ"}
|