@fastnear/api 0.3.0 → 0.5.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.
Files changed (40) hide show
  1. package/dist/cjs/index.cjs +40 -0
  2. package/dist/cjs/index.cjs.map +1 -0
  3. package/dist/cjs/index.d.cts +3339 -0
  4. package/dist/esm/index.d.ts +3339 -0
  5. package/dist/esm/index.js +9 -60
  6. package/dist/esm/index.js.map +1 -7
  7. package/dist/umd/{index.js → browser.global.js} +416 -219
  8. package/dist/umd/browser.global.js.map +1 -0
  9. package/package.json +13 -10
  10. package/dist/cjs/cryptoUtils.js +0 -89
  11. package/dist/cjs/cryptoUtils.js.map +0 -7
  12. package/dist/cjs/index.esm.js +0 -1191
  13. package/dist/cjs/index.esm.js.map +0 -7
  14. package/dist/cjs/index.js +0 -1246
  15. package/dist/cjs/index.js.map +0 -7
  16. package/dist/cjs/near.js +0 -1191
  17. package/dist/cjs/near.js.map +0 -7
  18. package/dist/cjs/transaction.js +0 -360
  19. package/dist/cjs/transaction.js.map +0 -7
  20. package/dist/cjs/utils.js +0 -105
  21. package/dist/cjs/utils.js.map +0 -7
  22. package/dist/esm/chunk-2SCAGR3F.js +0 -68
  23. package/dist/esm/chunk-2SCAGR3F.js.map +0 -7
  24. package/dist/esm/chunk-B2HMQPYI.js +0 -814
  25. package/dist/esm/chunk-B2HMQPYI.js.map +0 -7
  26. package/dist/esm/chunk-S5Q2EM2B.js +0 -48
  27. package/dist/esm/chunk-S5Q2EM2B.js.map +0 -7
  28. package/dist/esm/chunk-YKPILPMX.js +0 -301
  29. package/dist/esm/chunk-YKPILPMX.js.map +0 -7
  30. package/dist/esm/cryptoUtils.js +0 -21
  31. package/dist/esm/cryptoUtils.js.map +0 -7
  32. package/dist/esm/index.esm.js +0 -13
  33. package/dist/esm/index.esm.js.map +0 -7
  34. package/dist/esm/near.js +0 -15
  35. package/dist/esm/near.js.map +0 -7
  36. package/dist/esm/transaction.js +0 -16
  37. package/dist/esm/transaction.js.map +0 -7
  38. package/dist/esm/utils.js +0 -24
  39. package/dist/esm/utils.js.map +0 -7
  40. package/dist/umd/index.js.map +0 -7
@@ -1,9 +1,18 @@
1
- /* ⋈ 🏃🏻💨 FastNEAR API - https://github.com/fastnear */
2
- var FastNear = (() => {
1
+ /* ⋈ 🏃🏻💨 FastNEAR API - IIFE/UMD */
2
+ var NearApi = (() => {
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
+ }) : x)(function(x) {
13
+ if (typeof require !== "undefined") return require.apply(this, arguments);
14
+ throw Error('Dynamic require of "' + x + '" is not supported');
15
+ });
7
16
  var __export = (target, all) => {
8
17
  for (var name in all)
9
18
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -16,6 +25,14 @@ var FastNear = (() => {
16
25
  }
17
26
  return to;
18
27
  };
28
+ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
29
+ // If the importer is in node compatibility mode or this is not an ESM
30
+ // file that has been converted to a CommonJS file using a Babel-
31
+ // compatible transform (i.e. "__esModule" has not been set), then set
32
+ // "default" to the CommonJS "module.exports" for node compatibility.
33
+ isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
34
+ mod2
35
+ ));
19
36
  var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
20
37
 
21
38
  // src/index.ts
@@ -82,6 +99,7 @@ var FastNear = (() => {
82
99
  }
83
100
  x.constructor = Big2;
84
101
  }
102
+ __name(Big2, "Big");
85
103
  Big2.prototype = P;
86
104
  Big2.DP = DP;
87
105
  Big2.RM = RM;
@@ -94,6 +112,7 @@ var FastNear = (() => {
94
112
  Big2.roundUp = 3;
95
113
  return Big2;
96
114
  }
115
+ __name(_Big_, "_Big_");
97
116
  function parse(x, n) {
98
117
  var e, i, nl;
99
118
  if (!NUMERIC.test(n)) {
@@ -120,6 +139,7 @@ var FastNear = (() => {
120
139
  }
121
140
  return x;
122
141
  }
142
+ __name(parse, "parse");
123
143
  function round(x, sd, rm, more) {
124
144
  var xc = x.c;
125
145
  if (rm === UNDEFINED) rm = x.constructor.RM;
@@ -152,6 +172,7 @@ var FastNear = (() => {
152
172
  }
153
173
  return x;
154
174
  }
175
+ __name(round, "round");
155
176
  function stringify(x, doExponential, isNonzero) {
156
177
  var e = x.e, s = x.c.join(""), n = s.length;
157
178
  if (doExponential) {
@@ -170,6 +191,7 @@ var FastNear = (() => {
170
191
  }
171
192
  return x.s < 0 && isNonzero ? "-" + s : s;
172
193
  }
194
+ __name(stringify, "stringify");
173
195
  P.abs = function() {
174
196
  var x = new this.constructor(this);
175
197
  x.s = 1;
@@ -532,6 +554,9 @@ var FastNear = (() => {
532
554
 
533
555
  // ../wallet-adapter/src/index.ts
534
556
  var WalletAdapter = class _WalletAdapter {
557
+ static {
558
+ __name(this, "WalletAdapter");
559
+ }
535
560
  /** @type {HTMLIFrameElement} */
536
561
  #iframe = null;
537
562
  /** @type {string} */
@@ -549,8 +574,8 @@ var FastNear = (() => {
549
574
  /** @type {string} */
550
575
  static defaultWidgetUrl = "https://wallet-adapter.fastnear.com";
551
576
  /**
552
- * @param {WalletAdapterConfig} [config]
553
- */
577
+ * @param {WalletAdapterConfig} [config]
578
+ */
554
579
  constructor({
555
580
  widgetUrl = _WalletAdapter.defaultWidgetUrl,
556
581
  targetOrigin = "*",
@@ -575,6 +600,7 @@ var FastNear = (() => {
575
600
  this.#iframe.remove();
576
601
  }
577
602
  const url = new URL(path, this.#widgetUrl);
603
+ console.log("aloha wa url", url);
578
604
  const iframe = document.createElement("iframe");
579
605
  iframe.src = url.toString();
580
606
  iframe.allow = "usb";
@@ -666,7 +692,7 @@ var FastNear = (() => {
666
692
  * @returns {Promise<SignInResult>}
667
693
  */
668
694
  async signIn(config) {
669
- return this.#sendMessage("/login.html", "signIn", config);
695
+ return this.#sendMessage("/public/login.html", "signIn", config);
670
696
  }
671
697
  /**
672
698
  * Send a transaction using connected wallet
@@ -674,7 +700,7 @@ var FastNear = (() => {
674
700
  * @returns {Promise<TransactionResult>}
675
701
  */
676
702
  async sendTransactions(config) {
677
- return this.#sendMessage("/send.html", "sendTransactions", config);
703
+ return this.#sendMessage("/public/send.html", "sendTransactions", config);
678
704
  }
679
705
  /**
680
706
  * Clean up adapter resources
@@ -690,18 +716,21 @@ var FastNear = (() => {
690
716
  function isBytes(a) {
691
717
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
692
718
  }
719
+ __name(isBytes, "isBytes");
693
720
  function abytes(b, ...lengths) {
694
721
  if (!isBytes(b))
695
722
  throw new Error("Uint8Array expected");
696
723
  if (lengths.length > 0 && !lengths.includes(b.length))
697
724
  throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
698
725
  }
726
+ __name(abytes, "abytes");
699
727
  function aexists(instance, checkFinished = true) {
700
728
  if (instance.destroyed)
701
729
  throw new Error("Hash instance has been destroyed");
702
730
  if (checkFinished && instance.finished)
703
731
  throw new Error("Hash#digest() has already been called");
704
732
  }
733
+ __name(aexists, "aexists");
705
734
  function aoutput(out, instance) {
706
735
  abytes(out);
707
736
  const min = instance.outputLen;
@@ -709,37 +738,45 @@ var FastNear = (() => {
709
738
  throw new Error("digestInto() expects output buffer of length at least " + min);
710
739
  }
711
740
  }
741
+ __name(aoutput, "aoutput");
712
742
 
713
- // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/crypto.js
714
- var crypto2 = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
743
+ // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/cryptoNode.js
744
+ var nc = __toESM(__require("node:crypto"), 1);
745
+ var crypto2 = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
715
746
 
716
747
  // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/utils.js
717
- var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
748
+ var createView = /* @__PURE__ */ __name((arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength), "createView");
718
749
  function utf8ToBytes(str) {
719
750
  if (typeof str !== "string")
720
751
  throw new Error("utf8ToBytes expected string, got " + typeof str);
721
752
  return new Uint8Array(new TextEncoder().encode(str));
722
753
  }
754
+ __name(utf8ToBytes, "utf8ToBytes");
723
755
  function toBytes(data) {
724
756
  if (typeof data === "string")
725
757
  data = utf8ToBytes(data);
726
758
  abytes(data);
727
759
  return data;
728
760
  }
761
+ __name(toBytes, "toBytes");
729
762
  var Hash = class {
763
+ static {
764
+ __name(this, "Hash");
765
+ }
730
766
  // Safe version that clones internal state
731
767
  clone() {
732
768
  return this._cloneInto();
733
769
  }
734
770
  };
735
771
  function wrapConstructor(hashCons) {
736
- const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
772
+ const hashC = /* @__PURE__ */ __name((msg) => hashCons().update(toBytes(msg)).digest(), "hashC");
737
773
  const tmp = hashCons();
738
774
  hashC.outputLen = tmp.outputLen;
739
775
  hashC.blockLen = tmp.blockLen;
740
776
  hashC.create = () => hashCons();
741
777
  return hashC;
742
778
  }
779
+ __name(wrapConstructor, "wrapConstructor");
743
780
  function randomBytes(bytesLength = 32) {
744
781
  if (crypto2 && typeof crypto2.getRandomValues === "function") {
745
782
  return crypto2.getRandomValues(new Uint8Array(bytesLength));
@@ -749,6 +786,7 @@ var FastNear = (() => {
749
786
  }
750
787
  throw new Error("crypto.getRandomValues must be defined");
751
788
  }
789
+ __name(randomBytes, "randomBytes");
752
790
 
753
791
  // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/_md.js
754
792
  function setBigUint64(view, byteOffset, value, isLE) {
@@ -763,7 +801,11 @@ var FastNear = (() => {
763
801
  view.setUint32(byteOffset + h, wh, isLE);
764
802
  view.setUint32(byteOffset + l, wl, isLE);
765
803
  }
804
+ __name(setBigUint64, "setBigUint64");
766
805
  var HashMD = class extends Hash {
806
+ static {
807
+ __name(this, "HashMD");
808
+ }
767
809
  constructor(blockLen, outputLen, padOffset, isLE) {
768
810
  super();
769
811
  this.blockLen = blockLen;
@@ -858,6 +900,7 @@ var FastNear = (() => {
858
900
  return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
859
901
  return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
860
902
  }
903
+ __name(fromBig, "fromBig");
861
904
  function split(lst, le = false) {
862
905
  let Ah = new Uint32Array(lst.length);
863
906
  let Al = new Uint32Array(lst.length);
@@ -867,29 +910,31 @@ var FastNear = (() => {
867
910
  }
868
911
  return [Ah, Al];
869
912
  }
870
- var toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0);
871
- var shrSH = (h, _l, s) => h >>> s;
872
- var shrSL = (h, l, s) => h << 32 - s | l >>> s;
873
- var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
874
- var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
875
- var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
876
- var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
877
- var rotr32H = (_h, l) => l;
878
- var rotr32L = (h, _l) => h;
879
- var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
880
- var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
881
- var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
882
- var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
913
+ __name(split, "split");
914
+ var toBig = /* @__PURE__ */ __name((h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0), "toBig");
915
+ var shrSH = /* @__PURE__ */ __name((h, _l, s) => h >>> s, "shrSH");
916
+ var shrSL = /* @__PURE__ */ __name((h, l, s) => h << 32 - s | l >>> s, "shrSL");
917
+ var rotrSH = /* @__PURE__ */ __name((h, l, s) => h >>> s | l << 32 - s, "rotrSH");
918
+ var rotrSL = /* @__PURE__ */ __name((h, l, s) => h << 32 - s | l >>> s, "rotrSL");
919
+ var rotrBH = /* @__PURE__ */ __name((h, l, s) => h << 64 - s | l >>> s - 32, "rotrBH");
920
+ var rotrBL = /* @__PURE__ */ __name((h, l, s) => h >>> s - 32 | l << 64 - s, "rotrBL");
921
+ var rotr32H = /* @__PURE__ */ __name((_h, l) => l, "rotr32H");
922
+ var rotr32L = /* @__PURE__ */ __name((h, _l) => h, "rotr32L");
923
+ var rotlSH = /* @__PURE__ */ __name((h, l, s) => h << s | l >>> 32 - s, "rotlSH");
924
+ var rotlSL = /* @__PURE__ */ __name((h, l, s) => l << s | h >>> 32 - s, "rotlSL");
925
+ var rotlBH = /* @__PURE__ */ __name((h, l, s) => l << s - 32 | h >>> 64 - s, "rotlBH");
926
+ var rotlBL = /* @__PURE__ */ __name((h, l, s) => h << s - 32 | l >>> 64 - s, "rotlBL");
883
927
  function add(Ah, Al, Bh, Bl) {
884
928
  const l = (Al >>> 0) + (Bl >>> 0);
885
929
  return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
886
930
  }
887
- var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
888
- var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
889
- var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
890
- var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
891
- var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
892
- var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
931
+ __name(add, "add");
932
+ var add3L = /* @__PURE__ */ __name((Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0), "add3L");
933
+ var add3H = /* @__PURE__ */ __name((low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0, "add3H");
934
+ var add4L = /* @__PURE__ */ __name((Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0), "add4L");
935
+ var add4H = /* @__PURE__ */ __name((low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0, "add4H");
936
+ var add5L = /* @__PURE__ */ __name((Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0), "add5L");
937
+ var add5H = /* @__PURE__ */ __name((low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0, "add5H");
893
938
  var u64 = {
894
939
  fromBig,
895
940
  split,
@@ -1002,6 +1047,9 @@ var FastNear = (() => {
1002
1047
  var SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
1003
1048
  var SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
1004
1049
  var SHA512 = class extends HashMD {
1050
+ static {
1051
+ __name(this, "SHA512");
1052
+ }
1005
1053
  constructor() {
1006
1054
  super(128, 64, 16, false);
1007
1055
  this.Ah = 1779033703 | 0;
@@ -1122,14 +1170,17 @@ var FastNear = (() => {
1122
1170
  function isBytes2(a) {
1123
1171
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
1124
1172
  }
1173
+ __name(isBytes2, "isBytes");
1125
1174
  function abytes2(item) {
1126
1175
  if (!isBytes2(item))
1127
1176
  throw new Error("Uint8Array expected");
1128
1177
  }
1178
+ __name(abytes2, "abytes");
1129
1179
  function abool(title, value) {
1130
1180
  if (typeof value !== "boolean")
1131
1181
  throw new Error(title + " boolean expected, got " + value);
1132
1182
  }
1183
+ __name(abool, "abool");
1133
1184
  var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
1134
1185
  function bytesToHex(bytes) {
1135
1186
  abytes2(bytes);
@@ -1139,11 +1190,13 @@ var FastNear = (() => {
1139
1190
  }
1140
1191
  return hex;
1141
1192
  }
1193
+ __name(bytesToHex, "bytesToHex");
1142
1194
  function hexToNumber(hex) {
1143
1195
  if (typeof hex !== "string")
1144
1196
  throw new Error("hex string expected, got " + typeof hex);
1145
1197
  return hex === "" ? _0n : BigInt("0x" + hex);
1146
1198
  }
1199
+ __name(hexToNumber, "hexToNumber");
1147
1200
  var asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
1148
1201
  function asciiToBase16(ch) {
1149
1202
  if (ch >= asciis._0 && ch <= asciis._9)
@@ -1154,6 +1207,7 @@ var FastNear = (() => {
1154
1207
  return ch - (asciis.a - 10);
1155
1208
  return;
1156
1209
  }
1210
+ __name(asciiToBase16, "asciiToBase16");
1157
1211
  function hexToBytes(hex) {
1158
1212
  if (typeof hex !== "string")
1159
1213
  throw new Error("hex string expected, got " + typeof hex);
@@ -1173,19 +1227,24 @@ var FastNear = (() => {
1173
1227
  }
1174
1228
  return array;
1175
1229
  }
1230
+ __name(hexToBytes, "hexToBytes");
1176
1231
  function bytesToNumberBE(bytes) {
1177
1232
  return hexToNumber(bytesToHex(bytes));
1178
1233
  }
1234
+ __name(bytesToNumberBE, "bytesToNumberBE");
1179
1235
  function bytesToNumberLE(bytes) {
1180
1236
  abytes2(bytes);
1181
1237
  return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));
1182
1238
  }
1239
+ __name(bytesToNumberLE, "bytesToNumberLE");
1183
1240
  function numberToBytesBE(n, len) {
1184
1241
  return hexToBytes(n.toString(16).padStart(len * 2, "0"));
1185
1242
  }
1243
+ __name(numberToBytesBE, "numberToBytesBE");
1186
1244
  function numberToBytesLE(n, len) {
1187
1245
  return numberToBytesBE(n, len).reverse();
1188
1246
  }
1247
+ __name(numberToBytesLE, "numberToBytesLE");
1189
1248
  function ensureBytes(title, hex, expectedLength) {
1190
1249
  let res;
1191
1250
  if (typeof hex === "string") {
@@ -1204,6 +1263,7 @@ var FastNear = (() => {
1204
1263
  throw new Error(title + " of length " + expectedLength + " expected, got " + len);
1205
1264
  return res;
1206
1265
  }
1266
+ __name(ensureBytes, "ensureBytes");
1207
1267
  function concatBytes(...arrays) {
1208
1268
  let sum = 0;
1209
1269
  for (let i = 0; i < arrays.length; i++) {
@@ -1219,34 +1279,38 @@ var FastNear = (() => {
1219
1279
  }
1220
1280
  return res;
1221
1281
  }
1222
- var isPosBig = (n) => typeof n === "bigint" && _0n <= n;
1282
+ __name(concatBytes, "concatBytes");
1283
+ var isPosBig = /* @__PURE__ */ __name((n) => typeof n === "bigint" && _0n <= n, "isPosBig");
1223
1284
  function inRange(n, min, max) {
1224
1285
  return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
1225
1286
  }
1287
+ __name(inRange, "inRange");
1226
1288
  function aInRange(title, n, min, max) {
1227
1289
  if (!inRange(n, min, max))
1228
1290
  throw new Error("expected valid " + title + ": " + min + " <= n < " + max + ", got " + n);
1229
1291
  }
1292
+ __name(aInRange, "aInRange");
1230
1293
  function bitLen(n) {
1231
1294
  let len;
1232
1295
  for (len = 0; n > _0n; n >>= _1n, len += 1)
1233
1296
  ;
1234
1297
  return len;
1235
1298
  }
1236
- var bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;
1299
+ __name(bitLen, "bitLen");
1300
+ var bitMask = /* @__PURE__ */ __name((n) => (_2n << BigInt(n - 1)) - _1n, "bitMask");
1237
1301
  var validatorFns = {
1238
- bigint: (val) => typeof val === "bigint",
1239
- function: (val) => typeof val === "function",
1240
- boolean: (val) => typeof val === "boolean",
1241
- string: (val) => typeof val === "string",
1242
- stringOrUint8Array: (val) => typeof val === "string" || isBytes2(val),
1243
- isSafeInteger: (val) => Number.isSafeInteger(val),
1244
- array: (val) => Array.isArray(val),
1245
- field: (val, object) => object.Fp.isValid(val),
1246
- hash: (val) => typeof val === "function" && Number.isSafeInteger(val.outputLen)
1302
+ bigint: /* @__PURE__ */ __name((val) => typeof val === "bigint", "bigint"),
1303
+ function: /* @__PURE__ */ __name((val) => typeof val === "function", "function"),
1304
+ boolean: /* @__PURE__ */ __name((val) => typeof val === "boolean", "boolean"),
1305
+ string: /* @__PURE__ */ __name((val) => typeof val === "string", "string"),
1306
+ stringOrUint8Array: /* @__PURE__ */ __name((val) => typeof val === "string" || isBytes2(val), "stringOrUint8Array"),
1307
+ isSafeInteger: /* @__PURE__ */ __name((val) => Number.isSafeInteger(val), "isSafeInteger"),
1308
+ array: /* @__PURE__ */ __name((val) => Array.isArray(val), "array"),
1309
+ field: /* @__PURE__ */ __name((val, object) => object.Fp.isValid(val), "field"),
1310
+ hash: /* @__PURE__ */ __name((val) => typeof val === "function" && Number.isSafeInteger(val.outputLen), "hash")
1247
1311
  };
1248
1312
  function validateObject(object, validators, optValidators = {}) {
1249
- const checkField = (fieldName, type, isOptional) => {
1313
+ const checkField = /* @__PURE__ */ __name((fieldName, type, isOptional) => {
1250
1314
  const checkVal = validatorFns[type];
1251
1315
  if (typeof checkVal !== "function")
1252
1316
  throw new Error("invalid validator function");
@@ -1256,13 +1320,14 @@ var FastNear = (() => {
1256
1320
  if (!checkVal(val, object)) {
1257
1321
  throw new Error("param " + String(fieldName) + " is invalid. Expected " + type + ", got " + val);
1258
1322
  }
1259
- };
1323
+ }, "checkField");
1260
1324
  for (const [fieldName, type] of Object.entries(validators))
1261
1325
  checkField(fieldName, type, false);
1262
1326
  for (const [fieldName, type] of Object.entries(optValidators))
1263
1327
  checkField(fieldName, type, true);
1264
1328
  return object;
1265
1329
  }
1330
+ __name(validateObject, "validateObject");
1266
1331
  function memoized(fn) {
1267
1332
  const map = /* @__PURE__ */ new WeakMap();
1268
1333
  return (arg, ...args) => {
@@ -1274,6 +1339,7 @@ var FastNear = (() => {
1274
1339
  return computed;
1275
1340
  };
1276
1341
  }
1342
+ __name(memoized, "memoized");
1277
1343
 
1278
1344
  // ../../node_modules/@noble/curves/esm/abstract/modular.js
1279
1345
  var _0n2 = BigInt(0);
@@ -1289,6 +1355,7 @@ var FastNear = (() => {
1289
1355
  const result = a % b;
1290
1356
  return result >= _0n2 ? result : b + result;
1291
1357
  }
1358
+ __name(mod, "mod");
1292
1359
  function pow(num, power, modulo) {
1293
1360
  if (power < _0n2)
1294
1361
  throw new Error("invalid exponent, negatives unsupported");
@@ -1305,6 +1372,7 @@ var FastNear = (() => {
1305
1372
  }
1306
1373
  return res;
1307
1374
  }
1375
+ __name(pow, "pow");
1308
1376
  function pow2(x, power, modulo) {
1309
1377
  let res = x;
1310
1378
  while (power-- > _0n2) {
@@ -1313,6 +1381,7 @@ var FastNear = (() => {
1313
1381
  }
1314
1382
  return res;
1315
1383
  }
1384
+ __name(pow2, "pow2");
1316
1385
  function invert(number, modulo) {
1317
1386
  if (number === _0n2)
1318
1387
  throw new Error("invert: expected non-zero number");
@@ -1333,6 +1402,7 @@ var FastNear = (() => {
1333
1402
  throw new Error("invert: does not exist");
1334
1403
  return mod(x, modulo);
1335
1404
  }
1405
+ __name(invert, "invert");
1336
1406
  function tonelliShanks(P2) {
1337
1407
  const legendreC = (P2 - _1n2) / _2n2;
1338
1408
  let Q, S, Z;
@@ -1344,15 +1414,15 @@ var FastNear = (() => {
1344
1414
  }
1345
1415
  if (S === 1) {
1346
1416
  const p1div4 = (P2 + _1n2) / _4n;
1347
- return function tonelliFast(Fp2, n) {
1417
+ return /* @__PURE__ */ __name(function tonelliFast(Fp2, n) {
1348
1418
  const root = Fp2.pow(n, p1div4);
1349
1419
  if (!Fp2.eql(Fp2.sqr(root), n))
1350
1420
  throw new Error("Cannot find square root");
1351
1421
  return root;
1352
- };
1422
+ }, "tonelliFast");
1353
1423
  }
1354
1424
  const Q1div2 = (Q + _1n2) / _2n2;
1355
- return function tonelliSlow(Fp2, n) {
1425
+ return /* @__PURE__ */ __name(function tonelliSlow(Fp2, n) {
1356
1426
  if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE))
1357
1427
  throw new Error("Cannot find square root");
1358
1428
  let r = S;
@@ -1375,21 +1445,22 @@ var FastNear = (() => {
1375
1445
  r = m;
1376
1446
  }
1377
1447
  return x;
1378
- };
1448
+ }, "tonelliSlow");
1379
1449
  }
1450
+ __name(tonelliShanks, "tonelliShanks");
1380
1451
  function FpSqrt(P2) {
1381
1452
  if (P2 % _4n === _3n) {
1382
1453
  const p1div4 = (P2 + _1n2) / _4n;
1383
- return function sqrt3mod4(Fp2, n) {
1454
+ return /* @__PURE__ */ __name(function sqrt3mod4(Fp2, n) {
1384
1455
  const root = Fp2.pow(n, p1div4);
1385
1456
  if (!Fp2.eql(Fp2.sqr(root), n))
1386
1457
  throw new Error("Cannot find square root");
1387
1458
  return root;
1388
- };
1459
+ }, "sqrt3mod4");
1389
1460
  }
1390
1461
  if (P2 % _8n === _5n) {
1391
1462
  const c1 = (P2 - _5n) / _8n;
1392
- return function sqrt5mod8(Fp2, n) {
1463
+ return /* @__PURE__ */ __name(function sqrt5mod8(Fp2, n) {
1393
1464
  const n2 = Fp2.mul(n, _2n2);
1394
1465
  const v = Fp2.pow(n2, c1);
1395
1466
  const nv = Fp2.mul(n, v);
@@ -1398,13 +1469,14 @@ var FastNear = (() => {
1398
1469
  if (!Fp2.eql(Fp2.sqr(root), n))
1399
1470
  throw new Error("Cannot find square root");
1400
1471
  return root;
1401
- };
1472
+ }, "sqrt5mod8");
1402
1473
  }
1403
1474
  if (P2 % _16n === _9n) {
1404
1475
  }
1405
1476
  return tonelliShanks(P2);
1406
1477
  }
1407
- var isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n2) === _1n2;
1478
+ __name(FpSqrt, "FpSqrt");
1479
+ var isNegativeLE = /* @__PURE__ */ __name((num, modulo) => (mod(num, modulo) & _1n2) === _1n2, "isNegativeLE");
1408
1480
  var FIELD_FIELDS = [
1409
1481
  "create",
1410
1482
  "isValid",
@@ -1437,6 +1509,7 @@ var FastNear = (() => {
1437
1509
  }, initial);
1438
1510
  return validateObject(field, opts);
1439
1511
  }
1512
+ __name(validateField, "validateField");
1440
1513
  function FpPow(f, num, power) {
1441
1514
  if (power < _0n2)
1442
1515
  throw new Error("invalid exponent, negatives unsupported");
@@ -1454,6 +1527,7 @@ var FastNear = (() => {
1454
1527
  }
1455
1528
  return p;
1456
1529
  }
1530
+ __name(FpPow, "FpPow");
1457
1531
  function FpInvertBatch(f, nums) {
1458
1532
  const tmp = new Array(nums.length);
1459
1533
  const lastMultiplied = nums.reduce((acc, num, i) => {
@@ -1471,11 +1545,13 @@ var FastNear = (() => {
1471
1545
  }, inverted);
1472
1546
  return tmp;
1473
1547
  }
1548
+ __name(FpInvertBatch, "FpInvertBatch");
1474
1549
  function nLength(n, nBitLength) {
1475
1550
  const _nBitLength = nBitLength !== void 0 ? nBitLength : n.toString(2).length;
1476
1551
  const nByteLength = Math.ceil(_nBitLength / 8);
1477
1552
  return { nBitLength: _nBitLength, nByteLength };
1478
1553
  }
1554
+ __name(nLength, "nLength");
1479
1555
  function Field(ORDER, bitLen2, isLE = false, redef = {}) {
1480
1556
  if (ORDER <= _0n2)
1481
1557
  throw new Error("invalid field: expected ORDER > 0, got " + ORDER);
@@ -1490,46 +1566,47 @@ var FastNear = (() => {
1490
1566
  MASK: bitMask(BITS),
1491
1567
  ZERO: _0n2,
1492
1568
  ONE: _1n2,
1493
- create: (num) => mod(num, ORDER),
1494
- isValid: (num) => {
1569
+ create: /* @__PURE__ */ __name((num) => mod(num, ORDER), "create"),
1570
+ isValid: /* @__PURE__ */ __name((num) => {
1495
1571
  if (typeof num !== "bigint")
1496
1572
  throw new Error("invalid field element: expected bigint, got " + typeof num);
1497
1573
  return _0n2 <= num && num < ORDER;
1498
- },
1499
- is0: (num) => num === _0n2,
1500
- isOdd: (num) => (num & _1n2) === _1n2,
1501
- neg: (num) => mod(-num, ORDER),
1502
- eql: (lhs, rhs) => lhs === rhs,
1503
- sqr: (num) => mod(num * num, ORDER),
1504
- add: (lhs, rhs) => mod(lhs + rhs, ORDER),
1505
- sub: (lhs, rhs) => mod(lhs - rhs, ORDER),
1506
- mul: (lhs, rhs) => mod(lhs * rhs, ORDER),
1507
- pow: (num, power) => FpPow(f, num, power),
1508
- div: (lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER),
1574
+ }, "isValid"),
1575
+ is0: /* @__PURE__ */ __name((num) => num === _0n2, "is0"),
1576
+ isOdd: /* @__PURE__ */ __name((num) => (num & _1n2) === _1n2, "isOdd"),
1577
+ neg: /* @__PURE__ */ __name((num) => mod(-num, ORDER), "neg"),
1578
+ eql: /* @__PURE__ */ __name((lhs, rhs) => lhs === rhs, "eql"),
1579
+ sqr: /* @__PURE__ */ __name((num) => mod(num * num, ORDER), "sqr"),
1580
+ add: /* @__PURE__ */ __name((lhs, rhs) => mod(lhs + rhs, ORDER), "add"),
1581
+ sub: /* @__PURE__ */ __name((lhs, rhs) => mod(lhs - rhs, ORDER), "sub"),
1582
+ mul: /* @__PURE__ */ __name((lhs, rhs) => mod(lhs * rhs, ORDER), "mul"),
1583
+ pow: /* @__PURE__ */ __name((num, power) => FpPow(f, num, power), "pow"),
1584
+ div: /* @__PURE__ */ __name((lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), "div"),
1509
1585
  // Same as above, but doesn't normalize
1510
- sqrN: (num) => num * num,
1511
- addN: (lhs, rhs) => lhs + rhs,
1512
- subN: (lhs, rhs) => lhs - rhs,
1513
- mulN: (lhs, rhs) => lhs * rhs,
1514
- inv: (num) => invert(num, ORDER),
1586
+ sqrN: /* @__PURE__ */ __name((num) => num * num, "sqrN"),
1587
+ addN: /* @__PURE__ */ __name((lhs, rhs) => lhs + rhs, "addN"),
1588
+ subN: /* @__PURE__ */ __name((lhs, rhs) => lhs - rhs, "subN"),
1589
+ mulN: /* @__PURE__ */ __name((lhs, rhs) => lhs * rhs, "mulN"),
1590
+ inv: /* @__PURE__ */ __name((num) => invert(num, ORDER), "inv"),
1515
1591
  sqrt: redef.sqrt || ((n) => {
1516
1592
  if (!sqrtP)
1517
1593
  sqrtP = FpSqrt(ORDER);
1518
1594
  return sqrtP(f, n);
1519
1595
  }),
1520
- invertBatch: (lst) => FpInvertBatch(f, lst),
1596
+ invertBatch: /* @__PURE__ */ __name((lst) => FpInvertBatch(f, lst), "invertBatch"),
1521
1597
  // TODO: do we really need constant cmov?
1522
1598
  // We don't have const-time bigints anyway, so probably will be not very useful
1523
- cmov: (a, b, c) => c ? b : a,
1524
- toBytes: (num) => isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES),
1525
- fromBytes: (bytes) => {
1599
+ cmov: /* @__PURE__ */ __name((a, b, c) => c ? b : a, "cmov"),
1600
+ toBytes: /* @__PURE__ */ __name((num) => isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES), "toBytes"),
1601
+ fromBytes: /* @__PURE__ */ __name((bytes) => {
1526
1602
  if (bytes.length !== BYTES)
1527
1603
  throw new Error("Field.fromBytes: expected " + BYTES + " bytes, got " + bytes.length);
1528
1604
  return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);
1529
- }
1605
+ }, "fromBytes")
1530
1606
  });
1531
1607
  return Object.freeze(f);
1532
1608
  }
1609
+ __name(Field, "Field");
1533
1610
 
1534
1611
  // ../../node_modules/@noble/curves/esm/abstract/curve.js
1535
1612
  var _0n3 = BigInt(0);
@@ -1538,16 +1615,19 @@ var FastNear = (() => {
1538
1615
  const neg = item.negate();
1539
1616
  return condition ? neg : item;
1540
1617
  }
1618
+ __name(constTimeNegate, "constTimeNegate");
1541
1619
  function validateW(W, bits) {
1542
1620
  if (!Number.isSafeInteger(W) || W <= 0 || W > bits)
1543
1621
  throw new Error("invalid window size, expected [1.." + bits + "], got W=" + W);
1544
1622
  }
1623
+ __name(validateW, "validateW");
1545
1624
  function calcWOpts(W, bits) {
1546
1625
  validateW(W, bits);
1547
1626
  const windows = Math.ceil(bits / W) + 1;
1548
1627
  const windowSize = 2 ** (W - 1);
1549
1628
  return { windows, windowSize };
1550
1629
  }
1630
+ __name(calcWOpts, "calcWOpts");
1551
1631
  function validateMSMPoints(points, c) {
1552
1632
  if (!Array.isArray(points))
1553
1633
  throw new Error("array expected");
@@ -1556,6 +1636,7 @@ var FastNear = (() => {
1556
1636
  throw new Error("invalid point at index " + i);
1557
1637
  });
1558
1638
  }
1639
+ __name(validateMSMPoints, "validateMSMPoints");
1559
1640
  function validateMSMScalars(scalars, field) {
1560
1641
  if (!Array.isArray(scalars))
1561
1642
  throw new Error("array of scalars expected");
@@ -1564,11 +1645,13 @@ var FastNear = (() => {
1564
1645
  throw new Error("invalid scalar at index " + i);
1565
1646
  });
1566
1647
  }
1648
+ __name(validateMSMScalars, "validateMSMScalars");
1567
1649
  var pointPrecomputes = /* @__PURE__ */ new WeakMap();
1568
1650
  var pointWindowSizes = /* @__PURE__ */ new WeakMap();
1569
1651
  function getW(P2) {
1570
1652
  return pointWindowSizes.get(P2) || 1;
1571
1653
  }
1654
+ __name(getW, "getW");
1572
1655
  function wNAF(c, bits) {
1573
1656
  return {
1574
1657
  constTimeNegate,
@@ -1709,6 +1792,7 @@ var FastNear = (() => {
1709
1792
  }
1710
1793
  };
1711
1794
  }
1795
+ __name(wNAF, "wNAF");
1712
1796
  function pippenger(c, fieldN, points, scalars) {
1713
1797
  validateMSMPoints(points, c);
1714
1798
  validateMSMScalars(scalars, fieldN);
@@ -1740,6 +1824,7 @@ var FastNear = (() => {
1740
1824
  }
1741
1825
  return sum;
1742
1826
  }
1827
+ __name(pippenger, "pippenger");
1743
1828
  function validateBasic(curve) {
1744
1829
  validateField(curve.Fp);
1745
1830
  validateObject(curve, {
@@ -1757,6 +1842,7 @@ var FastNear = (() => {
1757
1842
  ...{ p: curve.Fp.ORDER }
1758
1843
  });
1759
1844
  }
1845
+ __name(validateBasic, "validateBasic");
1760
1846
 
1761
1847
  // ../../node_modules/@noble/curves/esm/abstract/edwards.js
1762
1848
  var _0n4 = BigInt(0);
@@ -1779,6 +1865,7 @@ var FastNear = (() => {
1779
1865
  });
1780
1866
  return Object.freeze({ ...opts });
1781
1867
  }
1868
+ __name(validateOpts, "validateOpts");
1782
1869
  function twistedEdwards(curveDef) {
1783
1870
  const CURVE = validateOpts(curveDef);
1784
1871
  const { Fp: Fp2, n: CURVE_ORDER, prehash, hash: cHash, randomBytes: randomBytes2, nByteLength, h: cofactor } = CURVE;
@@ -1802,10 +1889,12 @@ var FastNear = (() => {
1802
1889
  function aCoordinate(title, n) {
1803
1890
  aInRange("coordinate " + title, n, _0n4, MASK);
1804
1891
  }
1892
+ __name(aCoordinate, "aCoordinate");
1805
1893
  function assertPoint(other) {
1806
1894
  if (!(other instanceof Point))
1807
1895
  throw new Error("ExtendedPoint expected");
1808
1896
  }
1897
+ __name(assertPoint, "assertPoint");
1809
1898
  const toAffineMemo = memoized((p, iz) => {
1810
1899
  const { ex: x, ey: y, ez: z } = p;
1811
1900
  const is0 = p.is0();
@@ -1841,6 +1930,9 @@ var FastNear = (() => {
1841
1930
  return true;
1842
1931
  });
1843
1932
  class Point {
1933
+ static {
1934
+ __name(this, "Point");
1935
+ }
1844
1936
  constructor(ex, ey, ez, et) {
1845
1937
  this.ex = ex;
1846
1938
  this.ey = ey;
@@ -2057,9 +2149,11 @@ var FastNear = (() => {
2057
2149
  function modN(a) {
2058
2150
  return mod(a, CURVE_ORDER);
2059
2151
  }
2152
+ __name(modN, "modN");
2060
2153
  function modN_LE(hash) {
2061
2154
  return modN(bytesToNumberLE(hash));
2062
2155
  }
2156
+ __name(modN_LE, "modN_LE");
2063
2157
  function getExtendedPublicKey(key) {
2064
2158
  const len = Fp2.BYTES;
2065
2159
  key = ensureBytes("private key", key, len);
@@ -2071,13 +2165,16 @@ var FastNear = (() => {
2071
2165
  const pointBytes = point.toRawBytes();
2072
2166
  return { head, prefix, scalar, point, pointBytes };
2073
2167
  }
2168
+ __name(getExtendedPublicKey, "getExtendedPublicKey");
2074
2169
  function getPublicKey(privKey) {
2075
2170
  return getExtendedPublicKey(privKey).pointBytes;
2076
2171
  }
2172
+ __name(getPublicKey, "getPublicKey");
2077
2173
  function hashDomainToScalar(context = new Uint8Array(), ...msgs) {
2078
2174
  const msg = concatBytes(...msgs);
2079
2175
  return modN_LE(cHash(domain(msg, ensureBytes("context", context), !!prehash)));
2080
2176
  }
2177
+ __name(hashDomainToScalar, "hashDomainToScalar");
2081
2178
  function sign(msg, privKey, options = {}) {
2082
2179
  msg = ensureBytes("message", msg);
2083
2180
  if (prehash)
@@ -2091,6 +2188,7 @@ var FastNear = (() => {
2091
2188
  const res = concatBytes(R, numberToBytesLE(s, Fp2.BYTES));
2092
2189
  return ensureBytes("result", res, Fp2.BYTES * 2);
2093
2190
  }
2191
+ __name(sign, "sign");
2094
2192
  const verifyOpts = VERIFY_DEFAULT;
2095
2193
  function verify(sig, msg, publicKey, options = verifyOpts) {
2096
2194
  const { context, zip215 } = options;
@@ -2117,11 +2215,12 @@ var FastNear = (() => {
2117
2215
  const RkA = R.add(A.multiplyUnsafe(k));
2118
2216
  return RkA.subtract(SB).clearCofactor().equals(Point.ZERO);
2119
2217
  }
2218
+ __name(verify, "verify");
2120
2219
  G._setWindowSize(8);
2121
2220
  const utils = {
2122
2221
  getExtendedPublicKey,
2123
2222
  // ed25519 private keys are uniform 32b. No need to check for modulo bias, like in secp256k1.
2124
- randomPrivateKey: () => randomBytes2(Fp2.BYTES),
2223
+ randomPrivateKey: /* @__PURE__ */ __name(() => randomBytes2(Fp2.BYTES), "randomPrivateKey"),
2125
2224
  /**
2126
2225
  * We're doing scalar multiplication (used in getPublicKey etc) with precomputed BASE_POINT
2127
2226
  * values. This slows down first getPublicKey() by milliseconds (see Speed section),
@@ -2143,6 +2242,7 @@ var FastNear = (() => {
2143
2242
  utils
2144
2243
  };
2145
2244
  }
2245
+ __name(twistedEdwards, "twistedEdwards");
2146
2246
 
2147
2247
  // ../../node_modules/@noble/curves/esm/ed25519.js
2148
2248
  var ED25519_P = BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");
@@ -2170,12 +2270,14 @@ var FastNear = (() => {
2170
2270
  const pow_p_5_8 = pow2(b250, _2n4, P2) * x % P2;
2171
2271
  return { pow_p_5_8, b2 };
2172
2272
  }
2273
+ __name(ed25519_pow_2_252_3, "ed25519_pow_2_252_3");
2173
2274
  function adjustScalarBytes(bytes) {
2174
2275
  bytes[0] &= 248;
2175
2276
  bytes[31] &= 127;
2176
2277
  bytes[31] |= 64;
2177
2278
  return bytes;
2178
2279
  }
2280
+ __name(adjustScalarBytes, "adjustScalarBytes");
2179
2281
  function uvRatio(u, v) {
2180
2282
  const P2 = ED25519_P;
2181
2283
  const v3 = mod(v * v * v, P2);
@@ -2196,6 +2298,7 @@ var FastNear = (() => {
2196
2298
  x = mod(-x, P2);
2197
2299
  return { isValid: useRoot1 || useRoot2, value: x };
2198
2300
  }
2301
+ __name(uvRatio, "uvRatio");
2199
2302
  var Fp = /* @__PURE__ */ (() => Field(ED25519_P, void 0, true))();
2200
2303
  var ed25519Defaults = /* @__PURE__ */ (() => ({
2201
2304
  // Param: a
@@ -2228,18 +2331,21 @@ var FastNear = (() => {
2228
2331
  function isBytes3(a) {
2229
2332
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
2230
2333
  }
2334
+ __name(isBytes3, "isBytes");
2231
2335
  function abytes3(b, ...lengths) {
2232
2336
  if (!isBytes3(b))
2233
2337
  throw new Error("Uint8Array expected");
2234
2338
  if (lengths.length > 0 && !lengths.includes(b.length))
2235
2339
  throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
2236
2340
  }
2341
+ __name(abytes3, "abytes");
2237
2342
  function aexists2(instance, checkFinished = true) {
2238
2343
  if (instance.destroyed)
2239
2344
  throw new Error("Hash instance has been destroyed");
2240
2345
  if (checkFinished && instance.finished)
2241
2346
  throw new Error("Hash#digest() has already been called");
2242
2347
  }
2348
+ __name(aexists2, "aexists");
2243
2349
  function aoutput2(out, instance) {
2244
2350
  abytes3(out);
2245
2351
  const min = instance.outputLen;
@@ -2247,35 +2353,42 @@ var FastNear = (() => {
2247
2353
  throw new Error("digestInto() expects output buffer of length at least " + min);
2248
2354
  }
2249
2355
  }
2356
+ __name(aoutput2, "aoutput");
2250
2357
 
2251
2358
  // ../../node_modules/@noble/hashes/esm/utils.js
2252
- var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
2253
- var rotr = (word, shift) => word << 32 - shift | word >>> shift;
2359
+ var createView2 = /* @__PURE__ */ __name((arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength), "createView");
2360
+ var rotr = /* @__PURE__ */ __name((word, shift) => word << 32 - shift | word >>> shift, "rotr");
2254
2361
  function utf8ToBytes2(str) {
2255
2362
  if (typeof str !== "string")
2256
2363
  throw new Error("utf8ToBytes expected string, got " + typeof str);
2257
2364
  return new Uint8Array(new TextEncoder().encode(str));
2258
2365
  }
2366
+ __name(utf8ToBytes2, "utf8ToBytes");
2259
2367
  function toBytes2(data) {
2260
2368
  if (typeof data === "string")
2261
2369
  data = utf8ToBytes2(data);
2262
2370
  abytes3(data);
2263
2371
  return data;
2264
2372
  }
2373
+ __name(toBytes2, "toBytes");
2265
2374
  var Hash2 = class {
2375
+ static {
2376
+ __name(this, "Hash");
2377
+ }
2266
2378
  // Safe version that clones internal state
2267
2379
  clone() {
2268
2380
  return this._cloneInto();
2269
2381
  }
2270
2382
  };
2271
2383
  function wrapConstructor2(hashCons) {
2272
- const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
2384
+ const hashC = /* @__PURE__ */ __name((msg) => hashCons().update(toBytes2(msg)).digest(), "hashC");
2273
2385
  const tmp = hashCons();
2274
2386
  hashC.outputLen = tmp.outputLen;
2275
2387
  hashC.blockLen = tmp.blockLen;
2276
2388
  hashC.create = () => hashCons();
2277
2389
  return hashC;
2278
2390
  }
2391
+ __name(wrapConstructor2, "wrapConstructor");
2279
2392
 
2280
2393
  // ../../node_modules/@noble/hashes/esm/_md.js
2281
2394
  function setBigUint642(view, byteOffset, value, isLE) {
@@ -2290,9 +2403,13 @@ var FastNear = (() => {
2290
2403
  view.setUint32(byteOffset + h, wh, isLE);
2291
2404
  view.setUint32(byteOffset + l, wl, isLE);
2292
2405
  }
2293
- var Chi = (a, b, c) => a & b ^ ~a & c;
2294
- var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
2406
+ __name(setBigUint642, "setBigUint64");
2407
+ var Chi = /* @__PURE__ */ __name((a, b, c) => a & b ^ ~a & c, "Chi");
2408
+ var Maj = /* @__PURE__ */ __name((a, b, c) => a & b ^ a & c ^ b & c, "Maj");
2295
2409
  var HashMD2 = class extends Hash2 {
2410
+ static {
2411
+ __name(this, "HashMD");
2412
+ }
2296
2413
  constructor(blockLen, outputLen, padOffset, isLE) {
2297
2414
  super();
2298
2415
  this.blockLen = blockLen;
@@ -2458,6 +2575,9 @@ var FastNear = (() => {
2458
2575
  ]);
2459
2576
  var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
2460
2577
  var SHA256 = class extends HashMD2 {
2578
+ static {
2579
+ __name(this, "SHA256");
2580
+ }
2461
2581
  constructor() {
2462
2582
  super(64, 32, 8, false);
2463
2583
  this.A = SHA256_IV[0] | 0;
@@ -2561,15 +2681,16 @@ var FastNear = (() => {
2561
2681
  )
2562
2682
  ]);
2563
2683
  }
2684
+ __name(base58_to_binary, "base58_to_binary");
2564
2685
  var base58_to_binary_default = base58_to_binary;
2565
2686
 
2566
2687
  // ../../node_modules/base58-js/create_base58_map.mjs
2567
- var create_base58_map = () => {
2688
+ var create_base58_map = /* @__PURE__ */ __name(() => {
2568
2689
  const base58M = Array(256).fill(-1);
2569
2690
  for (let i = 0; i < base58_chars_default.length; ++i)
2570
2691
  base58M[base58_chars_default.charCodeAt(i)] = i;
2571
2692
  return base58M;
2572
- };
2693
+ }, "create_base58_map");
2573
2694
  var create_base58_map_default = create_base58_map;
2574
2695
 
2575
2696
  // ../../node_modules/base58-js/binary_to_base58.mjs
@@ -2594,6 +2715,7 @@ var FastNear = (() => {
2594
2715
  result.reverse();
2595
2716
  return String.fromCharCode(...result);
2596
2717
  }
2718
+ __name(binary_to_base58, "binary_to_base58");
2597
2719
  var binary_to_base58_default = binary_to_base58;
2598
2720
 
2599
2721
  // ../../node_modules/js-base64/base64.mjs
@@ -2610,9 +2732,9 @@ var FastNear = (() => {
2610
2732
  var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
2611
2733
  var _fromCC = String.fromCharCode.bind(String);
2612
2734
  var _U8Afrom = typeof Uint8Array.from === "function" ? Uint8Array.from.bind(Uint8Array) : (it) => new Uint8Array(Array.prototype.slice.call(it, 0));
2613
- var _mkUriSafe = (src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_");
2614
- var _tidyB64 = (s) => s.replace(/[^A-Za-z0-9\+\/]/g, "");
2615
- var btoaPolyfill = (bin) => {
2735
+ var _mkUriSafe = /* @__PURE__ */ __name((src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_"), "_mkUriSafe");
2736
+ var _tidyB64 = /* @__PURE__ */ __name((s) => s.replace(/[^A-Za-z0-9\+\/]/g, ""), "_tidyB64");
2737
+ var btoaPolyfill = /* @__PURE__ */ __name((bin) => {
2616
2738
  let u32, c0, c1, c2, asc = "";
2617
2739
  const pad = bin.length % 3;
2618
2740
  for (let i = 0; i < bin.length; ) {
@@ -2622,7 +2744,7 @@ var FastNear = (() => {
2622
2744
  asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
2623
2745
  }
2624
2746
  return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
2625
- };
2747
+ }, "btoaPolyfill");
2626
2748
  var _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
2627
2749
  var _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
2628
2750
  const maxargs = 4096;
@@ -2632,7 +2754,7 @@ var FastNear = (() => {
2632
2754
  }
2633
2755
  return _btoa(strs.join(""));
2634
2756
  };
2635
- var cb_utob = (c) => {
2757
+ var cb_utob = /* @__PURE__ */ __name((c) => {
2636
2758
  if (c.length < 2) {
2637
2759
  var cc = c.charCodeAt(0);
2638
2760
  return cc < 128 ? c : cc < 2048 ? _fromCC(192 | cc >>> 6) + _fromCC(128 | cc & 63) : _fromCC(224 | cc >>> 12 & 15) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
@@ -2640,13 +2762,13 @@ var FastNear = (() => {
2640
2762
  var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
2641
2763
  return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
2642
2764
  }
2643
- };
2765
+ }, "cb_utob");
2644
2766
  var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
2645
- var utob = (u) => u.replace(re_utob, cb_utob);
2767
+ var utob = /* @__PURE__ */ __name((u) => u.replace(re_utob, cb_utob), "utob");
2646
2768
  var _encode = _hasBuffer ? (s) => Buffer.from(s, "utf8").toString("base64") : _TE ? (s) => _fromUint8Array(_TE.encode(s)) : (s) => _btoa(utob(s));
2647
- var encode = (src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src);
2769
+ var encode = /* @__PURE__ */ __name((src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src), "encode");
2648
2770
  var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
2649
- var cb_btou = (cccc) => {
2771
+ var cb_btou = /* @__PURE__ */ __name((cccc) => {
2650
2772
  switch (cccc.length) {
2651
2773
  case 4:
2652
2774
  var cp = (7 & cccc.charCodeAt(0)) << 18 | (63 & cccc.charCodeAt(1)) << 12 | (63 & cccc.charCodeAt(2)) << 6 | 63 & cccc.charCodeAt(3), offset = cp - 65536;
@@ -2656,9 +2778,9 @@ var FastNear = (() => {
2656
2778
  default:
2657
2779
  return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
2658
2780
  }
2659
- };
2660
- var btou = (b) => b.replace(re_btou, cb_btou);
2661
- var atobPolyfill = (asc) => {
2781
+ }, "cb_btou");
2782
+ var btou = /* @__PURE__ */ __name((b) => b.replace(re_btou, cb_btou), "btou");
2783
+ var atobPolyfill = /* @__PURE__ */ __name((asc) => {
2662
2784
  asc = asc.replace(/\s+/g, "");
2663
2785
  if (!b64re.test(asc))
2664
2786
  throw new TypeError("malformed base64.");
@@ -2669,12 +2791,12 @@ var FastNear = (() => {
2669
2791
  bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255);
2670
2792
  }
2671
2793
  return bin;
2672
- };
2794
+ }, "atobPolyfill");
2673
2795
  var _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
2674
2796
  var _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
2675
2797
  var _decode = _hasBuffer ? (a) => Buffer.from(a, "base64").toString("utf8") : _TD ? (a) => _TD.decode(_toUint8Array(a)) : (a) => btou(_atob(a));
2676
- var _unURI = (a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/"));
2677
- var decode = (src) => _decode(_unURI(src));
2798
+ var _unURI = /* @__PURE__ */ __name((a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/")), "_unURI");
2799
+ var decode = /* @__PURE__ */ __name((src) => _decode(_unURI(src)), "decode");
2678
2800
 
2679
2801
  // src/utils.ts
2680
2802
  var LsPrefix = "__fastnear_";
@@ -2687,6 +2809,7 @@ var FastNear = (() => {
2687
2809
  return encode(str);
2688
2810
  }
2689
2811
  }
2812
+ __name(toBase64, "toBase64");
2690
2813
  function fromBase64(str) {
2691
2814
  const binaryString = decode(str);
2692
2815
  const len = binaryString.length;
@@ -2696,6 +2819,7 @@ var FastNear = (() => {
2696
2819
  }
2697
2820
  return bytes;
2698
2821
  }
2822
+ __name(fromBase64, "fromBase64");
2699
2823
  function lsSet(key, value) {
2700
2824
  if (value === null || value === void 0) {
2701
2825
  localStorage.removeItem(LsPrefix + key);
@@ -2703,13 +2827,16 @@ var FastNear = (() => {
2703
2827
  localStorage.setItem(LsPrefix + key, JSON.stringify(value));
2704
2828
  }
2705
2829
  }
2830
+ __name(lsSet, "lsSet");
2706
2831
  function lsGet(key) {
2707
2832
  const value = localStorage.getItem(LsPrefix + key);
2708
2833
  return tryParseJson(value, null);
2709
2834
  }
2835
+ __name(lsGet, "lsGet");
2710
2836
  function deepCopy(obj) {
2711
2837
  return JSON.parse(JSON.stringify(obj));
2712
2838
  }
2839
+ __name(deepCopy, "deepCopy");
2713
2840
  function tryParseJson(...args) {
2714
2841
  try {
2715
2842
  return JSON.parse(args[0]);
@@ -2720,12 +2847,14 @@ var FastNear = (() => {
2720
2847
  return args[0];
2721
2848
  }
2722
2849
  }
2850
+ __name(tryParseJson, "tryParseJson");
2723
2851
  function canSignWithLAK(actions) {
2724
2852
  return actions.length === 1 && actions[0].type === "FunctionCall" && big_default(actions[0]?.deposit ?? "0").eq(0);
2725
2853
  }
2854
+ __name(canSignWithLAK, "canSignWithLAK");
2726
2855
 
2727
2856
  // src/cryptoUtils.ts
2728
- var keyFromString = (key) => base58_to_binary_default(
2857
+ var keyFromString = /* @__PURE__ */ __name((key) => base58_to_binary_default(
2729
2858
  key.includes(":") ? (() => {
2730
2859
  const [curve, keyPart] = key.split(":");
2731
2860
  if (curve !== "ed25519") {
@@ -2733,26 +2862,30 @@ var FastNear = (() => {
2733
2862
  }
2734
2863
  return keyPart;
2735
2864
  })() : key
2736
- );
2737
- var keyToString = (key) => `ed25519:${binary_to_base58_default(key)}`;
2865
+ ), "keyFromString");
2866
+ var keyToString = /* @__PURE__ */ __name((key) => `ed25519:${binary_to_base58_default(key)}`, "keyToString");
2738
2867
  function publicKeyFromPrivate(privateKey) {
2739
2868
  privateKey = keyFromString(privateKey).slice(0, 32);
2740
2869
  const publicKey = ed25519.getPublicKey(privateKey);
2741
2870
  return keyToString(publicKey);
2742
2871
  }
2872
+ __name(publicKeyFromPrivate, "publicKeyFromPrivate");
2743
2873
  function privateKeyFromRandom() {
2744
2874
  const privateKey = crypto.getRandomValues(new Uint8Array(64));
2745
2875
  return keyToString(privateKey);
2746
2876
  }
2877
+ __name(privateKeyFromRandom, "privateKeyFromRandom");
2747
2878
  function signHash(hash, privateKey) {
2748
2879
  privateKey = keyFromString(privateKey).slice(0, 32);
2749
2880
  const signature = ed25519.sign(base58_to_binary_default(hash), privateKey);
2750
2881
  return binary_to_base58_default(signature);
2751
2882
  }
2883
+ __name(signHash, "signHash");
2752
2884
  function signBytes(bytes, privateKey) {
2753
2885
  const hash = sha256(bytes);
2754
2886
  return signHash(binary_to_base58_default(hash), privateKey);
2755
2887
  }
2888
+ __name(signBytes, "signBytes");
2756
2889
 
2757
2890
  // ../../node_modules/borsh/lib/esm/types.js
2758
2891
  var integers = ["u8", "u16", "u32", "u64", "u128", "i8", "i16", "i32", "i64", "i128", "f32", "f64"];
@@ -2767,6 +2900,7 @@ var FastNear = (() => {
2767
2900
  this.buffer = new ArrayBuffer(this.buffer_size);
2768
2901
  this.view = new DataView(this.buffer);
2769
2902
  }
2903
+ __name(EncodeBuffer2, "EncodeBuffer");
2770
2904
  EncodeBuffer2.prototype.resize_if_necessary = function(needed_space) {
2771
2905
  if (this.buffer_size - this.offset < needed_space) {
2772
2906
  this.buffer_size = Math.max(this.buffer_size * 2, this.buffer_size + needed_space);
@@ -2805,6 +2939,7 @@ var FastNear = (() => {
2805
2939
  new Uint8Array(this.buffer).set(buf);
2806
2940
  this.view = new DataView(this.buffer);
2807
2941
  }
2942
+ __name(DecodeBuffer2, "DecodeBuffer");
2808
2943
  DecodeBuffer2.prototype.assert_enough_buffer = function(size) {
2809
2944
  if (this.offset + size > this.buffer.byteLength) {
2810
2945
  throw new Error("Error in schema, the buffer is smaller than expected");
@@ -2831,14 +2966,14 @@ var FastNear = (() => {
2831
2966
 
2832
2967
  // ../../node_modules/borsh/lib/esm/utils.js
2833
2968
  var __extends = /* @__PURE__ */ function() {
2834
- var extendStatics = function(d, b) {
2969
+ var extendStatics = /* @__PURE__ */ __name(function(d, b) {
2835
2970
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
2836
2971
  d2.__proto__ = b2;
2837
2972
  } || function(d2, b2) {
2838
2973
  for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
2839
2974
  };
2840
2975
  return extendStatics(d, b);
2841
- };
2976
+ }, "extendStatics");
2842
2977
  return function(d, b) {
2843
2978
  if (typeof b !== "function" && b !== null)
2844
2979
  throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
@@ -2846,17 +2981,20 @@ var FastNear = (() => {
2846
2981
  function __() {
2847
2982
  this.constructor = d;
2848
2983
  }
2984
+ __name(__, "__");
2849
2985
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2850
2986
  };
2851
2987
  }();
2852
2988
  function isArrayLike(value) {
2853
2989
  return Array.isArray(value) || !!value && typeof value === "object" && "length" in value && typeof value.length === "number" && (value.length === 0 || value.length > 0 && value.length - 1 in value);
2854
2990
  }
2991
+ __name(isArrayLike, "isArrayLike");
2855
2992
  function expect_type(value, type, fieldPath) {
2856
2993
  if (typeof value !== type) {
2857
2994
  throw new Error("Expected ".concat(type, " not ").concat(typeof value, "(").concat(value, ") at ").concat(fieldPath.join(".")));
2858
2995
  }
2859
2996
  }
2997
+ __name(expect_type, "expect_type");
2860
2998
  function expect_bigint(value, fieldPath) {
2861
2999
  var basicType = ["number", "string", "bigint", "boolean"].includes(typeof value);
2862
3000
  var strObject = typeof value === "object" && value !== null && "toString" in value;
@@ -2864,16 +3002,19 @@ var FastNear = (() => {
2864
3002
  throw new Error("Expected bigint, number, boolean or string not ".concat(typeof value, "(").concat(value, ") at ").concat(fieldPath.join(".")));
2865
3003
  }
2866
3004
  }
3005
+ __name(expect_bigint, "expect_bigint");
2867
3006
  function expect_same_size(length, expected, fieldPath) {
2868
3007
  if (length !== expected) {
2869
3008
  throw new Error("Array length ".concat(length, " does not match schema length ").concat(expected, " at ").concat(fieldPath.join(".")));
2870
3009
  }
2871
3010
  }
3011
+ __name(expect_same_size, "expect_same_size");
2872
3012
  function expect_enum(value, fieldPath) {
2873
3013
  if (typeof value !== "object" || value === null) {
2874
3014
  throw new Error("Expected object not ".concat(typeof value, "(").concat(value, ") at ").concat(fieldPath.join(".")));
2875
3015
  }
2876
3016
  }
3017
+ __name(expect_enum, "expect_enum");
2877
3018
  var VALID_STRING_TYPES = integers.concat(["bool", "string"]);
2878
3019
  var VALID_OBJECT_KEYS = ["option", "enum", "array", "set", "map", "struct"];
2879
3020
  var ErrorSchema = (
@@ -2884,6 +3025,7 @@ var FastNear = (() => {
2884
3025
  var message = "Invalid schema: ".concat(JSON.stringify(schema), " expected ").concat(expected);
2885
3026
  return _super.call(this, message) || this;
2886
3027
  }
3028
+ __name(ErrorSchema2, "ErrorSchema");
2887
3029
  return ErrorSchema2;
2888
3030
  }(Error)
2889
3031
  );
@@ -2911,6 +3053,7 @@ var FastNear = (() => {
2911
3053
  }
2912
3054
  throw new ErrorSchema(schema, VALID_OBJECT_KEYS.join(", ") + " or " + VALID_STRING_TYPES.join(", "));
2913
3055
  }
3056
+ __name(validate_schema, "validate_schema");
2914
3057
  function validate_enum_schema(schema) {
2915
3058
  if (!Array.isArray(schema))
2916
3059
  throw new ErrorSchema(schema, "Array");
@@ -2925,6 +3068,7 @@ var FastNear = (() => {
2925
3068
  validate_schema({ struct: sch.struct });
2926
3069
  }
2927
3070
  }
3071
+ __name(validate_enum_schema, "validate_enum_schema");
2928
3072
  function validate_array_schema(schema) {
2929
3073
  if (typeof schema !== "object")
2930
3074
  throw new ErrorSchema(schema, "{ type, len? }");
@@ -2935,6 +3079,7 @@ var FastNear = (() => {
2935
3079
  return validate_schema(schema.type);
2936
3080
  throw new ErrorSchema(schema, "{ type, len? }");
2937
3081
  }
3082
+ __name(validate_array_schema, "validate_array_schema");
2938
3083
  function validate_map_schema(schema) {
2939
3084
  if (typeof schema === "object" && "key" in schema && "value" in schema) {
2940
3085
  validate_schema(schema.key);
@@ -2943,6 +3088,7 @@ var FastNear = (() => {
2943
3088
  throw new ErrorSchema(schema, "{ key, value }");
2944
3089
  }
2945
3090
  }
3091
+ __name(validate_map_schema, "validate_map_schema");
2946
3092
  function validate_struct_schema(schema) {
2947
3093
  if (typeof schema !== "object")
2948
3094
  throw new ErrorSchema(schema, "object");
@@ -2950,6 +3096,7 @@ var FastNear = (() => {
2950
3096
  validate_schema(schema[key]);
2951
3097
  }
2952
3098
  }
3099
+ __name(validate_struct_schema, "validate_struct_schema");
2953
3100
 
2954
3101
  // ../../node_modules/borsh/lib/esm/serialize.js
2955
3102
  var BorshSerializer = (
@@ -2960,6 +3107,7 @@ var FastNear = (() => {
2960
3107
  this.fieldPath = ["value"];
2961
3108
  this.checkTypes = checkTypes;
2962
3109
  }
3110
+ __name(BorshSerializer2, "BorshSerializer");
2963
3111
  BorshSerializer2.prototype.encode = function(value, schema) {
2964
3112
  this.encode_value(value, schema);
2965
3113
  return this.encoded.get_used_buffer();
@@ -3118,6 +3266,7 @@ var FastNear = (() => {
3118
3266
  function BorshDeserializer2(bufferArray) {
3119
3267
  this.buffer = new DecodeBuffer(bufferArray);
3120
3268
  }
3269
+ __name(BorshDeserializer2, "BorshDeserializer");
3121
3270
  BorshDeserializer2.prototype.decode = function(schema) {
3122
3271
  return this.decode_value(schema);
3123
3272
  };
@@ -3256,6 +3405,7 @@ var FastNear = (() => {
3256
3405
  var serializer = new BorshSerializer(validate);
3257
3406
  return serializer.encode(value, schema);
3258
3407
  }
3408
+ __name(serialize, "serialize");
3259
3409
 
3260
3410
  // src/transaction.ts
3261
3411
  function mapTransaction(jsonTransaction) {
@@ -3272,10 +3422,12 @@ var FastNear = (() => {
3272
3422
  actions: jsonTransaction.actions.map(mapAction)
3273
3423
  };
3274
3424
  }
3425
+ __name(mapTransaction, "mapTransaction");
3275
3426
  function serializeTransaction(jsonTransaction) {
3276
3427
  const transaction = mapTransaction(jsonTransaction);
3277
3428
  return serialize(SCHEMA.Transaction, transaction);
3278
3429
  }
3430
+ __name(serializeTransaction, "serializeTransaction");
3279
3431
  function serializeSignedTransaction(jsonTransaction, signature) {
3280
3432
  const signedTransaction = {
3281
3433
  transaction: mapTransaction(jsonTransaction),
@@ -3287,6 +3439,7 @@ var FastNear = (() => {
3287
3439
  };
3288
3440
  return serialize(SCHEMA.SignedTransaction, signedTransaction);
3289
3441
  }
3442
+ __name(serializeSignedTransaction, "serializeSignedTransaction");
3290
3443
  function mapAction(action) {
3291
3444
  switch (action.type) {
3292
3445
  case "CreateAccount": {
@@ -3384,7 +3537,11 @@ var FastNear = (() => {
3384
3537
  }
3385
3538
  }
3386
3539
  }
3540
+ __name(mapAction, "mapAction");
3387
3541
  var SCHEMA = new class BorshSchema {
3542
+ static {
3543
+ __name(this, "BorshSchema");
3544
+ }
3388
3545
  Ed25519Signature = {
3389
3546
  struct: {
3390
3547
  data: { array: { type: "u8", len: 64 } }
@@ -3544,7 +3701,7 @@ var FastNear = (() => {
3544
3701
  // src/near.ts
3545
3702
  big_default.DP = 27;
3546
3703
  var MaxBlockDelayMs = 1e3 * 60 * 60 * 6;
3547
- var WIDGET_URL = "http://localhost:3000/";
3704
+ var WIDGET_URL = "https://wallet-adapter.fastnear.com";
3548
3705
  var DEFAULT_NETWORK_ID = "mainnet";
3549
3706
  var NETWORKS = {
3550
3707
  testnet: {
@@ -3582,6 +3739,7 @@ var FastNear = (() => {
3582
3739
  networkId: DEFAULT_NETWORK_ID
3583
3740
  };
3584
3741
  }
3742
+ __name(getWalletAdapterState, "getWalletAdapterState");
3585
3743
  var _adapter;
3586
3744
  function updateState(newState) {
3587
3745
  const oldState = _state;
@@ -3603,6 +3761,7 @@ var FastNear = (() => {
3603
3761
  _adapter.setState(getWalletAdapterState());
3604
3762
  }
3605
3763
  }
3764
+ __name(updateState, "updateState");
3606
3765
  function updateTxHistory(txStatus) {
3607
3766
  const txId = txStatus.txId;
3608
3767
  _txHistory[txId] = {
@@ -3613,6 +3772,7 @@ var FastNear = (() => {
3613
3772
  lsSet("txHistory", _txHistory);
3614
3773
  notifyTxListeners(_txHistory[txId]);
3615
3774
  }
3775
+ __name(updateTxHistory, "updateTxHistory");
3616
3776
  function onAdapterStateUpdate(state) {
3617
3777
  console.log("Adapter state update:", state);
3618
3778
  const { accountId, lastWalletId, privateKey } = state;
@@ -3622,6 +3782,7 @@ var FastNear = (() => {
3622
3782
  ...privateKey && { privateKey }
3623
3783
  });
3624
3784
  }
3785
+ __name(onAdapterStateUpdate, "onAdapterStateUpdate");
3625
3786
  _adapter = new WalletAdapter({
3626
3787
  onStateUpdate: onAdapterStateUpdate,
3627
3788
  lastState: getWalletAdapterState(),
@@ -3639,9 +3800,11 @@ var FastNear = (() => {
3639
3800
  }
3640
3801
  }
3641
3802
  }
3803
+ __name(parseJsonFromBytes, "parseJsonFromBytes");
3642
3804
  function withBlockId(params, blockId) {
3643
- return blockId === "final" || blockId === "optimistic" ? { ...params, finality: blockId } : !!blockId ? { ...params, block_id: blockId } : { ...params, finality: "optimistic" };
3805
+ return blockId === "final" || blockId === "optimistic" ? { ...params, finality: blockId } : blockId ? { ...params, block_id: blockId } : { ...params, finality: "optimistic" };
3644
3806
  }
3807
+ __name(withBlockId, "withBlockId");
3645
3808
  async function queryRpc(method, params) {
3646
3809
  const response = await fetch(_config.nodeUrl, {
3647
3810
  method: "POST",
@@ -3659,6 +3822,7 @@ var FastNear = (() => {
3659
3822
  }
3660
3823
  return result.result;
3661
3824
  }
3825
+ __name(queryRpc, "queryRpc");
3662
3826
  function afterTxSent(txId) {
3663
3827
  queryRpc("tx", {
3664
3828
  tx_hash: _txHistory[txId].txHash,
@@ -3682,6 +3846,7 @@ var FastNear = (() => {
3682
3846
  });
3683
3847
  });
3684
3848
  }
3849
+ __name(afterTxSent, "afterTxSent");
3685
3850
  function sendTxToRpc(signedTxBase64, waitUntil, txId) {
3686
3851
  queryRpc("send_tx", {
3687
3852
  signed_tx_base64: signedTxBase64,
@@ -3703,6 +3868,7 @@ var FastNear = (() => {
3703
3868
  });
3704
3869
  });
3705
3870
  }
3871
+ __name(sendTxToRpc, "sendTxToRpc");
3706
3872
  function notifyAccountListeners(accountId) {
3707
3873
  if (_eventListeners.account.size === 0) {
3708
3874
  _unbroadcastedEvents.account.push(accountId);
@@ -3716,6 +3882,7 @@ var FastNear = (() => {
3716
3882
  }
3717
3883
  });
3718
3884
  }
3885
+ __name(notifyAccountListeners, "notifyAccountListeners");
3719
3886
  function notifyTxListeners(tx) {
3720
3887
  if (_eventListeners.tx.size === 0) {
3721
3888
  _unbroadcastedEvents.tx.push(tx);
@@ -3729,6 +3896,7 @@ var FastNear = (() => {
3729
3896
  }
3730
3897
  });
3731
3898
  }
3899
+ __name(notifyTxListeners, "notifyTxListeners");
3732
3900
  function convertUnit(s, ...args) {
3733
3901
  if (Array.isArray(s)) {
3734
3902
  s = s.reduce((acc, part, i) => {
@@ -3736,10 +3904,10 @@ var FastNear = (() => {
3736
3904
  });
3737
3905
  }
3738
3906
  if (typeof s == "string") {
3739
- let match = s.match(/([0-9.,_]+)\s*([a-zA-Z]+)?/);
3907
+ const match = s.match(/([0-9.,_]+)\s*([a-zA-Z]+)?/);
3740
3908
  if (match) {
3741
- let amount = match[1].replace(/[_,]/g, "");
3742
- let unitPart = match[2];
3909
+ const amount = match[1].replace(/[_,]/g, "");
3910
+ const unitPart = match[2];
3743
3911
  if (unitPart) {
3744
3912
  switch (unitPart.toLowerCase()) {
3745
3913
  case "near":
@@ -3749,9 +3917,10 @@ var FastNear = (() => {
3749
3917
  case "ggas":
3750
3918
  return big_default(amount).mul(big_default(10).pow(9)).toFixed(0);
3751
3919
  case "gas":
3920
+ case "yoctonear":
3752
3921
  return big_default(amount).toFixed(0);
3753
3922
  default:
3754
- throw new Error(`Unknown unit: ${unit}`);
3923
+ throw new Error(`Unknown unit: ${unitPart}`);
3755
3924
  }
3756
3925
  } else {
3757
3926
  return big_default(amount).toFixed(0);
@@ -3760,6 +3929,7 @@ var FastNear = (() => {
3760
3929
  }
3761
3930
  return big_default(s).toFixed(0);
3762
3931
  }
3932
+ __name(convertUnit, "convertUnit");
3763
3933
  var api = {
3764
3934
  // Context
3765
3935
  get accountId() {
@@ -3802,7 +3972,13 @@ var FastNear = (() => {
3802
3972
  return "SignedIn";
3803
3973
  },
3804
3974
  // Query Methods
3805
- async view({ contractId, methodName, args, argsBase64, blockId }) {
3975
+ async view({
3976
+ contractId,
3977
+ methodName,
3978
+ args,
3979
+ argsBase64,
3980
+ blockId
3981
+ }) {
3806
3982
  const encodedArgs = argsBase64 || (args ? toBase64(JSON.stringify(args)) : "");
3807
3983
  const result = await queryRpc(
3808
3984
  "query",
@@ -3818,7 +3994,10 @@ var FastNear = (() => {
3818
3994
  );
3819
3995
  return parseJsonFromBytes(result.result);
3820
3996
  },
3821
- async account({ accountId, blockId }) {
3997
+ async account({
3998
+ accountId,
3999
+ blockId
4000
+ }) {
3822
4001
  return queryRpc(
3823
4002
  "query",
3824
4003
  withBlockId(
@@ -3833,7 +4012,11 @@ var FastNear = (() => {
3833
4012
  async block({ blockId }) {
3834
4013
  return queryRpc("block", withBlockId({}, blockId));
3835
4014
  },
3836
- async accessKey({ accountId, publicKey, blockId }) {
4015
+ async accessKey({
4016
+ accountId,
4017
+ publicKey,
4018
+ blockId
4019
+ }) {
3837
4020
  return queryRpc(
3838
4021
  "query",
3839
4022
  withBlockId(
@@ -3853,7 +4036,11 @@ var FastNear = (() => {
3853
4036
  return [..._txHistory];
3854
4037
  },
3855
4038
  // Transaction Methods
3856
- async sendTx({ receiverId, actions, waitUntil }) {
4039
+ async sendTx({
4040
+ receiverId,
4041
+ actions,
4042
+ waitUntil
4043
+ }) {
3857
4044
  const signerId = _state.accountId;
3858
4045
  if (!signerId) {
3859
4046
  throw new Error("Not signed in");
@@ -3873,7 +4060,7 @@ var FastNear = (() => {
3873
4060
  tx: jsonTransaction2,
3874
4061
  finalState: false
3875
4062
  });
3876
- const url = new URL(window.location.href);
4063
+ const url = new URL(typeof window !== "undefined" ? window.location.href : "");
3877
4064
  url.searchParams.set("txIds", txId);
3878
4065
  _adapter.sendTransactions({
3879
4066
  transactions: [jsonTransaction2],
@@ -3882,16 +4069,18 @@ var FastNear = (() => {
3882
4069
  console.log("Transaction result:", result);
3883
4070
  if (result.url) {
3884
4071
  console.log("Redirecting to wallet:", result.url);
3885
- setTimeout(() => {
3886
- window.location.href = result.url;
3887
- }, 100);
4072
+ if (typeof window !== "undefined") {
4073
+ setTimeout(() => {
4074
+ window.location.href = result.url;
4075
+ }, 100);
4076
+ }
3888
4077
  } else if (result.outcomes) {
3889
- result.outcomes.forEach((result2) => {
4078
+ result.outcomes.forEach((r) => {
3890
4079
  updateTxHistory({
3891
4080
  txId,
3892
4081
  status: "Executed",
3893
- result: result2,
3894
- txHash: result2.transaction.hash,
4082
+ result: r,
4083
+ txHash: r.transaction.hash,
3895
4084
  finalState: true
3896
4085
  });
3897
4086
  });
@@ -3919,10 +4108,11 @@ var FastNear = (() => {
3919
4108
  });
3920
4109
  return txId;
3921
4110
  }
3922
- const toDoPromises = {};
3923
4111
  let nonce = lsGet("nonce");
4112
+ let block = lsGet("block");
4113
+ const toDoPromises = {};
3924
4114
  if (nonce === null || nonce === void 0) {
3925
- toDoPromises.nonce = this.accessKey({
4115
+ toDoPromises.nonce = api.accessKey({
3926
4116
  accountId: signerId,
3927
4117
  publicKey
3928
4118
  }).then((accessKey) => {
@@ -3933,30 +4123,30 @@ var FastNear = (() => {
3933
4123
  return accessKey.nonce;
3934
4124
  });
3935
4125
  }
3936
- let block = lsGet("block");
3937
- if (!block || parseFloat(block.header.timestamp_nanosec) / 1e6 + MaxBlockDelayMs < Date.now()) {
3938
- toDoPromises.block = this.block({ blockId: "final" }).then((block2) => {
3939
- block2 = {
4126
+ if (!block || !block.header || parseFloat(block.header.timestamp_nanosec) / 1e6 + MaxBlockDelayMs < Date.now()) {
4127
+ toDoPromises.block = api.block({ blockId: "final" }).then((b) => {
4128
+ const newBlock = {
3940
4129
  header: {
3941
- prev_hash: block2.header.prev_hash,
3942
- timestamp_nanosec: block2.header.timestamp_nanosec
4130
+ prev_hash: b.header.prev_hash,
4131
+ timestamp_nanosec: b.header.timestamp_nanosec
3943
4132
  }
3944
4133
  };
3945
- lsSet("block", block2);
3946
- return block2;
4134
+ lsSet("block", newBlock);
4135
+ return newBlock;
3947
4136
  });
3948
4137
  }
3949
4138
  if (Object.keys(toDoPromises).length > 0) {
3950
- let results = await Promise.all(Object.values(toDoPromises));
3951
- for (let i = 0; i < results.length; i++) {
3952
- if (Object.keys(toDoPromises)[i] === "nonce") {
3953
- nonce = results[i];
3954
- } else if (Object.keys(toDoPromises)[i] === "block") {
3955
- block = results[i];
4139
+ const results = await Promise.all(Object.values(toDoPromises));
4140
+ const keys = Object.keys(toDoPromises);
4141
+ results.forEach((res, i) => {
4142
+ if (keys[i] === "nonce") {
4143
+ nonce = res;
4144
+ } else if (keys[i] === "block") {
4145
+ block = res;
3956
4146
  }
3957
- }
4147
+ });
3958
4148
  }
3959
- const newNonce = nonce + 1;
4149
+ const newNonce = (nonce ?? 0) + 1;
3960
4150
  lsSet("nonce", newNonce);
3961
4151
  const blockHash = block.header.prev_hash;
3962
4152
  const jsonTransaction = {
@@ -3971,11 +4161,8 @@ var FastNear = (() => {
3971
4161
  const transaction = serializeTransaction(jsonTransaction);
3972
4162
  const txHash = binary_to_base58_default(sha256(transaction));
3973
4163
  const signature = signHash(txHash, privateKey);
3974
- const singedTransaction = serializeSignedTransaction(
3975
- jsonTransaction,
3976
- signature
3977
- );
3978
- const signedTxBase64 = toBase64(singedTransaction);
4164
+ const signedTransaction = serializeSignedTransaction(jsonTransaction, signature);
4165
+ const signedTxBase64 = toBase64(signedTransaction);
3979
4166
  updateTxHistory({
3980
4167
  status: "Pending",
3981
4168
  txId,
@@ -4008,9 +4195,11 @@ var FastNear = (() => {
4008
4195
  }
4009
4196
  if (result.url) {
4010
4197
  console.log("Redirecting to wallet:", result.url);
4011
- setTimeout(() => {
4012
- window.location.href = result.url;
4013
- }, 100);
4198
+ if (typeof window !== "undefined") {
4199
+ setTimeout(() => {
4200
+ window.location.href = result.url;
4201
+ }, 100);
4202
+ }
4014
4203
  } else if (result.accountId) {
4015
4204
  updateState({
4016
4205
  accountId: result.accountId
@@ -4043,29 +4232,35 @@ var FastNear = (() => {
4043
4232
  },
4044
4233
  // Action Helpers
4045
4234
  actions: {
4046
- functionCall: ({ methodName, gas, deposit, args, argsBase64 }) => ({
4235
+ functionCall: /* @__PURE__ */ __name(({
4236
+ methodName,
4237
+ gas,
4238
+ deposit,
4239
+ args,
4240
+ argsBase64
4241
+ }) => ({
4047
4242
  type: "FunctionCall",
4048
4243
  methodName,
4049
4244
  args,
4050
4245
  argsBase64,
4051
4246
  gas,
4052
4247
  deposit
4053
- }),
4054
- transfer: (yoctoAmount) => ({
4248
+ }), "functionCall"),
4249
+ transfer: /* @__PURE__ */ __name((yoctoAmount) => ({
4055
4250
  type: "Transfer",
4056
4251
  deposit: yoctoAmount
4057
- }),
4058
- stakeNEAR: ({ amount, publicKey }) => ({
4252
+ }), "transfer"),
4253
+ stakeNEAR: /* @__PURE__ */ __name(({ amount, publicKey }) => ({
4059
4254
  type: "Stake",
4060
4255
  stake: amount,
4061
4256
  publicKey
4062
- }),
4063
- addFullAccessKey: ({ publicKey }) => ({
4257
+ }), "stakeNEAR"),
4258
+ addFullAccessKey: /* @__PURE__ */ __name(({ publicKey }) => ({
4064
4259
  type: "AddKey",
4065
4260
  publicKey,
4066
4261
  accessKey: { permission: "FullAccess" }
4067
- }),
4068
- addLimitedAccessKey: ({
4262
+ }), "addFullAccessKey"),
4263
+ addLimitedAccessKey: /* @__PURE__ */ __name(({
4069
4264
  publicKey,
4070
4265
  allowance,
4071
4266
  accountId,
@@ -4079,22 +4274,22 @@ var FastNear = (() => {
4079
4274
  receiverId: accountId,
4080
4275
  methodNames
4081
4276
  }
4082
- }),
4083
- deleteKey: ({ publicKey }) => ({
4277
+ }), "addLimitedAccessKey"),
4278
+ deleteKey: /* @__PURE__ */ __name(({ publicKey }) => ({
4084
4279
  type: "DeleteKey",
4085
4280
  publicKey
4086
- }),
4087
- deleteAccount: ({ beneficiaryId }) => ({
4281
+ }), "deleteKey"),
4282
+ deleteAccount: /* @__PURE__ */ __name(({ beneficiaryId }) => ({
4088
4283
  type: "DeleteAccount",
4089
4284
  beneficiaryId
4090
- }),
4091
- createAccount: () => ({
4285
+ }), "deleteAccount"),
4286
+ createAccount: /* @__PURE__ */ __name(() => ({
4092
4287
  type: "CreateAccount"
4093
- }),
4094
- deployContract: ({ codeBase64 }) => ({
4288
+ }), "createAccount"),
4289
+ deployContract: /* @__PURE__ */ __name(({ codeBase64 }) => ({
4095
4290
  type: "DeployContract",
4096
4291
  codeBase64
4097
- })
4292
+ }), "deployContract")
4098
4293
  },
4099
4294
  utils: {
4100
4295
  toBase64,
@@ -4104,66 +4299,68 @@ var FastNear = (() => {
4104
4299
  }
4105
4300
  };
4106
4301
  try {
4107
- const url = new URL(window.location.href);
4108
- const accountId = url.searchParams.get("account_id");
4109
- const publicKey = url.searchParams.get("public_key");
4110
- const errorCode = url.searchParams.get("errorCode");
4111
- const errorMessage = url.searchParams.get("errorMessage");
4112
- const transactionHashes = url.searchParams.get("transactionHashes");
4113
- const txIds = url.searchParams.get("txIds");
4114
- if (errorCode || errorMessage) {
4115
- console.warn(new Error(`Wallet error: ${errorCode} ${errorMessage}`));
4116
- }
4117
- if (accountId && publicKey) {
4118
- if (publicKey === _state.publicKey) {
4119
- updateState({
4120
- accountId
4121
- });
4122
- } else {
4123
- console.error(
4124
- new Error("Public key mismatch from wallet redirect"),
4125
- publicKey,
4126
- _state.publicKey
4127
- );
4302
+ if (typeof window !== "undefined") {
4303
+ const url = new URL(window.location.href);
4304
+ const accountId = url.searchParams.get("account_id");
4305
+ const publicKey = url.searchParams.get("public_key");
4306
+ const errorCode = url.searchParams.get("errorCode");
4307
+ const errorMessage = url.searchParams.get("errorMessage");
4308
+ const transactionHashes = url.searchParams.get("transactionHashes");
4309
+ const txIds = url.searchParams.get("txIds");
4310
+ if (errorCode || errorMessage) {
4311
+ console.warn(new Error(`Wallet error: ${errorCode} ${errorMessage}`));
4128
4312
  }
4129
- }
4130
- if (transactionHashes || txIds) {
4131
- const txHashes = transactionHashes ? transactionHashes.split(",") : [];
4132
- const txIdsArray = txIds ? txIds.split(",") : [];
4133
- if (txIdsArray.length > txHashes.length) {
4134
- txIdsArray.forEach((txId, i) => {
4135
- updateTxHistory({
4136
- txId,
4137
- status: "RejectedByUser",
4138
- finalState: true
4313
+ if (accountId && publicKey) {
4314
+ if (publicKey === _state.publicKey) {
4315
+ updateState({
4316
+ accountId
4139
4317
  });
4140
- });
4141
- } else if (txIdsArray.length === txHashes.length) {
4142
- txIdsArray.forEach((txId, i) => {
4143
- updateTxHistory({
4144
- txId,
4145
- status: "PendingGotTxHash",
4146
- txHash: txHashes[i],
4147
- finalState: false
4318
+ } else {
4319
+ console.error(
4320
+ new Error("Public key mismatch from wallet redirect"),
4321
+ publicKey,
4322
+ _state.publicKey
4323
+ );
4324
+ }
4325
+ }
4326
+ if (transactionHashes || txIds) {
4327
+ const txHashes = transactionHashes ? transactionHashes.split(",") : [];
4328
+ const txIdsArray = txIds ? txIds.split(",") : [];
4329
+ if (txIdsArray.length > txHashes.length) {
4330
+ txIdsArray.forEach((txId, i) => {
4331
+ updateTxHistory({
4332
+ txId,
4333
+ status: "RejectedByUser",
4334
+ finalState: true
4335
+ });
4148
4336
  });
4149
- afterTxSent(txId);
4150
- });
4151
- } else {
4152
- console.error(
4153
- new Error("Transaction hash mismatch from wallet redirect"),
4154
- txIdsArray,
4155
- txHashes
4156
- );
4337
+ } else if (txIdsArray.length === txHashes.length) {
4338
+ txIdsArray.forEach((txId, i) => {
4339
+ updateTxHistory({
4340
+ txId,
4341
+ status: "PendingGotTxHash",
4342
+ txHash: txHashes[i],
4343
+ finalState: false
4344
+ });
4345
+ afterTxSent(txId);
4346
+ });
4347
+ } else {
4348
+ console.error(
4349
+ new Error("Transaction hash mismatch from wallet redirect"),
4350
+ txIdsArray,
4351
+ txHashes
4352
+ );
4353
+ }
4157
4354
  }
4355
+ url.searchParams.delete("account_id");
4356
+ url.searchParams.delete("public_key");
4357
+ url.searchParams.delete("errorCode");
4358
+ url.searchParams.delete("errorMessage");
4359
+ url.searchParams.delete("all_keys");
4360
+ url.searchParams.delete("transactionHashes");
4361
+ url.searchParams.delete("txIds");
4362
+ window.history.replaceState({}, "", url.toString());
4158
4363
  }
4159
- url.searchParams.delete("account_id");
4160
- url.searchParams.delete("public_key");
4161
- url.searchParams.delete("errorCode");
4162
- url.searchParams.delete("errorMessage");
4163
- url.searchParams.delete("all_keys");
4164
- url.searchParams.delete("transactionHashes");
4165
- url.searchParams.delete("txIds");
4166
- window.history.replaceState({}, "", url.toString());
4167
4364
  } catch (e) {
4168
4365
  console.error("Error handling wallet redirect:", e);
4169
4366
  }
@@ -4196,4 +4393,4 @@ var FastNear = (() => {
4196
4393
  @noble/hashes/esm/utils.js:
4197
4394
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
4198
4395
  */
4199
- //# sourceMappingURL=index.js.map
4396
+ //# sourceMappingURL=browser.global.js.map