@polyester/sdk 0.36.0-devnet-20261119195411 → 0.36.0-devnet-20261120040128
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 +18 -2
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +56 -4
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.js +9 -2
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -1
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +1 -1
- package/dist/gen/auth/v1/account_scope_pb.d.ts +40 -0
- package/dist/gen/auth/v1/account_scope_pb.d.ts.map +1 -0
- package/dist/gen/auth/v1/account_scope_pb.js +46 -0
- package/dist/gen/auth/v1/account_scope_pb.js.map +1 -0
- package/dist/gen/auth/v1/activity_pb.d.ts +1 -1
- package/dist/gen/auth/v1/address_book_pb.d.ts +4 -32
- package/dist/gen/auth/v1/address_book_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.js +8 -38
- package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +16 -15
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +16 -15
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/connected_apps_pb.d.ts +60 -59
- package/dist/gen/auth/v1/connected_apps_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/connected_apps_pb.js +38 -37
- package/dist/gen/auth/v1/connected_apps_pb.js.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.d.ts +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +28 -2
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +27 -1
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +1 -1
- package/dist/gen/auth/v1/resolve_pb.d.ts +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
- package/dist/gen/chain/analytics/v1/analytics_read_pb.d.ts +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +229 -3
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +32 -8
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/reason_pb.d.ts +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.d.ts +1 -1
- package/dist/gen/changelog/v1/changelog_pb.d.ts +17 -5
- package/dist/gen/changelog/v1/changelog_pb.d.ts.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.d.ts +1 -1
- package/dist/gen/claims/v1/claims_pb.d.ts +1 -1
- package/dist/gen/fees/v1/fees_pb.d.ts +1 -1
- package/dist/gen/index.d.ts +8 -6
- package/dist/gen/index.js +28 -26
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
- package/dist/gen/ledger/read/v1/statement_export_pb.d.ts +1 -1
- package/dist/gen/marketdata/v1/asset_info_pb.d.ts +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.d.ts +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +289 -3
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +115 -2
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +1 -1
- package/dist/gen/notifications/v1/notifications_pb.d.ts +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +79 -26
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +36 -7
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +36 -2
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/polyester/api/v1/request_error_pb.d.ts +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +1 -1
- package/dist/gen/polyester/type/v1/u128_pb.d.ts +1 -1
- package/dist/gen/privatews/v1/private_ws_pb.d.ts +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.d.ts +1 -1
- package/dist/gen/rewards/v1/rewards_pb.d.ts +1 -1
- package/dist/gen/strategies/v1/strategies_pb.d.ts +2928 -0
- package/dist/gen/strategies/v1/strategies_pb.d.ts.map +1 -0
- package/dist/gen/strategies/v1/strategies_pb.js +818 -0
- package/dist/gen/strategies/v1/strategies_pb.js.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +39 -18
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +4 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts +313 -133
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js +31 -26
- package/dist/gen/swap/quickswap/v1/quickswap_explorer_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +29 -14
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +2 -2
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +110 -3
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js +23 -3
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js.map +1 -1
- package/dist/gen/swap/v1/swap_pb.d.ts +1 -1
- package/dist/gen/system/v1/system_pb.d.ts +1 -1
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +1 -1
- package/dist/gen/transfer/v1/dust_conversion_pb.d.ts +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +4 -3
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +62 -12
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +4 -2
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/gen/vip/v1/vip_pb.d.ts +1 -1
- package/dist/index.d.ts +12 -6
- package/dist/services/account-activity/account-activity.js +1 -1
- package/dist/services/account-activity/account-activity.schemas.d.ts +4 -4
- package/dist/services/accounts/accounts.js +1 -1
- package/dist/services/accounts/accounts.schemas.js +1 -1
- package/dist/services/address-book/address-book.codecs.js +1 -0
- package/dist/services/address-book/address-book.codecs.js.map +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +2 -2
- package/dist/services/api-keys/api-keys.schemas.d.ts +6 -6
- package/dist/services/assistant/assistant-events.schemas.d.ts +135 -37
- package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -1
- package/dist/services/assistant/assistant-events.schemas.js +15 -5
- package/dist/services/assistant/assistant-events.schemas.js.map +1 -1
- package/dist/services/assistant/assistant.codecs.d.ts +5 -2
- package/dist/services/assistant/assistant.codecs.d.ts.map +1 -1
- package/dist/services/assistant/assistant.codecs.js +10 -2
- package/dist/services/assistant/assistant.codecs.js.map +1 -1
- package/dist/services/assistant/assistant.js +1 -1
- package/dist/services/assistant/assistant.schemas.d.ts +1 -1
- package/dist/services/auth/auth.js +1 -1
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auth/profile/profile.js +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.js +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +9 -9
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +5 -12
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
- package/dist/services/candles/candles.js +1 -1
- package/dist/services/chain-analytics/chain-analytics.js +1 -1
- package/dist/services/changelog/changelog.js +1 -1
- package/dist/services/checkpoints/checkpoints.js +1 -1
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
- package/dist/services/claims/claims.js +1 -1
- package/dist/services/claims/claims.schemas.d.ts +2 -2
- package/dist/services/claims/claims.schemas.js +1 -1
- package/dist/services/connected-apps/connected-apps.d.ts +4 -4
- package/dist/services/connected-apps/connected-apps.d.ts.map +1 -1
- package/dist/services/connected-apps/connected-apps.js +14 -14
- package/dist/services/connected-apps/connected-apps.js.map +1 -1
- package/dist/services/connected-apps/connected-apps.schemas.d.ts +7 -7
- package/dist/services/connected-apps/connected-apps.schemas.d.ts.map +1 -1
- package/dist/services/connected-apps/connected-apps.schemas.js +10 -10
- package/dist/services/connected-apps/connected-apps.schemas.js.map +1 -1
- package/dist/services/connected-apps/connected-apps.types.d.ts +2 -2
- package/dist/services/deposit/deposit.js +1 -1
- package/dist/services/dust-conversion/dust-conversion.js +1 -1
- package/dist/services/dust-conversion/dust-conversion.schemas.d.ts +8 -8
- package/dist/services/dust-conversion/dust-conversion.schemas.js +1 -1
- package/dist/services/fees/fees.js +1 -1
- package/dist/services/guard-signer/guard-signer.js +1 -1
- package/dist/services/heatmap/heatmap.js +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.js +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +6 -6
- package/dist/services/lifecycle/lifecycle.js +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +13 -13
- package/dist/services/lifecycle/lifecycle.schemas.js +2 -2
- package/dist/services/market-data/market-data.codecs.d.ts +9 -1
- package/dist/services/market-data/market-data.codecs.d.ts.map +1 -1
- package/dist/services/market-data/market-data.codecs.js +14 -1
- package/dist/services/market-data/market-data.codecs.js.map +1 -1
- package/dist/services/market-data/market-data.d.ts +9 -1
- package/dist/services/market-data/market-data.d.ts.map +1 -1
- package/dist/services/market-data/market-data.js +15 -2
- package/dist/services/market-data/market-data.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.d.ts +40 -2
- package/dist/services/market-data/market-data.schemas.d.ts.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +43 -8
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.types.d.ts +3 -3
- package/dist/services/market-overview/market-overview.js +1 -1
- package/dist/services/market-overview/market-overview.schemas.js +1 -1
- package/dist/services/notifications/notifications.js +1 -1
- package/dist/services/notifications/notifications.schemas.d.ts +4 -4
- package/dist/services/orderbook/orderbook.js +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +9 -9
- package/dist/services/orders/order-errors.schemas.js +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +97 -97
- package/dist/services/orders/orders-batch.schemas.js +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +16 -16
- package/dist/services/orders/orders-input.schemas.js +1 -1
- package/dist/services/orders/orders-modify.schemas.js +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +14 -14
- package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-output.schemas.js +1 -1
- package/dist/services/orders/orders-output.schemas.js.map +1 -1
- package/dist/services/orders/orders-risk.schemas.js +2 -2
- package/dist/services/orders/orders.d.ts +5 -0
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +7 -2
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/shared.codecs.js +12 -3
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
- package/dist/services/price-alerts/price-alerts.js +1 -1
- package/dist/services/rate-limits/rate-limits.js +1 -1
- package/dist/services/rewards/rewards.js +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +4 -4
- package/dist/services/social-verification/social-verification.js +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +1 -1
- package/dist/services/statement-exports/statement-exports.js +1 -1
- package/dist/services/statement-exports/statement-exports.schemas.d.ts +6 -6
- package/dist/services/strategies/service.d.ts +8 -0
- package/dist/services/strategies/service.d.ts.map +1 -0
- package/dist/services/strategies/service.js +9 -0
- package/dist/services/strategies/service.js.map +1 -0
- package/dist/services/strategies/strategies.codecs.d.ts +15 -0
- package/dist/services/strategies/strategies.codecs.d.ts.map +1 -0
- package/dist/services/strategies/strategies.codecs.js +50 -0
- package/dist/services/strategies/strategies.codecs.js.map +1 -0
- package/dist/services/strategies/strategies.d.ts +75 -0
- package/dist/services/strategies/strategies.d.ts.map +1 -0
- package/dist/services/strategies/strategies.js +135 -0
- package/dist/services/strategies/strategies.js.map +1 -0
- package/dist/services/strategies/strategies.schemas.d.ts +568 -0
- package/dist/services/strategies/strategies.schemas.d.ts.map +1 -0
- package/dist/services/strategies/strategies.schemas.js +408 -0
- package/dist/services/strategies/strategies.schemas.js.map +1 -0
- package/dist/services/strategies/strategies.types.d.ts +3 -0
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +19 -19
- package/dist/services/swap/service.d.ts +8 -0
- package/dist/services/swap/service.d.ts.map +1 -0
- package/dist/services/swap/service.js +9 -0
- package/dist/services/swap/service.js.map +1 -0
- package/dist/services/swap/swap.codecs.d.ts +19 -0
- package/dist/services/swap/swap.codecs.d.ts.map +1 -0
- package/dist/services/swap/swap.codecs.js +39 -0
- package/dist/services/swap/swap.codecs.js.map +1 -0
- package/dist/services/swap/swap.d.ts +51 -0
- package/dist/services/swap/swap.d.ts.map +1 -0
- package/dist/services/swap/swap.js +71 -0
- package/dist/services/swap/swap.js.map +1 -0
- package/dist/services/swap/swap.schemas.d.ts +520 -0
- package/dist/services/swap/swap.schemas.d.ts.map +1 -0
- package/dist/services/swap/swap.schemas.js +213 -0
- package/dist/services/swap/swap.schemas.js.map +1 -0
- package/dist/services/swap/swap.types.d.ts +3 -0
- package/dist/services/system/system.js +1 -1
- package/dist/services/trades/trades.js +1 -1
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +29 -2
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +75 -12
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +85 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +57 -2
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +3 -3
- package/dist/services/trading-withdraws/wallet-message.js +30 -2
- package/dist/services/trading-withdraws/wallet-message.js.map +1 -1
- package/dist/services/triggers/trigger-child-order.schemas.js +2 -2
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/trigger-input.schemas.js +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +53 -53
- package/dist/services/triggers/triggers.js +1 -1
- package/dist/services/vip/vip.js +1 -1
- package/dist/services/vip/vip.schemas.d.ts +3 -3
- package/dist/services/vip/vip.schemas.js +1 -1
- package/dist/services/zipper/zipper.js +1 -1
- package/dist/services/zipper/zipper.schemas.js +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +6 -0
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/decimal-surface.d.ts.map +1 -1
- package/dist/shared/decimal-surface.js +11 -1
- package/dist/shared/decimal-surface.js.map +1 -1
- package/dist/shared/error-detail.d.ts +37 -2
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +2 -0
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/alerts.js +1 -1
- package/dist/shared/error-details/assistant.js +1 -1
- package/dist/shared/error-details/auth.js +1 -1
- package/dist/shared/error-details/claims.js +1 -1
- package/dist/shared/error-details/internal-transfer.js +1 -1
- package/dist/shared/error-details/ledger.js +1 -1
- package/dist/shared/error-details/market-overview.js +1 -1
- package/dist/shared/error-details/notifications.js +1 -1
- package/dist/shared/error-details/orders.js +1 -1
- package/dist/shared/error-details/profile.js +1 -1
- package/dist/shared/error-details/rate-limit.js +1 -1
- package/dist/shared/error-details/strategies.js +36 -0
- package/dist/shared/error-details/strategies.js.map +1 -0
- package/dist/shared/error-details/swap.js +22 -0
- package/dist/shared/error-details/swap.js.map +1 -0
- package/dist/shared/error-details/withdraw.js +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +1 -1
- package/dist/shared/rate-limit.schemas.js +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +23 -19
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,22 +1,15 @@
|
|
|
1
|
+
import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
1
2
|
import { ValidationError } from "../../shared/errors.js";
|
|
2
3
|
import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
|
|
3
4
|
import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdOrEmptySchema, TimestampMsSchema, U128Schema } from "../../shared/schemas.js";
|
|
4
5
|
import { enumLabel, enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
5
6
|
import { fromU128, toU128 } from "../../utils/u128.js";
|
|
6
|
-
import {
|
|
7
|
+
import { decimalInputToE18, scaledToDecimalOutput } from "../../shared/decimal-surface.js";
|
|
7
8
|
import { PositiveUint32InputSchema } from "../shared.js";
|
|
8
9
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
9
|
-
import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
10
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
|
-
const U128_MAX = (1n << 128n) - 1n;
|
|
14
|
-
/** Decimal string → 18-decimal U128 integer, exact; throws `ValidationError`. */
|
|
15
|
-
function decimalToE18(field, value) {
|
|
16
|
-
const scaled = decimalInputToScaled(field, value, 18);
|
|
17
|
-
if (scaled > U128_MAX) throw new ValidationError(`${field} exceeds the maximum supported value: ${value}`);
|
|
18
|
-
return scaled;
|
|
19
|
-
}
|
|
20
13
|
function e18ToDecimal(value) {
|
|
21
14
|
return scaledToDecimalOutput(fromU128(value), 18);
|
|
22
15
|
}
|
|
@@ -87,8 +80,8 @@ const AutoWithdrawDestinationInputSchema = v.pipe(v.strictObject({
|
|
|
87
80
|
minAmount: v.string(),
|
|
88
81
|
maxAmount: v.string()
|
|
89
82
|
}), v.transform(({ minAmount, maxAmount, destinationChainId, ...destination }) => {
|
|
90
|
-
const min =
|
|
91
|
-
const max =
|
|
83
|
+
const min = decimalInputToE18("minAmount", minAmount);
|
|
84
|
+
const max = decimalInputToE18("maxAmount", maxAmount);
|
|
92
85
|
if (max === 0n || max < min) throw new ValidationError(`maxAmount must be greater than 0 and at least minAmount: ${maxAmount}`);
|
|
93
86
|
return {
|
|
94
87
|
...destination,
|
|
@@ -108,7 +101,7 @@ const SetAutoWithdrawRuleInputSchema = v.pipe(v.strictObject({
|
|
|
108
101
|
}), v.transform(({ account, minUsdValue, ...input }) => ({
|
|
109
102
|
...input,
|
|
110
103
|
subaccountId: accountScopeToSubaccountId(account),
|
|
111
|
-
minUsdValueE18: minUsdValue == null ? void 0 : toU128(
|
|
104
|
+
minUsdValueE18: minUsdValue == null ? void 0 : toU128(decimalInputToE18("minUsdValue", minUsdValue))
|
|
112
105
|
})));
|
|
113
106
|
const SetAutoWithdrawRuleEnabledInputSchema = v.pipe(v.strictObject({
|
|
114
107
|
...AccountScopeInputEntries,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-withdraw.schemas.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport {\n decimalInputToScaled,\n E18_SCALE,\n scaledToDecimalOutput,\n} from \"../../shared/decimal-surface.js\";\nimport { ValidationError } from \"../../shared/errors.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdOrEmptySchema,\n TimestampMsSchema,\n U128Schema,\n} from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport {\n AUTO_WITHDRAW_WEEKDAY_VALUES,\n AutoWithdrawCadenceCodec,\n AutoWithdrawPreviewStatusCodec,\n AutoWithdrawRunStateCodec,\n AutoWithdrawStepStateCodec,\n AutoWithdrawWeekdayCodec,\n type AutoWithdrawHoldReason,\n type AutoWithdrawPauseReason,\n type AutoWithdrawRunReason,\n type AutoWithdrawStepReason,\n type AutoWithdrawWeekday,\n} from \"./auto-withdraw.codecs.js\";\n\nconst U128_MAX = (1n << 128n) - 1n;\n\n/** Decimal string → 18-decimal U128 integer, exact; throws `ValidationError`. */\nfunction decimalToE18(field: string, value: string): bigint {\n const scaled = decimalInputToScaled(field, value, E18_SCALE);\n if (scaled > U128_MAX) {\n throw new ValidationError(`${field} exceeds the maximum supported value: ${value}`);\n }\n return scaled;\n}\n\nfunction e18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string {\n return scaledToDecimalOutput(fromU128(value), E18_SCALE);\n}\n\n/** Unset means unknown, never zero. */\nfunction optionalE18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string | null {\n return value ? e18ToDecimal(value) : null;\n}\n\nconst AccountScopedInputSchema = v.strictObject({ ...AccountScopeInputEntries });\n\nexport type AutoWithdrawScopedInput = v.InferInput<typeof AccountScopedInputSchema>;\n\nexport const AutoWithdrawScopedInputSchema = v.pipe(\n AccountScopedInputSchema,\n v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })),\n);\n\nconst Uint32InputSchema = v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(PROTOBUF_UINT32_MAX),\n);\nconst MinuteOfDaySchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1439));\nconst MinuteOfHourSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(59));\nconst DayOfMonthSchema = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(31));\nconst WeekdaySchema = v.picklist(AUTO_WITHDRAW_WEEKDAY_VALUES);\nconst AnchorDateSchema = v.pipe(\n v.string(),\n v.trim(),\n v.isoDate(\"anchorDate must be a UTC date, YYYY-MM-DD\"),\n v.check((date) => {\n const parsed = new Date(`${date}T00:00:00Z`);\n return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(date);\n }, \"anchorDate must be a real calendar date\"),\n);\n\n/**\n * A rule's UTC run slot. Each cadence takes only its own fields; any other field is rejected.\n * `minuteOfDay` is minutes after 00:00 UTC (0–1439), `minuteOfHour` 0–59, `dayOfMonth` 1–31\n * (a shorter month runs on its last day), and `anchorDate` is a UTC date in a week a biweekly\n * rule runs.\n */\nexport const AutoWithdrawScheduleInputSchema = v.pipe(\n v.variant(\"cadence\", [\n v.strictObject({ cadence: v.literal(\"hourly\"), minuteOfHour: MinuteOfHourSchema }),\n v.strictObject({ cadence: v.literal(\"daily\"), minuteOfDay: MinuteOfDaySchema }),\n v.strictObject({\n cadence: v.literal(\"weekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n v.strictObject({\n cadence: v.literal(\"biweekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n anchorDate: AnchorDateSchema,\n }),\n v.strictObject({\n cadence: v.literal(\"monthly\"),\n dayOfMonth: DayOfMonthSchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n ]),\n v.transform((schedule) => ({\n cadence: AutoWithdrawCadenceCodec.inputToProto[schedule.cadence],\n weekday:\n \"weekday\" in schedule\n ? AutoWithdrawWeekdayCodec.inputToProto[schedule.weekday]\n : undefined,\n minuteOfDay: \"minuteOfDay\" in schedule ? schedule.minuteOfDay : undefined,\n minuteOfHour: \"minuteOfHour\" in schedule ? schedule.minuteOfHour : undefined,\n dayOfMonth: \"dayOfMonth\" in schedule ? schedule.dayOfMonth : undefined,\n anchorDate: \"anchorDate\" in schedule ? schedule.anchorDate : undefined,\n })),\n);\n\nexport type AutoWithdrawScheduleInput = v.InferInput<typeof AutoWithdrawScheduleInputSchema>;\n\n/**\n * One asset paid in kind to one whitelisted external-chain address. `minAmount` and\n * `maxAmount` are decimal asset amounts (up to 18 decimals); a run pays the balance up to\n * `maxAmount` once it reaches `minAmount`.\n */\nconst AutoWithdrawDestinationInputSchema = v.pipe(\n v.strictObject({\n assetId: PositiveUint32InputSchema,\n /** Polyester chain ID of the network: a Zipper chain's `chainId`, not its `nativeChainId`. */\n destinationChainId: v.pipe(\n v.number(),\n v.integer(),\n v.gtValue(0),\n v.maxValue(Number.MAX_SAFE_INTEGER),\n ),\n destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n minAmount: v.string(),\n maxAmount: v.string(),\n }),\n v.transform(({ minAmount, maxAmount, destinationChainId, ...destination }) => {\n const min = decimalToE18(\"minAmount\", minAmount);\n const max = decimalToE18(\"maxAmount\", maxAmount);\n if (max === 0n || max < min) {\n throw new ValidationError(\n `maxAmount must be greater than 0 and at least minAmount: ${maxAmount}`,\n );\n }\n return {\n ...destination,\n destinationChainId: BigInt(destinationChainId),\n minAmountE18: toU128(min),\n maxAmountE18: toU128(max),\n };\n }),\n);\n\nexport type AutoWithdrawDestinationInput = v.InferInput<typeof AutoWithdrawDestinationInputSchema>;\n\nexport const SetAutoWithdrawRuleInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The version this change replaces: 0 when the account has no rule yet. */\n expectedVersion: Uint32InputSchema,\n schedule: AutoWithdrawScheduleInputSchema,\n destinations: v.pipe(\n v.array(AutoWithdrawDestinationInputSchema),\n v.minLength(1, \"At least one destination is required.\"),\n v.maxLength(32, \"At most 32 destinations are allowed.\"),\n v.check(\n (destinations) =>\n new Set(destinations.map((d) => d.assetId)).size === destinations.length,\n \"At most one destination per asset is allowed.\",\n ),\n ),\n /** Least USD value one payout pays, as a decimal; omit or null for no USD minimum. */\n minUsdValue: v.optional(v.nullable(v.string())),\n }),\n v.transform(({ account, minUsdValue, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n minUsdValueE18:\n minUsdValue == null ? undefined : toU128(decimalToE18(\"minUsdValue\", minUsdValue)),\n })),\n);\n\nexport type SetAutoWithdrawRuleInput = v.InferInput<typeof SetAutoWithdrawRuleInputSchema>;\n\nexport const SetAutoWithdrawRuleEnabledInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The account's latest rule version. */\n expectedVersion: Uint32InputSchema,\n /** `false` pauses the rule; `true` resumes it. */\n enabled: v.boolean(),\n }),\n v.transform(({ account, expectedVersion, enabled }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n expectedVersion,\n enabled,\n })),\n);\n\nexport type SetAutoWithdrawRuleEnabledInput = v.InferInput<\n typeof SetAutoWithdrawRuleEnabledInputSchema\n>;\n\n/** `limit` is 0 through 100; 0 or omitted uses the server default of 20. */\nexport const ListAutoWithdrawRunsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), 0),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListAutoWithdrawRunsInput = v.InferInput<typeof ListAutoWithdrawRunsInputSchema>;\n\ntype ScheduleShape<Weekday> =\n | { cadence: \"hourly\"; minuteOfHour: number }\n | { cadence: \"daily\"; minuteOfDay: number }\n | { cadence: \"weekly\"; weekday: Weekday; minuteOfDay: number }\n | { cadence: \"biweekly\"; weekday: Weekday; minuteOfDay: number; anchorDate: string }\n | { cadence: \"monthly\"; dayOfMonth: number; minuteOfDay: number };\n\n/** A decoded schedule. A cadence this SDK build does not know decodes as `\"unspecified\"`. */\nexport type AutoWithdrawSchedule =\n | ScheduleShape<DecodedEnum<AutoWithdrawWeekday>>\n | { cadence: \"unspecified\" };\n\nconst AutoWithdrawScheduleSchema = v.pipe(\n v.object({\n cadence: v.optional(v.number(), 0),\n weekday: v.optional(v.number(), 0),\n minuteOfDay: v.optional(v.number(), 0),\n minuteOfHour: v.optional(v.number(), 0),\n dayOfMonth: v.optional(v.number(), 0),\n anchorDate: v.optional(v.string(), \"\"),\n }),\n v.transform((s): AutoWithdrawSchedule => {\n const weekday = enumLabel(AutoWithdrawWeekdayCodec.protoToOutput, s.weekday);\n const { minuteOfDay } = s;\n switch (s.cadence) {\n case Proto.AutoWithdrawCadence.HOURLY:\n return { cadence: \"hourly\", minuteOfHour: s.minuteOfHour };\n case Proto.AutoWithdrawCadence.DAILY:\n return { cadence: \"daily\", minuteOfDay };\n case Proto.AutoWithdrawCadence.WEEKLY:\n return { cadence: \"weekly\", weekday, minuteOfDay };\n case Proto.AutoWithdrawCadence.BIWEEKLY:\n return { cadence: \"biweekly\", weekday, minuteOfDay, anchorDate: s.anchorDate };\n case Proto.AutoWithdrawCadence.MONTHLY:\n return { cadence: \"monthly\", dayOfMonth: s.dayOfMonth, minuteOfDay };\n default:\n return { cadence: \"unspecified\" };\n }\n }),\n);\n\nfunction reasonSchema<TReason extends string>() {\n return v.pipe(\n v.optional(v.string(), \"\"),\n v.transform((reason) => (reason ? (reason as TReason) : null)),\n );\n}\n\nconst AutoWithdrawDestinationSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n minAmountE18: v.optional(U128Schema),\n maxAmountE18: v.optional(U128Schema),\n minFloorE18: v.optional(U128Schema),\n }),\n v.transform(\n ({ minAmountE18, maxAmountE18, minFloorE18, destinationChainId, ...destination }) => ({\n ...destination,\n destinationChainId: Number(destinationChainId),\n minAmount: e18ToDecimal(minAmountE18),\n maxAmount: e18ToDecimal(maxAmountE18),\n minFloor: optionalE18ToDecimal(minFloorE18),\n }),\n ),\n);\n\n/**\n * `minFloor` is the least one payout to the destination can pay now (the route's withdrawal\n * minimum, above its current network fee); a new rule's `minAmount` must be at least this\n * floor. It follows the network fee, and is null when the route or fee is unknown: show no\n * floor then, not zero.\n */\nexport type AutoWithdrawDestination = v.InferOutput<typeof AutoWithdrawDestinationSchema>;\n\nconst AutoWithdrawPauseSchema = v.object({\n assetId: v.number(),\n reason: v.pipe(\n v.string(),\n v.transform((reason) => reason as AutoWithdrawPauseReason),\n ),\n pausedAt: TimestampMsSchema,\n});\n\nexport type AutoWithdrawPause = v.InferOutput<typeof AutoWithdrawPauseSchema>;\n\nexport const AutoWithdrawRuleSchema = v.pipe(\n v.object({\n subaccountId: v.optional(PublicIdOrEmptySchema, 0n),\n version: v.number(),\n enabled: v.boolean(),\n schedule: v.optional(AutoWithdrawScheduleSchema),\n destinations: v.array(AutoWithdrawDestinationSchema),\n createdAt: TimestampMsSchema,\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n createdByAccountId: v.optional(PublicIdOrEmptySchema, 0n),\n }),\n v.transform(({ schedule, pause, minUsdValueE18, ...rule }) => ({\n ...rule,\n schedule: schedule ?? ({ cadence: \"unspecified\" } as AutoWithdrawSchedule),\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * One version of an account's rule. `subaccountId` is the public subaccount ID, `\"\"` for the\n * root account; `createdByAccountId` is the public account ID of whoever created the version.\n * Times are epoch milliseconds. `minUsdValue` is null when the rule has no USD minimum. A paused\n * version (`enabled: false`) keeps its schedule and destinations. `pause` is set when the rule\n * paused itself; resuming it or setting a new rule clears it. The rule runs only while\n * `enabled` is true and `pause` is null.\n */\nexport type AutoWithdrawRule = v.InferOutput<typeof AutoWithdrawRuleSchema>;\n\nconst AutoWithdrawStepSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n availableE18: v.optional(U128Schema),\n amountE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n networkFeeE18: v.optional(U128Schema),\n state: enumLabelSchema(AutoWithdrawStepStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawStepReason>(),\n intentId: v.optional(v.string(), \"\"),\n txHash: v.optional(v.string(), \"\"),\n }),\n v.transform(\n ({\n availableE18,\n amountE18,\n valueUsdE18,\n networkFeeE18,\n destinationChainId,\n intentId,\n txHash,\n ...step\n }) => ({\n ...step,\n destinationChainId: Number(destinationChainId),\n available: e18ToDecimal(availableE18),\n amount: e18ToDecimal(amountE18),\n valueUsd: valueUsdE18 ? e18ToDecimal(valueUsdE18) : null,\n networkFee: optionalE18ToDecimal(networkFeeE18),\n intentId: intentId || null,\n txHash: txHash || null,\n }),\n ),\n);\n\n/**\n * One asset's payout in a run. `available`, `amount` and `valueUsd` are decimal strings;\n * `valueUsd` is null when the rule has no USD minimum or no price was available. `networkFee`\n * is the fee charged on the withdrawal: once completed it was taken out of `amount`; once\n * rejected or failed it is the fee kept, not refunded. It is null until the step is final, when\n * the step never reached the withdrawal, or when the fee was not reported.\n */\nexport type AutoWithdrawStep = v.InferOutput<typeof AutoWithdrawStepSchema>;\n\nconst AutoWithdrawRunSchema = v.pipe(\n v.object({\n runSeq: BigIntStringSchema,\n ruleVersion: v.number(),\n scheduledFor: TimestampMsSchema,\n state: enumLabelSchema(AutoWithdrawRunStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawRunReason>(),\n steps: v.array(AutoWithdrawStepSchema),\n createdAt: TimestampMsSchema,\n finishedAt: OptionalTimestampMsSchema,\n }),\n v.transform(({ finishedAt, ...run }) => ({ ...run, finishedAt: finishedAt ?? null })),\n);\n\n/** One scheduled run. Times are epoch milliseconds; `finishedAt` is null while in progress. */\nexport type AutoWithdrawRun = v.InferOutput<typeof AutoWithdrawRunSchema>;\n\nexport const ListAutoWithdrawRunsResultSchema = v.object({\n runs: v.array(AutoWithdrawRunSchema),\n nextPageToken: v.optional(v.string(), \"\"),\n});\n\n/** One page of runs, newest first. An empty `nextPageToken` means no more runs. */\nexport type ListAutoWithdrawRunsResult = v.InferOutput<typeof ListAutoWithdrawRunsResultSchema>;\n\nconst AutoWithdrawPreviewAssetSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.optional(v.bigint(), 0n),\n destinationAddress: v.optional(v.string(), \"\"),\n availableE18: v.optional(U128Schema),\n payableE18: v.optional(U128Schema),\n heldBackE18: v.optional(U128Schema),\n holdReason: reasonSchema<AutoWithdrawHoldReason>(),\n minimumE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n pricedAt: OptionalTimestampMsSchema,\n networkFeeE18: v.optional(U128Schema),\n networkFeeSampledAt: OptionalTimestampMsSchema,\n payableFrom: OptionalTimestampMsSchema,\n }),\n v.transform((asset) => ({\n assetId: asset.assetId,\n destinationChainId:\n asset.destinationChainId === 0n ? null : Number(asset.destinationChainId),\n destinationAddress: asset.destinationAddress || null,\n available: e18ToDecimal(asset.availableE18),\n payable: e18ToDecimal(asset.payableE18),\n heldBack: e18ToDecimal(asset.heldBackE18),\n holdReason: asset.holdReason,\n minimum: optionalE18ToDecimal(asset.minimumE18),\n valueUsd: optionalE18ToDecimal(asset.valueUsdE18),\n pricedAt: asset.pricedAt ?? null,\n networkFee: optionalE18ToDecimal(asset.networkFeeE18),\n networkFeeSampledAt: asset.networkFeeSampledAt ?? null,\n payableFrom: asset.payableFrom ?? null,\n })),\n);\n\n/**\n * What the next run would do with one asset, sized from the balance now. Amounts are decimal\n * strings; `heldBack` is `available` minus `payable`, and `holdReason` says why it stays (null\n * when the whole balance pays). `destinationChainId` and `destinationAddress` are null for an\n * asset the rule pays nowhere. `minimum`, `valueUsd`, `networkFee` and their times are null\n * when unknown, never zero. `payableFrom` is set only while a broker vault's destination cools\n * down. Times are epoch milliseconds.\n */\nexport type AutoWithdrawPreviewAsset = v.InferOutput<typeof AutoWithdrawPreviewAssetSchema>;\n\nexport const AutoWithdrawPreviewSchema = v.pipe(\n v.object({\n status: enumLabelSchema(AutoWithdrawPreviewStatusCodec.protoToOutput),\n nextRunAt: OptionalTimestampMsSchema,\n ruleVersion: v.optional(v.number(), 0),\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n assets: v.array(AutoWithdrawPreviewAssetSchema),\n computedAt: TimestampMsSchema,\n }),\n v.transform(({ nextRunAt, pause, minUsdValueE18, ...preview }) => ({\n ...preview,\n nextRunAt: nextRunAt ?? null,\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * The account's next run as it would go now; balances, prices and fees can change before\n * `nextRunAt`. `nextRunAt` is null without a rule or while it is paused; `ruleVersion` is 0\n * without a rule. `pause` is set only when the rule paused itself. `minUsdValue` is null when\n * there is no USD minimum. Times are epoch milliseconds.\n */\nexport type AutoWithdrawPreview = v.InferOutput<typeof AutoWithdrawPreviewSchema>;\n"],"mappings":";;;;;;;;;;;;AAsCA,MAAM,YAAY,MAAM,QAAQ;;AAGhC,SAAS,aAAa,OAAe,OAAuB;CACxD,MAAM,SAAS,qBAAqB,OAAO,OAAA,EAAgB;CAC3D,IAAI,SAAS,UACT,MAAM,IAAI,gBAAgB,GAAG,MAAM,wCAAwC,OAAO;CAEtF,OAAO;AACX;AAEA,SAAS,aAAa,OAA6D;CAC/E,OAAO,sBAAsB,SAAS,KAAK,GAAA,EAAY;AAC3D;;AAGA,SAAS,qBAAqB,OAAoE;CAC9F,OAAO,QAAQ,aAAa,KAAK,IAAI;AACzC;AAEA,MAAM,2BAA2B,EAAE,aAAa,EAAE,GAAG,yBAAyB,CAAC;AAI/E,MAAa,gCAAgC,EA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AY,qBAAqB,MAAM,aAAa;CACpD,qBAAqB,MAAM,uBAAuB;CAClD,aAAa,MAAM,eAAe;AACtC,EAAE,CACN;AAYA,MAAa,4BAA4B,EAAE,KACvC,EAAE,OAAO;CACL,QAAQ,gBAAgB,+BAA+B,aAAa;CACpE,WAAW;CACX,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,CAAC;CACrC,OAAO,EAAE,SAAS,uBAAuB;CACzC,gBAAgB,EAAE,SAAS,UAAU;CACrC,QAAQ,EAAE,MAAM,8BAA8B;CAC9C,YAAY;AAChB,CAAC,GACD,EAAE,WAAW,EAAE,WAAW,OAAO,gBAAgB,GAAG,eAAe;CAC/D,GAAG;CACH,WAAW,aAAa;CACxB,OAAO,SAAS;CAChB,aAAa,SAAS,cAAc,MAAM,KAAK,OAAO,aAAa,cAAc;AACrF,EAAE,CACN"}
|
|
1
|
+
{"version":3,"file":"auto-withdraw.schemas.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport {\n decimalInputToE18,\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\nfunction e18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string {\n return scaledToDecimalOutput(fromU128(value), E18_SCALE);\n}\n\n/** Unset means unknown, never zero. */\nfunction optionalE18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string | null {\n return value ? e18ToDecimal(value) : null;\n}\n\nconst AccountScopedInputSchema = v.strictObject({ ...AccountScopeInputEntries });\n\nexport type AutoWithdrawScopedInput = v.InferInput<typeof AccountScopedInputSchema>;\n\nexport const AutoWithdrawScopedInputSchema = v.pipe(\n AccountScopedInputSchema,\n v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })),\n);\n\nconst Uint32InputSchema = v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(PROTOBUF_UINT32_MAX),\n);\nconst MinuteOfDaySchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1439));\nconst MinuteOfHourSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(59));\nconst DayOfMonthSchema = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(31));\nconst WeekdaySchema = v.picklist(AUTO_WITHDRAW_WEEKDAY_VALUES);\nconst AnchorDateSchema = v.pipe(\n v.string(),\n v.trim(),\n v.isoDate(\"anchorDate must be a UTC date, YYYY-MM-DD\"),\n v.check((date) => {\n const parsed = new Date(`${date}T00:00:00Z`);\n return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(date);\n }, \"anchorDate must be a real calendar date\"),\n);\n\n/**\n * A rule's UTC run slot. Each cadence takes only its own fields; any other field is rejected.\n * `minuteOfDay` is minutes after 00:00 UTC (0–1439), `minuteOfHour` 0–59, `dayOfMonth` 1–31\n * (a shorter month runs on its last day), and `anchorDate` is a UTC date in a week a biweekly\n * rule runs.\n */\nexport const AutoWithdrawScheduleInputSchema = v.pipe(\n v.variant(\"cadence\", [\n v.strictObject({ cadence: v.literal(\"hourly\"), minuteOfHour: MinuteOfHourSchema }),\n v.strictObject({ cadence: v.literal(\"daily\"), minuteOfDay: MinuteOfDaySchema }),\n v.strictObject({\n cadence: v.literal(\"weekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n v.strictObject({\n cadence: v.literal(\"biweekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n anchorDate: AnchorDateSchema,\n }),\n v.strictObject({\n cadence: v.literal(\"monthly\"),\n dayOfMonth: DayOfMonthSchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n ]),\n v.transform((schedule) => ({\n cadence: AutoWithdrawCadenceCodec.inputToProto[schedule.cadence],\n weekday:\n \"weekday\" in schedule\n ? AutoWithdrawWeekdayCodec.inputToProto[schedule.weekday]\n : undefined,\n minuteOfDay: \"minuteOfDay\" in schedule ? schedule.minuteOfDay : undefined,\n minuteOfHour: \"minuteOfHour\" in schedule ? schedule.minuteOfHour : undefined,\n dayOfMonth: \"dayOfMonth\" in schedule ? schedule.dayOfMonth : undefined,\n anchorDate: \"anchorDate\" in schedule ? schedule.anchorDate : undefined,\n })),\n);\n\nexport type AutoWithdrawScheduleInput = v.InferInput<typeof AutoWithdrawScheduleInputSchema>;\n\n/**\n * One asset paid in kind to one whitelisted external-chain address. `minAmount` and\n * `maxAmount` are decimal asset amounts (up to 18 decimals); a run pays the balance up to\n * `maxAmount` once it reaches `minAmount`.\n */\nconst AutoWithdrawDestinationInputSchema = v.pipe(\n v.strictObject({\n assetId: PositiveUint32InputSchema,\n /** Polyester chain ID of the network: a Zipper chain's `chainId`, not its `nativeChainId`. */\n destinationChainId: v.pipe(\n v.number(),\n v.integer(),\n v.gtValue(0),\n v.maxValue(Number.MAX_SAFE_INTEGER),\n ),\n destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n minAmount: v.string(),\n maxAmount: v.string(),\n }),\n v.transform(({ minAmount, maxAmount, destinationChainId, ...destination }) => {\n const min = decimalInputToE18(\"minAmount\", minAmount);\n const max = decimalInputToE18(\"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(decimalInputToE18(\"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,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,mBAAmB,EAAE,KACvB,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,QAAQ,2CAA2C,GACrD,EAAE,OAAO,SAAS;CACd,MAAM,yBAAS,IAAI,KAAK,GAAG,KAAK,WAAW;CAC3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jD,YAAY,EAAE,SAAS,UAAU;CACjC,aAAa,EAAE,SAAS,UAAU;CAClC,UAAU;CACV,eAAe,EAAE,SAAS,UAAU;CACpC,qBAAqB;CACrB,aAAa;AACjB,CAAC,GACD,EAAE,WAAW,WAAW;CACpB,SAAS,MAAM;CACf,oBACI,MAAM,uBAAuB,KAAK,OAAO,OAAO,MAAM,kBAAkB;CAC5E,oBAAoB,MAAM,sBAAsB;CAChD,WAAW,aAAa,MAAM,YAAY;CAC1C,SAAS,aAAa,MAAM,UAAU;CACtC,UAAU,aAAa,MAAM,WAAW;CACxC,YAAY,MAAM;CAClB,SAAS,qBAAqB,MAAM,UAAU;CAC9C,UAAU,qBAAqB,MAAM,WAAW;CAChD,UAAU,MAAM,YAAY;CAC5B,YAAY,qBAAqB,MAAM,aAAa;CACpD,qBAAqB,MAAM,uBAAuB;CAClD,aAAa,MAAM,eAAe;AACtC,EAAE,CACN;AAYA,MAAa,4BAA4B,EAAE,KACvC,EAAE,OAAO;CACL,QAAQ,gBAAgB,+BAA+B,aAAa;CACpE,WAAW;CACX,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,CAAC;CACrC,OAAO,EAAE,SAAS,uBAAuB;CACzC,gBAAgB,EAAE,SAAS,UAAU;CACrC,QAAQ,EAAE,MAAM,8BAA8B;CAC9C,YAAY;AAChB,CAAC,GACD,EAAE,WAAW,EAAE,WAAW,OAAO,gBAAgB,GAAG,eAAe;CAC/D,GAAG;CACH,WAAW,aAAa;CACxB,OAAO,SAAS;CAChB,aAAa,SAAS,cAAc,MAAM,KAAK,OAAO,aAAa,cAAc;AACrF,EAAE,CACN"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { CandlePointSchema, MarketDataService } from "../../gen/marketdata/v1/marketdata_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
4
|
import { SymbolIdInputSchema } from "../shared.js";
|
|
4
|
-
import { CandlePointSchema, MarketDataService } from "../../gen/marketdata/v1/marketdata_pb.js";
|
|
5
5
|
import { TimeframeCodec } from "./candles.codecs.js";
|
|
6
6
|
import { ListCandlesInputSchema, TimeframeSchema, createCandleColumnarIntSchema, createCandleColumnarSchema, formatCandleRow } from "./candles.schemas.js";
|
|
7
7
|
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ChainAnalyticsService as ChainAnalyticsService$1 } from "../../gen/chain/analytics/v1/analytics_read_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { ChainAnalyticsService as ChainAnalyticsService$1 } from "../../gen/chain/analytics/v1/analytics_read_pb.js";
|
|
4
4
|
import { GetUnifiedAssetBalancesInputSchema, GetZippedAssetSupplyGroupInputSchema, GetZippedAssetSupplyInputSchema, createUnifiedAssetBalancesResponseSchema, createZippedAssetSupplyGroupResponseSchema, createZippedAssetSupplyResponseSchema } from "./chain-analytics.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/chain-analytics/chain-analytics.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ChangelogService as ChangelogService$1 } from "../../gen/changelog/v1/changelog_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { ChangelogService as ChangelogService$1 } from "../../gen/changelog/v1/changelog_pb.js";
|
|
4
4
|
import { GetChangelogDeploymentGroupInputSchema, GetChangelogDeploymentGroupResultSchema, GetChangelogPostInputSchema, GetChangelogPostResultSchema, ListChangelogChangesInputSchema, ListChangelogChangesResultSchema, ListChangelogDeploymentGroupsInputSchema, ListChangelogDeploymentGroupsResultSchema, ListChangelogPostsInputSchema, ListChangelogPostsResultSchema } from "./changelog.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/changelog/changelog.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { CheckpointService } from "../../gen/checkpoints/v1/checkpoints_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { CheckpointService } from "../../gen/checkpoints/v1/checkpoints_pb.js";
|
|
4
4
|
import { ListCheckpointsInputSchema, ListCheckpointsResultSchema } from "./checkpoints.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/checkpoints/checkpoints.ts
|
|
@@ -427,7 +427,7 @@ declare const CheckpointSchema: v.ObjectSchema<{
|
|
|
427
427
|
readonly seasonResultUsd: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
428
428
|
readonly subaccounts: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.MaxValueAction<bigint, bigint, undefined>, v.TransformAction<any, number>]>;
|
|
429
429
|
/** Values computed from partial evidence; show them with an approximation marker. */
|
|
430
|
-
readonly incomplete: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
430
|
+
readonly incomplete: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "tools" | "deposits" | "withdrawals" | "volume" | "top_pairs" | "order_types" | "time_in_force" | "order_status" | "median_limit_rest" | "internal_transfers" | "daily_claim_amounts" | "portfolio_value" | "trading_balances" | "funding_balances" | "transfers" | "season_result">]>, undefined>, readonly []>;
|
|
431
431
|
}, undefined>;
|
|
432
432
|
/**
|
|
433
433
|
* One frozen season recap of a root account and all of its subaccounts. An absent USD value
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { ClaimsService as ClaimsService$1 } from "../../gen/claims/v1/claims_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { ClaimsService as ClaimsService$1 } from "../../gen/claims/v1/claims_pb.js";
|
|
4
4
|
import { ClaimDailyRewardInputSchema, ClaimDailyRewardResultSchema, DailyClaimStatusSchema } from "./claims.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/claims/claims.ts
|
|
@@ -36,7 +36,7 @@ declare const DailyClaimTransferSchema: v.ObjectSchema<{
|
|
|
36
36
|
}, undefined>;
|
|
37
37
|
type DailyClaimTransfer = v.InferOutput<typeof DailyClaimTransferSchema>;
|
|
38
38
|
declare const DailyClaimStatusSchema: v.ObjectSchema<{
|
|
39
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
39
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "processing" | "unavailable" | "available" | "claimed" | "payout_delayed">]>;
|
|
40
40
|
readonly resetAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
41
41
|
readonly seconds: v.BigintSchema<undefined>;
|
|
42
42
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -76,7 +76,7 @@ declare const DailyClaimStatusSchema: v.ObjectSchema<{
|
|
|
76
76
|
type DailyClaimStatus = v.InferOutput<typeof DailyClaimStatusSchema>;
|
|
77
77
|
declare const ClaimDailyRewardResultSchema: v.ObjectSchema<{
|
|
78
78
|
readonly claimId: v.StringSchema<undefined>;
|
|
79
|
-
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
79
|
+
readonly state: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "processing" | "unavailable" | "available" | "claimed" | "payout_delayed">]>;
|
|
80
80
|
readonly claimedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
81
81
|
readonly seconds: v.BigintSchema<undefined>;
|
|
82
82
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { ErrorCode } from "../../gen/claims/v1/claims_pb.js";
|
|
1
2
|
import { OptionalPublicIdSchema, OptionalTimestampMsSchema, U128Schema, optionalSubaccountIdInputSchema } from "../../shared/schemas.js";
|
|
2
3
|
import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
3
4
|
import { fromU128 } from "../../utils/u128.js";
|
|
4
5
|
import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
|
|
5
|
-
import { ErrorCode } from "../../gen/claims/v1/claims_pb.js";
|
|
6
6
|
import { ClaimPolicyCodec, DailyClaimStateCodec } from "./claims.codecs.js";
|
|
7
7
|
import * as v from "valibot";
|
|
8
8
|
//#region src/services/claims/claims.schemas.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthApiTransports } from "../../shared/transports.js";
|
|
2
2
|
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
|
-
import {
|
|
3
|
+
import { AppConnectionRequest, AppConnectionRequestInput, AppConnectionRequestRedirect, ConnectedApp, RevokeConnectedAppInput } from "./connected-apps.schemas.js";
|
|
4
4
|
//#region src/services/connected-apps/connected-apps.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* Connects outside apps, such as an AI assistant, to the account with OAuth ("Sign in with
|
|
@@ -17,7 +17,7 @@ declare class ConnectedAppsService {
|
|
|
17
17
|
* Reads a pending app connection request to show the consent page. An unknown, expired or
|
|
18
18
|
* already answered request throws `ResourceNotFoundError`.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
getConnectionRequest(input: AppConnectionRequestInput, options?: PolyesterRequestOptions): Promise<AppConnectionRequest>;
|
|
21
21
|
/**
|
|
22
22
|
* Approves a pending app connection request; send the browser to the returned `redirectUrl`,
|
|
23
23
|
* which carries a one-time authorization code valid for 60 seconds. Needs MFA enrolled and a
|
|
@@ -25,13 +25,13 @@ declare class ConnectedAppsService {
|
|
|
25
25
|
* `ResourceNotFoundError`; an account with 20 connected apps throws `PreconditionFailedError`
|
|
26
26
|
* (`AUTH_CONNECTED_APP_LIMIT_REACHED`).
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
approveConnectionRequest(input: AppConnectionRequestInput, options?: PolyesterMutationOptions): Promise<AppConnectionRequestRedirect>;
|
|
29
29
|
/**
|
|
30
30
|
* Denies a pending app connection request; send the browser to the returned `redirectUrl`,
|
|
31
31
|
* which carries the `access_denied` error. An unknown, expired or already answered request
|
|
32
32
|
* throws `ResourceNotFoundError`.
|
|
33
33
|
*/
|
|
34
|
-
|
|
34
|
+
denyConnectionRequest(input: AppConnectionRequestInput, options?: PolyesterRequestOptions): Promise<AppConnectionRequestRedirect>;
|
|
35
35
|
/** Lists the apps connected to the account, newest first; at most 20. */
|
|
36
36
|
list(options?: PolyesterRequestOptions): Promise<ConnectedApp[]>;
|
|
37
37
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connected-apps.d.ts","names":[],"sources":["../../../src/services/connected-apps/connected-apps.ts"],"mappings":";;;;;;;;;;;;cA8Ba;;EAGG,YAAA,YAAY;;;;;EAQlB,
|
|
1
|
+
{"version":3,"file":"connected-apps.d.ts","names":[],"sources":["../../../src/services/connected-apps/connected-apps.ts"],"mappings":";;;;;;;;;;;;cA8Ba;;EAGG,YAAA,YAAY;;;;;EAQlB,qBACF,OAAO,2BACP,UAAU,0BACX,QAAQ;;;;;;;;EAgBL,yBACF,OAAO,2BACP,UAAU,2BACX,QAAQ;;;;;;EAcL,sBACF,OAAO,2BACP,UAAU,0BACX,QAAQ;;EAUL,KAAK,UAAU,0BAA0B,QAAQ;;;;;;EAUjD,OAAO,OAAO,yBAAyB,UAAU,0BAA0B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { ConnectedAppService } from "../../gen/auth/v1/connected_apps_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
|
-
import {
|
|
4
|
-
import { AppAuthorizationInputSchema, AppAuthorizationRedirectSchema, AppAuthorizationSchema, ConnectedAppsSchema, RevokeConnectedAppInputSchema } from "./connected-apps.schemas.js";
|
|
4
|
+
import { AppConnectionRequestInputSchema, AppConnectionRequestRedirectSchema, AppConnectionRequestSchema, ConnectedAppsSchema, RevokeConnectedAppInputSchema } from "./connected-apps.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/connected-apps/connected-apps.ts
|
|
7
7
|
/**
|
|
@@ -21,10 +21,10 @@ var ConnectedAppsService = class {
|
|
|
21
21
|
* Reads a pending app connection request to show the consent page. An unknown, expired or
|
|
22
22
|
* already answered request throws `ResourceNotFoundError`.
|
|
23
23
|
*/
|
|
24
|
-
async
|
|
25
|
-
const request = parse(
|
|
26
|
-
const response = await this.#client.
|
|
27
|
-
return parse(
|
|
24
|
+
async getConnectionRequest(input, options) {
|
|
25
|
+
const request = parse(AppConnectionRequestInputSchema, input);
|
|
26
|
+
const response = await this.#client.getAppConnectionRequest(request, toConnectCallOptions(options));
|
|
27
|
+
return parse(AppConnectionRequestSchema, response.connectionRequest);
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Approves a pending app connection request; send the browser to the returned `redirectUrl`,
|
|
@@ -33,20 +33,20 @@ var ConnectedAppsService = class {
|
|
|
33
33
|
* `ResourceNotFoundError`; an account with 20 connected apps throws `PreconditionFailedError`
|
|
34
34
|
* (`AUTH_CONNECTED_APP_LIMIT_REACHED`).
|
|
35
35
|
*/
|
|
36
|
-
async
|
|
37
|
-
const request = parse(
|
|
38
|
-
const response = await this.#client.
|
|
39
|
-
return parse(
|
|
36
|
+
async approveConnectionRequest(input, options) {
|
|
37
|
+
const request = parse(AppConnectionRequestInputSchema, input);
|
|
38
|
+
const response = await this.#client.approveAppConnectionRequest(request, toConnectCallOptions(options));
|
|
39
|
+
return parse(AppConnectionRequestRedirectSchema, response);
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Denies a pending app connection request; send the browser to the returned `redirectUrl`,
|
|
43
43
|
* which carries the `access_denied` error. An unknown, expired or already answered request
|
|
44
44
|
* throws `ResourceNotFoundError`.
|
|
45
45
|
*/
|
|
46
|
-
async
|
|
47
|
-
const request = parse(
|
|
48
|
-
const response = await this.#client.
|
|
49
|
-
return parse(
|
|
46
|
+
async denyConnectionRequest(input, options) {
|
|
47
|
+
const request = parse(AppConnectionRequestInputSchema, input);
|
|
48
|
+
const response = await this.#client.denyAppConnectionRequest(request, toConnectCallOptions(options));
|
|
49
|
+
return parse(AppConnectionRequestRedirectSchema, response);
|
|
50
50
|
}
|
|
51
51
|
/** Lists the apps connected to the account, newest first; at most 20. */
|
|
52
52
|
async list(options) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connected-apps.js","names":["#client","Proto.ConnectedAppService"],"sources":["../../../src/services/connected-apps/connected-apps.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/connected_apps_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
|
|
1
|
+
{"version":3,"file":"connected-apps.js","names":["#client","Proto.ConnectedAppService"],"sources":["../../../src/services/connected-apps/connected-apps.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/connected_apps_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 AppConnectionRequestInputSchema,\n AppConnectionRequestRedirectSchema,\n AppConnectionRequestSchema,\n ConnectedAppsSchema,\n RevokeConnectedAppInputSchema,\n type AppConnectionRequest,\n type AppConnectionRequestInput,\n type AppConnectionRequestRedirect,\n type ConnectedApp,\n type RevokeConnectedAppInput,\n} from \"./connected-apps.schemas.js\";\n\n/**\n * Connects outside apps, such as an AI assistant, to the account with OAuth (\"Sign in with\n * Polyester\"), and lists and disconnects them. Session only: the website's consent page and\n * settings call these, and API keys are refused. A connected app uses the account as the\n * signed-in website does, for the scopes granted; it never moves money out of the account or\n * changes its security settings. A connection lasts until it is disconnected or expires; signing\n * out does not end it.\n */\nexport class ConnectedAppsService {\n #client: Client<typeof Proto.ConnectedAppService>;\n\n constructor(transports: AuthApiTransports) {\n this.#client = createClient(Proto.ConnectedAppService, transports.authApi);\n }\n\n /**\n * Reads a pending app connection request to show the consent page. An unknown, expired or\n * already answered request throws `ResourceNotFoundError`.\n */\n async getConnectionRequest(\n input: AppConnectionRequestInput,\n options?: PolyesterRequestOptions,\n ): Promise<AppConnectionRequest> {\n const request = parse(AppConnectionRequestInputSchema, input);\n const response = await this.#client.getAppConnectionRequest(\n request,\n toConnectCallOptions(options),\n );\n return parse(AppConnectionRequestSchema, response.connectionRequest);\n }\n\n /**\n * Approves a pending app connection request; send the browser to the returned `redirectUrl`,\n * which carries a one-time authorization code valid for 60 seconds. Needs MFA enrolled and a\n * fresh `stepUpToken`. An unknown, expired or already answered request throws\n * `ResourceNotFoundError`; an account with 20 connected apps throws `PreconditionFailedError`\n * (`AUTH_CONNECTED_APP_LIMIT_REACHED`).\n */\n async approveConnectionRequest(\n input: AppConnectionRequestInput,\n options?: PolyesterMutationOptions,\n ): Promise<AppConnectionRequestRedirect> {\n const request = parse(AppConnectionRequestInputSchema, input);\n const response = await this.#client.approveAppConnectionRequest(\n request,\n toConnectCallOptions(options),\n );\n return parse(AppConnectionRequestRedirectSchema, response);\n }\n\n /**\n * Denies a pending app connection request; send the browser to the returned `redirectUrl`,\n * which carries the `access_denied` error. An unknown, expired or already answered request\n * throws `ResourceNotFoundError`.\n */\n async denyConnectionRequest(\n input: AppConnectionRequestInput,\n options?: PolyesterRequestOptions,\n ): Promise<AppConnectionRequestRedirect> {\n const request = parse(AppConnectionRequestInputSchema, input);\n const response = await this.#client.denyAppConnectionRequest(\n request,\n toConnectCallOptions(options),\n );\n return parse(AppConnectionRequestRedirectSchema, response);\n }\n\n /** Lists the apps connected to the account, newest first; at most 20. */\n async list(options?: PolyesterRequestOptions): Promise<ConnectedApp[]> {\n const response = await this.#client.listConnectedApps({}, toConnectCallOptions(options));\n return parse(ConnectedAppsSchema, response.apps);\n }\n\n /**\n * Disconnects an app; its access and refresh tokens stop working at once. Disconnecting an\n * app already disconnected or expired succeeds; an ID that is not one of the account's\n * connected apps throws `ResourceNotFoundError`.\n */\n async revoke(input: RevokeConnectedAppInput, options?: PolyesterRequestOptions): Promise<void> {\n const request = parse(RevokeConnectedAppInputSchema, input);\n await this.#client.revokeConnectedApp(request, toConnectCallOptions(options));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AA8BA,IAAa,uBAAb,MAAkC;CAC9B;CAEA,YAAY,YAA+B;EACvC,KAAKA,UAAU,aAAaC,qBAA2B,WAAW,OAAO;CAC7E;;;;;CAMA,MAAM,qBACF,OACA,SAC6B;EAC7B,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKD,QAAQ,wBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,4BAA4B,SAAS,iBAAiB;CACvE;;;;;;;;CASA,MAAM,yBACF,OACA,SACqC;EACrC,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKA,QAAQ,4BAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,oCAAoC,QAAQ;CAC7D;;;;;;CAOA,MAAM,sBACF,OACA,SACqC;EACrC,MAAM,UAAU,MAAM,iCAAiC,KAAK;EAC5D,MAAM,WAAW,MAAM,KAAKA,QAAQ,yBAChC,SACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,oCAAoC,QAAQ;CAC7D;;CAGA,MAAM,KAAK,SAA4D;EACnE,MAAM,WAAW,MAAM,KAAKA,QAAQ,kBAAkB,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvF,OAAO,MAAM,qBAAqB,SAAS,IAAI;CACnD;;;;;;CAOA,MAAM,OAAO,OAAgC,SAAkD;EAC3F,MAAM,UAAU,MAAM,+BAA+B,KAAK;EAC1D,MAAM,KAAKA,QAAQ,mBAAmB,SAAS,qBAAqB,OAAO,CAAC;CAChF;AACJ"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as v from "valibot";
|
|
2
2
|
//#region src/services/connected-apps/connected-apps.schemas.d.ts
|
|
3
3
|
/** Selects a pending app connection request. */
|
|
4
|
-
declare const
|
|
4
|
+
declare const AppConnectionRequestInputSchema: v.StrictObjectSchema<{
|
|
5
5
|
/** The `request` query parameter the authorization endpoint gave the consent page. */
|
|
6
6
|
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
7
7
|
}, undefined>;
|
|
8
|
-
type
|
|
8
|
+
type AppConnectionRequestInput = v.InferInput<typeof AppConnectionRequestInputSchema>;
|
|
9
9
|
declare const RevokeConnectedAppInputSchema: v.StrictObjectSchema<{
|
|
10
10
|
/** `connectedAppId` from `connectedApps.list`. */
|
|
11
11
|
readonly connectedAppId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
|
|
@@ -18,7 +18,7 @@ declare const ConnectedAppClientSchema: v.ObjectSchema<{
|
|
|
18
18
|
}, undefined>;
|
|
19
19
|
type ConnectedAppClient = v.InferOutput<typeof ConnectedAppClientSchema>;
|
|
20
20
|
/** A pending request from an app to connect to the account. Times are epoch milliseconds. */
|
|
21
|
-
declare const
|
|
21
|
+
declare const AppConnectionRequestSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
22
22
|
readonly client: v.OptionalSchema<v.ObjectSchema<{
|
|
23
23
|
readonly clientId: v.StringSchema<undefined>;
|
|
24
24
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -59,7 +59,7 @@ declare const AppAuthorizationSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
59
59
|
/** After this the request can no longer be approved or denied. */
|
|
60
60
|
expiresAt: number | null;
|
|
61
61
|
}>]>;
|
|
62
|
-
type
|
|
62
|
+
type AppConnectionRequest = v.InferOutput<typeof AppConnectionRequestSchema>;
|
|
63
63
|
/** An app connected to the account. Times are epoch milliseconds. */
|
|
64
64
|
declare const ConnectedAppSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
65
65
|
readonly connectedAppId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
@@ -123,10 +123,10 @@ declare const ConnectedAppSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
123
123
|
}>]>;
|
|
124
124
|
type ConnectedApp = v.InferOutput<typeof ConnectedAppSchema>;
|
|
125
125
|
/** Where to send the browser to hand the app its answer. */
|
|
126
|
-
declare const
|
|
126
|
+
declare const AppConnectionRequestRedirectSchema: v.ObjectSchema<{
|
|
127
127
|
readonly redirectUrl: v.StringSchema<undefined>;
|
|
128
128
|
}, undefined>;
|
|
129
|
-
type
|
|
129
|
+
type AppConnectionRequestRedirect = v.InferOutput<typeof AppConnectionRequestRedirectSchema>;
|
|
130
130
|
//#endregion
|
|
131
|
-
export {
|
|
131
|
+
export { AppConnectionRequest, AppConnectionRequestInput, AppConnectionRequestInputSchema, AppConnectionRequestRedirect, AppConnectionRequestRedirectSchema, AppConnectionRequestSchema, ConnectedApp, ConnectedAppClient, ConnectedAppClientSchema, ConnectedAppSchema, RevokeConnectedAppInput, RevokeConnectedAppInputSchema };
|
|
132
132
|
//# sourceMappingURL=connected-apps.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connected-apps.schemas.d.ts","names":[],"sources":["../../../src/services/connected-apps/connected-apps.schemas.ts"],"mappings":";;;cAKa,
|
|
1
|
+
{"version":3,"file":"connected-apps.schemas.d.ts","names":[],"sources":["../../../src/services/connected-apps/connected-apps.schemas.ts"],"mappings":";;;cAKa,iCAA+B,EAAA;;;;KAKhC,4BAA4B,EAAE,kBAAkB;cAE/C,+BAA6B,EAAA;;;;KAK9B,0BAA0B,EAAE,kBAAkB;;cAG7C,0BAAwB,EAAA;;;;KAKzB,qBAAqB,EAAE,mBAAmB;;cAKzC,4BAA0B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqB3B,uBAAuB,EAAE,mBAAmB;;cAG3C,oBAAkB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0BnB,eAAe,EAAE,mBAAmB;;cAKnC,oCAAkC,EAAA;wBAAlC,EAAA;;KAED,+BAA+B,EAAE,mBAAmB"}
|
|
@@ -3,7 +3,7 @@ import { PositiveStringInputSchema } from "../shared.js";
|
|
|
3
3
|
import * as v from "valibot";
|
|
4
4
|
//#region src/services/connected-apps/connected-apps.schemas.ts
|
|
5
5
|
/** Selects a pending app connection request. */
|
|
6
|
-
const
|
|
6
|
+
const AppConnectionRequestInputSchema = v.strictObject({
|
|
7
7
|
/** The `request` query parameter the authorization endpoint gave the consent page. */
|
|
8
8
|
requestId: PositiveStringInputSchema });
|
|
9
9
|
const RevokeConnectedAppInputSchema = v.strictObject({
|
|
@@ -19,22 +19,22 @@ const ClientSchema = v.optional(ConnectedAppClientSchema, {
|
|
|
19
19
|
name: ""
|
|
20
20
|
});
|
|
21
21
|
/** A pending request from an app to connect to the account. Times are epoch milliseconds. */
|
|
22
|
-
const
|
|
22
|
+
const AppConnectionRequestSchema = v.pipe(v.object({
|
|
23
23
|
client: ClientSchema,
|
|
24
24
|
scopes: v.array(v.string()),
|
|
25
25
|
resource: v.string(),
|
|
26
26
|
redirectHost: v.string(),
|
|
27
27
|
expiresAt: OptionalTimestampMsSchema
|
|
28
|
-
}), v.transform((
|
|
29
|
-
client:
|
|
28
|
+
}), v.transform((request) => ({
|
|
29
|
+
client: request.client,
|
|
30
30
|
/** OAuth scopes the app asks for, e.g. `"account:read"`. */
|
|
31
|
-
scopes:
|
|
31
|
+
scopes: request.scopes,
|
|
32
32
|
/** Absolute URL of the server the app will use the account through. */
|
|
33
|
-
resource:
|
|
33
|
+
resource: request.resource,
|
|
34
34
|
/** Host the app receives the answer on. */
|
|
35
|
-
redirectHost:
|
|
35
|
+
redirectHost: request.redirectHost,
|
|
36
36
|
/** After this the request can no longer be approved or denied. */
|
|
37
|
-
expiresAt:
|
|
37
|
+
expiresAt: request.expiresAt ?? null
|
|
38
38
|
})));
|
|
39
39
|
/** An app connected to the account. Times are epoch milliseconds. */
|
|
40
40
|
const ConnectedAppSchema = v.pipe(v.object({
|
|
@@ -61,8 +61,8 @@ const ConnectedAppSchema = v.pipe(v.object({
|
|
|
61
61
|
})));
|
|
62
62
|
const ConnectedAppsSchema = v.array(ConnectedAppSchema);
|
|
63
63
|
/** Where to send the browser to hand the app its answer. */
|
|
64
|
-
const
|
|
64
|
+
const AppConnectionRequestRedirectSchema = v.object({ redirectUrl: v.string() });
|
|
65
65
|
//#endregion
|
|
66
|
-
export {
|
|
66
|
+
export { AppConnectionRequestInputSchema, AppConnectionRequestRedirectSchema, AppConnectionRequestSchema, ConnectedAppClientSchema, ConnectedAppSchema, ConnectedAppsSchema, RevokeConnectedAppInputSchema };
|
|
67
67
|
|
|
68
68
|
//# sourceMappingURL=connected-apps.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connected-apps.schemas.js","names":[],"sources":["../../../src/services/connected-apps/connected-apps.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { OptionalTimestampMsSchema, PublicIdSchema, idInputSchema } from \"../../shared/schemas.js\";\nimport { PositiveStringInputSchema } from \"../shared.js\";\n\n/** Selects a pending app connection request. */\nexport const
|
|
1
|
+
{"version":3,"file":"connected-apps.schemas.js","names":[],"sources":["../../../src/services/connected-apps/connected-apps.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { OptionalTimestampMsSchema, PublicIdSchema, idInputSchema } from \"../../shared/schemas.js\";\nimport { PositiveStringInputSchema } from \"../shared.js\";\n\n/** Selects a pending app connection request. */\nexport const AppConnectionRequestInputSchema = v.strictObject({\n /** The `request` query parameter the authorization endpoint gave the consent page. */\n requestId: PositiveStringInputSchema,\n});\n\nexport type AppConnectionRequestInput = v.InferInput<typeof AppConnectionRequestInputSchema>;\n\nexport const RevokeConnectedAppInputSchema = v.strictObject({\n /** `connectedAppId` from `connectedApps.list`. */\n connectedAppId: idInputSchema(\"connectedAppId\"),\n});\n\nexport type RevokeConnectedAppInput = v.InferInput<typeof RevokeConnectedAppInputSchema>;\n\n/** The OAuth client of an app, as it presents itself on the consent page. */\nexport const ConnectedAppClientSchema = v.object({\n clientId: v.string(),\n name: v.string(),\n});\n\nexport type ConnectedAppClient = v.InferOutput<typeof ConnectedAppClientSchema>;\n\nconst ClientSchema = v.optional(ConnectedAppClientSchema, { clientId: \"\", name: \"\" });\n\n/** A pending request from an app to connect to the account. Times are epoch milliseconds. */\nexport const AppConnectionRequestSchema = v.pipe(\n v.object({\n client: ClientSchema,\n scopes: v.array(v.string()),\n resource: v.string(),\n redirectHost: v.string(),\n expiresAt: OptionalTimestampMsSchema,\n }),\n v.transform((request) => ({\n client: request.client,\n /** OAuth scopes the app asks for, e.g. `\"account:read\"`. */\n scopes: request.scopes,\n /** Absolute URL of the server the app will use the account through. */\n resource: request.resource,\n /** Host the app receives the answer on. */\n redirectHost: request.redirectHost,\n /** After this the request can no longer be approved or denied. */\n expiresAt: request.expiresAt ?? null,\n })),\n);\n\nexport type AppConnectionRequest = v.InferOutput<typeof AppConnectionRequestSchema>;\n\n/** An app connected to the account. Times are epoch milliseconds. */\nexport const ConnectedAppSchema = v.pipe(\n v.object({\n connectedAppId: PublicIdSchema,\n client: ClientSchema,\n scopes: v.array(v.string()),\n resource: v.string(),\n connectedAt: OptionalTimestampMsSchema,\n lastUsedAt: OptionalTimestampMsSchema,\n expiresAt: OptionalTimestampMsSchema,\n }),\n v.transform((app) => ({\n /** Pass to `connectedApps.revoke`. */\n connectedAppId: app.connectedAppId,\n client: app.client,\n /** OAuth scopes the account granted the app. */\n scopes: app.scopes,\n /** Absolute URL of the server the app uses the account through. */\n resource: app.resource,\n connectedAt: app.connectedAt ?? null,\n /** Last use or refresh, at minute precision; null until the app first uses its access. */\n lastUsedAt: app.lastUsedAt ?? null,\n /** The connection ends then unless it is disconnected first. */\n expiresAt: app.expiresAt ?? null,\n })),\n);\n\nexport type ConnectedApp = v.InferOutput<typeof ConnectedAppSchema>;\n\nexport const ConnectedAppsSchema = v.array(ConnectedAppSchema);\n\n/** Where to send the browser to hand the app its answer. */\nexport const AppConnectionRequestRedirectSchema = v.object({ redirectUrl: v.string() });\n\nexport type AppConnectionRequestRedirect = v.InferOutput<typeof AppConnectionRequestRedirectSchema>;\n"],"mappings":";;;;;AAKA,MAAa,kCAAkC,EAAE,aAAa;;AAE1D,WAAW,0BACf,CAAC;AAID,MAAa,gCAAgC,EAAE,aAAa;;AAExD,gBAAgB,cAAc,gBAAgB,EAClD,CAAC;;AAKD,MAAa,2BAA2B,EAAE,OAAO;CAC7C,UAAU,EAAE,OAAO;CACnB,MAAM,EAAE,OAAO;AACnB,CAAC;AAID,MAAM,eAAe,EAAE,SAAS,0BAA0B;CAAE,UAAU;CAAI,MAAM;AAAG,CAAC;;AAGpF,MAAa,6BAA6B,EAAE,KACxC,EAAE,OAAO;CACL,QAAQ;CACR,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;CAC1B,UAAU,EAAE,OAAO;CACnB,cAAc,EAAE,OAAO;CACvB,WAAW;AACf,CAAC,GACD,EAAE,WAAW,aAAa;CACtB,QAAQ,QAAQ;;CAEhB,QAAQ,QAAQ;;CAEhB,UAAU,QAAQ;;CAElB,cAAc,QAAQ;;CAEtB,WAAW,QAAQ,aAAa;AACpC,EAAE,CACN;;AAKA,MAAa,qBAAqB,EAAE,KAChC,EAAE,OAAO;CACL,gBAAgB;CAChB,QAAQ;CACR,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC;CAC1B,UAAU,EAAE,OAAO;CACnB,aAAa;CACb,YAAY;CACZ,WAAW;AACf,CAAC,GACD,EAAE,WAAW,SAAS;;CAElB,gBAAgB,IAAI;CACpB,QAAQ,IAAI;;CAEZ,QAAQ,IAAI;;CAEZ,UAAU,IAAI;CACd,aAAa,IAAI,eAAe;;CAEhC,YAAY,IAAI,cAAc;;CAE9B,WAAW,IAAI,aAAa;AAChC,EAAE,CACN;AAIA,MAAa,sBAAsB,EAAE,MAAM,kBAAkB;;AAG7D,MAAa,qCAAqC,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type {
|
|
1
|
+
import { AppConnectionRequest, AppConnectionRequestInput, AppConnectionRequestRedirect, ConnectedApp, ConnectedAppClient, RevokeConnectedAppInput } from "./connected-apps.schemas.js";
|
|
2
|
+
export type { AppConnectionRequest, AppConnectionRequestInput, AppConnectionRequestRedirect, ConnectedApp, ConnectedAppClient, RevokeConnectedAppInput };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { DepositAddressService } from "../../gen/chain/deposit/v1/deposit_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
3
4
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
4
5
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
5
|
-
import { DepositAddressService } from "../../gen/chain/deposit/v1/deposit_pb.js";
|
|
6
6
|
import { CreateDepositAddressInputSchema, DepositAddressSchema, DepositAddressesSchema, ListDepositAddressesInputSchema } from "./deposit.schemas.js";
|
|
7
7
|
import { createClient } from "@connectrpc/connect";
|
|
8
8
|
//#region src/services/deposit/deposit.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { DustConversionService as DustConversionService$1 } from "../../gen/transfer/v1/dust_conversion_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
3
4
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
4
5
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
5
|
-
import { DustConversionService as DustConversionService$1 } from "../../gen/transfer/v1/dust_conversion_pb.js";
|
|
6
6
|
import { CreateDustConversionInputSchema, DustConversionQuoteSchema, DustConversionSchema, GetDustConversionInputSchema, ListDustBalancesInputSchema, ListDustBalancesResultSchema, ListDustConversionsInputSchema, ListDustConversionsResultSchema, QuoteDustConversionInputSchema } from "./dust-conversion.schemas.js";
|
|
7
7
|
import { createClient } from "@connectrpc/connect";
|
|
8
8
|
//#region src/services/dust-conversion/dust-conversion.ts
|