@vleap/warps-adapter-fastset 0.1.0-alpha.26 → 0.1.0-alpha.27

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.mjs CHANGED
@@ -1,3 +1,11 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __export = (target, all) => {
4
+ for (var name2 in all)
5
+ __defProp(target, name2, { get: all[name2], enumerable: true });
6
+ };
7
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8
+
1
9
  // src/main.ts
2
10
  import { WarpChainName } from "@vleap/warps";
3
11
 
@@ -220,8 +228,8 @@ var WarpFastsetExplorer = class {
220
228
  getAccountUrl(address) {
221
229
  return `${this.explorerUrl}/account/${address}`;
222
230
  }
223
- getTransactionUrl(hash) {
224
- return `${this.explorerUrl}/transaction/${hash}`;
231
+ getTransactionUrl(hash2) {
232
+ return `${this.explorerUrl}/transaction/${hash2}`;
225
233
  }
226
234
  getAssetUrl(identifier) {
227
235
  return `${this.explorerUrl}/asset/${identifier}`;
@@ -444,15 +452,549 @@ import {
444
452
  getWarpWalletPrivateKeyFromConfig
445
453
  } from "@vleap/warps";
446
454
 
447
- // src/sdk/ed25519-setup.ts
448
- import * as ed from "@noble/ed25519";
455
+ // ../../node_modules/@noble/ed25519/index.js
456
+ var ed25519_exports = {};
457
+ __export(ed25519_exports, {
458
+ Point: () => Point,
459
+ etc: () => etc,
460
+ getPublicKey: () => getPublicKey,
461
+ getPublicKeyAsync: () => getPublicKeyAsync,
462
+ hash: () => hash,
463
+ hashes: () => hashes,
464
+ keygen: () => keygen,
465
+ keygenAsync: () => keygenAsync,
466
+ sign: () => sign,
467
+ signAsync: () => signAsync,
468
+ utils: () => utils,
469
+ verify: () => verify,
470
+ verifyAsync: () => verifyAsync
471
+ });
472
+ var ed25519_CURVE = {
473
+ p: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,
474
+ n: 0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3edn,
475
+ h: 8n,
476
+ a: 0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffecn,
477
+ d: 0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n,
478
+ Gx: 0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51an,
479
+ Gy: 0x6666666666666666666666666666666666666666666666666666666666666658n
480
+ };
481
+ var { p: P, n: N, Gx, Gy, a: _a, d: _d, h } = ed25519_CURVE;
482
+ var L = 32;
483
+ var L2 = 64;
484
+ var captureTrace = (...args) => {
485
+ if ("captureStackTrace" in Error && typeof Error.captureStackTrace === "function") {
486
+ Error.captureStackTrace(...args);
487
+ }
488
+ };
489
+ var err = (message = "") => {
490
+ const e = new Error(message);
491
+ captureTrace(e, err);
492
+ throw e;
493
+ };
494
+ var isBig = (n) => typeof n === "bigint";
495
+ var isStr = (s) => typeof s === "string";
496
+ var isBytes = (a) => a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
497
+ var abytes = (value, length, title = "") => {
498
+ const bytes = isBytes(value);
499
+ const len = value?.length;
500
+ const needsLen = length !== void 0;
501
+ if (!bytes || needsLen && len !== length) {
502
+ const prefix = title && `"${title}" `;
503
+ const ofLen = needsLen ? ` of length ${length}` : "";
504
+ const got = bytes ? `length=${len}` : `type=${typeof value}`;
505
+ err(prefix + "expected Uint8Array" + ofLen + ", got " + got);
506
+ }
507
+ return value;
508
+ };
509
+ var u8n = (len) => new Uint8Array(len);
510
+ var u8fr = (buf) => Uint8Array.from(buf);
511
+ var padh = (n, pad) => n.toString(16).padStart(pad, "0");
512
+ var bytesToHex = (b) => Array.from(abytes(b)).map((e) => padh(e, 2)).join("");
513
+ var C = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
514
+ var _ch = (ch) => {
515
+ if (ch >= C._0 && ch <= C._9)
516
+ return ch - C._0;
517
+ if (ch >= C.A && ch <= C.F)
518
+ return ch - (C.A - 10);
519
+ if (ch >= C.a && ch <= C.f)
520
+ return ch - (C.a - 10);
521
+ return;
522
+ };
523
+ var hexToBytes = (hex) => {
524
+ const e = "hex invalid";
525
+ if (!isStr(hex))
526
+ return err(e);
527
+ const hl = hex.length;
528
+ const al = hl / 2;
529
+ if (hl % 2)
530
+ return err(e);
531
+ const array = u8n(al);
532
+ for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
533
+ const n1 = _ch(hex.charCodeAt(hi));
534
+ const n2 = _ch(hex.charCodeAt(hi + 1));
535
+ if (n1 === void 0 || n2 === void 0)
536
+ return err(e);
537
+ array[ai] = n1 * 16 + n2;
538
+ }
539
+ return array;
540
+ };
541
+ var cr = () => globalThis?.crypto;
542
+ var subtle = () => cr()?.subtle ?? err("crypto.subtle must be defined, consider polyfill");
543
+ var concatBytes = (...arrs) => {
544
+ const r = u8n(arrs.reduce((sum, a) => sum + abytes(a).length, 0));
545
+ let pad = 0;
546
+ arrs.forEach((a) => {
547
+ r.set(a, pad);
548
+ pad += a.length;
549
+ });
550
+ return r;
551
+ };
552
+ var randomBytes = (len = L) => {
553
+ const c = cr();
554
+ return c.getRandomValues(u8n(len));
555
+ };
556
+ var big = BigInt;
557
+ var assertRange = (n, min, max, msg = "bad number: out of range") => isBig(n) && min <= n && n < max ? n : err(msg);
558
+ var M = (a, b = P) => {
559
+ const r = a % b;
560
+ return r >= 0n ? r : b + r;
561
+ };
562
+ var modN = (a) => M(a, N);
563
+ var invert = (num, md) => {
564
+ if (num === 0n || md <= 0n)
565
+ err("no inverse n=" + num + " mod=" + md);
566
+ let a = M(num, md), b = md, x = 0n, y = 1n, u = 1n, v = 0n;
567
+ while (a !== 0n) {
568
+ const q = b / a, r = b % a;
569
+ const m = x - u * q, n = y - v * q;
570
+ b = a, a = r, x = u, y = v, u = m, v = n;
571
+ }
572
+ return b === 1n ? M(x, md) : err("no inverse");
573
+ };
574
+ var callHash = (name2) => {
575
+ const fn = hashes[name2];
576
+ if (typeof fn !== "function")
577
+ err("hashes." + name2 + " not set");
578
+ return fn;
579
+ };
580
+ var hash = (msg) => callHash("sha512")(msg);
581
+ var apoint = (p) => p instanceof Point ? p : err("Point expected");
582
+ var B256 = 2n ** 256n;
583
+ var _Point = class _Point {
584
+ constructor(X, Y, Z, T) {
585
+ __publicField(this, "X");
586
+ __publicField(this, "Y");
587
+ __publicField(this, "Z");
588
+ __publicField(this, "T");
589
+ const max = B256;
590
+ this.X = assertRange(X, 0n, max);
591
+ this.Y = assertRange(Y, 0n, max);
592
+ this.Z = assertRange(Z, 1n, max);
593
+ this.T = assertRange(T, 0n, max);
594
+ Object.freeze(this);
595
+ }
596
+ static CURVE() {
597
+ return ed25519_CURVE;
598
+ }
599
+ static fromAffine(p) {
600
+ return new _Point(p.x, p.y, 1n, M(p.x * p.y));
601
+ }
602
+ /** RFC8032 5.1.3: Uint8Array to Point. */
603
+ static fromBytes(hex, zip215 = false) {
604
+ const d = _d;
605
+ const normed = u8fr(abytes(hex, L));
606
+ const lastByte = hex[31];
607
+ normed[31] = lastByte & ~128;
608
+ const y = bytesToNumLE(normed);
609
+ const max = zip215 ? B256 : P;
610
+ assertRange(y, 0n, max);
611
+ const y2 = M(y * y);
612
+ const u = M(y2 - 1n);
613
+ const v = M(d * y2 + 1n);
614
+ let { isValid, value: x } = uvRatio(u, v);
615
+ if (!isValid)
616
+ err("bad point: y not sqrt");
617
+ const isXOdd = (x & 1n) === 1n;
618
+ const isLastByteOdd = (lastByte & 128) !== 0;
619
+ if (!zip215 && x === 0n && isLastByteOdd)
620
+ err("bad point: x==0, isLastByteOdd");
621
+ if (isLastByteOdd !== isXOdd)
622
+ x = M(-x);
623
+ return new _Point(x, y, 1n, M(x * y));
624
+ }
625
+ static fromHex(hex, zip215) {
626
+ return _Point.fromBytes(hexToBytes(hex), zip215);
627
+ }
628
+ get x() {
629
+ return this.toAffine().x;
630
+ }
631
+ get y() {
632
+ return this.toAffine().y;
633
+ }
634
+ /** Checks if the point is valid and on-curve. */
635
+ assertValidity() {
636
+ const a = _a;
637
+ const d = _d;
638
+ const p = this;
639
+ if (p.is0())
640
+ return err("bad point: ZERO");
641
+ const { X, Y, Z, T } = p;
642
+ const X2 = M(X * X);
643
+ const Y2 = M(Y * Y);
644
+ const Z2 = M(Z * Z);
645
+ const Z4 = M(Z2 * Z2);
646
+ const aX2 = M(X2 * a);
647
+ const left = M(Z2 * M(aX2 + Y2));
648
+ const right = M(Z4 + M(d * M(X2 * Y2)));
649
+ if (left !== right)
650
+ return err("bad point: equation left != right (1)");
651
+ const XY = M(X * Y);
652
+ const ZT = M(Z * T);
653
+ if (XY !== ZT)
654
+ return err("bad point: equation left != right (2)");
655
+ return this;
656
+ }
657
+ /** Equality check: compare points P&Q. */
658
+ equals(other) {
659
+ const { X: X1, Y: Y1, Z: Z1 } = this;
660
+ const { X: X2, Y: Y2, Z: Z2 } = apoint(other);
661
+ const X1Z2 = M(X1 * Z2);
662
+ const X2Z1 = M(X2 * Z1);
663
+ const Y1Z2 = M(Y1 * Z2);
664
+ const Y2Z1 = M(Y2 * Z1);
665
+ return X1Z2 === X2Z1 && Y1Z2 === Y2Z1;
666
+ }
667
+ is0() {
668
+ return this.equals(I);
669
+ }
670
+ /** Flip point over y coordinate. */
671
+ negate() {
672
+ return new _Point(M(-this.X), this.Y, this.Z, M(-this.T));
673
+ }
674
+ /** Point doubling. Complete formula. Cost: `4M + 4S + 1*a + 6add + 1*2`. */
675
+ double() {
676
+ const { X: X1, Y: Y1, Z: Z1 } = this;
677
+ const a = _a;
678
+ const A = M(X1 * X1);
679
+ const B = M(Y1 * Y1);
680
+ const C2 = M(2n * M(Z1 * Z1));
681
+ const D = M(a * A);
682
+ const x1y1 = X1 + Y1;
683
+ const E = M(M(x1y1 * x1y1) - A - B);
684
+ const G2 = D + B;
685
+ const F = G2 - C2;
686
+ const H = D - B;
687
+ const X3 = M(E * F);
688
+ const Y3 = M(G2 * H);
689
+ const T3 = M(E * H);
690
+ const Z3 = M(F * G2);
691
+ return new _Point(X3, Y3, Z3, T3);
692
+ }
693
+ /** Point addition. Complete formula. Cost: `8M + 1*k + 8add + 1*2`. */
694
+ add(other) {
695
+ const { X: X1, Y: Y1, Z: Z1, T: T1 } = this;
696
+ const { X: X2, Y: Y2, Z: Z2, T: T2 } = apoint(other);
697
+ const a = _a;
698
+ const d = _d;
699
+ const A = M(X1 * X2);
700
+ const B = M(Y1 * Y2);
701
+ const C2 = M(T1 * d * T2);
702
+ const D = M(Z1 * Z2);
703
+ const E = M((X1 + Y1) * (X2 + Y2) - A - B);
704
+ const F = M(D - C2);
705
+ const G2 = M(D + C2);
706
+ const H = M(B - a * A);
707
+ const X3 = M(E * F);
708
+ const Y3 = M(G2 * H);
709
+ const T3 = M(E * H);
710
+ const Z3 = M(F * G2);
711
+ return new _Point(X3, Y3, Z3, T3);
712
+ }
713
+ subtract(other) {
714
+ return this.add(apoint(other).negate());
715
+ }
716
+ /**
717
+ * Point-by-scalar multiplication. Scalar must be in range 1 <= n < CURVE.n.
718
+ * Uses {@link wNAF} for base point.
719
+ * Uses fake point to mitigate side-channel leakage.
720
+ * @param n scalar by which point is multiplied
721
+ * @param safe safe mode guards against timing attacks; unsafe mode is faster
722
+ */
723
+ multiply(n, safe = true) {
724
+ if (!safe && (n === 0n || this.is0()))
725
+ return I;
726
+ assertRange(n, 1n, N);
727
+ if (n === 1n)
728
+ return this;
729
+ if (this.equals(G))
730
+ return wNAF(n).p;
731
+ let p = I;
732
+ let f = G;
733
+ for (let d = this; n > 0n; d = d.double(), n >>= 1n) {
734
+ if (n & 1n)
735
+ p = p.add(d);
736
+ else if (safe)
737
+ f = f.add(d);
738
+ }
739
+ return p;
740
+ }
741
+ multiplyUnsafe(scalar) {
742
+ return this.multiply(scalar, false);
743
+ }
744
+ /** Convert point to 2d xy affine point. (X, Y, Z) ∋ (x=X/Z, y=Y/Z) */
745
+ toAffine() {
746
+ const { X, Y, Z } = this;
747
+ if (this.equals(I))
748
+ return { x: 0n, y: 1n };
749
+ const iz = invert(Z, P);
750
+ if (M(Z * iz) !== 1n)
751
+ err("invalid inverse");
752
+ const x = M(X * iz);
753
+ const y = M(Y * iz);
754
+ return { x, y };
755
+ }
756
+ toBytes() {
757
+ const { x, y } = this.assertValidity().toAffine();
758
+ const b = numTo32bLE(y);
759
+ b[31] |= x & 1n ? 128 : 0;
760
+ return b;
761
+ }
762
+ toHex() {
763
+ return bytesToHex(this.toBytes());
764
+ }
765
+ clearCofactor() {
766
+ return this.multiply(big(h), false);
767
+ }
768
+ isSmallOrder() {
769
+ return this.clearCofactor().is0();
770
+ }
771
+ isTorsionFree() {
772
+ let p = this.multiply(N / 2n, false).double();
773
+ if (N % 2n)
774
+ p = p.add(this);
775
+ return p.is0();
776
+ }
777
+ };
778
+ __publicField(_Point, "BASE");
779
+ __publicField(_Point, "ZERO");
780
+ var Point = _Point;
781
+ var G = new Point(Gx, Gy, 1n, M(Gx * Gy));
782
+ var I = new Point(0n, 1n, 1n, 0n);
783
+ Point.BASE = G;
784
+ Point.ZERO = I;
785
+ var numTo32bLE = (num) => hexToBytes(padh(assertRange(num, 0n, B256), L2)).reverse();
786
+ var bytesToNumLE = (b) => big("0x" + bytesToHex(u8fr(abytes(b)).reverse()));
787
+ var pow2 = (x, power) => {
788
+ let r = x;
789
+ while (power-- > 0n) {
790
+ r *= r;
791
+ r %= P;
792
+ }
793
+ return r;
794
+ };
795
+ var pow_2_252_3 = (x) => {
796
+ const x2 = x * x % P;
797
+ const b2 = x2 * x % P;
798
+ const b4 = pow2(b2, 2n) * b2 % P;
799
+ const b5 = pow2(b4, 1n) * x % P;
800
+ const b10 = pow2(b5, 5n) * b5 % P;
801
+ const b20 = pow2(b10, 10n) * b10 % P;
802
+ const b40 = pow2(b20, 20n) * b20 % P;
803
+ const b80 = pow2(b40, 40n) * b40 % P;
804
+ const b160 = pow2(b80, 80n) * b80 % P;
805
+ const b240 = pow2(b160, 80n) * b80 % P;
806
+ const b250 = pow2(b240, 10n) * b10 % P;
807
+ const pow_p_5_8 = pow2(b250, 2n) * x % P;
808
+ return { pow_p_5_8, b2 };
809
+ };
810
+ var RM1 = 0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n;
811
+ var uvRatio = (u, v) => {
812
+ const v3 = M(v * v * v);
813
+ const v7 = M(v3 * v3 * v);
814
+ const pow = pow_2_252_3(u * v7).pow_p_5_8;
815
+ let x = M(u * v3 * pow);
816
+ const vx2 = M(v * x * x);
817
+ const root1 = x;
818
+ const root2 = M(x * RM1);
819
+ const useRoot1 = vx2 === u;
820
+ const useRoot2 = vx2 === M(-u);
821
+ const noRoot = vx2 === M(-u * RM1);
822
+ if (useRoot1)
823
+ x = root1;
824
+ if (useRoot2 || noRoot)
825
+ x = root2;
826
+ if ((M(x) & 1n) === 1n)
827
+ x = M(-x);
828
+ return { isValid: useRoot1 || useRoot2, value: x };
829
+ };
830
+ var modL_LE = (hash2) => modN(bytesToNumLE(hash2));
831
+ var sha512a = (...m) => hashes.sha512Async(concatBytes(...m));
832
+ var sha512s = (...m) => callHash("sha512")(concatBytes(...m));
833
+ var hash2extK = (hashed) => {
834
+ const head = hashed.slice(0, L);
835
+ head[0] &= 248;
836
+ head[31] &= 127;
837
+ head[31] |= 64;
838
+ const prefix = hashed.slice(L, L2);
839
+ const scalar = modL_LE(head);
840
+ const point = G.multiply(scalar);
841
+ const pointBytes = point.toBytes();
842
+ return { head, prefix, scalar, point, pointBytes };
843
+ };
844
+ var getExtendedPublicKeyAsync = (secretKey) => sha512a(abytes(secretKey, L)).then(hash2extK);
845
+ var getExtendedPublicKey = (secretKey) => hash2extK(sha512s(abytes(secretKey, L)));
846
+ var getPublicKeyAsync = (secretKey) => getExtendedPublicKeyAsync(secretKey).then((p) => p.pointBytes);
847
+ var getPublicKey = (priv) => getExtendedPublicKey(priv).pointBytes;
848
+ var hashFinishA = (res) => sha512a(res.hashable).then(res.finish);
849
+ var hashFinishS = (res) => res.finish(sha512s(res.hashable));
850
+ var _sign = (e, rBytes, msg) => {
851
+ const { pointBytes: P2, scalar: s } = e;
852
+ const r = modL_LE(rBytes);
853
+ const R = G.multiply(r).toBytes();
854
+ const hashable = concatBytes(R, P2, msg);
855
+ const finish = (hashed) => {
856
+ const S = modN(r + modL_LE(hashed) * s);
857
+ return abytes(concatBytes(R, numTo32bLE(S)), L2);
858
+ };
859
+ return { hashable, finish };
860
+ };
861
+ var signAsync = async (message, secretKey) => {
862
+ const m = abytes(message);
863
+ const e = await getExtendedPublicKeyAsync(secretKey);
864
+ const rBytes = await sha512a(e.prefix, m);
865
+ return hashFinishA(_sign(e, rBytes, m));
866
+ };
867
+ var sign = (message, secretKey) => {
868
+ const m = abytes(message);
869
+ const e = getExtendedPublicKey(secretKey);
870
+ const rBytes = sha512s(e.prefix, m);
871
+ return hashFinishS(_sign(e, rBytes, m));
872
+ };
873
+ var defaultVerifyOpts = { zip215: true };
874
+ var _verify = (sig, msg, pub, opts = defaultVerifyOpts) => {
875
+ sig = abytes(sig, L2);
876
+ msg = abytes(msg);
877
+ pub = abytes(pub, L);
878
+ const { zip215 } = opts;
879
+ let A;
880
+ let R;
881
+ let s;
882
+ let SB;
883
+ let hashable = Uint8Array.of();
884
+ try {
885
+ A = Point.fromBytes(pub, zip215);
886
+ R = Point.fromBytes(sig.slice(0, L), zip215);
887
+ s = bytesToNumLE(sig.slice(L, L2));
888
+ SB = G.multiply(s, false);
889
+ hashable = concatBytes(R.toBytes(), A.toBytes(), msg);
890
+ } catch (error) {
891
+ }
892
+ const finish = (hashed) => {
893
+ if (SB == null)
894
+ return false;
895
+ if (!zip215 && A.isSmallOrder())
896
+ return false;
897
+ const k = modL_LE(hashed);
898
+ const RkA = R.add(A.multiply(k, false));
899
+ return RkA.add(SB.negate()).clearCofactor().is0();
900
+ };
901
+ return { hashable, finish };
902
+ };
903
+ var verifyAsync = async (signature, message, publicKey, opts = defaultVerifyOpts) => hashFinishA(_verify(signature, message, publicKey, opts));
904
+ var verify = (signature, message, publicKey, opts = defaultVerifyOpts) => hashFinishS(_verify(signature, message, publicKey, opts));
905
+ var etc = {
906
+ bytesToHex,
907
+ hexToBytes,
908
+ concatBytes,
909
+ mod: M,
910
+ invert,
911
+ randomBytes
912
+ };
913
+ var hashes = {
914
+ sha512Async: async (message) => {
915
+ const s = subtle();
916
+ const m = concatBytes(message);
917
+ return u8n(await s.digest("SHA-512", m.buffer));
918
+ },
919
+ sha512: void 0
920
+ };
921
+ var randomSecretKey = (seed = randomBytes(L)) => seed;
922
+ var keygen = (seed) => {
923
+ const secretKey = randomSecretKey(seed);
924
+ const publicKey = getPublicKey(secretKey);
925
+ return { secretKey, publicKey };
926
+ };
927
+ var keygenAsync = async (seed) => {
928
+ const secretKey = randomSecretKey(seed);
929
+ const publicKey = await getPublicKeyAsync(secretKey);
930
+ return { secretKey, publicKey };
931
+ };
932
+ var utils = {
933
+ getExtendedPublicKeyAsync,
934
+ getExtendedPublicKey,
935
+ randomSecretKey
936
+ };
937
+ var W = 8;
938
+ var scalarBits = 256;
939
+ var pwindows = Math.ceil(scalarBits / W) + 1;
940
+ var pwindowSize = 2 ** (W - 1);
941
+ var precompute = () => {
942
+ const points = [];
943
+ let p = G;
944
+ let b = p;
945
+ for (let w = 0; w < pwindows; w++) {
946
+ b = p;
947
+ points.push(b);
948
+ for (let i = 1; i < pwindowSize; i++) {
949
+ b = b.add(p);
950
+ points.push(b);
951
+ }
952
+ p = b.double();
953
+ }
954
+ return points;
955
+ };
956
+ var Gpows = void 0;
957
+ var ctneg = (cnd, p) => {
958
+ const n = p.negate();
959
+ return cnd ? n : p;
960
+ };
961
+ var wNAF = (n) => {
962
+ const comp = Gpows || (Gpows = precompute());
963
+ let p = I;
964
+ let f = G;
965
+ const pow_2_w = 2 ** W;
966
+ const maxNum = pow_2_w;
967
+ const mask = big(pow_2_w - 1);
968
+ const shiftBy = big(W);
969
+ for (let w = 0; w < pwindows; w++) {
970
+ let wbits = Number(n & mask);
971
+ n >>= shiftBy;
972
+ if (wbits > pwindowSize) {
973
+ wbits -= maxNum;
974
+ n += 1n;
975
+ }
976
+ const off = w * pwindowSize;
977
+ const offF = off;
978
+ const offP = off + Math.abs(wbits) - 1;
979
+ const isEven = w % 2 !== 0;
980
+ const isNeg = wbits < 0;
981
+ if (wbits === 0) {
982
+ f = f.add(ctneg(isEven, comp[offF]));
983
+ } else {
984
+ p = p.add(ctneg(isNeg, comp[offP]));
985
+ }
986
+ }
987
+ if (n !== 0n)
988
+ err("invalid wnaf");
989
+ return { p, f };
990
+ };
449
991
 
450
992
  // ../../node_modules/@noble/hashes/esm/utils.js
451
- function isBytes(a) {
993
+ function isBytes2(a) {
452
994
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
453
995
  }
454
- function abytes(b, ...lengths) {
455
- if (!isBytes(b))
996
+ function abytes2(b, ...lengths) {
997
+ if (!isBytes2(b))
456
998
  throw new Error("Uint8Array expected");
457
999
  if (lengths.length > 0 && !lengths.includes(b.length))
458
1000
  throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
@@ -464,7 +1006,7 @@ function aexists(instance, checkFinished = true) {
464
1006
  throw new Error("Hash#digest() has already been called");
465
1007
  }
466
1008
  function aoutput(out, instance) {
467
- abytes(out);
1009
+ abytes2(out);
468
1010
  const min = instance.outputLen;
469
1011
  if (out.length < min) {
470
1012
  throw new Error("digestInto() expects output buffer of length at least " + min);
@@ -486,7 +1028,7 @@ function utf8ToBytes(str) {
486
1028
  function toBytes(data) {
487
1029
  if (typeof data === "string")
488
1030
  data = utf8ToBytes(data);
489
- abytes(data);
1031
+ abytes2(data);
490
1032
  return data;
491
1033
  }
492
1034
  var Hash = class {
@@ -508,9 +1050,9 @@ function setBigUint64(view, byteOffset, value, isLE) {
508
1050
  const _u32_max = BigInt(4294967295);
509
1051
  const wh = Number(value >> _32n2 & _u32_max);
510
1052
  const wl = Number(value & _u32_max);
511
- const h = isLE ? 4 : 0;
1053
+ const h2 = isLE ? 4 : 0;
512
1054
  const l = isLE ? 0 : 4;
513
- view.setUint32(byteOffset + h, wh, isLE);
1055
+ view.setUint32(byteOffset + h2, wh, isLE);
514
1056
  view.setUint32(byteOffset + l, wl, isLE);
515
1057
  }
516
1058
  var HashMD = class extends Hash {
@@ -530,7 +1072,7 @@ var HashMD = class extends Hash {
530
1072
  update(data) {
531
1073
  aexists(this);
532
1074
  data = toBytes(data);
533
- abytes(data);
1075
+ abytes2(data);
534
1076
  const { view, buffer, blockLen } = this;
535
1077
  const len = data.length;
536
1078
  for (let pos = 0; pos < len; ) {
@@ -635,17 +1177,17 @@ function split(lst, le = false) {
635
1177
  let Ah = new Uint32Array(len);
636
1178
  let Al = new Uint32Array(len);
637
1179
  for (let i = 0; i < len; i++) {
638
- const { h, l } = fromBig(lst[i], le);
639
- [Ah[i], Al[i]] = [h, l];
1180
+ const { h: h2, l } = fromBig(lst[i], le);
1181
+ [Ah[i], Al[i]] = [h2, l];
640
1182
  }
641
1183
  return [Ah, Al];
642
1184
  }
643
- var shrSH = (h, _l, s) => h >>> s;
644
- var shrSL = (h, l, s) => h << 32 - s | l >>> s;
645
- var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
646
- var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
647
- var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
648
- var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
1185
+ var shrSH = (h2, _l, s) => h2 >>> s;
1186
+ var shrSL = (h2, l, s) => h2 << 32 - s | l >>> s;
1187
+ var rotrSH = (h2, l, s) => h2 >>> s | l << 32 - s;
1188
+ var rotrSL = (h2, l, s) => h2 << 32 - s | l >>> s;
1189
+ var rotrBH = (h2, l, s) => h2 << 64 - s | l >>> s - 32;
1190
+ var rotrBL = (h2, l, s) => h2 >>> s - 32 | l << 64 - s;
649
1191
  function add(Ah, Al, Bh, Bl) {
650
1192
  const l = (Al >>> 0) + (Bl >>> 0);
651
1193
  return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
@@ -861,10 +1403,10 @@ var sha512 = /* @__PURE__ */ createHasher(() => new SHA512());
861
1403
  var sha5122 = sha512;
862
1404
 
863
1405
  // src/sdk/ed25519-setup.ts
864
- ed.hashes.sha512 = sha5122;
1406
+ hashes.sha512 = sha5122;
865
1407
 
866
1408
  // ../../node_modules/@scure/base/lib/esm/index.js
867
- function isBytes2(a) {
1409
+ function isBytes3(a) {
868
1410
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
869
1411
  }
870
1412
  function isArrayOf(isString, arr) {
@@ -1002,7 +1544,7 @@ function radix(num) {
1002
1544
  const _256 = 2 ** 8;
1003
1545
  return {
1004
1546
  encode: (bytes) => {
1005
- if (!isBytes2(bytes))
1547
+ if (!isBytes3(bytes))
1006
1548
  throw new Error("radix.encode input should be Uint8Array");
1007
1549
  return convertRadix(Array.from(bytes), _256, num);
1008
1550
  },
@@ -2211,9 +2753,6 @@ var WarpFastsetWallet = class {
2211
2753
  this.config = config;
2212
2754
  this.chain = chain2;
2213
2755
  this.client = getConfiguredFastsetClient(this.config, this.chain);
2214
- const privateKey = getWarpWalletPrivateKeyFromConfig(this.config, this.chain.name);
2215
- if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
2216
- this.privateKey = privateKey;
2217
2756
  }
2218
2757
  async signTransaction(tx) {
2219
2758
  const msg = Transaction.serialize(tx);
@@ -2222,14 +2761,18 @@ var WarpFastsetWallet = class {
2222
2761
  const dataToSign = new Uint8Array(prefix.length + msgBytes.length);
2223
2762
  dataToSign.set(prefix, 0);
2224
2763
  dataToSign.set(msgBytes, prefix.length);
2225
- const privateKeyBytes = hexToUint8Array(this.privateKey);
2226
- const signature = ed.sign(dataToSign, privateKeyBytes);
2764
+ const privateKey = getWarpWalletPrivateKeyFromConfig(this.config, this.chain.name);
2765
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
2766
+ const privateKeyBytes = hexToUint8Array(privateKey);
2767
+ const signature = ed25519_exports.sign(dataToSign, privateKeyBytes);
2227
2768
  return { ...tx, signature };
2228
2769
  }
2229
2770
  async signMessage(message) {
2230
2771
  const messageBytes = stringToUint8Array(message);
2231
- const privateKeyBytes = hexToUint8Array(this.privateKey);
2232
- const signature = ed.sign(messageBytes, privateKeyBytes);
2772
+ const privateKey = getWarpWalletPrivateKeyFromConfig(this.config, this.chain.name);
2773
+ if (!privateKey) throw new Error("Wallet not initialized - no private key provided");
2774
+ const privateKeyBytes = hexToUint8Array(privateKey);
2775
+ const signature = ed25519_exports.sign(messageBytes, privateKeyBytes);
2233
2776
  return uint8ArrayToHex(signature);
2234
2777
  }
2235
2778
  async sendTransaction(tx) {
@@ -2244,13 +2787,13 @@ var WarpFastsetWallet = class {
2244
2787
  create(mnemonic) {
2245
2788
  const seed = bip39.mnemonicToSeedSync(mnemonic);
2246
2789
  const privateKey = seed.slice(0, 32);
2247
- const publicKey = ed.getPublicKey(privateKey);
2790
+ const publicKey = ed25519_exports.getPublicKey(privateKey);
2248
2791
  const address = FastsetClient.encodeBech32Address(publicKey);
2249
2792
  return { address, privateKey: uint8ArrayToHex(privateKey), mnemonic };
2250
2793
  }
2251
2794
  generate() {
2252
- const privateKey = ed.utils.randomPrivateKey();
2253
- const publicKey = ed.getPublicKey(privateKey);
2795
+ const privateKey = ed25519_exports.utils.randomPrivateKey();
2796
+ const publicKey = ed25519_exports.getPublicKey(privateKey);
2254
2797
  const address = FastsetClient.encodeBech32Address(publicKey);
2255
2798
  return { address, privateKey: uint8ArrayToHex(privateKey), mnemonic: null };
2256
2799
  }
@@ -2330,6 +2873,9 @@ export {
2330
2873
  };
2331
2874
  /*! Bundled license information:
2332
2875
 
2876
+ @noble/ed25519/index.js:
2877
+ (*! noble-ed25519 - MIT License (c) 2019 Paul Miller (paulmillr.com) *)
2878
+
2333
2879
  @noble/hashes/esm/utils.js:
2334
2880
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
2335
2881