@gardenfi/orderbook 0.2.0-beta.12 → 0.2.0-beta.13

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 (93) hide show
  1. package/dist/index.cjs +1 -1
  2. package/dist/index.js +7 -8
  3. package/dist/index22.cjs +1 -1
  4. package/dist/index22.js +1 -1
  5. package/dist/index23.cjs +1 -1
  6. package/dist/index23.js +2 -2
  7. package/dist/index25.cjs +1 -1
  8. package/dist/index25.js +1 -1
  9. package/dist/index26.cjs +1 -1
  10. package/dist/index26.js +3 -3
  11. package/dist/index27.cjs +1 -1
  12. package/dist/index27.js +10 -10
  13. package/dist/index28.cjs +1 -1
  14. package/dist/index28.js +1 -1
  15. package/dist/index29.cjs +1 -1
  16. package/dist/index29.js +1 -1
  17. package/dist/index32.cjs +2 -1
  18. package/dist/index32.js +58 -33
  19. package/dist/index33.cjs +1 -2
  20. package/dist/index33.js +15 -53
  21. package/dist/index34.cjs +1 -1
  22. package/dist/index34.js +13 -127
  23. package/dist/index35.cjs +1 -1
  24. package/dist/index35.js +31 -52
  25. package/dist/index36.cjs +1 -2
  26. package/dist/index36.js +126 -41
  27. package/dist/index37.cjs +1 -1
  28. package/dist/index37.js +55 -8
  29. package/dist/index38.cjs +2 -1
  30. package/dist/index38.js +41 -9
  31. package/dist/index39.cjs +1 -1
  32. package/dist/index39.js +8 -11
  33. package/dist/index40.cjs +1 -1
  34. package/dist/index40.js +10 -13
  35. package/dist/index41.cjs +1 -1
  36. package/dist/index41.js +11 -6
  37. package/dist/index42.cjs +1 -1
  38. package/dist/index42.js +13 -17
  39. package/dist/index43.cjs +1 -1
  40. package/dist/index43.js +6 -78
  41. package/dist/index44.cjs +1 -1
  42. package/dist/index44.js +17 -14
  43. package/dist/index45.cjs +1 -1
  44. package/dist/index45.js +75 -15
  45. package/dist/index46.cjs +1 -1
  46. package/dist/index46.js +14 -3
  47. package/dist/index47.cjs +1 -1
  48. package/dist/index47.js +19 -2
  49. package/dist/index48.cjs +1 -1
  50. package/dist/index48.js +4 -2
  51. package/dist/index49.cjs +1 -1
  52. package/dist/index49.js +2 -7
  53. package/dist/index5.cjs +1 -1
  54. package/dist/index5.js +1 -9
  55. package/dist/index50.cjs +1 -2
  56. package/dist/index50.js +2 -35
  57. package/dist/index51.cjs +1 -1
  58. package/dist/index51.js +6 -5
  59. package/dist/index52.cjs +2 -1
  60. package/dist/index52.js +32 -19
  61. package/dist/index53.cjs +1 -1
  62. package/dist/index53.js +5 -13
  63. package/dist/index54.cjs +1 -1
  64. package/dist/index54.js +6 -20
  65. package/dist/index55.cjs +1 -1
  66. package/dist/index55.js +1 -1
  67. package/dist/index56.cjs +1 -1
  68. package/dist/index56.js +6 -6
  69. package/dist/index57.cjs +1 -1
  70. package/dist/index57.js +30 -110
  71. package/dist/index58.cjs +1 -1
  72. package/dist/index58.js +2 -7
  73. package/dist/index59.cjs +1 -1
  74. package/dist/index59.js +35 -30
  75. package/dist/index60.cjs +1 -1
  76. package/dist/index60.js +29 -2
  77. package/dist/index61.cjs +1 -1
  78. package/dist/index61.js +14 -31
  79. package/dist/index62.cjs +1 -1
  80. package/dist/index62.js +6 -28
  81. package/dist/index63.cjs +1 -1
  82. package/dist/index63.js +112 -6
  83. package/dist/index66.cjs +1 -1
  84. package/dist/index66.js +93 -50
  85. package/dist/index67.cjs +1 -1
  86. package/dist/index67.js +5 -35
  87. package/dist/index68.cjs +1 -1
  88. package/dist/index68.js +62 -5
  89. package/dist/index69.cjs +1 -1
  90. package/dist/index69.js +31 -101
  91. package/dist/src/index.d.ts +1 -1
  92. package/dist/src/lib/constants.d.ts +0 -1
  93. package/package.json +1 -1
package/dist/index66.js CHANGED
@@ -1,64 +1,107 @@
1
- import { exists as g, output as d } from "./index70.js";
2
- import { Hash as b, createView as p, toBytes as a } from "./index67.js";
3
- function w(o, t, s, i) {
4
- if (typeof o.setBigUint64 == "function")
5
- return o.setBigUint64(t, s, i);
6
- const n = BigInt(32), h = BigInt(4294967295), e = Number(s >> n & h), r = Number(s & h), c = i ? 4 : 0, u = i ? 0 : 4;
7
- o.setUint32(t + c, e, i), o.setUint32(t + u, r, i);
1
+ import { number as d, exists as k, bytes as B, output as A } from "./index70.js";
2
+ import { split as H, rotlBH as m, rotlSH as S, rotlBL as T, rotlSL as F } from "./index71.js";
3
+ import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./index69.js";
4
+ const y = [], L = [], b = [], M = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), R = /* @__PURE__ */ BigInt(2), j = /* @__PURE__ */ BigInt(7), C = /* @__PURE__ */ BigInt(256), q = /* @__PURE__ */ BigInt(113);
5
+ for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
6
+ [s, n] = [n, (2 * s + 3 * n) % 5], y.push(2 * (5 * n + s)), L.push((e + 1) * (e + 2) / 2 % 64);
7
+ let o = M;
8
+ for (let r = 0; r < 7; r++)
9
+ t = (t << f ^ (t >> j) * q) % C, t & R && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
10
+ b.push(o);
8
11
  }
9
- const B = (o, t, s) => o & t ^ ~o & s, L = (o, t, s) => o & t ^ o & s ^ t & s;
10
- class U extends b {
11
- constructor(t, s, i, n) {
12
- super(), this.blockLen = t, this.outputLen = s, this.padOffset = i, this.isLE = n, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(t), this.view = p(this.buffer);
12
+ const [v, z] = /* @__PURE__ */ H(b, !0), O = (e, t, s) => s > 32 ? m(e, t, s) : S(e, t, s), w = (e, t, s) => s > 32 ? T(e, t, s) : F(e, t, s);
13
+ function D(e, t = 24) {
14
+ const s = new Uint32Array(10);
15
+ for (let n = 24 - t; n < 24; n++) {
16
+ for (let i = 0; i < 10; i++)
17
+ s[i] = e[i] ^ e[i + 10] ^ e[i + 20] ^ e[i + 30] ^ e[i + 40];
18
+ for (let i = 0; i < 10; i += 2) {
19
+ const h = (i + 8) % 10, l = (i + 2) % 10, u = s[l], c = s[l + 1], _ = O(u, c, 1) ^ s[h], g = w(u, c, 1) ^ s[h + 1];
20
+ for (let a = 0; a < 50; a += 10)
21
+ e[i + a] ^= _, e[i + a + 1] ^= g;
22
+ }
23
+ let o = e[2], r = e[3];
24
+ for (let i = 0; i < 24; i++) {
25
+ const h = L[i], l = O(o, r, h), u = w(o, r, h), c = y[i];
26
+ o = e[c], r = e[c + 1], e[c] = l, e[c + 1] = u;
27
+ }
28
+ for (let i = 0; i < 50; i += 10) {
29
+ for (let h = 0; h < 10; h++)
30
+ s[h] = e[i + h];
31
+ for (let h = 0; h < 10; h++)
32
+ e[i + h] ^= ~s[(h + 2) % 10] & s[(h + 4) % 10];
33
+ }
34
+ e[0] ^= v[n], e[1] ^= z[n];
35
+ }
36
+ s.fill(0);
37
+ }
38
+ class p extends E {
39
+ // NOTE: we accept arguments in bytes instead of bits here.
40
+ constructor(t, s, n, o = !1, r = 24) {
41
+ if (super(), this.blockLen = t, this.suffix = s, this.outputLen = n, this.enableXOF = o, this.rounds = r, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, d(n), 0 >= this.blockLen || this.blockLen >= 200)
42
+ throw new Error("Sha3 supports only keccak-f1600 function");
43
+ this.state = new Uint8Array(200), this.state32 = U(this.state);
44
+ }
45
+ keccak() {
46
+ x || I(this.state32), D(this.state32, this.rounds), x || I(this.state32), this.posOut = 0, this.pos = 0;
13
47
  }
14
48
  update(t) {
15
- g(this);
16
- const { view: s, buffer: i, blockLen: n } = this;
17
- t = a(t);
18
- const h = t.length;
19
- for (let e = 0; e < h; ) {
20
- const r = Math.min(n - this.pos, h - e);
21
- if (r === n) {
22
- const c = p(t);
23
- for (; n <= h - e; e += n)
24
- this.process(c, e);
25
- continue;
26
- }
27
- i.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === n && (this.process(s, 0), this.pos = 0);
49
+ k(this);
50
+ const { blockLen: s, state: n } = this;
51
+ t = P(t);
52
+ const o = t.length;
53
+ for (let r = 0; r < o; ) {
54
+ const i = Math.min(s - this.pos, o - r);
55
+ for (let h = 0; h < i; h++)
56
+ n[this.pos++] ^= t[r++];
57
+ this.pos === s && this.keccak();
28
58
  }
29
- return this.length += t.length, this.roundClean(), this;
59
+ return this;
60
+ }
61
+ finish() {
62
+ if (this.finished)
63
+ return;
64
+ this.finished = !0;
65
+ const { state: t, suffix: s, pos: n, blockLen: o } = this;
66
+ t[n] ^= s, s & 128 && n === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
67
+ }
68
+ writeInto(t) {
69
+ k(this, !1), B(t), this.finish();
70
+ const s = this.state, { blockLen: n } = this;
71
+ for (let o = 0, r = t.length; o < r; ) {
72
+ this.posOut >= n && this.keccak();
73
+ const i = Math.min(n - this.posOut, r - o);
74
+ t.set(s.subarray(this.posOut, this.posOut + i), o), this.posOut += i, o += i;
75
+ }
76
+ return t;
77
+ }
78
+ xofInto(t) {
79
+ if (!this.enableXOF)
80
+ throw new Error("XOF is not possible for this instance");
81
+ return this.writeInto(t);
82
+ }
83
+ xof(t) {
84
+ return d(t), this.xofInto(new Uint8Array(t));
30
85
  }
31
86
  digestInto(t) {
32
- g(this), d(t, this), this.finished = !0;
33
- const { buffer: s, view: i, blockLen: n, isLE: h } = this;
34
- let { pos: e } = this;
35
- s[e++] = 128, this.buffer.subarray(e).fill(0), this.padOffset > n - e && (this.process(i, 0), e = 0);
36
- for (let f = e; f < n; f++)
37
- s[f] = 0;
38
- w(i, n - 8, BigInt(this.length * 8), h), this.process(i, 0);
39
- const r = p(t), c = this.outputLen;
40
- if (c % 4)
41
- throw new Error("_sha2: outputLen should be aligned to 32bit");
42
- const u = c / 4, l = this.get();
43
- if (u > l.length)
44
- throw new Error("_sha2: outputLen bigger than state");
45
- for (let f = 0; f < u; f++)
46
- r.setUint32(4 * f, l[f], h);
87
+ if (A(t, this), this.finished)
88
+ throw new Error("digest() was already called");
89
+ return this.writeInto(t), this.destroy(), t;
47
90
  }
48
91
  digest() {
49
- const { buffer: t, outputLen: s } = this;
50
- this.digestInto(t);
51
- const i = t.slice(0, s);
52
- return this.destroy(), i;
92
+ return this.digestInto(new Uint8Array(this.outputLen));
93
+ }
94
+ destroy() {
95
+ this.destroyed = !0, this.state.fill(0);
53
96
  }
54
97
  _cloneInto(t) {
55
- t || (t = new this.constructor()), t.set(...this.get());
56
- const { blockLen: s, buffer: i, length: n, finished: h, destroyed: e, pos: r } = this;
57
- return t.length = n, t.pos = r, t.finished = h, t.destroyed = e, n % s && t.buffer.set(i), t;
98
+ const { blockLen: s, suffix: n, outputLen: o, rounds: r, enableXOF: i } = this;
99
+ return t || (t = new p(s, n, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = n, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
58
100
  }
59
101
  }
102
+ const G = (e, t, s) => X(() => new p(t, e, s)), Q = /* @__PURE__ */ G(1, 136, 256 / 8);
60
103
  export {
61
- B as Chi,
62
- U as HashMD,
63
- L as Maj
104
+ p as Keccak,
105
+ D as keccakP,
106
+ Q as keccak_256
64
107
  };
package/dist/index67.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index70.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),i=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),y=(t,e)=>t<<32-e|t>>>e,b=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,o=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function p(t){for(let e=0;e<t.length;e++)t[e]=o(t[e])}function f(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function r(t){return typeof t=="string"&&(t=f(t)),s.bytes(t),t}class w{clone(){return this._cloneInto()}}function l(t){const e=c=>t().update(r(c)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}exports.Hash=w;exports.byteSwap=o;exports.byteSwap32=p;exports.createView=i;exports.isLE=b;exports.rotr=y;exports.toBytes=r;exports.u32=u;exports.utf8ToBytes=f;exports.wrapConstructor=l;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=6,s=32,e=4096,n=s*e,o=n*t-1-1*e*t;exports.bytesPerBlob=n;exports.bytesPerFieldElement=s;exports.fieldElementsPerBlob=e;exports.maxBytesPerTransaction=o;
package/dist/index67.js CHANGED
@@ -1,37 +1,7 @@
1
- import { bytes as f } from "./index70.js";
2
- /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
- const s = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), y = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), p = (t, e) => t << 32 - e | t >>> e, b = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, c = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
4
- function w(t) {
5
- for (let e = 0; e < t.length; e++)
6
- t[e] = c(t[e]);
7
- }
8
- function r(t) {
9
- if (typeof t != "string")
10
- throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
11
- return new Uint8Array(new TextEncoder().encode(t));
12
- }
13
- function u(t) {
14
- return typeof t == "string" && (t = r(t)), f(t), t;
15
- }
16
- class x {
17
- // Safe version that clones internal state
18
- clone() {
19
- return this._cloneInto();
20
- }
21
- }
22
- function g(t) {
23
- const e = (o) => t().update(u(o)).digest(), n = t();
24
- return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
25
- }
1
+ const e = 32, s = 4096, t = 131072, l = 761855;
26
2
  export {
27
- x as Hash,
28
- c as byteSwap,
29
- w as byteSwap32,
30
- y as createView,
31
- b as isLE,
32
- p as rotr,
33
- u as toBytes,
34
- s as u32,
35
- r as utf8ToBytes,
36
- g as wrapConstructor
3
+ t as bytesPerBlob,
4
+ e as bytesPerFieldElement,
5
+ s as fieldElementsPerBlob,
6
+ l as maxBytesPerTransaction
37
7
  };
package/dist/index68.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=6,s=32,e=4096,n=s*e,o=n*t-1-1*e*t;exports.bytesPerBlob=n;exports.bytesPerFieldElement=s;exports.fieldElementsPerBlob=e;exports.maxBytesPerTransaction=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./index70.cjs"),u=require("./index69.cjs");function a(o,t,s,i){if(typeof o.setBigUint64=="function")return o.setBigUint64(t,s,i);const n=BigInt(32),h=BigInt(4294967295),e=Number(s>>n&h),r=Number(s&h),c=i?4:0,l=i?0:4;o.setUint32(t+c,e,i),o.setUint32(t+l,r,i)}const d=(o,t,s)=>o&t^~o&s,b=(o,t,s)=>o&t^o&s^t&s;class w extends u.Hash{constructor(t,s,i,n){super(),this.blockLen=t,this.outputLen=s,this.padOffset=i,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=u.createView(this.buffer)}update(t){p.exists(this);const{view:s,buffer:i,blockLen:n}=this;t=u.toBytes(t);const h=t.length;for(let e=0;e<h;){const r=Math.min(n-this.pos,h-e);if(r===n){const c=u.createView(t);for(;n<=h-e;e+=n)this.process(c,e);continue}i.set(t.subarray(e,e+r),this.pos),this.pos+=r,e+=r,this.pos===n&&(this.process(s,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){p.exists(this),p.output(t,this),this.finished=!0;const{buffer:s,view:i,blockLen:n,isLE:h}=this;let{pos:e}=this;s[e++]=128,this.buffer.subarray(e).fill(0),this.padOffset>n-e&&(this.process(i,0),e=0);for(let f=e;f<n;f++)s[f]=0;a(i,n-8,BigInt(this.length*8),h),this.process(i,0);const r=u.createView(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const l=c/4,g=this.get();if(l>g.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<l;f++)r.setUint32(4*f,g[f],h)}digest(){const{buffer:t,outputLen:s}=this;this.digestInto(t);const i=t.slice(0,s);return this.destroy(),i}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:s,buffer:i,length:n,finished:h,destroyed:e,pos:r}=this;return t.length=n,t.pos=r,t.finished=h,t.destroyed=e,n%s&&t.buffer.set(i),t}}exports.Chi=d;exports.HashMD=w;exports.Maj=b;
package/dist/index68.js CHANGED
@@ -1,7 +1,64 @@
1
- const e = 32, s = 4096, t = 131072, l = 761855;
1
+ import { exists as g, output as d } from "./index70.js";
2
+ import { Hash as b, createView as p, toBytes as a } from "./index69.js";
3
+ function w(o, t, s, i) {
4
+ if (typeof o.setBigUint64 == "function")
5
+ return o.setBigUint64(t, s, i);
6
+ const n = BigInt(32), h = BigInt(4294967295), e = Number(s >> n & h), r = Number(s & h), c = i ? 4 : 0, u = i ? 0 : 4;
7
+ o.setUint32(t + c, e, i), o.setUint32(t + u, r, i);
8
+ }
9
+ const B = (o, t, s) => o & t ^ ~o & s, L = (o, t, s) => o & t ^ o & s ^ t & s;
10
+ class U extends b {
11
+ constructor(t, s, i, n) {
12
+ super(), this.blockLen = t, this.outputLen = s, this.padOffset = i, this.isLE = n, this.finished = !1, this.length = 0, this.pos = 0, this.destroyed = !1, this.buffer = new Uint8Array(t), this.view = p(this.buffer);
13
+ }
14
+ update(t) {
15
+ g(this);
16
+ const { view: s, buffer: i, blockLen: n } = this;
17
+ t = a(t);
18
+ const h = t.length;
19
+ for (let e = 0; e < h; ) {
20
+ const r = Math.min(n - this.pos, h - e);
21
+ if (r === n) {
22
+ const c = p(t);
23
+ for (; n <= h - e; e += n)
24
+ this.process(c, e);
25
+ continue;
26
+ }
27
+ i.set(t.subarray(e, e + r), this.pos), this.pos += r, e += r, this.pos === n && (this.process(s, 0), this.pos = 0);
28
+ }
29
+ return this.length += t.length, this.roundClean(), this;
30
+ }
31
+ digestInto(t) {
32
+ g(this), d(t, this), this.finished = !0;
33
+ const { buffer: s, view: i, blockLen: n, isLE: h } = this;
34
+ let { pos: e } = this;
35
+ s[e++] = 128, this.buffer.subarray(e).fill(0), this.padOffset > n - e && (this.process(i, 0), e = 0);
36
+ for (let f = e; f < n; f++)
37
+ s[f] = 0;
38
+ w(i, n - 8, BigInt(this.length * 8), h), this.process(i, 0);
39
+ const r = p(t), c = this.outputLen;
40
+ if (c % 4)
41
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
42
+ const u = c / 4, l = this.get();
43
+ if (u > l.length)
44
+ throw new Error("_sha2: outputLen bigger than state");
45
+ for (let f = 0; f < u; f++)
46
+ r.setUint32(4 * f, l[f], h);
47
+ }
48
+ digest() {
49
+ const { buffer: t, outputLen: s } = this;
50
+ this.digestInto(t);
51
+ const i = t.slice(0, s);
52
+ return this.destroy(), i;
53
+ }
54
+ _cloneInto(t) {
55
+ t || (t = new this.constructor()), t.set(...this.get());
56
+ const { blockLen: s, buffer: i, length: n, finished: h, destroyed: e, pos: r } = this;
57
+ return t.length = n, t.pos = r, t.finished = h, t.destroyed = e, n % s && t.buffer.set(i), t;
58
+ }
59
+ }
2
60
  export {
3
- t as bytesPerBlob,
4
- e as bytesPerFieldElement,
5
- s as fieldElementsPerBlob,
6
- l as maxBytesPerTransaction
61
+ B as Chi,
62
+ U as HashMD,
63
+ L as Maj
7
64
  };
package/dist/index69.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index70.cjs"),a=require("./index71.cjs"),c=require("./index67.cjs"),I=[],O=[],w=[],B=BigInt(0),f=BigInt(1),A=BigInt(2),S=BigInt(7),H=BigInt(256),T=BigInt(113);for(let i=0,t=f,s=1,n=0;i<24;i++){[s,n]=[n,(2*s+3*n)%5],I.push(2*(5*n+s)),O.push((i+1)*(i+2)/2%64);let o=B;for(let r=0;r<7;r++)t=(t<<f^(t>>S)*T)%H,t&A&&(o^=f<<(f<<BigInt(r))-f);w.push(o)}const[m,E]=a.split(w,!0),y=(i,t,s)=>s>32?a.rotlBH(i,t,s):a.rotlSH(i,t,s),b=(i,t,s)=>s>32?a.rotlBL(i,t,s):a.rotlSL(i,t,s);function L(i,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let e=0;e<10;e++)s[e]=i[e]^i[e+10]^i[e+20]^i[e+30]^i[e+40];for(let e=0;e<10;e+=2){const h=(e+8)%10,p=(e+2)%10,d=s[p],u=s[p+1],_=y(d,u,1)^s[h],g=b(d,u,1)^s[h+1];for(let k=0;k<50;k+=10)i[e+k]^=_,i[e+k+1]^=g}let o=i[2],r=i[3];for(let e=0;e<24;e++){const h=O[e],p=y(o,r,h),d=b(o,r,h),u=I[e];o=i[u],r=i[u+1],i[u]=p,i[u+1]=d}for(let e=0;e<50;e+=10){for(let h=0;h<10;h++)s[h]=i[e+h];for(let h=0;h<10;h++)i[e+h]^=~s[(h+2)%10]&s[(h+4)%10]}i[0]^=m[n],i[1]^=E[n]}s.fill(0)}class x extends c.Hash{constructor(t,s,n,o=!1,r=24){if(super(),this.blockLen=t,this.suffix=s,this.outputLen=n,this.enableXOF=o,this.rounds=r,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,l.number(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=c.u32(this.state)}keccak(){c.isLE||c.byteSwap32(this.state32),L(this.state32,this.rounds),c.isLE||c.byteSwap32(this.state32),this.posOut=0,this.pos=0}update(t){l.exists(this);const{blockLen:s,state:n}=this;t=c.toBytes(t);const o=t.length;for(let r=0;r<o;){const e=Math.min(s-this.pos,o-r);for(let h=0;h<e;h++)n[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:o}=this;t[n]^=s,s&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){l.exists(this,!1),l.bytes(t),this.finish();const s=this.state,{blockLen:n}=this;for(let o=0,r=t.length;o<r;){this.posOut>=n&&this.keccak();const e=Math.min(n-this.posOut,r-o);t.set(s.subarray(this.posOut,this.posOut+e),o),this.posOut+=e,o+=e}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return l.number(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(l.output(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:o,rounds:r,enableXOF:e}=this;return t||(t=new x(s,n,o,e,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=n,t.outputLen=o,t.enableXOF=e,t.destroyed=this.destroyed,t}}const F=(i,t,s)=>c.wrapConstructor(()=>new x(t,i,s)),P=F(1,136,256/8);exports.Keccak=x;exports.keccakP=L;exports.keccak_256=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index70.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u=t=>new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4)),i=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),y=(t,e)=>t<<32-e|t>>>e,b=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,o=t=>t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255;function p(t){for(let e=0;e<t.length;e++)t[e]=o(t[e])}function f(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function r(t){return typeof t=="string"&&(t=f(t)),s.bytes(t),t}class w{clone(){return this._cloneInto()}}function l(t){const e=c=>t().update(r(c)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}exports.Hash=w;exports.byteSwap=o;exports.byteSwap32=p;exports.createView=i;exports.isLE=b;exports.rotr=y;exports.toBytes=r;exports.u32=u;exports.utf8ToBytes=f;exports.wrapConstructor=l;
package/dist/index69.js CHANGED
@@ -1,107 +1,37 @@
1
- import { number as d, exists as k, bytes as B, output as A } from "./index70.js";
2
- import { split as H, rotlBH as m, rotlSH as S, rotlBL as T, rotlSL as F } from "./index71.js";
3
- import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./index67.js";
4
- const y = [], L = [], b = [], M = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), R = /* @__PURE__ */ BigInt(2), j = /* @__PURE__ */ BigInt(7), C = /* @__PURE__ */ BigInt(256), q = /* @__PURE__ */ BigInt(113);
5
- for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
6
- [s, n] = [n, (2 * s + 3 * n) % 5], y.push(2 * (5 * n + s)), L.push((e + 1) * (e + 2) / 2 % 64);
7
- let o = M;
8
- for (let r = 0; r < 7; r++)
9
- t = (t << f ^ (t >> j) * q) % C, t & R && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
10
- b.push(o);
1
+ import { bytes as f } from "./index70.js";
2
+ /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
3
+ const s = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), y = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), p = (t, e) => t << 32 - e | t >>> e, b = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, c = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
4
+ function w(t) {
5
+ for (let e = 0; e < t.length; e++)
6
+ t[e] = c(t[e]);
11
7
  }
12
- const [v, z] = /* @__PURE__ */ H(b, !0), O = (e, t, s) => s > 32 ? m(e, t, s) : S(e, t, s), w = (e, t, s) => s > 32 ? T(e, t, s) : F(e, t, s);
13
- function D(e, t = 24) {
14
- const s = new Uint32Array(10);
15
- for (let n = 24 - t; n < 24; n++) {
16
- for (let i = 0; i < 10; i++)
17
- s[i] = e[i] ^ e[i + 10] ^ e[i + 20] ^ e[i + 30] ^ e[i + 40];
18
- for (let i = 0; i < 10; i += 2) {
19
- const h = (i + 8) % 10, l = (i + 2) % 10, u = s[l], c = s[l + 1], _ = O(u, c, 1) ^ s[h], g = w(u, c, 1) ^ s[h + 1];
20
- for (let a = 0; a < 50; a += 10)
21
- e[i + a] ^= _, e[i + a + 1] ^= g;
22
- }
23
- let o = e[2], r = e[3];
24
- for (let i = 0; i < 24; i++) {
25
- const h = L[i], l = O(o, r, h), u = w(o, r, h), c = y[i];
26
- o = e[c], r = e[c + 1], e[c] = l, e[c + 1] = u;
27
- }
28
- for (let i = 0; i < 50; i += 10) {
29
- for (let h = 0; h < 10; h++)
30
- s[h] = e[i + h];
31
- for (let h = 0; h < 10; h++)
32
- e[i + h] ^= ~s[(h + 2) % 10] & s[(h + 4) % 10];
33
- }
34
- e[0] ^= v[n], e[1] ^= z[n];
35
- }
36
- s.fill(0);
8
+ function r(t) {
9
+ if (typeof t != "string")
10
+ throw new Error(`utf8ToBytes expected string, got ${typeof t}`);
11
+ return new Uint8Array(new TextEncoder().encode(t));
37
12
  }
38
- class p extends E {
39
- // NOTE: we accept arguments in bytes instead of bits here.
40
- constructor(t, s, n, o = !1, r = 24) {
41
- if (super(), this.blockLen = t, this.suffix = s, this.outputLen = n, this.enableXOF = o, this.rounds = r, this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, d(n), 0 >= this.blockLen || this.blockLen >= 200)
42
- throw new Error("Sha3 supports only keccak-f1600 function");
43
- this.state = new Uint8Array(200), this.state32 = U(this.state);
44
- }
45
- keccak() {
46
- x || I(this.state32), D(this.state32, this.rounds), x || I(this.state32), this.posOut = 0, this.pos = 0;
47
- }
48
- update(t) {
49
- k(this);
50
- const { blockLen: s, state: n } = this;
51
- t = P(t);
52
- const o = t.length;
53
- for (let r = 0; r < o; ) {
54
- const i = Math.min(s - this.pos, o - r);
55
- for (let h = 0; h < i; h++)
56
- n[this.pos++] ^= t[r++];
57
- this.pos === s && this.keccak();
58
- }
59
- return this;
60
- }
61
- finish() {
62
- if (this.finished)
63
- return;
64
- this.finished = !0;
65
- const { state: t, suffix: s, pos: n, blockLen: o } = this;
66
- t[n] ^= s, s & 128 && n === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
67
- }
68
- writeInto(t) {
69
- k(this, !1), B(t), this.finish();
70
- const s = this.state, { blockLen: n } = this;
71
- for (let o = 0, r = t.length; o < r; ) {
72
- this.posOut >= n && this.keccak();
73
- const i = Math.min(n - this.posOut, r - o);
74
- t.set(s.subarray(this.posOut, this.posOut + i), o), this.posOut += i, o += i;
75
- }
76
- return t;
77
- }
78
- xofInto(t) {
79
- if (!this.enableXOF)
80
- throw new Error("XOF is not possible for this instance");
81
- return this.writeInto(t);
82
- }
83
- xof(t) {
84
- return d(t), this.xofInto(new Uint8Array(t));
85
- }
86
- digestInto(t) {
87
- if (A(t, this), this.finished)
88
- throw new Error("digest() was already called");
89
- return this.writeInto(t), this.destroy(), t;
90
- }
91
- digest() {
92
- return this.digestInto(new Uint8Array(this.outputLen));
93
- }
94
- destroy() {
95
- this.destroyed = !0, this.state.fill(0);
96
- }
97
- _cloneInto(t) {
98
- const { blockLen: s, suffix: n, outputLen: o, rounds: r, enableXOF: i } = this;
99
- return t || (t = new p(s, n, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = n, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
13
+ function u(t) {
14
+ return typeof t == "string" && (t = r(t)), f(t), t;
15
+ }
16
+ class x {
17
+ // Safe version that clones internal state
18
+ clone() {
19
+ return this._cloneInto();
100
20
  }
101
21
  }
102
- const G = (e, t, s) => X(() => new p(t, e, s)), Q = /* @__PURE__ */ G(1, 136, 256 / 8);
22
+ function g(t) {
23
+ const e = (o) => t().update(u(o)).digest(), n = t();
24
+ return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
25
+ }
103
26
  export {
104
- p as Keccak,
105
- D as keccakP,
106
- Q as keccak_256
27
+ x as Hash,
28
+ c as byteSwap,
29
+ w as byteSwap32,
30
+ y as createView,
31
+ b as isLE,
32
+ p as rotr,
33
+ u as toBytes,
34
+ s as u32,
35
+ r as utf8ToBytes,
36
+ g as wrapConstructor
107
37
  };
@@ -4,4 +4,4 @@ export type { Chain, EvmChain, Asset } from './lib/asset';
4
4
  export { Chains, BlockchainType, isMainnet, isBitcoin, isEVM, getBlockchainType, ChainToID, } from './lib/asset';
5
5
  export { OrdersProvider } from './lib/orders/ordersProvider';
6
6
  export type { IOrderProvider } from './lib/orders/orders.types';
7
- export { WBTCArbitrumLocalnetAsset, WBTCEthereumLocalnetAsset, ArbitrumLocalnet, EthereumLocalnet, bitcoinRegtestAsset, SupportedAssets, } from './lib/constants';
7
+ export { WBTCArbitrumLocalnetAsset, WBTCEthereumLocalnetAsset, ArbitrumLocalnet, EthereumLocalnet, SupportedAssets, } from './lib/constants';
@@ -3,7 +3,6 @@ import { Asset } from './asset';
3
3
 
4
4
  export declare const ArbitrumLocalnet: Chain;
5
5
  export declare const EthereumLocalnet: Chain;
6
- export declare const bitcoinRegtestAsset: Asset;
7
6
  export declare const WBTCArbitrumLocalnetAsset: Asset;
8
7
  export declare const WBTCEthereumLocalnetAsset: Asset;
9
8
  type SupportedAssets = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gardenfi/orderbook",
3
- "version": "0.2.0-beta.12",
3
+ "version": "0.2.0-beta.13",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",