@coinbase/cdp-hooks 0.0.71 → 0.0.72
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/README.md +37 -0
- package/dist/esm/index174.js +3 -3
- package/dist/esm/index203.js +2 -2
- package/dist/esm/index206.js +2 -2
- package/dist/esm/index207.js +1 -1
- package/dist/esm/index212.js +40 -38
- package/dist/esm/index213.js +2 -2
- package/dist/esm/index214.js +4 -69
- package/dist/esm/index215.js +10 -34
- package/dist/esm/index216.js +18 -13
- package/dist/esm/index217.js +7 -40
- package/dist/esm/index218.js +12 -2
- package/dist/esm/index219.js +66 -4
- package/dist/esm/index220.js +64 -9
- package/dist/esm/index221.js +183 -17
- package/dist/esm/index222.js +22 -7
- package/dist/esm/index223.js +41 -10
- package/dist/esm/index224.js +72 -62
- package/dist/esm/index225.js +36 -61
- package/dist/esm/index226.js +15 -184
- package/dist/esm/index227.js +12 -21
- package/dist/esm/index228.js +7 -42
- package/dist/esm/index229.js +6 -76
- package/dist/esm/index230.js +36 -40
- package/dist/esm/index231.js +15 -16
- package/dist/esm/index232.js +8 -13
- package/dist/esm/index233.js +12 -7
- package/dist/esm/index234.js +9 -6
- package/dist/esm/index235.js +16 -36
- package/dist/esm/index236.js +22 -15
- package/dist/esm/index237.js +29 -7
- package/dist/esm/index238.js +2 -13
- package/dist/esm/index239.js +13 -9
- package/dist/esm/index240.js +11 -15
- package/dist/esm/index241.js +45 -20
- package/dist/esm/index242.js +9 -30
- package/dist/esm/index243.js +14 -2
- package/dist/esm/index244.js +14 -13
- package/dist/esm/index245.js +8 -12
- package/dist/esm/index246.js +14 -46
- package/dist/esm/index247.js +23 -8
- package/dist/esm/index248.js +11 -13
- package/dist/esm/index249.js +24 -14
- package/dist/esm/index250.js +51 -8
- package/dist/esm/index251.js +15 -13
- package/dist/esm/index252.js +14 -24
- package/dist/esm/index253.js +11 -11
- package/dist/esm/index254.js +103 -24
- package/dist/esm/index255.js +5 -51
- package/dist/esm/index256.js +222 -16
- package/dist/esm/index257.js +6 -14
- package/dist/esm/index258.js +7 -12
- package/dist/esm/index259.js +24 -101
- package/dist/esm/index260.js +19 -5
- package/dist/esm/index261.js +140 -218
- package/dist/esm/index262.js +38 -6
- package/dist/esm/index263.js +2 -7
- package/dist/esm/index264.js +68 -25
- package/dist/esm/index265.js +34 -19
- package/dist/esm/index266.js +12 -143
- package/dist/esm/index274.js +3 -3
- package/dist/esm/index277.js +5 -5
- package/dist/esm/index278.js +4 -4
- package/dist/esm/index279.js +1 -1
- package/dist/esm/index281.js +2 -2
- package/dist/esm/index282.js +2 -2
- package/dist/esm/index283.js +1 -1
- package/dist/esm/index284.js +1 -1
- package/dist/esm/index285.js +65 -3
- package/dist/esm/index286.js +4 -65
- package/dist/esm/index287.js +40 -4
- package/dist/esm/index288.js +7 -40
- package/dist/esm/index289.js +62 -7
- package/dist/esm/index290.js +72 -57
- package/dist/esm/index291.js +4 -78
- package/dist/esm/index292.js +195 -4
- package/dist/esm/index293.js +3 -194
- package/dist/esm/index294.js +2 -2
- package/dist/esm/index3.js +1 -1
- package/dist/esm/index30.js +2 -2
- package/dist/esm/index37.js +1 -1
- package/dist/esm/index38.js +1 -1
- package/dist/esm/index41.js +3 -3
- package/dist/esm/index42.js +2 -2
- package/dist/esm/index43.js +3 -3
- package/dist/esm/index44.js +2 -2
- package/dist/esm/index45.js +3 -3
- package/dist/esm/index46.js +6 -6
- package/dist/esm/index47.js +2 -2
- package/dist/esm/index48.js +1 -1
- package/dist/esm/index49.js +1 -1
- package/dist/esm/index50.js +1 -1
- package/dist/esm/index51.js +1 -1
- package/dist/esm/index52.js +1 -1
- package/dist/esm/index53.js +1 -1
- package/dist/esm/index54.js +4 -4
- package/dist/esm/index55.js +1 -1
- package/dist/esm/index63.js +1 -1
- package/dist/esm/index64.js +2 -2
- package/dist/esm/index65.js +1 -1
- package/dist/esm/index70.js +1 -1
- package/dist/esm/index73.js +1 -1
- package/dist/esm/index76.js +1 -1
- package/dist/esm/index77.js +1 -1
- package/dist/esm/index78.js +3 -3
- package/dist/esm/index79.js +2 -2
- package/dist/esm/index80.js +1 -1
- package/dist/esm/index82.js +1 -1
- package/dist/esm/index83.js +1 -1
- package/dist/esm/index84.js +3 -3
- package/dist/esm/index85.js +3 -3
- package/dist/esm/index86.js +3 -3
- package/dist/esm/index87.js +3 -3
- package/dist/esm/index88.js +3 -3
- package/dist/esm/index89.js +3 -3
- package/dist/esm/index90.js +3 -3
- package/dist/esm/index91.js +1 -1
- package/dist/esm/index93.js +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1759,6 +1759,43 @@ function SendUserOperation() {
|
|
|
1759
1759
|
}
|
|
1760
1760
|
```
|
|
1761
1761
|
|
|
1762
|
+
**Transaction Attribution with EIP-8021:**
|
|
1763
|
+
|
|
1764
|
+
You can add attribution data to user operations for tracking app usage and revenue sharing:
|
|
1765
|
+
|
|
1766
|
+
```tsx lines
|
|
1767
|
+
import { useSendUserOperation, useCurrentUser } from "@coinbase/cdp-hooks";
|
|
1768
|
+
|
|
1769
|
+
function SendUserOperationWithAttribution() {
|
|
1770
|
+
const { sendUserOperation, status } = useSendUserOperation();
|
|
1771
|
+
const { currentUser } = useCurrentUser();
|
|
1772
|
+
|
|
1773
|
+
// EIP-8021 data suffix for "baseapp" attribution
|
|
1774
|
+
const dataSuffix = "0xdddddddd62617365617070070080218021802180218021802180218021";
|
|
1775
|
+
|
|
1776
|
+
const handleSendWithAttribution = async () => {
|
|
1777
|
+
const smartAccount = currentUser?.evmSmartAccountObjects?.[0]?.address;
|
|
1778
|
+
if (!smartAccount) return;
|
|
1779
|
+
|
|
1780
|
+
await sendUserOperation({
|
|
1781
|
+
evmSmartAccount: smartAccount,
|
|
1782
|
+
network: "base-sepolia",
|
|
1783
|
+
calls: [{ to: "0xTargetContract", value: 0n, data: "0x" }],
|
|
1784
|
+
dataSuffix, // Attribution data appended to callData
|
|
1785
|
+
useCdpPaymaster: true,
|
|
1786
|
+
});
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
return (
|
|
1790
|
+
<button onClick={handleSendWithAttribution} disabled={status === "pending"}>
|
|
1791
|
+
Send with Attribution
|
|
1792
|
+
</button>
|
|
1793
|
+
);
|
|
1794
|
+
}
|
|
1795
|
+
```
|
|
1796
|
+
|
|
1797
|
+
The `dataSuffix` parameter accepts a hex-encoded string following the [EIP-8021 standard](https://eip.tools/eip/8021). This enables onchain attribution for tracking and revenue sharing.
|
|
1798
|
+
|
|
1762
1799
|
#### Track User Operation Status
|
|
1763
1800
|
|
|
1764
1801
|
Use the `useWaitForUserOperation` hook to poll for user operation status and provide real-time updates. This hook immediately fires off a query to get the result of the user operation:
|
package/dist/esm/index174.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { sha256 as v } from "./
|
|
2
|
-
import { createCurve as G } from "./
|
|
3
|
-
import { Field as P, mod as h, pow2 as t } from "./
|
|
1
|
+
import { sha256 as v } from "./index254.js";
|
|
2
|
+
import { createCurve as G } from "./index255.js";
|
|
3
|
+
import { Field as P, mod as h, pow2 as t } from "./index256.js";
|
|
4
4
|
const B = {
|
|
5
5
|
p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
|
|
6
6
|
n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
|
package/dist/esm/index203.js
CHANGED
package/dist/esm/index206.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { split as L, rotlSH as T, rotlSL as S, rotlBH as m, rotlBL as F } from "./
|
|
2
|
-
import { createHasher as X, Hash as E, anumber as d, u32 as U, swap32IfBE as I, aexists as x, toBytes as P, abytes as k, aoutput as M, clean as y } from "./
|
|
1
|
+
import { split as L, rotlSH as T, rotlSL as S, rotlBH as m, rotlBL as F } from "./index260.js";
|
|
2
|
+
import { createHasher as X, Hash as E, anumber as d, u32 as U, swap32IfBE as I, aexists as x, toBytes as P, abytes as k, aoutput as M, clean as y } from "./index261.js";
|
|
3
3
|
const R = BigInt(0), f = BigInt(1), j = BigInt(2), q = BigInt(7), v = BigInt(256), z = BigInt(113), _ = [], g = [], B = [];
|
|
4
4
|
for (let n = 0, t = f, s = 1, i = 0; n < 24; n++) {
|
|
5
5
|
[s, i] = [i, (2 * s + 3 * i) % 5], _.push(2 * (5 * i + s)), g.push((n + 1) * (n + 2) / 2 % 64);
|
package/dist/esm/index207.js
CHANGED
package/dist/esm/index212.js
CHANGED
|
@@ -1,41 +1,43 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
1
|
+
import { version as u } from "./index213.js";
|
|
2
|
+
class a extends Error {
|
|
3
|
+
constructor(i, e = {}) {
|
|
4
|
+
const t = e.cause instanceof a ? e.cause.details : e.cause?.message ? e.cause.message : e.details, s = e.cause instanceof a && e.cause.docsPath || e.docsPath, r = [
|
|
5
|
+
i || "An error occurred.",
|
|
6
|
+
"",
|
|
7
|
+
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
8
|
+
...s ? [`Docs: https://abitype.dev${s}`] : [],
|
|
9
|
+
...t ? [`Details: ${t}`] : [],
|
|
10
|
+
`Version: abitype@${u}`
|
|
11
|
+
].join(`
|
|
12
|
+
`);
|
|
13
|
+
super(r), Object.defineProperty(this, "details", {
|
|
14
|
+
enumerable: !0,
|
|
15
|
+
configurable: !0,
|
|
16
|
+
writable: !0,
|
|
17
|
+
value: void 0
|
|
18
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
19
|
+
enumerable: !0,
|
|
20
|
+
configurable: !0,
|
|
21
|
+
writable: !0,
|
|
22
|
+
value: void 0
|
|
23
|
+
}), Object.defineProperty(this, "metaMessages", {
|
|
24
|
+
enumerable: !0,
|
|
25
|
+
configurable: !0,
|
|
26
|
+
writable: !0,
|
|
27
|
+
value: void 0
|
|
28
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
29
|
+
enumerable: !0,
|
|
30
|
+
configurable: !0,
|
|
31
|
+
writable: !0,
|
|
32
|
+
value: void 0
|
|
33
|
+
}), Object.defineProperty(this, "name", {
|
|
34
|
+
enumerable: !0,
|
|
35
|
+
configurable: !0,
|
|
36
|
+
writable: !0,
|
|
37
|
+
value: "AbiTypeError"
|
|
38
|
+
}), e.cause && (this.cause = e.cause), this.details = t, this.docsPath = s, this.metaMessages = e.metaMessages, this.shortMessage = i;
|
|
39
|
+
}
|
|
38
40
|
}
|
|
39
41
|
export {
|
|
40
|
-
|
|
42
|
+
a as BaseError
|
|
41
43
|
};
|
package/dist/esm/index213.js
CHANGED
package/dist/esm/index214.js
CHANGED
|
@@ -1,72 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
function
|
|
4
|
-
return h ? a.exports : (h = 1, function() {
|
|
5
|
-
var f = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", u = {
|
|
6
|
-
// Bit-wise rotation left
|
|
7
|
-
rotl: function(r, t) {
|
|
8
|
-
return r << t | r >>> 32 - t;
|
|
9
|
-
},
|
|
10
|
-
// Bit-wise rotation right
|
|
11
|
-
rotr: function(r, t) {
|
|
12
|
-
return r << 32 - t | r >>> t;
|
|
13
|
-
},
|
|
14
|
-
// Swap big-endian to little-endian and vice versa
|
|
15
|
-
endian: function(r) {
|
|
16
|
-
if (r.constructor == Number)
|
|
17
|
-
return u.rotl(r, 8) & 16711935 | u.rotl(r, 24) & 4278255360;
|
|
18
|
-
for (var t = 0; t < r.length; t++)
|
|
19
|
-
r[t] = u.endian(r[t]);
|
|
20
|
-
return r;
|
|
21
|
-
},
|
|
22
|
-
// Generate an array of any length of random bytes
|
|
23
|
-
randomBytes: function(r) {
|
|
24
|
-
for (var t = []; r > 0; r--)
|
|
25
|
-
t.push(Math.floor(Math.random() * 256));
|
|
26
|
-
return t;
|
|
27
|
-
},
|
|
28
|
-
// Convert a byte array to big-endian 32-bit words
|
|
29
|
-
bytesToWords: function(r) {
|
|
30
|
-
for (var t = [], n = 0, o = 0; n < r.length; n++, o += 8)
|
|
31
|
-
t[o >>> 5] |= r[n] << 24 - o % 32;
|
|
32
|
-
return t;
|
|
33
|
-
},
|
|
34
|
-
// Convert big-endian 32-bit words to a byte array
|
|
35
|
-
wordsToBytes: function(r) {
|
|
36
|
-
for (var t = [], n = 0; n < r.length * 32; n += 8)
|
|
37
|
-
t.push(r[n >>> 5] >>> 24 - n % 32 & 255);
|
|
38
|
-
return t;
|
|
39
|
-
},
|
|
40
|
-
// Convert a byte array to a hex string
|
|
41
|
-
bytesToHex: function(r) {
|
|
42
|
-
for (var t = [], n = 0; n < r.length; n++)
|
|
43
|
-
t.push((r[n] >>> 4).toString(16)), t.push((r[n] & 15).toString(16));
|
|
44
|
-
return t.join("");
|
|
45
|
-
},
|
|
46
|
-
// Convert a hex string to a byte array
|
|
47
|
-
hexToBytes: function(r) {
|
|
48
|
-
for (var t = [], n = 0; n < r.length; n += 2)
|
|
49
|
-
t.push(parseInt(r.substr(n, 2), 16));
|
|
50
|
-
return t;
|
|
51
|
-
},
|
|
52
|
-
// Convert a byte array to a base-64 string
|
|
53
|
-
bytesToBase64: function(r) {
|
|
54
|
-
for (var t = [], n = 0; n < r.length; n += 3)
|
|
55
|
-
for (var o = r[n] << 16 | r[n + 1] << 8 | r[n + 2], e = 0; e < 4; e++)
|
|
56
|
-
n * 8 + e * 6 <= r.length * 8 ? t.push(f.charAt(o >>> 6 * (3 - e) & 63)) : t.push("=");
|
|
57
|
-
return t.join("");
|
|
58
|
-
},
|
|
59
|
-
// Convert a base-64 string to a byte array
|
|
60
|
-
base64ToBytes: function(r) {
|
|
61
|
-
r = r.replace(/[^A-Z0-9+\/]/ig, "");
|
|
62
|
-
for (var t = [], n = 0, o = 0; n < r.length; o = ++n % 4)
|
|
63
|
-
o != 0 && t.push((f.indexOf(r.charAt(n - 1)) & Math.pow(2, -2 * o + 8) - 1) << o * 2 | f.indexOf(r.charAt(n)) >>> 6 - o * 2);
|
|
64
|
-
return t;
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
a.exports = u;
|
|
68
|
-
}(), a.exports);
|
|
1
|
+
import { formatAbiParameters as r } from "./index215.js";
|
|
2
|
+
function e(t) {
|
|
3
|
+
return t.type === "function" ? `function ${t.name}(${r(t.inputs)})${t.stateMutability && t.stateMutability !== "nonpayable" ? ` ${t.stateMutability}` : ""}${t.outputs?.length ? ` returns (${r(t.outputs)})` : ""}` : t.type === "event" ? `event ${t.name}(${r(t.inputs)})` : t.type === "error" ? `error ${t.name}(${r(t.inputs)})` : t.type === "constructor" ? `constructor(${r(t.inputs)})${t.stateMutability === "payable" ? " payable" : ""}` : t.type === "fallback" ? `fallback() external${t.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
|
|
69
4
|
}
|
|
70
5
|
export {
|
|
71
|
-
|
|
6
|
+
e as formatAbiItem
|
|
72
7
|
};
|
package/dist/esm/index215.js
CHANGED
|
@@ -1,37 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return t.bin.stringToBytes(unescape(encodeURIComponent(n)));
|
|
11
|
-
},
|
|
12
|
-
// Convert a byte array to a string
|
|
13
|
-
bytesToString: function(n) {
|
|
14
|
-
return decodeURIComponent(escape(t.bin.bytesToString(n)));
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
// Binary encoding
|
|
18
|
-
bin: {
|
|
19
|
-
// Convert a string to a byte array
|
|
20
|
-
stringToBytes: function(n) {
|
|
21
|
-
for (var e = [], r = 0; r < n.length; r++)
|
|
22
|
-
e.push(n.charCodeAt(r) & 255);
|
|
23
|
-
return e;
|
|
24
|
-
},
|
|
25
|
-
// Convert a byte array to a string
|
|
26
|
-
bytesToString: function(n) {
|
|
27
|
-
for (var e = [], r = 0; r < n.length; r++)
|
|
28
|
-
e.push(String.fromCharCode(n[r]));
|
|
29
|
-
return e.join("");
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
return o = t, o;
|
|
1
|
+
import { formatAbiParameter as m } from "./index216.js";
|
|
2
|
+
function f(e) {
|
|
3
|
+
let r = "";
|
|
4
|
+
const o = e.length;
|
|
5
|
+
for (let t = 0; t < o; t++) {
|
|
6
|
+
const a = e[t];
|
|
7
|
+
r += m(a), t !== o - 1 && (r += ", ");
|
|
8
|
+
}
|
|
9
|
+
return r;
|
|
34
10
|
}
|
|
35
11
|
export {
|
|
36
|
-
|
|
12
|
+
f as formatAbiParameters
|
|
37
13
|
};
|
package/dist/esm/index216.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { execTyped as f } from "./index217.js";
|
|
2
|
+
const p = /^tuple(?<array>(\[(\d*)\])*)$/;
|
|
3
|
+
function c(n) {
|
|
4
|
+
let t = n.type;
|
|
5
|
+
if (p.test(n.type) && "components" in n) {
|
|
6
|
+
t = "(";
|
|
7
|
+
const e = n.components.length;
|
|
8
|
+
for (let o = 0; o < e; o++) {
|
|
9
|
+
const d = n.components[o];
|
|
10
|
+
t += c(d), o < e - 1 && (t += ", ");
|
|
11
|
+
}
|
|
12
|
+
const s = f(p, n.type);
|
|
13
|
+
return t += `)${s?.array ?? ""}`, c({
|
|
14
|
+
...n,
|
|
15
|
+
type: t
|
|
16
|
+
});
|
|
9
17
|
}
|
|
10
|
-
|
|
11
|
-
return typeof r.readFloatLE == "function" && typeof r.slice == "function" && u(r.slice(0, 0));
|
|
12
|
-
}
|
|
13
|
-
return f;
|
|
18
|
+
return "indexed" in n && n.indexed && (t = `${t} indexed`), n.name ? `${t} ${n.name}` : t;
|
|
14
19
|
}
|
|
15
20
|
export {
|
|
16
|
-
|
|
21
|
+
c as formatAbiParameter
|
|
17
22
|
};
|
package/dist/esm/index217.js
CHANGED
|
@@ -1,43 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
constructor(i, e = {}) {
|
|
4
|
-
const t = e.cause instanceof a ? e.cause.details : e.cause?.message ? e.cause.message : e.details, s = e.cause instanceof a && e.cause.docsPath || e.docsPath, r = [
|
|
5
|
-
i || "An error occurred.",
|
|
6
|
-
"",
|
|
7
|
-
...e.metaMessages ? [...e.metaMessages, ""] : [],
|
|
8
|
-
...s ? [`Docs: https://abitype.dev${s}`] : [],
|
|
9
|
-
...t ? [`Details: ${t}`] : [],
|
|
10
|
-
`Version: abitype@${u}`
|
|
11
|
-
].join(`
|
|
12
|
-
`);
|
|
13
|
-
super(r), Object.defineProperty(this, "details", {
|
|
14
|
-
enumerable: !0,
|
|
15
|
-
configurable: !0,
|
|
16
|
-
writable: !0,
|
|
17
|
-
value: void 0
|
|
18
|
-
}), Object.defineProperty(this, "docsPath", {
|
|
19
|
-
enumerable: !0,
|
|
20
|
-
configurable: !0,
|
|
21
|
-
writable: !0,
|
|
22
|
-
value: void 0
|
|
23
|
-
}), Object.defineProperty(this, "metaMessages", {
|
|
24
|
-
enumerable: !0,
|
|
25
|
-
configurable: !0,
|
|
26
|
-
writable: !0,
|
|
27
|
-
value: void 0
|
|
28
|
-
}), Object.defineProperty(this, "shortMessage", {
|
|
29
|
-
enumerable: !0,
|
|
30
|
-
configurable: !0,
|
|
31
|
-
writable: !0,
|
|
32
|
-
value: void 0
|
|
33
|
-
}), Object.defineProperty(this, "name", {
|
|
34
|
-
enumerable: !0,
|
|
35
|
-
configurable: !0,
|
|
36
|
-
writable: !0,
|
|
37
|
-
value: "AbiTypeError"
|
|
38
|
-
}), e.cause && (this.cause = e.cause), this.details = t, this.docsPath = s, this.metaMessages = e.metaMessages, this.shortMessage = i;
|
|
39
|
-
}
|
|
1
|
+
function n(e, t) {
|
|
2
|
+
return e.exec(t)?.groups;
|
|
40
3
|
}
|
|
4
|
+
const s = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, o = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/, x = /^\(.+?\).*?$/;
|
|
41
5
|
export {
|
|
42
|
-
|
|
6
|
+
s as bytesRegex,
|
|
7
|
+
n as execTyped,
|
|
8
|
+
o as integerRegex,
|
|
9
|
+
x as isTupleRegex
|
|
43
10
|
};
|
package/dist/esm/index218.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
|
|
1
|
+
import { isStructSignature as c } from "./index219.js";
|
|
2
|
+
import { parseStructs as s } from "./index220.js";
|
|
3
|
+
import { parseSignature as p } from "./index221.js";
|
|
4
|
+
function a(t) {
|
|
5
|
+
const i = s(t), o = [], e = t.length;
|
|
6
|
+
for (let r = 0; r < e; r++) {
|
|
7
|
+
const n = t[r];
|
|
8
|
+
c(n) || o.push(p(n, i));
|
|
9
|
+
}
|
|
10
|
+
return o;
|
|
11
|
+
}
|
|
2
12
|
export {
|
|
3
|
-
|
|
13
|
+
a as parseAbi
|
|
4
14
|
};
|
package/dist/esm/index219.js
CHANGED
|
@@ -1,7 +1,69 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { execTyped as t } from "./index217.js";
|
|
2
|
+
const n = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
3
|
+
function g(e) {
|
|
4
|
+
return n.test(e);
|
|
4
5
|
}
|
|
6
|
+
function S(e) {
|
|
7
|
+
return t(n, e);
|
|
8
|
+
}
|
|
9
|
+
const r = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
10
|
+
function l(e) {
|
|
11
|
+
return r.test(e);
|
|
12
|
+
}
|
|
13
|
+
function f(e) {
|
|
14
|
+
return t(r, e);
|
|
15
|
+
}
|
|
16
|
+
const a = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
|
|
17
|
+
function x(e) {
|
|
18
|
+
return a.test(e);
|
|
19
|
+
}
|
|
20
|
+
function p(e) {
|
|
21
|
+
return t(a, e);
|
|
22
|
+
}
|
|
23
|
+
const u = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
|
|
24
|
+
function $(e) {
|
|
25
|
+
return u.test(e);
|
|
26
|
+
}
|
|
27
|
+
function b(e) {
|
|
28
|
+
return t(u, e);
|
|
29
|
+
}
|
|
30
|
+
const i = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
|
|
31
|
+
function m(e) {
|
|
32
|
+
return i.test(e);
|
|
33
|
+
}
|
|
34
|
+
function y(e) {
|
|
35
|
+
return t(i, e);
|
|
36
|
+
}
|
|
37
|
+
const c = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
|
|
38
|
+
function v(e) {
|
|
39
|
+
return c.test(e);
|
|
40
|
+
}
|
|
41
|
+
function z(e) {
|
|
42
|
+
return t(c, e);
|
|
43
|
+
}
|
|
44
|
+
const o = /^receive\(\) external payable$/;
|
|
45
|
+
function A(e) {
|
|
46
|
+
return o.test(e);
|
|
47
|
+
}
|
|
48
|
+
const R = /* @__PURE__ */ new Set(["indexed"]), Z = /* @__PURE__ */ new Set([
|
|
49
|
+
"calldata",
|
|
50
|
+
"memory",
|
|
51
|
+
"storage"
|
|
52
|
+
]);
|
|
5
53
|
export {
|
|
6
|
-
|
|
54
|
+
R as eventModifiers,
|
|
55
|
+
y as execConstructorSignature,
|
|
56
|
+
S as execErrorSignature,
|
|
57
|
+
f as execEventSignature,
|
|
58
|
+
z as execFallbackSignature,
|
|
59
|
+
p as execFunctionSignature,
|
|
60
|
+
b as execStructSignature,
|
|
61
|
+
Z as functionModifiers,
|
|
62
|
+
m as isConstructorSignature,
|
|
63
|
+
g as isErrorSignature,
|
|
64
|
+
l as isEventSignature,
|
|
65
|
+
v as isFallbackSignature,
|
|
66
|
+
x as isFunctionSignature,
|
|
67
|
+
A as isReceiveSignature,
|
|
68
|
+
$ as isStructSignature
|
|
7
69
|
};
|
package/dist/esm/index220.js
CHANGED
|
@@ -1,13 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { isTupleRegex as g, execTyped as w } from "./index217.js";
|
|
2
|
+
import { UnknownTypeError as S } from "./index223.js";
|
|
3
|
+
import { InvalidAbiTypeParameterError as d } from "./index224.js";
|
|
4
|
+
import { InvalidSignatureError as T, InvalidStructSignatureError as v } from "./index225.js";
|
|
5
|
+
import { CircularReferenceError as x } from "./index227.js";
|
|
6
|
+
import { isStructSignature as E, execStructSignature as b } from "./index219.js";
|
|
7
|
+
import { parseAbiParameter as A, isSolidityType as $ } from "./index221.js";
|
|
8
|
+
function C(s) {
|
|
9
|
+
const n = {}, c = s.length;
|
|
10
|
+
for (let t = 0; t < c; t++) {
|
|
11
|
+
const i = s[t];
|
|
12
|
+
if (!E(i))
|
|
13
|
+
continue;
|
|
14
|
+
const r = b(i);
|
|
15
|
+
if (!r)
|
|
16
|
+
throw new T({ signature: i, type: "struct" });
|
|
17
|
+
const u = r.properties.split(";"), e = [], h = u.length;
|
|
18
|
+
for (let l = 0; l < h; l++) {
|
|
19
|
+
const m = u[l].trim();
|
|
20
|
+
if (!m)
|
|
21
|
+
continue;
|
|
22
|
+
const y = A(m, {
|
|
23
|
+
type: "struct"
|
|
24
|
+
});
|
|
25
|
+
e.push(y);
|
|
26
|
+
}
|
|
27
|
+
if (!e.length)
|
|
28
|
+
throw new v({ signature: i });
|
|
29
|
+
n[r.name] = e;
|
|
8
30
|
}
|
|
9
|
-
|
|
31
|
+
const o = {}, a = Object.entries(n), p = a.length;
|
|
32
|
+
for (let t = 0; t < p; t++) {
|
|
33
|
+
const [i, r] = a[t];
|
|
34
|
+
o[i] = f(r, n);
|
|
35
|
+
}
|
|
36
|
+
return o;
|
|
37
|
+
}
|
|
38
|
+
const I = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
|
|
39
|
+
function f(s, n, c = /* @__PURE__ */ new Set()) {
|
|
40
|
+
const o = [], a = s.length;
|
|
41
|
+
for (let p = 0; p < a; p++) {
|
|
42
|
+
const t = s[p];
|
|
43
|
+
if (g.test(t.type))
|
|
44
|
+
o.push(t);
|
|
45
|
+
else {
|
|
46
|
+
const r = w(I, t.type);
|
|
47
|
+
if (!r?.type)
|
|
48
|
+
throw new d({ abiParameter: t });
|
|
49
|
+
const { array: u, type: e } = r;
|
|
50
|
+
if (e in n) {
|
|
51
|
+
if (c.has(e))
|
|
52
|
+
throw new x({ type: e });
|
|
53
|
+
o.push({
|
|
54
|
+
...t,
|
|
55
|
+
type: `tuple${u ?? ""}`,
|
|
56
|
+
components: f(n[e] ?? [], n, /* @__PURE__ */ new Set([...c, e]))
|
|
57
|
+
});
|
|
58
|
+
} else if ($(e))
|
|
59
|
+
o.push(t);
|
|
60
|
+
else
|
|
61
|
+
throw new S({ type: e });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return o;
|
|
10
65
|
}
|
|
11
66
|
export {
|
|
12
|
-
|
|
67
|
+
C as parseStructs
|
|
13
68
|
};
|