@gardenfi/utils 2.1.2-beta.7 → 2.1.2-beta.8

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 (173) hide show
  1. package/dist/index100.cjs +1 -1
  2. package/dist/index100.js +5 -5
  3. package/dist/index101.cjs +2 -1
  4. package/dist/index101.js +3 -11
  5. package/dist/index102.cjs +1 -1
  6. package/dist/index102.js +18 -6
  7. package/dist/index103.cjs +1 -1
  8. package/dist/index103.js +638 -15
  9. package/dist/index104.cjs +1 -1
  10. package/dist/index104.js +173 -5
  11. package/dist/index18.cjs +1 -1
  12. package/dist/index18.js +2 -2
  13. package/dist/index19.cjs +1 -1
  14. package/dist/index19.js +9 -9
  15. package/dist/index20.cjs +1 -1
  16. package/dist/index20.js +1 -1
  17. package/dist/index21.cjs +1 -1
  18. package/dist/index21.js +3 -3
  19. package/dist/index22.cjs +1 -1
  20. package/dist/index22.js +1 -1
  21. package/dist/index23.cjs +2 -1
  22. package/dist/index23.js +49 -40
  23. package/dist/index24.cjs +1 -1
  24. package/dist/index24.js +24 -45
  25. package/dist/index25.cjs +1 -1
  26. package/dist/index25.js +41 -25
  27. package/dist/index26.cjs +1 -1
  28. package/dist/index26.js +45 -6
  29. package/dist/index27.cjs +1 -1
  30. package/dist/index27.js +24 -12
  31. package/dist/index28.cjs +1 -1
  32. package/dist/index28.js +6 -15
  33. package/dist/index29.cjs +1 -1
  34. package/dist/index29.js +13 -5
  35. package/dist/index30.cjs +1 -1
  36. package/dist/index30.js +14 -12
  37. package/dist/index31.cjs +1 -1
  38. package/dist/index31.js +5 -10
  39. package/dist/index32.cjs +1 -1
  40. package/dist/index32.js +13 -12
  41. package/dist/index33.cjs +1 -1
  42. package/dist/index33.js +10 -11
  43. package/dist/index34.cjs +1 -1
  44. package/dist/index34.js +12 -13
  45. package/dist/index35.cjs +1 -1
  46. package/dist/index35.js +11 -23
  47. package/dist/index36.cjs +1 -1
  48. package/dist/index36.js +13 -55
  49. package/dist/index37.cjs +1 -1
  50. package/dist/index37.js +23 -16
  51. package/dist/index38.cjs +1 -1
  52. package/dist/index38.js +55 -5
  53. package/dist/index39.cjs +1 -1
  54. package/dist/index39.js +16 -8
  55. package/dist/index40.cjs +1 -1
  56. package/dist/index40.js +5 -171
  57. package/dist/index41.cjs +1 -1
  58. package/dist/index41.js +8 -103
  59. package/dist/index42.cjs +1 -1
  60. package/dist/index42.js +170 -20
  61. package/dist/index43.cjs +1 -2
  62. package/dist/index43.js +97 -44
  63. package/dist/index44.cjs +1 -1
  64. package/dist/index44.js +21 -24
  65. package/dist/index45.cjs +1 -1
  66. package/dist/index45.js +1 -1
  67. package/dist/index47.cjs +1 -1
  68. package/dist/index47.js +6 -40
  69. package/dist/index48.cjs +2 -1
  70. package/dist/index48.js +58 -33
  71. package/dist/index49.cjs +1 -1
  72. package/dist/index49.js +2 -70
  73. package/dist/index50.cjs +1 -1
  74. package/dist/index50.js +5 -111
  75. package/dist/index51.cjs +1 -1
  76. package/dist/index51.js +4 -67
  77. package/dist/index52.cjs +1 -1
  78. package/dist/index52.js +12 -2
  79. package/dist/index53.cjs +1 -1
  80. package/dist/index53.js +8 -17
  81. package/dist/index54.cjs +5 -1
  82. package/dist/index54.js +48 -215
  83. package/dist/index55.cjs +2 -1
  84. package/dist/index55.js +31 -228
  85. package/dist/index56.cjs +1 -2
  86. package/dist/index56.js +5 -59
  87. package/dist/index57.cjs +1 -1
  88. package/dist/index57.js +2 -22
  89. package/dist/index58.cjs +1 -1
  90. package/dist/index58.js +18 -101
  91. package/dist/index59.cjs +1 -1
  92. package/dist/index59.js +8 -3
  93. package/dist/index60.cjs +1 -1
  94. package/dist/index60.js +9 -16
  95. package/dist/index61.cjs +1 -1
  96. package/dist/index61.js +11 -8
  97. package/dist/index62.cjs +1 -1
  98. package/dist/index62.js +6 -10
  99. package/dist/index63.cjs +1 -1
  100. package/dist/index63.js +13 -11
  101. package/dist/index64.cjs +1 -1
  102. package/dist/index64.js +31 -12
  103. package/dist/index65.cjs +1 -1
  104. package/dist/index65.js +14 -18
  105. package/dist/index66.cjs +1 -1
  106. package/dist/index66.js +64 -6
  107. package/dist/index67.cjs +1 -1
  108. package/dist/index67.js +25 -40
  109. package/dist/index68.cjs +1 -1
  110. package/dist/index68.js +3 -79
  111. package/dist/index69.cjs +1 -1
  112. package/dist/index69.js +3 -14
  113. package/dist/index70.cjs +1 -1
  114. package/dist/index70.js +8 -18
  115. package/dist/index71.cjs +1 -1
  116. package/dist/index71.js +191 -8
  117. package/dist/index72.cjs +1 -1
  118. package/dist/index72.js +18 -191
  119. package/dist/index73.cjs +1 -1
  120. package/dist/index73.js +39 -63
  121. package/dist/index74.cjs +1 -1
  122. package/dist/index74.js +34 -4
  123. package/dist/index75.cjs +1 -1
  124. package/dist/index75.js +70 -2
  125. package/dist/index76.cjs +1 -1
  126. package/dist/index76.js +111 -5
  127. package/dist/index77.cjs +1 -1
  128. package/dist/index77.js +67 -11
  129. package/dist/index78.cjs +1 -1
  130. package/dist/index78.js +2 -8
  131. package/dist/index79.cjs +1 -5
  132. package/dist/index79.js +15 -55
  133. package/dist/index80.cjs +1 -2
  134. package/dist/index80.js +220 -31
  135. package/dist/index81.cjs +1 -1
  136. package/dist/index81.js +231 -5
  137. package/dist/index82.cjs +1 -1
  138. package/dist/index82.js +43 -2
  139. package/dist/index83.cjs +1 -1
  140. package/dist/index83.js +104 -6
  141. package/dist/index84.cjs +1 -1
  142. package/dist/index84.js +16 -31
  143. package/dist/index85.cjs +1 -1
  144. package/dist/index85.js +75 -24
  145. package/dist/index86.cjs +1 -1
  146. package/dist/index86.js +19 -3
  147. package/dist/index87.cjs +1 -1
  148. package/dist/index87.js +8 -11
  149. package/dist/index88.cjs +1 -1
  150. package/dist/index88.js +11 -19
  151. package/dist/index89.cjs +1 -1
  152. package/dist/index89.js +19 -8
  153. package/dist/index90.cjs +1 -1
  154. package/dist/index90.js +1 -1
  155. package/dist/index91.cjs +1 -1
  156. package/dist/index91.js +37 -17
  157. package/dist/index92.cjs +1 -1
  158. package/dist/index92.js +2 -644
  159. package/dist/index93.cjs +1 -1
  160. package/dist/index93.js +5 -173
  161. package/dist/index94.cjs +1 -1
  162. package/dist/index94.js +10 -127
  163. package/dist/index95.cjs +1 -2
  164. package/dist/index95.js +128 -3
  165. package/dist/index96.cjs +1 -1
  166. package/dist/index96.js +7 -2
  167. package/dist/index97.cjs +1 -1
  168. package/dist/index97.js +2 -2
  169. package/dist/index98.cjs +1 -1
  170. package/dist/index98.js +2 -2
  171. package/dist/index99.cjs +1 -1
  172. package/dist/index99.js +17 -35
  173. package/package.json +1 -1
package/dist/index104.js CHANGED
@@ -1,7 +1,175 @@
1
- const e = 32, s = 4096, t = 131072, l = 761855;
1
+ import { validateField as z, nLength as F } from "./index80.js";
2
+ import { validateObject as x, bitLen as O } from "./index81.js";
3
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
4
+ const I = BigInt(0), p = BigInt(1);
5
+ function m(e, r) {
6
+ const t = r.negate();
7
+ return e ? t : r;
8
+ }
9
+ function A(e, r) {
10
+ if (!Number.isSafeInteger(e) || e <= 0 || e > r)
11
+ throw new Error("invalid window size, expected [1.." + r + "], got W=" + e);
12
+ }
13
+ function b(e, r) {
14
+ A(e, r);
15
+ const t = Math.ceil(r / e) + 1, n = 2 ** (e - 1);
16
+ return { windows: t, windowSize: n };
17
+ }
18
+ function L(e, r) {
19
+ if (!Array.isArray(e))
20
+ throw new Error("array expected");
21
+ e.forEach((t, n) => {
22
+ if (!(t instanceof r))
23
+ throw new Error("invalid point at index " + n);
24
+ });
25
+ }
26
+ function k(e, r) {
27
+ if (!Array.isArray(e))
28
+ throw new Error("array of scalars expected");
29
+ e.forEach((t, n) => {
30
+ if (!r.isValid(t))
31
+ throw new Error("invalid scalar at index " + n);
32
+ });
33
+ }
34
+ const B = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap();
35
+ function S(e) {
36
+ return E.get(e) || 1;
37
+ }
38
+ function v(e, r) {
39
+ return {
40
+ constTimeNegate: m,
41
+ hasPrecomputes(t) {
42
+ return S(t) !== 1;
43
+ },
44
+ // non-const time multiplication ladder
45
+ unsafeLadder(t, n, i = e.ZERO) {
46
+ let o = t;
47
+ for (; n > I; )
48
+ n & p && (i = i.add(o)), o = o.double(), n >>= p;
49
+ return i;
50
+ },
51
+ /**
52
+ * Creates a wNAF precomputation window. Used for caching.
53
+ * Default window size is set by `utils.precompute()` and is equal to 8.
54
+ * Number of precomputed points depends on the curve size:
55
+ * 2^(𝑊−1) * (Math.ceil(𝑛 / 𝑊) + 1), where:
56
+ * - 𝑊 is the window size
57
+ * - 𝑛 is the bitlength of the curve order.
58
+ * For a 256-bit curve and window size 8, the number of precomputed points is 128 * 33 = 4224.
59
+ * @param elm Point instance
60
+ * @param W window size
61
+ * @returns precomputed point tables flattened to a single array
62
+ */
63
+ precomputeWindow(t, n) {
64
+ const { windows: i, windowSize: o } = b(n, r), a = [];
65
+ let c = t, d = c;
66
+ for (let h = 0; h < i; h++) {
67
+ d = c, a.push(d);
68
+ for (let w = 1; w < o; w++)
69
+ d = d.add(c), a.push(d);
70
+ c = d.double();
71
+ }
72
+ return a;
73
+ },
74
+ /**
75
+ * Implements ec multiplication using precomputed tables and w-ary non-adjacent form.
76
+ * @param W window size
77
+ * @param precomputes precomputed tables
78
+ * @param n scalar (we don't check here, but should be less than curve order)
79
+ * @returns real and fake (for const-time) points
80
+ */
81
+ wNAF(t, n, i) {
82
+ const { windows: o, windowSize: a } = b(t, r);
83
+ let c = e.ZERO, d = e.BASE;
84
+ const h = BigInt(2 ** t - 1), w = 2 ** t, l = BigInt(t);
85
+ for (let u = 0; u < o; u++) {
86
+ const s = u * a;
87
+ let f = Number(i & h);
88
+ i >>= l, f > a && (f -= w, i += p);
89
+ const g = s, N = s + Math.abs(f) - 1, y = u % 2 !== 0, M = f < 0;
90
+ f === 0 ? d = d.add(m(y, n[g])) : c = c.add(m(M, n[N]));
91
+ }
92
+ return { p: c, f: d };
93
+ },
94
+ /**
95
+ * Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
96
+ * @param W window size
97
+ * @param precomputes precomputed tables
98
+ * @param n scalar (we don't check here, but should be less than curve order)
99
+ * @param acc accumulator point to add result of multiplication
100
+ * @returns point
101
+ */
102
+ wNAFUnsafe(t, n, i, o = e.ZERO) {
103
+ const { windows: a, windowSize: c } = b(t, r), d = BigInt(2 ** t - 1), h = 2 ** t, w = BigInt(t);
104
+ for (let l = 0; l < a; l++) {
105
+ const u = l * c;
106
+ if (i === I)
107
+ break;
108
+ let s = Number(i & d);
109
+ if (i >>= w, s > c && (s -= h, i += p), s === 0)
110
+ continue;
111
+ let f = n[u + Math.abs(s) - 1];
112
+ s < 0 && (f = f.negate()), o = o.add(f);
113
+ }
114
+ return o;
115
+ },
116
+ getPrecomputes(t, n, i) {
117
+ let o = B.get(n);
118
+ return o || (o = this.precomputeWindow(n, t), t !== 1 && B.set(n, i(o))), o;
119
+ },
120
+ wNAFCached(t, n, i) {
121
+ const o = S(t);
122
+ return this.wNAF(o, this.getPrecomputes(o, t, i), n);
123
+ },
124
+ wNAFCachedUnsafe(t, n, i, o) {
125
+ const a = S(t);
126
+ return a === 1 ? this.unsafeLadder(t, n, o) : this.wNAFUnsafe(a, this.getPrecomputes(a, t, i), n, o);
127
+ },
128
+ // We calculate precomputes for elliptic curve point multiplication
129
+ // using windowed method. This specifies window size and
130
+ // stores precomputed values. Usually only base point would be precomputed.
131
+ setWindowSize(t, n) {
132
+ A(n, r), E.set(t, n), B.delete(t);
133
+ }
134
+ };
135
+ }
136
+ function Z(e, r, t, n) {
137
+ if (L(t, e), k(n, r), t.length !== n.length)
138
+ throw new Error("arrays of points and scalars must have equal length");
139
+ const i = e.ZERO, o = O(BigInt(t.length)), a = o > 12 ? o - 3 : o > 4 ? o - 2 : o ? 2 : 1, c = (1 << a) - 1, d = new Array(c + 1).fill(i), h = Math.floor((r.BITS - 1) / a) * a;
140
+ let w = i;
141
+ for (let l = h; l >= 0; l -= a) {
142
+ d.fill(i);
143
+ for (let s = 0; s < n.length; s++) {
144
+ const f = n[s], g = Number(f >> BigInt(l) & BigInt(c));
145
+ d[g] = d[g].add(t[s]);
146
+ }
147
+ let u = i;
148
+ for (let s = d.length - 1, f = i; s > 0; s--)
149
+ f = f.add(d[s]), u = u.add(f);
150
+ if (w = w.add(u), l !== 0)
151
+ for (let s = 0; s < a; s++)
152
+ w = w.double();
153
+ }
154
+ return w;
155
+ }
156
+ function U(e) {
157
+ return z(e.Fp), x(e, {
158
+ n: "bigint",
159
+ h: "bigint",
160
+ Gx: "field",
161
+ Gy: "field"
162
+ }, {
163
+ nBitLength: "isSafeInteger",
164
+ nByteLength: "isSafeInteger"
165
+ }), Object.freeze({
166
+ ...F(e.n, e.nBitLength),
167
+ ...e,
168
+ p: e.Fp.ORDER
169
+ });
170
+ }
2
171
  export {
3
- t as bytesPerBlob,
4
- e as bytesPerFieldElement,
5
- s as fieldElementsPerBlob,
6
- l as maxBytesPerTransaction
172
+ Z as pippenger,
173
+ U as validateBasic,
174
+ v as wNAF
7
175
  };
package/dist/index18.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index43.cjs"),i=require("./index44.cjs");async function s(t,{hash:e}){var a,n,o;const r=await t.request({method:"eth_getTransactionReceipt",params:[e]},{dedupe:!0});if(!r)throw new c.TransactionReceiptNotFoundError({hash:e});return(((o=(n=(a=t.chain)==null?void 0:a.formatters)==null?void 0:n.transactionReceipt)==null?void 0:o.format)||i.formatTransactionReceipt)(r)}exports.getTransactionReceipt=s;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index23.cjs"),i=require("./index24.cjs");async function s(t,{hash:e}){var a,n,o;const r=await t.request({method:"eth_getTransactionReceipt",params:[e]},{dedupe:!0});if(!r)throw new c.TransactionReceiptNotFoundError({hash:e});return(((o=(n=(a=t.chain)==null?void 0:a.formatters)==null?void 0:n.transactionReceipt)==null?void 0:o.format)||i.formatTransactionReceipt)(r)}exports.getTransactionReceipt=s;
package/dist/index18.js CHANGED
@@ -1,5 +1,5 @@
1
- import { TransactionReceiptNotFoundError as i } from "./index43.js";
2
- import { formatTransactionReceipt as c } from "./index44.js";
1
+ import { TransactionReceiptNotFoundError as i } from "./index23.js";
2
+ import { formatTransactionReceipt as c } from "./index24.js";
3
3
  async function f(t, { hash: r }) {
4
4
  var o, a, n;
5
5
  const e = await t.request({
package/dist/index19.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index23.cjs"),u=require("./index24.cjs"),a=require("./index25.cjs"),g=require("./index26.cjs"),y=require("./index27.cjs"),d=require("./index28.cjs"),T=require("./index29.cjs"),l=require("./index30.cjs"),q=require("./index31.cjs");function A(s,t={}){const{nonceManager:c}=t,e=u.toHex(i.secp256k1.getPublicKey(s.slice(2),!1)),o=g.publicKeyToAddress(e);return{...a.toAccount({address:o,nonceManager:c,async sign({hash:n}){return y.sign({hash:n,privateKey:s,to:"hex"})},async signAuthorization(n){return d.signAuthorization({...n,privateKey:s})},async signMessage({message:n}){return T.signMessage({message:n,privateKey:s})},async signTransaction(n,{serializer:r}={}){return l.signTransaction({privateKey:s,transaction:n,serializer:r})},async signTypedData(n){return q.signTypedData({...n,privateKey:s})}}),publicKey:e,source:"privateKey"}}exports.privateKeyToAccount=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index25.cjs"),u=require("./index26.cjs"),a=require("./index27.cjs"),g=require("./index28.cjs"),y=require("./index29.cjs"),d=require("./index30.cjs"),T=require("./index31.cjs"),l=require("./index32.cjs"),q=require("./index33.cjs");function A(s,t={}){const{nonceManager:c}=t,e=u.toHex(i.secp256k1.getPublicKey(s.slice(2),!1)),o=g.publicKeyToAddress(e);return{...a.toAccount({address:o,nonceManager:c,async sign({hash:n}){return y.sign({hash:n,privateKey:s,to:"hex"})},async signAuthorization(n){return d.signAuthorization({...n,privateKey:s})},async signMessage({message:n}){return T.signMessage({message:n,privateKey:s})},async signTransaction(n,{serializer:r}={}){return l.signTransaction({privateKey:s,transaction:n,serializer:r})},async signTypedData(n){return q.signTypedData({...n,privateKey:s})}}),publicKey:e,source:"privateKey"}}exports.privateKeyToAccount=A;
package/dist/index19.js CHANGED
@@ -1,12 +1,12 @@
1
- import { secp256k1 as e } from "./index23.js";
2
- import { toHex as a } from "./index24.js";
3
- import { toAccount as m } from "./index25.js";
4
- import { publicKeyToAddress as u } from "./index26.js";
5
- import { sign as g } from "./index27.js";
6
- import { signAuthorization as p } from "./index28.js";
7
- import { signMessage as f } from "./index29.js";
8
- import { signTransaction as y } from "./index30.js";
9
- import { signTypedData as d } from "./index31.js";
1
+ import { secp256k1 as e } from "./index25.js";
2
+ import { toHex as a } from "./index26.js";
3
+ import { toAccount as m } from "./index27.js";
4
+ import { publicKeyToAddress as u } from "./index28.js";
5
+ import { sign as g } from "./index29.js";
6
+ import { signAuthorization as p } from "./index30.js";
7
+ import { signMessage as f } from "./index31.js";
8
+ import { signTransaction as y } from "./index32.js";
9
+ import { signTypedData as d } from "./index33.js";
10
10
  function H(n, t = {}) {
11
11
  const { nonceManager: s } = t, r = a(e.getPublicKey(n.slice(2), !1)), c = u(r);
12
12
  return {
package/dist/index20.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index89.cjs"),t=e.defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});exports.mainnet=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index87.cjs"),t=e.defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});exports.mainnet=t;
package/dist/index20.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineChain as e } from "./index89.js";
1
+ import { defineChain as e } from "./index87.js";
2
2
  const t = /* @__PURE__ */ e({
3
3
  id: 1,
4
4
  name: "Ethereum",
package/dist/index21.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index87.cjs"),M=require("./index42.cjs"),h=require("./index88.cjs");function R(r){const{chainId:o,domain:s,expirationTime:l,issuedAt:m=new Date,nonce:a,notBefore:f,requestId:w,resources:g,scheme:i,uri:c,version:d}=r;{if(o!==Math.floor(o))throw new e.SiweInvalidMessageFieldError({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${o}`]});if(!(E.test(s)||F.test(s)||b.test(s)))throw new e.SiweInvalidMessageFieldError({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${s}`]});if(!A.test(a))throw new e.SiweInvalidMessageFieldError({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${a}`]});if(!h.isUri(c))throw new e.SiweInvalidMessageFieldError({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${c}`]});if(d!=="1")throw new e.SiweInvalidMessageFieldError({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${d}`]});if(i&&!P.test(i))throw new e.SiweInvalidMessageFieldError({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${i}`]});const t=r.statement;if(t!=null&&t.includes(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index88.cjs"),M=require("./index44.cjs"),h=require("./index89.cjs");function R(r){const{chainId:o,domain:s,expirationTime:l,issuedAt:m=new Date,nonce:a,notBefore:f,requestId:w,resources:g,scheme:i,uri:c,version:d}=r;{if(o!==Math.floor(o))throw new e.SiweInvalidMessageFieldError({field:"chainId",metaMessages:["- Chain ID must be a EIP-155 chain ID.","- See https://eips.ethereum.org/EIPS/eip-155","",`Provided value: ${o}`]});if(!(E.test(s)||F.test(s)||b.test(s)))throw new e.SiweInvalidMessageFieldError({field:"domain",metaMessages:["- Domain must be an RFC 3986 authority.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${s}`]});if(!A.test(a))throw new e.SiweInvalidMessageFieldError({field:"nonce",metaMessages:["- Nonce must be at least 8 characters.","- Nonce must be alphanumeric.","",`Provided value: ${a}`]});if(!h.isUri(c))throw new e.SiweInvalidMessageFieldError({field:"uri",metaMessages:["- URI must be a RFC 3986 URI referring to the resource that is the subject of the signing.","- See https://www.rfc-editor.org/rfc/rfc3986","",`Provided value: ${c}`]});if(d!=="1")throw new e.SiweInvalidMessageFieldError({field:"version",metaMessages:["- Version must be '1'.","",`Provided value: ${d}`]});if(i&&!P.test(i))throw new e.SiweInvalidMessageFieldError({field:"scheme",metaMessages:["- Scheme must be an RFC 3986 URI scheme.","- See https://www.rfc-editor.org/rfc/rfc3986#section-3.1","",`Provided value: ${i}`]});const t=r.statement;if(t!=null&&t.includes(`
2
2
  `))throw new e.SiweInvalidMessageFieldError({field:"statement",metaMessages:["- Statement must not include '\\n'.","",`Provided value: ${t}`]})}const $=M.getAddress(r.address),v=i?`${i}://${s}`:s,I=r.statement?`${r.statement}
3
3
  `:"",S=`${v} wants you to sign in with your Ethereum account:
4
4
  ${$}
package/dist/index21.js CHANGED
@@ -1,6 +1,6 @@
1
- import { SiweInvalidMessageFieldError as e } from "./index87.js";
2
- import { getAddress as S } from "./index42.js";
3
- import { isUri as $ } from "./index88.js";
1
+ import { SiweInvalidMessageFieldError as e } from "./index88.js";
2
+ import { getAddress as S } from "./index44.js";
3
+ import { isUri as $ } from "./index89.js";
4
4
  function C(n) {
5
5
  const { chainId: i, domain: s, expirationTime: u, issuedAt: g = /* @__PURE__ */ new Date(), nonce: a, notBefore: m, requestId: h, resources: w, scheme: o, uri: c, version: f } = n;
6
6
  {
package/dist/index22.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index89.cjs"),a=e.defineChain({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.drpc.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0});exports.sepolia=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index87.cjs"),a=e.defineChain({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.drpc.org"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",blockCreated:5317080}},testnet:!0});exports.sepolia=a;
package/dist/index22.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineChain as e } from "./index89.js";
1
+ import { defineChain as e } from "./index87.js";
2
2
  const s = /* @__PURE__ */ e({
3
3
  id: 11155111,
4
4
  name: "Sepolia",
package/dist/index23.cjs CHANGED
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index50.cjs"),C=require("./index53.cjs"),n=require("./index54.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const k=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),x=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),G=BigInt(1),w=BigInt(2),h=(t,f)=>(t+f/w)/f;function M(t){const f=k,e=BigInt(3),r=BigInt(6),p=BigInt(11),a=BigInt(22),s=BigInt(23),i=BigInt(44),d=BigInt(88),o=t*t*t%f,c=o*o*t%f,g=n.pow2(c,e,f)*c%f,b=n.pow2(g,e,f)*c%f,l=n.pow2(b,w,f)*o%f,B=n.pow2(l,p,f)*l%f,I=n.pow2(B,a,f)*B%f,_=n.pow2(I,i,f)*I%f,P=n.pow2(_,d,f)*_%f,S=n.pow2(P,i,f)*I%f,v=n.pow2(S,e,f)*c%f,E=n.pow2(v,s,f)*B%f,F=n.pow2(E,r,f)*o%f,q=n.pow2(F,w,f);if(!u.eql(u.sqr(q),t))throw new Error("Cannot find square root");return q}const u=n.Field(k,void 0,void 0,{sqrt:M}),m=C.createCurve({a:BigInt(0),b:BigInt(7),Fp:u,n:x,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const f=x,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-G*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),p=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=e,s=BigInt("0x100000000000000000000000000000000"),i=h(a*t,f),d=h(-r*t,f);let o=n.mod(t-i*e-d*p,f),c=n.mod(-i*r-d*a,f);const g=o>s,b=c>s;if(g&&(o=f-o),b&&(c=f-c),o>s||c>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:o,k2neg:b,k2:c}}}},j.sha256);BigInt(0);m.ProjectivePoint;exports.secp256k1=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index48.cjs");function o(a){const r=Object.entries(a).map(([n,e])=>e===void 0||e===!1?null:[n,e]).filter(Boolean),i=r.reduce((n,[e])=>Math.max(n,e.length),0);return r.map(([n,e])=>` ${`${n}:`.padEnd(i+1)} ${e}`).join(`
2
+ `)}class s extends t.BaseError{constructor({v:r}){super(`Invalid \`v\` value "${r}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}}class c extends t.BaseError{constructor({transaction:r}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",o(r),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class d extends t.BaseError{constructor({storageKey:r}){super(`Size for storage key "${r}" is invalid. Expected 32 bytes. Got ${Math.floor((r.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}}class l extends t.BaseError{constructor({hash:r}){super(`Transaction receipt with hash "${r}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}exports.InvalidLegacyVError=s;exports.InvalidSerializableTransactionError=c;exports.InvalidStorageKeySizeError=d;exports.TransactionReceiptNotFoundError=l;exports.prettyPrint=o;
package/dist/index23.js CHANGED
@@ -1,44 +1,53 @@
1
- import { sha256 as C } from "./index50.js";
2
- import { createCurve as G } from "./index53.js";
3
- import { Field as N, mod as k, pow2 as t } from "./index54.js";
4
- /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5
- const q = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), w = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), j = BigInt(1), _ = BigInt(2), h = (n, f) => (n + f / _) / f;
6
- function M(n) {
7
- const f = q, e = BigInt(3), r = BigInt(6), I = BigInt(11), a = BigInt(22), s = BigInt(23), i = BigInt(44), g = BigInt(88), o = n * n * n % f, c = o * o * n % f, d = t(c, e, f) * c % f, B = t(d, e, f) * c % f, m = t(B, _, f) * o % f, b = t(m, I, f) * m % f, p = t(b, a, f) * b % f, x = t(p, i, f) * p % f, P = t(x, g, f) * x % f, v = t(P, i, f) * p % f, E = t(v, e, f) * c % f, F = t(E, s, f) * b % f, S = t(F, r, f) * o % f, u = t(S, _, f);
8
- if (!l.eql(l.sqr(u), n))
9
- throw new Error("Cannot find square root");
10
- return u;
1
+ import { BaseError as t } from "./index48.js";
2
+ function i(a) {
3
+ const r = Object.entries(a).map(([n, e]) => e === void 0 || e === !1 ? null : [n, e]).filter(Boolean), o = r.reduce((n, [e]) => Math.max(n, e.length), 0);
4
+ return r.map(([n, e]) => ` ${`${n}:`.padEnd(o + 1)} ${e}`).join(`
5
+ `);
11
6
  }
12
- const l = N(q, void 0, void 0, { sqrt: M }), O = G({
13
- a: BigInt(0),
14
- // equation params: a, b
15
- b: BigInt(7),
16
- Fp: l,
17
- // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n
18
- n: w,
19
- // Curve order, total count of valid points in the field
20
- // Base point (x, y) aka generator point
21
- Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
22
- Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
23
- h: BigInt(1),
24
- // Cofactor
25
- lowS: !0,
26
- // Allow only low-S signatures by default in sign() and verify()
27
- endo: {
28
- // Endomorphism, see above
29
- beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
30
- splitScalar: (n) => {
31
- const f = w, e = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -j * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), I = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), a = e, s = BigInt("0x100000000000000000000000000000000"), i = h(a * n, f), g = h(-r * n, f);
32
- let o = k(n - i * e - g * I, f), c = k(-i * r - g * a, f);
33
- const d = o > s, B = c > s;
34
- if (d && (o = f - o), B && (c = f - c), o > s || c > s)
35
- throw new Error("splitScalar: Endomorphism failed, k=" + n);
36
- return { k1neg: d, k1: o, k2neg: B, k2: c };
37
- }
7
+ class c extends t {
8
+ constructor({ v: r }) {
9
+ super(`Invalid \`v\` value "${r}". Expected 27 or 28.`, {
10
+ name: "InvalidLegacyVError"
11
+ });
38
12
  }
39
- }, C);
40
- BigInt(0);
41
- O.ProjectivePoint;
13
+ }
14
+ class d extends t {
15
+ constructor({ transaction: r }) {
16
+ super("Cannot infer a transaction type from provided transaction.", {
17
+ metaMessages: [
18
+ "Provided Transaction:",
19
+ "{",
20
+ i(r),
21
+ "}",
22
+ "",
23
+ "To infer the type, either provide:",
24
+ "- a `type` to the Transaction, or",
25
+ "- an EIP-1559 Transaction with `maxFeePerGas`, or",
26
+ "- an EIP-2930 Transaction with `gasPrice` & `accessList`, or",
27
+ "- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or",
28
+ "- an EIP-7702 Transaction with `authorizationList`, or",
29
+ "- a Legacy Transaction with `gasPrice`"
30
+ ],
31
+ name: "InvalidSerializableTransactionError"
32
+ });
33
+ }
34
+ }
35
+ class l extends t {
36
+ constructor({ storageKey: r }) {
37
+ super(`Size for storage key "${r}" is invalid. Expected 32 bytes. Got ${Math.floor((r.length - 2) / 2)} bytes.`, { name: "InvalidStorageKeySizeError" });
38
+ }
39
+ }
40
+ class p extends t {
41
+ constructor({ hash: r }) {
42
+ super(`Transaction receipt with hash "${r}" could not be found. The Transaction may not be processed on a block yet.`, {
43
+ name: "TransactionReceiptNotFoundError"
44
+ });
45
+ }
46
+ }
42
47
  export {
43
- O as secp256k1
48
+ c as InvalidLegacyVError,
49
+ d as InvalidSerializableTransactionError,
50
+ l as InvalidStorageKeySizeError,
51
+ p as TransactionReceiptNotFoundError,
52
+ i as prettyPrint
44
53
  };
package/dist/index24.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index45.cjs"),f=require("./index46.cjs"),x=require("./index35.cjs"),z=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function H(e,n={}){return typeof e=="number"||typeof e=="bigint"?d(e,n):typeof e=="string"?m(e,n):typeof e=="boolean"?b(e,n):u(e,n)}function b(e,n={}){const t=`0x${Number(e)}`;return typeof n.size=="number"?(x.assertSize(t,{size:n.size}),f.pad(t,{size:n.size})):t}function u(e,n={}){let t="";for(let i=0;i<e.length;i++)t+=z[e[i]];const r=`0x${t}`;return typeof n.size=="number"?(x.assertSize(r,{size:n.size}),f.pad(r,{dir:"right",size:n.size})):r}function d(e,n={}){const{signed:t,size:r}=n,i=BigInt(e);let o;r?t?o=(1n<<BigInt(r)*8n-1n)-1n:o=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const c=typeof o=="bigint"&&t?-o-1n:0;if(o&&i>o||i<c){const s=typeof e=="bigint"?"n":"";throw new y.IntegerOutOfRangeError({max:o?`${o}${s}`:void 0,min:`${c}${s}`,signed:t,size:r,value:`${e}${s}`})}const g=`0x${(t&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?f.pad(g,{size:r}):g}const T=new TextEncoder;function m(e,n={}){const t=T.encode(e);return u(t,n)}exports.boolToHex=b;exports.bytesToHex=u;exports.numberToHex=d;exports.stringToHex=m;exports.toHex=H;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("./index37.cjs"),d=require("./index52.cjs"),r=require("./index53.cjs"),u={"0x0":"reverted","0x1":"success"};function o(l){const s={...l,blockNumber:l.blockNumber?BigInt(l.blockNumber):null,contractAddress:l.contractAddress?l.contractAddress:null,cumulativeGasUsed:l.cumulativeGasUsed?BigInt(l.cumulativeGasUsed):null,effectiveGasPrice:l.effectiveGasPrice?BigInt(l.effectiveGasPrice):null,gasUsed:l.gasUsed?BigInt(l.gasUsed):null,logs:l.logs?l.logs.map(e=>d.formatLog(e)):null,to:l.to?l.to:null,transactionIndex:l.transactionIndex?b.hexToNumber(l.transactionIndex):null,status:l.status?u[l.status]:null,type:l.type?r.transactionType[l.type]||l.type:null};return l.blobGasPrice&&(s.blobGasPrice=BigInt(l.blobGasPrice)),l.blobGasUsed&&(s.blobGasUsed=BigInt(l.blobGasUsed)),s}exports.formatTransactionReceipt=o;exports.receiptStatuses=u;
package/dist/index24.js CHANGED
@@ -1,48 +1,27 @@
1
- import { IntegerOutOfRangeError as x } from "./index45.js";
2
- import { pad as s } from "./index46.js";
3
- import { assertSize as c } from "./index35.js";
4
- const b = /* @__PURE__ */ Array.from({ length: 256 }, (n, e) => e.toString(16).padStart(2, "0"));
5
- function B(n, e = {}) {
6
- return typeof n == "number" || typeof n == "bigint" ? y(n, e) : typeof n == "string" ? $(n, e) : typeof n == "boolean" ? z(n, e) : m(n, e);
7
- }
8
- function z(n, e = {}) {
9
- const t = `0x${Number(n)}`;
10
- return typeof e.size == "number" ? (c(t, { size: e.size }), s(t, { size: e.size })) : t;
11
- }
12
- function m(n, e = {}) {
13
- let t = "";
14
- for (let i = 0; i < n.length; i++)
15
- t += b[n[i]];
16
- const r = `0x${t}`;
17
- return typeof e.size == "number" ? (c(r, { size: e.size }), s(r, { dir: "right", size: e.size })) : r;
18
- }
19
- function y(n, e = {}) {
20
- const { signed: t, size: r } = e, i = BigInt(n);
21
- let o;
22
- r ? t ? o = (1n << BigInt(r) * 8n - 1n) - 1n : o = 2n ** (BigInt(r) * 8n) - 1n : typeof n == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
23
- const g = typeof o == "bigint" && t ? -o - 1n : 0;
24
- if (o && i > o || i < g) {
25
- const f = typeof n == "bigint" ? "n" : "";
26
- throw new x({
27
- max: o ? `${o}${f}` : void 0,
28
- min: `${g}${f}`,
29
- signed: t,
30
- size: r,
31
- value: `${n}${f}`
32
- });
33
- }
34
- const u = `0x${(t && i < 0 ? (1n << BigInt(r * 8)) + BigInt(i) : i).toString(16)}`;
35
- return r ? s(u, { size: r }) : u;
36
- }
37
- const d = /* @__PURE__ */ new TextEncoder();
38
- function $(n, e = {}) {
39
- const t = d.encode(n);
40
- return m(t, e);
1
+ import { hexToNumber as b } from "./index37.js";
2
+ import { formatLog as d } from "./index52.js";
3
+ import { transactionType as m } from "./index53.js";
4
+ const f = {
5
+ "0x0": "reverted",
6
+ "0x1": "success"
7
+ };
8
+ function r(l) {
9
+ const u = {
10
+ ...l,
11
+ blockNumber: l.blockNumber ? BigInt(l.blockNumber) : null,
12
+ contractAddress: l.contractAddress ? l.contractAddress : null,
13
+ cumulativeGasUsed: l.cumulativeGasUsed ? BigInt(l.cumulativeGasUsed) : null,
14
+ effectiveGasPrice: l.effectiveGasPrice ? BigInt(l.effectiveGasPrice) : null,
15
+ gasUsed: l.gasUsed ? BigInt(l.gasUsed) : null,
16
+ logs: l.logs ? l.logs.map((s) => d(s)) : null,
17
+ to: l.to ? l.to : null,
18
+ transactionIndex: l.transactionIndex ? b(l.transactionIndex) : null,
19
+ status: l.status ? f[l.status] : null,
20
+ type: l.type ? m[l.type] || l.type : null
21
+ };
22
+ return l.blobGasPrice && (u.blobGasPrice = BigInt(l.blobGasPrice)), l.blobGasUsed && (u.blobGasUsed = BigInt(l.blobGasUsed)), u;
41
23
  }
42
24
  export {
43
- z as boolToHex,
44
- m as bytesToHex,
45
- y as numberToHex,
46
- $ as stringToHex,
47
- B as toHex
25
+ r as formatTransactionReceipt,
26
+ f as receiptStatuses
48
27
  };
package/dist/index25.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index32.cjs"),t=require("./index33.cjs");function i(s){if(typeof s=="string"){if(!t.isAddress(s,{strict:!1}))throw new n.InvalidAddressError({address:s});return{address:s,type:"json-rpc"}}if(!t.isAddress(s.address,{strict:!1}))throw new n.InvalidAddressError({address:s.address});return{address:s.address,nonceManager:s.nonceManager,sign:s.sign,signAuthorization:s.signAuthorization,signMessage:s.signMessage,signTransaction:s.signTransaction,signTypedData:s.signTypedData,source:"custom",type:"local"}}exports.toAccount=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const j=require("./index76.cjs"),C=require("./index79.cjs"),n=require("./index80.cjs");/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const k=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),x=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),G=BigInt(1),w=BigInt(2),h=(t,f)=>(t+f/w)/f;function M(t){const f=k,e=BigInt(3),r=BigInt(6),p=BigInt(11),a=BigInt(22),s=BigInt(23),i=BigInt(44),d=BigInt(88),o=t*t*t%f,c=o*o*t%f,g=n.pow2(c,e,f)*c%f,b=n.pow2(g,e,f)*c%f,l=n.pow2(b,w,f)*o%f,B=n.pow2(l,p,f)*l%f,I=n.pow2(B,a,f)*B%f,_=n.pow2(I,i,f)*I%f,P=n.pow2(_,d,f)*_%f,S=n.pow2(P,i,f)*I%f,v=n.pow2(S,e,f)*c%f,E=n.pow2(v,s,f)*B%f,F=n.pow2(E,r,f)*o%f,q=n.pow2(F,w,f);if(!u.eql(u.sqr(q),t))throw new Error("Cannot find square root");return q}const u=n.Field(k,void 0,void 0,{sqrt:M}),m=C.createCurve({a:BigInt(0),b:BigInt(7),Fp:u,n:x,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const f=x,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-G*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),p=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),a=e,s=BigInt("0x100000000000000000000000000000000"),i=h(a*t,f),d=h(-r*t,f);let o=n.mod(t-i*e-d*p,f),c=n.mod(-i*r-d*a,f);const g=o>s,b=c>s;if(g&&(o=f-o),b&&(c=f-c),o>s||c>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:g,k1:o,k2neg:b,k2:c}}}},j.sha256);BigInt(0);m.ProjectivePoint;exports.secp256k1=m;
package/dist/index25.js CHANGED
@@ -1,28 +1,44 @@
1
- import { InvalidAddressError as s } from "./index32.js";
2
- import { isAddress as a } from "./index33.js";
3
- function r(n) {
4
- if (typeof n == "string") {
5
- if (!a(n, { strict: !1 }))
6
- throw new s({ address: n });
7
- return {
8
- address: n,
9
- type: "json-rpc"
10
- };
11
- }
12
- if (!a(n.address, { strict: !1 }))
13
- throw new s({ address: n.address });
14
- return {
15
- address: n.address,
16
- nonceManager: n.nonceManager,
17
- sign: n.sign,
18
- signAuthorization: n.signAuthorization,
19
- signMessage: n.signMessage,
20
- signTransaction: n.signTransaction,
21
- signTypedData: n.signTypedData,
22
- source: "custom",
23
- type: "local"
24
- };
1
+ import { sha256 as C } from "./index76.js";
2
+ import { createCurve as G } from "./index79.js";
3
+ import { Field as N, mod as k, pow2 as t } from "./index80.js";
4
+ /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
5
+ const q = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"), w = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"), j = BigInt(1), _ = BigInt(2), h = (n, f) => (n + f / _) / f;
6
+ function M(n) {
7
+ const f = q, e = BigInt(3), r = BigInt(6), I = BigInt(11), a = BigInt(22), s = BigInt(23), i = BigInt(44), g = BigInt(88), o = n * n * n % f, c = o * o * n % f, d = t(c, e, f) * c % f, B = t(d, e, f) * c % f, m = t(B, _, f) * o % f, b = t(m, I, f) * m % f, p = t(b, a, f) * b % f, x = t(p, i, f) * p % f, P = t(x, g, f) * x % f, v = t(P, i, f) * p % f, E = t(v, e, f) * c % f, F = t(E, s, f) * b % f, S = t(F, r, f) * o % f, u = t(S, _, f);
8
+ if (!l.eql(l.sqr(u), n))
9
+ throw new Error("Cannot find square root");
10
+ return u;
25
11
  }
12
+ const l = N(q, void 0, void 0, { sqrt: M }), O = G({
13
+ a: BigInt(0),
14
+ // equation params: a, b
15
+ b: BigInt(7),
16
+ Fp: l,
17
+ // Field's prime: 2n**256n - 2n**32n - 2n**9n - 2n**8n - 2n**7n - 2n**6n - 2n**4n - 1n
18
+ n: w,
19
+ // Curve order, total count of valid points in the field
20
+ // Base point (x, y) aka generator point
21
+ Gx: BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),
22
+ Gy: BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),
23
+ h: BigInt(1),
24
+ // Cofactor
25
+ lowS: !0,
26
+ // Allow only low-S signatures by default in sign() and verify()
27
+ endo: {
28
+ // Endomorphism, see above
29
+ beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
30
+ splitScalar: (n) => {
31
+ const f = w, e = BigInt("0x3086d221a7d46bcde86c90e49284eb15"), r = -j * BigInt("0xe4437ed6010e88286f547fa90abfe4c3"), I = BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), a = e, s = BigInt("0x100000000000000000000000000000000"), i = h(a * n, f), g = h(-r * n, f);
32
+ let o = k(n - i * e - g * I, f), c = k(-i * r - g * a, f);
33
+ const d = o > s, B = c > s;
34
+ if (d && (o = f - o), B && (c = f - c), o > s || c > s)
35
+ throw new Error("splitScalar: Endomorphism failed, k=" + n);
36
+ return { k1neg: d, k1: o, k2neg: B, k2: c };
37
+ }
38
+ }
39
+ }, C);
40
+ BigInt(0);
41
+ O.ProjectivePoint;
26
42
  export {
27
- r as toAccount
43
+ O as secp256k1
28
44
  };
package/dist/index26.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index42.cjs"),c=require("./index39.cjs");function t(e){const s=c.keccak256(`0x${e.substring(4)}`).substring(26);return r.checksumAddress(`0x${s}`)}exports.publicKeyToAddress=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./index45.cjs"),f=require("./index46.cjs"),x=require("./index37.cjs"),z=Array.from({length:256},(e,n)=>n.toString(16).padStart(2,"0"));function H(e,n={}){return typeof e=="number"||typeof e=="bigint"?d(e,n):typeof e=="string"?m(e,n):typeof e=="boolean"?b(e,n):u(e,n)}function b(e,n={}){const t=`0x${Number(e)}`;return typeof n.size=="number"?(x.assertSize(t,{size:n.size}),f.pad(t,{size:n.size})):t}function u(e,n={}){let t="";for(let i=0;i<e.length;i++)t+=z[e[i]];const r=`0x${t}`;return typeof n.size=="number"?(x.assertSize(r,{size:n.size}),f.pad(r,{dir:"right",size:n.size})):r}function d(e,n={}){const{signed:t,size:r}=n,i=BigInt(e);let o;r?t?o=(1n<<BigInt(r)*8n-1n)-1n:o=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));const c=typeof o=="bigint"&&t?-o-1n:0;if(o&&i>o||i<c){const s=typeof e=="bigint"?"n":"";throw new y.IntegerOutOfRangeError({max:o?`${o}${s}`:void 0,min:`${c}${s}`,signed:t,size:r,value:`${e}${s}`})}const g=`0x${(t&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?f.pad(g,{size:r}):g}const T=new TextEncoder;function m(e,n={}){const t=T.encode(e);return u(t,n)}exports.boolToHex=b;exports.bytesToHex=u;exports.numberToHex=d;exports.stringToHex=m;exports.toHex=H;
package/dist/index26.js CHANGED
@@ -1,9 +1,48 @@
1
- import { checksumAddress as e } from "./index42.js";
2
- import { keccak256 as o } from "./index39.js";
3
- function d(r) {
4
- const s = o(`0x${r.substring(4)}`).substring(26);
5
- return e(`0x${s}`);
1
+ import { IntegerOutOfRangeError as x } from "./index45.js";
2
+ import { pad as s } from "./index46.js";
3
+ import { assertSize as c } from "./index37.js";
4
+ const b = /* @__PURE__ */ Array.from({ length: 256 }, (n, e) => e.toString(16).padStart(2, "0"));
5
+ function B(n, e = {}) {
6
+ return typeof n == "number" || typeof n == "bigint" ? y(n, e) : typeof n == "string" ? $(n, e) : typeof n == "boolean" ? z(n, e) : m(n, e);
7
+ }
8
+ function z(n, e = {}) {
9
+ const t = `0x${Number(n)}`;
10
+ return typeof e.size == "number" ? (c(t, { size: e.size }), s(t, { size: e.size })) : t;
11
+ }
12
+ function m(n, e = {}) {
13
+ let t = "";
14
+ for (let i = 0; i < n.length; i++)
15
+ t += b[n[i]];
16
+ const r = `0x${t}`;
17
+ return typeof e.size == "number" ? (c(r, { size: e.size }), s(r, { dir: "right", size: e.size })) : r;
18
+ }
19
+ function y(n, e = {}) {
20
+ const { signed: t, size: r } = e, i = BigInt(n);
21
+ let o;
22
+ r ? t ? o = (1n << BigInt(r) * 8n - 1n) - 1n : o = 2n ** (BigInt(r) * 8n) - 1n : typeof n == "number" && (o = BigInt(Number.MAX_SAFE_INTEGER));
23
+ const g = typeof o == "bigint" && t ? -o - 1n : 0;
24
+ if (o && i > o || i < g) {
25
+ const f = typeof n == "bigint" ? "n" : "";
26
+ throw new x({
27
+ max: o ? `${o}${f}` : void 0,
28
+ min: `${g}${f}`,
29
+ signed: t,
30
+ size: r,
31
+ value: `${n}${f}`
32
+ });
33
+ }
34
+ const u = `0x${(t && i < 0 ? (1n << BigInt(r * 8)) + BigInt(i) : i).toString(16)}`;
35
+ return r ? s(u, { size: r }) : u;
36
+ }
37
+ const d = /* @__PURE__ */ new TextEncoder();
38
+ function $(n, e = {}) {
39
+ const t = d.encode(n);
40
+ return m(t, e);
6
41
  }
7
42
  export {
8
- d as publicKeyToAddress
43
+ z as boolToHex,
44
+ m as bytesToHex,
45
+ y as numberToHex,
46
+ $ as stringToHex,
47
+ B as toHex
9
48
  };
package/dist/index27.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./index23.cjs"),s=require("./index24.cjs"),a=require("./index34.cjs");let l=!1;async function g({hash:t,privateKey:i,to:e="object"}){const{r:u,s:c,recovery:r}=o.secp256k1.sign(t.slice(2),i.slice(2),{lowS:!0,extraEntropy:l}),n={r:s.numberToHex(u,{size:32}),s:s.numberToHex(c,{size:32}),v:r?28n:27n,yParity:r};return e==="bytes"||e==="hex"?a.serializeSignature({...n,to:e}):n}exports.sign=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index34.cjs"),t=require("./index35.cjs");function i(s){if(typeof s=="string"){if(!t.isAddress(s,{strict:!1}))throw new n.InvalidAddressError({address:s});return{address:s,type:"json-rpc"}}if(!t.isAddress(s.address,{strict:!1}))throw new n.InvalidAddressError({address:s.address});return{address:s.address,nonceManager:s.nonceManager,sign:s.sign,signAuthorization:s.signAuthorization,signMessage:s.signMessage,signTransaction:s.signTransaction,signTypedData:s.signTypedData,source:"custom",type:"local"}}exports.toAccount=i;