@polyester/sdk 0.32.2-devnet-20261102164441 → 0.32.2-devnet-20261103030350
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 +5 -1
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.js +1 -1
- package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +1 -1
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/mfa_pb.js +1 -1
- package/dist/gen/auth/v1/mfa_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +1 -1
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.js +1 -1
- package/dist/gen/auth/v1/profile_pb.js.map +1 -1
- package/dist/gen/auth/v1/resolve_pb.js +1 -1
- package/dist/gen/auth/v1/resolve_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/analytics/v1/analytics_read_pb.js +1 -1
- package/dist/gen/chain/analytics/v1/analytics_read_pb.js.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js.map +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.js +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js +1 -1
- package/dist/gen/chain/zipper/v1/zipper_pb.js.map +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js +1 -1
- package/dist/gen/changelog/v1/changelog_pb.js.map +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.js +1 -1
- package/dist/gen/checkpoints/v1/checkpoints_pb.js.map +1 -1
- package/dist/gen/claims/v1/claims_pb.js +1 -1
- package/dist/gen/claims/v1/claims_pb.js.map +1 -1
- package/dist/gen/fees/v1/fees_pb.js +1 -1
- package/dist/gen/fees/v1/fees_pb.js.map +1 -1
- package/dist/gen/index.js +2 -2
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +2 -2
- package/dist/gen/ledger/read/v1/ledger_read_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.js +1 -1
- package/dist/gen/marketdata/v1/heatmap_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.js +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +1 -1
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +9 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +10 -2
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/gen/polyester/api/options_pb.d.ts +11 -4
- package/dist/gen/polyester/api/options_pb.d.ts.map +1 -1
- package/dist/gen/polyester/api/options_pb.js +11 -3
- package/dist/gen/polyester/api/options_pb.js.map +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.js +1 -1
- package/dist/gen/ratelimit/v1/ratelimit_pb.js.map +1 -1
- package/dist/gen/rewards/v1/rewards_pb.js +1 -1
- package/dist/gen/rewards/v1/rewards_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/swap/v1/swap_pb.js +1 -1
- package/dist/gen/swap/v1/swap_pb.js.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +9 -0
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +10 -1
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/gen/vip/v1/vip_pb.js +1 -1
- package/dist/gen/vip/v1/vip_pb.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +19 -0
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js +61 -0
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.d.ts +40 -0
- package/dist/services/auto-withdraw/auto-withdraw.d.ts.map +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.js +82 -0
- package/dist/services/auto-withdraw/auto-withdraw.js.map +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +751 -0
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +238 -0
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.types.d.ts +3 -0
- package/dist/services/auto-withdraw/service.d.ts +8 -0
- package/dist/services/auto-withdraw/service.d.ts.map +1 -0
- package/dist/services/auto-withdraw/service.js +9 -0
- package/dist/services/auto-withdraw/service.js.map +1 -0
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +94 -94
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +5 -5
- package/dist/services/orders/orders-output.schemas.d.ts +8 -8
- package/dist/services/orders/orders.codecs.js +1 -0
- package/dist/services/orders/orders.codecs.js.map +1 -1
- package/dist/services/rewards/rewards.schemas.d.ts +3 -3
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +1 -1
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +7 -7
- package/dist/services/triggers/triggers.codecs.js +1 -0
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +2 -0
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-withdraw.schemas.d.ts","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"mappings":";;;;;;cAmDM,0BAAwB,EAAA;;;;;KAElB,0BAA0B,EAAE,kBAAkB;;;;;;;cAiC7C,iCAA+B,EAAA,yBAAA,EAAA,0BAAA,EAAA;;;;;;;;;;;;;;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,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAef,kBAAkB,EAAE,mBAAmB;cAEtC,kCAAgC,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAMjC,6BAA6B,EAAE,mBAAmB"}
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
import { ValidationError } from "../../shared/errors.js";
|
|
2
|
+
import { PROTOBUF_UINT32_MAX } from "../../shared/wire-bounds.js";
|
|
3
|
+
import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdOrEmptySchema, TimestampMsSchema, U128Schema } from "../../shared/schemas.js";
|
|
4
|
+
import { enumLabel, enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
5
|
+
import { decimalInputToScaled, scaledToDecimalOutput } from "../../shared/decimal-surface.js";
|
|
6
|
+
import { PositiveUint32InputSchema } from "../shared.js";
|
|
7
|
+
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
8
|
+
import "../../gen/chain/withdraw/v1/auto_withdraw_pb.js";
|
|
9
|
+
import { fromU128, toU128 } from "../../utils/u128.js";
|
|
10
|
+
import { AUTO_WITHDRAW_WEEKDAY_VALUES, AutoWithdrawCadenceCodec, AutoWithdrawRunStateCodec, AutoWithdrawStepStateCodec, AutoWithdrawWeekdayCodec } from "./auto-withdraw.codecs.js";
|
|
11
|
+
import * as v from "valibot";
|
|
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
|
+
function e18ToDecimal(value) {
|
|
21
|
+
return scaledToDecimalOutput(fromU128(value), 18);
|
|
22
|
+
}
|
|
23
|
+
const AccountScopedInputSchema = v.strictObject({ ...AccountScopeInputEntries });
|
|
24
|
+
const AutoWithdrawScopedInputSchema = v.pipe(AccountScopedInputSchema, v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })));
|
|
25
|
+
const Uint32InputSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX));
|
|
26
|
+
const MinuteOfDaySchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1439));
|
|
27
|
+
const MinuteOfHourSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(59));
|
|
28
|
+
const DayOfMonthSchema = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(31));
|
|
29
|
+
const WeekdaySchema = v.picklist(AUTO_WITHDRAW_WEEKDAY_VALUES);
|
|
30
|
+
const AnchorDateSchema = v.pipe(v.string(), v.trim(), v.isoDate("anchorDate must be a UTC date, YYYY-MM-DD"), v.check((date) => {
|
|
31
|
+
const parsed = /* @__PURE__ */ new Date(`${date}T00:00:00Z`);
|
|
32
|
+
return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(date);
|
|
33
|
+
}, "anchorDate must be a real calendar date"));
|
|
34
|
+
/**
|
|
35
|
+
* A rule's UTC run slot. Each cadence takes only its own fields; any other field is rejected.
|
|
36
|
+
* `minuteOfDay` is minutes after 00:00 UTC (0–1439), `minuteOfHour` 0–59, `dayOfMonth` 1–31
|
|
37
|
+
* (a shorter month runs on its last day), and `anchorDate` is a UTC date in a week a biweekly
|
|
38
|
+
* rule runs.
|
|
39
|
+
*/
|
|
40
|
+
const AutoWithdrawScheduleInputSchema = v.pipe(v.variant("cadence", [
|
|
41
|
+
v.strictObject({
|
|
42
|
+
cadence: v.literal("hourly"),
|
|
43
|
+
minuteOfHour: MinuteOfHourSchema
|
|
44
|
+
}),
|
|
45
|
+
v.strictObject({
|
|
46
|
+
cadence: v.literal("daily"),
|
|
47
|
+
minuteOfDay: MinuteOfDaySchema
|
|
48
|
+
}),
|
|
49
|
+
v.strictObject({
|
|
50
|
+
cadence: v.literal("weekly"),
|
|
51
|
+
weekday: WeekdaySchema,
|
|
52
|
+
minuteOfDay: MinuteOfDaySchema
|
|
53
|
+
}),
|
|
54
|
+
v.strictObject({
|
|
55
|
+
cadence: v.literal("biweekly"),
|
|
56
|
+
weekday: WeekdaySchema,
|
|
57
|
+
minuteOfDay: MinuteOfDaySchema,
|
|
58
|
+
anchorDate: AnchorDateSchema
|
|
59
|
+
}),
|
|
60
|
+
v.strictObject({
|
|
61
|
+
cadence: v.literal("monthly"),
|
|
62
|
+
dayOfMonth: DayOfMonthSchema,
|
|
63
|
+
minuteOfDay: MinuteOfDaySchema
|
|
64
|
+
})
|
|
65
|
+
]), v.transform((schedule) => ({
|
|
66
|
+
cadence: AutoWithdrawCadenceCodec.inputToProto[schedule.cadence],
|
|
67
|
+
weekday: "weekday" in schedule ? AutoWithdrawWeekdayCodec.inputToProto[schedule.weekday] : void 0,
|
|
68
|
+
minuteOfDay: "minuteOfDay" in schedule ? schedule.minuteOfDay : void 0,
|
|
69
|
+
minuteOfHour: "minuteOfHour" in schedule ? schedule.minuteOfHour : void 0,
|
|
70
|
+
dayOfMonth: "dayOfMonth" in schedule ? schedule.dayOfMonth : void 0,
|
|
71
|
+
anchorDate: "anchorDate" in schedule ? schedule.anchorDate : void 0
|
|
72
|
+
})));
|
|
73
|
+
/**
|
|
74
|
+
* One asset paid in kind to one whitelisted external-chain address. `minAmount` and
|
|
75
|
+
* `maxAmount` are decimal asset amounts (up to 18 decimals); a run pays the balance up to
|
|
76
|
+
* `maxAmount` once it reaches `minAmount`.
|
|
77
|
+
*/
|
|
78
|
+
const AutoWithdrawDestinationInputSchema = v.pipe(v.strictObject({
|
|
79
|
+
assetId: PositiveUint32InputSchema,
|
|
80
|
+
destinationChainId: v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(Number.MAX_SAFE_INTEGER)),
|
|
81
|
+
destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),
|
|
82
|
+
minAmount: v.string(),
|
|
83
|
+
maxAmount: v.string()
|
|
84
|
+
}), v.transform(({ minAmount, maxAmount, destinationChainId, ...destination }) => {
|
|
85
|
+
const min = decimalToE18("minAmount", minAmount);
|
|
86
|
+
const max = decimalToE18("maxAmount", maxAmount);
|
|
87
|
+
if (max === 0n || max < min) throw new ValidationError(`maxAmount must be greater than 0 and at least minAmount: ${maxAmount}`);
|
|
88
|
+
return {
|
|
89
|
+
...destination,
|
|
90
|
+
destinationChainId: BigInt(destinationChainId),
|
|
91
|
+
minAmountE18: toU128(min),
|
|
92
|
+
maxAmountE18: toU128(max)
|
|
93
|
+
};
|
|
94
|
+
}));
|
|
95
|
+
const SetAutoWithdrawRuleInputSchema = v.pipe(v.strictObject({
|
|
96
|
+
...AccountScopeInputEntries,
|
|
97
|
+
/** The version this change replaces: 0 when the account has no rule yet. */
|
|
98
|
+
expectedVersion: Uint32InputSchema,
|
|
99
|
+
schedule: AutoWithdrawScheduleInputSchema,
|
|
100
|
+
destinations: v.pipe(v.array(AutoWithdrawDestinationInputSchema), v.minLength(1, "At least one destination is required."), v.maxLength(32, "At most 32 destinations are allowed."), v.check((destinations) => new Set(destinations.map((d) => d.assetId)).size === destinations.length, "At most one destination per asset is allowed.")),
|
|
101
|
+
/** Least USD value one payout pays, as a decimal; omit or null for no USD minimum. */
|
|
102
|
+
minUsdValue: v.optional(v.nullable(v.string()))
|
|
103
|
+
}), v.transform(({ account, minUsdValue, ...input }) => ({
|
|
104
|
+
...input,
|
|
105
|
+
subaccountId: accountScopeToSubaccountId(account),
|
|
106
|
+
minUsdValueE18: minUsdValue == null ? void 0 : toU128(decimalToE18("minUsdValue", minUsdValue))
|
|
107
|
+
})));
|
|
108
|
+
const DisableAutoWithdrawRuleInputSchema = v.pipe(v.strictObject({
|
|
109
|
+
...AccountScopeInputEntries,
|
|
110
|
+
/** The account's latest rule version. */
|
|
111
|
+
expectedVersion: Uint32InputSchema
|
|
112
|
+
}), v.transform(({ account, expectedVersion }) => ({
|
|
113
|
+
subaccountId: accountScopeToSubaccountId(account),
|
|
114
|
+
expectedVersion
|
|
115
|
+
})));
|
|
116
|
+
/** `limit` is 0 through 100; 0 or omitted uses the server default of 20. */
|
|
117
|
+
const ListAutoWithdrawRunsInputSchema = v.pipe(v.strictObject({
|
|
118
|
+
...AccountScopeInputEntries,
|
|
119
|
+
limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), 0),
|
|
120
|
+
pageToken: v.optional(v.pipe(v.string(), v.trim()), "")
|
|
121
|
+
}), v.transform(({ account, ...input }) => ({
|
|
122
|
+
...input,
|
|
123
|
+
subaccountId: accountScopeToSubaccountId(account)
|
|
124
|
+
})));
|
|
125
|
+
const AutoWithdrawScheduleSchema = v.pipe(v.object({
|
|
126
|
+
cadence: v.optional(v.number(), 0),
|
|
127
|
+
weekday: v.optional(v.number(), 0),
|
|
128
|
+
minuteOfDay: v.optional(v.number(), 0),
|
|
129
|
+
minuteOfHour: v.optional(v.number(), 0),
|
|
130
|
+
dayOfMonth: v.optional(v.number(), 0),
|
|
131
|
+
anchorDate: v.optional(v.string(), "")
|
|
132
|
+
}), v.transform((s) => {
|
|
133
|
+
const weekday = enumLabel(AutoWithdrawWeekdayCodec.protoToOutput, s.weekday);
|
|
134
|
+
const { minuteOfDay } = s;
|
|
135
|
+
switch (s.cadence) {
|
|
136
|
+
case 3: return {
|
|
137
|
+
cadence: "hourly",
|
|
138
|
+
minuteOfHour: s.minuteOfHour
|
|
139
|
+
};
|
|
140
|
+
case 1: return {
|
|
141
|
+
cadence: "daily",
|
|
142
|
+
minuteOfDay
|
|
143
|
+
};
|
|
144
|
+
case 2: return {
|
|
145
|
+
cadence: "weekly",
|
|
146
|
+
weekday,
|
|
147
|
+
minuteOfDay
|
|
148
|
+
};
|
|
149
|
+
case 4: return {
|
|
150
|
+
cadence: "biweekly",
|
|
151
|
+
weekday,
|
|
152
|
+
minuteOfDay,
|
|
153
|
+
anchorDate: s.anchorDate
|
|
154
|
+
};
|
|
155
|
+
case 5: return {
|
|
156
|
+
cadence: "monthly",
|
|
157
|
+
dayOfMonth: s.dayOfMonth,
|
|
158
|
+
minuteOfDay
|
|
159
|
+
};
|
|
160
|
+
default: return { cadence: "unspecified" };
|
|
161
|
+
}
|
|
162
|
+
}));
|
|
163
|
+
function reasonSchema() {
|
|
164
|
+
return v.pipe(v.optional(v.string(), ""), v.transform((reason) => reason ? reason : null));
|
|
165
|
+
}
|
|
166
|
+
const AutoWithdrawDestinationSchema = v.pipe(v.object({
|
|
167
|
+
assetId: v.number(),
|
|
168
|
+
destinationChainId: v.bigint(),
|
|
169
|
+
destinationAddress: v.string(),
|
|
170
|
+
minAmountE18: v.optional(U128Schema),
|
|
171
|
+
maxAmountE18: v.optional(U128Schema)
|
|
172
|
+
}), v.transform(({ minAmountE18, maxAmountE18, destinationChainId, ...destination }) => ({
|
|
173
|
+
...destination,
|
|
174
|
+
destinationChainId: Number(destinationChainId),
|
|
175
|
+
minAmount: e18ToDecimal(minAmountE18),
|
|
176
|
+
maxAmount: e18ToDecimal(maxAmountE18)
|
|
177
|
+
})));
|
|
178
|
+
const AutoWithdrawPauseSchema = v.object({
|
|
179
|
+
assetId: v.number(),
|
|
180
|
+
reason: v.pipe(v.string(), v.transform((reason) => reason)),
|
|
181
|
+
pausedAt: TimestampMsSchema
|
|
182
|
+
});
|
|
183
|
+
const AutoWithdrawRuleSchema = v.pipe(v.object({
|
|
184
|
+
subaccountId: v.optional(PublicIdOrEmptySchema, 0n),
|
|
185
|
+
version: v.number(),
|
|
186
|
+
enabled: v.boolean(),
|
|
187
|
+
schedule: v.optional(AutoWithdrawScheduleSchema),
|
|
188
|
+
destinations: v.array(AutoWithdrawDestinationSchema),
|
|
189
|
+
createdAt: TimestampMsSchema,
|
|
190
|
+
pause: v.optional(AutoWithdrawPauseSchema),
|
|
191
|
+
minUsdValueE18: v.optional(U128Schema)
|
|
192
|
+
}), v.transform(({ schedule, pause, minUsdValueE18, ...rule }) => ({
|
|
193
|
+
...rule,
|
|
194
|
+
schedule: schedule ?? { cadence: "unspecified" },
|
|
195
|
+
pause: pause ?? null,
|
|
196
|
+
minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18)
|
|
197
|
+
})));
|
|
198
|
+
const AutoWithdrawStepSchema = v.pipe(v.object({
|
|
199
|
+
assetId: v.number(),
|
|
200
|
+
destinationChainId: v.bigint(),
|
|
201
|
+
destinationAddress: v.string(),
|
|
202
|
+
availableE18: v.optional(U128Schema),
|
|
203
|
+
amountE18: v.optional(U128Schema),
|
|
204
|
+
valueUsdE18: v.optional(U128Schema),
|
|
205
|
+
state: enumLabelSchema(AutoWithdrawStepStateCodec.protoToOutput),
|
|
206
|
+
reason: reasonSchema(),
|
|
207
|
+
intentId: v.optional(v.string(), ""),
|
|
208
|
+
txHash: v.optional(v.string(), "")
|
|
209
|
+
}), v.transform(({ availableE18, amountE18, valueUsdE18, destinationChainId, intentId, txHash, ...step }) => ({
|
|
210
|
+
...step,
|
|
211
|
+
destinationChainId: Number(destinationChainId),
|
|
212
|
+
available: e18ToDecimal(availableE18),
|
|
213
|
+
amount: e18ToDecimal(amountE18),
|
|
214
|
+
valueUsd: valueUsdE18 ? e18ToDecimal(valueUsdE18) : null,
|
|
215
|
+
intentId: intentId || null,
|
|
216
|
+
txHash: txHash || null
|
|
217
|
+
})));
|
|
218
|
+
const AutoWithdrawRunSchema = v.pipe(v.object({
|
|
219
|
+
runSeq: BigIntStringSchema,
|
|
220
|
+
ruleVersion: v.number(),
|
|
221
|
+
scheduledFor: TimestampMsSchema,
|
|
222
|
+
state: enumLabelSchema(AutoWithdrawRunStateCodec.protoToOutput),
|
|
223
|
+
reason: reasonSchema(),
|
|
224
|
+
steps: v.array(AutoWithdrawStepSchema),
|
|
225
|
+
createdAt: TimestampMsSchema,
|
|
226
|
+
finishedAt: OptionalTimestampMsSchema
|
|
227
|
+
}), v.transform(({ finishedAt, ...run }) => ({
|
|
228
|
+
...run,
|
|
229
|
+
finishedAt: finishedAt ?? null
|
|
230
|
+
})));
|
|
231
|
+
const ListAutoWithdrawRunsResultSchema = v.object({
|
|
232
|
+
runs: v.array(AutoWithdrawRunSchema),
|
|
233
|
+
nextPageToken: v.optional(v.string(), "")
|
|
234
|
+
});
|
|
235
|
+
//#endregion
|
|
236
|
+
export { AutoWithdrawRuleSchema, AutoWithdrawScheduleInputSchema, AutoWithdrawScopedInputSchema, DisableAutoWithdrawRuleInputSchema, ListAutoWithdrawRunsInputSchema, ListAutoWithdrawRunsResultSchema, SetAutoWithdrawRuleInputSchema };
|
|
237
|
+
|
|
238
|
+
//# sourceMappingURL=auto-withdraw.schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auto-withdraw.schemas.js","names":[],"sources":["../../../src/services/auto-withdraw/auto-withdraw.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as Proto from \"../../gen/chain/withdraw/v1/auto_withdraw_pb.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport {\n decimalInputToScaled,\n E18_SCALE,\n scaledToDecimalOutput,\n} from \"../../shared/decimal-surface.js\";\nimport { ValidationError } from \"../../shared/errors.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdOrEmptySchema,\n TimestampMsSchema,\n U128Schema,\n} from \"../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../shared/wire-bounds.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport {\n AUTO_WITHDRAW_WEEKDAY_VALUES,\n AutoWithdrawCadenceCodec,\n AutoWithdrawRunStateCodec,\n AutoWithdrawStepStateCodec,\n AutoWithdrawWeekdayCodec,\n type AutoWithdrawPauseReason,\n type AutoWithdrawRunReason,\n type AutoWithdrawStepReason,\n type AutoWithdrawWeekday,\n} from \"./auto-withdraw.codecs.js\";\n\nconst U128_MAX = (1n << 128n) - 1n;\n\n/** Decimal string → 18-decimal U128 integer, exact; throws `ValidationError`. */\nfunction decimalToE18(field: string, value: string): bigint {\n const scaled = decimalInputToScaled(field, value, E18_SCALE);\n if (scaled > U128_MAX) {\n throw new ValidationError(`${field} exceeds the maximum supported value: ${value}`);\n }\n return scaled;\n}\n\nfunction e18ToDecimal(value: v.InferOutput<typeof U128Schema> | undefined): string {\n return scaledToDecimalOutput(fromU128(value), E18_SCALE);\n}\n\nconst AccountScopedInputSchema = v.strictObject({ ...AccountScopeInputEntries });\n\nexport type AutoWithdrawScopedInput = v.InferInput<typeof AccountScopedInputSchema>;\n\nexport const AutoWithdrawScopedInputSchema = v.pipe(\n AccountScopedInputSchema,\n v.transform(({ account }) => ({ subaccountId: accountScopeToSubaccountId(account) })),\n);\n\nconst Uint32InputSchema = v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(PROTOBUF_UINT32_MAX),\n);\nconst MinuteOfDaySchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(1439));\nconst MinuteOfHourSchema = v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(59));\nconst DayOfMonthSchema = v.pipe(v.number(), v.integer(), v.minValue(1), v.maxValue(31));\nconst WeekdaySchema = v.picklist(AUTO_WITHDRAW_WEEKDAY_VALUES);\nconst AnchorDateSchema = v.pipe(\n v.string(),\n v.trim(),\n v.isoDate(\"anchorDate must be a UTC date, YYYY-MM-DD\"),\n v.check((date) => {\n const parsed = new Date(`${date}T00:00:00Z`);\n return !Number.isNaN(parsed.getTime()) && parsed.toISOString().startsWith(date);\n }, \"anchorDate must be a real calendar date\"),\n);\n\n/**\n * A rule's UTC run slot. Each cadence takes only its own fields; any other field is rejected.\n * `minuteOfDay` is minutes after 00:00 UTC (0–1439), `minuteOfHour` 0–59, `dayOfMonth` 1–31\n * (a shorter month runs on its last day), and `anchorDate` is a UTC date in a week a biweekly\n * rule runs.\n */\nexport const AutoWithdrawScheduleInputSchema = v.pipe(\n v.variant(\"cadence\", [\n v.strictObject({ cadence: v.literal(\"hourly\"), minuteOfHour: MinuteOfHourSchema }),\n v.strictObject({ cadence: v.literal(\"daily\"), minuteOfDay: MinuteOfDaySchema }),\n v.strictObject({\n cadence: v.literal(\"weekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n v.strictObject({\n cadence: v.literal(\"biweekly\"),\n weekday: WeekdaySchema,\n minuteOfDay: MinuteOfDaySchema,\n anchorDate: AnchorDateSchema,\n }),\n v.strictObject({\n cadence: v.literal(\"monthly\"),\n dayOfMonth: DayOfMonthSchema,\n minuteOfDay: MinuteOfDaySchema,\n }),\n ]),\n v.transform((schedule) => ({\n cadence: AutoWithdrawCadenceCodec.inputToProto[schedule.cadence],\n weekday:\n \"weekday\" in schedule\n ? AutoWithdrawWeekdayCodec.inputToProto[schedule.weekday]\n : undefined,\n minuteOfDay: \"minuteOfDay\" in schedule ? schedule.minuteOfDay : undefined,\n minuteOfHour: \"minuteOfHour\" in schedule ? schedule.minuteOfHour : undefined,\n dayOfMonth: \"dayOfMonth\" in schedule ? schedule.dayOfMonth : undefined,\n anchorDate: \"anchorDate\" in schedule ? schedule.anchorDate : undefined,\n })),\n);\n\nexport type AutoWithdrawScheduleInput = v.InferInput<typeof AutoWithdrawScheduleInputSchema>;\n\n/**\n * One asset paid in kind to one whitelisted external-chain address. `minAmount` and\n * `maxAmount` are decimal asset amounts (up to 18 decimals); a run pays the balance up to\n * `maxAmount` once it reaches `minAmount`.\n */\nconst AutoWithdrawDestinationInputSchema = v.pipe(\n v.strictObject({\n assetId: PositiveUint32InputSchema,\n destinationChainId: v.pipe(\n v.number(),\n v.integer(),\n v.gtValue(0),\n v.maxValue(Number.MAX_SAFE_INTEGER),\n ),\n destinationAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n minAmount: v.string(),\n maxAmount: v.string(),\n }),\n v.transform(({ minAmount, maxAmount, destinationChainId, ...destination }) => {\n const min = decimalToE18(\"minAmount\", minAmount);\n const max = decimalToE18(\"maxAmount\", maxAmount);\n if (max === 0n || max < min) {\n throw new ValidationError(\n `maxAmount must be greater than 0 and at least minAmount: ${maxAmount}`,\n );\n }\n return {\n ...destination,\n destinationChainId: BigInt(destinationChainId),\n minAmountE18: toU128(min),\n maxAmountE18: toU128(max),\n };\n }),\n);\n\nexport type AutoWithdrawDestinationInput = v.InferInput<typeof AutoWithdrawDestinationInputSchema>;\n\nexport const SetAutoWithdrawRuleInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The version this change replaces: 0 when the account has no rule yet. */\n expectedVersion: Uint32InputSchema,\n schedule: AutoWithdrawScheduleInputSchema,\n destinations: v.pipe(\n v.array(AutoWithdrawDestinationInputSchema),\n v.minLength(1, \"At least one destination is required.\"),\n v.maxLength(32, \"At most 32 destinations are allowed.\"),\n v.check(\n (destinations) =>\n new Set(destinations.map((d) => d.assetId)).size === destinations.length,\n \"At most one destination per asset is allowed.\",\n ),\n ),\n /** Least USD value one payout pays, as a decimal; omit or null for no USD minimum. */\n minUsdValue: v.optional(v.nullable(v.string())),\n }),\n v.transform(({ account, minUsdValue, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n minUsdValueE18:\n minUsdValue == null ? undefined : toU128(decimalToE18(\"minUsdValue\", minUsdValue)),\n })),\n);\n\nexport type SetAutoWithdrawRuleInput = v.InferInput<typeof SetAutoWithdrawRuleInputSchema>;\n\nexport const DisableAutoWithdrawRuleInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n /** The account's latest rule version. */\n expectedVersion: Uint32InputSchema,\n }),\n v.transform(({ account, expectedVersion }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n expectedVersion,\n })),\n);\n\nexport type DisableAutoWithdrawRuleInput = v.InferInput<typeof DisableAutoWithdrawRuleInputSchema>;\n\n/** `limit` is 0 through 100; 0 or omitted uses the server default of 20. */\nexport const ListAutoWithdrawRunsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(100)), 0),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ListAutoWithdrawRunsInput = v.InferInput<typeof ListAutoWithdrawRunsInputSchema>;\n\ntype ScheduleShape<Weekday> =\n | { cadence: \"hourly\"; minuteOfHour: number }\n | { cadence: \"daily\"; minuteOfDay: number }\n | { cadence: \"weekly\"; weekday: Weekday; minuteOfDay: number }\n | { cadence: \"biweekly\"; weekday: Weekday; minuteOfDay: number; anchorDate: string }\n | { cadence: \"monthly\"; dayOfMonth: number; minuteOfDay: number };\n\n/** A decoded schedule. A cadence this SDK build does not know decodes as `\"unspecified\"`. */\nexport type AutoWithdrawSchedule =\n | ScheduleShape<DecodedEnum<AutoWithdrawWeekday>>\n | { cadence: \"unspecified\" };\n\nconst AutoWithdrawScheduleSchema = v.pipe(\n v.object({\n cadence: v.optional(v.number(), 0),\n weekday: v.optional(v.number(), 0),\n minuteOfDay: v.optional(v.number(), 0),\n minuteOfHour: v.optional(v.number(), 0),\n dayOfMonth: v.optional(v.number(), 0),\n anchorDate: v.optional(v.string(), \"\"),\n }),\n v.transform((s): AutoWithdrawSchedule => {\n const weekday = enumLabel(AutoWithdrawWeekdayCodec.protoToOutput, s.weekday);\n const { minuteOfDay } = s;\n switch (s.cadence) {\n case Proto.AutoWithdrawCadence.HOURLY:\n return { cadence: \"hourly\", minuteOfHour: s.minuteOfHour };\n case Proto.AutoWithdrawCadence.DAILY:\n return { cadence: \"daily\", minuteOfDay };\n case Proto.AutoWithdrawCadence.WEEKLY:\n return { cadence: \"weekly\", weekday, minuteOfDay };\n case Proto.AutoWithdrawCadence.BIWEEKLY:\n return { cadence: \"biweekly\", weekday, minuteOfDay, anchorDate: s.anchorDate };\n case Proto.AutoWithdrawCadence.MONTHLY:\n return { cadence: \"monthly\", dayOfMonth: s.dayOfMonth, minuteOfDay };\n default:\n return { cadence: \"unspecified\" };\n }\n }),\n);\n\nfunction reasonSchema<TReason extends string>() {\n return v.pipe(\n v.optional(v.string(), \"\"),\n v.transform((reason) => (reason ? (reason as TReason) : null)),\n );\n}\n\nconst AutoWithdrawDestinationSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n minAmountE18: v.optional(U128Schema),\n maxAmountE18: v.optional(U128Schema),\n }),\n v.transform(({ minAmountE18, maxAmountE18, destinationChainId, ...destination }) => ({\n ...destination,\n destinationChainId: Number(destinationChainId),\n minAmount: e18ToDecimal(minAmountE18),\n maxAmount: e18ToDecimal(maxAmountE18),\n })),\n);\n\nexport type AutoWithdrawDestination = v.InferOutput<typeof AutoWithdrawDestinationSchema>;\n\nconst AutoWithdrawPauseSchema = v.object({\n assetId: v.number(),\n reason: v.pipe(\n v.string(),\n v.transform((reason) => reason as AutoWithdrawPauseReason),\n ),\n pausedAt: TimestampMsSchema,\n});\n\nexport type AutoWithdrawPause = v.InferOutput<typeof AutoWithdrawPauseSchema>;\n\nexport const AutoWithdrawRuleSchema = v.pipe(\n v.object({\n subaccountId: v.optional(PublicIdOrEmptySchema, 0n),\n version: v.number(),\n enabled: v.boolean(),\n schedule: v.optional(AutoWithdrawScheduleSchema),\n destinations: v.array(AutoWithdrawDestinationSchema),\n createdAt: TimestampMsSchema,\n pause: v.optional(AutoWithdrawPauseSchema),\n minUsdValueE18: v.optional(U128Schema),\n }),\n v.transform(({ schedule, pause, minUsdValueE18, ...rule }) => ({\n ...rule,\n schedule: schedule ?? ({ cadence: \"unspecified\" } as AutoWithdrawSchedule),\n pause: pause ?? null,\n minUsdValue: fromU128(minUsdValueE18) === 0n ? null : e18ToDecimal(minUsdValueE18),\n })),\n);\n\n/**\n * One version of an account's rule. `subaccountId` is the public subaccount ID, `\"\"` for the\n * root account. Times are epoch milliseconds. `minUsdValue` is null when the rule has no USD\n * minimum; `pause` is set when the rule paused itself, and a new version resumes it.\n */\nexport type AutoWithdrawRule = v.InferOutput<typeof AutoWithdrawRuleSchema>;\n\nconst AutoWithdrawStepSchema = v.pipe(\n v.object({\n assetId: v.number(),\n destinationChainId: v.bigint(),\n destinationAddress: v.string(),\n availableE18: v.optional(U128Schema),\n amountE18: v.optional(U128Schema),\n valueUsdE18: v.optional(U128Schema),\n state: enumLabelSchema(AutoWithdrawStepStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawStepReason>(),\n intentId: v.optional(v.string(), \"\"),\n txHash: v.optional(v.string(), \"\"),\n }),\n v.transform(\n ({\n availableE18,\n amountE18,\n valueUsdE18,\n destinationChainId,\n intentId,\n txHash,\n ...step\n }) => ({\n ...step,\n destinationChainId: Number(destinationChainId),\n available: e18ToDecimal(availableE18),\n amount: e18ToDecimal(amountE18),\n valueUsd: valueUsdE18 ? e18ToDecimal(valueUsdE18) : null,\n intentId: intentId || null,\n txHash: txHash || null,\n }),\n ),\n);\n\n/**\n * One asset's payout in a run. `available`, `amount` and `valueUsd` are decimal strings;\n * `valueUsd` is null when the rule has no USD minimum or no price was available.\n */\nexport type AutoWithdrawStep = v.InferOutput<typeof AutoWithdrawStepSchema>;\n\nconst AutoWithdrawRunSchema = v.pipe(\n v.object({\n runSeq: BigIntStringSchema,\n ruleVersion: v.number(),\n scheduledFor: TimestampMsSchema,\n state: enumLabelSchema(AutoWithdrawRunStateCodec.protoToOutput),\n reason: reasonSchema<AutoWithdrawRunReason>(),\n steps: v.array(AutoWithdrawStepSchema),\n createdAt: TimestampMsSchema,\n finishedAt: OptionalTimestampMsSchema,\n }),\n v.transform(({ finishedAt, ...run }) => ({ ...run, finishedAt: finishedAt ?? null })),\n);\n\n/** One scheduled run. Times are epoch milliseconds; `finishedAt` is null while in progress. */\nexport type AutoWithdrawRun = v.InferOutput<typeof AutoWithdrawRunSchema>;\n\nexport const ListAutoWithdrawRunsResultSchema = v.object({\n runs: v.array(AutoWithdrawRunSchema),\n nextPageToken: v.optional(v.string(), \"\"),\n});\n\n/** One page of runs, newest first. An empty `nextPageToken` means no more runs. */\nexport type ListAutoWithdrawRunsResult = v.InferOutput<typeof ListAutoWithdrawRunsResultSchema>;\n"],"mappings":";;;;;;;;;;;;AAoCA,MAAM,YAAY,MAAM,QAAQ;;AAGhC,SAAS,aAAa,OAAe,OAAuB;CACxD,MAAM,SAAS,qBAAqB,OAAO,OAAA,EAAgB;CAC3D,IAAI,SAAS,UACT,MAAM,IAAI,gBAAgB,GAAG,MAAM,wCAAwC,OAAO;CAEtF,OAAO;AACX;AAEA,SAAS,aAAa,OAA6D;CAC/E,OAAO,sBAAsB,SAAS,KAAK,GAAA,EAAY;AAC3D;AAEA,MAAM,2BAA2B,EAAE,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,C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,3 @@
|
|
|
1
|
+
import { AutoWithdrawCadence, AutoWithdrawPauseReason, AutoWithdrawRunReason, AutoWithdrawRunState, AutoWithdrawStepReason, AutoWithdrawStepState, AutoWithdrawWeekday } from "./auto-withdraw.codecs.js";
|
|
2
|
+
import { AutoWithdrawDestination, AutoWithdrawDestinationInput, AutoWithdrawPause, AutoWithdrawRule, AutoWithdrawRun, AutoWithdrawSchedule, AutoWithdrawScheduleInput, AutoWithdrawScopedInput, AutoWithdrawStep, DisableAutoWithdrawRuleInput, ListAutoWithdrawRunsInput, ListAutoWithdrawRunsResult, SetAutoWithdrawRuleInput } from "./auto-withdraw.schemas.js";
|
|
3
|
+
export type { AutoWithdrawCadence, AutoWithdrawDestination, AutoWithdrawDestinationInput, AutoWithdrawPause, AutoWithdrawPauseReason, AutoWithdrawRule, AutoWithdrawRun, AutoWithdrawRunReason, AutoWithdrawRunState, AutoWithdrawSchedule, AutoWithdrawScheduleInput, AutoWithdrawScopedInput, AutoWithdrawStep, AutoWithdrawStepReason, AutoWithdrawStepState, AutoWithdrawWeekday, DisableAutoWithdrawRuleInput, ListAutoWithdrawRunsInput, ListAutoWithdrawRunsResult, SetAutoWithdrawRuleInput };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AutoWithdrawService } from "./auto-withdraw.js";
|
|
2
|
+
import { PolyesterCore } from "../../core-client.js";
|
|
3
|
+
//#region src/services/auto-withdraw/service.d.ts
|
|
4
|
+
/** Returns the client's AutoWithdrawService, creating it on first use. */
|
|
5
|
+
declare const autoWithdrawService: (client: PolyesterCore) => AutoWithdrawService;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { autoWithdrawService };
|
|
8
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","names":[],"sources":["../../../src/services/auto-withdraw/service.ts"],"mappings":";;;;cAIa,sBAAmB,QAAnB,kBAAmB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineService } from "../../core-client.js";
|
|
2
|
+
import { AutoWithdrawService } from "./auto-withdraw.js";
|
|
3
|
+
//#region src/services/auto-withdraw/service.ts
|
|
4
|
+
/** Returns the client's AutoWithdrawService, creating it on first use. */
|
|
5
|
+
const autoWithdrawService = defineService((context) => new AutoWithdrawService(context.transports, context.resolver));
|
|
6
|
+
//#endregion
|
|
7
|
+
export { autoWithdrawService };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","names":[],"sources":["../../../src/services/auto-withdraw/service.ts"],"sourcesContent":["import { defineService } from \"../../core-client.js\";\nimport { AutoWithdrawService } from \"./auto-withdraw.js\";\n\n/** Returns the client's AutoWithdrawService, creating it on first use. */\nexport const autoWithdrawService = defineService(\n (context) => new AutoWithdrawService(context.transports, context.resolver),\n);\n"],"mappings":";;;;AAIA,MAAa,sBAAsB,eAC9B,YAAY,IAAI,oBAAoB,QAAQ,YAAY,QAAQ,QAAQ,CAC7E"}
|
|
@@ -421,7 +421,7 @@ declare const CheckpointSchema: v.ObjectSchema<{
|
|
|
421
421
|
readonly seasonResultUsd: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, undefined>]>, undefined>;
|
|
422
422
|
readonly subaccounts: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.MaxValueAction<bigint, bigint, undefined>, v.TransformAction<any, number>]>;
|
|
423
423
|
/** Values computed from partial evidence; show them with an approximation marker. */
|
|
424
|
-
readonly incomplete: v.OptionalSchema<v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
424
|
+
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 []>;
|
|
425
425
|
}, undefined>;
|
|
426
426
|
/**
|
|
427
427
|
* One frozen season recap of a root account and all of its subaccounts. An absent USD value
|
|
@@ -14,7 +14,7 @@ type TimestampInit = {
|
|
|
14
14
|
declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
15
15
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
16
16
|
readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1s" | "1m" | "5m" | "1h", HeatmapInterval>]>;
|
|
17
|
-
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 5 | 10 | 20 | 100 | 500 |
|
|
17
|
+
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<1 | 5 | 10 | 20 | 100 | 500 | 1000 | 50 | 200, HeatmapDepth>]>;
|
|
18
18
|
readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
|
|
19
19
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>;
|
|
20
20
|
readonly startTsSec: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
|
|
@@ -227,7 +227,7 @@ type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
|
|
|
227
227
|
declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
228
228
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
229
229
|
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
|
|
230
|
-
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 | "unspecified" | 5 | 10 | 20 | 100 | 500 |
|
|
230
|
+
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 1 | "unspecified" | 5 | 10 | 20 | 100 | 500 | 1000 | 50 | 200>]>;
|
|
231
231
|
readonly chain: v.OptionalSchema<v.ObjectSchema<{
|
|
232
232
|
readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
|
|
233
233
|
readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
@@ -287,7 +287,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
287
287
|
}, undefined>, v.TransformAction<{
|
|
288
288
|
symbolId: number;
|
|
289
289
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
290
|
-
depth: 1 | "unspecified" | 5 | 10 | 20 | 100 | 500 |
|
|
290
|
+
depth: 1 | "unspecified" | 5 | 10 | 20 | 100 | 500 | 1000 | 50 | 200;
|
|
291
291
|
chain?: {
|
|
292
292
|
baseKeyframe?: {
|
|
293
293
|
tsSec: number;
|
|
@@ -347,7 +347,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
347
347
|
}, {
|
|
348
348
|
symbolId: number;
|
|
349
349
|
interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
|
|
350
|
-
depth: 1 | "unspecified" | 5 | 10 | 20 | 100 | 500 |
|
|
350
|
+
depth: 1 | "unspecified" | 5 | 10 | 20 | 100 | 500 | 1000 | 50 | 200;
|
|
351
351
|
chain: {
|
|
352
352
|
baseKeyframe: {
|
|
353
353
|
tsSec: number;
|