@symmio/trading-react 4.4.0 → 4.5.0
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/dist/account-layer/automatic-timelock-attempt.d.ts +11 -0
- package/dist/account-layer/automatic-timelock-attempt.d.ts.map +1 -0
- package/dist/account-layer/automatic-timelock-attempt.js +41 -0
- package/dist/account-layer/automatic-timelock-attempt.js.map +1 -0
- package/dist/account-layer/index.d.ts +9 -0
- package/dist/account-layer/index.d.ts.map +1 -1
- package/dist/account-layer/index.js +41 -32
- package/dist/account-layer/use-active-virtual-account-by-key.d.ts +33 -0
- package/dist/account-layer/use-active-virtual-account-by-key.d.ts.map +1 -0
- package/dist/account-layer/use-active-virtual-account-by-key.js +27 -0
- package/dist/account-layer/use-active-virtual-account-by-key.js.map +1 -0
- package/dist/account-layer/use-add-margin.d.ts +2 -2
- package/dist/account-layer/use-add-margin.d.ts.map +1 -1
- package/dist/account-layer/use-add-margin.js +28 -17
- package/dist/account-layer/use-add-margin.js.map +1 -1
- package/dist/account-layer/use-allocate.d.ts +2 -2
- package/dist/account-layer/use-allocate.d.ts.map +1 -1
- package/dist/account-layer/use-allocate.js +28 -17
- package/dist/account-layer/use-allocate.js.map +1 -1
- package/dist/account-layer/use-automatic-timelock-recovery.d.ts +25 -0
- package/dist/account-layer/use-automatic-timelock-recovery.d.ts.map +1 -0
- package/dist/account-layer/use-automatic-timelock-recovery.js +26 -0
- package/dist/account-layer/use-automatic-timelock-recovery.js.map +1 -0
- package/dist/account-layer/use-automatic-timelock.d.ts +48 -0
- package/dist/account-layer/use-automatic-timelock.d.ts.map +1 -0
- package/dist/account-layer/use-automatic-timelock.js +189 -0
- package/dist/account-layer/use-automatic-timelock.js.map +1 -0
- package/dist/account-layer/use-create-sub-accounts.d.ts +9 -4
- package/dist/account-layer/use-create-sub-accounts.d.ts.map +1 -1
- package/dist/account-layer/use-create-sub-accounts.js +11 -13
- package/dist/account-layer/use-create-sub-accounts.js.map +1 -1
- package/dist/account-layer/use-deallocate-and-initiate-withdraw.d.ts +3 -3
- package/dist/account-layer/use-deallocate-and-initiate-withdraw.d.ts.map +1 -1
- package/dist/account-layer/use-deallocate-and-initiate-withdraw.js +32 -21
- package/dist/account-layer/use-deallocate-and-initiate-withdraw.js.map +1 -1
- package/dist/account-layer/use-deallocate.d.ts +6 -5
- package/dist/account-layer/use-deallocate.d.ts.map +1 -1
- package/dist/account-layer/use-deallocate.js +33 -20
- package/dist/account-layer/use-deallocate.js.map +1 -1
- package/dist/account-layer/use-delete-sub-account.d.ts +2 -2
- package/dist/account-layer/use-delete-sub-account.d.ts.map +1 -1
- package/dist/account-layer/use-delete-sub-account.js +30 -19
- package/dist/account-layer/use-delete-sub-account.js.map +1 -1
- package/dist/account-layer/use-execute-account-calls.d.ts +7 -0
- package/dist/account-layer/use-execute-account-calls.d.ts.map +1 -0
- package/dist/account-layer/use-execute-account-calls.js +54 -0
- package/dist/account-layer/use-execute-account-calls.js.map +1 -0
- package/dist/account-layer/use-protected-function.d.ts +22 -0
- package/dist/account-layer/use-protected-function.d.ts.map +1 -0
- package/dist/account-layer/use-protected-function.js +68 -0
- package/dist/account-layer/use-protected-function.js.map +1 -0
- package/dist/account-layer/use-remove-margin.d.ts +2 -2
- package/dist/account-layer/use-remove-margin.d.ts.map +1 -1
- package/dist/account-layer/use-remove-margin.js +31 -20
- package/dist/account-layer/use-remove-margin.js.map +1 -1
- package/dist/account-layer/use-timelock-policy.d.ts +21 -0
- package/dist/account-layer/use-timelock-policy.d.ts.map +1 -0
- package/dist/account-layer/use-timelock-policy.js +112 -0
- package/dist/account-layer/use-timelock-policy.js.map +1 -0
- package/dist/account-layer/use-timelock-route.d.ts +75 -0
- package/dist/account-layer/use-timelock-route.d.ts.map +1 -0
- package/dist/account-layer/use-timelock-route.js +177 -0
- package/dist/account-layer/use-timelock-route.js.map +1 -0
- package/dist/account-layer/use-timelock.d.ts +102 -0
- package/dist/account-layer/use-timelock.d.ts.map +1 -0
- package/dist/account-layer/use-timelock.js +177 -0
- package/dist/account-layer/use-timelock.js.map +1 -0
- package/dist/account-layer/use-virtual-accounts-count-of-sub-account.d.ts +24 -0
- package/dist/account-layer/use-virtual-accounts-count-of-sub-account.d.ts.map +1 -0
- package/dist/account-layer/use-virtual-accounts-count-of-sub-account.js +27 -0
- package/dist/account-layer/use-virtual-accounts-count-of-sub-account.js.map +1 -0
- package/dist/account-layer/use-virtual-accounts-of-sub-account.d.ts +25 -0
- package/dist/account-layer/use-virtual-accounts-of-sub-account.d.ts.map +1 -0
- package/dist/account-layer/use-virtual-accounts-of-sub-account.js +27 -0
- package/dist/account-layer/use-virtual-accounts-of-sub-account.js.map +1 -0
- package/dist/errors/normalize-protected-write-error.d.ts +5 -0
- package/dist/errors/normalize-protected-write-error.d.ts.map +1 -0
- package/dist/errors/normalize-protected-write-error.js +43 -0
- package/dist/errors/normalize-protected-write-error.js.map +1 -0
- package/dist/errors/normalize-symm-error.d.ts.map +1 -1
- package/dist/errors/normalize-symm-error.js +56 -43
- package/dist/errors/normalize-symm-error.js.map +1 -1
- package/dist/errors/symmio-request-error.d.ts +5 -0
- package/dist/errors/symmio-request-error.d.ts.map +1 -1
- package/dist/errors/symmio-request-error.js +2 -1
- package/dist/errors/symmio-request-error.js.map +1 -1
- package/dist/gasless/index.d.ts +1 -0
- package/dist/gasless/index.d.ts.map +1 -1
- package/dist/gasless/index.js +20 -19
- package/dist/gasless/invalidate-relay-reads.d.ts +3 -1
- package/dist/gasless/invalidate-relay-reads.d.ts.map +1 -1
- package/dist/gasless/invalidate-relay-reads.js +115 -60
- package/dist/gasless/invalidate-relay-reads.js.map +1 -1
- package/dist/gasless/use-approve-operational-fee-allowance.d.ts +37 -0
- package/dist/gasless/use-approve-operational-fee-allowance.d.ts.map +1 -0
- package/dist/gasless/use-approve-operational-fee-allowance.js +48 -0
- package/dist/gasless/use-approve-operational-fee-allowance.js.map +1 -0
- package/dist/gasless/use-approve-operational-fee.d.ts +2 -2
- package/dist/gasless/use-approve-operational-fee.d.ts.map +1 -1
- package/dist/gasless/use-approve-operational-fee.js +28 -17
- package/dist/gasless/use-approve-operational-fee.js.map +1 -1
- package/dist/gasless/use-relay-gasless-batch.d.ts +5 -4
- package/dist/gasless/use-relay-gasless-batch.d.ts.map +1 -1
- package/dist/gasless/use-relay-gasless-batch.js.map +1 -1
- package/dist/index.d.ts +13 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +271 -256
- package/dist/instant-layer/index.d.ts +2 -0
- package/dist/instant-layer/index.d.ts.map +1 -1
- package/dist/instant-layer/index.js +25 -23
- package/dist/instant-layer/invalidate-delegation-grant.d.ts +17 -0
- package/dist/instant-layer/invalidate-delegation-grant.d.ts.map +1 -0
- package/dist/instant-layer/invalidate-delegation-grant.js +26 -0
- package/dist/instant-layer/invalidate-delegation-grant.js.map +1 -0
- package/dist/instant-layer/use-grant-delegation.d.ts +3 -1
- package/dist/instant-layer/use-grant-delegation.d.ts.map +1 -1
- package/dist/instant-layer/use-grant-delegation.js +19 -28
- package/dist/instant-layer/use-grant-delegation.js.map +1 -1
- package/dist/instant-layer/use-grant-delegations.d.ts +44 -0
- package/dist/instant-layer/use-grant-delegations.d.ts.map +1 -0
- package/dist/instant-layer/use-grant-delegations.js +36 -0
- package/dist/instant-layer/use-grant-delegations.js.map +1 -0
- package/dist/instant-layer/use-instant-close-fees.js +8 -8
- package/dist/instant-layer/use-instant-open-inputs.js +8 -8
- package/dist/instant-layer/use-session-key-selectors.d.ts +5 -2
- package/dist/instant-layer/use-session-key-selectors.d.ts.map +1 -1
- package/dist/instant-layer/use-session-key-selectors.js +9 -5
- package/dist/instant-layer/use-session-key-selectors.js.map +1 -1
- package/dist/instant-layer/use-simulate-grant-delegations.d.ts +25 -0
- package/dist/instant-layer/use-simulate-grant-delegations.d.ts.map +1 -0
- package/dist/instant-layer/use-simulate-grant-delegations.js +29 -0
- package/dist/instant-layer/use-simulate-grant-delegations.js.map +1 -0
- package/dist/provider/symmio-provider.d.ts +31 -4
- package/dist/provider/symmio-provider.d.ts.map +1 -1
- package/dist/provider/symmio-provider.js +12 -11
- package/dist/provider/symmio-provider.js.map +1 -1
- package/dist/solvers/timelock-capability-cache.d.ts +9 -0
- package/dist/solvers/timelock-capability-cache.d.ts.map +1 -0
- package/dist/solvers/timelock-capability-cache.js +79 -0
- package/dist/solvers/timelock-capability-cache.js.map +1 -0
- package/dist/solvers/use-solver-info.d.ts +5 -2
- package/dist/solvers/use-solver-info.d.ts.map +1 -1
- package/dist/solvers/use-solver-info.js +35 -11
- package/dist/solvers/use-solver-info.js.map +1 -1
- package/dist/transactions/write-types.d.ts +13 -1
- package/dist/transactions/write-types.d.ts.map +1 -1
- package/dist/withdraw/index.d.ts +3 -0
- package/dist/withdraw/index.d.ts.map +1 -1
- package/dist/withdraw/use-deallocate-debounce-time.d.ts +29 -0
- package/dist/withdraw/use-deallocate-debounce-time.d.ts.map +1 -0
- package/dist/withdraw/use-deallocate-debounce-time.js +27 -0
- package/dist/withdraw/use-deallocate-debounce-time.js.map +1 -0
- package/dist/withdraw/use-finalize-withdraw-request.d.ts.map +1 -1
- package/dist/withdraw/use-finalize-withdraw-request.js +13 -12
- package/dist/withdraw/use-finalize-withdraw-request.js.map +1 -1
- package/dist/withdraw/use-initiate-withdraw.d.ts +2 -2
- package/dist/withdraw/use-initiate-withdraw.d.ts.map +1 -1
- package/dist/withdraw/use-initiate-withdraw.js +29 -17
- package/dist/withdraw/use-initiate-withdraw.js.map +1 -1
- package/dist/withdraw/use-pending-withdraw-requests-batch.d.ts +19 -0
- package/dist/withdraw/use-pending-withdraw-requests-batch.d.ts.map +1 -0
- package/dist/withdraw/use-pending-withdraw-requests-batch.js +27 -0
- package/dist/withdraw/use-pending-withdraw-requests-batch.js.map +1 -0
- package/dist/withdraw/use-request-cancel-withdraw.d.ts.map +1 -1
- package/dist/withdraw/use-request-cancel-withdraw.js +14 -13
- package/dist/withdraw/use-request-cancel-withdraw.js.map +1 -1
- package/dist/withdraw/use-withdraw-cooldown-of.d.ts +33 -0
- package/dist/withdraw/use-withdraw-cooldown-of.d.ts.map +1 -0
- package/dist/withdraw/use-withdraw-cooldown-of.js +27 -0
- package/dist/withdraw/use-withdraw-cooldown-of.js.map +1 -0
- package/dist/withdraw/use-withdraw.d.ts +3 -3
- package/dist/withdraw/use-withdraw.d.ts.map +1 -1
- package/dist/withdraw/use-withdraw.js +57 -31
- package/dist/withdraw/use-withdraw.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { resolveWriteResult as r } from "../transactions/resolve-write-result.js";
|
|
6
|
+
import { normalizeProtectedWriteError as i } from "../errors/normalize-protected-write-error.js";
|
|
7
|
+
import { predicateMatch as a } from "../utils/predicate-match.js";
|
|
8
|
+
import { refreshTimelockInfoAfterUnavailable as o } from "../solvers/timelock-capability-cache.js";
|
|
9
|
+
import { invalidateTimelockExecutionReads as s } from "../gasless/invalidate-relay-reads.js";
|
|
10
|
+
import { INSTANT_OPEN_TIMELOCK_ACCOUNT_LAYER_FUNCTIONS as c, INSTANT_OPEN_TIMELOCK_CORE_FUNCTIONS as l, INSTANT_OPEN_TIMELOCK_SELECTORS as u, cancelTimelockOpMutationOptions as d, clearTimelocksMutationOptions as f, createHttpTimelockApprovalProvider as p, encodeTimelockedCoreCall as m, executeProtectedCallMutationOptions as h, executeTimelockOpMutationOptions as g, getSelectorTimelockQueryKey as _, getSelectorTimelockQueryOptions as v, getTimelockPolicyQueryKey as y, getTimelockScheduleStateQueryKey as b, getTimelockScheduleStateQueryOptions as x, matchesScheduledCall as S, requestTimelockApprovalMutationOptions as C, scheduleTimelockOpMutationOptions as w, setupTimelocksMutationOptions as T } from "@symmio/trading-core";
|
|
11
|
+
import { useMemo as E } from "react";
|
|
12
|
+
import { useMutation as D, useQuery as O, useQueryClient as k } from "@tanstack/react-query";
|
|
13
|
+
//#region src/account-layer/use-timelock.ts
|
|
14
|
+
function A(e) {
|
|
15
|
+
let t = [...l, ...c].indexOf(e);
|
|
16
|
+
return t < 0 ? void 0 : u[t];
|
|
17
|
+
}
|
|
18
|
+
function j(e, t, n) {
|
|
19
|
+
return S(e, t, n);
|
|
20
|
+
}
|
|
21
|
+
function M(n = {}) {
|
|
22
|
+
let r = t(n), i = e(), a = k(), s = n.chainId ?? i, c = r.getSolver({
|
|
23
|
+
chainId: s,
|
|
24
|
+
solverId: n.solverId
|
|
25
|
+
});
|
|
26
|
+
return E(() => {
|
|
27
|
+
let e = p({ baseUrl: c.url });
|
|
28
|
+
return { async requestApproval(t, n) {
|
|
29
|
+
try {
|
|
30
|
+
return await e.requestApproval(t, n);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
throw o(a, r, s, c.id, e), e;
|
|
33
|
+
}
|
|
34
|
+
} };
|
|
35
|
+
}, [
|
|
36
|
+
r,
|
|
37
|
+
a,
|
|
38
|
+
s,
|
|
39
|
+
c.id,
|
|
40
|
+
c.url
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
function N(n = {}) {
|
|
44
|
+
let a = t(n), o = e(), c = k(), l = h(a);
|
|
45
|
+
return D({
|
|
46
|
+
mutationKey: l.mutationKey,
|
|
47
|
+
retry: !1,
|
|
48
|
+
mutationFn: async (e) => {
|
|
49
|
+
try {
|
|
50
|
+
let t = e.chainId ?? o;
|
|
51
|
+
return await r(a, await l.mutationFn({
|
|
52
|
+
...e,
|
|
53
|
+
chainId: t
|
|
54
|
+
}), {
|
|
55
|
+
chainId: t,
|
|
56
|
+
waitForReceipt: n.waitForReceipt,
|
|
57
|
+
confirmations: n.confirmations
|
|
58
|
+
});
|
|
59
|
+
} catch (t) {
|
|
60
|
+
throw i(t, e.timelock);
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
onSuccess: (e, t) => {
|
|
64
|
+
if (!e.receipt) return;
|
|
65
|
+
let n = t.target === "core" ? m(t.account, t.callData) : t.callData;
|
|
66
|
+
s(c, { configKey: a.getChainConfigKey(t.chainId ?? o) }, n);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
function P(i, o, c) {
|
|
71
|
+
let l = t(o), u = e(), d = k(), f = i(l);
|
|
72
|
+
return D({
|
|
73
|
+
mutationKey: f.mutationKey,
|
|
74
|
+
retry: !1,
|
|
75
|
+
mutationFn: async (e) => {
|
|
76
|
+
try {
|
|
77
|
+
let t = e.chainId ?? u;
|
|
78
|
+
return await r(l, await f.mutationFn({
|
|
79
|
+
...e,
|
|
80
|
+
chainId: t
|
|
81
|
+
}), {
|
|
82
|
+
chainId: t,
|
|
83
|
+
waitForReceipt: o.waitForReceipt,
|
|
84
|
+
confirmations: o.confirmations
|
|
85
|
+
});
|
|
86
|
+
} catch (e) {
|
|
87
|
+
throw n(e);
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
onSuccess: (e, t) => {
|
|
91
|
+
if (!e.receipt) return;
|
|
92
|
+
let n = { configKey: l.getChainConfigKey(t.chainId ?? u) }, r = "account" in t ? t.account : void 0;
|
|
93
|
+
if (c === "policy") {
|
|
94
|
+
d.invalidateQueries({ predicate: a(y, n) }), d.invalidateQueries({ predicate: a(_, {
|
|
95
|
+
...n,
|
|
96
|
+
account: r
|
|
97
|
+
}) }), d.invalidateQueries({ predicate: a(b, {
|
|
98
|
+
...n,
|
|
99
|
+
account: r
|
|
100
|
+
}) });
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
d.invalidateQueries({ predicate: a(b, {
|
|
104
|
+
...n,
|
|
105
|
+
account: r
|
|
106
|
+
}) }), c === "execution" && t.innerCallData && s(d, n, t.innerCallData);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function F(e = {}) {
|
|
111
|
+
return P(T, e, "policy");
|
|
112
|
+
}
|
|
113
|
+
function I(e = {}) {
|
|
114
|
+
return P(f, e, "policy");
|
|
115
|
+
}
|
|
116
|
+
function L(e = {}) {
|
|
117
|
+
return P(w, e, "schedule");
|
|
118
|
+
}
|
|
119
|
+
function R(e = {}) {
|
|
120
|
+
return P(d, e, "schedule");
|
|
121
|
+
}
|
|
122
|
+
function z(e = {}) {
|
|
123
|
+
return P(g, e, "execution");
|
|
124
|
+
}
|
|
125
|
+
function B(r = {}) {
|
|
126
|
+
let i = t(r), a = e(), o = C(i);
|
|
127
|
+
return D({
|
|
128
|
+
mutationKey: o.mutationKey,
|
|
129
|
+
retry: !1,
|
|
130
|
+
mutationFn: async (e) => {
|
|
131
|
+
try {
|
|
132
|
+
return await o.mutationFn({
|
|
133
|
+
...e,
|
|
134
|
+
chainId: e.chainId ?? a
|
|
135
|
+
});
|
|
136
|
+
} catch (e) {
|
|
137
|
+
throw n(e);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function V(r) {
|
|
143
|
+
let i = t(r), a = e(), o = v(i, {
|
|
144
|
+
...r,
|
|
145
|
+
chainId: r.chainId ?? a
|
|
146
|
+
});
|
|
147
|
+
return O({
|
|
148
|
+
...o,
|
|
149
|
+
queryFn: async () => {
|
|
150
|
+
try {
|
|
151
|
+
return await o.queryFn();
|
|
152
|
+
} catch (e) {
|
|
153
|
+
throw n(e);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
function H(r) {
|
|
159
|
+
let i = t(r), a = e(), o = x(i, {
|
|
160
|
+
...r,
|
|
161
|
+
chainId: r.chainId ?? a
|
|
162
|
+
});
|
|
163
|
+
return O({
|
|
164
|
+
...o,
|
|
165
|
+
queryFn: async () => {
|
|
166
|
+
try {
|
|
167
|
+
return await o.queryFn();
|
|
168
|
+
} catch (e) {
|
|
169
|
+
throw n(e);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
//#endregion
|
|
175
|
+
export { R as useCancelTimelockOp, I as useClearTimelocks, z as useExecuteTimelockOp, N as useProtectedCall, B as useRequestTimelockApproval, L as useScheduleTimelockOp, j as useScheduledCallMatch, V as useSelectorTimelock, F as useSetupTimelocks, M as useTimelockApprovalProvider, H as useTimelockScheduleState, A as useTimelockSelector };
|
|
176
|
+
|
|
177
|
+
//# sourceMappingURL=use-timelock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-timelock.js","names":[],"sources":["../../src/account-layer/use-timelock.ts"],"sourcesContent":["\"use client\";\n\nimport {\n cancelTimelockOpMutationOptions,\n clearTimelocksMutationOptions,\n createHttpTimelockApprovalProvider,\n encodeTimelockedCoreCall,\n executeProtectedCallMutationOptions,\n executeTimelockOpMutationOptions,\n getSelectorTimelockQueryKey,\n getSelectorTimelockQueryOptions,\n getTimelockPolicyQueryKey,\n getTimelockScheduleStateQueryKey,\n getTimelockScheduleStateQueryOptions,\n INSTANT_OPEN_TIMELOCK_ACCOUNT_LAYER_FUNCTIONS,\n INSTANT_OPEN_TIMELOCK_CORE_FUNCTIONS,\n INSTANT_OPEN_TIMELOCK_SELECTORS,\n matchesScheduledCall,\n requestTimelockApprovalMutationOptions,\n scheduleTimelockOpMutationOptions,\n setupTimelocksMutationOptions,\n type CancelTimelockOpParameters,\n type ClearTimelocksParameters,\n type Config,\n type ConfigParameter,\n type ExecuteProtectedCallParameters,\n type ExecuteTimelockOpParameters,\n type GetSelectorTimelockOptions,\n type GetTimelockScheduleStateOptions,\n type RequestTimelockApprovalParameters,\n type ScheduleTimelockOpParameters,\n type SelectorTimelock,\n type SetupTimelocksParameters,\n type SolverId,\n type TimelockScheduleState,\n type ValidatedTimelockApproval,\n} from \"@symmio/trading-core\";\nimport {\n useMutation,\n useQuery,\n useQueryClient,\n type UseMutationResult,\n type UseQueryResult,\n} from \"@tanstack/react-query\";\nimport { useMemo } from \"react\";\nimport type { Address, Hex } from \"viem\";\nimport { normalizeProtectedWriteError } from \"../errors/normalize-protected-write-error\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { invalidateTimelockExecutionReads } from \"../gasless/invalidate-relay-reads\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\nimport { refreshTimelockInfoAfterUnavailable } from \"../solvers/timelock-capability-cache\";\nimport { resolveWriteResult, type WriteParameters, type WriteResult } from \"../transactions\";\nimport { predicateMatch } from \"../utils/predicate-match\";\n\ntype TimelockMutationFactory<T> = (config: Config) => {\n mutationKey: readonly string[];\n mutationFn: (variables: T) => Promise<`0x${string}`>;\n};\n\n/** Select a supported policy selector by its ABI function name. */\nexport function useTimelockSelector(name: string): Hex | undefined {\n const names: readonly string[] = [\n ...INSTANT_OPEN_TIMELOCK_CORE_FUNCTIONS,\n ...INSTANT_OPEN_TIMELOCK_ACCOUNT_LAYER_FUNCTIONS,\n ];\n const index = names.indexOf(name);\n return index < 0 ? undefined : INSTANT_OPEN_TIMELOCK_SELECTORS[index];\n}\n\n/** Check whether an execution payload matches a single scheduled raw call. */\nexport function useScheduledCallMatch(account: Address, rawCallData: Hex, innerCallData: Hex): boolean {\n return matchesScheduledCall(account, rawCallData, innerCallData);\n}\n\n/** Create the standard approval transport for the selected solver. */\nexport function useTimelockApprovalProvider(\n parameters: ConfigParameter & { chainId?: number; solverId?: SolverId } = {},\n) {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const resolvedChainId = parameters.chainId ?? chainId;\n const solver = config.getSolver({ chainId: resolvedChainId, solverId: parameters.solverId });\n return useMemo(() => {\n const provider = createHttpTimelockApprovalProvider({ baseUrl: solver.url });\n return {\n async requestApproval(\n request: Parameters<typeof provider.requestApproval>[0],\n options?: Parameters<typeof provider.requestApproval>[1],\n ) {\n try {\n return await provider.requestApproval(request, options);\n } catch (error) {\n void refreshTimelockInfoAfterUnavailable(queryClient, config, resolvedChainId, solver.id, error);\n throw error;\n }\n },\n };\n }, [config, queryClient, resolvedChainId, solver.id, solver.url]);\n}\n\n/** Execute one exact protected call and refresh affected reads after confirmation. */\nexport function useProtectedCall(\n parameters: WriteParameters = {},\n): UseMutationResult<WriteResult, SymmioRequestError, ExecuteProtectedCallParameters> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = executeProtectedCallMutationOptions(config);\n return useMutation({\n mutationKey: base.mutationKey,\n retry: false,\n mutationFn: async (variables) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({ ...variables, chainId: resolvedChainId });\n return await resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (error) {\n throw normalizeProtectedWriteError(error, variables.timelock);\n }\n },\n onSuccess: (result, variables) => {\n if (!result.receipt) return;\n const inner =\n variables.target === \"core\"\n ? encodeTimelockedCoreCall(variables.account, variables.callData)\n : variables.callData;\n invalidateTimelockExecutionReads(\n queryClient,\n { configKey: config.getChainConfigKey(variables.chainId ?? chainId) },\n inner,\n );\n },\n });\n}\n\nfunction useTimelockMutation<T extends { chainId?: number; innerCallData?: Hex }>(\n factory: TimelockMutationFactory<T>,\n parameters: WriteParameters,\n invalidate: \"policy\" | \"schedule\" | \"execution\",\n): UseMutationResult<WriteResult, SymmioRequestError, T> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const queryClient = useQueryClient();\n const base = factory(config);\n return useMutation({\n mutationKey: base.mutationKey,\n retry: false,\n mutationFn: async (variables: T) => {\n try {\n const resolvedChainId = variables.chainId ?? chainId;\n const hash = await base.mutationFn({ ...variables, chainId: resolvedChainId });\n return await resolveWriteResult(config, hash, {\n chainId: resolvedChainId,\n waitForReceipt: parameters.waitForReceipt,\n confirmations: parameters.confirmations,\n });\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n onSuccess: (result, variables) => {\n if (!result.receipt) return;\n const scope = { configKey: config.getChainConfigKey(variables.chainId ?? chainId) };\n const account = \"account\" in variables ? (variables.account as `0x${string}`) : undefined;\n if (invalidate === \"policy\") {\n // A policy is shared by the root and all virtual accounts.\n void queryClient.invalidateQueries({ predicate: predicateMatch(getTimelockPolicyQueryKey, scope) });\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getSelectorTimelockQueryKey, { ...scope, account }),\n });\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getTimelockScheduleStateQueryKey, { ...scope, account }),\n });\n return;\n }\n void queryClient.invalidateQueries({\n predicate: predicateMatch(getTimelockScheduleStateQueryKey, { ...scope, account }),\n });\n if (invalidate !== \"execution\") return;\n\n if (variables.innerCallData) {\n invalidateTimelockExecutionReads(queryClient, scope, variables.innerCallData);\n }\n },\n });\n}\n\n/**\n * Configure root-account timelock policy and refresh policy-derived reads after confirmation.\n *\n * @param parameters - Receipt waiting and optional config controls.\n * @returns A mutation whose variables match `setupTimelocks`.\n *\n * @example\n * ```tsx\n * const setup = useSetupTimelocks();\n * setup.mutate({ account: root, unlocker, delay: 600n, selectors, gasless: true });\n * ```\n */\nexport function useSetupTimelocks(\n parameters: WriteParameters = {},\n): UseMutationResult<WriteResult, SymmioRequestError, SetupTimelocksParameters> {\n return useTimelockMutation(setupTimelocksMutationOptions, parameters, \"policy\");\n}\n\n/**\n * Remove selector policies from a root account.\n *\n * @param parameters - Receipt waiting and optional config controls.\n * @returns A mutation whose variables match `clearTimelocks`.\n */\nexport function useClearTimelocks(\n parameters: WriteParameters = {},\n): UseMutationResult<WriteResult, SymmioRequestError, ClearTimelocksParameters> {\n return useTimelockMutation(clearTimelocksMutationOptions, parameters, \"policy\");\n}\n\n/**\n * Schedule raw operation calldata for delayed fallback execution.\n *\n * @param parameters - Receipt waiting and optional config controls.\n * @returns A mutation whose variables include the root account and exact raw calldata.\n */\nexport function useScheduleTimelockOp(\n parameters: WriteParameters = {},\n): UseMutationResult<WriteResult, SymmioRequestError, ScheduleTimelockOpParameters> {\n return useTimelockMutation(scheduleTimelockOpMutationOptions, parameters, \"schedule\");\n}\n\n/**\n * Cancel a pending fallback schedule before execution.\n *\n * @param parameters - Receipt waiting and optional config controls.\n * @returns A mutation that accepts the same root account and raw calldata used to schedule.\n */\nexport function useCancelTimelockOp(\n parameters: WriteParameters = {},\n): UseMutationResult<WriteResult, SymmioRequestError, CancelTimelockOpParameters> {\n return useTimelockMutation(cancelTimelockOpMutationOptions, parameters, \"schedule\");\n}\n\n/**\n * Execute a timelocked AccountLayer call with an approval or mature schedule.\n * After confirmation, refresh the inner operation's affected reads, including\n * account lists and details for `deleteSubAccount`. No approval is requested automatically.\n *\n * @param parameters - Receipt waiting and optional config controls.\n * @returns A mutation whose variables carry inner AccountLayer calldata and optional approvals.\n */\nexport function useExecuteTimelockOp(\n parameters: WriteParameters = {},\n): UseMutationResult<WriteResult, SymmioRequestError, ExecuteTimelockOpParameters> {\n return useTimelockMutation(executeTimelockOpMutationOptions, parameters, \"execution\");\n}\n\n/**\n * Request one public approval. Automatic mutation retries are always disabled.\n *\n * @param parameters - Optional SDK config override.\n * @returns A mutation returning a validated signed approval and the prepared request.\n *\n * @example\n * ```tsx\n * const approval = useRequestTimelockApproval();\n * approval.mutate({ provider, capability, account, rootAccount, callData, deadline });\n * ```\n */\nexport function useRequestTimelockApproval(\n parameters: ConfigParameter = {},\n): UseMutationResult<ValidatedTimelockApproval, SymmioRequestError, RequestTimelockApprovalParameters> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const base = requestTimelockApprovalMutationOptions(config);\n return useMutation({\n mutationKey: base.mutationKey,\n retry: false,\n mutationFn: async (variables) => {\n try {\n return await base.mutationFn({ ...variables, chainId: variables.chainId ?? chainId });\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n });\n}\n\n/** Required selector-policy query inputs plus React config overrides. */\nexport type UseSelectorTimelockParameters = GetSelectorTimelockOptions & ConfigParameter;\n\n/**\n * Read the unlocker and delay configured for one root-account selector.\n *\n * @param parameters - Root account, selector, optional chain, and TanStack query controls.\n * @returns A TanStack query result containing the selector policy.\n */\nexport function useSelectorTimelock(\n parameters: UseSelectorTimelockParameters,\n): UseQueryResult<SelectorTimelock, SymmioRequestError> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getSelectorTimelockQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n }) as UseQueryResult<SelectorTimelock, SymmioRequestError>;\n}\n\n/** Required schedule-state query inputs plus React config overrides. */\nexport type UseTimelockScheduleStateParameters = GetTimelockScheduleStateOptions & ConfigParameter;\n\n/**\n * Read a fallback schedule and its derived ready/expiry timestamps.\n *\n * @param parameters - Root account, exact raw calldata, optional selector calldata, and query controls.\n * @returns A TanStack query result containing schedule state and policy timing.\n *\n * @example\n * ```tsx\n * const schedule = useTimelockScheduleState({ account: root, callData: rawWithdrawCall });\n * ```\n */\nexport function useTimelockScheduleState(\n parameters: UseTimelockScheduleStateParameters,\n): UseQueryResult<TimelockScheduleState, SymmioRequestError> {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getTimelockScheduleStateQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n }) as UseQueryResult<TimelockScheduleState, SymmioRequestError>;\n}\n"],"mappings":";;;;;;;;;;;;;AA8DA,SAAgB,EAAoB,GAA+B;CAKjE,IAAM,IAAQ,CAHZ,GAAG,GACH,GAAG,CAES,EAAM,QAAQ,CAAI;CAChC,OAAO,IAAQ,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AAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAO;IACd,MAAM,EAAmB,CAAK;GAChC;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ConfigParameter, GetVirtualAccountsCountOfSubAccountOptions, GetVirtualAccountsCountOfSubAccountReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useVirtualAccountsCountOfSubAccount}: the core query
|
|
6
|
+
* options (subAccount, chain id, TanStack `query` overrides) plus an
|
|
7
|
+
* optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseVirtualAccountsCountOfSubAccountParameters = GetVirtualAccountsCountOfSubAccountOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useVirtualAccountsCountOfSubAccount}. */
|
|
11
|
+
export type UseVirtualAccountsCountOfSubAccountReturnType = UseQueryResult<GetVirtualAccountsCountOfSubAccountReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* Read how many Virtual Accounts (VAs) a subaccount holds — for paging the VA
|
|
14
|
+
* lists past their default limit of 200. The query is disabled until
|
|
15
|
+
* `subAccount` is set. `chainId` defaults to the connected chain. Errors are
|
|
16
|
+
* normalized to {@link SymmioRequestError}.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* const { data: count } = useVirtualAccountsCountOfSubAccount({ subAccount: "0xsub…", chainId });
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export declare function useVirtualAccountsCountOfSubAccount(parameters?: UseVirtualAccountsCountOfSubAccountParameters): UseVirtualAccountsCountOfSubAccountReturnType;
|
|
24
|
+
//# sourceMappingURL=use-virtual-accounts-count-of-sub-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-virtual-accounts-count-of-sub-account.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-virtual-accounts-count-of-sub-account.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,0CAA0C,EAC/C,KAAK,6CAA6C,EACnD,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;;GAIG;AACH,MAAM,MAAM,6CAA6C,GAAG,0CAA0C,GACpG,eAAe,CAAC;AAElB,kEAAkE;AAClE,MAAM,MAAM,6CAA6C,GAAG,cAAc,CACxE,6CAA6C,EAC7C,kBAAkB,CACnB,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,mCAAmC,CACjD,UAAU,GAAE,6CAAkD,GAC7D,6CAA6C,CAkB/C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { getVirtualAccountsCountOfSubAccountQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/account-layer/use-virtual-accounts-count-of-sub-account.ts
|
|
8
|
+
function a(a = {}) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s
|
|
12
|
+
});
|
|
13
|
+
return i({
|
|
14
|
+
...c,
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await c.queryFn();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw n(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as useVirtualAccountsCountOfSubAccount };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-virtual-accounts-count-of-sub-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-virtual-accounts-count-of-sub-account.js","names":[],"sources":["../../src/account-layer/use-virtual-accounts-count-of-sub-account.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getVirtualAccountsCountOfSubAccountQueryOptions,\n type ConfigParameter,\n type GetVirtualAccountsCountOfSubAccountOptions,\n type GetVirtualAccountsCountOfSubAccountReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useVirtualAccountsCountOfSubAccount}: the core query\n * options (subAccount, chain id, TanStack `query` overrides) plus an\n * optional `config`.\n */\nexport type UseVirtualAccountsCountOfSubAccountParameters = GetVirtualAccountsCountOfSubAccountOptions &\n ConfigParameter;\n\n/** Return type of {@link useVirtualAccountsCountOfSubAccount}. */\nexport type UseVirtualAccountsCountOfSubAccountReturnType = UseQueryResult<\n GetVirtualAccountsCountOfSubAccountReturnType,\n SymmioRequestError\n>;\n\n/**\n * Read how many Virtual Accounts (VAs) a subaccount holds — for paging the VA\n * lists past their default limit of 200. The query is disabled until\n * `subAccount` is set. `chainId` defaults to the connected chain. Errors are\n * normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: count } = useVirtualAccountsCountOfSubAccount({ subAccount: \"0xsub…\", chainId });\n * ```\n */\nexport function useVirtualAccountsCountOfSubAccount(\n parameters: UseVirtualAccountsCountOfSubAccountParameters = {},\n): UseVirtualAccountsCountOfSubAccountReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getVirtualAccountsCountOfSubAccountQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseVirtualAccountsCountOfSubAccountReturnType;\n}\n"],"mappings":";;;;;;;AAuCA,SAAgB,EACd,IAA4D,CAAC,GACd;CAC/C,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAAgD,GAAQ;EACtE,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConfigParameter, GetVirtualAccountsOfSubAccountOptions, GetVirtualAccountsOfSubAccountReturnType } from '@symmio/trading-core';
|
|
2
|
+
import { UseQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link useVirtualAccountsOfSubAccount}: the core query
|
|
6
|
+
* options (subAccount, pagination, chain id, TanStack `query` overrides) plus an
|
|
7
|
+
* optional `config`.
|
|
8
|
+
*/
|
|
9
|
+
export type UseVirtualAccountsOfSubAccountParameters = GetVirtualAccountsOfSubAccountOptions & ConfigParameter;
|
|
10
|
+
/** Return type of {@link useVirtualAccountsOfSubAccount}. */
|
|
11
|
+
export type UseVirtualAccountsOfSubAccountReturnType = UseQueryResult<GetVirtualAccountsOfSubAccountReturnType, SymmioRequestError>;
|
|
12
|
+
/**
|
|
13
|
+
* List a subaccount's Virtual Accounts (VAs) **with their details** — market
|
|
14
|
+
* (`symbolId`), parent, isolation type — in one AccountLayer call. The query is
|
|
15
|
+
* disabled until `subAccount` is set; one call with the default `limit` covers
|
|
16
|
+
* up to 200 VAs. `chainId` defaults to the connected chain. Errors are
|
|
17
|
+
* normalized to {@link SymmioRequestError}.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* const { data: vas } = useVirtualAccountsOfSubAccount({ subAccount: "0xsub…", chainId });
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function useVirtualAccountsOfSubAccount(parameters?: UseVirtualAccountsOfSubAccountParameters): UseVirtualAccountsOfSubAccountReturnType;
|
|
25
|
+
//# sourceMappingURL=use-virtual-accounts-of-sub-account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-virtual-accounts-of-sub-account.d.ts","sourceRoot":"","sources":["../../src/account-layer/use-virtual-accounts-of-sub-account.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,eAAe,EACpB,KAAK,qCAAqC,EAC1C,KAAK,wCAAwC,EAC9C,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAY,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAIzE;;;;GAIG;AACH,MAAM,MAAM,wCAAwC,GAAG,qCAAqC,GAAG,eAAe,CAAC;AAE/G,6DAA6D;AAC7D,MAAM,MAAM,wCAAwC,GAAG,cAAc,CACnE,wCAAwC,EACxC,kBAAkB,CACnB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAC5C,UAAU,GAAE,wCAA6C,GACxD,wCAAwC,CAkB1C"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useSymmioChainId as e } from "../provider/use-symmio-chain-id.js";
|
|
3
|
+
import { useSymmioConfig as t } from "../provider/use-symmio-config.js";
|
|
4
|
+
import { normalizeSymmError as n } from "../errors/normalize-symm-error.js";
|
|
5
|
+
import { getVirtualAccountsOfSubAccountQueryOptions as r } from "@symmio/trading-core";
|
|
6
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
7
|
+
//#region src/account-layer/use-virtual-accounts-of-sub-account.ts
|
|
8
|
+
function a(a = {}) {
|
|
9
|
+
let o = t(a), s = e(), c = r(o, {
|
|
10
|
+
...a,
|
|
11
|
+
chainId: a.chainId ?? s
|
|
12
|
+
});
|
|
13
|
+
return i({
|
|
14
|
+
...c,
|
|
15
|
+
queryFn: async () => {
|
|
16
|
+
try {
|
|
17
|
+
return await c.queryFn();
|
|
18
|
+
} catch (e) {
|
|
19
|
+
throw n(e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as useVirtualAccountsOfSubAccount };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=use-virtual-accounts-of-sub-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-virtual-accounts-of-sub-account.js","names":[],"sources":["../../src/account-layer/use-virtual-accounts-of-sub-account.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getVirtualAccountsOfSubAccountQueryOptions,\n type ConfigParameter,\n type GetVirtualAccountsOfSubAccountOptions,\n type GetVirtualAccountsOfSubAccountReturnType,\n} from \"@symmio/trading-core\";\nimport { useQuery, type UseQueryResult } from \"@tanstack/react-query\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\nimport { useSymmioChainId } from \"../provider/use-symmio-chain-id\";\nimport { useSymmioConfig } from \"../provider/use-symmio-config\";\n\n/**\n * Parameters for {@link useVirtualAccountsOfSubAccount}: the core query\n * options (subAccount, pagination, chain id, TanStack `query` overrides) plus an\n * optional `config`.\n */\nexport type UseVirtualAccountsOfSubAccountParameters = GetVirtualAccountsOfSubAccountOptions & ConfigParameter;\n\n/** Return type of {@link useVirtualAccountsOfSubAccount}. */\nexport type UseVirtualAccountsOfSubAccountReturnType = UseQueryResult<\n GetVirtualAccountsOfSubAccountReturnType,\n SymmioRequestError\n>;\n\n/**\n * List a subaccount's Virtual Accounts (VAs) **with their details** — market\n * (`symbolId`), parent, isolation type — in one AccountLayer call. The query is\n * disabled until `subAccount` is set; one call with the default `limit` covers\n * up to 200 VAs. `chainId` defaults to the connected chain. Errors are\n * normalized to {@link SymmioRequestError}.\n *\n * @example\n * ```tsx\n * const { data: vas } = useVirtualAccountsOfSubAccount({ subAccount: \"0xsub…\", chainId });\n * ```\n */\nexport function useVirtualAccountsOfSubAccount(\n parameters: UseVirtualAccountsOfSubAccountParameters = {},\n): UseVirtualAccountsOfSubAccountReturnType {\n const config = useSymmioConfig(parameters);\n const chainId = useSymmioChainId();\n const options = getVirtualAccountsOfSubAccountQueryOptions(config, {\n ...parameters,\n chainId: parameters.chainId ?? chainId,\n });\n\n return useQuery({\n ...options,\n queryFn: async () => {\n try {\n return await options.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseVirtualAccountsOfSubAccountReturnType;\n}\n"],"mappings":";;;;;;;AAuCA,SAAgB,EACd,IAAuD,CAAC,GACd;CAC1C,IAAM,IAAS,EAAgB,CAAU,GACnC,IAAU,EAAiB,GAC3B,IAAU,EAA2C,GAAQ;EACjE,GAAG;EACH,SAAS,EAAW,WAAW;CACjC,CAAC;CAED,OAAO,EAAS;EACd,GAAG;EACH,SAAS,YAAY;GACnB,IAAI;IACF,OAAO,MAAM,EAAQ,QAAQ;GAC/B,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TimelockAuthorization, TimelockBatchAuthorization } from '@symmio/trading-core';
|
|
2
|
+
import { SymmioRequestError } from './symmio-request-error.js';
|
|
3
|
+
/** Preserve the exact approval, calldata and hash if confirmation fails. */
|
|
4
|
+
export declare function normalizeProtectedWriteError(error: unknown, authorization?: TimelockAuthorization | TimelockBatchAuthorization): SymmioRequestError;
|
|
5
|
+
//# sourceMappingURL=normalize-protected-write-error.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-protected-write-error.d.ts","sourceRoot":"","sources":["../../src/errors/normalize-protected-write-error.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAChC,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAM5D,4EAA4E;AAC5E,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,EACd,aAAa,CAAC,EAAE,qBAAqB,GAAG,0BAA0B,sBA+BnE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { SymmioRequestError as e } from "./symmio-request-error.js";
|
|
2
|
+
import { normalizeSymmError as t } from "./normalize-symm-error.js";
|
|
3
|
+
import { TransactionRevertedError as n } from "../transactions/resolve-write-result.js";
|
|
4
|
+
import { TimelockBatchExecutionError as r, TimelockExecutionError as i, getTimelockBatchRecovery as a, getTimelockExecutionRecovery as o } from "@symmio/trading-core";
|
|
5
|
+
//#region src/errors/normalize-protected-write-error.ts
|
|
6
|
+
var s = /* @__PURE__ */ new WeakMap();
|
|
7
|
+
function c(e, n) {
|
|
8
|
+
let c = n && s.get(n);
|
|
9
|
+
if (c && (e instanceof i || e instanceof r)) return c;
|
|
10
|
+
if (n && "calls" in n) {
|
|
11
|
+
let i = a(n);
|
|
12
|
+
if (i) {
|
|
13
|
+
let t = l(e, new r(i.approvals, i.callDatas, e, i.hash));
|
|
14
|
+
return s.set(n, t), t;
|
|
15
|
+
}
|
|
16
|
+
return e instanceof r ? l(e.cause, e) : t(e);
|
|
17
|
+
}
|
|
18
|
+
let u = n ? o(n) : void 0;
|
|
19
|
+
if (u && n) {
|
|
20
|
+
let t = l(e, new i(u.approval, u.callData, e, u.hash));
|
|
21
|
+
return s.set(n, t), t;
|
|
22
|
+
}
|
|
23
|
+
return e instanceof i ? l(e.cause, e) : t(e);
|
|
24
|
+
}
|
|
25
|
+
function l(r, i) {
|
|
26
|
+
let a = t(r);
|
|
27
|
+
if (a instanceof n) {
|
|
28
|
+
let e = new n({
|
|
29
|
+
hash: a.hash,
|
|
30
|
+
receipt: a.receipt
|
|
31
|
+
});
|
|
32
|
+
return e.cause = i, e;
|
|
33
|
+
}
|
|
34
|
+
return new e({
|
|
35
|
+
...a,
|
|
36
|
+
message: a.message,
|
|
37
|
+
cause: i
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { c as normalizeProtectedWriteError };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=normalize-protected-write-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-protected-write-error.js","names":[],"sources":["../../src/errors/normalize-protected-write-error.ts"],"sourcesContent":["import {\n getTimelockBatchRecovery,\n getTimelockExecutionRecovery,\n TimelockBatchExecutionError,\n TimelockExecutionError,\n type TimelockAuthorization,\n type TimelockBatchAuthorization,\n} from \"@symmio/trading-core\";\nimport { TransactionRevertedError } from \"../transactions/resolve-write-result\";\nimport { normalizeSymmError } from \"./normalize-symm-error\";\nimport { SymmioRequestError } from \"./symmio-request-error\";\n\n// A framework-level retry must not replace the confirmed outcome of the first\n// attempt with the SDK's later \"already submitted\" guard error.\nconst confirmationErrors = new WeakMap<TimelockAuthorization | TimelockBatchAuthorization, SymmioRequestError>();\n\n/** Preserve the exact approval, calldata and hash if confirmation fails. */\nexport function normalizeProtectedWriteError(\n error: unknown,\n authorization?: TimelockAuthorization | TimelockBatchAuthorization,\n) {\n const previous = authorization && confirmationErrors.get(authorization);\n if (previous && (error instanceof TimelockExecutionError || error instanceof TimelockBatchExecutionError))\n return previous;\n if (authorization && \"calls\" in authorization) {\n const recovery = getTimelockBatchRecovery(authorization);\n if (recovery) {\n const result = preserveClassification(\n error,\n new TimelockBatchExecutionError(recovery.approvals, recovery.callDatas, error, recovery.hash),\n );\n confirmationErrors.set(authorization, result);\n return result;\n }\n return error instanceof TimelockBatchExecutionError\n ? preserveClassification(error.cause, error)\n : normalizeSymmError(error);\n }\n const recovery = authorization ? getTimelockExecutionRecovery(authorization) : undefined;\n if (recovery && authorization) {\n const result = preserveClassification(\n error,\n new TimelockExecutionError(recovery.approval, recovery.callData, error, recovery.hash),\n );\n confirmationErrors.set(authorization, result);\n return result;\n }\n return error instanceof TimelockExecutionError\n ? preserveClassification(error.cause, error)\n : normalizeSymmError(error);\n}\n\nfunction preserveClassification(error: unknown, recovery: Error): SymmioRequestError {\n const underlying = normalizeSymmError(error);\n if (underlying instanceof TransactionRevertedError) {\n const reverted = new TransactionRevertedError({ hash: underlying.hash, receipt: underlying.receipt });\n reverted.cause = recovery;\n return reverted;\n }\n return new SymmioRequestError({ ...underlying, message: underlying.message, cause: recovery });\n}\n"],"mappings":";;;;;AAcA,IAAM,oBAAqB,IAAI,QAAgF;AAG/G,SAAgB,EACd,GACA,GACA;CACA,IAAM,IAAW,KAAiB,EAAmB,IAAI,CAAa;CACtE,IAAI,MAAa,aAAiB,KAA0B,aAAiB,IAC3E,OAAO;CACT,IAAI,KAAiB,WAAW,GAAe;EAC7C,IAAM,IAAW,EAAyB,CAAa;EACvD,IAAI,GAAU;GACZ,IAAM,IAAS,EACb,GACA,IAAI,EAA4B,EAAS,WAAW,EAAS,WAAW,GAAO,EAAS,IAAI,CAC9F;GAEA,OADA,EAAmB,IAAI,GAAe,CAAM,GACrC;EACT;EACA,OAAO,aAAiB,IACpB,EAAuB,EAAM,OAAO,CAAK,IACzC,EAAmB,CAAK;CAC9B;CACA,IAAM,IAAW,IAAgB,EAA6B,CAAa,IAAI,KAAA;CAC/E,IAAI,KAAY,GAAe;EAC7B,IAAM,IAAS,EACb,GACA,IAAI,EAAuB,EAAS,UAAU,EAAS,UAAU,GAAO,EAAS,IAAI,CACvF;EAEA,OADA,EAAmB,IAAI,GAAe,CAAM,GACrC;CACT;CACA,OAAO,aAAiB,IACpB,EAAuB,EAAM,OAAO,CAAK,IACzC,EAAmB,CAAK;AAC9B;AAEA,SAAS,EAAuB,GAAgB,GAAqC;CACnF,IAAM,IAAa,EAAmB,CAAK;CAC3C,IAAI,aAAsB,GAA0B;EAClD,IAAM,IAAW,IAAI,EAAyB;GAAE,MAAM,EAAW;GAAM,SAAS,EAAW;EAAQ,CAAC;EAEpG,OADA,EAAS,QAAQ,GACV;CACT;CACA,OAAO,IAAI,EAAmB;EAAE,GAAG;EAAY,SAAS,EAAW;EAAS,OAAO;CAAS,CAAC;AAC/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-symm-error.d.ts","sourceRoot":"","sources":["../../src/errors/normalize-symm-error.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"normalize-symm-error.d.ts","sourceRoot":"","sources":["../../src/errors/normalize-symm-error.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,kBAAkB,CA0GnE"}
|
|
@@ -1,75 +1,88 @@
|
|
|
1
1
|
import { SymmioRequestError as e } from "./symmio-request-error.js";
|
|
2
|
-
import { SymmApiError as t, SymmError as n } from "@symmio/trading-core";
|
|
3
|
-
import { BaseError as
|
|
2
|
+
import { SymmApiError as t, SymmError as n, TimelockSolverError as r } from "@symmio/trading-core";
|
|
3
|
+
import { BaseError as i, ContractFunctionRevertedError as a, EstimateGasExecutionError as o, HttpRequestError as s, InsufficientFundsError as c, TimeoutError as l, TransactionExecutionError as u, UserRejectedRequestError as d } from "viem";
|
|
4
4
|
//#region src/errors/normalize-symm-error.ts
|
|
5
|
-
function
|
|
6
|
-
if (
|
|
7
|
-
if (
|
|
5
|
+
function f(i) {
|
|
6
|
+
if (i instanceof e) return i;
|
|
7
|
+
if (i instanceof t) return new e({
|
|
8
8
|
kind: "api",
|
|
9
|
-
message:
|
|
10
|
-
code:
|
|
11
|
-
status:
|
|
12
|
-
responseData:
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
message: i.message,
|
|
10
|
+
code: i.code,
|
|
11
|
+
status: i.status,
|
|
12
|
+
responseData: i.responseData,
|
|
13
|
+
timelock: i instanceof r ? i.details : void 0,
|
|
14
|
+
retryAfterMs: i.retryAfterMs,
|
|
15
|
+
cause: i
|
|
15
16
|
});
|
|
16
|
-
if (
|
|
17
|
+
if (i instanceof n) return i.code === "TIMELOCK_REQUIRED" ? new e({
|
|
18
|
+
kind: "contract-revert",
|
|
19
|
+
code: i.code,
|
|
20
|
+
message: i.message,
|
|
21
|
+
reason: "TimelockOpNotApprovedOrScheduled",
|
|
22
|
+
cause: i
|
|
23
|
+
}) : new e({
|
|
17
24
|
kind: "sdk",
|
|
18
|
-
message:
|
|
19
|
-
code:
|
|
20
|
-
cause:
|
|
25
|
+
message: i.message,
|
|
26
|
+
code: i.code,
|
|
27
|
+
cause: i
|
|
21
28
|
});
|
|
22
|
-
let
|
|
23
|
-
if (
|
|
24
|
-
let t =
|
|
29
|
+
let f = p(i);
|
|
30
|
+
if (f) {
|
|
31
|
+
let t = m(f, d);
|
|
25
32
|
if (t) return new e({
|
|
26
33
|
kind: "user-rejected",
|
|
27
34
|
message: t.shortMessage || "Wallet request was rejected.",
|
|
28
|
-
cause:
|
|
35
|
+
cause: i
|
|
29
36
|
});
|
|
30
|
-
let n =
|
|
37
|
+
let n = m(f, a);
|
|
31
38
|
if (n) {
|
|
32
39
|
let t = n.reason ?? n.data?.errorName;
|
|
33
|
-
return new e({
|
|
40
|
+
return n.data?.errorName === "TimelockOpNotApprovedOrScheduled" ? new e({
|
|
41
|
+
kind: "contract-revert",
|
|
42
|
+
code: "TIMELOCK_REQUIRED",
|
|
43
|
+
message: "This operation requires a timelock approval or a mature schedule.",
|
|
44
|
+
reason: n.data.errorName,
|
|
45
|
+
cause: i
|
|
46
|
+
}) : new e({
|
|
34
47
|
kind: "contract-revert",
|
|
35
48
|
message: n.shortMessage || `Contract reverted${t ? `: ${t}` : "."}`,
|
|
36
49
|
reason: t,
|
|
37
|
-
cause:
|
|
50
|
+
cause: i
|
|
38
51
|
});
|
|
39
52
|
}
|
|
40
|
-
let
|
|
41
|
-
if (
|
|
53
|
+
let r = m(f, c);
|
|
54
|
+
if (r) return new e({
|
|
42
55
|
kind: "insufficient-funds",
|
|
43
|
-
message:
|
|
44
|
-
cause:
|
|
56
|
+
message: r.shortMessage || "Insufficient funds for gas.",
|
|
57
|
+
cause: i
|
|
45
58
|
});
|
|
46
|
-
let
|
|
47
|
-
return
|
|
59
|
+
let p = m(f, s) || m(f, l) || m(f, o) || m(f, u);
|
|
60
|
+
return p ? new e({
|
|
48
61
|
kind: "rpc",
|
|
49
|
-
message:
|
|
50
|
-
shortMessage:
|
|
51
|
-
cause:
|
|
62
|
+
message: p.shortMessage || p.message,
|
|
63
|
+
shortMessage: p.shortMessage,
|
|
64
|
+
cause: i
|
|
52
65
|
}) : new e({
|
|
53
66
|
kind: "rpc",
|
|
54
|
-
message:
|
|
55
|
-
shortMessage:
|
|
56
|
-
cause:
|
|
67
|
+
message: f.shortMessage || f.message,
|
|
68
|
+
shortMessage: f.shortMessage,
|
|
69
|
+
cause: i
|
|
57
70
|
});
|
|
58
71
|
}
|
|
59
|
-
return
|
|
72
|
+
return i instanceof Error ? new e({
|
|
60
73
|
kind: "unknown",
|
|
61
|
-
message:
|
|
62
|
-
cause:
|
|
74
|
+
message: i.message,
|
|
75
|
+
cause: i
|
|
63
76
|
}) : new e({
|
|
64
77
|
kind: "unknown",
|
|
65
|
-
message: typeof
|
|
66
|
-
cause:
|
|
78
|
+
message: typeof i == "string" ? i : "An unknown error occurred.",
|
|
79
|
+
cause: i
|
|
67
80
|
});
|
|
68
81
|
}
|
|
69
|
-
function
|
|
82
|
+
function p(e) {
|
|
70
83
|
let t = e, n = 0;
|
|
71
84
|
for (; t && n < 16;) {
|
|
72
|
-
if (t instanceof
|
|
85
|
+
if (t instanceof i) return t;
|
|
73
86
|
if (t instanceof Error && t.cause) {
|
|
74
87
|
t = t.cause, n += 1;
|
|
75
88
|
continue;
|
|
@@ -77,11 +90,11 @@ function f(e) {
|
|
|
77
90
|
return;
|
|
78
91
|
}
|
|
79
92
|
}
|
|
80
|
-
function
|
|
93
|
+
function m(e, t) {
|
|
81
94
|
let n = e.walk((e) => e instanceof t);
|
|
82
95
|
return n instanceof t ? n : void 0;
|
|
83
96
|
}
|
|
84
97
|
//#endregion
|
|
85
|
-
export {
|
|
98
|
+
export { f as normalizeSymmError };
|
|
86
99
|
|
|
87
100
|
//# sourceMappingURL=normalize-symm-error.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-symm-error.js","names":[],"sources":["../../src/errors/normalize-symm-error.ts"],"sourcesContent":["import { SymmApiError, SymmError } from \"@symmio/trading-core\";\nimport {\n BaseError,\n ContractFunctionRevertedError,\n EstimateGasExecutionError,\n HttpRequestError,\n InsufficientFundsError,\n TimeoutError,\n TransactionExecutionError,\n UserRejectedRequestError,\n} from \"viem\";\nimport { SymmioRequestError } from \"./symmio-request-error\";\n\n/**\n * Classify any thrown value into a {@link SymmioRequestError}. Hooks call this\n * inside their `queryFn` / `mutationFn` so consumers always see the same\n * discriminated shape, regardless of which viem error type fired underneath.\n *\n * The order of `walk` matters: a wallet-popup dismissal nests inside a\n * `TransactionExecutionError`, so the rejection check has to consider every\n * level of the cause chain, not just the topmost throw.\n *\n * @param err - The thrown value (typed `unknown` because Promises can reject with anything).\n */\nexport function normalizeSymmError(err: unknown): SymmioRequestError {\n if (err instanceof SymmioRequestError) return err;\n\n if (err instanceof SymmApiError) {\n return new SymmioRequestError({\n kind: \"api\",\n message: err.message,\n code: err.code,\n status: err.status,\n responseData: err.responseData,\n retryAfterMs: err.retryAfterMs,\n cause: err,\n });\n }\n\n if (err instanceof SymmError) {\n return new SymmioRequestError({\n kind: \"sdk\",\n message: err.message,\n code: err.code,\n cause: err,\n });\n }\n\n const viemErr = findViemError(err);\n\n if (viemErr) {\n const userRejected = findInCauseChain(viemErr, UserRejectedRequestError);\n if (userRejected) {\n return new SymmioRequestError({\n kind: \"user-rejected\",\n message: userRejected.shortMessage || \"Wallet request was rejected.\",\n cause: err,\n });\n }\n\n const revert = findInCauseChain(viemErr, ContractFunctionRevertedError);\n if (revert) {\n const reason = revert.reason ?? revert.data?.errorName;\n return new SymmioRequestError({\n kind: \"contract-revert\",\n message: revert.shortMessage || `Contract reverted${reason ? `: ${reason}` : \".\"}`,\n reason,\n cause: err,\n });\n }\n\n const insufficient = findInCauseChain(viemErr, InsufficientFundsError);\n if (insufficient) {\n return new SymmioRequestError({\n kind: \"insufficient-funds\",\n message: insufficient.shortMessage || \"Insufficient funds for gas.\",\n cause: err,\n });\n }\n\n const transport =\n findInCauseChain(viemErr, HttpRequestError) ||\n findInCauseChain(viemErr, TimeoutError) ||\n findInCauseChain(viemErr, EstimateGasExecutionError) ||\n findInCauseChain(viemErr, TransactionExecutionError);\n if (transport) {\n return new SymmioRequestError({\n kind: \"rpc\",\n message: transport.shortMessage || transport.message,\n shortMessage: transport.shortMessage,\n cause: err,\n });\n }\n\n return new SymmioRequestError({\n kind: \"rpc\",\n message: viemErr.shortMessage || viemErr.message,\n shortMessage: viemErr.shortMessage,\n cause: err,\n });\n }\n\n if (err instanceof Error) {\n return new SymmioRequestError({ kind: \"unknown\", message: err.message, cause: err });\n }\n\n return new SymmioRequestError({\n kind: \"unknown\",\n message: typeof err === \"string\" ? err : \"An unknown error occurred.\",\n cause: err,\n });\n}\n\n/**\n * Walk an error and its `cause` chain looking for a viem `BaseError`. Returns\n * the first one found, or `undefined`.\n *\n * @internal\n */\nfunction findViemError(err: unknown): BaseError | undefined {\n let current: unknown = err;\n let depth = 0;\n while (current && depth < 16) {\n if (current instanceof BaseError) return current;\n if (current instanceof Error && current.cause) {\n current = current.cause;\n depth += 1;\n continue;\n }\n return undefined;\n }\n return undefined;\n}\n\n/**\n * Walk a viem `BaseError`'s `walk()` chain looking for a specific subclass.\n *\n * @internal\n */\nfunction findInCauseChain<T extends BaseError>(err: BaseError, ctor: new (...args: never[]) => T): T | undefined {\n const found = err.walk((candidate) => candidate instanceof ctor);\n return found instanceof ctor ? (found as T) : undefined;\n}\n"],"mappings":";;;;AAwBA,SAAgB,EAAmB,GAAkC;CACnE,IAAI,aAAe,GAAoB,OAAO;CAE9C,IAAI,aAAe,GACjB,OAAO,IAAI,EAAmB;EAC5B,MAAM;EACN,SAAS,EAAI;EACb,MAAM,EAAI;EACV,QAAQ,EAAI;EACZ,cAAc,EAAI;EAClB,cAAc,EAAI;EAClB,OAAO;CACT,CAAC;CAGH,IAAI,aAAe,
|
|
1
|
+
{"version":3,"file":"normalize-symm-error.js","names":[],"sources":["../../src/errors/normalize-symm-error.ts"],"sourcesContent":["import { SymmApiError, SymmError, TimelockSolverError } from \"@symmio/trading-core\";\nimport {\n BaseError,\n ContractFunctionRevertedError,\n EstimateGasExecutionError,\n HttpRequestError,\n InsufficientFundsError,\n TimeoutError,\n TransactionExecutionError,\n UserRejectedRequestError,\n} from \"viem\";\nimport { SymmioRequestError } from \"./symmio-request-error\";\n\n/**\n * Classify any thrown value into a {@link SymmioRequestError}. Hooks call this\n * inside their `queryFn` / `mutationFn` so consumers always see the same\n * discriminated shape, regardless of which viem error type fired underneath.\n *\n * The order of `walk` matters: a wallet-popup dismissal nests inside a\n * `TransactionExecutionError`, so the rejection check has to consider every\n * level of the cause chain, not just the topmost throw.\n *\n * @param err - The thrown value (typed `unknown` because Promises can reject with anything).\n */\nexport function normalizeSymmError(err: unknown): SymmioRequestError {\n if (err instanceof SymmioRequestError) return err;\n\n if (err instanceof SymmApiError) {\n return new SymmioRequestError({\n kind: \"api\",\n message: err.message,\n code: err.code,\n status: err.status,\n responseData: err.responseData,\n timelock: err instanceof TimelockSolverError ? err.details : undefined,\n retryAfterMs: err.retryAfterMs,\n cause: err,\n });\n }\n\n if (err instanceof SymmError) {\n if (err.code === \"TIMELOCK_REQUIRED\") {\n return new SymmioRequestError({\n kind: \"contract-revert\",\n code: err.code,\n message: err.message,\n reason: \"TimelockOpNotApprovedOrScheduled\",\n cause: err,\n });\n }\n return new SymmioRequestError({\n kind: \"sdk\",\n message: err.message,\n code: err.code,\n cause: err,\n });\n }\n\n const viemErr = findViemError(err);\n\n if (viemErr) {\n const userRejected = findInCauseChain(viemErr, UserRejectedRequestError);\n if (userRejected) {\n return new SymmioRequestError({\n kind: \"user-rejected\",\n message: userRejected.shortMessage || \"Wallet request was rejected.\",\n cause: err,\n });\n }\n\n const revert = findInCauseChain(viemErr, ContractFunctionRevertedError);\n if (revert) {\n const reason = revert.reason ?? revert.data?.errorName;\n if (revert.data?.errorName === \"TimelockOpNotApprovedOrScheduled\") {\n return new SymmioRequestError({\n kind: \"contract-revert\",\n code: \"TIMELOCK_REQUIRED\",\n message: \"This operation requires a timelock approval or a mature schedule.\",\n reason: revert.data.errorName,\n cause: err,\n });\n }\n return new SymmioRequestError({\n kind: \"contract-revert\",\n message: revert.shortMessage || `Contract reverted${reason ? `: ${reason}` : \".\"}`,\n reason,\n cause: err,\n });\n }\n\n const insufficient = findInCauseChain(viemErr, InsufficientFundsError);\n if (insufficient) {\n return new SymmioRequestError({\n kind: \"insufficient-funds\",\n message: insufficient.shortMessage || \"Insufficient funds for gas.\",\n cause: err,\n });\n }\n\n const transport =\n findInCauseChain(viemErr, HttpRequestError) ||\n findInCauseChain(viemErr, TimeoutError) ||\n findInCauseChain(viemErr, EstimateGasExecutionError) ||\n findInCauseChain(viemErr, TransactionExecutionError);\n if (transport) {\n return new SymmioRequestError({\n kind: \"rpc\",\n message: transport.shortMessage || transport.message,\n shortMessage: transport.shortMessage,\n cause: err,\n });\n }\n\n return new SymmioRequestError({\n kind: \"rpc\",\n message: viemErr.shortMessage || viemErr.message,\n shortMessage: viemErr.shortMessage,\n cause: err,\n });\n }\n\n if (err instanceof Error) {\n return new SymmioRequestError({ kind: \"unknown\", message: err.message, cause: err });\n }\n\n return new SymmioRequestError({\n kind: \"unknown\",\n message: typeof err === \"string\" ? err : \"An unknown error occurred.\",\n cause: err,\n });\n}\n\n/**\n * Walk an error and its `cause` chain looking for a viem `BaseError`. Returns\n * the first one found, or `undefined`.\n *\n * @internal\n */\nfunction findViemError(err: unknown): BaseError | undefined {\n let current: unknown = err;\n let depth = 0;\n while (current && depth < 16) {\n if (current instanceof BaseError) return current;\n if (current instanceof Error && current.cause) {\n current = current.cause;\n depth += 1;\n continue;\n }\n return undefined;\n }\n return undefined;\n}\n\n/**\n * Walk a viem `BaseError`'s `walk()` chain looking for a specific subclass.\n *\n * @internal\n */\nfunction findInCauseChain<T extends BaseError>(err: BaseError, ctor: new (...args: never[]) => T): T | undefined {\n const found = err.walk((candidate) => candidate instanceof ctor);\n return found instanceof ctor ? (found as T) : undefined;\n}\n"],"mappings":";;;;AAwBA,SAAgB,EAAmB,GAAkC;CACnE,IAAI,aAAe,GAAoB,OAAO;CAE9C,IAAI,aAAe,GACjB,OAAO,IAAI,EAAmB;EAC5B,MAAM;EACN,SAAS,EAAI;EACb,MAAM,EAAI;EACV,QAAQ,EAAI;EACZ,cAAc,EAAI;EAClB,UAAU,aAAe,IAAsB,EAAI,UAAU,KAAA;EAC7D,cAAc,EAAI;EAClB,OAAO;CACT,CAAC;CAGH,IAAI,aAAe,GAUjB,OATI,EAAI,SAAS,sBACR,IAAI,EAAmB;EAC5B,MAAM;EACN,MAAM,EAAI;EACV,SAAS,EAAI;EACb,QAAQ;EACR,O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AC5B,MAAM;EACN,SAAS,OAAO,KAAQ,WAAW,IAAM;EACzC,OAAO;CACT,CAAC;AACH;AAQA,SAAS,EAAc,GAAqC;CAC1D,IAAI,IAAmB,GACnB,IAAQ;CACZ,OAAO,KAAW,IAAQ,KAAI;EAC5B,IAAI,aAAmB,GAAW,OAAO;EACzC,IAAI,aAAmB,SAAS,EAAQ,OAAO;GAE7C,AADA,IAAU,EAAQ,OAClB,KAAS;GACT;EACF;EACA;CACF;AAEF;AAOA,SAAS,EAAsC,GAAgB,GAAkD;CAC/G,IAAM,IAAQ,EAAI,MAAM,MAAc,aAAqB,CAAI;CAC/D,OAAO,aAAiB,IAAQ,IAAc,KAAA;AAChD"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
+
import { TimelockErrorDetails } from '@symmio/trading-core';
|
|
1
2
|
import { SymmioNormalizedErrorKind } from './types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Options accepted by the {@link SymmioRequestError} constructor. Carries
|
|
4
5
|
* the discriminator-specific fields the UI cares about.
|
|
5
6
|
*/
|
|
6
7
|
export interface SymmioRequestErrorOptions {
|
|
8
|
+
/** Normalized timelock solver fields, when this is a typed timelock API error. */
|
|
9
|
+
timelock?: TimelockErrorDetails;
|
|
7
10
|
kind: SymmioNormalizedErrorKind;
|
|
8
11
|
message: string;
|
|
9
12
|
/** SDK error code (e.g., "FETCH_MARKETS_FAILED", "UNSUPPORTED_CHAIN"). */
|
|
@@ -41,6 +44,8 @@ export interface SymmioRequestErrorOptions {
|
|
|
41
44
|
* if (error) return <GenericError message={error.message} />;
|
|
42
45
|
*/
|
|
43
46
|
export declare class SymmioRequestError extends Error {
|
|
47
|
+
/** Structured timelock error fields without parsing the free-form diagnostic body. */
|
|
48
|
+
readonly timelock?: TimelockErrorDetails;
|
|
44
49
|
readonly name = "SymmioRequestError";
|
|
45
50
|
/** Classification used by the UI to branch on this failure. */
|
|
46
51
|
readonly kind: SymmioNormalizedErrorKind;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"symmio-request-error.d.ts","sourceRoot":"","sources":["../../src/errors/symmio-request-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAEzD;;;GAGG;AACH,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,+DAA+D;IAC/D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yDAAyD;IACzD,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,SAAkB,IAAI,wBAAwB;IAC9C,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,yBAAyB,CAAC;IACzC,qDAAqD;IACrD,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,8CAA8C;IAC9C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,sEAAsE;IACtE,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC;IAChC;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,gEAAgE;IAChE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,kDAAkD;IAClD,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,yBAAyB;
|
|
1
|
+
{"version":3,"file":"symmio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