@gardenfi/orderbook 0.2.0-beta.16 → 0.2.0-beta.18
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.
- package/dist/index22.cjs +1 -1
- package/dist/index22.js +1 -1
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +2 -2
- package/dist/index25.cjs +1 -1
- package/dist/index25.js +1 -1
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +3 -3
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +10 -10
- package/dist/index28.cjs +1 -1
- package/dist/index28.js +1 -1
- package/dist/index29.cjs +1 -1
- package/dist/index29.js +1 -1
- package/dist/index32.cjs +1 -2
- package/dist/index32.js +33 -58
- package/dist/index33.cjs +2 -1
- package/dist/index33.js +53 -15
- package/dist/index34.cjs +1 -1
- package/dist/index34.js +127 -13
- package/dist/index35.cjs +1 -1
- package/dist/index35.js +52 -31
- package/dist/index36.cjs +2 -1
- package/dist/index36.js +41 -126
- package/dist/index37.cjs +1 -1
- package/dist/index37.js +8 -55
- package/dist/index38.cjs +1 -2
- package/dist/index38.js +9 -41
- package/dist/index39.cjs +1 -1
- package/dist/index39.js +11 -8
- package/dist/index40.cjs +1 -1
- package/dist/index40.js +13 -10
- package/dist/index41.cjs +1 -1
- package/dist/index41.js +6 -11
- package/dist/index42.cjs +1 -1
- package/dist/index42.js +17 -13
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +78 -6
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +14 -17
- package/dist/index45.cjs +1 -1
- package/dist/index45.js +15 -75
- package/dist/index46.cjs +1 -1
- package/dist/index46.js +3 -14
- package/dist/index47.cjs +1 -1
- package/dist/index47.js +20 -17
- package/dist/index48.cjs +1 -1
- package/dist/index48.js +13 -3
- package/dist/index49.cjs +1 -1
- package/dist/index49.js +1 -1
- package/dist/index52.cjs +1 -1
- package/dist/index52.js +1 -1
- package/dist/index54.cjs +1 -1
- package/dist/index54.js +12 -6
- package/dist/index55.cjs +1 -1
- package/dist/index55.js +1 -1
- package/dist/index56.cjs +1 -1
- package/dist/index56.js +6 -12
- package/dist/index57.cjs +1 -1
- package/dist/index57.js +32 -6
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +2 -33
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +38 -2
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +25 -34
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +6 -28
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +112 -6
- package/dist/index63.cjs +1 -1
- package/dist/index63.js +6 -112
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +5 -105
- package/dist/index67.cjs +1 -1
- package/dist/index67.js +62 -5
- package/dist/index68.cjs +1 -1
- package/dist/index68.js +32 -59
- package/dist/index69.cjs +1 -1
- package/dist/index69.js +101 -31
- package/dist/src/index.d.ts +1 -1
- package/dist/src/lib/asset.d.ts +8 -8
- package/dist/src/lib/orderbook/orderbook.types.d.ts +2 -2
- package/package.json +1 -1
package/dist/index69.js
CHANGED
|
@@ -1,37 +1,107 @@
|
|
|
1
|
-
import { bytes as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 "./index68.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);
|
|
7
11
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
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];
|
|
20
35
|
}
|
|
36
|
+
s.fill(0);
|
|
21
37
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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;
|
|
100
|
+
}
|
|
25
101
|
}
|
|
102
|
+
const G = (e, t, s) => X(() => new p(t, e, s)), Q = /* @__PURE__ */ G(1, 136, 256 / 8);
|
|
26
103
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
104
|
+
p as Keccak,
|
|
105
|
+
D as keccakP,
|
|
106
|
+
Q as keccak_256
|
|
37
107
|
};
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { Orderbook } from './lib/orderbook/orderbook';
|
|
2
2
|
export type * from './lib/orderbook/orderbook.types';
|
|
3
|
-
export type {
|
|
3
|
+
export type { Chain, EvmChain, Asset } from './lib/asset';
|
|
4
4
|
export { Chains, BlockchainType, isMainnet, isBitcoin, isEVM, getBlockchainType, evmToViemChainMap, } from './lib/asset';
|
|
5
5
|
export { OrdersProvider } from './lib/orders/ordersProvider';
|
|
6
6
|
export type { IOrderProvider } from './lib/orders/orders.types';
|
package/dist/src/lib/asset.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Chain } from 'viem/chains';
|
|
1
|
+
import { Chain as viemChain } from 'viem/chains';
|
|
2
2
|
|
|
3
3
|
export type AssetCommon = {
|
|
4
4
|
name: string;
|
|
5
5
|
decimals: number;
|
|
6
6
|
symbol: string;
|
|
7
|
-
chain:
|
|
7
|
+
chain: Chain;
|
|
8
8
|
logo?: string;
|
|
9
9
|
atomicSwapAddress: string;
|
|
10
10
|
};
|
|
@@ -43,10 +43,10 @@ export declare const Chains: {
|
|
|
43
43
|
readonly ethereum_localnet: "ethereum_localnet";
|
|
44
44
|
readonly base_sepolia: "base_sepolia";
|
|
45
45
|
};
|
|
46
|
-
export type
|
|
46
|
+
export type Chain = keyof typeof Chains;
|
|
47
47
|
export type EvmChain = keyof Omit<typeof Chains, 'bitcoin' | 'bitcoin_testnet' | 'bitcoin_regtest'>;
|
|
48
|
-
export declare const isMainnet: (chain:
|
|
49
|
-
export declare const isBitcoin: (chain:
|
|
50
|
-
export declare const isEVM: (chain:
|
|
51
|
-
export declare const evmToViemChainMap: Record<EvmChain,
|
|
52
|
-
export declare const getBlockchainType: (chain:
|
|
48
|
+
export declare const isMainnet: (chain: Chain) => chain is "bitcoin" | "ethereum" | "ethereum_arbitrum";
|
|
49
|
+
export declare const isBitcoin: (chain: Chain) => chain is "bitcoin" | "bitcoin_testnet" | "bitcoin_regtest";
|
|
50
|
+
export declare const isEVM: (chain: Chain) => chain is "ethereum" | "ethereum_arbitrum" | "ethereum_sepolia" | "arbitrum_localnet" | "arbitrum_sepolia" | "ethereum_localnet" | "base_sepolia";
|
|
51
|
+
export declare const evmToViemChainMap: Record<EvmChain, viemChain>;
|
|
52
|
+
export declare const getBlockchainType: (chain: Chain) => BlockchainType;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { WalletClient } from 'viem';
|
|
2
2
|
import { AsyncResult } from '@catalogfi/utils';
|
|
3
3
|
import { APIResponse, IAuth, IStore } from '@gardenfi/utils';
|
|
4
|
-
import { Asset,
|
|
4
|
+
import { Asset, Chain } from '../asset';
|
|
5
5
|
import { IOrderProvider } from '../orders/orders.types';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -179,7 +179,7 @@ export type Swap = {
|
|
|
179
179
|
updated_at: string;
|
|
180
180
|
deleted_at: string | null;
|
|
181
181
|
swap_id: string;
|
|
182
|
-
chain:
|
|
182
|
+
chain: Chain;
|
|
183
183
|
asset: string;
|
|
184
184
|
initiator: string;
|
|
185
185
|
redeemer: string;
|