@gardenfi/core 0.2.0-beta.71 → 0.2.0-beta.72

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +14 -15
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +41 -55
  5. package/dist/index11.cjs +1 -1
  6. package/dist/index11.js +2 -2
  7. package/dist/index14.cjs +1 -1
  8. package/dist/index14.js +2 -2
  9. package/dist/index16.cjs +1 -1
  10. package/dist/index16.js +136 -30
  11. package/dist/index17.cjs +1 -1
  12. package/dist/index17.js +2 -25
  13. package/dist/index18.cjs +3 -1
  14. package/dist/index18.js +26 -29
  15. package/dist/index19.cjs +1 -1
  16. package/dist/index19.js +17 -32
  17. package/dist/index20.cjs +2 -1
  18. package/dist/index20.js +25 -53
  19. package/dist/index21.cjs +1 -1
  20. package/dist/index21.js +39 -26
  21. package/dist/index22.cjs +1 -1
  22. package/dist/index22.js +199 -15
  23. package/dist/index23.cjs +1 -1
  24. package/dist/index23.js +2 -9
  25. package/dist/index24.cjs +1 -1
  26. package/dist/index24.js +2 -9
  27. package/dist/index25.cjs +1 -1
  28. package/dist/index25.js +2 -138
  29. package/dist/index26.cjs +1 -1
  30. package/dist/index26.js +28 -2
  31. package/dist/index27.cjs +1 -1
  32. package/dist/index27.js +14 -12
  33. package/dist/index28.cjs +1 -1
  34. package/dist/index28.js +174 -36
  35. package/dist/index29.cjs +1 -1
  36. package/dist/index29.js +21 -41
  37. package/dist/index30.cjs +1 -1
  38. package/dist/index30.js +2 -24
  39. package/dist/index31.cjs +1 -1
  40. package/dist/index31.js +34 -25
  41. package/dist/index32.cjs +1 -1
  42. package/dist/index32.js +8 -54
  43. package/dist/index33.cjs +1 -1
  44. package/dist/index33.js +2 -28
  45. package/dist/index34.cjs +6 -3
  46. package/dist/index34.js +949 -30
  47. package/dist/index35.cjs +1 -1
  48. package/dist/index35.js +4 -17
  49. package/dist/index36.cjs +1 -2
  50. package/dist/index36.js +18 -23
  51. package/dist/index37.cjs +1 -1
  52. package/dist/index37.js +29 -38
  53. package/dist/index38.cjs +1 -1
  54. package/dist/index38.js +60 -197
  55. package/dist/index39.cjs +1 -1
  56. package/dist/index39.js +33 -2
  57. package/dist/index40.cjs +1 -1
  58. package/dist/index40.js +87 -2
  59. package/dist/index41.cjs +1 -1
  60. package/dist/index41.js +49 -2
  61. package/dist/index42.cjs +1 -1
  62. package/dist/index42.js +25 -12
  63. package/dist/index43.cjs +1 -1
  64. package/dist/index43.js +2 -12
  65. package/dist/index44.cjs +1 -1
  66. package/dist/index44.js +2 -4
  67. package/dist/index45.cjs +1 -1
  68. package/dist/index45.js +19 -45
  69. package/dist/index46.cjs +1 -1
  70. package/dist/index46.js +30 -38
  71. package/dist/index47.cjs +1 -1
  72. package/dist/index47.js +360 -165
  73. package/dist/index48.cjs +1 -1
  74. package/dist/index48.js +21 -13
  75. package/dist/index49.cjs +1 -1
  76. package/dist/index49.js +54 -3
  77. package/dist/index50.cjs +1 -1
  78. package/dist/index50.js +3 -17
  79. package/dist/index51.cjs +1 -1
  80. package/dist/index51.js +70 -9
  81. package/dist/index52.cjs +1 -1
  82. package/dist/index52.js +2 -175
  83. package/dist/index53.cjs +1 -1
  84. package/dist/index53.js +57 -21
  85. package/dist/index54.js +2 -2
  86. package/dist/index55.cjs +1 -1
  87. package/dist/index55.js +39 -34
  88. package/dist/index56.cjs +1 -1
  89. package/dist/index56.js +43 -9
  90. package/dist/index57.cjs +1 -1
  91. package/dist/index57.js +17 -34
  92. package/dist/index58.cjs +1 -1
  93. package/dist/index58.js +103 -50
  94. package/dist/index59.cjs +1 -2
  95. package/dist/index59.js +19 -58
  96. package/dist/index60.cjs +1 -1
  97. package/dist/index60.js +225 -3
  98. package/dist/index61.cjs +1 -1
  99. package/dist/index61.js +4 -128
  100. package/dist/index62.cjs +1 -2
  101. package/dist/index62.js +152 -37
  102. package/dist/index63.cjs +1 -1
  103. package/dist/index63.js +2 -9
  104. package/dist/index64.cjs +1 -1
  105. package/dist/index64.js +13 -11
  106. package/dist/index65.cjs +1 -1
  107. package/dist/index65.js +2 -12
  108. package/dist/index66.cjs +1 -1
  109. package/dist/index66.js +32 -13
  110. package/dist/index67.cjs +1 -1
  111. package/dist/index67.js +2 -7
  112. package/dist/index68.cjs +1 -1
  113. package/dist/index68.js +355 -17
  114. package/dist/index69.cjs +1 -1
  115. package/dist/index69.js +235 -75
  116. package/dist/index70.cjs +1 -1
  117. package/dist/index70.js +67 -14
  118. package/dist/index71.cjs +1 -1
  119. package/dist/index71.js +60 -17
  120. package/dist/index72.cjs +1 -1
  121. package/dist/index72.js +11 -21
  122. package/dist/index73.cjs +1 -1
  123. package/dist/index73.js +44 -13
  124. package/dist/index74.cjs +1 -1
  125. package/dist/index74.js +63 -2
  126. package/dist/index75.cjs +1 -1
  127. package/dist/index75.js +226 -2
  128. package/dist/index76.cjs +1 -1
  129. package/dist/index76.js +3 -7
  130. package/dist/index77.cjs +1 -2
  131. package/dist/index77.js +166 -32
  132. package/dist/index78.cjs +1 -1
  133. package/dist/index78.js +27 -5
  134. package/dist/index79.cjs +1 -1
  135. package/dist/index79.js +19 -18
  136. package/dist/index80.cjs +1 -1
  137. package/dist/index80.js +68 -30
  138. package/dist/index81.cjs +1 -1
  139. package/dist/index81.js +128 -2
  140. package/dist/index82.cjs +1 -6
  141. package/dist/index82.js +9 -949
  142. package/dist/index83.cjs +1 -1
  143. package/dist/index84.cjs +1 -1
  144. package/dist/index84.js +25 -61
  145. package/dist/index85.cjs +1 -1
  146. package/dist/index85.js +2 -33
  147. package/dist/src/index.d.ts +1 -1
  148. package/dist/src/lib/utils.d.ts +1 -3
  149. package/package.json +2 -2
  150. package/dist/index100.cjs +0 -1
  151. package/dist/index100.js +0 -37
  152. package/dist/index101.cjs +0 -1
  153. package/dist/index101.js +0 -369
  154. package/dist/index102.cjs +0 -1
  155. package/dist/index102.js +0 -23
  156. package/dist/index103.cjs +0 -1
  157. package/dist/index103.js +0 -58
  158. package/dist/index104.cjs +0 -1
  159. package/dist/index104.js +0 -5
  160. package/dist/index105.cjs +0 -1
  161. package/dist/index105.js +0 -51
  162. package/dist/index106.cjs +0 -1
  163. package/dist/index106.js +0 -28
  164. package/dist/index107.cjs +0 -1
  165. package/dist/index107.js +0 -4
  166. package/dist/index108.cjs +0 -1
  167. package/dist/index108.js +0 -4
  168. package/dist/index109.cjs +0 -1
  169. package/dist/index109.js +0 -64
  170. package/dist/index110.cjs +0 -1
  171. package/dist/index110.js +0 -37
  172. package/dist/index111.cjs +0 -1
  173. package/dist/index111.js +0 -4
  174. package/dist/index112.cjs +0 -1
  175. package/dist/index112.js +0 -60
  176. package/dist/index113.cjs +0 -1
  177. package/dist/index113.js +0 -4
  178. package/dist/index114.cjs +0 -1
  179. package/dist/index114.js +0 -42
  180. package/dist/index115.cjs +0 -1
  181. package/dist/index115.js +0 -45
  182. package/dist/index116.cjs +0 -1
  183. package/dist/index116.js +0 -20
  184. package/dist/index117.cjs +0 -1
  185. package/dist/index117.js +0 -111
  186. package/dist/index118.cjs +0 -1
  187. package/dist/index118.js +0 -23
  188. package/dist/index119.cjs +0 -1
  189. package/dist/index119.js +0 -228
  190. package/dist/index120.cjs +0 -1
  191. package/dist/index120.js +0 -6
  192. package/dist/index121.cjs +0 -1
  193. package/dist/index121.js +0 -160
  194. package/dist/index122.cjs +0 -1
  195. package/dist/index122.js +0 -4
  196. package/dist/index123.cjs +0 -1
  197. package/dist/index123.js +0 -75
  198. package/dist/index124.cjs +0 -1
  199. package/dist/index124.js +0 -7
  200. package/dist/index125.cjs +0 -1
  201. package/dist/index125.js +0 -107
  202. package/dist/index126.cjs +0 -1
  203. package/dist/index126.js +0 -15
  204. package/dist/index127.cjs +0 -1
  205. package/dist/index127.js +0 -35
  206. package/dist/index128.cjs +0 -1
  207. package/dist/index128.js +0 -32
  208. package/dist/index129.cjs +0 -1
  209. package/dist/index129.js +0 -4
  210. package/dist/index130.cjs +0 -1
  211. package/dist/index130.js +0 -21
  212. package/dist/index131.cjs +0 -1
  213. package/dist/index131.js +0 -4
  214. package/dist/index132.cjs +0 -1
  215. package/dist/index132.js +0 -358
  216. package/dist/index133.cjs +0 -1
  217. package/dist/index133.js +0 -241
  218. package/dist/index134.cjs +0 -1
  219. package/dist/index134.js +0 -70
  220. package/dist/index135.cjs +0 -1
  221. package/dist/index135.js +0 -64
  222. package/dist/index136.cjs +0 -1
  223. package/dist/index136.js +0 -14
  224. package/dist/index137.cjs +0 -1
  225. package/dist/index137.js +0 -47
  226. package/dist/index138.cjs +0 -1
  227. package/dist/index138.js +0 -65
  228. package/dist/index139.cjs +0 -1
  229. package/dist/index139.js +0 -228
  230. package/dist/index140.cjs +0 -1
  231. package/dist/index140.js +0 -5
  232. package/dist/index141.cjs +0 -1
  233. package/dist/index141.js +0 -171
  234. package/dist/index142.cjs +0 -1
  235. package/dist/index142.js +0 -30
  236. package/dist/index143.cjs +0 -1
  237. package/dist/index143.js +0 -23
  238. package/dist/index144.cjs +0 -1
  239. package/dist/index144.js +0 -72
  240. package/dist/index145.cjs +0 -1
  241. package/dist/index145.js +0 -130
  242. package/dist/index146.cjs +0 -1
  243. package/dist/index146.js +0 -9
  244. package/dist/index147.cjs +0 -1
  245. package/dist/index147.js +0 -4
  246. package/dist/index148.cjs +0 -1
  247. package/dist/index148.js +0 -28
  248. package/dist/index149.cjs +0 -1
  249. package/dist/index149.js +0 -4
  250. package/dist/index86.cjs +0 -1
  251. package/dist/index86.js +0 -89
  252. package/dist/index87.cjs +0 -1
  253. package/dist/index87.js +0 -15
  254. package/dist/index88.cjs +0 -1
  255. package/dist/index88.js +0 -9
  256. package/dist/index89.cjs +0 -1
  257. package/dist/index89.js +0 -115
  258. package/dist/index90.cjs +0 -1
  259. package/dist/index90.js +0 -9
  260. package/dist/index91.cjs +0 -1
  261. package/dist/index91.js +0 -35
  262. package/dist/index92.cjs +0 -1
  263. package/dist/index92.js +0 -4
  264. package/dist/index93.cjs +0 -1
  265. package/dist/index93.js +0 -40
  266. package/dist/index94.cjs +0 -1
  267. package/dist/index94.js +0 -31
  268. package/dist/index95.cjs +0 -1
  269. package/dist/index95.js +0 -23
  270. package/dist/index96.cjs +0 -1
  271. package/dist/index96.js +0 -9
  272. package/dist/index97.cjs +0 -1
  273. package/dist/index97.js +0 -7
  274. package/dist/index98.cjs +0 -1
  275. package/dist/index98.js +0 -13
  276. package/dist/index99.cjs +0 -1
  277. package/dist/index99.js +0 -22
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index2.cjs"),t=require("./index3.cjs"),i=require("./index4.cjs"),o=require("./index5.cjs"),a=require("./index6.cjs"),e=require("./index7.cjs"),c=require("./index8.cjs"),u=require("./index9.cjs"),r=require("./index10.cjs");exports.Garden=s.Garden;exports.OrderActions=t.OrderActions;exports.TimeLocks=t.TimeLocks;exports.BlockNumberFetcher=i.BlockNumberFetcher;exports.EvmRelay=o.EvmRelay;exports.OrderStatus=a.OrderStatus;exports.SwapStatus=a.SwapStatus;exports.ParseOrderStatus=e.ParseOrderStatus;exports.ParseSwapStatus=e.ParseSwapStatus;exports.filterDeadlineExpiredOrders=e.filterDeadlineExpiredOrders;exports.isExpired=e.isExpired;exports.parseAction=e.parseAction;exports.parseActionFromStatus=e.parseActionFromStatus;exports.SecretManager=c.SecretManager;exports.Quote=u.Quote;exports.constructOrderPair=r.constructOrderPair;exports.evmToViemChainMap=r.evmToViemChainMap;exports.switchOrAddNetwork=r.switchOrAddNetwork;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index2.cjs"),r=require("./index3.cjs"),i=require("./index4.cjs"),o=require("./index5.cjs"),t=require("./index6.cjs"),e=require("./index7.cjs"),c=require("./index8.cjs"),u=require("./index9.cjs"),s=require("./index10.cjs");exports.Garden=a.Garden;exports.OrderActions=r.OrderActions;exports.TimeLocks=r.TimeLocks;exports.BlockNumberFetcher=i.BlockNumberFetcher;exports.EvmRelay=o.EvmRelay;exports.OrderStatus=t.OrderStatus;exports.SwapStatus=t.SwapStatus;exports.ParseOrderStatus=e.ParseOrderStatus;exports.ParseSwapStatus=e.ParseSwapStatus;exports.filterDeadlineExpiredOrders=e.filterDeadlineExpiredOrders;exports.isExpired=e.isExpired;exports.parseAction=e.parseAction;exports.parseActionFromStatus=e.parseActionFromStatus;exports.SecretManager=c.SecretManager;exports.Quote=u.Quote;exports.constructOrderPair=s.constructOrderPair;exports.switchOrAddNetwork=s.switchOrAddNetwork;
package/dist/index.js CHANGED
@@ -1,29 +1,28 @@
1
1
  import { Garden as t } from "./index2.js";
2
2
  import { OrderActions as a, TimeLocks as p } from "./index3.js";
3
- import { BlockNumberFetcher as s } from "./index4.js";
4
- import { EvmRelay as d } from "./index5.js";
3
+ import { BlockNumberFetcher as m } from "./index4.js";
4
+ import { EvmRelay as i } from "./index5.js";
5
5
  import { OrderStatus as c, SwapStatus as f } from "./index6.js";
6
- import { ParseOrderStatus as u, ParseSwapStatus as S, filterDeadlineExpiredOrders as O, isExpired as l, parseAction as w, parseActionFromStatus as A } from "./index7.js";
7
- import { SecretManager as k } from "./index8.js";
8
- import { Quote as P } from "./index9.js";
9
- import { constructOrderPair as F, evmToViemChainMap as M, switchOrAddNetwork as N } from "./index10.js";
6
+ import { ParseOrderStatus as S, ParseSwapStatus as n, filterDeadlineExpiredOrders as O, isExpired as l, parseAction as w, parseActionFromStatus as A } from "./index7.js";
7
+ import { SecretManager as E } from "./index8.js";
8
+ import { Quote as h } from "./index9.js";
9
+ import { constructOrderPair as N, switchOrAddNetwork as b } from "./index10.js";
10
10
  export {
11
- s as BlockNumberFetcher,
12
- d as EvmRelay,
11
+ m as BlockNumberFetcher,
12
+ i as EvmRelay,
13
13
  t as Garden,
14
14
  a as OrderActions,
15
15
  c as OrderStatus,
16
- u as ParseOrderStatus,
17
- S as ParseSwapStatus,
18
- P as Quote,
19
- k as SecretManager,
16
+ S as ParseOrderStatus,
17
+ n as ParseSwapStatus,
18
+ h as Quote,
19
+ E as SecretManager,
20
20
  f as SwapStatus,
21
21
  p as TimeLocks,
22
- F as constructOrderPair,
23
- M as evmToViemChainMap,
22
+ N as constructOrderPair,
24
23
  O as filterDeadlineExpiredOrders,
25
24
  l as isExpired,
26
25
  w as parseAction,
27
26
  A as parseActionFromStatus,
28
- N as switchOrAddNetwork
27
+ b as switchOrAddNetwork
29
28
  };
package/dist/index10.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@gardenfi/utils");const s=require("@gardenfi/orderbook"),o=require("viem"),h=require("varuint-bitcoin"),i=require("@catalogfi/utils"),m=require("tiny-secp256k1"),p=require("./index16.cjs"),w=require("./index17.cjs"),b=require("./index18.cjs"),g=require("./index19.cjs"),O=require("./index20.cjs");function l(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const u=l(h),y=l(m);function S(e){return typeof e=="string"&&(e=Buffer.from(e,"hex")),e.length===32?e:e.subarray(1,33)}function q(e,t){if(!e)throw new Error(t)}function _(e){return Buffer.concat([Uint8Array.from([192]),d(e)])}function d(e){const t=u.encodingLength(e.length),r=Buffer.allocUnsafe(t);return u.encode(e.length,r),Buffer.concat([r,e])}function v(e,t){if(e.compare(t)>0){const r=e;e=t,t=r}return[e,t]}const L=e=>e.length===64?e:e.slice(2),P=e=>{if(!e)return!1;try{const t=Buffer.from(e,"hex");return y.isPoint(t)}catch{return!1}},f={ethereum:p.mainnet,ethereum_arbitrum:w.arbitrum,ethereum_sepolia:b.sepolia,arbitrum_sepolia:g.arbitrumSepolia,ethereum_localnet:s.EthereumLocalnet,arbitrum_localnet:s.ArbitrumLocalnet,base_sepolia:O.baseSepolia},C=async(e,t)=>{var n;const r=f[e];if(r)try{if(r.id===((n=t.chain)==null?void 0:n.id))return i.Ok({message:"Already on the network",walletClient:t});await t.switchChain({id:r.id});const c=o.createWalletClient({account:t.account,chain:r,transport:o.custom(window.ethereum)});return i.Ok({message:"Switched chain",walletClient:c})}catch(c){if(k(c))try{await t.addChain({chain:r});const a=o.createWalletClient({account:t.account,chain:r,transport:o.custom(window.ethereum)});return i.Ok({message:"Added network",walletClient:a})}catch{return i.Err("Failed to add network")}else return i.Err("Failed to switch network")}else return i.Err("Chain not supported")},k=e=>typeof e=="object"&&e!==null&&"code"in e&&e.code===4902,B=(e,t,r,n)=>e+":"+t.toLowerCase()+"::"+r+":"+n.toLowerCase();exports.assert=q;exports.constructOrderPair=B;exports.evmToViemChainMap=f;exports.isValidBitcoinPubKey=P;exports.prefixScriptLength=d;exports.serializeScript=_;exports.sortLeaves=v;exports.switchOrAddNetwork=C;exports.toXOnly=L;exports.xOnlyPubkey=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("@gardenfi/utils");const f=require("@gardenfi/orderbook"),c=require("viem"),l=require("varuint-bitcoin"),o=require("@catalogfi/utils"),h=require("tiny-secp256k1");function u(t){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const r in t)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(e,r,n.get?n:{enumerable:!0,get:()=>t[r]})}}return e.default=t,Object.freeze(e)}const s=u(l),m=u(h);function w(t){return typeof t=="string"&&(t=Buffer.from(t,"hex")),t.length===32?t:t.subarray(1,33)}function g(t,e){if(!t)throw new Error(e)}function O(t){return Buffer.concat([Uint8Array.from([192]),d(t)])}function d(t){const e=s.encodingLength(t.length),r=Buffer.allocUnsafe(e);return s.encode(t.length,r),Buffer.concat([r,t])}function p(t,e){if(t.compare(e)>0){const r=t;t=e,e=r}return[t,e]}const y=t=>t.length===64?t:t.slice(2),P=t=>{if(!t)return!1;try{const e=Buffer.from(t,"hex");return m.isPoint(e)}catch{return!1}},b=async(t,e)=>{var n;const r=f.evmToViemChainMap[t];if(r)try{if(r.id===((n=e.chain)==null?void 0:n.id))return o.Ok({message:"Already on the network",walletClient:e});await e.switchChain({id:r.id});const i=c.createWalletClient({account:e.account,chain:r,transport:c.custom(window.ethereum)});return o.Ok({message:"Switched chain",walletClient:i})}catch(i){if(v(i))try{await e.addChain({chain:r});const a=c.createWalletClient({account:e.account,chain:r,transport:c.custom(window.ethereum)});return o.Ok({message:"Added network",walletClient:a})}catch{return o.Err("Failed to add network")}else return o.Err("Failed to switch network")}else return o.Err("Chain not supported")},v=t=>typeof t=="object"&&t!==null&&"code"in t&&t.code===4902,S=(t,e,r,n)=>t+":"+e.toLowerCase()+"::"+r+":"+n.toLowerCase();exports.assert=g;exports.constructOrderPair=S;exports.isValidBitcoinPubKey=P;exports.prefixScriptLength=d;exports.serializeScript=O;exports.sortLeaves=p;exports.switchOrAddNetwork=b;exports.toXOnly=y;exports.xOnlyPubkey=w;
package/dist/index10.js CHANGED
@@ -1,38 +1,33 @@
1
1
  import "@gardenfi/utils";
2
- import { EthereumLocalnet as f, ArbitrumLocalnet as h } from "@gardenfi/orderbook";
3
- import { createWalletClient as s, custom as m } from "viem";
2
+ import { evmToViemChainMap as h } from "@gardenfi/orderbook";
3
+ import { createWalletClient as s, custom as f } from "viem";
4
4
  import * as u from "varuint-bitcoin";
5
- import { Ok as i, Err as a } from "@catalogfi/utils";
5
+ import { Ok as i, Err as c } from "@catalogfi/utils";
6
6
  import * as d from "tiny-secp256k1";
7
- import { mainnet as l } from "./index16.js";
8
- import { arbitrum as p } from "./index17.js";
9
- import { sepolia as w } from "./index18.js";
10
- import { arbitrumSepolia as g } from "./index19.js";
11
- import { baseSepolia as L } from "./index20.js";
12
- function F(t) {
7
+ function C(t) {
13
8
  return typeof t == "string" && (t = Buffer.from(t, "hex")), t.length === 32 ? t : t.subarray(1, 33);
14
9
  }
15
- function W(t, r) {
10
+ function y(t, r) {
16
11
  if (!t) throw new Error(r);
17
12
  }
18
- function k(t) {
13
+ function L(t) {
19
14
  return Buffer.concat([
20
15
  Uint8Array.from([192]),
21
- B(t)
16
+ m(t)
22
17
  ]);
23
18
  }
24
- function B(t) {
25
- const r = u.encodingLength(t.length), e = Buffer.allocUnsafe(r);
26
- return u.encode(t.length, e), Buffer.concat([e, t]);
19
+ function m(t) {
20
+ const r = u.encodingLength(t.length), n = Buffer.allocUnsafe(r);
21
+ return u.encode(t.length, n), Buffer.concat([n, t]);
27
22
  }
28
- function N(t, r) {
23
+ function x(t, r) {
29
24
  if (t.compare(r) > 0) {
30
- const e = t;
31
- t = r, r = e;
25
+ const n = t;
26
+ t = r, r = n;
32
27
  }
33
28
  return [t, r];
34
29
  }
35
- const U = (t) => t.length === 64 ? t : t.slice(2), V = (t) => {
30
+ const O = (t) => t.length === 64 ? t : t.slice(2), v = (t) => {
36
31
  if (!t) return !1;
37
32
  try {
38
33
  const r = Buffer.from(t, "hex");
@@ -40,62 +35,53 @@ const U = (t) => t.length === 64 ? t : t.slice(2), V = (t) => {
40
35
  } catch {
41
36
  return !1;
42
37
  }
43
- }, C = {
44
- ethereum: l,
45
- ethereum_arbitrum: p,
46
- ethereum_sepolia: w,
47
- arbitrum_sepolia: g,
48
- ethereum_localnet: f,
49
- arbitrum_localnet: h,
50
- base_sepolia: L
51
- }, j = async (t, r) => {
52
- var n;
53
- const e = C[t];
54
- if (e)
38
+ }, A = async (t, r) => {
39
+ var e;
40
+ const n = h[t];
41
+ if (n)
55
42
  try {
56
- if (e.id === ((n = r.chain) == null ? void 0 : n.id))
43
+ if (n.id === ((e = r.chain) == null ? void 0 : e.id))
57
44
  return i({ message: "Already on the network", walletClient: r });
58
- await r.switchChain({ id: e.id });
45
+ await r.switchChain({ id: n.id });
59
46
  const o = s({
60
47
  account: r.account,
61
- chain: e,
62
- transport: m(window.ethereum)
48
+ chain: n,
49
+ transport: f(window.ethereum)
63
50
  });
64
51
  return i({
65
52
  message: "Switched chain",
66
53
  walletClient: o
67
54
  });
68
55
  } catch (o) {
69
- if (b(o))
56
+ if (w(o))
70
57
  try {
71
- await r.addChain({ chain: e });
72
- const c = s({
58
+ await r.addChain({ chain: n });
59
+ const a = s({
73
60
  account: r.account,
74
- chain: e,
75
- transport: m(window.ethereum)
61
+ chain: n,
62
+ transport: f(window.ethereum)
76
63
  });
77
64
  return i({
78
65
  message: "Added network",
79
- walletClient: c
66
+ walletClient: a
80
67
  });
81
68
  } catch {
82
- return a("Failed to add network");
69
+ return c("Failed to add network");
83
70
  }
84
71
  else
85
- return a("Failed to switch network");
72
+ return c("Failed to switch network");
86
73
  }
87
74
  else
88
- return a("Chain not supported");
89
- }, b = (t) => typeof t == "object" && t !== null && "code" in t && t.code === 4902, z = (t, r, e, n) => t + ":" + r.toLowerCase() + "::" + e + ":" + n.toLowerCase();
75
+ return c("Chain not supported");
76
+ }, w = (t) => typeof t == "object" && t !== null && "code" in t && t.code === 4902, E = (t, r, n, e) => t + ":" + r.toLowerCase() + "::" + n + ":" + e.toLowerCase();
90
77
  export {
91
- W as assert,
92
- z as constructOrderPair,
93
- C as evmToViemChainMap,
94
- V as isValidBitcoinPubKey,
95
- B as prefixScriptLength,
96
- k as serializeScript,
97
- N as sortLeaves,
98
- j as switchOrAddNetwork,
99
- U as toXOnly,
100
- F as xOnlyPubkey
78
+ y as assert,
79
+ E as constructOrderPair,
80
+ v as isValidBitcoinPubKey,
81
+ m as prefixScriptLength,
82
+ L as serializeScript,
83
+ x as sortLeaves,
84
+ A as switchOrAddNetwork,
85
+ O as toXOnly,
86
+ C as xOnlyPubkey
101
87
  };
package/dist/index11.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("@catalogfi/wallets"),H=require("bitcoinjs-lib"),O=require("tiny-secp256k1"),P=require("./index21.cjs"),f=require("./index10.cjs"),u=require("./index22.cjs");function S(p){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const r in p)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(p,r);Object.defineProperty(e,r,t.get?t:{enumerable:!0,get:()=>p[r]})}}return e.default=p,Object.freeze(e)}const h=S(H),k=S(O),m=192;h.initEccLib(k);class v{constructor(e,r,t,s,i,a,d,o){this.secretHash=t,this.redeemerPubkey=s,this.initiatorPubkey=i,this.expiry=a,this.signer=e,this.network=d,this.internalPubkey=P.generateInternalkey(),this.initiateAmount=r,this.utxoHashes=o}static async from(e,r,t,s,i,a,d){t=t.startsWith("0x")?t.slice(2):t,f.assert(t.length===64,u.htlcErrors.secretHashLenMismatch),f.assert(s.length===64||s.length===66,`initiator ${u.htlcErrors.pubkeyLenMismatch}`),f.assert(i.length===64||i.length===66,`redeemer ${u.htlcErrors.pubkeyLenMismatch}`),f.assert(a>0,u.htlcErrors.zeroOrNegativeExpiry);const o=await e.getNetwork();return new v(e,r,t,f.xOnlyPubkey(i).toString("hex"),f.xOnlyPubkey(s).toString("hex"),a,o,d)}address(){const{address:e}=h.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves()});if(!e)throw new Error(u.htlcErrors.htlcAddressGenerationFailed);return e}id(){return this.address()}async _buildRawTx(e,r){const t=new h.Transaction;t.version=2;const s=this.address(),i=await this.signer.getProvider();let a=[];if(this.utxoHashes&&this.utxoHashes.length>0)for(const o of this.utxoHashes){const l=await i.getTransaction(o);for(let g=0;g<l.vout.length;g++){const n=l.vout[g];n.scriptpubkey_address===s&&a.push({txid:l.txid,vout:g,value:n.value,status:{confirmed:!1}})}}else a=await i.getUTXOs(s);const d=a.reduce((o,l)=>o+l.value,0);if(d===0)throw new Error(`${s} ${u.htlcErrors.notFunded}`);for(let o=0;o<a.length;o++)t.addInput(Buffer.from(a[o].txid,"hex").reverse(),a[o].vout);return r??(r=await i.suggestFee(s,d,b.Urgency.MEDIUM)),t.addOutput(h.address.toOutputScript(e,this.network),d-r),{tx:t,usedUtxos:a}}async buildRawTx(e){return await this._buildRawTx(await this.signer.getAddress(),e)}getOutputScript(){return h.address.toOutputScript(this.address(),this.network)}async init(e){return e??(e=await(await this.signer.getProvider()).suggestFee(await this.signer.getAddress(),this.initiateAmount,b.Urgency.MEDIUM)),await this.signer.send(this.address(),this.initiateAmount,e)}async instantRefund(e,r){f.assert(e.length>0,u.htlcErrors.noCounterpartySigs);const{tx:t,usedUtxos:s}=await this.buildRawTx(r);for(const n of s)if(!e.find(c=>c.utxo===n.txid))throw new Error(u.htlcErrors.counterPartySigNotFound(n.txid));const i=this.getOutputScript(),a=h.Transaction.SIGHASH_DEFAULT,d=this.leafHash(2),o=s.map(n=>n.value),l=y(i,s.length);for(let n=0;n<t.ins.length;n++){const c=t.hashForWitnessV1(n,l,o,a,d);if(!k.verifySchnorr(c,Buffer.from(this.redeemerPubkey,"hex"),Buffer.from(e[n].sig,"hex")))throw new Error(u.htlcErrors.invalidCounterpartySigForUTXO(e[n].utxo));const w=await this.signer.signSchnorr(c),x=Buffer.from(t.ins[n].hash).reverse().toString("hex"),E=e.find(L=>L.utxo===x);if(!E)throw new Error(u.htlcErrors.counterPartySigNotFound(x));t.setWitness(n,[Buffer.from(E.sig,"hex"),w,this.instantRefundLeaf(),this.generateControlBlockFor(2)])}return await(await this.signer.getProvider()).broadcast(t.toHex())}async redeem(e,r,t){f.assert(h.crypto.sha256(Buffer.from(e,"hex")).toString("hex")===this.secretHash,u.htlcErrors.secretMismatch);const{tx:s,usedUtxos:i}=await this._buildRawTx(r??await this.signer.getAddress(),t),a=this.leafHash(1),d=i.map(n=>n.value),o=y(this.getOutputScript(),i.length),l=h.Transaction.SIGHASH_DEFAULT;for(let n=0;n<s.ins.length;n++){const c=s.hashForWitnessV1(n,o,d,l,a),w=await this.signer.signSchnorr(c);s.setWitness(n,[w,Buffer.from(e,"hex"),this.redeemLeaf(),this.generateControlBlockFor(1)])}return await(await this.signer.getProvider()).broadcast(s.toHex())}async refund(e,r){const{tx:t,usedUtxos:s}=await this._buildRawTx(e??await this.signer.getAddress(),r),[i,a]=await this.canRefund(s);if(!i)throw new Error(u.htlcErrors.htlcNotExpired(a));const d=this.leafHash(0),o=s.map(c=>c.value),l=y(this.getOutputScript(),s.length),g=h.Transaction.SIGHASH_DEFAULT;for(let c=0;c<t.ins.length;c++){t.ins[c].sequence=this.expiry;const w=t.hashForWitnessV1(c,l,o,g,d),x=await this.signer.signSchnorr(w);t.setWitness(c,[x,this.refundLeaf(),this.generateControlBlockFor(0)])}return await(await this.signer.getProvider()).broadcast(t.toHex())}async canRefund(e){const t=await(await this.signer.getProvider()).getLatestTip();for(const s of e){let i=0;if(s.status.confirmed&&s.status.block_height+this.expiry>t?i=s.status.block_height+this.expiry-t+1:s.status.confirmed||(i=this.expiry+1),i>0)return[!1,i]}return[!0,0]}generateControlBlockFor(e){let r;switch(e){case 1:r=this.redeemLeaf();break;case 0:r=this.refundLeaf();break;case 2:r=this.instantRefundLeaf();break;default:throw new Error(u.htlcErrors.invalidLeaf)}const t=h.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves(),redeem:{output:r,redeemVersion:m}});if(!t.witness)throw new Error(u.htlcErrors.controlBlockGenerationFailed);return t.witness[t.witness.length-1]}leafHash(e){let r=this.redeemLeaf();return e===0&&(r=this.refundLeaf()),e===2&&(r=this.instantRefundLeaf()),h.crypto.taggedHash("TapLeaf",f.serializeScript(r))}refundLeaf(){return h.script.fromASM(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("@catalogfi/wallets"),H=require("bitcoinjs-lib"),O=require("tiny-secp256k1"),P=require("./index26.cjs"),f=require("./index10.cjs"),u=require("./index27.cjs");function S(p){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(p){for(const r in p)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(p,r);Object.defineProperty(e,r,t.get?t:{enumerable:!0,get:()=>p[r]})}}return e.default=p,Object.freeze(e)}const h=S(H),k=S(O),m=192;h.initEccLib(k);class v{constructor(e,r,t,s,i,a,d,o){this.secretHash=t,this.redeemerPubkey=s,this.initiatorPubkey=i,this.expiry=a,this.signer=e,this.network=d,this.internalPubkey=P.generateInternalkey(),this.initiateAmount=r,this.utxoHashes=o}static async from(e,r,t,s,i,a,d){t=t.startsWith("0x")?t.slice(2):t,f.assert(t.length===64,u.htlcErrors.secretHashLenMismatch),f.assert(s.length===64||s.length===66,`initiator ${u.htlcErrors.pubkeyLenMismatch}`),f.assert(i.length===64||i.length===66,`redeemer ${u.htlcErrors.pubkeyLenMismatch}`),f.assert(a>0,u.htlcErrors.zeroOrNegativeExpiry);const o=await e.getNetwork();return new v(e,r,t,f.xOnlyPubkey(i).toString("hex"),f.xOnlyPubkey(s).toString("hex"),a,o,d)}address(){const{address:e}=h.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves()});if(!e)throw new Error(u.htlcErrors.htlcAddressGenerationFailed);return e}id(){return this.address()}async _buildRawTx(e,r){const t=new h.Transaction;t.version=2;const s=this.address(),i=await this.signer.getProvider();let a=[];if(this.utxoHashes&&this.utxoHashes.length>0)for(const o of this.utxoHashes){const l=await i.getTransaction(o);for(let g=0;g<l.vout.length;g++){const n=l.vout[g];n.scriptpubkey_address===s&&a.push({txid:l.txid,vout:g,value:n.value,status:{confirmed:!1}})}}else a=await i.getUTXOs(s);const d=a.reduce((o,l)=>o+l.value,0);if(d===0)throw new Error(`${s} ${u.htlcErrors.notFunded}`);for(let o=0;o<a.length;o++)t.addInput(Buffer.from(a[o].txid,"hex").reverse(),a[o].vout);return r??(r=await i.suggestFee(s,d,b.Urgency.MEDIUM)),t.addOutput(h.address.toOutputScript(e,this.network),d-r),{tx:t,usedUtxos:a}}async buildRawTx(e){return await this._buildRawTx(await this.signer.getAddress(),e)}getOutputScript(){return h.address.toOutputScript(this.address(),this.network)}async init(e){return e??(e=await(await this.signer.getProvider()).suggestFee(await this.signer.getAddress(),this.initiateAmount,b.Urgency.MEDIUM)),await this.signer.send(this.address(),this.initiateAmount,e)}async instantRefund(e,r){f.assert(e.length>0,u.htlcErrors.noCounterpartySigs);const{tx:t,usedUtxos:s}=await this.buildRawTx(r);for(const n of s)if(!e.find(c=>c.utxo===n.txid))throw new Error(u.htlcErrors.counterPartySigNotFound(n.txid));const i=this.getOutputScript(),a=h.Transaction.SIGHASH_DEFAULT,d=this.leafHash(2),o=s.map(n=>n.value),l=y(i,s.length);for(let n=0;n<t.ins.length;n++){const c=t.hashForWitnessV1(n,l,o,a,d);if(!k.verifySchnorr(c,Buffer.from(this.redeemerPubkey,"hex"),Buffer.from(e[n].sig,"hex")))throw new Error(u.htlcErrors.invalidCounterpartySigForUTXO(e[n].utxo));const w=await this.signer.signSchnorr(c),x=Buffer.from(t.ins[n].hash).reverse().toString("hex"),E=e.find(L=>L.utxo===x);if(!E)throw new Error(u.htlcErrors.counterPartySigNotFound(x));t.setWitness(n,[Buffer.from(E.sig,"hex"),w,this.instantRefundLeaf(),this.generateControlBlockFor(2)])}return await(await this.signer.getProvider()).broadcast(t.toHex())}async redeem(e,r,t){f.assert(h.crypto.sha256(Buffer.from(e,"hex")).toString("hex")===this.secretHash,u.htlcErrors.secretMismatch);const{tx:s,usedUtxos:i}=await this._buildRawTx(r??await this.signer.getAddress(),t),a=this.leafHash(1),d=i.map(n=>n.value),o=y(this.getOutputScript(),i.length),l=h.Transaction.SIGHASH_DEFAULT;for(let n=0;n<s.ins.length;n++){const c=s.hashForWitnessV1(n,o,d,l,a),w=await this.signer.signSchnorr(c);s.setWitness(n,[w,Buffer.from(e,"hex"),this.redeemLeaf(),this.generateControlBlockFor(1)])}return await(await this.signer.getProvider()).broadcast(s.toHex())}async refund(e,r){const{tx:t,usedUtxos:s}=await this._buildRawTx(e??await this.signer.getAddress(),r),[i,a]=await this.canRefund(s);if(!i)throw new Error(u.htlcErrors.htlcNotExpired(a));const d=this.leafHash(0),o=s.map(c=>c.value),l=y(this.getOutputScript(),s.length),g=h.Transaction.SIGHASH_DEFAULT;for(let c=0;c<t.ins.length;c++){t.ins[c].sequence=this.expiry;const w=t.hashForWitnessV1(c,l,o,g,d),x=await this.signer.signSchnorr(w);t.setWitness(c,[x,this.refundLeaf(),this.generateControlBlockFor(0)])}return await(await this.signer.getProvider()).broadcast(t.toHex())}async canRefund(e){const t=await(await this.signer.getProvider()).getLatestTip();for(const s of e){let i=0;if(s.status.confirmed&&s.status.block_height+this.expiry>t?i=s.status.block_height+this.expiry-t+1:s.status.confirmed||(i=this.expiry+1),i>0)return[!1,i]}return[!0,0]}generateControlBlockFor(e){let r;switch(e){case 1:r=this.redeemLeaf();break;case 0:r=this.refundLeaf();break;case 2:r=this.instantRefundLeaf();break;default:throw new Error(u.htlcErrors.invalidLeaf)}const t=h.payments.p2tr({internalPubkey:this.internalPubkey,network:this.network,scriptTree:this.leaves(),redeem:{output:r,redeemVersion:m}});if(!t.witness)throw new Error(u.htlcErrors.controlBlockGenerationFailed);return t.witness[t.witness.length-1]}leafHash(e){let r=this.redeemLeaf();return e===0&&(r=this.refundLeaf()),e===2&&(r=this.instantRefundLeaf()),h.crypto.taggedHash("TapLeaf",f.serializeScript(r))}refundLeaf(){return h.script.fromASM(`
2
2
  ${h.script.number.encode(this.expiry).toString("hex")}
3
3
  OP_CHECKSEQUENCEVERIFY
4
4
  OP_DROP
package/dist/index11.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Urgency as y } from "@catalogfi/wallets";
2
2
  import * as h from "bitcoinjs-lib";
3
3
  import * as k from "tiny-secp256k1";
4
- import { generateInternalkey as b } from "./index21.js";
4
+ import { generateInternalkey as b } from "./index26.js";
5
5
  import { assert as g, xOnlyPubkey as L, serializeScript as P, sortLeaves as O } from "./index10.js";
6
- import { htlcErrors as u } from "./index22.js";
6
+ import { htlcErrors as u } from "./index27.js";
7
7
  const m = 192;
8
8
  h.initEccLib(k);
9
9
  class H {
package/dist/index14.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const t=require("./index15.cjs");require("./index25.cjs");const n=require("./index26.cjs");(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.networks=e.ECPairFactory=e.default=void 0;var r=n.__exports;Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r.ECPairFactory}}),Object.defineProperty(e,"ECPairFactory",{enumerable:!0,get:function(){return r.ECPairFactory}}),Object.defineProperty(e,"networks",{enumerable:!0,get:function(){return r.networks}})})(t.__exports);
1
+ "use strict";const t=require("./index15.cjs");require("./index16.cjs");const n=require("./index17.cjs");(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.networks=e.ECPairFactory=e.default=void 0;var r=n.__exports;Object.defineProperty(e,"default",{enumerable:!0,get:function(){return r.ECPairFactory}}),Object.defineProperty(e,"ECPairFactory",{enumerable:!0,get:function(){return r.ECPairFactory}}),Object.defineProperty(e,"networks",{enumerable:!0,get:function(){return r.networks}})})(t.__exports);
package/dist/index14.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { __exports as t } from "./index15.js";
2
- import "./index25.js";
3
- import { __exports as n } from "./index26.js";
2
+ import "./index16.js";
3
+ import { __exports as n } from "./index17.js";
4
4
  (function(e) {
5
5
  Object.defineProperty(e, "__esModule", { value: !0 }), e.networks = e.ECPairFactory = e.default = void 0;
6
6
  var r = n;
package/dist/index16.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index23.cjs"),a=e.defineChain({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},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=a;
1
+ "use strict";var v=Object.defineProperty;var k=(r,o,f)=>o in r?v(r,o,{enumerable:!0,configurable:!0,writable:!0,value:f}):r[o]=f;var a=(r,o,f)=>k(r,typeof o!="symbol"?o+"":o,f);const c=require("./index17.cjs");require("./index18.cjs");require("./index19.cjs");const b=require("./index20.cjs"),P=require("./index21.cjs");require("./index22.cjs");const K=require("./index23.cjs"),x=require("./index24.cjs"),g=require("./index25.cjs");Object.defineProperty(c.__exports,"__esModule",{value:!0});c.__exports.ECPairFactory=c.__exports.networks=void 0;const p=K.__exports;c.__exports.networks=p;const n=x.__exports,E=b.browserExports,_=P.wif,B=g.__exports,y=n.typeforce.maybe(n.typeforce.compile({compressed:n.maybe(n.Boolean),network:n.maybe(n.Network)})),D=r=>r.length===32?r:r.slice(1,33);function F(r){(0,B.testEcc)(r);function o(s){return r.isPoint(s)}function f(s,e){if(n.typeforce(n.Buffer256bit,s),!r.isPrivate(s))throw new TypeError("Private key not in range [1, n)");return n.typeforce(y,e),new d(s,void 0,e)}function h(s,e){return n.typeforce(r.isPoint,s),n.typeforce(y,e),new d(void 0,s,e)}function l(s,e){const t=_.decode(s),i=t.version;if(n.Array(e)){if(e=e.filter(u=>i===u.wif).pop(),!e)throw new Error("Unknown network version")}else if(e=e||p.bitcoin,i!==e.wif)throw new Error("Invalid network version");return f(t.privateKey,{compressed:t.compressed,network:e})}function m(s){n.typeforce(y,s),s===void 0&&(s={});const e=s.rng||E;let t;do t=e(32),n.typeforce(n.Buffer256bit,t);while(!r.isPrivate(t));return f(t,s)}class d{constructor(e,t,i){a(this,"__D");a(this,"__Q");a(this,"compressed");a(this,"network");a(this,"lowR");this.__D=e,this.__Q=t,this.lowR=!1,i===void 0&&(i={}),this.compressed=i.compressed===void 0?!0:i.compressed,this.network=i.network||p.bitcoin,t!==void 0&&(this.__Q=Buffer.from(r.pointCompress(t,this.compressed)))}get privateKey(){return this.__D}get publicKey(){if(!this.__Q){const e=r.pointFromScalar(this.__D,this.compressed);this.__Q=Buffer.from(e)}return this.__Q}toWIF(){if(!this.__D)throw new Error("Missing private key");return _.encode(this.network.wif,this.__D,this.compressed)}tweak(e){return this.privateKey?this.tweakFromPrivateKey(e):this.tweakFromPublicKey(e)}sign(e,t){if(!this.__D)throw new Error("Missing private key");if(t===void 0&&(t=this.lowR),t===!1)return Buffer.from(r.sign(e,this.__D));{let i=r.sign(e,this.__D);const u=Buffer.alloc(32,0);let w=0;for(;i[0]>127;)w++,u.writeUIntLE(w,0,6),i=r.sign(e,this.__D,u);return Buffer.from(i)}}signSchnorr(e){if(!this.privateKey)throw new Error("Missing private key");if(!r.signSchnorr)throw new Error("signSchnorr not supported by ecc library");return Buffer.from(r.signSchnorr(e,this.privateKey))}verify(e,t){return r.verify(e,this.publicKey,t)}verifySchnorr(e,t){if(!r.verifySchnorr)throw new Error("verifySchnorr not supported by ecc library");return r.verifySchnorr(e,this.publicKey.subarray(1,33),t)}tweakFromPublicKey(e){const t=D(this.publicKey),i=r.xOnlyPointAddTweak(t,e);if(!i||i.xOnlyPubkey===null)throw new Error("Cannot tweak public key!");const u=Buffer.from([i.parity===0?2:3]);return h(Buffer.concat([u,i.xOnlyPubkey]),{network:this.network,compressed:this.compressed})}tweakFromPrivateKey(e){const i=this.publicKey[0]===3||this.publicKey[0]===4&&(this.publicKey[64]&1)===1?r.privateNegate(this.privateKey):this.privateKey,u=r.privateAdd(i,e);if(!u)throw new Error("Invalid tweaked private key!");return f(Buffer.from(u),{network:this.network,compressed:this.compressed})}}return{isPoint:o,fromPrivateKey:f,fromPublicKey:h,fromWIF:l,makeRandom:m}}c.__exports.ECPairFactory=F;module.exports=c.__exports;
package/dist/index16.js CHANGED
@@ -1,34 +1,140 @@
1
- import { defineChain as e } from "./index23.js";
2
- const t = /* @__PURE__ */ e({
3
- id: 1,
4
- name: "Ethereum",
5
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
6
- rpcUrls: {
7
- default: {
8
- http: ["https://cloudflare-eth.com"]
9
- }
10
- },
11
- blockExplorers: {
12
- default: {
13
- name: "Etherscan",
14
- url: "https://etherscan.io",
15
- apiUrl: "https://api.etherscan.io/api"
16
- }
17
- },
18
- contracts: {
19
- ensRegistry: {
20
- address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"
21
- },
22
- ensUniversalResolver: {
23
- address: "0xce01f8eee7E479C928F8919abD53E553a36CeF67",
24
- blockCreated: 19258213
25
- },
26
- multicall3: {
27
- address: "0xca11bde05977b3631167028862be2a173976ca11",
28
- blockCreated: 14353601
1
+ var v = Object.defineProperty;
2
+ var k = (e, n, f) => n in e ? v(e, n, { enumerable: !0, configurable: !0, writable: !0, value: f }) : e[n] = f;
3
+ var y = (e, n, f) => k(e, typeof n != "symbol" ? n + "" : n, f);
4
+ import { __exports as p } from "./index17.js";
5
+ import "./index18.js";
6
+ import "./index19.js";
7
+ import { b } from "./index20.js";
8
+ import { w as P } from "./index21.js";
9
+ import "./index22.js";
10
+ import { __exports as K } from "./index23.js";
11
+ import { __exports as g } from "./index24.js";
12
+ import { __exports as E } from "./index25.js";
13
+ Object.defineProperty(p, "__esModule", { value: !0 });
14
+ p.ECPairFactory = p.networks = void 0;
15
+ const c = K;
16
+ p.networks = c;
17
+ const s = g, x = b, m = P, B = E, u = s.typeforce.maybe(
18
+ s.typeforce.compile({
19
+ compressed: s.maybe(s.Boolean),
20
+ network: s.maybe(s.Network)
21
+ })
22
+ ), D = (e) => e.length === 32 ? e : e.slice(1, 33);
23
+ function F(e) {
24
+ (0, B.testEcc)(e);
25
+ function n(o) {
26
+ return e.isPoint(o);
27
+ }
28
+ function f(o, r) {
29
+ if (s.typeforce(s.Buffer256bit, o), !e.isPrivate(o))
30
+ throw new TypeError("Private key not in range [1, n)");
31
+ return s.typeforce(u, r), new d(o, void 0, r);
32
+ }
33
+ function h(o, r) {
34
+ return s.typeforce(e.isPoint, o), s.typeforce(u, r), new d(void 0, o, r);
35
+ }
36
+ function l(o, r) {
37
+ const t = m.decode(o), i = t.version;
38
+ if (s.Array(r)) {
39
+ if (r = r.filter((a) => i === a.wif).pop(), !r) throw new Error("Unknown network version");
40
+ } else if (r = r || c.bitcoin, i !== r.wif) throw new Error("Invalid network version");
41
+ return f(t.privateKey, {
42
+ compressed: t.compressed,
43
+ network: r
44
+ });
45
+ }
46
+ function _(o) {
47
+ s.typeforce(u, o), o === void 0 && (o = {});
48
+ const r = o.rng || x;
49
+ let t;
50
+ do
51
+ t = r(32), s.typeforce(s.Buffer256bit, t);
52
+ while (!e.isPrivate(t));
53
+ return f(t, o);
54
+ }
55
+ class d {
56
+ constructor(r, t, i) {
57
+ y(this, "__D");
58
+ y(this, "__Q");
59
+ y(this, "compressed");
60
+ y(this, "network");
61
+ y(this, "lowR");
62
+ this.__D = r, this.__Q = t, this.lowR = !1, i === void 0 && (i = {}), this.compressed = i.compressed === void 0 ? !0 : i.compressed, this.network = i.network || c.bitcoin, t !== void 0 && (this.__Q = Buffer.from(e.pointCompress(t, this.compressed)));
63
+ }
64
+ get privateKey() {
65
+ return this.__D;
66
+ }
67
+ get publicKey() {
68
+ if (!this.__Q) {
69
+ const r = e.pointFromScalar(this.__D, this.compressed);
70
+ this.__Q = Buffer.from(r);
71
+ }
72
+ return this.__Q;
73
+ }
74
+ toWIF() {
75
+ if (!this.__D) throw new Error("Missing private key");
76
+ return m.encode(this.network.wif, this.__D, this.compressed);
77
+ }
78
+ tweak(r) {
79
+ return this.privateKey ? this.tweakFromPrivateKey(r) : this.tweakFromPublicKey(r);
80
+ }
81
+ sign(r, t) {
82
+ if (!this.__D) throw new Error("Missing private key");
83
+ if (t === void 0 && (t = this.lowR), t === !1)
84
+ return Buffer.from(e.sign(r, this.__D));
85
+ {
86
+ let i = e.sign(r, this.__D);
87
+ const a = Buffer.alloc(32, 0);
88
+ let w = 0;
89
+ for (; i[0] > 127; )
90
+ w++, a.writeUIntLE(w, 0, 6), i = e.sign(r, this.__D, a);
91
+ return Buffer.from(i);
92
+ }
93
+ }
94
+ signSchnorr(r) {
95
+ if (!this.privateKey) throw new Error("Missing private key");
96
+ if (!e.signSchnorr)
97
+ throw new Error("signSchnorr not supported by ecc library");
98
+ return Buffer.from(e.signSchnorr(r, this.privateKey));
99
+ }
100
+ verify(r, t) {
101
+ return e.verify(r, this.publicKey, t);
102
+ }
103
+ verifySchnorr(r, t) {
104
+ if (!e.verifySchnorr)
105
+ throw new Error("verifySchnorr not supported by ecc library");
106
+ return e.verifySchnorr(r, this.publicKey.subarray(1, 33), t);
107
+ }
108
+ tweakFromPublicKey(r) {
109
+ const t = D(this.publicKey), i = e.xOnlyPointAddTweak(t, r);
110
+ if (!i || i.xOnlyPubkey === null)
111
+ throw new Error("Cannot tweak public key!");
112
+ const a = Buffer.from([
113
+ i.parity === 0 ? 2 : 3
114
+ ]);
115
+ return h(
116
+ Buffer.concat([a, i.xOnlyPubkey]),
117
+ { network: this.network, compressed: this.compressed }
118
+ );
119
+ }
120
+ tweakFromPrivateKey(r) {
121
+ const i = this.publicKey[0] === 3 || this.publicKey[0] === 4 && (this.publicKey[64] & 1) === 1 ? e.privateNegate(this.privateKey) : this.privateKey, a = e.privateAdd(i, r);
122
+ if (!a) throw new Error("Invalid tweaked private key!");
123
+ return f(Buffer.from(a), {
124
+ network: this.network,
125
+ compressed: this.compressed
126
+ });
29
127
  }
30
128
  }
31
- });
129
+ return {
130
+ isPoint: n,
131
+ fromPrivateKey: f,
132
+ fromPublicKey: h,
133
+ fromWIF: l,
134
+ makeRandom: _
135
+ };
136
+ }
137
+ p.ECPairFactory = F;
32
138
  export {
33
- t as mainnet
139
+ p as default
34
140
  };
package/dist/index17.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index23.cjs"),a=r.defineChain({id:42161,name:"Arbitrum One",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://arbiscan.io",apiUrl:"https://api.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:7654707}}});exports.arbitrum=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
package/dist/index17.js CHANGED
@@ -1,27 +1,4 @@
1
- import { defineChain as a } from "./index23.js";
2
- const t = /* @__PURE__ */ a({
3
- id: 42161,
4
- name: "Arbitrum One",
5
- nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
6
- rpcUrls: {
7
- default: {
8
- http: ["https://arb1.arbitrum.io/rpc"]
9
- }
10
- },
11
- blockExplorers: {
12
- default: {
13
- name: "Arbiscan",
14
- url: "https://arbiscan.io",
15
- apiUrl: "https://api.arbiscan.io/api"
16
- }
17
- },
18
- contracts: {
19
- multicall3: {
20
- address: "0xca11bde05977b3631167028862be2a173976ca11",
21
- blockCreated: 7654707
22
- }
23
- }
24
- });
1
+ var r = {};
25
2
  export {
26
- t as arbitrum
3
+ r as __exports
27
4
  };
package/dist/index18.cjs CHANGED
@@ -1 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index23.cjs"),a=e.defineChain({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc2.sepolia.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";const e=require("./index23.cjs");Object.defineProperty(e.__exports,"__esModule",{value:!0});e.__exports.testnet=e.__exports.bitcoin=void 0;e.__exports.bitcoin={messagePrefix:`Bitcoin Signed Message:
2
+ `,bech32:"bc",bip32:{public:76067358,private:76066276},pubKeyHash:0,scriptHash:5,wif:128};e.__exports.testnet={messagePrefix:`Bitcoin Signed Message:
3
+ `,bech32:"tb",bip32:{public:70617039,private:70615956},pubKeyHash:111,scriptHash:196,wif:239};module.exports=e.__exports;
package/dist/index18.js CHANGED
@@ -1,33 +1,30 @@
1
- import { defineChain as e } from "./index23.js";
2
- const s = /* @__PURE__ */ e({
3
- id: 11155111,
4
- name: "Sepolia",
5
- nativeCurrency: { name: "Sepolia Ether", symbol: "ETH", decimals: 18 },
6
- rpcUrls: {
7
- default: {
8
- http: ["https://rpc2.sepolia.org"]
9
- }
1
+ import { __exports as e } from "./index23.js";
2
+ Object.defineProperty(e, "__esModule", { value: !0 });
3
+ e.testnet = e.bitcoin = void 0;
4
+ e.bitcoin = {
5
+ messagePrefix: `Bitcoin Signed Message:
6
+ `,
7
+ bech32: "bc",
8
+ bip32: {
9
+ public: 76067358,
10
+ private: 76066276
10
11
  },
11
- blockExplorers: {
12
- default: {
13
- name: "Etherscan",
14
- url: "https://sepolia.etherscan.io",
15
- apiUrl: "https://api-sepolia.etherscan.io/api"
16
- }
17
- },
18
- contracts: {
19
- multicall3: {
20
- address: "0xca11bde05977b3631167028862be2a173976ca11",
21
- blockCreated: 751532
22
- },
23
- ensRegistry: { address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" },
24
- ensUniversalResolver: {
25
- address: "0xc8Af999e38273D658BE1b921b88A9Ddf005769cC",
26
- blockCreated: 5317080
27
- }
12
+ pubKeyHash: 0,
13
+ scriptHash: 5,
14
+ wif: 128
15
+ };
16
+ e.testnet = {
17
+ messagePrefix: `Bitcoin Signed Message:
18
+ `,
19
+ bech32: "tb",
20
+ bip32: {
21
+ public: 70617039,
22
+ private: 70615956
28
23
  },
29
- testnet: !0
30
- });
24
+ pubKeyHash: 111,
25
+ scriptHash: 196,
26
+ wif: 239
27
+ };
31
28
  export {
32
- s as sepolia
29
+ e as default
33
30
  };
package/dist/index19.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index23.cjs"),a=e.defineChain({id:421614,name:"Arbitrum Sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Arbiscan",url:"https://sepolia.arbiscan.io",apiUrl:"https://api-sepolia.arbiscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:81930}},testnet:!0});exports.arbitrumSepolia=a;
1
+ "use strict";const f=require("./index24.cjs"),y=require("./index28.cjs");(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.maybe=e.Boolean=e.Array=e.Buffer256bit=e.Network=e.typeforce=void 0,e.typeforce=y.typeforce_1,e.Network=e.typeforce.compile({messagePrefix:e.typeforce.oneOf(e.typeforce.Buffer,e.typeforce.String),bip32:{public:e.typeforce.UInt32,private:e.typeforce.UInt32},pubKeyHash:e.typeforce.UInt8,scriptHash:e.typeforce.UInt8,wif:e.typeforce.UInt8}),e.Buffer256bit=e.typeforce.BufferN(32),e.Array=e.typeforce.Array,e.Boolean=e.typeforce.Boolean,e.maybe=e.typeforce.maybe})(f.__exports);
package/dist/index19.js CHANGED
@@ -1,32 +1,17 @@
1
- import { defineChain as a } from "./index23.js";
2
- const e = /* @__PURE__ */ a({
3
- id: 421614,
4
- name: "Arbitrum Sepolia",
5
- nativeCurrency: {
6
- name: "Arbitrum Sepolia Ether",
7
- symbol: "ETH",
8
- decimals: 18
9
- },
10
- rpcUrls: {
11
- default: {
12
- http: ["https://sepolia-rollup.arbitrum.io/rpc"]
13
- }
14
- },
15
- blockExplorers: {
16
- default: {
17
- name: "Arbiscan",
18
- url: "https://sepolia.arbiscan.io",
19
- apiUrl: "https://api-sepolia.arbiscan.io/api"
20
- }
21
- },
22
- contracts: {
23
- multicall3: {
24
- address: "0xca11bde05977b3631167028862be2a173976ca11",
25
- blockCreated: 81930
26
- }
27
- },
28
- testnet: !0
29
- });
30
- export {
31
- e as arbitrumSepolia
32
- };
1
+ import { __exports as f } from "./index24.js";
2
+ import { t as y } from "./index28.js";
3
+ (function(e) {
4
+ Object.defineProperty(e, "__esModule", { value: !0 }), e.maybe = e.Boolean = e.Array = e.Buffer256bit = e.Network = e.typeforce = void 0, e.typeforce = y, e.Network = e.typeforce.compile({
5
+ messagePrefix: e.typeforce.oneOf(
6
+ e.typeforce.Buffer,
7
+ e.typeforce.String
8
+ ),
9
+ bip32: {
10
+ public: e.typeforce.UInt32,
11
+ private: e.typeforce.UInt32
12
+ },
13
+ pubKeyHash: e.typeforce.UInt8,
14
+ scriptHash: e.typeforce.UInt8,
15
+ wif: e.typeforce.UInt8
16
+ }), e.Buffer256bit = e.typeforce.BufferN(32), e.Array = e.typeforce.Array, e.Boolean = e.typeforce.Boolean, e.maybe = e.typeforce.maybe;
17
+ })(f);
package/dist/index20.cjs CHANGED
@@ -1 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index24.cjs"),s=require("./index23.cjs"),e=11155111,t=s.defineChain({...a.chainConfig,id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Basescan",url:"https://sepolia.basescan.org",apiUrl:"https://api-sepolia.basescan.org/api"}},contracts:{...a.chainConfig.contracts,disputeGameFactory:{[e]:{address:"0xd6E6dBf4F7EA0ac412fD8b65ED297e64BB7a06E1"}},l2OutputOracle:{[e]:{address:"0x84457ca9D0163FbC4bbfe4Dfbb20ba46e48DF254"}},portal:{[e]:{address:"0x49f53e41452c74589e85ca1677426ba426459e85",blockCreated:4446677}},l1StandardBridge:{[e]:{address:"0xfd0Bf71F60660E2f608ed56e1659C450eB113120",blockCreated:4446677}},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:1059647}},testnet:!0,sourceId:e});exports.baseSepolia=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index29.cjs"),s=require("./index30.cjs"),l=require("./index31.cjs");var n=65536,f=4294967295;function m(){throw new Error(`Secure random number generation is not supported by this browser.
2
+ Use Chrome, Firefox or Internet Explorer 11`)}var c=l.safeBufferExports.Buffer,t=a.commonjsGlobal.crypto||a.commonjsGlobal.msCrypto;t&&t.getRandomValues?s.__module.exports=i:s.__module.exports=m;function i(r,u){if(r>f)throw new RangeError("requested too many random bytes");var o=c.allocUnsafe(r);if(r>0)if(r>n)for(var e=0;e<r;e+=n)t.getRandomValues(o.slice(e,e+n));else t.getRandomValues(o);return typeof u=="function"?process.nextTick(function(){u(null,o)}):o}var p=s.__module.exports;exports.browserExports=p;