0xtrails 0.7.0 → 0.8.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/{ccip-fConRNoG.js → ccip-uMWNlvmJ.js} +34 -34
- package/dist/fees.d.ts.map +1 -1
- package/dist/{index-BbajxCG_.js → index-BiPwqVkZ.js} +31527 -28874
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +478 -456
- package/dist/intents.d.ts +10 -4
- package/dist/intents.d.ts.map +1 -1
- package/dist/prepareSend.d.ts +1 -1
- package/dist/prepareSend.d.ts.map +1 -1
- package/dist/prices.d.ts +2 -2
- package/dist/prices.d.ts.map +1 -1
- package/dist/refund.d.ts +116 -0
- package/dist/refund.d.ts.map +1 -0
- package/dist/tokenBalances.d.ts +1 -1
- package/dist/tokenBalances.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/crossChain.d.ts +4 -3
- package/dist/transactionIntent/handlers/crossChain.d.ts.map +1 -1
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts +3 -3
- package/dist/transactionIntent/handlers/sameChainSameToken.d.ts.map +1 -1
- package/dist/transactionIntent/quote/normalizeQuote.d.ts +1 -2
- package/dist/transactionIntent/quote/normalizeQuote.d.ts.map +1 -1
- package/dist/transactionIntent/quote/quoteHelpers.d.ts +3 -3
- package/dist/transactionIntent/quote/quoteHelpers.d.ts.map +1 -1
- package/dist/transactionIntent/types.d.ts +5 -4
- package/dist/transactionIntent/types.d.ts.map +1 -1
- package/dist/transactions.d.ts +4 -0
- package/dist/transactions.d.ts.map +1 -1
- package/dist/widget/components/AccountIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/components/ClassicSwap.d.ts +2 -1
- package/dist/widget/components/ClassicSwap.d.ts.map +1 -1
- package/dist/widget/components/Earn.d.ts +2 -1
- package/dist/widget/components/Earn.d.ts.map +1 -1
- package/dist/widget/components/ErrorDisplay.d.ts.map +1 -1
- package/dist/widget/components/Fund.d.ts +2 -1
- package/dist/widget/components/Fund.d.ts.map +1 -1
- package/dist/widget/components/FundSwap.d.ts +2 -1
- package/dist/widget/components/FundSwap.d.ts.map +1 -1
- package/dist/widget/components/Pay.d.ts +2 -1
- package/dist/widget/components/Pay.d.ts.map +1 -1
- package/dist/widget/components/PoolDeposit.d.ts +2 -1
- package/dist/widget/components/PoolDeposit.d.ts.map +1 -1
- package/dist/widget/components/QuoteDetails.d.ts +1 -0
- package/dist/widget/components/QuoteDetails.d.ts.map +1 -1
- package/dist/widget/components/Swap.d.ts +2 -1
- package/dist/widget/components/Swap.d.ts.map +1 -1
- package/dist/widget/components/TokenImage.d.ts.map +1 -1
- package/dist/widget/components/TransactionDetails.d.ts.map +1 -1
- package/dist/widget/css/compiled.css +1 -1
- package/dist/widget/hooks/useAmountUsd.d.ts.map +1 -1
- package/dist/widget/hooks/useDefaultTokenSelection.d.ts.map +1 -1
- package/dist/widget/hooks/useGetIntent.d.ts +18 -0
- package/dist/widget/hooks/useGetIntent.d.ts.map +1 -0
- package/dist/widget/hooks/useIntentTransactionHistory.d.ts.map +1 -1
- package/dist/widget/hooks/useQuote.d.ts +10 -7
- package/dist/widget/hooks/useQuote.d.ts.map +1 -1
- package/dist/widget/hooks/useSendForm.d.ts +3 -2
- package/dist/widget/hooks/useSendForm.d.ts.map +1 -1
- package/dist/widget/hooks/useTokenList.d.ts.map +1 -1
- package/dist/widget/hooks/useTrailsSendTransaction.d.ts.map +1 -1
- package/dist/widget/index.js +3 -3
- package/dist/widget/widget.d.ts +2 -1
- package/dist/widget/widget.d.ts.map +1 -1
- package/package.json +5 -12
- package/src/fees.ts +8 -2
- package/src/index.ts +33 -1
- package/src/intents.ts +34 -7
- package/src/prepareSend.ts +6 -4
- package/src/prices.ts +6 -6
- package/src/refund.ts +914 -0
- package/src/tokenBalances.ts +4 -14
- package/src/transactionIntent/handlers/crossChain.ts +21 -10
- package/src/transactionIntent/handlers/sameChainSameToken.ts +12 -8
- package/src/transactionIntent/quote/normalizeQuote.ts +29 -27
- package/src/transactionIntent/quote/quoteHelpers.ts +5 -9
- package/src/transactionIntent/types.ts +5 -3
- package/src/transactions.ts +5 -0
- package/src/widget/compiled.css +1 -1
- package/src/widget/components/AccountIntentTransactionHistory.tsx +197 -5
- package/src/widget/components/ClassicSwap.tsx +6 -3
- package/src/widget/components/Earn.tsx +6 -3
- package/src/widget/components/ErrorDisplay.tsx +6 -4
- package/src/widget/components/Fund.tsx +6 -3
- package/src/widget/components/FundSwap.tsx +2 -1
- package/src/widget/components/Pay.tsx +15 -7
- package/src/widget/components/PoolDeposit.tsx +6 -3
- package/src/widget/components/QuoteDetails.tsx +34 -38
- package/src/widget/components/Swap.tsx +2 -1
- package/src/widget/components/TokenImage.tsx +3 -1
- package/src/widget/components/TransactionDetails.tsx +108 -0
- package/src/widget/hooks/useAmountUsd.ts +0 -3
- package/src/widget/hooks/useDefaultTokenSelection.tsx +0 -3
- package/src/widget/hooks/useGetIntent.ts +53 -0
- package/src/widget/hooks/useIntentTransactionHistory.ts +85 -3
- package/src/widget/hooks/useQuote.ts +16 -10
- package/src/widget/hooks/useSendForm.ts +30 -15
- package/src/widget/hooks/useTokenList.ts +2 -4
- package/src/widget/hooks/useTrailsSendTransaction.ts +2 -1
- package/src/widget/widget.tsx +12 -6
- package/dist/sequenceWallet.d.ts +0 -67
- package/dist/sequenceWallet.d.ts.map +0 -1
- package/src/sequenceWallet.ts +0 -532
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
3
|
-
const { abi: r, data: e } = a, s = b(e, 0, 4), t = r.find((n) => n.type === "function" && s ===
|
|
1
|
+
import { aC as b, aD as O, aE as F, aF as q, aG as $, aH as L, aI as E, aJ as D, aK as w, aL as G, aM as R, aN as I, aO as T, aP as y, aQ as x, aR as M, aS as m, aT as C, aU as H, aV as U, aW as v, aX as j, aY as A, aZ as B } from "./index-BiPwqVkZ.js";
|
|
2
|
+
function J(a) {
|
|
3
|
+
const { abi: r, data: e } = a, s = b(e, 0, 4), t = r.find((n) => n.type === "function" && s === O(F(n)));
|
|
4
4
|
if (!t)
|
|
5
|
-
throw new
|
|
5
|
+
throw new q(s, {
|
|
6
6
|
docsPath: "/docs/contract/decodeFunctionData"
|
|
7
7
|
});
|
|
8
8
|
return {
|
|
@@ -15,14 +15,14 @@ function k(a) {
|
|
|
15
15
|
const { abi: r, errorName: e, args: s } = a;
|
|
16
16
|
let t = r[0];
|
|
17
17
|
if (e) {
|
|
18
|
-
const d =
|
|
18
|
+
const d = L({ abi: r, args: s, name: e });
|
|
19
19
|
if (!d)
|
|
20
20
|
throw new E(e, { docsPath: p });
|
|
21
21
|
t = d;
|
|
22
22
|
}
|
|
23
23
|
if (t.type !== "error")
|
|
24
24
|
throw new E(void 0, { docsPath: p });
|
|
25
|
-
const n = F(t), o =
|
|
25
|
+
const n = F(t), o = O(n);
|
|
26
26
|
let c = "0x";
|
|
27
27
|
if (s && s.length > 0) {
|
|
28
28
|
if (!t.inputs)
|
|
@@ -32,11 +32,11 @@ function k(a) {
|
|
|
32
32
|
return G([o, c]);
|
|
33
33
|
}
|
|
34
34
|
const h = "/docs/contract/encodeFunctionResult";
|
|
35
|
-
function
|
|
35
|
+
function W(a) {
|
|
36
36
|
const { abi: r, functionName: e, result: s } = a;
|
|
37
37
|
let t = r[0];
|
|
38
38
|
if (e) {
|
|
39
|
-
const o =
|
|
39
|
+
const o = L({ abi: r, name: e });
|
|
40
40
|
if (!o)
|
|
41
41
|
throw new R(e, { docsPath: h });
|
|
42
42
|
t = o;
|
|
@@ -52,11 +52,11 @@ function z(a) {
|
|
|
52
52
|
return [s];
|
|
53
53
|
if (Array.isArray(s))
|
|
54
54
|
return s;
|
|
55
|
-
throw new
|
|
55
|
+
throw new T(s);
|
|
56
56
|
})();
|
|
57
57
|
return w(t.outputs, n);
|
|
58
58
|
}
|
|
59
|
-
class
|
|
59
|
+
class _ extends y {
|
|
60
60
|
constructor({ callbackSelector: r, cause: e, data: s, extraData: t, sender: n, urls: o }) {
|
|
61
61
|
super(e.shortMessage || "An error occurred while fetching for an offchain result.", {
|
|
62
62
|
cause: e,
|
|
@@ -66,7 +66,7 @@ class J extends y {
|
|
|
66
66
|
"Offchain Gateway Call:",
|
|
67
67
|
o && [
|
|
68
68
|
" Gateway URL(s):",
|
|
69
|
-
...o.map((c) => ` ${
|
|
69
|
+
...o.map((c) => ` ${x(c)}`)
|
|
70
70
|
],
|
|
71
71
|
` Sender: ${n}`,
|
|
72
72
|
` Data: ${s}`,
|
|
@@ -77,18 +77,18 @@ class J extends y {
|
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
|
-
class
|
|
80
|
+
class K extends y {
|
|
81
81
|
constructor({ result: r, url: e }) {
|
|
82
82
|
super("Offchain gateway response is malformed. Response data must be a hex value.", {
|
|
83
83
|
metaMessages: [
|
|
84
|
-
`Gateway URL: ${
|
|
84
|
+
`Gateway URL: ${x(e)}`,
|
|
85
85
|
`Response: ${M(r)}`
|
|
86
86
|
],
|
|
87
87
|
name: "OffchainLookupResponseMalformedError"
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
class
|
|
91
|
+
class Q extends y {
|
|
92
92
|
constructor({ sender: r, to: e }) {
|
|
93
93
|
super("Reverted sender address does not match target contract address (`to`).", {
|
|
94
94
|
metaMessages: [
|
|
@@ -101,31 +101,31 @@ class K extends y {
|
|
|
101
101
|
}
|
|
102
102
|
const N = "x-batch-gateway:true";
|
|
103
103
|
async function P(a) {
|
|
104
|
-
const { data: r, ccipRequest: e } = a, { args: [s] } =
|
|
104
|
+
const { data: r, ccipRequest: e } = a, { args: [s] } = J({ abi: m, data: r }), t = [], n = [];
|
|
105
105
|
return await Promise.all(s.map(async (o, c) => {
|
|
106
106
|
try {
|
|
107
107
|
n[c] = o.urls.includes(N) ? await P({ data: o.data, ccipRequest: e }) : await e(o), t[c] = !1;
|
|
108
108
|
} catch (d) {
|
|
109
|
-
t[c] = !0, n[c] =
|
|
109
|
+
t[c] = !0, n[c] = V(d);
|
|
110
110
|
}
|
|
111
|
-
})),
|
|
111
|
+
})), W({
|
|
112
112
|
abi: m,
|
|
113
113
|
functionName: "query",
|
|
114
114
|
result: [t, n]
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
|
-
function
|
|
117
|
+
function V(a) {
|
|
118
118
|
return a.name === "HttpRequestError" && a.status ? k({
|
|
119
119
|
abi: m,
|
|
120
120
|
errorName: "HttpError",
|
|
121
121
|
args: [a.status, a.shortMessage]
|
|
122
122
|
}) : k({
|
|
123
|
-
abi: [
|
|
123
|
+
abi: [C],
|
|
124
124
|
errorName: "Error",
|
|
125
125
|
args: ["shortMessage" in a ? a.shortMessage : a.message]
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
const
|
|
128
|
+
const z = "0x556f1830", X = {
|
|
129
129
|
name: "OffchainLookup",
|
|
130
130
|
type: "error",
|
|
131
131
|
inputs: [
|
|
@@ -154,26 +154,26 @@ const Z = "0x556f1830", V = {
|
|
|
154
154
|
async function tt(a, { blockNumber: r, blockTag: e, data: s, to: t }) {
|
|
155
155
|
const { args: n } = H({
|
|
156
156
|
data: s,
|
|
157
|
-
abi: [
|
|
158
|
-
}), [o, c, d, i, u] = n, { ccipRead: f } = a, g = f && typeof f?.request == "function" ? f.request :
|
|
157
|
+
abi: [X]
|
|
158
|
+
}), [o, c, d, i, u] = n, { ccipRead: f } = a, g = f && typeof f?.request == "function" ? f.request : Y;
|
|
159
159
|
try {
|
|
160
|
-
if (!
|
|
161
|
-
throw new
|
|
160
|
+
if (!U(t, o))
|
|
161
|
+
throw new Q({ sender: o, to: t });
|
|
162
162
|
const l = c.includes(N) ? await P({
|
|
163
163
|
data: d,
|
|
164
164
|
ccipRequest: g
|
|
165
|
-
}) : await g({ data: d, sender: o, urls: c }), { data:
|
|
165
|
+
}) : await g({ data: d, sender: o, urls: c }), { data: S } = await v(a, {
|
|
166
166
|
blockNumber: r,
|
|
167
167
|
blockTag: e,
|
|
168
|
-
data:
|
|
168
|
+
data: j([
|
|
169
169
|
i,
|
|
170
170
|
w([{ type: "bytes" }, { type: "bytes" }], [l, u])
|
|
171
171
|
]),
|
|
172
172
|
to: t
|
|
173
173
|
});
|
|
174
|
-
return
|
|
174
|
+
return S;
|
|
175
175
|
} catch (l) {
|
|
176
|
-
throw new
|
|
176
|
+
throw new _({
|
|
177
177
|
callbackSelector: i,
|
|
178
178
|
cause: l,
|
|
179
179
|
data: s,
|
|
@@ -183,7 +183,7 @@ async function tt(a, { blockNumber: r, blockTag: e, data: s, to: t }) {
|
|
|
183
183
|
});
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
async function
|
|
186
|
+
async function Y({ data: a, sender: r, urls: e }) {
|
|
187
187
|
let s = new Error("An unknown error occurred.");
|
|
188
188
|
for (let t = 0; t < e.length; t++) {
|
|
189
189
|
const n = e[t], o = n.includes("{data}") ? "GET" : "POST", c = o === "POST" ? { data: a, sender: r } : void 0, d = o === "POST" ? { "Content-Type": "application/json" } : {};
|
|
@@ -204,8 +204,8 @@ async function X({ data: a, sender: r, urls: e }) {
|
|
|
204
204
|
});
|
|
205
205
|
continue;
|
|
206
206
|
}
|
|
207
|
-
if (!
|
|
208
|
-
s = new
|
|
207
|
+
if (!B(u)) {
|
|
208
|
+
s = new K({
|
|
209
209
|
result: u,
|
|
210
210
|
url: n
|
|
211
211
|
});
|
|
@@ -223,8 +223,8 @@ async function X({ data: a, sender: r, urls: e }) {
|
|
|
223
223
|
throw s;
|
|
224
224
|
}
|
|
225
225
|
export {
|
|
226
|
-
|
|
226
|
+
Y as ccipRequest,
|
|
227
227
|
tt as offchainLookup,
|
|
228
|
-
|
|
229
|
-
|
|
228
|
+
X as offchainLookupAbiItem,
|
|
229
|
+
z as offchainLookupSignature
|
|
230
230
|
};
|
package/dist/fees.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees.d.ts","sourceRoot":"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