@gardenfi/utils 2.1.3 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (216) hide show
  1. package/dist/index102.cjs +1 -1
  2. package/dist/index102.js +12 -8
  3. package/dist/index104.cjs +1 -1
  4. package/dist/index104.js +1 -1
  5. package/dist/index107.cjs +1 -1
  6. package/dist/index107.js +75 -34
  7. package/dist/index108.cjs +1 -1
  8. package/dist/index108.js +45 -43
  9. package/dist/index110.cjs +1 -1
  10. package/dist/index110.js +1 -1
  11. package/dist/index111.cjs +1 -1
  12. package/dist/index111.js +1 -1
  13. package/dist/index112.cjs +1 -1
  14. package/dist/index112.js +1 -1
  15. package/dist/index113.cjs +1 -1
  16. package/dist/index113.js +1 -1
  17. package/dist/index125.cjs +1 -1
  18. package/dist/index125.js +1 -1
  19. package/dist/index166.cjs +1 -1
  20. package/dist/index166.js +36 -34
  21. package/dist/index189.cjs +1 -1
  22. package/dist/index189.js +2 -2
  23. package/dist/index191.cjs +1 -1
  24. package/dist/index191.js +19 -15
  25. package/dist/index192.cjs +1 -1
  26. package/dist/index192.js +27 -25
  27. package/dist/index203.cjs +1 -1
  28. package/dist/index203.js +16 -16
  29. package/dist/index222.cjs +1 -1
  30. package/dist/index222.js +2 -2
  31. package/dist/index225.cjs +1 -1
  32. package/dist/index225.js +43 -43
  33. package/dist/index226.cjs +1 -1
  34. package/dist/index226.js +3 -113
  35. package/dist/index228.cjs +1 -1
  36. package/dist/index228.js +14 -14
  37. package/dist/index231.cjs +1 -1
  38. package/dist/index231.js +1 -1
  39. package/dist/index232.cjs +1 -1
  40. package/dist/index232.js +1 -1
  41. package/dist/index233.cjs +1 -1
  42. package/dist/index233.js +31 -2
  43. package/dist/index234.cjs +1 -1
  44. package/dist/index234.js +2 -14
  45. package/dist/index235.cjs +1 -1
  46. package/dist/index235.js +13 -12
  47. package/dist/index236.cjs +1 -1
  48. package/dist/index236.js +10 -45
  49. package/dist/index237.cjs +1 -1
  50. package/dist/index237.js +46 -10
  51. package/dist/index238.cjs +1 -1
  52. package/dist/index238.js +11 -7
  53. package/dist/index239.cjs +1 -1
  54. package/dist/index239.js +7 -9
  55. package/dist/index240.cjs +1 -1
  56. package/dist/index240.js +8 -12
  57. package/dist/index241.cjs +1 -1
  58. package/dist/index241.js +13 -14
  59. package/dist/index242.cjs +1 -1
  60. package/dist/index242.js +14 -9
  61. package/dist/index243.cjs +1 -1
  62. package/dist/index243.js +7 -28
  63. package/dist/index245.cjs +1 -1
  64. package/dist/index245.js +3 -3
  65. package/dist/index246.cjs +1 -1
  66. package/dist/index246.js +3 -3
  67. package/dist/index247.cjs +1 -2
  68. package/dist/index247.js +13 -24
  69. package/dist/index248.cjs +1 -1
  70. package/dist/index248.js +15 -13
  71. package/dist/index249.cjs +2 -1
  72. package/dist/index249.js +23 -14
  73. package/dist/index25.cjs +1 -1
  74. package/dist/index25.js +2 -2
  75. package/dist/index266.cjs +1 -1
  76. package/dist/index266.js +1 -1
  77. package/dist/index275.cjs +1 -1
  78. package/dist/index275.js +7 -6
  79. package/dist/index277.cjs +1 -1
  80. package/dist/index277.js +103 -16
  81. package/dist/index278.cjs +1 -1
  82. package/dist/index278.js +5 -222
  83. package/dist/index279.cjs +1 -1
  84. package/dist/index279.js +224 -6
  85. package/dist/index280.cjs +1 -1
  86. package/dist/index280.js +7 -7
  87. package/dist/index281.cjs +1 -1
  88. package/dist/index281.js +7 -27
  89. package/dist/index282.cjs +1 -1
  90. package/dist/index282.js +26 -34
  91. package/dist/index283.cjs +1 -1
  92. package/dist/index283.js +13 -12
  93. package/dist/index284.cjs +1 -1
  94. package/dist/index284.js +124 -48
  95. package/dist/index285.cjs +1 -1
  96. package/dist/index285.js +3 -67
  97. package/dist/index286.cjs +1 -1
  98. package/dist/index286.js +140 -3
  99. package/dist/index287.cjs +1 -1
  100. package/dist/index287.js +143 -128
  101. package/dist/index288.cjs +1 -1
  102. package/dist/index288.js +9 -155
  103. package/dist/index289.cjs +1 -1
  104. package/dist/index289.js +111 -7
  105. package/dist/index290.cjs +2 -1
  106. package/dist/index290.js +116 -95
  107. package/dist/index291.cjs +1 -2
  108. package/dist/index291.js +8 -131
  109. package/dist/index292.cjs +1 -1
  110. package/dist/index292.js +19 -11
  111. package/dist/index293.cjs +1 -1
  112. package/dist/index293.js +139 -19
  113. package/dist/index294.cjs +1 -1
  114. package/dist/index294.js +42 -28
  115. package/dist/index295.cjs +1 -1
  116. package/dist/index295.js +72 -32
  117. package/dist/index296.cjs +1 -1
  118. package/dist/index296.js +2 -69
  119. package/dist/index297.cjs +1 -1
  120. package/dist/index297.js +69 -2
  121. package/dist/index298.cjs +1 -1
  122. package/dist/index298.js +699 -41
  123. package/dist/index299.cjs +1 -1
  124. package/dist/index299.js +179 -620
  125. package/dist/index3.cjs +1 -1
  126. package/dist/index3.js +1 -1
  127. package/dist/index30.cjs +1 -1
  128. package/dist/index30.js +1 -1
  129. package/dist/index300.cjs +2 -1
  130. package/dist/index300.js +63 -203
  131. package/dist/index301.cjs +1 -1
  132. package/dist/index301.js +4 -172
  133. package/dist/index302.cjs +1 -2
  134. package/dist/index302.js +39 -65
  135. package/dist/index303.cjs +1 -1
  136. package/dist/index303.js +7 -4
  137. package/dist/index304.cjs +1 -1
  138. package/dist/index304.js +60 -38
  139. package/dist/index305.cjs +1 -1
  140. package/dist/index305.js +77 -7
  141. package/dist/index306.cjs +1 -1
  142. package/dist/index306.js +4 -63
  143. package/dist/index307.cjs +1 -1
  144. package/dist/index307.js +181 -64
  145. package/dist/index308.cjs +1 -1
  146. package/dist/index308.js +64 -4
  147. package/dist/index309.cjs +1 -1
  148. package/dist/index309.js +44 -194
  149. package/dist/index310.cjs +1 -1
  150. package/dist/index310.js +4 -18
  151. package/dist/index311.cjs +1 -1
  152. package/dist/index311.js +5 -64
  153. package/dist/index312.cjs +1 -1
  154. package/dist/index312.js +2 -45
  155. package/dist/index313.cjs +1 -1
  156. package/dist/index313.js +21 -4
  157. package/dist/index35.cjs +1 -1
  158. package/dist/index35.js +41 -41
  159. package/dist/index36.cjs +1 -1
  160. package/dist/index36.js +1 -1
  161. package/dist/index39.cjs +1 -1
  162. package/dist/index39.js +29 -24
  163. package/dist/index43.cjs +1 -1
  164. package/dist/index43.js +40 -21
  165. package/dist/index44.cjs +1 -1
  166. package/dist/index44.js +24 -24
  167. package/dist/index58.cjs +1 -1
  168. package/dist/index58.js +111 -107
  169. package/dist/index59.cjs +1 -1
  170. package/dist/index59.js +11 -11
  171. package/dist/index60.cjs +1 -1
  172. package/dist/index60.js +1 -1
  173. package/dist/index61.cjs +1 -1
  174. package/dist/index61.js +1 -1
  175. package/dist/index62.cjs +1 -1
  176. package/dist/index62.js +1 -1
  177. package/dist/index64.cjs +1 -1
  178. package/dist/index64.js +26 -26
  179. package/dist/index66.cjs +1 -1
  180. package/dist/index66.js +3 -3
  181. package/dist/index73.cjs +1 -1
  182. package/dist/index73.js +1 -1
  183. package/dist/index74.cjs +1 -1
  184. package/dist/index74.js +8 -8
  185. package/dist/index79.cjs +1 -1
  186. package/dist/index79.js +1 -1
  187. package/dist/index83.cjs +1 -1
  188. package/dist/index83.js +8 -3
  189. package/dist/index84.cjs +1 -1
  190. package/dist/index84.js +53 -51
  191. package/dist/index85.cjs +1 -1
  192. package/dist/index85.js +55 -54
  193. package/dist/index86.cjs +1 -1
  194. package/dist/index86.js +53 -57
  195. package/dist/index90.cjs +1 -1
  196. package/dist/index90.js +44 -42
  197. package/dist/index91.cjs +1 -1
  198. package/dist/index91.js +41 -41
  199. package/dist/index92.cjs +1 -1
  200. package/dist/index92.js +48 -47
  201. package/dist/index93.cjs +1 -1
  202. package/dist/index93.js +28 -28
  203. package/dist/index94.cjs +1 -1
  204. package/dist/index94.js +26 -26
  205. package/dist/index98.cjs +1 -1
  206. package/dist/index98.js +1 -1
  207. package/dist/src/lib/utils.d.ts +2 -1
  208. package/package.json +1 -1
  209. package/dist/index314.cjs +0 -1
  210. package/dist/index314.js +0 -107
  211. package/dist/index315.cjs +0 -1
  212. package/dist/index315.js +0 -7
  213. package/dist/index316.cjs +0 -1
  214. package/dist/index316.js +0 -4
  215. package/dist/index317.cjs +0 -1
  216. package/dist/index317.js +0 -24
package/dist/index102.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index45.cjs");async function b(a,c={}){const{account:i=a.account,chainId:s}=c,e=i?u.parseAccount(i):void 0,n=await a.request({method:"wallet_getCapabilities",params:[e==null?void 0:e.address]}),t={};for(const[o,r]of Object.entries(n))t[Number(o)]=r;return typeof s=="number"?t[s]:t}exports.getCapabilities=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index45.cjs"),p=require("./index150.cjs");async function f(s,c={}){const{account:n=s.account,chainId:t}=c,e=n?l.parseAccount(n):void 0,o=t?[e==null?void 0:e.address,[p.numberToHex(t)]]:[e==null?void 0:e.address],u=await s.request({method:"wallet_getCapabilities",params:o}),a={};for(const[r,b]of Object.entries(u)){a[Number(r)]={};for(let[i,d]of Object.entries(b))i==="addSubAccount"&&(i="unstable_addSubAccount"),a[Number(r)][i]=d}return typeof t=="number"?a[t]:a}exports.getCapabilities=f;
package/dist/index102.js CHANGED
@@ -1,13 +1,17 @@
1
1
  import { parseAccount as p } from "./index45.js";
2
- async function b(a, n = {}) {
3
- const { account: i = a.account, chainId: s } = n, e = i ? p(i) : void 0, o = await a.request({
2
+ import { numberToHex as f } from "./index150.js";
3
+ async function h(s, n = {}) {
4
+ const { account: o = s.account, chainId: t } = n, e = o ? p(o) : void 0, c = t ? [e == null ? void 0 : e.address, [f(t)]] : [e == null ? void 0 : e.address], b = await s.request({
4
5
  method: "wallet_getCapabilities",
5
- params: [e == null ? void 0 : e.address]
6
- }), t = {};
7
- for (const [c, r] of Object.entries(o))
8
- t[Number(c)] = r;
9
- return typeof s == "number" ? t[s] : t;
6
+ params: c
7
+ }), a = {};
8
+ for (const [r, u] of Object.entries(b)) {
9
+ a[Number(r)] = {};
10
+ for (let [i, d] of Object.entries(u))
11
+ i === "addSubAccount" && (i = "unstable_addSubAccount"), a[Number(r)][i] = d;
12
+ }
13
+ return typeof t == "number" ? a[t] : a;
10
14
  }
11
15
  export {
12
- b as getCapabilities
16
+ h as getCapabilities
13
17
  };
package/dist/index104.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index45.cjs"),f=require("./index247.cjs"),g=require("./index181.cjs"),s=require("./index29.cjs"),h=require("./index71.cjs"),A=require("./index83.cjs");async function p(o,n){var i;const{account:c=o.account,chainId:u,nonce:a}=n;if(!c)throw new f.AccountNotFoundError({docsPath:"/docs/eip7702/prepareAuthorization"});const r=d.parseAccount(c),t=(()=>{if(n.executor)return n.executor==="self"?n.executor:d.parseAccount(n.executor)})(),e={address:n.contractAddress??n.address,chainId:u,nonce:a};return typeof e.chainId>"u"&&(e.chainId=((i=o.chain)==null?void 0:i.id)??await s.getAction(o,h.getChainId,"getChainId")({})),typeof e.nonce>"u"&&(e.nonce=await s.getAction(o,A.getTransactionCount,"getTransactionCount")({address:r.address,blockTag:"pending"}),(t==="self"||t!=null&&t.address&&g.isAddressEqual(t.address,r.address))&&(e.nonce+=1)),e}exports.prepareAuthorization=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index45.cjs"),f=require("./index249.cjs"),g=require("./index181.cjs"),s=require("./index29.cjs"),h=require("./index71.cjs"),A=require("./index83.cjs");async function p(o,n){var i;const{account:c=o.account,chainId:u,nonce:a}=n;if(!c)throw new f.AccountNotFoundError({docsPath:"/docs/eip7702/prepareAuthorization"});const r=d.parseAccount(c),t=(()=>{if(n.executor)return n.executor==="self"?n.executor:d.parseAccount(n.executor)})(),e={address:n.contractAddress??n.address,chainId:u,nonce:a};return typeof e.chainId>"u"&&(e.chainId=((i=o.chain)==null?void 0:i.id)??await s.getAction(o,h.getChainId,"getChainId")({})),typeof e.nonce>"u"&&(e.nonce=await s.getAction(o,A.getTransactionCount,"getTransactionCount")({address:r.address,blockTag:"pending"}),(t==="self"||t!=null&&t.address&&g.isAddressEqual(t.address,r.address))&&(e.nonce+=1)),e}exports.prepareAuthorization=p;
package/dist/index104.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parseAccount as e } from "./index45.js";
2
- import { AccountNotFoundError as f } from "./index247.js";
2
+ import { AccountNotFoundError as f } from "./index249.js";
3
3
  import { isAddressEqual as h } from "./index181.js";
4
4
  import { getAction as a } from "./index29.js";
5
5
  import { getChainId as p } from "./index71.js";
package/dist/index107.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("./index45.cjs"),m=require("./index247.cjs"),b=require("./index177.cjs"),r=require("./index150.cjs"),p=require("./index248.cjs");async function g(a,t){const{account:c=a.account,capabilities:i,chain:s=a.chain,forceAtomic:u=!1,id:d,version:l="2.0.0"}=t;if(typeof c>"u")throw new m.AccountNotFoundError({docsPath:"/experimental/eip5792/sendCalls"});const o=c?h.parseAccount(c):null,f=t.calls.map(e=>{const n=e;return{data:n.abi?b.encodeFunctionData({abi:n.abi,functionName:n.functionName,args:n.args}):n.data,to:n.to,value:n.value?r.numberToHex(n.value):void 0}});try{const e=await a.request({method:"wallet_sendCalls",params:[{atomicRequired:u,calls:f,capabilities:i,chainId:r.numberToHex(s.id),from:o==null?void 0:o.address,id:d,version:l}]},{retryCount:0});return typeof e=="string"?{id:e}:e}catch(e){throw p.getTransactionError(e,{...t,account:o,chain:t.chain})}}exports.sendCalls=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./index45.cjs"),h=require("./index38.cjs"),w=require("./index138.cjs"),N=require("./index177.cjs"),g=require("./index154.cjs"),M=require("./index182.cjs"),c=require("./index150.cjs"),S=require("./index247.cjs"),_=require("./index108.cjs"),T="0x5792579257925792579257925792579257925792579257925792579257925792",v=c.numberToHex(0,{size:32});async function H(i,s){const{account:f=i.account,capabilities:l,chain:u=i.chain,experimental_fallback:x,experimental_fallbackDelay:m=32,forceAtomic:b=!1,id:y,version:C="2.0.0"}=s,r=f?k.parseAccount(f):null,d=s.calls.map(a=>{const e=a,o=e.abi?N.encodeFunctionData({abi:e.abi,functionName:e.functionName,args:e.args}):e.data;return{data:e.dataSuffix&&o?g.concat([o,e.dataSuffix]):o,to:e.to,value:e.value?c.numberToHex(e.value):void 0}});try{const a=await i.request({method:"wallet_sendCalls",params:[{atomicRequired:b,calls:d,capabilities:l,chainId:c.numberToHex(u.id),from:r==null?void 0:r.address,id:y,version:C}]},{retryCount:0});return typeof a=="string"?{id:a}:a}catch(a){const e=a;if(x&&(e.name==="MethodNotFoundRpcError"||e.name==="MethodNotSupportedRpcError"||e.name==="UnknownRpcError"||e.details.toLowerCase().includes("does not exist / is not available")||e.details.toLowerCase().includes("missing or invalid. request()")||e.details.toLowerCase().includes("did not match any variant of untagged enum")||e.details.toLowerCase().includes("account upgraded to unsupported contract")||e.details.toLowerCase().includes("eip-7702 not supported")||e.details.toLowerCase().includes("unsupported wc_ method"))){if(l&&Object.values(l).some(n=>!n.optional)){const n="non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";throw new w.UnsupportedNonOptionalCapabilityError(new h.BaseError(n,{details:n}))}if(b&&d.length>1){const t="`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";throw new w.AtomicityNotSupportedError(new h.BaseError(t,{details:t}))}const o=[];for(const t of d){const n=_.sendTransaction(i,{account:r,chain:u,data:t.data,to:t.to,value:t.value?M.hexToBigInt(t.value):void 0});o.push(n),m>0&&await new Promise(E=>setTimeout(E,m))}const p=await Promise.allSettled(o);if(p.every(t=>t.status==="rejected"))throw p[0].reason;const q=p.map(t=>t.status==="fulfilled"?t.value:v);return{id:g.concat([...q,c.numberToHex(u.id,{size:32}),T])}}throw S.getTransactionError(a,{...s,account:r,chain:s.chain})}}exports.fallbackMagicIdentifier=T;exports.fallbackTransactionErrorMagicIdentifier=v;exports.sendCalls=H;
package/dist/index107.js CHANGED
@@ -1,50 +1,91 @@
1
- import { parseAccount as m } from "./index45.js";
2
- import { AccountNotFoundError as p } from "./index247.js";
3
- import { encodeFunctionData as h } from "./index177.js";
1
+ import { parseAccount as E } from "./index45.js";
2
+ import { BaseError as w } from "./index38.js";
3
+ import { UnsupportedNonOptionalCapabilityError as N, AtomicityNotSupportedError as T } from "./index138.js";
4
+ import { encodeFunctionData as k } from "./index177.js";
5
+ import { concat as b } from "./index154.js";
6
+ import { hexToBigInt as _ } from "./index182.js";
4
7
  import { numberToHex as c } from "./index150.js";
5
- import { getTransactionError as b } from "./index248.js";
6
- async function A(r, n) {
7
- const { account: e = r.account, capabilities: i, chain: s = r.chain, forceAtomic: u = !1, id: d, version: l = "2.0.0" } = n;
8
- if (typeof e > "u")
9
- throw new p({
10
- docsPath: "/experimental/eip5792/sendCalls"
11
- });
12
- const a = e ? m(e) : null, f = n.calls.map((t) => {
13
- const o = t;
8
+ import { getTransactionError as L } from "./index247.js";
9
+ import { sendTransaction as S } from "./index108.js";
10
+ const A = "0x5792579257925792579257925792579257925792579257925792579257925792", I = c(0, {
11
+ size: 32
12
+ });
13
+ async function P(i, s) {
14
+ const { account: f = i.account, capabilities: l, chain: d = i.chain, experimental_fallback: g, experimental_fallbackDelay: m = 32, forceAtomic: h = !1, id: v, version: C = "2.0.0" } = s, r = f ? E(f) : null, u = s.calls.map((a) => {
15
+ const t = a, e = t.abi ? k({
16
+ abi: t.abi,
17
+ functionName: t.functionName,
18
+ args: t.args
19
+ }) : t.data;
14
20
  return {
15
- data: o.abi ? h({
16
- abi: o.abi,
17
- functionName: o.functionName,
18
- args: o.args
19
- }) : o.data,
20
- to: o.to,
21
- value: o.value ? c(o.value) : void 0
21
+ data: t.dataSuffix && e ? b([e, t.dataSuffix]) : e,
22
+ to: t.to,
23
+ value: t.value ? c(t.value) : void 0
22
24
  };
23
25
  });
24
26
  try {
25
- const t = await r.request({
27
+ const a = await i.request({
26
28
  method: "wallet_sendCalls",
27
29
  params: [
28
30
  {
29
- atomicRequired: u,
30
- calls: f,
31
- capabilities: i,
32
- chainId: c(s.id),
33
- from: a == null ? void 0 : a.address,
34
- id: d,
35
- version: l
31
+ atomicRequired: h,
32
+ calls: u,
33
+ capabilities: l,
34
+ chainId: c(d.id),
35
+ from: r == null ? void 0 : r.address,
36
+ id: v,
37
+ version: C
36
38
  }
37
39
  ]
38
40
  }, { retryCount: 0 });
39
- return typeof t == "string" ? { id: t } : t;
40
- } catch (t) {
41
- throw b(t, {
42
- ...n,
43
- account: a,
44
- chain: n.chain
41
+ return typeof a == "string" ? { id: a } : a;
42
+ } catch (a) {
43
+ const t = a;
44
+ if (g && (t.name === "MethodNotFoundRpcError" || t.name === "MethodNotSupportedRpcError" || t.name === "UnknownRpcError" || t.details.toLowerCase().includes("does not exist / is not available") || t.details.toLowerCase().includes("missing or invalid. request()") || t.details.toLowerCase().includes("did not match any variant of untagged enum") || t.details.toLowerCase().includes("account upgraded to unsupported contract") || t.details.toLowerCase().includes("eip-7702 not supported") || t.details.toLowerCase().includes("unsupported wc_ method"))) {
45
+ if (l && Object.values(l).some((n) => !n.optional)) {
46
+ const n = "non-optional `capabilities` are not supported on fallback to `eth_sendTransaction`.";
47
+ throw new N(new w(n, {
48
+ details: n
49
+ }));
50
+ }
51
+ if (h && u.length > 1) {
52
+ const o = "`forceAtomic` is not supported on fallback to `eth_sendTransaction`.";
53
+ throw new T(new w(o, {
54
+ details: o
55
+ }));
56
+ }
57
+ const e = [];
58
+ for (const o of u) {
59
+ const n = S(i, {
60
+ account: r,
61
+ chain: d,
62
+ data: o.data,
63
+ to: o.to,
64
+ value: o.value ? _(o.value) : void 0
65
+ });
66
+ e.push(n), m > 0 && await new Promise((x) => setTimeout(x, m));
67
+ }
68
+ const p = await Promise.allSettled(e);
69
+ if (p.every((o) => o.status === "rejected"))
70
+ throw p[0].reason;
71
+ const y = p.map((o) => o.status === "fulfilled" ? o.value : I);
72
+ return {
73
+ id: b([
74
+ ...y,
75
+ c(d.id, { size: 32 }),
76
+ A
77
+ ])
78
+ };
79
+ }
80
+ throw L(a, {
81
+ ...s,
82
+ account: r,
83
+ chain: s.chain
45
84
  });
46
85
  }
47
86
  }
48
87
  export {
49
- A as sendCalls
88
+ A as fallbackMagicIdentifier,
89
+ I as fallbackTransactionErrorMagicIdentifier,
90
+ P as sendCalls
50
91
  };
package/dist/index108.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./index45.cjs"),u=require("./index247.cjs"),G=require("./index38.cjs"),O=require("./index239.cjs"),j=require("./index212.cjs"),B=require("./index248.cjs"),U=require("./index235.cjs"),W=require("./index184.cjs"),l=require("./index29.cjs"),k=require("./index220.cjs"),D=require("./index197.cjs"),H=require("./index71.cjs"),x=require("./index96.cjs"),J=require("./index97.cjs"),f=new k.LruMap(128);async function K(t,e){var P,M,z,I;const{account:d=t.account,chain:n=t.chain,accessList:w,authorizationList:s,blobs:q,data:m,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,value:C,...N}=e;if(typeof d>"u")throw new u.AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const r=d?_.parseAccount(d):null;try{D.assertRequest(e);const a=await(async()=>{if(e.to)return e.to;if(e.to!==null&&s&&s.length>0)return await O.recoverAuthorizationAddress({authorization:s[0]}).catch(()=>{throw new G.BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((r==null?void 0:r.type)==="json-rpc"||r===null){let i;n!==null&&(i=await l.getAction(t,H.getChainId,"getChainId")({}),j.assertCurrentChain({currentChainId:i,chain:n}));const c=(z=(M=(P=t.chain)==null?void 0:P.formatters)==null?void 0:M.transactionRequest)==null?void 0:z.format,b=(c||W.formatTransactionRequest)({...U.extract(N,{format:c}),accessList:w,authorizationList:s,blobs:q,chainId:i,data:m,from:r==null?void 0:r.address,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,to:a,value:C}),F=f.get(t.uid),L=F?"wallet_sendTransaction":"eth_sendTransaction";try{return await t.request({method:L,params:[b]},{retryCount:0})}catch(v){if(F===!1)throw v;const o=v;if(o.name==="InvalidInputRpcError"||o.name==="InvalidParamsRpcError"||o.name==="MethodNotFoundRpcError"||o.name==="MethodNotSupportedRpcError")return await t.request({method:"wallet_sendTransaction",params:[b]},{retryCount:0}).then(p=>(f.set(t.uid,!0),p)).catch(p=>{const h=p;throw h.name==="MethodNotFoundRpcError"||h.name==="MethodNotSupportedRpcError"?(f.set(t.uid,!1),o):h});throw o}}if((r==null?void 0:r.type)==="local"){const i=await l.getAction(t,x.prepareTransactionRequest,"prepareTransactionRequest")({account:r,accessList:w,authorizationList:s,blobs:q,chain:n,data:m,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,nonceManager:r.nonceManager,parameters:[...x.defaultParameters,"sidecars"],value:C,...N,to:a}),c=(I=n==null?void 0:n.serializers)==null?void 0:I.transaction,S=await r.signTransaction(i,{serializer:c});return await l.getAction(t,J.sendRawTransaction,"sendRawTransaction")({serializedTransaction:S})}throw(r==null?void 0:r.type)==="smart"?new u.AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new u.AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:r==null?void 0:r.type})}catch(a){throw a instanceof u.AccountTypeNotSupportedError?a:B.getTransactionError(a,{...e,account:r,chain:e.chain||void 0})}}exports.sendTransaction=K;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const G=require("./index45.cjs"),u=require("./index249.cjs"),O=require("./index38.cjs"),j=require("./index240.cjs"),B=require("./index212.cjs"),U=require("./index247.cjs"),W=require("./index236.cjs"),k=require("./index184.cjs"),l=require("./index29.cjs"),D=require("./index220.cjs"),H=require("./index197.cjs"),J=require("./index71.cjs"),L=require("./index96.cjs"),K=require("./index97.cjs"),f=new D.LruMap(128);async function Q(r,e){var M,z,I,S;const{account:d=r.account,chain:n=r.chain,accessList:w,authorizationList:s,blobs:q,data:m,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,type:C,value:N,...P}=e;if(typeof d>"u")throw new u.AccountNotFoundError({docsPath:"/docs/actions/wallet/sendTransaction"});const t=d?G.parseAccount(d):null;try{H.assertRequest(e);const a=await(async()=>{if(e.to)return e.to;if(e.to!==null&&s&&s.length>0)return await j.recoverAuthorizationAddress({authorization:s[0]}).catch(()=>{throw new O.BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((t==null?void 0:t.type)==="json-rpc"||t===null){let i;n!==null&&(i=await l.getAction(r,J.getChainId,"getChainId")({}),B.assertCurrentChain({currentChainId:i,chain:n}));const c=(I=(z=(M=r.chain)==null?void 0:M.formatters)==null?void 0:z.transactionRequest)==null?void 0:I.format,F=(c||k.formatTransactionRequest)({...W.extract(P,{format:c}),accessList:w,authorizationList:s,blobs:q,chainId:i,data:m,from:t==null?void 0:t.address,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,to:a,type:C,value:N}),v=f.get(r.uid),_=v?"wallet_sendTransaction":"eth_sendTransaction";try{return await r.request({method:_,params:[F]},{retryCount:0})}catch(x){if(v===!1)throw x;const o=x;if(o.name==="InvalidInputRpcError"||o.name==="InvalidParamsRpcError"||o.name==="MethodNotFoundRpcError"||o.name==="MethodNotSupportedRpcError")return await r.request({method:"wallet_sendTransaction",params:[F]},{retryCount:0}).then(p=>(f.set(r.uid,!0),p)).catch(p=>{const h=p;throw h.name==="MethodNotFoundRpcError"||h.name==="MethodNotSupportedRpcError"?(f.set(r.uid,!1),o):h});throw o}}if((t==null?void 0:t.type)==="local"){const i=await l.getAction(r,L.prepareTransactionRequest,"prepareTransactionRequest")({account:t,accessList:w,authorizationList:s,blobs:q,chain:n,data:m,gas:T,gasPrice:g,maxFeePerBlobGas:y,maxFeePerGas:R,maxPriorityFeePerGas:A,nonce:E,nonceManager:t.nonceManager,parameters:[...L.defaultParameters,"sidecars"],type:C,value:N,...P,to:a}),c=(S=n==null?void 0:n.serializers)==null?void 0:S.transaction,b=await t.signTransaction(i,{serializer:c});return await l.getAction(r,K.sendRawTransaction,"sendRawTransaction")({serializedTransaction:b})}throw(t==null?void 0:t.type)==="smart"?new u.AccountTypeNotSupportedError({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new u.AccountTypeNotSupportedError({docsPath:"/docs/actions/wallet/sendTransaction",type:t==null?void 0:t.type})}catch(a){throw a instanceof u.AccountTypeNotSupportedError?a:U.getTransactionError(a,{...e,account:t,chain:e.chain||void 0})}}exports.sendTransaction=Q;
package/dist/index108.js CHANGED
@@ -1,47 +1,47 @@
1
- import { parseAccount as S } from "./index45.js";
2
- import { AccountNotFoundError as _, AccountTypeNotSupportedError as p } from "./index247.js";
3
- import { BaseError as G } from "./index38.js";
4
- import { recoverAuthorizationAddress as B } from "./index239.js";
5
- import { assertCurrentChain as O } from "./index212.js";
6
- import { getTransactionError as U } from "./index248.js";
7
- import { extract as W } from "./index235.js";
8
- import { formatTransactionRequest as j } from "./index184.js";
1
+ import { parseAccount as _ } from "./index45.js";
2
+ import { AccountNotFoundError as G, AccountTypeNotSupportedError as p } from "./index249.js";
3
+ import { BaseError as B } from "./index38.js";
4
+ import { recoverAuthorizationAddress as O } from "./index240.js";
5
+ import { assertCurrentChain as U } from "./index212.js";
6
+ import { getTransactionError as W } from "./index247.js";
7
+ import { extract as j } from "./index236.js";
8
+ import { formatTransactionRequest as k } from "./index184.js";
9
9
  import { getAction as f } from "./index29.js";
10
- import { LruMap as k } from "./index220.js";
11
- import { assertRequest as D } from "./index197.js";
12
- import { getChainId as H } from "./index71.js";
13
- import { prepareTransactionRequest as J, defaultParameters as K } from "./index96.js";
14
- import { sendRawTransaction as Q } from "./index97.js";
15
- const h = new k(128);
16
- async function dr(t, o) {
17
- var M, z, A, F;
18
- const { account: d = t.account, chain: e = t.chain, accessList: w, authorizationList: s, blobs: l, data: y, gas: T, gasPrice: g, maxFeePerBlobGas: R, maxFeePerGas: E, maxPriorityFeePerGas: q, nonce: P, value: C, ...N } = o;
10
+ import { LruMap as D } from "./index220.js";
11
+ import { assertRequest as H } from "./index197.js";
12
+ import { getChainId as J } from "./index71.js";
13
+ import { prepareTransactionRequest as K, defaultParameters as Q } from "./index96.js";
14
+ import { sendRawTransaction as V } from "./index97.js";
15
+ const h = new D(128);
16
+ async function mr(t, o) {
17
+ var z, A, F, I;
18
+ const { account: d = t.account, chain: e = t.chain, accessList: w, authorizationList: s, blobs: l, data: y, gas: T, gasPrice: g, maxFeePerBlobGas: R, maxFeePerGas: E, maxPriorityFeePerGas: q, nonce: P, type: C, value: N, ...M } = o;
19
19
  if (typeof d > "u")
20
- throw new _({
20
+ throw new G({
21
21
  docsPath: "/docs/actions/wallet/sendTransaction"
22
22
  });
23
- const r = d ? S(d) : null;
23
+ const r = d ? _(d) : null;
24
24
  try {
25
- D(o);
25
+ H(o);
26
26
  const a = await (async () => {
27
27
  if (o.to)
28
28
  return o.to;
29
29
  if (o.to !== null && s && s.length > 0)
30
- return await B({
30
+ return await O({
31
31
  authorization: s[0]
32
32
  }).catch(() => {
33
- throw new G("`to` is required. Could not infer from `authorizationList`.");
33
+ throw new B("`to` is required. Could not infer from `authorizationList`.");
34
34
  });
35
35
  })();
36
36
  if ((r == null ? void 0 : r.type) === "json-rpc" || r === null) {
37
37
  let i;
38
- e !== null && (i = await f(t, H, "getChainId")({}), O({
38
+ e !== null && (i = await f(t, J, "getChainId")({}), U({
39
39
  currentChainId: i,
40
40
  chain: e
41
41
  }));
42
- const c = (A = (z = (M = t.chain) == null ? void 0 : M.formatters) == null ? void 0 : z.transactionRequest) == null ? void 0 : A.format, x = (c || j)({
42
+ const c = (F = (A = (z = t.chain) == null ? void 0 : z.formatters) == null ? void 0 : A.transactionRequest) == null ? void 0 : F.format, b = (c || k)({
43
43
  // Pick out extra data that might exist on the chain's transaction request type.
44
- ...W(N, { format: c }),
44
+ ...j(M, { format: c }),
45
45
  accessList: w,
46
46
  authorizationList: s,
47
47
  blobs: l,
@@ -55,21 +55,22 @@ async function dr(t, o) {
55
55
  maxPriorityFeePerGas: q,
56
56
  nonce: P,
57
57
  to: a,
58
- value: C
59
- }), b = h.get(t.uid), L = b ? "wallet_sendTransaction" : "eth_sendTransaction";
58
+ type: C,
59
+ value: N
60
+ }), v = h.get(t.uid), S = v ? "wallet_sendTransaction" : "eth_sendTransaction";
60
61
  try {
61
62
  return await t.request({
62
- method: L,
63
- params: [x]
63
+ method: S,
64
+ params: [b]
64
65
  }, { retryCount: 0 });
65
- } catch (v) {
66
- if (b === !1)
67
- throw v;
68
- const n = v;
66
+ } catch (L) {
67
+ if (v === !1)
68
+ throw L;
69
+ const n = L;
69
70
  if (n.name === "InvalidInputRpcError" || n.name === "InvalidParamsRpcError" || n.name === "MethodNotFoundRpcError" || n.name === "MethodNotSupportedRpcError")
70
71
  return await t.request({
71
72
  method: "wallet_sendTransaction",
72
- params: [x]
73
+ params: [b]
73
74
  }, { retryCount: 0 }).then((m) => (h.set(t.uid, !0), m)).catch((m) => {
74
75
  const u = m;
75
76
  throw u.name === "MethodNotFoundRpcError" || u.name === "MethodNotSupportedRpcError" ? (h.set(t.uid, !1), n) : u;
@@ -78,7 +79,7 @@ async function dr(t, o) {
78
79
  }
79
80
  }
80
81
  if ((r == null ? void 0 : r.type) === "local") {
81
- const i = await f(t, J, "prepareTransactionRequest")({
82
+ const i = await f(t, K, "prepareTransactionRequest")({
82
83
  account: r,
83
84
  accessList: w,
84
85
  authorizationList: s,
@@ -92,15 +93,16 @@ async function dr(t, o) {
92
93
  maxPriorityFeePerGas: q,
93
94
  nonce: P,
94
95
  nonceManager: r.nonceManager,
95
- parameters: [...K, "sidecars"],
96
- value: C,
97
- ...N,
96
+ parameters: [...Q, "sidecars"],
97
+ type: C,
98
+ value: N,
99
+ ...M,
98
100
  to: a
99
- }), c = (F = e == null ? void 0 : e.serializers) == null ? void 0 : F.transaction, I = await r.signTransaction(i, {
101
+ }), c = (I = e == null ? void 0 : e.serializers) == null ? void 0 : I.transaction, x = await r.signTransaction(i, {
100
102
  serializer: c
101
103
  });
102
- return await f(t, Q, "sendRawTransaction")({
103
- serializedTransaction: I
104
+ return await f(t, V, "sendRawTransaction")({
105
+ serializedTransaction: x
104
106
  });
105
107
  }
106
108
  throw (r == null ? void 0 : r.type) === "smart" ? new p({
@@ -114,7 +116,7 @@ async function dr(t, o) {
114
116
  type: r == null ? void 0 : r.type
115
117
  });
116
118
  } catch (a) {
117
- throw a instanceof p ? a : U(a, {
119
+ throw a instanceof p ? a : W(a, {
118
120
  ...o,
119
121
  account: r,
120
122
  chain: o.chain || void 0
@@ -122,5 +124,5 @@ async function dr(t, o) {
122
124
  }
123
125
  }
124
126
  export {
125
- dr as sendTransaction
127
+ mr as sendTransaction
126
128
  };
package/dist/index110.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index45.cjs"),r=require("./index247.cjs"),e=require("./index104.cjs");async function a(t,n){const{account:i=t.account}=n;if(!i)throw new r.AccountNotFoundError({docsPath:"/docs/eip7702/signAuthorization"});const o=u.parseAccount(i);if(!o.signAuthorization)throw new r.AccountTypeNotSupportedError({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:o.type});const c=await e.prepareAuthorization(t,n);return o.signAuthorization(c)}exports.signAuthorization=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index45.cjs"),r=require("./index249.cjs"),e=require("./index104.cjs");async function a(t,n){const{account:i=t.account}=n;if(!i)throw new r.AccountNotFoundError({docsPath:"/docs/eip7702/signAuthorization"});const o=u.parseAccount(i);if(!o.signAuthorization)throw new r.AccountTypeNotSupportedError({docsPath:"/docs/eip7702/signAuthorization",metaMessages:["The `signAuthorization` Action does not support JSON-RPC Accounts."],type:o.type});const c=await e.prepareAuthorization(t,n);return o.signAuthorization(c)}exports.signAuthorization=a;
package/dist/index110.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parseAccount as c } from "./index45.js";
2
- import { AccountNotFoundError as u, AccountTypeNotSupportedError as a } from "./index247.js";
2
+ import { AccountNotFoundError as u, AccountTypeNotSupportedError as a } from "./index249.js";
3
3
  import { prepareAuthorization as s } from "./index104.js";
4
4
  async function A(t, n) {
5
5
  const { account: i = t.account } = n;
package/dist/index111.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index45.cjs"),a=require("./index247.cjs"),o=require("./index150.cjs");async function i(n,{account:e=n.account,message:r}){if(!e)throw new a.AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const t=c.parseAccount(e);if(t.signMessage)return t.signMessage({message:r});const s=typeof r=="string"?o.stringToHex(r):r.raw instanceof Uint8Array?o.toHex(r.raw):r.raw;return n.request({method:"personal_sign",params:[s,t.address]},{retryCount:0})}exports.signMessage=i;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index45.cjs"),a=require("./index249.cjs"),o=require("./index150.cjs");async function i(n,{account:e=n.account,message:r}){if(!e)throw new a.AccountNotFoundError({docsPath:"/docs/actions/wallet/signMessage"});const t=c.parseAccount(e);if(t.signMessage)return t.signMessage({message:r});const s=typeof r=="string"?o.stringToHex(r):r.raw instanceof Uint8Array?o.toHex(r.raw):r.raw;return n.request({method:"personal_sign",params:[s,t.address]},{retryCount:0})}exports.signMessage=i;
package/dist/index111.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parseAccount as e } from "./index45.js";
2
- import { AccountNotFoundError as i } from "./index247.js";
2
+ import { AccountNotFoundError as i } from "./index249.js";
3
3
  import { stringToHex as a, toHex as c } from "./index150.js";
4
4
  async function g(n, { account: o = n.account, message: r }) {
5
5
  if (!o)
package/dist/index112.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index45.cjs"),f=require("./index247.cjs"),C=require("./index212.cjs"),T=require("./index150.cjs"),m=require("./index184.cjs"),I=require("./index29.cjs"),w=require("./index197.cjs"),A=require("./index71.cjs");async function R(t,s){var i,u,d,h;const{account:o=t.account,chain:n=t.chain,...c}=s;if(!o)throw new f.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});const r=g.parseAccount(o);w.assertRequest({account:r,...s});const a=await I.getAction(t,A.getChainId,"getChainId")({});n!==null&&C.assertCurrentChain({currentChainId:a,chain:n});const e=(n==null?void 0:n.formatters)||((i=t.chain)==null?void 0:i.formatters),q=((u=e==null?void 0:e.transactionRequest)==null?void 0:u.format)||m.formatTransactionRequest;return r.signTransaction?r.signTransaction({...c,chainId:a},{serializer:(h=(d=t.chain)==null?void 0:d.serializers)==null?void 0:h.transaction}):await t.request({method:"eth_signTransaction",params:[{...q(c),chainId:T.numberToHex(a),from:r.address}]},{retryCount:0})}exports.signTransaction=R;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("./index45.cjs"),f=require("./index249.cjs"),C=require("./index212.cjs"),T=require("./index150.cjs"),m=require("./index184.cjs"),I=require("./index29.cjs"),w=require("./index197.cjs"),A=require("./index71.cjs");async function R(t,s){var i,u,d,h;const{account:o=t.account,chain:n=t.chain,...c}=s;if(!o)throw new f.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTransaction"});const r=g.parseAccount(o);w.assertRequest({account:r,...s});const a=await I.getAction(t,A.getChainId,"getChainId")({});n!==null&&C.assertCurrentChain({currentChainId:a,chain:n});const e=(n==null?void 0:n.formatters)||((i=t.chain)==null?void 0:i.formatters),q=((u=e==null?void 0:e.transactionRequest)==null?void 0:u.format)||m.formatTransactionRequest;return r.signTransaction?r.signTransaction({...c,chainId:a},{serializer:(h=(d=t.chain)==null?void 0:d.serializers)==null?void 0:h.transaction}):await t.request({method:"eth_signTransaction",params:[{...q(c),chainId:T.numberToHex(a),from:r.address}]},{retryCount:0})}exports.signTransaction=R;
package/dist/index112.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parseAccount as d } from "./index45.js";
2
- import { AccountNotFoundError as p } from "./index247.js";
2
+ import { AccountNotFoundError as p } from "./index249.js";
3
3
  import { assertCurrentChain as g } from "./index212.js";
4
4
  import { numberToHex as T } from "./index150.js";
5
5
  import { formatTransactionRequest as C } from "./index184.js";
package/dist/index113.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index45.cjs"),y=require("./index247.cjs"),s=require("./index188.cjs");async function p(c,r){const{account:i=c.account,domain:t,message:a,primaryType:e}=r;if(!i)throw new y.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});const n=u.parseAccount(i),o={EIP712Domain:s.getTypesForEIP712Domain({domain:t}),...r.types};if(s.validateTypedData({domain:t,message:a,primaryType:e,types:o}),n.signTypedData)return n.signTypedData({domain:t,message:a,primaryType:e,types:o});const d=s.serializeTypedData({domain:t,message:a,primaryType:e,types:o});return c.request({method:"eth_signTypedData_v4",params:[n.address,d]},{retryCount:0})}exports.signTypedData=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./index45.cjs"),y=require("./index249.cjs"),s=require("./index188.cjs");async function p(c,r){const{account:i=c.account,domain:t,message:a,primaryType:e}=r;if(!i)throw new y.AccountNotFoundError({docsPath:"/docs/actions/wallet/signTypedData"});const n=u.parseAccount(i),o={EIP712Domain:s.getTypesForEIP712Domain({domain:t}),...r.types};if(s.validateTypedData({domain:t,message:a,primaryType:e,types:o}),n.signTypedData)return n.signTypedData({domain:t,message:a,primaryType:e,types:o});const d=s.serializeTypedData({domain:t,message:a,primaryType:e,types:o});return c.request({method:"eth_signTypedData_v4",params:[n.address,d]},{retryCount:0})}exports.signTypedData=p;
package/dist/index113.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { parseAccount as p } from "./index45.js";
2
- import { AccountNotFoundError as d } from "./index247.js";
2
+ import { AccountNotFoundError as d } from "./index249.js";
3
3
  import { getTypesForEIP712Domain as y, validateTypedData as m, serializeTypedData as u } from "./index188.js";
4
4
  async function f(r, s) {
5
5
  const { account: c = r.account, domain: t, message: a, primaryType: o } = s;
package/dist/index125.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="2.28.0";exports.version=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="2.31.6";exports.version=e;
package/dist/index125.js CHANGED
@@ -1,4 +1,4 @@
1
- const o = "2.28.0";
1
+ const o = "2.31.6";
2
2
  export {
3
3
  o as version
4
4
  };
package/dist/index166.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index122.cjs"),y=require("./index124.cjs"),A=require("./index167.cjs"),D=require("./index168.cjs"),b=require("./index158.cjs"),S=require("./index123.cjs"),h="/docs/contract/decodeEventLog";function q(n){const{abi:r,data:i,strict:p,topics:v}=n,m=p??!0,[u,...E]=v;if(!u)throw new a.AbiEventSignatureEmptyTopicsError({docsPath:h});const o=r.length===1?r[0]:r.find(e=>e.type==="event"&&u===A.toEventSelector(S.formatAbiItem(e)));if(!(o&&"name"in o)||o.type!=="event")throw new a.AbiEventSignatureNotFoundError(u,{docsPath:h});const{name:w,inputs:d}=o,f=d==null?void 0:d.some(e=>!("name"in e&&e.name));let c=f?[]:{};const g=d.filter(e=>"indexed"in e&&e.indexed);for(let e=0;e<g.length;e++){const t=g[e],l=E[e];if(!l)throw new a.DecodeLogTopicsMismatch({abiItem:o,param:t});c[f?e:t.name||e]=I({param:t,value:l})}const s=d.filter(e=>!("indexed"in e&&e.indexed));if(s.length>0){if(i&&i!=="0x")try{const e=b.decodeAbiParameters(s,i);if(e)if(f)c=[...c,...e];else for(let t=0;t<s.length;t++)c[s[t].name]=e[t]}catch(e){if(m)throw e instanceof a.AbiDecodingDataSizeTooSmallError||e instanceof D.PositionOutOfBoundsError?new a.DecodeLogDataMismatch({abiItem:o,data:i,params:s,size:y.size(i)}):e}else if(m)throw new a.DecodeLogDataMismatch({abiItem:o,data:"0x",params:s,size:0})}return{eventName:w,args:Object.values(c).length>0?c:void 0}}function I({param:n,value:r}){return n.type==="string"||n.type==="bytes"||n.type==="tuple"||n.type.match(/^(.*)\[(\d+)?\]$/)?r:(b.decodeAbiParameters([n],r)||[])[0]}exports.decodeEventLog=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index122.cjs"),A=require("./index124.cjs"),D=require("./index167.cjs"),S=require("./index168.cjs"),b=require("./index158.cjs"),I=require("./index123.cjs"),p="/docs/contract/decodeEventLog";function q(n){const{abi:d,data:i,strict:v,topics:E}=n,m=v??!0,[f,...w]=E;if(!f)throw new a.AbiEventSignatureEmptyTopicsError({docsPath:p});const o=d.find(e=>e.type==="event"&&f===D.toEventSelector(I.formatAbiItem(e)));if(!(o&&"name"in o)||o.type!=="event")throw new a.AbiEventSignatureNotFoundError(f,{docsPath:p});const{name:y,inputs:r}=o,u=r==null?void 0:r.some(e=>!("name"in e&&e.name)),c=u?[]:{},g=r.map((e,t)=>[e,t]).filter(([e])=>"indexed"in e&&e.indexed);for(let e=0;e<g.length;e++){const[t,l]=g[e],h=w[e];if(!h)throw new a.DecodeLogTopicsMismatch({abiItem:o,param:t});c[u?l:t.name||l]=L({param:t,value:h})}const s=r.filter(e=>!("indexed"in e&&e.indexed));if(s.length>0){if(i&&i!=="0x")try{const e=b.decodeAbiParameters(s,i);if(e)if(u)for(let t=0;t<r.length;t++)c[t]=c[t]??e.shift();else for(let t=0;t<s.length;t++)c[s[t].name]=e[t]}catch(e){if(m)throw e instanceof a.AbiDecodingDataSizeTooSmallError||e instanceof S.PositionOutOfBoundsError?new a.DecodeLogDataMismatch({abiItem:o,data:i,params:s,size:A.size(i)}):e}else if(m)throw new a.DecodeLogDataMismatch({abiItem:o,data:"0x",params:s,size:0})}return{eventName:y,args:Object.values(c).length>0?c:void 0}}function L({param:n,value:d}){return n.type==="string"||n.type==="bytes"||n.type==="tuple"||n.type.match(/^(.*)\[(\d+)?\]$/)?d:(b.decodeAbiParameters([n],d)||[])[0]}exports.decodeEventLog=q;
package/dist/index166.js CHANGED
@@ -1,65 +1,67 @@
1
- import { AbiEventSignatureEmptyTopicsError as y, AbiEventSignatureNotFoundError as A, DecodeLogTopicsMismatch as D, AbiDecodingDataSizeTooSmallError as x, DecodeLogDataMismatch as u } from "./index122.js";
2
- import { size as I } from "./index124.js";
3
- import { toEventSelector as S } from "./index167.js";
4
- import { PositionOutOfBoundsError as T } from "./index168.js";
5
- import { decodeAbiParameters as h } from "./index158.js";
6
- import { formatAbiItem as z } from "./index123.js";
7
- const l = "/docs/contract/decodeEventLog";
8
- function F(n) {
9
- const { abi: i, data: r, strict: w, topics: E } = n, m = w ?? !0, [a, ...b] = E;
1
+ import { AbiEventSignatureEmptyTopicsError as A, AbiEventSignatureNotFoundError as x, DecodeLogTopicsMismatch as D, AbiDecodingDataSizeTooSmallError as I, DecodeLogDataMismatch as l } from "./index122.js";
2
+ import { size as S } from "./index124.js";
3
+ import { toEventSelector as T } from "./index167.js";
4
+ import { PositionOutOfBoundsError as z } from "./index168.js";
5
+ import { decodeAbiParameters as w } from "./index158.js";
6
+ import { formatAbiItem as L } from "./index123.js";
7
+ const u = "/docs/contract/decodeEventLog";
8
+ function U(o) {
9
+ const { abi: d, data: i, strict: E, topics: b } = o, m = E ?? !0, [a, ...v] = b;
10
10
  if (!a)
11
- throw new y({ docsPath: l });
12
- const o = i.length === 1 ? i[0] : i.find((e) => e.type === "event" && a === S(z(e)));
13
- if (!(o && "name" in o) || o.type !== "event")
14
- throw new A(a, { docsPath: l });
15
- const { name: v, inputs: d } = o, f = d == null ? void 0 : d.some((e) => !("name" in e && e.name));
16
- let c = f ? [] : {};
17
- const p = d.filter((e) => "indexed" in e && e.indexed);
11
+ throw new A({ docsPath: u });
12
+ const n = d.find((e) => e.type === "event" && a === T(L(e)));
13
+ if (!(n && "name" in n) || n.type !== "event")
14
+ throw new x(a, { docsPath: u });
15
+ const { name: y, inputs: r } = n, f = r == null ? void 0 : r.some((e) => !("name" in e && e.name)), c = f ? [] : {}, p = r.map((e, t) => [e, t]).filter(([e]) => "indexed" in e && e.indexed);
18
16
  for (let e = 0; e < p.length; e++) {
19
- const t = p[e], g = b[e];
20
- if (!g)
17
+ const [t, g] = p[e], h = v[e];
18
+ if (!h)
21
19
  throw new D({
22
- abiItem: o,
20
+ abiItem: n,
23
21
  param: t
24
22
  });
25
- c[f ? e : t.name || e] = L({ param: t, value: g });
23
+ c[f ? g : t.name || g] = O({
24
+ param: t,
25
+ value: h
26
+ });
26
27
  }
27
- const s = d.filter((e) => !("indexed" in e && e.indexed));
28
+ const s = r.filter((e) => !("indexed" in e && e.indexed));
28
29
  if (s.length > 0) {
29
- if (r && r !== "0x")
30
+ if (i && i !== "0x")
30
31
  try {
31
- const e = h(s, r);
32
+ const e = w(s, i);
32
33
  if (e)
33
34
  if (f)
34
- c = [...c, ...e];
35
+ for (let t = 0; t < r.length; t++)
36
+ c[t] = c[t] ?? e.shift();
35
37
  else
36
38
  for (let t = 0; t < s.length; t++)
37
39
  c[s[t].name] = e[t];
38
40
  } catch (e) {
39
41
  if (m)
40
- throw e instanceof x || e instanceof T ? new u({
41
- abiItem: o,
42
- data: r,
42
+ throw e instanceof I || e instanceof z ? new l({
43
+ abiItem: n,
44
+ data: i,
43
45
  params: s,
44
- size: I(r)
46
+ size: S(i)
45
47
  }) : e;
46
48
  }
47
49
  else if (m)
48
- throw new u({
49
- abiItem: o,
50
+ throw new l({
51
+ abiItem: n,
50
52
  data: "0x",
51
53
  params: s,
52
54
  size: 0
53
55
  });
54
56
  }
55
57
  return {
56
- eventName: v,
58
+ eventName: y,
57
59
  args: Object.values(c).length > 0 ? c : void 0
58
60
  };
59
61
  }
60
- function L({ param: n, value: i }) {
61
- return n.type === "string" || n.type === "bytes" || n.type === "tuple" || n.type.match(/^(.*)\[(\d+)?\]$/) ? i : (h([n], i) || [])[0];
62
+ function O({ param: o, value: d }) {
63
+ return o.type === "string" || o.type === "bytes" || o.type === "tuple" || o.type.match(/^(.*)\[(\d+)?\]$/) ? d : (w([o], d) || [])[0];
62
64
  }
63
65
  export {
64
- F as decodeEventLog
66
+ U as decodeEventLog
65
67
  };
package/dist/index189.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index190.cjs"),s=require("./index191.cjs");async function o({hash:e,signature:r}){return c.publicKeyToAddress(await s.recoverPublicKey({hash:e,signature:r}))}exports.recoverAddress=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index190.cjs"),o=require("./index191.cjs");async function s({hash:e,signature:r}){return c.publicKeyToAddress(await o.recoverPublicKey({hash:e,signature:r}))}exports.recoverAddress=s;
package/dist/index189.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { publicKeyToAddress as o } from "./index190.js";
2
2
  import { recoverPublicKey as c } from "./index191.js";
3
- async function t({ hash: r, signature: e }) {
3
+ async function s({ hash: r, signature: e }) {
4
4
  return o(await c({ hash: r, signature: e }));
5
5
  }
6
6
  export {
7
- t as recoverAddress
7
+ s as recoverAddress
8
8
  };
package/dist/index191.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index185.cjs"),t=require("./index182.cjs"),n=require("./index150.cjs");async function d({hash:e,signature:r}){const u=i.isHex(e)?e:n.toHex(e),{secp256k1:o}=await Promise.resolve().then(()=>require("./index192.cjs"));return`0x${(()=>{if(typeof r=="object"&&"r"in r&&"s"in r){const{r:l,s:v,v:b,yParity:f}=r,H=Number(f??b),a=s(H);return new o.Signature(t.hexToBigInt(l),t.hexToBigInt(v)).addRecoveryBit(a)}const c=i.isHex(r)?r:n.toHex(r),x=t.hexToNumber(`0x${c.slice(130)}`),y=s(x);return o.Signature.fromCompact(c.substring(2,130)).addRecoveryBit(y)})().recoverPublicKey(u.substring(2)).toHex(!1)}`}function s(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}exports.recoverPublicKey=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./index185.cjs"),d=require("./index124.cjs"),o=require("./index182.cjs"),c=require("./index150.cjs");async function g({hash:e,signature:r}){const u=n.isHex(e)?e:c.toHex(e),{secp256k1:i}=await Promise.resolve().then(()=>require("./index192.cjs"));return`0x${(()=>{if(typeof r=="object"&&"r"in r&&"s"in r){const{r:v,s:y,v:b,yParity:f}=r,a=Number(f??b),H=s(a);return new i.Signature(o.hexToBigInt(v),o.hexToBigInt(y)).addRecoveryBit(H)}const t=n.isHex(r)?r:c.toHex(r);if(d.size(t)!==65)throw new Error("invalid signature length");const l=o.hexToNumber(`0x${t.slice(130)}`),x=s(l);return i.Signature.fromCompact(t.substring(2,130)).addRecoveryBit(x)})().recoverPublicKey(u.substring(2)).toHex(!1)}`}function s(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}exports.recoverPublicKey=g;