@symmio/trading-react 4.4.0 → 4.6.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/candles/index.d.ts +2 -0
- package/dist/candles/index.d.ts.map +1 -1
- package/dist/candles/index.js +6 -4
- package/dist/candles/use-candle-history.d.ts +30 -0
- package/dist/candles/use-candle-history.d.ts.map +1 -0
- package/dist/candles/use-candle-history.js +66 -0
- package/dist/candles/use-candle-history.js.map +1 -0
- package/dist/candles/use-candle-stream.d.ts +5 -4
- package/dist/candles/use-candle-stream.d.ts.map +1 -1
- package/dist/candles/use-candle-stream.js +17 -10
- package/dist/candles/use-candle-stream.js.map +1 -1
- package/dist/candles/use-candles.js +2 -2
- package/dist/candles/use-candles.js.map +1 -1
- package/dist/candles/use-lowcap-candle-source.d.ts +19 -0
- package/dist/candles/use-lowcap-candle-source.d.ts.map +1 -0
- package/dist/candles/use-lowcap-candle-source.js +25 -0
- package/dist/candles/use-lowcap-candle-source.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 +3 -0
- package/dist/gasless/index.d.ts.map +1 -1
- package/dist/gasless/index.js +22 -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-gasless-batch-funding.d.ts +22 -0
- package/dist/gasless/use-gasless-batch-funding.d.ts.map +1 -0
- package/dist/gasless/use-gasless-batch-funding.js +27 -0
- package/dist/gasless/use-gasless-batch-funding.js.map +1 -0
- package/dist/gasless/use-gasless-margin-funding.d.ts +26 -0
- package/dist/gasless/use-gasless-margin-funding.d.ts.map +1 -0
- package/dist/gasless/use-gasless-margin-funding.js +27 -0
- package/dist/gasless/use-gasless-margin-funding.js.map +1 -0
- 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 +14 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +275 -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/pools/use-listing-config.d.ts +3 -1
- package/dist/pools/use-listing-config.d.ts.map +1 -1
- package/dist/pools/use-listing-config.js.map +1 -1
- 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":"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"}
|
|
@@ -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"}
|
package/dist/candles/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export * from './use-binance-candle-source.js';
|
|
2
|
+
export * from './use-candle-history.js';
|
|
2
3
|
export * from './use-candle-stream.js';
|
|
3
4
|
export * from './use-candles.js';
|
|
5
|
+
export * from './use-lowcap-candle-source.js';
|
|
4
6
|
export * from './use-tradingview-datafeed.js';
|
|
5
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/candles/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/candles/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC"}
|
package/dist/candles/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useBinanceCandleSource as e } from "./use-binance-candle-source.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
2
|
+
import { useCandleHistory as t } from "./use-candle-history.js";
|
|
3
|
+
import { useCandleStream as n } from "./use-candle-stream.js";
|
|
4
|
+
import { useCandles as r } from "./use-candles.js";
|
|
5
|
+
import { useLowcapCandleSource as i } from "./use-lowcap-candle-source.js";
|
|
6
|
+
import { useTradingViewDatafeed as a } from "./use-tradingview-datafeed.js";
|
|
7
|
+
export { e as useBinanceCandleSource, t as useCandleHistory, n as useCandleStream, r as useCandles, i as useLowcapCandleSource, a as useTradingViewDatafeed };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CandleHistoryData, CandleHistoryRange, CandleSource, GetCandleHistoryOptions } from '@symmio/trading-core';
|
|
2
|
+
import { UseInfiniteQueryResult } from '@tanstack/react-query';
|
|
3
|
+
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
4
|
+
/** Source, stable initial range, follow-latest policy, and TanStack overrides for {@link useCandleHistory}. */
|
|
5
|
+
export type UseCandleHistoryParameters = GetCandleHistoryOptions & {
|
|
6
|
+
source: CandleSource;
|
|
7
|
+
};
|
|
8
|
+
/** Incremental history state, with merged `data.candles` and explicit loading and refresh actions. */
|
|
9
|
+
export type UseCandleHistoryReturnType = UseInfiniteQueryResult<CandleHistoryData, SymmioRequestError> & {
|
|
10
|
+
/** Fetch only the preceding window. Repeated calls while fetching are ignored; errors require refresh. */
|
|
11
|
+
loadOlder: () => Promise<void>;
|
|
12
|
+
/** Revalidate all windows, or replace only corrected intervals plus any missing live tail. Bounded refreshes wait for active paging. */
|
|
13
|
+
refresh: (range?: CandleHistoryRange) => Promise<void>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Retain candle history while loading preceding windows through any CandleSource.
|
|
17
|
+
* Cursor calculation and merging live in core; this hook supplies React lifecycle,
|
|
18
|
+
* cancellation, and normalized errors. An empty window never triggers another load.
|
|
19
|
+
*
|
|
20
|
+
* @param parameters - Source, market, resolution, and a stable initial range.
|
|
21
|
+
* @returns Query state with ascending candles, loadOlder, and refresh.
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const history = useCandleHistory({ source, marketName, resolution, ...initialRange, followLatest: true });
|
|
25
|
+
* const stream = useCandleStream({ source, marketName, resolution, onReset: (range) => { void history.refresh(range); } });
|
|
26
|
+
* // Wire history.loadOlder to your chart's older-edge gesture.
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export declare function useCandleHistory(parameters: UseCandleHistoryParameters): UseCandleHistoryReturnType;
|
|
30
|
+
//# sourceMappingURL=use-candle-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-candle-history.d.ts","sourceRoot":"","sources":["../../src/candles/use-candle-history.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAE7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAA6C,KAAK,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAG/G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE,+GAA+G;AAC/G,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,GAAG;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,CAAC;AAE5F,sGAAsG;AACtG,MAAM,MAAM,0BAA0B,GAAG,sBAAsB,CAAC,iBAAiB,EAAE,kBAAkB,CAAC,GAAG;IACvG,0GAA0G;IAC1G,SAAS,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/B,wIAAwI;IACxI,OAAO,EAAE,CAAC,KAAK,CAAC,EAAE,kBAAkB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,0BAA0B,GAAG,0BAA0B,CA6DnG"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { normalizeSymmError as e } from "../errors/normalize-symm-error.js";
|
|
3
|
+
import { getCandleHistoryQueryOptions as t, refreshCandleHistory as n } from "@symmio/trading-core";
|
|
4
|
+
import { useCallback as r, useEffect as i, useRef as a } from "react";
|
|
5
|
+
import { hashKey as o, useInfiniteQuery as s, useQueryClient as c } from "@tanstack/react-query";
|
|
6
|
+
//#region src/candles/use-candle-history.ts
|
|
7
|
+
function l(l) {
|
|
8
|
+
let { source: u, ...d } = l, f = c(), p = t(u, d), m = {
|
|
9
|
+
...p,
|
|
10
|
+
fetchRange: async (t, n) => {
|
|
11
|
+
try {
|
|
12
|
+
return await p.fetchRange(t, n);
|
|
13
|
+
} catch (t) {
|
|
14
|
+
throw e(t);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
queryFn: async (t) => {
|
|
18
|
+
try {
|
|
19
|
+
return await p.queryFn(t);
|
|
20
|
+
} catch (t) {
|
|
21
|
+
throw e(t);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}, h = s(m), g = o(p.queryKey), _ = a(m);
|
|
25
|
+
_.current = m;
|
|
26
|
+
let v = a(void 0);
|
|
27
|
+
i(() => (v.current = {
|
|
28
|
+
key: g,
|
|
29
|
+
controller: new AbortController()
|
|
30
|
+
}, () => {
|
|
31
|
+
v.current?.key === g && (v.current.controller.abort(), v.current = void 0);
|
|
32
|
+
}), [g]);
|
|
33
|
+
let { isFetching: y, error: b, hasNextPage: x, fetchNextPage: S } = h, C = r(async () => {
|
|
34
|
+
y || b || !x || await S({ cancelRefetch: !1 });
|
|
35
|
+
}, [
|
|
36
|
+
y,
|
|
37
|
+
b,
|
|
38
|
+
x,
|
|
39
|
+
S
|
|
40
|
+
]), w = r(async (t) => {
|
|
41
|
+
if (v.current?.key !== g) return;
|
|
42
|
+
t || (v.current.controller.abort(), v.current = {
|
|
43
|
+
key: g,
|
|
44
|
+
controller: new AbortController()
|
|
45
|
+
});
|
|
46
|
+
let { signal: r } = v.current.controller, i = _.current;
|
|
47
|
+
try {
|
|
48
|
+
await n(f, {
|
|
49
|
+
queryOptions: i,
|
|
50
|
+
range: t,
|
|
51
|
+
signal: r
|
|
52
|
+
});
|
|
53
|
+
} catch (t) {
|
|
54
|
+
if (!r.aborted && !f.getQueryState(i.queryKey)?.error) throw e(t);
|
|
55
|
+
}
|
|
56
|
+
}, [g, f]);
|
|
57
|
+
return {
|
|
58
|
+
...h,
|
|
59
|
+
loadOlder: C,
|
|
60
|
+
refresh: w
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { l as useCandleHistory };
|
|
65
|
+
|
|
66
|
+
//# sourceMappingURL=use-candle-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-candle-history.js","names":[],"sources":["../../src/candles/use-candle-history.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getCandleHistoryQueryOptions,\n refreshCandleHistory,\n type CandleHistoryData,\n type CandleHistoryRange,\n type CandleSource,\n type GetCandleHistoryOptions,\n type GetCandleHistoryQueryOptions,\n} from \"@symmio/trading-core\";\nimport { hashKey, useInfiniteQuery, useQueryClient, type UseInfiniteQueryResult } from \"@tanstack/react-query\";\nimport { useCallback, useEffect, useRef } from \"react\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\n\n/** Source, stable initial range, follow-latest policy, and TanStack overrides for {@link useCandleHistory}. */\nexport type UseCandleHistoryParameters = GetCandleHistoryOptions & { source: CandleSource };\n\n/** Incremental history state, with merged `data.candles` and explicit loading and refresh actions. */\nexport type UseCandleHistoryReturnType = UseInfiniteQueryResult<CandleHistoryData, SymmioRequestError> & {\n /** Fetch only the preceding window. Repeated calls while fetching are ignored; errors require refresh. */\n loadOlder: () => Promise<void>;\n /** Revalidate all windows, or replace only corrected intervals plus any missing live tail. Bounded refreshes wait for active paging. */\n refresh: (range?: CandleHistoryRange) => Promise<void>;\n};\n\n/**\n * Retain candle history while loading preceding windows through any CandleSource.\n * Cursor calculation and merging live in core; this hook supplies React lifecycle,\n * cancellation, and normalized errors. An empty window never triggers another load.\n *\n * @param parameters - Source, market, resolution, and a stable initial range.\n * @returns Query state with ascending candles, loadOlder, and refresh.\n * @example\n * ```tsx\n * const history = useCandleHistory({ source, marketName, resolution, ...initialRange, followLatest: true });\n * const stream = useCandleStream({ source, marketName, resolution, onReset: (range) => { void history.refresh(range); } });\n * // Wire history.loadOlder to your chart's older-edge gesture.\n * ```\n */\nexport function useCandleHistory(parameters: UseCandleHistoryParameters): UseCandleHistoryReturnType {\n const { source, ...options } = parameters;\n const queryClient = useQueryClient();\n const queryOptions = getCandleHistoryQueryOptions(source, options);\n const normalizedOptions: GetCandleHistoryQueryOptions = {\n ...queryOptions,\n fetchRange: async (range, signal) => {\n try {\n return await queryOptions.fetchRange(range, signal);\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n queryFn: async (context) => {\n try {\n return await queryOptions.queryFn(context);\n } catch (error) {\n throw normalizeSymmError(error);\n }\n },\n };\n const query = useInfiniteQuery(normalizedOptions) as UseInfiniteQueryResult<CandleHistoryData, SymmioRequestError>;\n const key = hashKey(queryOptions.queryKey);\n const optionsRef = useRef(normalizedOptions);\n optionsRef.current = normalizedOptions;\n const lifecycle = useRef<{ key: string; controller: AbortController } | undefined>(undefined);\n useEffect(() => {\n lifecycle.current = { key, controller: new AbortController() };\n return () => {\n if (lifecycle.current?.key === key) {\n lifecycle.current.controller.abort();\n lifecycle.current = undefined;\n }\n };\n }, [key]);\n\n const { isFetching, error, hasNextPage, fetchNextPage } = query;\n const loadOlder = useCallback(async () => {\n if (isFetching || error || !hasNextPage) return;\n await fetchNextPage({ cancelRefetch: false });\n }, [isFetching, error, hasNextPage, fetchNextPage]);\n const refresh = useCallback(\n async (range?: CandleHistoryRange) => {\n if (lifecycle.current?.key !== key) return;\n if (!range) {\n /** A full refresh supersedes queued corrections for this history. */\n lifecycle.current.controller.abort();\n lifecycle.current = { key, controller: new AbortController() };\n }\n const { signal } = lifecycle.current.controller;\n const original = optionsRef.current;\n try {\n await refreshCandleHistory(queryClient, { queryOptions: original, range, signal });\n } catch (error) {\n /** Request failures are already observable through the shared query state. */\n if (!signal.aborted && !queryClient.getQueryState(original.queryKey)?.error) throw normalizeSymmError(error);\n }\n },\n [key, queryClient],\n );\n return { ...query, loadOlder, refresh };\n}\n"],"mappings":";;;;;;AAyCA,SAAgB,EAAiB,GAAoE;CACnG,IAAM,EAAE,WAAQ,GAAG,MAAY,GACzB,IAAc,EAAe,GAC7B,IAAe,EAA6B,GAAQ,CAAO,GAC3D,IAAkD;EACtD,GAAG;EACH,YAAY,OAAO,GAAO,MAAW;GACnC,IAAI;IACF,OAAO,MAAM,EAAa,WAAW,GAAO,CAAM;GACpD,SAAS,GAAO;IACd,MAAM,EAAmB,CAAK;GAChC;EACF;EACA,SAAS,OAAO,MAAY;GAC1B,IAAI;IACF,OAAO,MAAM,EAAa,QAAQ,CAAO;GAC3C,SAAS,GAAO;IACd,MAAM,EAAmB,CAAK;GAChC;EACF;CACF,GACM,IAAQ,EAAiB,CAAiB,GAC1C,IAAM,EAAQ,EAAa,QAAQ,GACnC,IAAa,EAAO,CAAiB;CAC3C,EAAW,UAAU;CACrB,IAAM,IAAY,EAAiE,KAAA,CAAS;CAC5F,SACE,EAAU,UAAU;EAAE;EAAK,YAAY,IAAI,gBAAgB;CAAE,SAChD;EACX,AAAI,EAAU,SAAS,QAAQ,MAC7B,EAAU,QAAQ,WAAW,MAAM,GACnC,EAAU,UAAU,KAAA;CAExB,IACC,CAAC,CAAG,CAAC;CAER,IAAM,EAAE,eAAY,UAAO,gBAAa,qBAAkB,GACpD,IAAY,EAAY,YAAY;EACpC,KAAc,KAAS,CAAC,KAC5B,MAAM,EAAc,EAAE,eAAe,GAAM,CAAC;CAC9C,GAAG;EAAC;EAAY;EAAO;EAAa;CAAa,CAAC,GAC5C,IAAU,EACd,OAAO,MAA+B;EACpC,IAAI,EAAU,SAAS,QAAQ,GAAK;EACpC,AAAK,MAEH,EAAU,QAAQ,WAAW,MAAM,GACnC,EAAU,UAAU;GAAE;GAAK,YAAY,IAAI,gBAAgB;EAAE;EAE/D,IAAM,EAAE,cAAW,EAAU,QAAQ,YAC/B,IAAW,EAAW;EAC5B,IAAI;GACF,MAAM,EAAqB,GAAa;IAAE,cAAc;IAAU;IAAO;GAAO,CAAC;EACnF,SAAS,GAAO;GAEd,IAAI,CAAC,EAAO,WAAW,CAAC,EAAY,cAAc,EAAS,QAAQ,GAAG,OAAO,MAAM,EAAmB,CAAK;EAC7G;CACF,GACA,CAAC,GAAK,CAAW,CACnB;CACA,OAAO;EAAE,GAAG;EAAO;EAAW;CAAQ;AACxC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Candle, CandleResolution, CandleSource, CandleUpdateMeta, SocketStatus } from '@symmio/trading-core';
|
|
1
|
+
import { Candle, CandleHistoryRange, CandleResolution, CandleSource, CandleUpdateMeta, SocketStatus } from '@symmio/trading-core';
|
|
2
2
|
import { SymmioRequestError } from '../errors/symmio-request-error.js';
|
|
3
3
|
/**
|
|
4
4
|
* Parameters for {@link useCandleStream}.
|
|
@@ -21,10 +21,11 @@ export interface UseCandleStreamParameters {
|
|
|
21
21
|
*/
|
|
22
22
|
onCandle?: (candle: Candle, meta: CandleUpdateMeta) => void;
|
|
23
23
|
/**
|
|
24
|
-
* Called after
|
|
25
|
-
*
|
|
24
|
+
* Called after reconnects or when the source detects historical corrections.
|
|
25
|
+
* Forward the optional corrected range to history.refresh(range). Without a
|
|
26
|
+
* range, refetch all retained history through the present time.
|
|
26
27
|
*/
|
|
27
|
-
onReset?: () => void;
|
|
28
|
+
onReset?: (range?: CandleHistoryRange) => void;
|
|
28
29
|
}
|
|
29
30
|
/**
|
|
30
31
|
* Value returned by {@link useCandleStream}.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-candle-stream.d.ts","sourceRoot":"","sources":["../../src/candles/use-candle-stream.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"use-candle-stream.d.ts","sourceRoot":"","sources":["../../src/candles/use-candle-stream.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEzE;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,uEAAuE;IACvE,MAAM,EAAE,YAAY,CAAC;IACrB,sCAAsC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,0BAA0B;IAC1B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,kDAAkD;IAClD,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC5D;;;;OAIG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,kBAAkB,KAAK,IAAI,CAAC;CAChD;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,qEAAqE;IACrE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,uEAAuE;IACvE,MAAM,EAAE,OAAO,CAAC;IAChB,0BAA0B;IAC1B,MAAM,EAAE,YAAY,CAAC;IACrB,4DAA4D;IAC5D,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,yBAAyB,GAAG,yBAAyB,CA+DhG"}
|
|
@@ -5,27 +5,34 @@ import { useEffect as t, useRef as n, useState as r } from "react";
|
|
|
5
5
|
function i(i) {
|
|
6
6
|
let { source: a, marketName: o, resolution: s, enabled: c = !0, onCandle: l, onReset: u } = i, [d, f] = r(null), [p, m] = r(!1), [h, g] = r("closed"), [_, v] = r(null), y = n(l), b = n(u);
|
|
7
7
|
return y.current = l, b.current = u, t(() => {
|
|
8
|
-
if (!c || !a.watchCandles) {
|
|
8
|
+
if (f(null), m(!1), v(null), !c || !a.watchCandles) {
|
|
9
9
|
g("closed");
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
let t;
|
|
12
|
+
let t = !0, n;
|
|
14
13
|
try {
|
|
15
|
-
|
|
14
|
+
n = a.watchCandles({
|
|
16
15
|
marketName: o,
|
|
17
16
|
resolution: s,
|
|
18
|
-
onCandle: (e,
|
|
19
|
-
y.current?.(e,
|
|
17
|
+
onCandle: (e, n) => {
|
|
18
|
+
t && (y.current?.(e, n), f(e), m(n.closed));
|
|
20
19
|
},
|
|
21
|
-
onReset: () =>
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
onReset: (e) => {
|
|
21
|
+
t && (f(null), m(!1), b.current?.(e));
|
|
22
|
+
},
|
|
23
|
+
onStatusChange: (e) => {
|
|
24
|
+
t && g(e);
|
|
25
|
+
},
|
|
26
|
+
onError: (n) => {
|
|
27
|
+
t && v(e(n));
|
|
28
|
+
}
|
|
24
29
|
});
|
|
25
30
|
} catch (t) {
|
|
26
31
|
v(e(t)), g("closed");
|
|
27
32
|
}
|
|
28
|
-
return () =>
|
|
33
|
+
return () => {
|
|
34
|
+
t = !1, n?.();
|
|
35
|
+
};
|
|
29
36
|
}, [
|
|
30
37
|
c,
|
|
31
38
|
a,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-candle-stream.js","names":[],"sources":["../../src/candles/use-candle-stream.ts"],"sourcesContent":["\"use client\";\n\nimport type {
|
|
1
|
+
{"version":3,"file":"use-candle-stream.js","names":[],"sources":["../../src/candles/use-candle-stream.ts"],"sourcesContent":["\"use client\";\n\nimport type {\n Candle,\n CandleHistoryRange,\n CandleResolution,\n CandleSource,\n CandleUpdateMeta,\n SocketStatus,\n} from \"@symmio/trading-core\";\nimport { useEffect, useRef, useState } from \"react\";\nimport { normalizeSymmError } from \"../errors/normalize-symm-error\";\nimport type { SymmioRequestError } from \"../errors/symmio-request-error\";\n\n/**\n * Parameters for {@link useCandleStream}.\n */\nexport interface UseCandleStreamParameters {\n /** The candle source to stream from. Must implement `watchCandles`. */\n source: CandleSource;\n /** Market name as SYMMIO names it. */\n marketName: string;\n /** Bar size to stream. */\n resolution: CandleResolution;\n /** Subscribe only when `true`. Default `true`. */\n enabled?: boolean;\n /**\n * Called for every bar update, ahead of the state update.\n *\n * Use this to drive a chart imperatively (`series.update(...)`) without\n * re-rendering on every tick. The reference is read through a ref, so an\n * inline arrow does not re-subscribe.\n */\n onCandle?: (candle: Candle, meta: CandleUpdateMeta) => void;\n /**\n * Called after reconnects or when the source detects historical corrections.\n * Forward the optional corrected range to history.refresh(range). Without a\n * range, refetch all retained history through the present time.\n */\n onReset?: (range?: CandleHistoryRange) => void;\n}\n\n/**\n * Value returned by {@link useCandleStream}.\n */\nexport interface UseCandleStreamReturnType {\n /** The most recent bar, or `null` until the first update arrives. */\n candle: Candle | null;\n /** `true` when {@link UseCandleStreamReturnType.candle} has closed. */\n closed: boolean;\n /** Live socket status. */\n status: SocketStatus;\n /** Last transport or parse error, normalized, or `null`. */\n error: SymmioRequestError | null;\n}\n\n/**\n * Subscribe to live bar updates for one market and resolution.\n *\n * Returns the latest bar as state for simple cases (a price header, a\n * sparkline). For a full chart, prefer the `onCandle` callback and let the\n * charting library own the series — re-rendering a React tree on every tick is\n * wasted work when the chart mutates its own canvas.\n *\n * @param parameters - Source, market, resolution, and handlers.\n * @returns The latest bar plus connection status.\n *\n * @example\n * ```tsx\n * useCandleStream({\n * source,\n * marketName: \"BTCUSDT\",\n * resolution: \"1m\",\n * onCandle: (candle) => series.update(candle),\n * onReset: () => refetchHistory(),\n * });\n * ```\n */\nexport function useCandleStream(parameters: UseCandleStreamParameters): UseCandleStreamReturnType {\n const { source, marketName, resolution, enabled = true, onCandle, onReset } = parameters;\n\n const [candle, setCandle] = useState<Candle | null>(null);\n const [closed, setClosed] = useState(false);\n const [status, setStatus] = useState<SocketStatus>(\"closed\");\n const [error, setError] = useState<SymmioRequestError | null>(null);\n\n /**\n * Handlers are read through refs so a consumer passing inline arrows does not\n * tear down and re-dial the socket on every render.\n */\n const onCandleRef = useRef(onCandle);\n const onResetRef = useRef(onReset);\n onCandleRef.current = onCandle;\n onResetRef.current = onReset;\n\n useEffect(() => {\n setCandle(null);\n setClosed(false);\n setError(null);\n if (!enabled || !source.watchCandles) {\n setStatus(\"closed\");\n return;\n }\n\n let active = true;\n let unwatch: (() => void) | undefined;\n try {\n unwatch = source.watchCandles({\n marketName,\n resolution,\n onCandle: (next, meta) => {\n if (!active) return;\n onCandleRef.current?.(next, meta);\n setCandle(next);\n setClosed(meta.closed);\n },\n onReset: (range) => {\n if (!active) return;\n setCandle(null);\n setClosed(false);\n onResetRef.current?.(range);\n },\n onStatusChange: (next) => {\n if (active) setStatus(next);\n },\n onError: (err) => {\n if (active) setError(normalizeSymmError(err));\n },\n });\n } catch (err) {\n setError(normalizeSymmError(err));\n setStatus(\"closed\");\n }\n\n return () => {\n active = false;\n unwatch?.();\n };\n }, [enabled, source, marketName, resolution]);\n\n return { candle, closed, status, error };\n}\n"],"mappings":";;;;AA8EA,SAAgB,EAAgB,GAAkE;CAChG,IAAM,EAAE,WAAQ,eAAY,eAAY,aAAU,IAAM,aAAU,eAAY,GAExE,CAAC,GAAQ,KAAa,EAAwB,IAAI,GAClD,CAAC,GAAQ,KAAa,EAAS,EAAK,GACpC,CAAC,GAAQ,KAAa,EAAuB,QAAQ,GACrD,CAAC,GAAO,KAAY,EAAoC,IAAI,GAM5D,IAAc,EAAO,CAAQ,GAC7B,IAAa,EAAO,CAAO;CAiDjC,OAhDA,EAAY,UAAU,GACtB,EAAW,UAAU,GAErB,QAAgB;EAId,IAHA,EAAU,IAAI,GACd,EAAU,EAAK,GACf,EAAS,IAAI,GACT,CAAC,KAAW,CAAC,EAAO,cAAc;GACpC,EAAU,QAAQ;GAClB;EACF;EAEA,IAAI,IAAS,IACT;EACJ,IAAI;GACF,IAAU,EAAO,aAAa;IAC5B;IACA;IACA,WAAW,GAAM,MAAS;KACnB,MACL,EAAY,UAAU,GAAM,CAAI,GAChC,EAAU,CAAI,GACd,EAAU,EAAK,MAAM;IACvB;IACA,UAAU,MAAU;KACb,MACL,EAAU,IAAI,GACd,EAAU,EAAK,GACf,EAAW,UAAU,CAAK;IAC5B;IACA,iBAAiB,MAAS;KACxB,AAAI,KAAQ,EAAU,CAAI;IAC5B;IACA,UAAU,MAAQ;KAChB,AAAI,KAAQ,EAAS,EAAmB,CAAG,CAAC;IAC9C;GACF,CAAC;EACH,SAAS,GAAK;GAEZ,AADA,EAAS,EAAmB,CAAG,CAAC,GAChC,EAAU,QAAQ;EACpB;EAEA,aAAa;GAEX,AADA,IAAS,IACT,IAAU;EACZ;CACF,GAAG;EAAC;EAAS;EAAQ;EAAY;CAAU,CAAC,GAErC;EAAE;EAAQ;EAAQ;EAAQ;CAAM;AACzC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-candles.js","names":[],"sources":["../../src/candles/use-candles.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getCandlesQueryOptions,\n type CandleSource,\n type GetCandlesOptions,\n type GetCandlesReturnType,\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\";\n\n/**\n * Parameters for {@link useCandles}: the source to read from, the range to\n * fetch, and TanStack `query` overrides.\n */\nexport type UseCandlesParameters = GetCandlesOptions & {\n /** The candle source to read from, e.g. from {@link useBinanceCandleSource}. */\n source: CandleSource;\n};\n\n/** Return type of {@link useCandles}. */\nexport type UseCandlesReturnType = UseQueryResult<GetCandlesReturnType, SymmioRequestError>;\n\n/**\n * Fetch historical bars from a {@link CandleSource}.\n *\n * The source's `id` is part of the query key, so switching venues does not read\n * another venue's cached bars.\n *\n * Note that `from`/`to` are part of the key too. Passing a live `Date.now()`\n * mints a new cache entry on every render — derive the range from state that\n * only changes when the user actually pans or changes resolution.\n *\n * @param parameters - Source, market, resolution, range, and query overrides.\n * @returns A TanStack query result carrying the bars and a `noMoreData` flag.\n *\n * @example\n * ```tsx\n * const source = useBinanceCandleSource();\n * const { data, isLoading } = useCandles({\n * source,\n * marketName: \"BTCUSDT\",\n * resolution: \"1m\",\n * from: rangeStart,\n * to: rangeEnd,\n * });\n * ```\n */\nexport function useCandles(parameters: UseCandlesParameters): UseCandlesReturnType {\n const { source, ...options } = parameters;\n const queryOptions = getCandlesQueryOptions(source, options);\n\n return useQuery({\n ...queryOptions,\n queryFn: async () => {\n try {\n return await queryOptions.queryFn();\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseCandlesReturnType;\n}\n"],"mappings":";;;;;AAiDA,SAAgB,EAAW,GAAwD;CACjF,IAAM,EAAE,WAAQ,GAAG,MAAY,GACzB,IAAe,EAAuB,GAAQ,CAAO;CAE3D,OAAO,EAAS;EACd,GAAG;EACH,SAAS,
|
|
1
|
+
{"version":3,"file":"use-candles.js","names":[],"sources":["../../src/candles/use-candles.ts"],"sourcesContent":["\"use client\";\n\nimport {\n getCandlesQueryOptions,\n type CandleSource,\n type GetCandlesOptions,\n type GetCandlesReturnType,\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\";\n\n/**\n * Parameters for {@link useCandles}: the source to read from, the range to\n * fetch, and TanStack `query` overrides.\n */\nexport type UseCandlesParameters = GetCandlesOptions & {\n /** The candle source to read from, e.g. from {@link useBinanceCandleSource}. */\n source: CandleSource;\n};\n\n/** Return type of {@link useCandles}. */\nexport type UseCandlesReturnType = UseQueryResult<GetCandlesReturnType, SymmioRequestError>;\n\n/**\n * Fetch historical bars from a {@link CandleSource}.\n *\n * The source's `id` is part of the query key, so switching venues does not read\n * another venue's cached bars.\n *\n * Note that `from`/`to` are part of the key too. Passing a live `Date.now()`\n * mints a new cache entry on every render — derive the range from state that\n * only changes when the user actually pans or changes resolution.\n *\n * @param parameters - Source, market, resolution, range, and query overrides.\n * @returns A TanStack query result carrying the bars and a `noMoreData` flag.\n *\n * @example\n * ```tsx\n * const source = useBinanceCandleSource();\n * const { data, isLoading } = useCandles({\n * source,\n * marketName: \"BTCUSDT\",\n * resolution: \"1m\",\n * from: rangeStart,\n * to: rangeEnd,\n * });\n * ```\n */\nexport function useCandles(parameters: UseCandlesParameters): UseCandlesReturnType {\n const { source, ...options } = parameters;\n const queryOptions = getCandlesQueryOptions(source, options);\n\n return useQuery({\n ...queryOptions,\n queryFn: async (context) => {\n try {\n return await queryOptions.queryFn(context);\n } catch (err) {\n throw normalizeSymmError(err);\n }\n },\n }) as UseCandlesReturnType;\n}\n"],"mappings":";;;;;AAiDA,SAAgB,EAAW,GAAwD;CACjF,IAAM,EAAE,WAAQ,GAAG,MAAY,GACzB,IAAe,EAAuB,GAAQ,CAAO;CAE3D,OAAO,EAAS;EACd,GAAG;EACH,SAAS,OAAO,MAAY;GAC1B,IAAI;IACF,OAAO,MAAM,EAAa,QAAQ,CAAO;GAC3C,SAAS,GAAK;IACZ,MAAM,EAAmB,CAAG;GAC9B;EACF;CACF,CAAC;AACH"}
|