@gardenfi/utils 2.1.3-beta.5 → 2.1.3-beta.7
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/index102.cjs +1 -1
- package/dist/index102.js +12 -8
- package/dist/index104.cjs +1 -1
- package/dist/index104.js +1 -1
- package/dist/index107.cjs +1 -1
- package/dist/index107.js +76 -35
- package/dist/index108.cjs +1 -1
- package/dist/index108.js +45 -43
- package/dist/index110.cjs +1 -1
- package/dist/index110.js +1 -1
- package/dist/index111.cjs +1 -1
- package/dist/index111.js +1 -1
- package/dist/index112.cjs +1 -1
- package/dist/index112.js +1 -1
- package/dist/index113.cjs +1 -1
- package/dist/index113.js +1 -1
- package/dist/index125.cjs +1 -1
- package/dist/index125.js +1 -1
- package/dist/index15.cjs +1 -1
- package/dist/index15.js +4 -4
- package/dist/index166.cjs +1 -1
- package/dist/index166.js +36 -34
- package/dist/index189.cjs +1 -1
- package/dist/index189.js +2 -2
- package/dist/index191.cjs +1 -1
- package/dist/index191.js +19 -15
- package/dist/index192.cjs +1 -1
- package/dist/index192.js +15 -18
- package/dist/index222.cjs +1 -1
- package/dist/index222.js +2 -2
- package/dist/index225.cjs +1 -1
- package/dist/index225.js +43 -43
- package/dist/index226.cjs +1 -1
- package/dist/index226.js +3 -113
- package/dist/index23.cjs +1 -1
- package/dist/index23.js +13 -31
- package/dist/index231.cjs +1 -1
- package/dist/index231.js +1 -1
- package/dist/index232.cjs +1 -1
- package/dist/index232.js +1 -1
- package/dist/index233.cjs +1 -1
- package/dist/index233.js +31 -2
- package/dist/index234.cjs +1 -1
- package/dist/index234.js +2 -14
- package/dist/index235.cjs +1 -1
- package/dist/index235.js +13 -12
- package/dist/index236.cjs +1 -1
- package/dist/index236.js +10 -45
- package/dist/index237.cjs +1 -1
- package/dist/index237.js +46 -10
- package/dist/index238.cjs +1 -1
- package/dist/index238.js +11 -7
- package/dist/index239.cjs +1 -1
- package/dist/index239.js +7 -9
- package/dist/index24.cjs +1 -1
- package/dist/index24.js +58 -32
- package/dist/index240.cjs +1 -1
- package/dist/index240.js +8 -12
- package/dist/index241.cjs +1 -1
- package/dist/index241.js +13 -14
- package/dist/index242.cjs +1 -1
- package/dist/index242.js +14 -9
- package/dist/index243.cjs +1 -1
- package/dist/index243.js +7 -28
- package/dist/index245.cjs +1 -1
- package/dist/index245.js +3 -3
- package/dist/index246.cjs +1 -1
- package/dist/index246.js +3 -3
- package/dist/index247.cjs +1 -2
- package/dist/index247.js +13 -24
- package/dist/index248.cjs +1 -1
- package/dist/index248.js +15 -13
- package/dist/index249.cjs +2 -1
- package/dist/index249.js +23 -14
- package/dist/index25.cjs +16 -1
- package/dist/index25.js +113 -11
- package/dist/index26.cjs +1 -1
- package/dist/index26.js +32 -58
- package/dist/index27.cjs +1 -1
- package/dist/index27.js +31 -13
- package/dist/index275.cjs +1 -1
- package/dist/index275.js +7 -6
- package/dist/index277.cjs +1 -1
- package/dist/index277.js +103 -16
- package/dist/index278.cjs +1 -1
- package/dist/index278.js +13 -220
- package/dist/index279.cjs +1 -1
- package/dist/index279.js +214 -6
- package/dist/index28.cjs +1 -16
- package/dist/index28.js +11 -113
- package/dist/index280.cjs +1 -1
- package/dist/index280.js +7 -7
- package/dist/index281.cjs +1 -1
- package/dist/index281.js +7 -27
- package/dist/index282.cjs +1 -1
- package/dist/index282.js +26 -34
- package/dist/index283.cjs +1 -1
- package/dist/index283.js +13 -12
- package/dist/index284.cjs +1 -1
- package/dist/index284.js +89 -51
- package/dist/index285.cjs +1 -1
- package/dist/index285.js +3 -67
- package/dist/index286.cjs +1 -1
- package/dist/index286.js +140 -3
- package/dist/index287.cjs +1 -1
- package/dist/index287.js +143 -128
- package/dist/index288.cjs +1 -1
- package/dist/index288.js +9 -155
- package/dist/index289.cjs +1 -1
- package/dist/index289.js +111 -7
- package/dist/index290.cjs +2 -1
- package/dist/index290.js +116 -95
- package/dist/index291.cjs +1 -2
- package/dist/index291.js +8 -131
- package/dist/index292.cjs +1 -1
- package/dist/index292.js +18 -27
- package/dist/index293.cjs +1 -1
- package/dist/index293.js +39 -35
- package/dist/index294.cjs +1 -1
- package/dist/index294.js +77 -10
- package/dist/index295.cjs +1 -1
- package/dist/index295.js +2 -20
- package/dist/index297.cjs +1 -1
- package/dist/index297.js +658 -2
- package/dist/index298.cjs +1 -1
- package/dist/index298.js +203 -37
- package/dist/index299.cjs +1 -1
- package/dist/index299.js +155 -620
- package/dist/index3.cjs +1 -1
- package/dist/index3.js +1 -1
- package/dist/index30.cjs +1 -1
- package/dist/index30.js +1 -1
- package/dist/index300.cjs +2 -1
- package/dist/index300.js +63 -203
- package/dist/index301.cjs +1 -1
- package/dist/index301.js +4 -172
- package/dist/index302.cjs +1 -2
- package/dist/index302.js +39 -65
- package/dist/index303.cjs +1 -1
- package/dist/index303.js +7 -4
- package/dist/index304.cjs +1 -1
- package/dist/index304.js +60 -38
- package/dist/index305.cjs +1 -1
- package/dist/index305.js +77 -7
- package/dist/index306.cjs +1 -1
- package/dist/index306.js +4 -63
- package/dist/index307.cjs +1 -1
- package/dist/index307.js +181 -64
- package/dist/index308.cjs +1 -1
- package/dist/index308.js +64 -4
- package/dist/index309.cjs +1 -1
- package/dist/index309.js +44 -194
- package/dist/index310.cjs +1 -1
- package/dist/index310.js +4 -18
- package/dist/index311.cjs +1 -1
- package/dist/index311.js +5 -64
- package/dist/index312.cjs +1 -1
- package/dist/index312.js +2 -45
- package/dist/index313.cjs +1 -1
- package/dist/index313.js +21 -4
- package/dist/index36.cjs +1 -1
- package/dist/index36.js +1 -1
- package/dist/index4.cjs +1 -1
- package/dist/index4.js +0 -4
- package/dist/index43.cjs +1 -1
- package/dist/index43.js +40 -21
- package/dist/index44.cjs +1 -1
- package/dist/index44.js +24 -24
- package/dist/index58.cjs +1 -1
- package/dist/index58.js +111 -107
- package/dist/index59.cjs +1 -1
- package/dist/index59.js +11 -11
- package/dist/index60.cjs +1 -1
- package/dist/index60.js +1 -1
- package/dist/index61.cjs +1 -1
- package/dist/index61.js +1 -1
- package/dist/index62.cjs +1 -1
- package/dist/index62.js +1 -1
- package/dist/index64.cjs +1 -1
- package/dist/index64.js +26 -26
- package/dist/index66.cjs +1 -1
- package/dist/index66.js +3 -3
- package/dist/index73.cjs +1 -1
- package/dist/index73.js +1 -1
- package/dist/index74.cjs +1 -1
- package/dist/index74.js +8 -8
- package/dist/index79.cjs +1 -1
- package/dist/index79.js +1 -1
- package/dist/index83.cjs +1 -1
- package/dist/index83.js +8 -3
- package/dist/index84.cjs +1 -1
- package/dist/index84.js +53 -51
- package/dist/index85.cjs +1 -1
- package/dist/index85.js +18 -18
- package/dist/index9.cjs +1 -1
- package/dist/index9.js +4 -4
- package/dist/index90.cjs +1 -1
- package/dist/index90.js +44 -42
- package/dist/index92.cjs +1 -1
- package/dist/index92.js +39 -39
- package/dist/index98.cjs +1 -1
- package/dist/index98.js +1 -1
- package/dist/src/lib/utils.d.ts +2 -1
- package/package.json +1 -1
- package/dist/index314.cjs +0 -1
- package/dist/index314.js +0 -107
- package/dist/index315.cjs +0 -1
- package/dist/index315.js +0 -7
- package/dist/index316.cjs +0 -1
- package/dist/index316.js +0 -4
- package/dist/index317.cjs +0 -1
- package/dist/index317.js +0 -24
package/dist/index92.js
CHANGED
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
import { getAction as
|
|
1
|
+
import { getAction as i } from "./index29.js";
|
|
2
2
|
import { observe as B } from "./index39.js";
|
|
3
3
|
import { poll as N } from "./index40.js";
|
|
4
4
|
import { stringify as S } from "./index42.js";
|
|
5
5
|
import { getBlock as p } from "./index68.js";
|
|
6
|
-
function j(e, { blockTag: b = "latest", emitMissed: y = !1, emitOnBegin: m = !1, onBlock: k, onError:
|
|
7
|
-
const g = typeof d < "u" ? d : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket"),
|
|
6
|
+
function j(e, { blockTag: b = "latest", emitMissed: y = !1, emitOnBegin: m = !1, onBlock: k, onError: u, includeTransactions: h, poll: d, pollingInterval: w = e.pollingInterval }) {
|
|
7
|
+
const g = typeof d < "u" ? d : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket"), o = h ?? !1;
|
|
8
8
|
let t;
|
|
9
9
|
return g ? (() => {
|
|
10
|
-
const
|
|
10
|
+
const a = S([
|
|
11
11
|
"watchBlocks",
|
|
12
12
|
e.uid,
|
|
13
13
|
b,
|
|
14
14
|
y,
|
|
15
15
|
m,
|
|
16
|
-
|
|
16
|
+
o,
|
|
17
17
|
w
|
|
18
18
|
]);
|
|
19
|
-
return B(
|
|
20
|
-
var
|
|
19
|
+
return B(a, { onBlock: k, onError: u }, (s) => N(async () => {
|
|
20
|
+
var c;
|
|
21
21
|
try {
|
|
22
|
-
const r = await
|
|
22
|
+
const r = await i(e, p, "getBlock")({
|
|
23
23
|
blockTag: b,
|
|
24
|
-
includeTransactions:
|
|
24
|
+
includeTransactions: o
|
|
25
25
|
});
|
|
26
|
-
if (r.number && (t
|
|
26
|
+
if (r.number !== null && (t == null ? void 0 : t.number) != null) {
|
|
27
27
|
if (r.number === t.number)
|
|
28
28
|
return;
|
|
29
29
|
if (r.number - t.number > 1 && y)
|
|
30
|
-
for (let
|
|
31
|
-
const
|
|
32
|
-
blockNumber:
|
|
33
|
-
includeTransactions:
|
|
30
|
+
for (let f = (t == null ? void 0 : t.number) + 1n; f < r.number; f++) {
|
|
31
|
+
const n = await i(e, p, "getBlock")({
|
|
32
|
+
blockNumber: f,
|
|
33
|
+
includeTransactions: o
|
|
34
34
|
});
|
|
35
|
-
|
|
35
|
+
s.onBlock(n, t), t = n;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
// If no previous block exists, emit.
|
|
39
|
-
(
|
|
40
|
-
b === "pending" &&
|
|
39
|
+
((t == null ? void 0 : t.number) == null || // If the block tag is "pending" with no block number, emit.
|
|
40
|
+
b === "pending" && (r == null ? void 0 : r.number) == null || // If the next block number is greater than the previous block number, emit.
|
|
41
41
|
// We don't want to emit blocks in the past.
|
|
42
|
-
r.number && r.number > t.number) && (
|
|
42
|
+
r.number !== null && r.number > t.number) && (s.onBlock(r, t), t = r);
|
|
43
43
|
} catch (r) {
|
|
44
|
-
(
|
|
44
|
+
(c = s.onError) == null || c.call(s, r);
|
|
45
45
|
}
|
|
46
46
|
}, {
|
|
47
47
|
emitOnBegin: m,
|
|
48
48
|
interval: w
|
|
49
49
|
}));
|
|
50
50
|
})() : (() => {
|
|
51
|
-
let
|
|
51
|
+
let a = !0, s = !0, c = () => a = !1;
|
|
52
52
|
return (async () => {
|
|
53
53
|
try {
|
|
54
|
-
m &&
|
|
54
|
+
m && i(e, p, "getBlock")({
|
|
55
55
|
blockTag: b,
|
|
56
|
-
includeTransactions:
|
|
57
|
-
}).then((
|
|
58
|
-
|
|
59
|
-
});
|
|
56
|
+
includeTransactions: o
|
|
57
|
+
}).then((n) => {
|
|
58
|
+
a && s && (k(n, void 0), s = !1);
|
|
59
|
+
}).catch(u);
|
|
60
60
|
const r = (() => {
|
|
61
61
|
if (e.transport.type === "fallback") {
|
|
62
|
-
const
|
|
63
|
-
return
|
|
62
|
+
const n = e.transport.transports.find((l) => l.config.type === "webSocket");
|
|
63
|
+
return n ? n.value : e.transport;
|
|
64
64
|
}
|
|
65
65
|
return e.transport;
|
|
66
|
-
})(), { unsubscribe:
|
|
66
|
+
})(), { unsubscribe: f } = await r.subscribe({
|
|
67
67
|
params: ["newHeads"],
|
|
68
|
-
async onData(
|
|
69
|
-
if (!
|
|
68
|
+
async onData(n) {
|
|
69
|
+
if (!a)
|
|
70
70
|
return;
|
|
71
|
-
const
|
|
72
|
-
blockNumber:
|
|
73
|
-
includeTransactions:
|
|
71
|
+
const l = await i(e, p, "getBlock")({
|
|
72
|
+
blockNumber: n.blockNumber,
|
|
73
|
+
includeTransactions: o
|
|
74
74
|
}).catch(() => {
|
|
75
75
|
});
|
|
76
|
-
|
|
76
|
+
a && (k(l, t), s = !1, t = l);
|
|
77
77
|
},
|
|
78
|
-
onError(
|
|
79
|
-
|
|
78
|
+
onError(n) {
|
|
79
|
+
u == null || u(n);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
|
|
82
|
+
c = f, a || c();
|
|
83
83
|
} catch (r) {
|
|
84
|
-
|
|
84
|
+
u == null || u(r);
|
|
85
85
|
}
|
|
86
|
-
})(), () =>
|
|
86
|
+
})(), () => c();
|
|
87
87
|
})();
|
|
88
88
|
}
|
|
89
89
|
export {
|
package/dist/index98.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index71.cjs"),t=require("./index99.cjs"),a=require("./index100.cjs"),i=require("./index101.cjs"),n=require("./index43.cjs"),o=require("./index102.cjs"),u=require("./index103.cjs"),d=require("./index104.cjs"),g=require("./index96.cjs"),q=require("./index105.cjs"),c=require("./index106.cjs"),C=require("./index107.cjs"),h=require("./index97.cjs"),p=require("./index108.cjs"),w=require("./index109.cjs"),A=require("./index110.cjs"),T=require("./index111.cjs"),l=require("./index112.cjs"),S=require("./index113.cjs"),y=require("./index114.cjs"),m=require("./index37.cjs"),P=require("./index115.cjs"),z=require("./index36.cjs");function R(e){return{addChain:s=>t.addChain(e,s),deployContract:s=>a.deployContract(e,s),getAddresses:()=>i.getAddresses(e),getCallsStatus:s=>n.getCallsStatus(e,s),getCapabilities:
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./index71.cjs"),t=require("./index99.cjs"),a=require("./index100.cjs"),i=require("./index101.cjs"),n=require("./index43.cjs"),o=require("./index102.cjs"),u=require("./index103.cjs"),d=require("./index104.cjs"),g=require("./index96.cjs"),q=require("./index105.cjs"),c=require("./index106.cjs"),C=require("./index107.cjs"),h=require("./index97.cjs"),p=require("./index108.cjs"),w=require("./index109.cjs"),A=require("./index110.cjs"),T=require("./index111.cjs"),l=require("./index112.cjs"),S=require("./index113.cjs"),y=require("./index114.cjs"),m=require("./index37.cjs"),P=require("./index115.cjs"),z=require("./index36.cjs");function R(e){return{addChain:s=>t.addChain(e,s),deployContract:s=>a.deployContract(e,s),getAddresses:()=>i.getAddresses(e),getCallsStatus:s=>n.getCallsStatus(e,s),getCapabilities:s=>o.getCapabilities(e,s),getChainId:()=>r.getChainId(e),getPermissions:()=>u.getPermissions(e),prepareAuthorization:s=>d.prepareAuthorization(e,s),prepareTransactionRequest:s=>g.prepareTransactionRequest(e,s),requestAddresses:()=>q.requestAddresses(e),requestPermissions:s=>c.requestPermissions(e,s),sendCalls:s=>C.sendCalls(e,s),sendRawTransaction:s=>h.sendRawTransaction(e,s),sendTransaction:s=>p.sendTransaction(e,s),showCallsStatus:s=>w.showCallsStatus(e,s),signAuthorization:s=>A.signAuthorization(e,s),signMessage:s=>T.signMessage(e,s),signTransaction:s=>l.signTransaction(e,s),signTypedData:s=>S.signTypedData(e,s),switchChain:s=>y.switchChain(e,s),waitForCallsStatus:s=>m.waitForCallsStatus(e,s),watchAsset:s=>P.watchAsset(e,s),writeContract:s=>z.writeContract(e,s)}}exports.walletActions=R;
|
package/dist/index98.js
CHANGED
|
@@ -27,7 +27,7 @@ function X(s) {
|
|
|
27
27
|
deployContract: (r) => a(s, r),
|
|
28
28
|
getAddresses: () => i(s),
|
|
29
29
|
getCallsStatus: (r) => m(s, r),
|
|
30
|
-
getCapabilities: () => e(s),
|
|
30
|
+
getCapabilities: (r) => e(s, r),
|
|
31
31
|
getChainId: () => o(s),
|
|
32
32
|
getPermissions: () => p(s),
|
|
33
33
|
prepareAuthorization: (r) => n(s, r),
|
package/dist/src/lib/utils.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ export declare const sleep: (ms: number) => Promise<unknown>;
|
|
|
9
9
|
export declare const parseJwt: <T>(token: string) => T | undefined;
|
|
10
10
|
export declare enum Network {
|
|
11
11
|
MAINNET = "mainnet",
|
|
12
|
-
TESTNET = "testnet"
|
|
12
|
+
TESTNET = "testnet",
|
|
13
|
+
LOCALNET = "localnet"
|
|
13
14
|
}
|
|
14
15
|
export declare enum Environment {
|
|
15
16
|
MAINNET = "mainnet",
|
package/package.json
CHANGED
package/dist/index314.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("./index292.cjs"),f=require("./index310.cjs"),c=require("./index293.cjs"),I=[],O=[],w=[],B=BigInt(0),a=BigInt(1),A=BigInt(2),S=BigInt(7),H=BigInt(256),T=BigInt(113);for(let i=0,t=a,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<<a^(t>>S)*T)%H,t&A&&(o^=a<<(a<<BigInt(r))-a);w.push(o)}const[m,E]=f.split(w,!0),y=(i,t,s)=>s>32?f.rotlBH(i,t,s):f.rotlSH(i,t,s),b=(i,t,s)=>s>32?f.rotlBL(i,t,s):f.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.anumber(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.aexists(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.aexists(this,!1),l.abytes(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.anumber(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(l.aoutput(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;
|
package/dist/index314.js
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { anumber as d, aexists as k, abytes as B, aoutput as A } from "./index292.js";
|
|
2
|
-
import { rotlSH as H, rotlSL as m, rotlBH as S, rotlBL as T, split as F } from "./index310.js";
|
|
3
|
-
import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./index293.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);
|
|
11
|
-
}
|
|
12
|
-
const [v, z] = /* @__PURE__ */ F(b, !0), O = (e, t, s) => s > 32 ? S(e, t, s) : H(e, t, s), w = (e, t, s) => s > 32 ? T(e, t, s) : m(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;
|
|
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
|
-
}
|
|
101
|
-
}
|
|
102
|
-
const G = (e, t, s) => X(() => new p(t, e, s)), Q = /* @__PURE__ */ G(1, 136, 256 / 8);
|
|
103
|
-
export {
|
|
104
|
-
p as Keccak,
|
|
105
|
-
D as keccakP,
|
|
106
|
-
Q as keccak_256
|
|
107
|
-
};
|
package/dist/index315.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./index317.cjs"),e={checksum:new c.LruMap(8192)},s=e.checksum;exports.checksum=s;
|
package/dist/index315.js
DELETED
package/dist/index316.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="0.1.1";exports.version=e;
|
package/dist/index316.js
DELETED
package/dist/index317.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class i extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}exports.LruMap=i;
|
package/dist/index317.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
class r extends Map {
|
|
2
|
-
constructor(e) {
|
|
3
|
-
super(), Object.defineProperty(this, "maxSize", {
|
|
4
|
-
enumerable: !0,
|
|
5
|
-
configurable: !0,
|
|
6
|
-
writable: !0,
|
|
7
|
-
value: void 0
|
|
8
|
-
}), this.maxSize = e;
|
|
9
|
-
}
|
|
10
|
-
get(e) {
|
|
11
|
-
const t = super.get(e);
|
|
12
|
-
return super.has(e) && t !== void 0 && (this.delete(e), super.set(e, t)), t;
|
|
13
|
-
}
|
|
14
|
-
set(e, t) {
|
|
15
|
-
if (super.set(e, t), this.maxSize && this.size > this.maxSize) {
|
|
16
|
-
const s = this.keys().next().value;
|
|
17
|
-
s && this.delete(s);
|
|
18
|
-
}
|
|
19
|
-
return this;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
export {
|
|
23
|
-
r as LruMap
|
|
24
|
-
};
|