@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.
Files changed (119) hide show
  1. package/README.md +37 -0
  2. package/dist/esm/index174.js +3 -3
  3. package/dist/esm/index203.js +2 -2
  4. package/dist/esm/index206.js +2 -2
  5. package/dist/esm/index207.js +1 -1
  6. package/dist/esm/index212.js +40 -38
  7. package/dist/esm/index213.js +2 -2
  8. package/dist/esm/index214.js +4 -69
  9. package/dist/esm/index215.js +10 -34
  10. package/dist/esm/index216.js +18 -13
  11. package/dist/esm/index217.js +7 -40
  12. package/dist/esm/index218.js +12 -2
  13. package/dist/esm/index219.js +66 -4
  14. package/dist/esm/index220.js +64 -9
  15. package/dist/esm/index221.js +183 -17
  16. package/dist/esm/index222.js +22 -7
  17. package/dist/esm/index223.js +41 -10
  18. package/dist/esm/index224.js +72 -62
  19. package/dist/esm/index225.js +36 -61
  20. package/dist/esm/index226.js +15 -184
  21. package/dist/esm/index227.js +12 -21
  22. package/dist/esm/index228.js +7 -42
  23. package/dist/esm/index229.js +6 -76
  24. package/dist/esm/index230.js +36 -40
  25. package/dist/esm/index231.js +15 -16
  26. package/dist/esm/index232.js +8 -13
  27. package/dist/esm/index233.js +12 -7
  28. package/dist/esm/index234.js +9 -6
  29. package/dist/esm/index235.js +16 -36
  30. package/dist/esm/index236.js +22 -15
  31. package/dist/esm/index237.js +29 -7
  32. package/dist/esm/index238.js +2 -13
  33. package/dist/esm/index239.js +13 -9
  34. package/dist/esm/index240.js +11 -15
  35. package/dist/esm/index241.js +45 -20
  36. package/dist/esm/index242.js +9 -30
  37. package/dist/esm/index243.js +14 -2
  38. package/dist/esm/index244.js +14 -13
  39. package/dist/esm/index245.js +8 -12
  40. package/dist/esm/index246.js +14 -46
  41. package/dist/esm/index247.js +23 -8
  42. package/dist/esm/index248.js +11 -13
  43. package/dist/esm/index249.js +24 -14
  44. package/dist/esm/index250.js +51 -8
  45. package/dist/esm/index251.js +15 -13
  46. package/dist/esm/index252.js +14 -24
  47. package/dist/esm/index253.js +11 -11
  48. package/dist/esm/index254.js +103 -24
  49. package/dist/esm/index255.js +5 -51
  50. package/dist/esm/index256.js +222 -16
  51. package/dist/esm/index257.js +6 -14
  52. package/dist/esm/index258.js +7 -12
  53. package/dist/esm/index259.js +24 -101
  54. package/dist/esm/index260.js +19 -5
  55. package/dist/esm/index261.js +140 -218
  56. package/dist/esm/index262.js +38 -6
  57. package/dist/esm/index263.js +2 -7
  58. package/dist/esm/index264.js +68 -25
  59. package/dist/esm/index265.js +34 -19
  60. package/dist/esm/index266.js +12 -143
  61. package/dist/esm/index274.js +3 -3
  62. package/dist/esm/index277.js +5 -5
  63. package/dist/esm/index278.js +4 -4
  64. package/dist/esm/index279.js +1 -1
  65. package/dist/esm/index281.js +2 -2
  66. package/dist/esm/index282.js +2 -2
  67. package/dist/esm/index283.js +1 -1
  68. package/dist/esm/index284.js +1 -1
  69. package/dist/esm/index285.js +65 -3
  70. package/dist/esm/index286.js +4 -65
  71. package/dist/esm/index287.js +40 -4
  72. package/dist/esm/index288.js +7 -40
  73. package/dist/esm/index289.js +62 -7
  74. package/dist/esm/index290.js +72 -57
  75. package/dist/esm/index291.js +4 -78
  76. package/dist/esm/index292.js +195 -4
  77. package/dist/esm/index293.js +3 -194
  78. package/dist/esm/index294.js +2 -2
  79. package/dist/esm/index3.js +1 -1
  80. package/dist/esm/index30.js +2 -2
  81. package/dist/esm/index37.js +1 -1
  82. package/dist/esm/index38.js +1 -1
  83. package/dist/esm/index41.js +3 -3
  84. package/dist/esm/index42.js +2 -2
  85. package/dist/esm/index43.js +3 -3
  86. package/dist/esm/index44.js +2 -2
  87. package/dist/esm/index45.js +3 -3
  88. package/dist/esm/index46.js +6 -6
  89. package/dist/esm/index47.js +2 -2
  90. package/dist/esm/index48.js +1 -1
  91. package/dist/esm/index49.js +1 -1
  92. package/dist/esm/index50.js +1 -1
  93. package/dist/esm/index51.js +1 -1
  94. package/dist/esm/index52.js +1 -1
  95. package/dist/esm/index53.js +1 -1
  96. package/dist/esm/index54.js +4 -4
  97. package/dist/esm/index55.js +1 -1
  98. package/dist/esm/index63.js +1 -1
  99. package/dist/esm/index64.js +2 -2
  100. package/dist/esm/index65.js +1 -1
  101. package/dist/esm/index70.js +1 -1
  102. package/dist/esm/index73.js +1 -1
  103. package/dist/esm/index76.js +1 -1
  104. package/dist/esm/index77.js +1 -1
  105. package/dist/esm/index78.js +3 -3
  106. package/dist/esm/index79.js +2 -2
  107. package/dist/esm/index80.js +1 -1
  108. package/dist/esm/index82.js +1 -1
  109. package/dist/esm/index83.js +1 -1
  110. package/dist/esm/index84.js +3 -3
  111. package/dist/esm/index85.js +3 -3
  112. package/dist/esm/index86.js +3 -3
  113. package/dist/esm/index87.js +3 -3
  114. package/dist/esm/index88.js +3 -3
  115. package/dist/esm/index89.js +3 -3
  116. package/dist/esm/index90.js +3 -3
  117. package/dist/esm/index91.js +1 -1
  118. package/dist/esm/index93.js +1 -1
  119. 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:
@@ -1,6 +1,6 @@
1
- import { sha256 as v } from "./index259.js";
2
- import { createCurve as G } from "./index260.js";
3
- import { Field as P, mod as h, pow2 as t } from "./index261.js";
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"),
@@ -1,5 +1,5 @@
1
- import { hashSignature as t } from "./index262.js";
2
- import { toSignature as o } from "./index263.js";
1
+ import { hashSignature as t } from "./index257.js";
2
+ import { toSignature as o } from "./index258.js";
3
3
  function a(r) {
4
4
  return t(o(r));
5
5
  }
@@ -1,5 +1,5 @@
1
- import { split as L, rotlSH as T, rotlSL as S, rotlBH as m, rotlBL as F } from "./index265.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 "./index266.js";
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);
@@ -1,4 +1,4 @@
1
- import { sha256 as s } from "./index259.js";
1
+ import { sha256 as s } from "./index254.js";
2
2
  const o = s;
3
3
  export {
4
4
  o as sha256
@@ -1,41 +1,43 @@
1
- import { __module as h } from "./index213.js";
2
- import { __require as S } from "./index214.js";
3
- import { __require as q } from "./index215.js";
4
- import { __require as w } from "./index216.js";
5
- var x;
6
- function G() {
7
- return x ? h.exports : (x = 1, function() {
8
- var v = S(), p = q().utf8, B = w(), F = q().bin, d = function(o, f) {
9
- o.constructor == String ? f && f.encoding === "binary" ? o = F.stringToBytes(o) : o = p.stringToBytes(o) : B(o) ? o = Array.prototype.slice.call(o, 0) : !Array.isArray(o) && o.constructor !== Uint8Array && (o = o.toString());
10
- for (var u = v.bytesToWords(o), a = o.length * 8, n = 1732584193, r = -271733879, i = -1732584194, t = 271733878, e = 0; e < u.length; e++)
11
- u[e] = (u[e] << 8 | u[e] >>> 24) & 16711935 | (u[e] << 24 | u[e] >>> 8) & 4278255360;
12
- u[a >>> 5] |= 128 << a % 32, u[(a + 64 >>> 9 << 4) + 14] = a;
13
- for (var _ = d._ff, c = d._gg, l = d._hh, y = d._ii, e = 0; e < u.length; e += 16) {
14
- var T = n, b = r, A = i, I = t;
15
- n = _(n, r, i, t, u[e + 0], 7, -680876936), t = _(t, n, r, i, u[e + 1], 12, -389564586), i = _(i, t, n, r, u[e + 2], 17, 606105819), r = _(r, i, t, n, u[e + 3], 22, -1044525330), n = _(n, r, i, t, u[e + 4], 7, -176418897), t = _(t, n, r, i, u[e + 5], 12, 1200080426), i = _(i, t, n, r, u[e + 6], 17, -1473231341), r = _(r, i, t, n, u[e + 7], 22, -45705983), n = _(n, r, i, t, u[e + 8], 7, 1770035416), t = _(t, n, r, i, u[e + 9], 12, -1958414417), i = _(i, t, n, r, u[e + 10], 17, -42063), r = _(r, i, t, n, u[e + 11], 22, -1990404162), n = _(n, r, i, t, u[e + 12], 7, 1804603682), t = _(t, n, r, i, u[e + 13], 12, -40341101), i = _(i, t, n, r, u[e + 14], 17, -1502002290), r = _(r, i, t, n, u[e + 15], 22, 1236535329), n = c(n, r, i, t, u[e + 1], 5, -165796510), t = c(t, n, r, i, u[e + 6], 9, -1069501632), i = c(i, t, n, r, u[e + 11], 14, 643717713), r = c(r, i, t, n, u[e + 0], 20, -373897302), n = c(n, r, i, t, u[e + 5], 5, -701558691), t = c(t, n, r, i, u[e + 10], 9, 38016083), i = c(i, t, n, r, u[e + 15], 14, -660478335), r = c(r, i, t, n, u[e + 4], 20, -405537848), n = c(n, r, i, t, u[e + 9], 5, 568446438), t = c(t, n, r, i, u[e + 14], 9, -1019803690), i = c(i, t, n, r, u[e + 3], 14, -187363961), r = c(r, i, t, n, u[e + 8], 20, 1163531501), n = c(n, r, i, t, u[e + 13], 5, -1444681467), t = c(t, n, r, i, u[e + 2], 9, -51403784), i = c(i, t, n, r, u[e + 7], 14, 1735328473), r = c(r, i, t, n, u[e + 12], 20, -1926607734), n = l(n, r, i, t, u[e + 5], 4, -378558), t = l(t, n, r, i, u[e + 8], 11, -2022574463), i = l(i, t, n, r, u[e + 11], 16, 1839030562), r = l(r, i, t, n, u[e + 14], 23, -35309556), n = l(n, r, i, t, u[e + 1], 4, -1530992060), t = l(t, n, r, i, u[e + 4], 11, 1272893353), i = l(i, t, n, r, u[e + 7], 16, -155497632), r = l(r, i, t, n, u[e + 10], 23, -1094730640), n = l(n, r, i, t, u[e + 13], 4, 681279174), t = l(t, n, r, i, u[e + 0], 11, -358537222), i = l(i, t, n, r, u[e + 3], 16, -722521979), r = l(r, i, t, n, u[e + 6], 23, 76029189), n = l(n, r, i, t, u[e + 9], 4, -640364487), t = l(t, n, r, i, u[e + 12], 11, -421815835), i = l(i, t, n, r, u[e + 15], 16, 530742520), r = l(r, i, t, n, u[e + 2], 23, -995338651), n = y(n, r, i, t, u[e + 0], 6, -198630844), t = y(t, n, r, i, u[e + 7], 10, 1126891415), i = y(i, t, n, r, u[e + 14], 15, -1416354905), r = y(r, i, t, n, u[e + 5], 21, -57434055), n = y(n, r, i, t, u[e + 12], 6, 1700485571), t = y(t, n, r, i, u[e + 3], 10, -1894986606), i = y(i, t, n, r, u[e + 10], 15, -1051523), r = y(r, i, t, n, u[e + 1], 21, -2054922799), n = y(n, r, i, t, u[e + 8], 6, 1873313359), t = y(t, n, r, i, u[e + 15], 10, -30611744), i = y(i, t, n, r, u[e + 6], 15, -1560198380), r = y(r, i, t, n, u[e + 13], 21, 1309151649), n = y(n, r, i, t, u[e + 4], 6, -145523070), t = y(t, n, r, i, u[e + 11], 10, -1120210379), i = y(i, t, n, r, u[e + 2], 15, 718787259), r = y(r, i, t, n, u[e + 9], 21, -343485551), n = n + T >>> 0, r = r + b >>> 0, i = i + A >>> 0, t = t + I >>> 0;
16
- }
17
- return v.endian([n, r, i, t]);
18
- };
19
- d._ff = function(o, f, u, a, n, r, i) {
20
- var t = o + (f & u | ~f & a) + (n >>> 0) + i;
21
- return (t << r | t >>> 32 - r) + f;
22
- }, d._gg = function(o, f, u, a, n, r, i) {
23
- var t = o + (f & a | u & ~a) + (n >>> 0) + i;
24
- return (t << r | t >>> 32 - r) + f;
25
- }, d._hh = function(o, f, u, a, n, r, i) {
26
- var t = o + (f ^ u ^ a) + (n >>> 0) + i;
27
- return (t << r | t >>> 32 - r) + f;
28
- }, d._ii = function(o, f, u, a, n, r, i) {
29
- var t = o + (u ^ (f | ~a)) + (n >>> 0) + i;
30
- return (t << r | t >>> 32 - r) + f;
31
- }, d._blocksize = 16, d._digestsize = 16, h.exports = function(o, f) {
32
- if (o == null)
33
- throw new Error("Illegal argument " + o);
34
- var u = v.wordsToBytes(d(o, f));
35
- return f && f.asBytes ? u : f && f.asString ? F.bytesToString(u) : v.bytesToHex(u);
36
- };
37
- }(), h.exports);
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
- G as __require
42
+ a as BaseError
41
43
  };
@@ -1,4 +1,4 @@
1
- var e = { exports: {} };
1
+ const o = "1.0.8";
2
2
  export {
3
- e as __module
3
+ o as version
4
4
  };
@@ -1,72 +1,7 @@
1
- import { __module as a } from "./index270.js";
2
- var h;
3
- function c() {
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
- c as __require
6
+ e as formatAbiItem
72
7
  };
@@ -1,37 +1,13 @@
1
- var o, u;
2
- function c() {
3
- if (u) return o;
4
- u = 1;
5
- var t = {
6
- // UTF-8 encoding
7
- utf8: {
8
- // Convert a string to a byte array
9
- stringToBytes: function(n) {
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
- c as __require
12
+ f as formatAbiParameters
37
13
  };
@@ -1,17 +1,22 @@
1
- var f, e;
2
- function t() {
3
- if (e) return f;
4
- e = 1, f = function(r) {
5
- return r != null && (u(r) || n(r) || !!r._isBuffer);
6
- };
7
- function u(r) {
8
- return !!r.constructor && typeof r.constructor.isBuffer == "function" && r.constructor.isBuffer(r);
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
- function n(r) {
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
- t as __require
21
+ c as formatAbiParameter
17
22
  };
@@ -1,43 +1,10 @@
1
- import { version as u } from "./index218.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
- }
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
- a as BaseError
6
+ s as bytesRegex,
7
+ n as execTyped,
8
+ o as integerRegex,
9
+ x as isTupleRegex
43
10
  };
@@ -1,4 +1,14 @@
1
- const o = "1.0.8";
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
- o as version
13
+ a as parseAbi
4
14
  };
@@ -1,7 +1,69 @@
1
- import { formatAbiParameters as r } from "./index220.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";
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
- e as formatAbiItem
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
  };
@@ -1,13 +1,68 @@
1
- import { formatAbiParameter as m } from "./index221.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 += ", ");
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
- return r;
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
- f as formatAbiParameters
67
+ C as parseStructs
13
68
  };