@gardenfi/core 0.2.0-beta.73 → 0.2.0-beta.75

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 (267) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +16 -15
  3. package/dist/index10.cjs +1 -1
  4. package/dist/index10.js +42 -31
  5. package/dist/index100.cjs +1 -1
  6. package/dist/index100.js +18 -32
  7. package/dist/index101.cjs +1 -1
  8. package/dist/index101.js +6 -366
  9. package/dist/index102.cjs +1 -1
  10. package/dist/index102.js +33 -21
  11. package/dist/index103.cjs +1 -1
  12. package/dist/index103.js +2 -56
  13. package/dist/index104.cjs +1 -1
  14. package/dist/index104.js +38 -3
  15. package/dist/index105.cjs +1 -1
  16. package/dist/index105.js +25 -45
  17. package/dist/index106.cjs +1 -1
  18. package/dist/index106.js +7 -26
  19. package/dist/index107.cjs +1 -1
  20. package/dist/index107.js +5 -2
  21. package/dist/index108.cjs +1 -1
  22. package/dist/index108.js +11 -2
  23. package/dist/index109.cjs +1 -1
  24. package/dist/index109.js +2 -62
  25. package/dist/index11.cjs +1 -1
  26. package/dist/index11.js +2 -2
  27. package/dist/index110.cjs +1 -1
  28. package/dist/index110.js +55 -32
  29. package/dist/index111.cjs +1 -1
  30. package/dist/index111.js +2 -5
  31. package/dist/index112.cjs +1 -1
  32. package/dist/index112.js +40 -2
  33. package/dist/index113.cjs +1 -1
  34. package/dist/index113.js +38 -53
  35. package/dist/index114.cjs +1 -1
  36. package/dist/index114.js +18 -2
  37. package/dist/index115.cjs +1 -1
  38. package/dist/index115.js +101 -32
  39. package/dist/index116.cjs +1 -1
  40. package/dist/index116.js +17 -39
  41. package/dist/index117.cjs +1 -1
  42. package/dist/index117.js +224 -16
  43. package/dist/index118.cjs +1 -1
  44. package/dist/index118.js +4 -109
  45. package/dist/index119.cjs +1 -1
  46. package/dist/index119.js +155 -18
  47. package/dist/index120.cjs +1 -1
  48. package/dist/index120.js +2 -226
  49. package/dist/index121.cjs +1 -1
  50. package/dist/index121.js +73 -4
  51. package/dist/index122.cjs +1 -1
  52. package/dist/index122.js +55 -151
  53. package/dist/index123.cjs +1 -1
  54. package/dist/index123.js +35 -2
  55. package/dist/index124.cjs +1 -1
  56. package/dist/index124.js +5 -73
  57. package/dist/index125.cjs +1 -1
  58. package/dist/index125.js +2 -2
  59. package/dist/index126.cjs +1 -1
  60. package/dist/index126.js +8 -8
  61. package/dist/index127.cjs +1 -1
  62. package/dist/index127.js +1 -1
  63. package/dist/index130.cjs +1 -1
  64. package/dist/index130.js +2 -19
  65. package/dist/index131.cjs +1 -1
  66. package/dist/index131.js +356 -2
  67. package/dist/index132.cjs +1 -1
  68. package/dist/index132.js +206 -323
  69. package/dist/index133.cjs +1 -1
  70. package/dist/index133.js +37 -208
  71. package/dist/index134.cjs +1 -1
  72. package/dist/index134.js +59 -65
  73. package/dist/index135.cjs +1 -1
  74. package/dist/index135.js +10 -60
  75. package/dist/index136.cjs +1 -1
  76. package/dist/index136.js +45 -12
  77. package/dist/index137.cjs +1 -1
  78. package/dist/index137.js +56 -38
  79. package/dist/index138.cjs +1 -1
  80. package/dist/index138.js +19 -63
  81. package/dist/index14.cjs +1 -1
  82. package/dist/index14.js +9 -4
  83. package/dist/index141.cjs +1 -1
  84. package/dist/index141.js +3 -3
  85. package/dist/index145.cjs +1 -1
  86. package/dist/index145.js +1 -1
  87. package/dist/index148.cjs +1 -1
  88. package/dist/index148.js +1 -1
  89. package/dist/index15.cjs +1 -1
  90. package/dist/index15.js +32 -2
  91. package/dist/index16.cjs +1 -1
  92. package/dist/index16.js +10 -17
  93. package/dist/index17.cjs +1 -1
  94. package/dist/index17.js +18 -12
  95. package/dist/index18.cjs +1 -1
  96. package/dist/index18.js +15 -16
  97. package/dist/index19.cjs +1 -1
  98. package/dist/index19.js +39 -16
  99. package/dist/index20.cjs +1 -1
  100. package/dist/index20.js +25 -52
  101. package/dist/index21.cjs +1 -1
  102. package/dist/index21.js +2 -9
  103. package/dist/index22.cjs +1 -1
  104. package/dist/index22.js +138 -9
  105. package/dist/index23.cjs +1 -1
  106. package/dist/index23.js +2 -138
  107. package/dist/index24.cjs +1 -1
  108. package/dist/index24.js +9 -2
  109. package/dist/index25.cjs +1 -1
  110. package/dist/index25.js +7 -11
  111. package/dist/index26.cjs +3 -1
  112. package/dist/index26.js +27 -36
  113. package/dist/index27.cjs +1 -1
  114. package/dist/index27.js +17 -44
  115. package/dist/index28.cjs +2 -1
  116. package/dist/index28.js +24 -27
  117. package/dist/index29.cjs +1 -1
  118. package/dist/index29.js +40 -14
  119. package/dist/index30.cjs +1 -1
  120. package/dist/index30.js +197 -22
  121. package/dist/index31.cjs +1 -1
  122. package/dist/index31.js +2 -26
  123. package/dist/index32.cjs +1 -1
  124. package/dist/index32.js +2 -55
  125. package/dist/index33.cjs +1 -1
  126. package/dist/index33.js +2 -28
  127. package/dist/index34.cjs +1 -3
  128. package/dist/index34.js +11 -26
  129. package/dist/index35.cjs +1 -1
  130. package/dist/index35.js +39 -17
  131. package/dist/index36.cjs +1 -2
  132. package/dist/index36.js +40 -23
  133. package/dist/index37.cjs +1 -1
  134. package/dist/index37.js +26 -39
  135. package/dist/index38.cjs +1 -1
  136. package/dist/index38.js +15 -199
  137. package/dist/index39.cjs +1 -1
  138. package/dist/index39.js +24 -2
  139. package/dist/index40.cjs +1 -1
  140. package/dist/index40.js +26 -2
  141. package/dist/index41.cjs +1 -1
  142. package/dist/index41.js +55 -2
  143. package/dist/index42.cjs +1 -1
  144. package/dist/index42.js +27 -12
  145. package/dist/index43.cjs +1 -1
  146. package/dist/index43.js +174 -11
  147. package/dist/index44.cjs +1 -1
  148. package/dist/index44.js +2 -4
  149. package/dist/index45.cjs +1 -1
  150. package/dist/index45.js +34 -45
  151. package/dist/index46.cjs +1 -1
  152. package/dist/index46.js +9 -43
  153. package/dist/index47.cjs +1 -1
  154. package/dist/index47.js +10 -169
  155. package/dist/index48.cjs +1 -1
  156. package/dist/index48.js +11 -12
  157. package/dist/index49.cjs +1 -1
  158. package/dist/index49.js +3 -4
  159. package/dist/index5.cjs +1 -1
  160. package/dist/index5.js +48 -59
  161. package/dist/index50.cjs +1 -1
  162. package/dist/index50.js +45 -16
  163. package/dist/index51.cjs +1 -1
  164. package/dist/index51.js +40 -9
  165. package/dist/index52.cjs +1 -1
  166. package/dist/index52.js +167 -170
  167. package/dist/index53.cjs +1 -1
  168. package/dist/index53.js +12 -21
  169. package/dist/index54.cjs +1 -1
  170. package/dist/index54.js +5 -2
  171. package/dist/index55.cjs +1 -1
  172. package/dist/index55.js +17 -35
  173. package/dist/index56.cjs +1 -1
  174. package/dist/index56.js +11 -8
  175. package/dist/index57.cjs +1 -1
  176. package/dist/index57.js +19 -34
  177. package/dist/index58.cjs +1 -1
  178. package/dist/index58.js +31 -55
  179. package/dist/index59.cjs +1 -2
  180. package/dist/index59.js +2 -60
  181. package/dist/index60.cjs +6 -1
  182. package/dist/index60.js +949 -6
  183. package/dist/index61.cjs +1 -1
  184. package/dist/index61.js +2 -128
  185. package/dist/index62.cjs +1 -2
  186. package/dist/index62.js +61 -42
  187. package/dist/index63.cjs +1 -1
  188. package/dist/index63.js +33 -9
  189. package/dist/index64.cjs +1 -1
  190. package/dist/index64.js +86 -10
  191. package/dist/index65.cjs +1 -1
  192. package/dist/index65.js +55 -11
  193. package/dist/index66.cjs +2 -1
  194. package/dist/index66.js +59 -13
  195. package/dist/index67.cjs +1 -1
  196. package/dist/index67.js +3 -6
  197. package/dist/index68.cjs +1 -1
  198. package/dist/index68.js +33 -16
  199. package/dist/index69.cjs +1 -1
  200. package/dist/index69.js +126 -77
  201. package/dist/index70.cjs +2 -1
  202. package/dist/index70.js +42 -14
  203. package/dist/index71.cjs +1 -1
  204. package/dist/index71.js +8 -18
  205. package/dist/index72.cjs +1 -1
  206. package/dist/index72.js +9 -5
  207. package/dist/index73.cjs +1 -1
  208. package/dist/index73.js +11 -21
  209. package/dist/index74.cjs +1 -1
  210. package/dist/index74.js +13 -13
  211. package/dist/index75.cjs +1 -1
  212. package/dist/index75.js +7 -2
  213. package/dist/index76.cjs +1 -1
  214. package/dist/index76.js +18 -2
  215. package/dist/index77.cjs +1 -2
  216. package/dist/index77.js +76 -32
  217. package/dist/index78.cjs +1 -1
  218. package/dist/index78.js +14 -5
  219. package/dist/index79.cjs +1 -1
  220. package/dist/index79.js +18 -19
  221. package/dist/index8.cjs +1 -1
  222. package/dist/index8.js +5 -6
  223. package/dist/index80.cjs +1 -1
  224. package/dist/index80.js +19 -29
  225. package/dist/index81.cjs +1 -1
  226. package/dist/index81.js +14 -2
  227. package/dist/index82.cjs +1 -6
  228. package/dist/index82.js +9 -949
  229. package/dist/index83.cjs +1 -1
  230. package/dist/index83.js +2 -2
  231. package/dist/index84.cjs +1 -1
  232. package/dist/index84.js +2 -62
  233. package/dist/index85.cjs +2 -1
  234. package/dist/index85.js +34 -32
  235. package/dist/index86.cjs +1 -1
  236. package/dist/index86.js +5 -86
  237. package/dist/index87.cjs +1 -1
  238. package/dist/index87.js +19 -12
  239. package/dist/index88.cjs +1 -1
  240. package/dist/index88.js +34 -6
  241. package/dist/index89.cjs +1 -1
  242. package/dist/index89.js +365 -111
  243. package/dist/index90.cjs +1 -1
  244. package/dist/index90.js +21 -7
  245. package/dist/index91.cjs +1 -1
  246. package/dist/index91.js +55 -32
  247. package/dist/index92.cjs +1 -1
  248. package/dist/index92.js +3 -2
  249. package/dist/index93.cjs +1 -1
  250. package/dist/index93.js +45 -34
  251. package/dist/index94.cjs +1 -1
  252. package/dist/index94.js +26 -29
  253. package/dist/index95.cjs +1 -1
  254. package/dist/index95.js +2 -21
  255. package/dist/index96.cjs +1 -1
  256. package/dist/index96.js +2 -7
  257. package/dist/index97.cjs +1 -1
  258. package/dist/index97.js +13 -5
  259. package/dist/index98.cjs +1 -1
  260. package/dist/index98.js +6 -10
  261. package/dist/index99.cjs +1 -1
  262. package/dist/index99.js +111 -18
  263. package/dist/src/index.d.ts +1 -1
  264. package/dist/src/lib/evm/relay/evmRelay.d.ts +1 -1
  265. package/dist/src/lib/evm/relay/evmRelay.types.d.ts +1 -1
  266. package/dist/src/lib/utils.d.ts +2 -0
  267. package/package.json +2 -2
package/dist/index36.js CHANGED
@@ -1,27 +1,44 @@
1
- import { commonjsGlobal as f } from "./index53.js";
2
- import { __module as n } from "./index54.js";
3
- import { s as m } from "./index55.js";
4
- var s = 65536, u = 4294967295;
5
- function p() {
6
- throw new Error(`Secure random number generation is not supported by this browser.
7
- Use Chrome, Firefox or Internet Explorer 11`);
1
+ import { InvalidAddressError as a } from "./index47.js";
2
+ import { isAddress as f } from "./index48.js";
3
+ import { concatHex as p } from "./index49.js";
4
+ import { toHex as i } from "./index50.js";
5
+ import { toRlp as x } from "./index51.js";
6
+ import { serializeTransaction as l } from "./index52.js";
7
+ function T(r, e) {
8
+ return h(r) ? z(r) : l(r, e);
8
9
  }
9
- var l = m.Buffer, t = f.crypto || f.msCrypto;
10
- t && t.getRandomValues ? n.exports = i : n.exports = p;
11
- function i(r, a) {
12
- if (r > u) throw new RangeError("requested too many random bytes");
13
- var o = l.allocUnsafe(r);
14
- if (r > 0)
15
- if (r > s)
16
- for (var e = 0; e < r; e += s)
17
- t.getRandomValues(o.slice(e, e + s));
18
- else
19
- t.getRandomValues(o);
20
- return typeof a == "function" ? process.nextTick(function() {
21
- a(null, o);
22
- }) : o;
10
+ const E = {
11
+ transaction: T
12
+ };
13
+ function z(r) {
14
+ w(r);
15
+ const { sourceHash: e, data: o, from: m, gas: t, isSystemTx: u, mint: s, to: c, value: n } = r, d = [
16
+ e,
17
+ m,
18
+ c ?? "0x",
19
+ s ? i(s) : "0x",
20
+ n ? i(n) : "0x",
21
+ t ? i(t) : "0x",
22
+ u ? "0x1" : "0x",
23
+ o ?? "0x"
24
+ ];
25
+ return p([
26
+ "0x7e",
27
+ x(d)
28
+ ]);
29
+ }
30
+ function h(r) {
31
+ return r.type === "deposit" || typeof r.sourceHash < "u";
32
+ }
33
+ function w(r) {
34
+ const { from: e, to: o } = r;
35
+ if (e && !f(e))
36
+ throw new a({ address: e });
37
+ if (o && !f(o))
38
+ throw new a({ address: o });
23
39
  }
24
- var b = n.exports;
25
40
  export {
26
- b
41
+ w as assertTransactionDeposit,
42
+ T as serializeTransaction,
43
+ E as serializers
27
44
  };
package/dist/index37.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index56.cjs");var t=d.bs58check;function i(e,n){if(n!==void 0&&e[0]!==n)throw new Error("Invalid network version");if(e.length===33)return{version:e[0],privateKey:e.slice(1,33),compressed:!1};if(e.length!==34)throw new Error("Invalid WIF length");if(e[33]!==1)throw new Error("Invalid compression flag");return{version:e[0],privateKey:e.slice(1,33),compressed:!0}}function c(e,n,r){var o=new Buffer(r?34:33);return o.writeUInt8(e,0),n.copy(o,1),r&&(o[33]=1),o}function a(e,n){return i(t.decode(e),n)}function w(e,n,r){return typeof e=="number"?t.encode(c(e,n,r)):t.encode(c(e.version,e.privateKey,e.compressed))}var l={decode:a,decodeRaw:i,encode:w,encodeRaw:c};exports.wif=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("bitcoinjs-lib"),c=require("tiny-secp256k1"),u=require("./index10.cjs");function b(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const a=b(c),i=Buffer.from("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","hex"),l=Buffer.from("483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8","hex"),d=Buffer.concat([i,l]),s=Buffer.from("0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0","hex"),f={failedToCreateInternalPubkey:"failed to create internal pubkey",failedToTweakPubkey:"failed to tweak pubkey"};function y(){const e=o.crypto.sha256(Buffer.from("GardenHTLC","utf-8")),r=a.pointMultiply(Buffer.concat([Buffer.from("04","hex"),d]),e);if(!r)throw new Error(f.failedToCreateInternalPubkey);const t=a.pointAdd(s,r);if(!t)throw new Error(f.failedToCreateInternalPubkey);return u.xOnlyPubkey(Buffer.from(t))}exports.generateInternalkey=y;
package/dist/index37.js CHANGED
@@ -1,43 +1,30 @@
1
- import { b as i } from "./index56.js";
2
- var t = i;
3
- function d(e, n) {
4
- if (n !== void 0 && e[0] !== n) throw new Error("Invalid network version");
5
- if (e.length === 33)
6
- return {
7
- version: e[0],
8
- privateKey: e.slice(1, 33),
9
- compressed: !1
10
- };
11
- if (e.length !== 34) throw new Error("Invalid WIF length");
12
- if (e[33] !== 1) throw new Error("Invalid compression flag");
13
- return {
14
- version: e[0],
15
- privateKey: e.slice(1, 33),
16
- compressed: !0
17
- };
18
- }
19
- function c(e, n, r) {
20
- var o = new Buffer(r ? 34 : 33);
21
- return o.writeUInt8(e, 0), n.copy(o, 1), r && (o[33] = 1), o;
22
- }
23
- function a(e, n) {
24
- return d(t.decode(e), n);
25
- }
26
- function w(e, n, r) {
27
- return typeof e == "number" ? t.encode(c(e, n, r)) : t.encode(
28
- c(
29
- e.version,
30
- e.privateKey,
31
- e.compressed
32
- )
1
+ import { crypto as t } from "bitcoinjs-lib";
2
+ import * as f from "tiny-secp256k1";
3
+ import { xOnlyPubkey as n } from "./index10.js";
4
+ const c = Buffer.from(
5
+ "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798",
6
+ "hex"
7
+ ), b = Buffer.from(
8
+ "483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",
9
+ "hex"
10
+ ), u = Buffer.concat([c, b]), d = Buffer.from(
11
+ "0250929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0",
12
+ "hex"
13
+ ), a = {
14
+ failedToCreateInternalPubkey: "failed to create internal pubkey",
15
+ failedToTweakPubkey: "failed to tweak pubkey"
16
+ };
17
+ function m() {
18
+ const o = t.sha256(Buffer.from("GardenHTLC", "utf-8")), e = f.pointMultiply(
19
+ Buffer.concat([Buffer.from("04", "hex"), u]),
20
+ o
33
21
  );
22
+ if (!e)
23
+ throw new Error(a.failedToCreateInternalPubkey);
24
+ const r = f.pointAdd(d, e);
25
+ if (!r) throw new Error(a.failedToCreateInternalPubkey);
26
+ return n(Buffer.from(r));
34
27
  }
35
- var l = {
36
- decode: a,
37
- decodeRaw: d,
38
- encode: w,
39
- encodeRaw: c
40
- };
41
28
  export {
42
- l as w
29
+ m as generateInternalkey
43
30
  };
package/dist/index38.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";const d=require("./index41.cjs");Object.defineProperty(d.__exports,"__esModule",{value:!0});d.__exports.testEcc=void 0;const f=b=>Buffer.from(b,"hex");function c(b){a(b.isPoint(f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),a(!b.isPoint(f("030000000000000000000000000000000000000000000000000000000000000005"))),a(b.isPrivate(f("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),a(b.isPrivate(f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),a(!b.isPrivate(f("0000000000000000000000000000000000000000000000000000000000000000"))),a(!b.isPrivate(f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"))),a(!b.isPrivate(f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142"))),a(Buffer.from(b.privateAdd(f("0000000000000000000000000000000000000000000000000000000000000001"),f("0000000000000000000000000000000000000000000000000000000000000000"))).equals(f("0000000000000000000000000000000000000000000000000000000000000001"))),a(b.privateAdd(f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),f("0000000000000000000000000000000000000000000000000000000000000003"))===null),a(Buffer.from(b.privateAdd(f("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"),f("b51fbb69051255d1becbd683de5848242a89c229348dd72896a87ada94ae8665"))).equals(f("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24"))),a(Buffer.from(b.privateNegate(f("0000000000000000000000000000000000000000000000000000000000000001"))).equals(f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))),a(Buffer.from(b.privateNegate(f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"))).equals(f("0000000000000000000000000000000000000000000000000000000000000003"))),a(Buffer.from(b.privateNegate(f("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(f("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792"))),a(Buffer.from(b.pointCompress(f("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!0)).equals(f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),a(Buffer.from(b.pointCompress(f("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"),!1)).equals(f("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),a(Buffer.from(b.pointCompress(f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!0)).equals(f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"))),a(Buffer.from(b.pointCompress(f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),!1)).equals(f("0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"))),a(Buffer.from(b.pointFromScalar(f("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af"))).equals(f("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99"))),a(b.xOnlyPointAddTweak(f("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))===null);let e=b.xOnlyPointAddTweak(f("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),f("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac"));a(Buffer.from(e.xOnlyPubkey).equals(f("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf"))&&e.parity===1),e=b.xOnlyPointAddTweak(f("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),f("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")),a(Buffer.from(e.xOnlyPubkey).equals(f("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c"))&&e.parity===0),a(Buffer.from(b.sign(f("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140"))).equals(f("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),a(b.verify(f("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),f("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),f("54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"))),b.signSchnorr&&a(Buffer.from(b.signSchnorr(f("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),f("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),f("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906"))).equals(f("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"))),b.verifySchnorr&&a(b.verifySchnorr(f("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),f("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),f("5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7")))}d.__exports.testEcc=c;function a(b){if(!b)throw new Error("ecc library invalid")}module.exports=d.__exports;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t={secretMismatch:"invalid secret",secretHashLenMismatch:"secret hash should be 32 bytes",pubkeyLenMismatch:"pubkey should be 32 bytes",zeroOrNegativeExpiry:"expiry should be greater than 0",htlcAddressGenerationFailed:"failed to generate htlc address",notFunded:"address not funded",noCounterpartySigs:"counterparty signatures are required",counterPartySigNotFound:e=>"counterparty signature not found for utxo "+e,invalidCounterpartySigForUTXO:e=>"invalid counterparty signature for utxo "+e,htlcNotExpired:e=>`HTLC not expired, need more ${e} blocks`,controlBlockGenerationFailed:"failed to generate control block",invalidLeaf:"invalid leaf"};exports.htlcErrors=t;
package/dist/index38.js CHANGED
@@ -1,201 +1,17 @@
1
- import { __exports as d } from "./index41.js";
2
- Object.defineProperty(d, "__esModule", { value: !0 });
3
- d.testEcc = void 0;
4
- const f = (b) => Buffer.from(b, "hex");
5
- function c(b) {
6
- a(
7
- b.isPoint(
8
- f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
9
- )
10
- ), a(
11
- !b.isPoint(
12
- f("030000000000000000000000000000000000000000000000000000000000000005")
13
- )
14
- ), a(
15
- b.isPrivate(
16
- f("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
17
- )
18
- ), a(
19
- b.isPrivate(
20
- f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
21
- )
22
- ), a(
23
- !b.isPrivate(
24
- f("0000000000000000000000000000000000000000000000000000000000000000")
25
- )
26
- ), a(
27
- !b.isPrivate(
28
- f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141")
29
- )
30
- ), a(
31
- !b.isPrivate(
32
- f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364142")
33
- )
34
- ), a(
35
- Buffer.from(
36
- b.privateAdd(
37
- f("0000000000000000000000000000000000000000000000000000000000000001"),
38
- f("0000000000000000000000000000000000000000000000000000000000000000")
39
- )
40
- ).equals(
41
- f("0000000000000000000000000000000000000000000000000000000000000001")
42
- )
43
- ), a(
44
- b.privateAdd(
45
- f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e"),
46
- f("0000000000000000000000000000000000000000000000000000000000000003")
47
- ) === null
48
- ), a(
49
- Buffer.from(
50
- b.privateAdd(
51
- f("e211078564db65c3ce7704f08262b1f38f1ef412ad15b5ac2d76657a63b2c500"),
52
- f("b51fbb69051255d1becbd683de5848242a89c229348dd72896a87ada94ae8665")
53
- )
54
- ).equals(
55
- f("9730c2ee69edbb958d42db7460bafa18fef9d955325aec99044c81c8282b0a24")
56
- )
57
- ), a(
58
- Buffer.from(
59
- b.privateNegate(
60
- f("0000000000000000000000000000000000000000000000000000000000000001")
61
- )
62
- ).equals(
63
- f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
64
- )
65
- ), a(
66
- Buffer.from(
67
- b.privateNegate(
68
- f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd036413e")
69
- )
70
- ).equals(
71
- f("0000000000000000000000000000000000000000000000000000000000000003")
72
- )
73
- ), a(
74
- Buffer.from(
75
- b.privateNegate(
76
- f("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af")
77
- )
78
- ).equals(
79
- f("4eede1bf775995d70a494f0a7bb6bc11e0b8cccd41cce8009ab1132c8b0a3792")
80
- )
81
- ), a(
82
- Buffer.from(
83
- b.pointCompress(
84
- f(
85
- "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
86
- ),
87
- !0
88
- )
89
- ).equals(
90
- f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
91
- )
92
- ), a(
93
- Buffer.from(
94
- b.pointCompress(
95
- f(
96
- "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
97
- ),
98
- !1
99
- )
100
- ).equals(
101
- f(
102
- "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
103
- )
104
- )
105
- ), a(
106
- Buffer.from(
107
- b.pointCompress(
108
- f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
109
- !0
110
- )
111
- ).equals(
112
- f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798")
113
- )
114
- ), a(
115
- Buffer.from(
116
- b.pointCompress(
117
- f("0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
118
- !1
119
- )
120
- ).equals(
121
- f(
122
- "0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8"
123
- )
124
- )
125
- ), a(
126
- Buffer.from(
127
- b.pointFromScalar(
128
- f("b1121e4088a66a28f5b6b0f5844943ecd9f610196d7bb83b25214b60452c09af")
129
- )
130
- ).equals(
131
- f("02b07ba9dca9523b7ef4bd97703d43d20399eb698e194704791a25ce77a400df99")
132
- )
133
- ), a(
134
- b.xOnlyPointAddTweak(
135
- f("79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
136
- f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
137
- ) === null
138
- );
139
- let e = b.xOnlyPointAddTweak(
140
- f("1617d38ed8d8657da4d4761e8057bc396ea9e4b9d29776d4be096016dbd2509b"),
141
- f("a8397a935f0dfceba6ba9618f6451ef4d80637abf4e6af2669fbc9de6a8fd2ac")
142
- );
143
- a(
144
- Buffer.from(e.xOnlyPubkey).equals(
145
- f("e478f99dab91052ab39a33ea35fd5e6e4933f4d28023cd597c9a1f6760346adf")
146
- ) && e.parity === 1
147
- ), e = b.xOnlyPointAddTweak(
148
- f("2c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991"),
149
- f("823c3cd2142744b075a87eade7e1b8678ba308d566226a0056ca2b7a76f86b47")
150
- ), a(
151
- Buffer.from(e.xOnlyPubkey).equals(
152
- f("9534f8dc8c6deda2dc007655981c78b49c5d96c778fbf363462a11ec9dfd948c")
153
- ) && e.parity === 0
154
- ), a(
155
- Buffer.from(
156
- b.sign(
157
- f("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),
158
- f("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364140")
159
- )
160
- ).equals(
161
- f(
162
- "54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"
163
- )
164
- )
165
- ), a(
166
- b.verify(
167
- f("5e9f0a0d593efdcf78ac923bc3313e4e7d408d574354ee2b3288c0da9fbba6ed"),
168
- f("0379be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
169
- f(
170
- "54c4a33c6423d689378f160a7ff8b61330444abb58fb470f96ea16d99d4a2fed07082304410efa6b2943111b6a4e0aaa7b7db55a07e9861d1fb3cb1f421044a5"
171
- )
172
- )
173
- ), b.signSchnorr && a(
174
- Buffer.from(
175
- b.signSchnorr(
176
- f("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),
177
- f("c90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b14e5c9"),
178
- f("c87aa53824b4d7ae2eb035a2b5bbbccc080e76cdc6d1692c4b0b62d798e6d906")
179
- )
180
- ).equals(
181
- f(
182
- "5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"
183
- )
184
- )
185
- ), b.verifySchnorr && a(
186
- b.verifySchnorr(
187
- f("7e2d58d8b3bcdf1abadec7829054f90dda9805aab56c77333024b9d0a508b75c"),
188
- f("dd308afec5777e13121fa72b9cc1b7cc0139715309b086c960e18fd969774eb8"),
189
- f(
190
- "5831aaeed7b44bb74e5eab94ba9d4294c49bcf2a60728d8b4c200f50dd313c1bab745879a5ad954a72c45a91c3a51d3c7adea98d82f8481e0e1e03674a6f3fb7"
191
- )
192
- )
193
- );
194
- }
195
- d.testEcc = c;
196
- function a(b) {
197
- if (!b) throw new Error("ecc library invalid");
198
- }
1
+ const t = {
2
+ secretMismatch: "invalid secret",
3
+ secretHashLenMismatch: "secret hash should be 32 bytes",
4
+ pubkeyLenMismatch: "pubkey should be 32 bytes",
5
+ zeroOrNegativeExpiry: "expiry should be greater than 0",
6
+ htlcAddressGenerationFailed: "failed to generate htlc address",
7
+ notFunded: "address not funded",
8
+ noCounterpartySigs: "counterparty signatures are required",
9
+ counterPartySigNotFound: (e) => "counterparty signature not found for utxo " + e,
10
+ invalidCounterpartySigForUTXO: (e) => "invalid counterparty signature for utxo " + e,
11
+ htlcNotExpired: (e) => `HTLC not expired, need more ${e} blocks`,
12
+ controlBlockGenerationFailed: "failed to generate control block",
13
+ invalidLeaf: "invalid leaf"
14
+ };
199
15
  export {
200
- d as default
16
+ t as htlcErrors
201
17
  };
package/dist/index39.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const z=require("./index53.cjs"),r=require("./index54.cjs");function o(e,{size:n}){if(r.size(e)>n)throw new z.SizeOverflowError({givenSize:r.size(e),maxSize:n})}function s(e,n={}){const{signed:u}=n;n.size&&o(e,{size:n.size});const i=BigInt(e);if(!u)return i;const t=(e.length-2)/2,c=(1n<<BigInt(t)*8n-1n)-1n;return i<=c?i:i-BigInt(`0x${"f".padStart(t*2,"f")}`)-1n}function f(e,n={}){return Number(s(e,n))}exports.assertSize=o;exports.hexToBigInt=s;exports.hexToNumber=f;
package/dist/index39.js CHANGED
@@ -1,4 +1,26 @@
1
- var r = {};
1
+ import { SizeOverflowError as u } from "./index53.js";
2
+ import { size as t } from "./index54.js";
3
+ function s(n, { size: i }) {
4
+ if (t(n) > i)
5
+ throw new u({
6
+ givenSize: t(n),
7
+ maxSize: i
8
+ });
9
+ }
10
+ function z(n, i = {}) {
11
+ const { signed: o } = i;
12
+ i.size && s(n, { size: i.size });
13
+ const e = BigInt(n);
14
+ if (!o)
15
+ return e;
16
+ const r = (n.length - 2) / 2, f = (1n << BigInt(r) * 8n - 1n) - 1n;
17
+ return e <= f ? e : e - BigInt(`0x${"f".padStart(r * 2, "f")}`) - 1n;
18
+ }
19
+ function g(n, i = {}) {
20
+ return Number(z(n, i));
21
+ }
2
22
  export {
3
- r as __exports
23
+ s as assertSize,
24
+ z as hexToBigInt,
25
+ g as hexToNumber
4
26
  };
package/dist/index40.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("./index55.cjs"),u=require("./index41.cjs");function i(e){var t;const s=(t=e.transactions)==null?void 0:t.map(n=>typeof n=="string"?n:u.formatTransaction(n));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:s,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const f=a.defineFormatter("block",i);exports.defineBlock=f;exports.formatBlock=i;
package/dist/index40.js CHANGED
@@ -1,4 +1,28 @@
1
- var e = {};
1
+ import { defineFormatter as t } from "./index55.js";
2
+ import { formatTransaction as a } from "./index41.js";
3
+ function f(e) {
4
+ var i;
5
+ const s = (i = e.transactions) == null ? void 0 : i.map((n) => typeof n == "string" ? n : a(n));
6
+ return {
7
+ ...e,
8
+ baseFeePerGas: e.baseFeePerGas ? BigInt(e.baseFeePerGas) : null,
9
+ blobGasUsed: e.blobGasUsed ? BigInt(e.blobGasUsed) : void 0,
10
+ difficulty: e.difficulty ? BigInt(e.difficulty) : void 0,
11
+ excessBlobGas: e.excessBlobGas ? BigInt(e.excessBlobGas) : void 0,
12
+ gasLimit: e.gasLimit ? BigInt(e.gasLimit) : void 0,
13
+ gasUsed: e.gasUsed ? BigInt(e.gasUsed) : void 0,
14
+ hash: e.hash ? e.hash : null,
15
+ logsBloom: e.logsBloom ? e.logsBloom : null,
16
+ nonce: e.nonce ? e.nonce : null,
17
+ number: e.number ? BigInt(e.number) : null,
18
+ size: e.size ? BigInt(e.size) : void 0,
19
+ timestamp: e.timestamp ? BigInt(e.timestamp) : void 0,
20
+ transactions: s,
21
+ totalDifficulty: e.totalDifficulty ? BigInt(e.totalDifficulty) : null
22
+ };
23
+ }
24
+ const m = /* @__PURE__ */ t("block", f);
2
25
  export {
3
- e as __exports
26
+ m as defineBlock,
27
+ f as formatBlock
4
28
  };
package/dist/index41.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});var e={};exports.__exports=e;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index39.cjs"),l=require("./index55.cjs"),d={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function u(e){const r={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?i.hexToNumber(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?i.hexToNumber(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?d[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(r.authorizationList=m(e.authorizationList)),r.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof r.v=="bigint"){if(r.v===0n||r.v===27n)return 0;if(r.v===1n||r.v===28n)return 1;if(r.v>=35n)return r.v%2n===0n?1:0}})(),r.type==="legacy"&&(delete r.accessList,delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.yParity),r.type==="eip2930"&&(delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas),r.type==="eip1559"&&delete r.maxFeePerBlobGas,r}const n=l.defineFormatter("transaction",u);function m(e){return e.map(r=>({contractAddress:r.address,chainId:Number(r.chainId),nonce:Number(r.nonce),r:r.r,s:r.s,yParity:Number(r.yParity)}))}exports.defineTransaction=n;exports.formatTransaction=u;exports.transactionType=d;
package/dist/index41.js CHANGED
@@ -1,4 +1,57 @@
1
- var e = {};
1
+ import { hexToNumber as r } from "./index39.js";
2
+ import { defineFormatter as i } from "./index55.js";
3
+ const u = {
4
+ "0x0": "legacy",
5
+ "0x1": "eip2930",
6
+ "0x2": "eip1559",
7
+ "0x3": "eip4844",
8
+ "0x4": "eip7702"
9
+ };
10
+ function l(e) {
11
+ const d = {
12
+ ...e,
13
+ blockHash: e.blockHash ? e.blockHash : null,
14
+ blockNumber: e.blockNumber ? BigInt(e.blockNumber) : null,
15
+ chainId: e.chainId ? r(e.chainId) : void 0,
16
+ gas: e.gas ? BigInt(e.gas) : void 0,
17
+ gasPrice: e.gasPrice ? BigInt(e.gasPrice) : void 0,
18
+ maxFeePerBlobGas: e.maxFeePerBlobGas ? BigInt(e.maxFeePerBlobGas) : void 0,
19
+ maxFeePerGas: e.maxFeePerGas ? BigInt(e.maxFeePerGas) : void 0,
20
+ maxPriorityFeePerGas: e.maxPriorityFeePerGas ? BigInt(e.maxPriorityFeePerGas) : void 0,
21
+ nonce: e.nonce ? r(e.nonce) : void 0,
22
+ to: e.to ? e.to : null,
23
+ transactionIndex: e.transactionIndex ? Number(e.transactionIndex) : null,
24
+ type: e.type ? u[e.type] : void 0,
25
+ typeHex: e.type ? e.type : void 0,
26
+ value: e.value ? BigInt(e.value) : void 0,
27
+ v: e.v ? BigInt(e.v) : void 0
28
+ };
29
+ return e.authorizationList && (d.authorizationList = m(e.authorizationList)), d.yParity = (() => {
30
+ if (e.yParity)
31
+ return Number(e.yParity);
32
+ if (typeof d.v == "bigint") {
33
+ if (d.v === 0n || d.v === 27n)
34
+ return 0;
35
+ if (d.v === 1n || d.v === 28n)
36
+ return 1;
37
+ if (d.v >= 35n)
38
+ return d.v % 2n === 0n ? 1 : 0;
39
+ }
40
+ })(), d.type === "legacy" && (delete d.accessList, delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas, delete d.yParity), d.type === "eip2930" && (delete d.maxFeePerBlobGas, delete d.maxFeePerGas, delete d.maxPriorityFeePerGas), d.type === "eip1559" && delete d.maxFeePerBlobGas, d;
41
+ }
42
+ const P = /* @__PURE__ */ i("transaction", l);
43
+ function m(e) {
44
+ return e.map((d) => ({
45
+ contractAddress: d.address,
46
+ chainId: Number(d.chainId),
47
+ nonce: Number(d.nonce),
48
+ r: d.r,
49
+ s: d.s,
50
+ yParity: Number(d.yParity)
51
+ }));
52
+ }
2
53
  export {
3
- e as __exports
54
+ P as defineTransaction,
55
+ l as formatTransaction,
56
+ u as transactionType
4
57
  };
package/dist/index42.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index59.cjs");class r extends s.BaseError{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}exports.InvalidAddressError=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index39.cjs"),o=require("./index55.cjs"),b=require("./index56.cjs"),f=require("./index41.cjs"),l={"0x0":"reverted","0x1":"success"};function u(e){const s={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>b.formatLog(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?d.hexToNumber(e.transactionIndex):null,status:e.status?l[e.status]:null,type:e.type?f.transactionType[e.type]||e.type:null};return e.blobGasPrice&&(s.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(s.blobGasUsed=BigInt(e.blobGasUsed)),s}const g=o.defineFormatter("transactionReceipt",u);exports.defineTransactionReceipt=g;exports.formatTransactionReceipt=u;exports.receiptStatuses=l;
package/dist/index42.js CHANGED
@@ -1,15 +1,30 @@
1
- import { BaseError as r } from "./index59.js";
2
- class d extends r {
3
- constructor({ address: s }) {
4
- super(`Address "${s}" is invalid.`, {
5
- metaMessages: [
6
- "- Address must be a hex value of 20 bytes (40 hex characters).",
7
- "- Address must match its checksum counterpart."
8
- ],
9
- name: "InvalidAddressError"
10
- });
11
- }
1
+ import { hexToNumber as d } from "./index39.js";
2
+ import { defineFormatter as b } from "./index55.js";
3
+ import { formatLog as m } from "./index56.js";
4
+ import { transactionType as o } from "./index41.js";
5
+ const f = {
6
+ "0x0": "reverted",
7
+ "0x1": "success"
8
+ };
9
+ function r(l) {
10
+ const s = {
11
+ ...l,
12
+ blockNumber: l.blockNumber ? BigInt(l.blockNumber) : null,
13
+ contractAddress: l.contractAddress ? l.contractAddress : null,
14
+ cumulativeGasUsed: l.cumulativeGasUsed ? BigInt(l.cumulativeGasUsed) : null,
15
+ effectiveGasPrice: l.effectiveGasPrice ? BigInt(l.effectiveGasPrice) : null,
16
+ gasUsed: l.gasUsed ? BigInt(l.gasUsed) : null,
17
+ logs: l.logs ? l.logs.map((u) => m(u)) : null,
18
+ to: l.to ? l.to : null,
19
+ transactionIndex: l.transactionIndex ? d(l.transactionIndex) : null,
20
+ status: l.status ? f[l.status] : null,
21
+ type: l.type ? o[l.type] || l.type : null
22
+ };
23
+ return l.blobGasPrice && (s.blobGasPrice = BigInt(l.blobGasPrice)), l.blobGasUsed && (s.blobGasUsed = BigInt(l.blobGasUsed)), s;
12
24
  }
25
+ const U = /* @__PURE__ */ b("transactionReceipt", r);
13
26
  export {
14
- d as InvalidAddressError
27
+ U as defineTransactionReceipt,
28
+ r as formatTransactionReceipt,
29
+ f as receiptStatuses
15
30
  };
package/dist/index43.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index73.cjs"),i=require("./index74.cjs"),o=/^0x[a-fA-F0-9]{40}$/,t=new c.LruMap(8192);function f(e,n){const{strict:s=!0}=n??{},r=`${e}.${s}`;if(t.has(r))return t.get(r);const u=o.test(e)?e.toLowerCase()===e?!0:s?i.checksumAddress(e)===e:!0:!1;return t.set(r,u),u}exports.isAddress=f;exports.isAddressCache=t;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./index62.cjs"),J=require("./index63.cjs"),j=require("./index64.cjs");var d=_.errors,u=J.native,h=d.tfJSON,S=d.TfTypeError,b=d.TfPropertyTypeError,v=d.tfSubError,w=d.getValueTypeName,g={arrayOf:function(n,r){n=l(n),r=r||{};function t(f,i){return!u.Array(f)||u.Nil(f)||r.minLength!==void 0&&f.length<r.minLength||r.maxLength!==void 0&&f.length>r.maxLength||r.length!==void 0&&f.length!==r.length?!1:f.every(function(a,o){try{return c(n,a,i)}catch(m){throw v(m,o)}})}return t.toJSON=function(){var f="["+h(n)+"]";return r.length!==void 0?f+="{"+r.length+"}":(r.minLength!==void 0||r.maxLength!==void 0)&&(f+="{"+(r.minLength===void 0?0:r.minLength)+","+(r.maxLength===void 0?1/0:r.maxLength)+"}"),f},t},maybe:function e(n){n=l(n);function r(t,f){return u.Nil(t)||n(t,f,e)}return r.toJSON=function(){return"?"+h(n)},r},map:function(n,r){n=l(n),r&&(r=l(r));function t(f,i){if(!u.Object(f)||u.Nil(f))return!1;for(var a in f){try{r&&c(r,a,i)}catch(m){throw v(m,a,"key")}try{var o=f[a];c(n,o,i)}catch(m){throw v(m,a)}}return!0}return r?t.toJSON=function(){return"{"+h(r)+": "+h(n)+"}"}:t.toJSON=function(){return"{"+h(n)+"}"},t},object:function(n){var r={};for(var t in n)r[t]=l(n[t]);function f(i,a){if(!u.Object(i)||u.Nil(i))return!1;var o;try{for(o in r){var m=r[o],E=i[o];c(m,E,a)}}catch(L){throw v(L,o)}if(a){for(o in i)if(!r[o])throw new b(void 0,o)}return!0}return f.toJSON=function(){return h(r)},f},anyOf:function(){var n=[].slice.call(arguments).map(l);function r(t,f){return n.some(function(i){try{return c(i,t,f)}catch{return!1}})}return r.toJSON=function(){return n.map(h).join("|")},r},allOf:function(){var n=[].slice.call(arguments).map(l);function r(t,f){return n.every(function(i){try{return c(i,t,f)}catch{return!1}})}return r.toJSON=function(){return n.map(h).join(" & ")},r},quacksLike:function(n){function r(t){return n===w(t)}return r.toJSON=function(){return n},r},tuple:function(){var n=[].slice.call(arguments).map(l);function r(t,f){return u.Nil(t)||u.Nil(t.length)||f&&t.length!==n.length?!1:n.every(function(i,a){try{return c(i,t[a],f)}catch(o){throw v(o,a)}})}return r.toJSON=function(){return"("+n.map(h).join(", ")+")"},r},value:function(n){function r(t){return t===n}return r.toJSON=function(){return n},r}};g.oneOf=g.anyOf;function l(e){if(u.String(e))return e[0]==="?"?g.maybe(e.slice(1)):u[e]||g.quacksLike(e);if(e&&u.Object(e)){if(u.Array(e)){if(e.length!==1)throw new TypeError("Expected compile() parameter of type Array of length 1");return g.arrayOf(e[0])}return g.object(e)}else if(u.Function(e))return e;return g.value(e)}function c(e,n,r,t){if(u.Function(e)){if(e(n,r))return!0;throw new S(t||e,n)}return c(l(e),n,r)}for(var O in u)c[O]=u[O];for(O in g)c[O]=g[O];var s=j.__require();for(O in s)c[O]=s[O];c.compile=l;c.TfTypeError=S;c.TfPropertyTypeError=b;var N=c;exports.typeforce_1=N;