@argent/x-shared 1.48.2 → 1.49.0
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/index.cjs +1 -1
- package/dist/index.js +457 -455
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js +3 -3
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js +5 -5
- package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js +2 -2
- package/dist/node_modules/.pnpm/@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js +2 -2
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_md.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/_md.js +64 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.cjs +1 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.js +115 -0
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha3.js +2 -2
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.cjs +1 -1
- package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.js +12 -10
- package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.cjs +1 -1
- package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js +55 -58
- package/dist/src/accountNameGenerator/colors.cjs +1 -0
- package/dist/src/accountNameGenerator/colors.d.ts +2 -0
- package/dist/src/accountNameGenerator/colors.js +25 -0
- package/dist/src/accountNameGenerator/index.cjs +1 -0
- package/dist/src/accountNameGenerator/index.d.ts +9 -0
- package/dist/src/accountNameGenerator/index.js +24 -0
- package/dist/src/accountNameGenerator/types.d.ts +18 -0
- package/dist/src/accountNameGenerator/x-names.json.cjs +1 -0
- package/dist/src/accountNameGenerator/x-names.json.js +1926 -0
- package/dist/src/chains/starknet/services/deploymentData/findImplementationForAccount.js +1 -1
- package/dist/src/features/simulation/activity/schema.js +3 -3
- package/dist/src/features/simulation/activity/utils/createNativeActivity.js +3 -3
- package/dist/src/features/simulation/transactionReview/schema.js +4 -4
- package/dist/src/features/swap/models/trade.model.js +3 -3
- package/dist/src/index.d.ts +1 -0
- package/dist/src/nfts/BackendNftService.cjs +1 -1
- package/dist/src/nfts/BackendNftService.js +3 -3
- package/dist/src/tokens/service/types/backend.model.js +1 -1
- package/dist/src/transactions/estimate/utils.js +1 -1
- package/dist/src/transactions/transactionVersion.js +1 -1
- package/dist/src/transactions/txv3.cjs +1 -1
- package/dist/src/transactions/txv3.js +4 -4
- package/dist/src/utils/number/prettifyNumber.cjs +1 -1
- package/dist/src/utils/number/prettifyNumber.js +27 -22
- package/package.json +25 -25
package/dist/node_modules/.pnpm/@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { hmac as m } from "../../../../../@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/hmac.js";
|
|
2
|
-
import {
|
|
2
|
+
import { randomBytes as c, concatBytes as e } from "../../../../../@noble_hashes@1.3.0/node_modules/@noble/hashes/esm/utils.js";
|
|
3
3
|
import "./abstract/weierstrass.js";
|
|
4
4
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5
5
|
function p(t) {
|
|
6
6
|
return {
|
|
7
7
|
hash: t,
|
|
8
|
-
hmac: (o, ...r) => m(t, o,
|
|
9
|
-
randomBytes:
|
|
8
|
+
hmac: (o, ...r) => m(t, o, e(...r)),
|
|
9
|
+
randomBytes: c
|
|
10
10
|
};
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { validateObject as L, ensureBytes as T, bytesToNumberLE as y, bytesToNumberBE as m, numberToBytesBE as _, bitMask as $, numberToBytesLE as C } from "./utils.js";
|
|
2
2
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
3
|
const f = BigInt(0), u = BigInt(1), w = BigInt(2), M = BigInt(3), E = BigInt(4), b = BigInt(5), I = BigInt(8);
|
|
4
4
|
BigInt(9);
|
|
@@ -109,7 +109,7 @@ function Q(e) {
|
|
|
109
109
|
BYTES: "isSafeInteger",
|
|
110
110
|
BITS: "isSafeInteger"
|
|
111
111
|
}, n = A.reduce((r, s) => (r[s] = "function", r), o);
|
|
112
|
-
return
|
|
112
|
+
return L(e, n);
|
|
113
113
|
}
|
|
114
114
|
function O(e, o, n) {
|
|
115
115
|
if (n < f)
|
|
@@ -141,7 +141,7 @@ function V(e, o, n = !1, r = {}) {
|
|
|
141
141
|
ORDER: e,
|
|
142
142
|
BITS: s,
|
|
143
143
|
BYTES: c,
|
|
144
|
-
MASK:
|
|
144
|
+
MASK: $(s),
|
|
145
145
|
ZERO: f,
|
|
146
146
|
ONE: u,
|
|
147
147
|
create: (t) => g(t, e),
|
|
@@ -171,7 +171,7 @@ function V(e, o, n = !1, r = {}) {
|
|
|
171
171
|
// TODO: do we really need constant cmov?
|
|
172
172
|
// We don't have const-time bigints anyway, so probably will be not very useful
|
|
173
173
|
cmov: (t, l, a) => a ? l : t,
|
|
174
|
-
toBytes: (t) => n ?
|
|
174
|
+
toBytes: (t) => n ? C(t, c) : _(t, c),
|
|
175
175
|
fromBytes: (t) => {
|
|
176
176
|
if (t.length !== c)
|
|
177
177
|
throw new Error(`Fp.fromBytes: expected ${c}, got ${t.length}`);
|
|
@@ -181,7 +181,7 @@ function V(e, o, n = !1, r = {}) {
|
|
|
181
181
|
return Object.freeze(i);
|
|
182
182
|
}
|
|
183
183
|
function Y(e, o, n = !1) {
|
|
184
|
-
e =
|
|
184
|
+
e = T("privateHash", e);
|
|
185
185
|
const r = e.length, s = x(o).nByteLength + 8;
|
|
186
186
|
if (s < 24 || r < s || r > 1024)
|
|
187
187
|
throw new Error(`hashToPrivateScalar: expected ${s}-1024 bytes of input, got ${r}`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mod as ut, hashToPrivateScalar as dt, invert as ht } from "./modular.js";
|
|
2
2
|
import * as mt from "./utils.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { validateObject as lt, concatBytes as et, ensureBytes as Y, bytesToHex as nt, bytesToNumberBE as _, bitMask as yt, numberToBytesBE as rt, hexToBytes as at, createHmacDrbg as pt } from "./utils.js";
|
|
4
|
+
import { validateBasic as ft, wNAF as wt } from "./curve.js";
|
|
5
5
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
6
6
|
function Et(B) {
|
|
7
7
|
const n = ft(B);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { number as d, exists as k, bytes as _, output as g } from "./_assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import { rotlBH as B, rotlSH as A, rotlBL as H, rotlSL as m, split as S } from "./_u64.js";
|
|
3
3
|
import { wrapConstructor as T, Hash as F, u32 as X, toBytes as U } from "./utils.js";
|
|
4
4
|
const [O, w, y] = [[], [], []], E = /* @__PURE__ */ BigInt(0), f = /* @__PURE__ */ BigInt(1), P = /* @__PURE__ */ BigInt(2), M = /* @__PURE__ */ BigInt(7), R = /* @__PURE__ */ BigInt(256), j = /* @__PURE__ */ BigInt(113);
|
|
5
5
|
for (let i = 0, t = f, s = 1, n = 0; i < 24; i++) {
|
|
@@ -9,7 +9,7 @@ for (let i = 0, t = f, s = 1, n = 0; i < 24; i++) {
|
|
|
9
9
|
t = (t << f ^ (t >> M) * j) % R, t & P && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
|
|
10
10
|
y.push(o);
|
|
11
11
|
}
|
|
12
|
-
const [C, q] = /* @__PURE__ */
|
|
12
|
+
const [C, q] = /* @__PURE__ */ S(y, !0), x = (i, t, s) => s > 32 ? B(i, t, s) : A(i, t, s), I = (i, t, s) => s > 32 ? H(i, t, s) : m(i, t, s);
|
|
13
13
|
function v(i, t = 24) {
|
|
14
14
|
const s = new Uint32Array(10);
|
|
15
15
|
for (let n = 24 - t; n < 24; n++) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("./_assert.cjs"),u=require("./utils.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;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { exists as g, output as d } from "./_assert.js";
|
|
2
|
+
import { Hash as b, createView as p, toBytes as a } from "./utils.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
|
+
}
|
|
60
|
+
export {
|
|
61
|
+
B as Chi,
|
|
62
|
+
U as HashMD,
|
|
63
|
+
L as Maj
|
|
64
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const H=require("./_md.cjs"),s=require("./utils.cjs"),S=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),b=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),f=new Uint32Array(64);class g extends H.HashMD{constructor(){super(64,32,8,!1),this.A=b[0]|0,this.B=b[1]|0,this.C=b[2]|0,this.D=b[3]|0,this.E=b[4]|0,this.F=b[5]|0,this.G=b[6]|0,this.H=b[7]|0}get(){const{A:d,B:o,C:x,D:e,E:a,F:i,G:c,H:r}=this;return[d,o,x,e,a,i,c,r]}set(d,o,x,e,a,i,c,r){this.A=d|0,this.B=o|0,this.C=x|0,this.D=e|0,this.E=a|0,this.F=i|0,this.G=c|0,this.H=r|0}process(d,o){for(let t=0;t<16;t++,o+=4)f[t]=d.getUint32(o,!1);for(let t=16;t<64;t++){const A=f[t-15],n=f[t-2],C=s.rotr(A,7)^s.rotr(A,18)^A>>>3,u=s.rotr(n,17)^s.rotr(n,19)^n>>>10;f[t]=u+f[t-7]+C+f[t-16]|0}let{A:x,B:e,C:a,D:i,E:c,F:r,G:h,H:l}=this;for(let t=0;t<64;t++){const A=s.rotr(c,6)^s.rotr(c,11)^s.rotr(c,25),n=l+A+H.Chi(c,r,h)+S[t]+f[t]|0,u=(s.rotr(x,2)^s.rotr(x,13)^s.rotr(x,22))+H.Maj(x,e,a)|0;l=h,h=r,r=c,c=i+n|0,i=a,a=e,e=x,x=n+u|0}x=x+this.A|0,e=e+this.B|0,a=a+this.C|0,i=i+this.D|0,c=c+this.E|0,r=r+this.F|0,h=h+this.G|0,l=l+this.H|0,this.set(x,e,a,i,c,r,h,l)}roundClean(){f.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const y=s.wrapConstructor(()=>new g);exports.SHA256=g;exports.sha256=y;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { HashMD as m, Chi as p, Maj as u } from "./_md.js";
|
|
2
|
+
import { wrapConstructor as D, rotr as i } from "./utils.js";
|
|
3
|
+
const g = /* @__PURE__ */ new Uint32Array([
|
|
4
|
+
1116352408,
|
|
5
|
+
1899447441,
|
|
6
|
+
3049323471,
|
|
7
|
+
3921009573,
|
|
8
|
+
961987163,
|
|
9
|
+
1508970993,
|
|
10
|
+
2453635748,
|
|
11
|
+
2870763221,
|
|
12
|
+
3624381080,
|
|
13
|
+
310598401,
|
|
14
|
+
607225278,
|
|
15
|
+
1426881987,
|
|
16
|
+
1925078388,
|
|
17
|
+
2162078206,
|
|
18
|
+
2614888103,
|
|
19
|
+
3248222580,
|
|
20
|
+
3835390401,
|
|
21
|
+
4022224774,
|
|
22
|
+
264347078,
|
|
23
|
+
604807628,
|
|
24
|
+
770255983,
|
|
25
|
+
1249150122,
|
|
26
|
+
1555081692,
|
|
27
|
+
1996064986,
|
|
28
|
+
2554220882,
|
|
29
|
+
2821834349,
|
|
30
|
+
2952996808,
|
|
31
|
+
3210313671,
|
|
32
|
+
3336571891,
|
|
33
|
+
3584528711,
|
|
34
|
+
113926993,
|
|
35
|
+
338241895,
|
|
36
|
+
666307205,
|
|
37
|
+
773529912,
|
|
38
|
+
1294757372,
|
|
39
|
+
1396182291,
|
|
40
|
+
1695183700,
|
|
41
|
+
1986661051,
|
|
42
|
+
2177026350,
|
|
43
|
+
2456956037,
|
|
44
|
+
2730485921,
|
|
45
|
+
2820302411,
|
|
46
|
+
3259730800,
|
|
47
|
+
3345764771,
|
|
48
|
+
3516065817,
|
|
49
|
+
3600352804,
|
|
50
|
+
4094571909,
|
|
51
|
+
275423344,
|
|
52
|
+
430227734,
|
|
53
|
+
506948616,
|
|
54
|
+
659060556,
|
|
55
|
+
883997877,
|
|
56
|
+
958139571,
|
|
57
|
+
1322822218,
|
|
58
|
+
1537002063,
|
|
59
|
+
1747873779,
|
|
60
|
+
1955562222,
|
|
61
|
+
2024104815,
|
|
62
|
+
2227730452,
|
|
63
|
+
2361852424,
|
|
64
|
+
2428436474,
|
|
65
|
+
2756734187,
|
|
66
|
+
3204031479,
|
|
67
|
+
3329325298
|
|
68
|
+
]), b = /* @__PURE__ */ new Uint32Array([
|
|
69
|
+
1779033703,
|
|
70
|
+
3144134277,
|
|
71
|
+
1013904242,
|
|
72
|
+
2773480762,
|
|
73
|
+
1359893119,
|
|
74
|
+
2600822924,
|
|
75
|
+
528734635,
|
|
76
|
+
1541459225
|
|
77
|
+
]), h = /* @__PURE__ */ new Uint32Array(64);
|
|
78
|
+
class w extends m {
|
|
79
|
+
constructor() {
|
|
80
|
+
super(64, 32, 8, !1), this.A = b[0] | 0, this.B = b[1] | 0, this.C = b[2] | 0, this.D = b[3] | 0, this.E = b[4] | 0, this.F = b[5] | 0, this.G = b[6] | 0, this.H = b[7] | 0;
|
|
81
|
+
}
|
|
82
|
+
get() {
|
|
83
|
+
const { A: d, B: o, C: t, D: s, E: a, F: f, G: c, H: e } = this;
|
|
84
|
+
return [d, o, t, s, a, f, c, e];
|
|
85
|
+
}
|
|
86
|
+
// prettier-ignore
|
|
87
|
+
set(d, o, t, s, a, f, c, e) {
|
|
88
|
+
this.A = d | 0, this.B = o | 0, this.C = t | 0, this.D = s | 0, this.E = a | 0, this.F = f | 0, this.G = c | 0, this.H = e | 0;
|
|
89
|
+
}
|
|
90
|
+
process(d, o) {
|
|
91
|
+
for (let x = 0; x < 16; x++, o += 4)
|
|
92
|
+
h[x] = d.getUint32(o, !1);
|
|
93
|
+
for (let x = 16; x < 64; x++) {
|
|
94
|
+
const A = h[x - 15], n = h[x - 2], C = i(A, 7) ^ i(A, 18) ^ A >>> 3, H = i(n, 17) ^ i(n, 19) ^ n >>> 10;
|
|
95
|
+
h[x] = H + h[x - 7] + C + h[x - 16] | 0;
|
|
96
|
+
}
|
|
97
|
+
let { A: t, B: s, C: a, D: f, E: c, F: e, G: r, H: l } = this;
|
|
98
|
+
for (let x = 0; x < 64; x++) {
|
|
99
|
+
const A = i(c, 6) ^ i(c, 11) ^ i(c, 25), n = l + A + p(c, e, r) + g[x] + h[x] | 0, H = (i(t, 2) ^ i(t, 13) ^ i(t, 22)) + u(t, s, a) | 0;
|
|
100
|
+
l = r, r = e, e = c, c = f + n | 0, f = a, a = s, s = t, t = n + H | 0;
|
|
101
|
+
}
|
|
102
|
+
t = t + this.A | 0, s = s + this.B | 0, a = a + this.C | 0, f = f + this.D | 0, c = c + this.E | 0, e = e + this.F | 0, r = r + this.G | 0, l = l + this.H | 0, this.set(t, s, a, f, c, e, r, l);
|
|
103
|
+
}
|
|
104
|
+
roundClean() {
|
|
105
|
+
h.fill(0);
|
|
106
|
+
}
|
|
107
|
+
destroy() {
|
|
108
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0), this.buffer.fill(0);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const G = /* @__PURE__ */ D(() => new w());
|
|
112
|
+
export {
|
|
113
|
+
w as SHA256,
|
|
114
|
+
G as sha256
|
|
115
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { number as d, exists as k, bytes as B, output as A } from "./_assert.js";
|
|
2
|
-
import {
|
|
2
|
+
import { rotlBH as H, rotlSH as m, rotlBL as S, rotlSL as T, split as F } from "./_u64.js";
|
|
3
3
|
import { wrapConstructor as X, Hash as E, u32 as U, isLE as x, byteSwap32 as I, toBytes as P } from "./utils.js";
|
|
4
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
5
|
for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
|
|
@@ -9,7 +9,7 @@ for (let e = 0, t = f, s = 1, n = 0; e < 24; e++) {
|
|
|
9
9
|
t = (t << f ^ (t >> j) * q) % C, t & R && (o ^= f << (f << /* @__PURE__ */ BigInt(r)) - f);
|
|
10
10
|
b.push(o);
|
|
11
11
|
}
|
|
12
|
-
const [v, z] = /* @__PURE__ */
|
|
12
|
+
const [v, z] = /* @__PURE__ */ F(b, !0), O = (e, t, s) => s > 32 ? H(e, t, s) : m(e, t, s), w = (e, t, s) => s > 32 ? S(e, t, s) : T(e, t, s);
|
|
13
13
|
function D(e, t = 24) {
|
|
14
14
|
const s = new Uint32Array(10);
|
|
15
15
|
for (let n = 24 - t; n < 24; n++) {
|
package/dist/node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/utils.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./_assert.cjs");/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./_assert.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,r=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]=r(t[e])}const l=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function g(t){o.bytes(t);let e="";for(let n=0;n<t.length;n++)e+=l[t[n]];return 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 s(t){return typeof t=="string"&&(t=f(t)),o.bytes(t),t}class w{clone(){return this._cloneInto()}}function x(t){const e=c=>t().update(s(c)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}exports.Hash=w;exports.byteSwap=r;exports.byteSwap32=p;exports.bytesToHex=g;exports.createView=i;exports.isLE=b;exports.rotr=y;exports.toBytes=s;exports.u32=u;exports.utf8ToBytes=f;exports.wrapConstructor=x;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { bytes as o } from "./_assert.js";
|
|
2
2
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
|
-
const y = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), p = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, r = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
4
|
-
function
|
|
3
|
+
const y = (t) => new Uint32Array(t.buffer, t.byteOffset, Math.floor(t.byteLength / 4)), p = (t) => new DataView(t.buffer, t.byteOffset, t.byteLength), l = (t, e) => t << 32 - e | t >>> e, x = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68, r = (t) => t << 24 & 4278190080 | t << 8 & 16711680 | t >>> 8 & 65280 | t >>> 24 & 255;
|
|
4
|
+
function b(t) {
|
|
5
5
|
for (let e = 0; e < t.length; e++)
|
|
6
6
|
t[e] = r(t[e]);
|
|
7
7
|
}
|
|
8
8
|
const c = /* @__PURE__ */ Array.from({ length: 256 }, (t, e) => e.toString(16).padStart(2, "0"));
|
|
9
|
-
function
|
|
9
|
+
function g(t) {
|
|
10
10
|
o(t);
|
|
11
11
|
let e = "";
|
|
12
12
|
for (let n = 0; n < t.length; n++)
|
|
@@ -21,24 +21,26 @@ function i(t) {
|
|
|
21
21
|
function u(t) {
|
|
22
22
|
return typeof t == "string" && (t = i(t)), o(t), t;
|
|
23
23
|
}
|
|
24
|
-
class
|
|
24
|
+
class w {
|
|
25
25
|
// Safe version that clones internal state
|
|
26
26
|
clone() {
|
|
27
27
|
return this._cloneInto();
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function h(t) {
|
|
31
31
|
const e = (f) => t().update(u(f)).digest(), n = t();
|
|
32
32
|
return e.outputLen = n.outputLen, e.blockLen = n.blockLen, e.create = () => t(), e;
|
|
33
33
|
}
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
w as Hash,
|
|
36
36
|
r as byteSwap,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
p as
|
|
37
|
+
b as byteSwap32,
|
|
38
|
+
g as bytesToHex,
|
|
39
|
+
p as createView,
|
|
40
|
+
x as isLE,
|
|
41
|
+
l as rotr,
|
|
40
42
|
u as toBytes,
|
|
41
43
|
y as u32,
|
|
42
44
|
i as utf8ToBytes,
|
|
43
|
-
|
|
45
|
+
h as wrapConstructor
|
|
44
46
|
};
|
package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.cjs"),w=require("../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.cjs"),S=require("../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.cjs"),c=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.cjs"),N=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.cjs"),F=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.cjs"),i=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.cjs"),R=require("../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.cjs"),p=BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"),E=252;function g(e){for(;e[0]===0;)e=e.subarray(1);const n=e.length*8-E,t=i.bytesToNumberBE(e);return n>0?t>>BigInt(n):t}function m(e){return typeof e=="string"&&(e=_(e),e.length&1&&(e="0"+e)),i.hexToBytes(e)}const b=F.weierstrass({a:BigInt(1),b:BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),Fp:c.Field(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),n:p,nBitLength:E,Gx:BigInt("874739451078007766457464989774322083649278607533249481151382481072868806602"),Gy:BigInt("152666792071518830868575557812948353041420400780739481342941381225525861407"),h:BigInt(1),lowS:!1,...R.getHash(w.sha256),bits2int:g,bits2int_modN:e=>{const n=i.bytesToNumberBE(e).toString(16);return n.length===63&&(e=m(n+"0")),c.mod(g(e),p)}});function T(e){return i.ensureBytes("",typeof e=="string"?m(e):e)}const{ProjectivePoint:u}=b;function v(e){return`0x${i.bytesToHex(e.subarray(1)).replace(/^0+/gm,"")}`}function _(e){return e.replace(/^0x/i,"")}const a=[new u(2089986280348253421170679821480865132823066470938446095505822317253594081284n,1713931329540660377023406109199410414810705867260802078187082345529207694986n,1n),new u(996781205833008774514500082376783249102396023663454813447423147977397232763n,1668503676786377725805489344771023921079126552019160156920634619255970485781n,1n),new u(2251563274489750535117886426533222435294046428347329203627021249169616184184n,1798716007562728905295480679789526322175868328062420237419143593021674992973n,1n),new u(2138414695194151160943305727036575959195309218611738193261179310511854807447n,113410276730064486255102093846540133784865286929052426931474106396135072156n,1n),new u(2379962749567351885752724891227938183011949129833673362440656643086021394946n,776496453633298175483985398648758586525933812536653089401905292063708816422n,1n)];function y(e,n){const t=[];let r=e;for(let o=0;o<248;o++)t.push(r),r=r.double();r=n;for(let o=0;o<4;o++)t.push(r),r=r.double();return t}const q=y(a[1],a[2]),x=y(a[3],a[4]);function k(e){let n;if(typeof e=="bigint")n=e;else if(typeof e=="number"){if(!Number.isSafeInteger(e))throw new Error(`Invalid pedersenArg: ${e}`);n=BigInt(e)}else n=i.bytesToNumberBE(T(e));if(!(0n<=n&&n<b.CURVE.Fp.ORDER))throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${n}`);return n}function B(e,n,t){let r=k(n);for(let o=0;o<252;o++){const s=t[o];if(s.equals(e))throw new Error("Same point");(r&1n)!==0n&&(e=e.add(s)),r>>=1n}return e}function $(e,n){let t=a[0];return t=B(t,e,q),t=B(t,n,x),v(t.toRawBytes(!0))}const D=i.bitMask(250),O=e=>i.bytesToNumberBE(h.keccak_256(e))&D;c.Field(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));const I=c.Field(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));function j(e,n,t){const r=e.fromBytes(w.sha256(S.utf8ToBytes(`${n}${t}`)));return e.create(r)}const A=[[3,1,1],[1,-1,1],[1,1,-2]].map(e=>e.map(BigInt));function P(e,n){if(c.validateField(e.Fp),!Number.isSafeInteger(e.rate)||!Number.isSafeInteger(e.capacity))throw new Error(`Wrong poseidon opts: ${e}`);const t=e.rate+e.capacity,r=e.roundsFull+e.roundsPartial,o=[];for(let l=0;l<r;l++){const f=[];for(let d=0;d<t;d++)f.push(j(e.Fp,"Hades",t*l+d));o.push(f)}const s=N.poseidon({...e,t,sboxPower:3,reversePartialPowIdx:!0,mds:n,roundConstants:o});return s.m=t,s.rate=e.rate,s.capacity=e.capacity,s}P({Fp:I,rate:2,capacity:1,roundsFull:8,roundsPartial:83},A);exports.Fp251=I;exports.ProjectivePoint=u;exports.keccak=O;exports.pedersen=$;exports.poseidonBasic=P;
|
package/dist/node_modules/.pnpm/micro-starknet@0.2.3/node_modules/micro-starknet/lib/esm/index.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { keccak_256 as
|
|
1
|
+
import { keccak_256 as P } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha3.js";
|
|
2
2
|
import { sha256 as B } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/sha256.js";
|
|
3
|
-
import { utf8ToBytes as
|
|
4
|
-
import {
|
|
5
|
-
import { poseidon as
|
|
3
|
+
import { utf8ToBytes as S } from "../../../../../@noble_hashes@1.3.3/node_modules/@noble/hashes/esm/utils.js";
|
|
4
|
+
import { mod as h, Field as l, validateField as b } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/modular.js";
|
|
5
|
+
import { poseidon as R } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/poseidon.js";
|
|
6
6
|
import { weierstrass as N } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/weierstrass.js";
|
|
7
|
-
import { bytesToNumberBE as c,
|
|
7
|
+
import { bytesToNumberBE as c, ensureBytes as x, hexToBytes as F, bytesToHex as v, bitMask as T } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/abstract/utils.js";
|
|
8
8
|
import { getHash as _ } from "../../../../../@noble_curves@1.0.0/node_modules/@noble/curves/esm/_shortw_utils.js";
|
|
9
9
|
const d = BigInt("3618502788666131213697322783095070105526743751716087489154079457884512865583"), w = 252;
|
|
10
10
|
function m(n) {
|
|
11
11
|
for (; n[0] === 0; )
|
|
12
12
|
n = n.subarray(1);
|
|
13
|
-
const
|
|
14
|
-
return
|
|
13
|
+
const e = n.length * 8 - w, t = c(n);
|
|
14
|
+
return e > 0 ? t >> BigInt(e) : t;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
return typeof n == "string" && (n =
|
|
16
|
+
function I(n) {
|
|
17
|
+
return typeof n == "string" && (n = k(n), n.length & 1 && (n = "0" + n)), F(n);
|
|
18
18
|
}
|
|
19
|
-
const
|
|
19
|
+
const E = N({
|
|
20
20
|
a: BigInt(1),
|
|
21
21
|
b: BigInt("3141592653589793238462643383279502884197169399375105820974944592307816406665"),
|
|
22
22
|
Fp: l(BigInt("0x800000000000011000000000000000000000000000000000000000000000001")),
|
|
@@ -29,18 +29,18 @@ const I = N({
|
|
|
29
29
|
..._(B),
|
|
30
30
|
bits2int: m,
|
|
31
31
|
bits2int_modN: (n) => {
|
|
32
|
-
const
|
|
33
|
-
return
|
|
32
|
+
const e = c(n).toString(16);
|
|
33
|
+
return e.length === 63 && (n = I(e + "0")), h(m(n), d);
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
function $(n) {
|
|
37
|
-
return
|
|
37
|
+
return x("", typeof n == "string" ? I(n) : n);
|
|
38
38
|
}
|
|
39
|
-
const {
|
|
40
|
-
function
|
|
39
|
+
const { ProjectivePoint: s } = E;
|
|
40
|
+
function D(n) {
|
|
41
41
|
return `0x${v(n.subarray(1)).replace(/^0+/gm, "")}`;
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function k(n) {
|
|
44
44
|
return n.replace(/^0x/i, "");
|
|
45
45
|
}
|
|
46
46
|
const u = [
|
|
@@ -50,85 +50,82 @@ const u = [
|
|
|
50
50
|
new s(2138414695194151160943305727036575959195309218611738193261179310511854807447n, 113410276730064486255102093846540133784865286929052426931474106396135072156n, 1n),
|
|
51
51
|
new s(2379962749567351885752724891227938183011949129833673362440656643086021394946n, 776496453633298175483985398648758586525933812536653089401905292063708816422n, 1n)
|
|
52
52
|
];
|
|
53
|
-
function
|
|
54
|
-
const
|
|
53
|
+
function y(n, e) {
|
|
54
|
+
const t = [];
|
|
55
55
|
let r = n;
|
|
56
56
|
for (let o = 0; o < 248; o++)
|
|
57
|
-
|
|
58
|
-
r =
|
|
57
|
+
t.push(r), r = r.double();
|
|
58
|
+
r = e;
|
|
59
59
|
for (let o = 0; o < 4; o++)
|
|
60
|
-
|
|
61
|
-
return
|
|
60
|
+
t.push(r), r = r.double();
|
|
61
|
+
return t;
|
|
62
62
|
}
|
|
63
|
-
const
|
|
63
|
+
const A = y(u[1], u[2]), C = y(u[3], u[4]);
|
|
64
64
|
function O(n) {
|
|
65
|
-
let
|
|
65
|
+
let e;
|
|
66
66
|
if (typeof n == "bigint")
|
|
67
|
-
|
|
67
|
+
e = n;
|
|
68
68
|
else if (typeof n == "number") {
|
|
69
69
|
if (!Number.isSafeInteger(n))
|
|
70
70
|
throw new Error(`Invalid pedersenArg: ${n}`);
|
|
71
|
-
|
|
71
|
+
e = BigInt(n);
|
|
72
72
|
} else
|
|
73
|
-
|
|
74
|
-
if (!(0n <=
|
|
75
|
-
throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${
|
|
76
|
-
return
|
|
73
|
+
e = c($(n));
|
|
74
|
+
if (!(0n <= e && e < E.CURVE.Fp.ORDER))
|
|
75
|
+
throw new Error(`PedersenArg should be 0 <= value < CURVE.P: ${e}`);
|
|
76
|
+
return e;
|
|
77
77
|
}
|
|
78
|
-
function g(n,
|
|
79
|
-
let r = O(
|
|
78
|
+
function g(n, e, t) {
|
|
79
|
+
let r = O(e);
|
|
80
80
|
for (let o = 0; o < 252; o++) {
|
|
81
|
-
const i =
|
|
81
|
+
const i = t[o];
|
|
82
82
|
if (i.equals(n))
|
|
83
83
|
throw new Error("Same point");
|
|
84
84
|
(r & 1n) !== 0n && (n = n.add(i)), r >>= 1n;
|
|
85
85
|
}
|
|
86
86
|
return n;
|
|
87
87
|
}
|
|
88
|
-
function
|
|
89
|
-
let
|
|
90
|
-
return
|
|
88
|
+
function Q(n, e) {
|
|
89
|
+
let t = u[0];
|
|
90
|
+
return t = g(t, n, A), t = g(t, e, C), D(t.toRawBytes(!0));
|
|
91
91
|
}
|
|
92
|
-
const M =
|
|
92
|
+
const M = T(250), Y = (n) => c(P(n)) & M;
|
|
93
93
|
l(BigInt("14474011154664525231415395255581126252639794253786371766033694892385558855681"));
|
|
94
|
-
const
|
|
95
|
-
function
|
|
96
|
-
const r = n.fromBytes(B(
|
|
94
|
+
const j = l(BigInt("3618502788666131213697322783095070105623107215331596699973092056135872020481"));
|
|
95
|
+
function H(n, e, t) {
|
|
96
|
+
const r = n.fromBytes(B(S(`${e}${t}`)));
|
|
97
97
|
return n.create(r);
|
|
98
98
|
}
|
|
99
|
-
const
|
|
99
|
+
const L = [
|
|
100
100
|
[3, 1, 1],
|
|
101
101
|
[1, -1, 1],
|
|
102
102
|
[1, 1, -2]
|
|
103
103
|
].map((n) => n.map(BigInt));
|
|
104
|
-
function
|
|
105
|
-
if (
|
|
104
|
+
function U(n, e) {
|
|
105
|
+
if (b(n.Fp), !Number.isSafeInteger(n.rate) || !Number.isSafeInteger(n.capacity))
|
|
106
106
|
throw new Error(`Wrong poseidon opts: ${n}`);
|
|
107
|
-
const
|
|
107
|
+
const t = n.rate + n.capacity, r = n.roundsFull + n.roundsPartial, o = [];
|
|
108
108
|
for (let a = 0; a < r; a++) {
|
|
109
109
|
const p = [];
|
|
110
|
-
for (let f = 0; f <
|
|
111
|
-
p.push(
|
|
110
|
+
for (let f = 0; f < t; f++)
|
|
111
|
+
p.push(H(n.Fp, "Hades", t * a + f));
|
|
112
112
|
o.push(p);
|
|
113
113
|
}
|
|
114
|
-
const i =
|
|
114
|
+
const i = R({
|
|
115
115
|
...n,
|
|
116
|
-
t
|
|
116
|
+
t,
|
|
117
117
|
sboxPower: 3,
|
|
118
118
|
reversePartialPowIdx: !0,
|
|
119
|
-
mds:
|
|
119
|
+
mds: e,
|
|
120
120
|
roundConstants: o
|
|
121
121
|
});
|
|
122
|
-
return i.m =
|
|
122
|
+
return i.m = t, i.rate = n.rate, i.capacity = n.capacity, i;
|
|
123
123
|
}
|
|
124
|
-
|
|
124
|
+
U({ Fp: j, rate: 2, capacity: 1, roundsFull: 8, roundsPartial: 83 }, L);
|
|
125
125
|
export {
|
|
126
|
-
|
|
127
|
-
U as Fp251,
|
|
126
|
+
j as Fp251,
|
|
128
127
|
s as ProjectivePoint,
|
|
129
|
-
Y as
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
H as poseidonBasic,
|
|
133
|
-
Z as utils
|
|
128
|
+
Y as keccak,
|
|
129
|
+
Q as pedersen,
|
|
130
|
+
U as poseidonBasic
|
|
134
131
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=[{token:"accent-sky-blue",hex:"#29C5FF"},{token:"accent-yellow",hex:"#FFBF3D"},{token:"accent-brand",hex:"#FF875B"},{token:"accent-green",hex:"#2CD3A9"},{token:"accent-hot-pink",hex:"#FF5B81"}];exports.nameDataColors=e;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const e = [
|
|
2
|
+
{
|
|
3
|
+
token: "accent-sky-blue",
|
|
4
|
+
hex: "#29C5FF"
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
token: "accent-yellow",
|
|
8
|
+
hex: "#FFBF3D"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
token: "accent-brand",
|
|
12
|
+
hex: "#FF875B"
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
token: "accent-green",
|
|
16
|
+
hex: "#2CD3A9"
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
token: "accent-hot-pink",
|
|
20
|
+
hex: "#FF5B81"
|
|
21
|
+
}
|
|
22
|
+
];
|
|
23
|
+
export {
|
|
24
|
+
e as nameDataColors
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../../node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.cjs"),h=require("lodash-es"),d=require("./colors.cjs"),l=require("./x-names.json.cjs");class m{constructor(t,e){this.nameList=t||l.default,this.colorList=e||d.nameDataColors}generate(t){const e=this.hashSeed(t),n=e.getUint32(0)%this.nameList.items.length,s=this.nameList.items[n],o=e.getUint32(4)%s.adjectives.length,i=s.adjectives[o],r=e.getUint32(8)%this.colorList.length,c=this.colorList[r];return{name:`${h.upperFirst(i)} ${s.name}`,emoji:s.emoji,color:c}}hashSeed(t){const e=a.sha256(new TextEncoder().encode(t));return new DataView(e.buffer,e.byteOffset,e.byteLength)}}exports.AccountNameGenerator=m;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { GeneratedNameData, NameColor, NameDataList } from './types';
|
|
2
|
+
export declare class AccountNameGenerator {
|
|
3
|
+
nameList: NameDataList;
|
|
4
|
+
colorList: NameColor[];
|
|
5
|
+
constructor(nameList?: NameDataList, colorList?: NameColor[]);
|
|
6
|
+
generate(seed: string): GeneratedNameData;
|
|
7
|
+
private hashSeed;
|
|
8
|
+
}
|
|
9
|
+
export type * from './types';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { sha256 as c } from "../../node_modules/.pnpm/@noble_hashes@1.5.0/node_modules/@noble/hashes/esm/sha256.js";
|
|
2
|
+
import { upperFirst as m } from "lodash-es";
|
|
3
|
+
import { nameDataColors as h } from "./colors.js";
|
|
4
|
+
import d from "./x-names.json.js";
|
|
5
|
+
class j {
|
|
6
|
+
constructor(t, e) {
|
|
7
|
+
this.nameList = t || d, this.colorList = e || h;
|
|
8
|
+
}
|
|
9
|
+
generate(t) {
|
|
10
|
+
const e = this.hashSeed(t), s = e.getUint32(0) % this.nameList.items.length, o = this.nameList.items[s], n = e.getUint32(4) % o.adjectives.length, i = o.adjectives[n], r = e.getUint32(8) % this.colorList.length, a = this.colorList[r];
|
|
11
|
+
return {
|
|
12
|
+
name: `${m(i)} ${o.name}`,
|
|
13
|
+
emoji: o.emoji,
|
|
14
|
+
color: a
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
hashSeed(t) {
|
|
18
|
+
const e = c(new TextEncoder().encode(t));
|
|
19
|
+
return new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
j as AccountNameGenerator
|
|
24
|
+
};
|