@fastnear/api 0.4.0 → 0.5.1

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} +272 -120
  8. package/dist/umd/browser.global.js.map +1 -0
  9. package/package.json +9 -8
  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 -1219
  13. package/dist/cjs/index.esm.js.map +0 -7
  14. package/dist/cjs/index.js +0 -1274
  15. package/dist/cjs/index.js.map +0 -7
  16. package/dist/cjs/near.js +0 -1219
  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-OR3WITSY.js +0 -842
  25. package/dist/esm/chunk-OR3WITSY.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,10 @@
1
- /* ⋈ 🏃🏻💨 FastNEAR API - https://github.com/fastnear */
2
- var FastNear = (() => {
1
+ /* ⋈ 🏃🏻💨 FastNEAR API - IIFE/UMD */
2
+ var NearApi = (() => {
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
8
  var __export = (target, all) => {
8
9
  for (var name in all)
9
10
  __defProp(target, name, { get: all[name], enumerable: true });
@@ -82,6 +83,7 @@ var FastNear = (() => {
82
83
  }
83
84
  x.constructor = Big2;
84
85
  }
86
+ __name(Big2, "Big");
85
87
  Big2.prototype = P;
86
88
  Big2.DP = DP;
87
89
  Big2.RM = RM;
@@ -94,6 +96,7 @@ var FastNear = (() => {
94
96
  Big2.roundUp = 3;
95
97
  return Big2;
96
98
  }
99
+ __name(_Big_, "_Big_");
97
100
  function parse(x, n) {
98
101
  var e, i, nl;
99
102
  if (!NUMERIC.test(n)) {
@@ -120,6 +123,7 @@ var FastNear = (() => {
120
123
  }
121
124
  return x;
122
125
  }
126
+ __name(parse, "parse");
123
127
  function round(x, sd, rm, more) {
124
128
  var xc = x.c;
125
129
  if (rm === UNDEFINED) rm = x.constructor.RM;
@@ -152,6 +156,7 @@ var FastNear = (() => {
152
156
  }
153
157
  return x;
154
158
  }
159
+ __name(round, "round");
155
160
  function stringify(x, doExponential, isNonzero) {
156
161
  var e = x.e, s = x.c.join(""), n = s.length;
157
162
  if (doExponential) {
@@ -170,6 +175,7 @@ var FastNear = (() => {
170
175
  }
171
176
  return x.s < 0 && isNonzero ? "-" + s : s;
172
177
  }
178
+ __name(stringify, "stringify");
173
179
  P.abs = function() {
174
180
  var x = new this.constructor(this);
175
181
  x.s = 1;
@@ -532,6 +538,9 @@ var FastNear = (() => {
532
538
 
533
539
  // ../wallet-adapter/src/index.ts
534
540
  var WalletAdapter = class _WalletAdapter {
541
+ static {
542
+ __name(this, "WalletAdapter");
543
+ }
535
544
  /** @type {HTMLIFrameElement} */
536
545
  #iframe = null;
537
546
  /** @type {string} */
@@ -549,8 +558,8 @@ var FastNear = (() => {
549
558
  /** @type {string} */
550
559
  static defaultWidgetUrl = "https://wallet-adapter.fastnear.com";
551
560
  /**
552
- * @param {WalletAdapterConfig} [config]
553
- */
561
+ * @param {WalletAdapterConfig} [config]
562
+ */
554
563
  constructor({
555
564
  widgetUrl = _WalletAdapter.defaultWidgetUrl,
556
565
  targetOrigin = "*",
@@ -575,6 +584,7 @@ var FastNear = (() => {
575
584
  this.#iframe.remove();
576
585
  }
577
586
  const url = new URL(path, this.#widgetUrl);
587
+ console.log("aloha wa url", url);
578
588
  const iframe = document.createElement("iframe");
579
589
  iframe.src = url.toString();
580
590
  iframe.allow = "usb";
@@ -666,7 +676,7 @@ var FastNear = (() => {
666
676
  * @returns {Promise<SignInResult>}
667
677
  */
668
678
  async signIn(config) {
669
- return this.#sendMessage("/login.html", "signIn", config);
679
+ return this.#sendMessage("/public/login.html", "signIn", config);
670
680
  }
671
681
  /**
672
682
  * Send a transaction using connected wallet
@@ -674,7 +684,7 @@ var FastNear = (() => {
674
684
  * @returns {Promise<TransactionResult>}
675
685
  */
676
686
  async sendTransactions(config) {
677
- return this.#sendMessage("/send.html", "sendTransactions", config);
687
+ return this.#sendMessage("/public/send.html", "sendTransactions", config);
678
688
  }
679
689
  /**
680
690
  * Clean up adapter resources
@@ -690,18 +700,21 @@ var FastNear = (() => {
690
700
  function isBytes(a) {
691
701
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
692
702
  }
703
+ __name(isBytes, "isBytes");
693
704
  function abytes(b, ...lengths) {
694
705
  if (!isBytes(b))
695
706
  throw new Error("Uint8Array expected");
696
707
  if (lengths.length > 0 && !lengths.includes(b.length))
697
708
  throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
698
709
  }
710
+ __name(abytes, "abytes");
699
711
  function aexists(instance, checkFinished = true) {
700
712
  if (instance.destroyed)
701
713
  throw new Error("Hash instance has been destroyed");
702
714
  if (checkFinished && instance.finished)
703
715
  throw new Error("Hash#digest() has already been called");
704
716
  }
717
+ __name(aexists, "aexists");
705
718
  function aoutput(out, instance) {
706
719
  abytes(out);
707
720
  const min = instance.outputLen;
@@ -709,37 +722,44 @@ var FastNear = (() => {
709
722
  throw new Error("digestInto() expects output buffer of length at least " + min);
710
723
  }
711
724
  }
725
+ __name(aoutput, "aoutput");
712
726
 
713
727
  // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/crypto.js
714
728
  var crypto2 = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
715
729
 
716
730
  // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/utils.js
717
- var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
731
+ var createView = /* @__PURE__ */ __name((arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength), "createView");
718
732
  function utf8ToBytes(str) {
719
733
  if (typeof str !== "string")
720
734
  throw new Error("utf8ToBytes expected string, got " + typeof str);
721
735
  return new Uint8Array(new TextEncoder().encode(str));
722
736
  }
737
+ __name(utf8ToBytes, "utf8ToBytes");
723
738
  function toBytes(data) {
724
739
  if (typeof data === "string")
725
740
  data = utf8ToBytes(data);
726
741
  abytes(data);
727
742
  return data;
728
743
  }
744
+ __name(toBytes, "toBytes");
729
745
  var Hash = class {
746
+ static {
747
+ __name(this, "Hash");
748
+ }
730
749
  // Safe version that clones internal state
731
750
  clone() {
732
751
  return this._cloneInto();
733
752
  }
734
753
  };
735
754
  function wrapConstructor(hashCons) {
736
- const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
755
+ const hashC = /* @__PURE__ */ __name((msg) => hashCons().update(toBytes(msg)).digest(), "hashC");
737
756
  const tmp = hashCons();
738
757
  hashC.outputLen = tmp.outputLen;
739
758
  hashC.blockLen = tmp.blockLen;
740
759
  hashC.create = () => hashCons();
741
760
  return hashC;
742
761
  }
762
+ __name(wrapConstructor, "wrapConstructor");
743
763
  function randomBytes(bytesLength = 32) {
744
764
  if (crypto2 && typeof crypto2.getRandomValues === "function") {
745
765
  return crypto2.getRandomValues(new Uint8Array(bytesLength));
@@ -749,6 +769,7 @@ var FastNear = (() => {
749
769
  }
750
770
  throw new Error("crypto.getRandomValues must be defined");
751
771
  }
772
+ __name(randomBytes, "randomBytes");
752
773
 
753
774
  // ../../node_modules/@noble/curves/node_modules/@noble/hashes/esm/_md.js
754
775
  function setBigUint64(view, byteOffset, value, isLE) {
@@ -763,7 +784,11 @@ var FastNear = (() => {
763
784
  view.setUint32(byteOffset + h, wh, isLE);
764
785
  view.setUint32(byteOffset + l, wl, isLE);
765
786
  }
787
+ __name(setBigUint64, "setBigUint64");
766
788
  var HashMD = class extends Hash {
789
+ static {
790
+ __name(this, "HashMD");
791
+ }
767
792
  constructor(blockLen, outputLen, padOffset, isLE) {
768
793
  super();
769
794
  this.blockLen = blockLen;
@@ -858,6 +883,7 @@ var FastNear = (() => {
858
883
  return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
859
884
  return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
860
885
  }
886
+ __name(fromBig, "fromBig");
861
887
  function split(lst, le = false) {
862
888
  let Ah = new Uint32Array(lst.length);
863
889
  let Al = new Uint32Array(lst.length);
@@ -867,29 +893,31 @@ var FastNear = (() => {
867
893
  }
868
894
  return [Ah, Al];
869
895
  }
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;
896
+ __name(split, "split");
897
+ var toBig = /* @__PURE__ */ __name((h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0), "toBig");
898
+ var shrSH = /* @__PURE__ */ __name((h, _l, s) => h >>> s, "shrSH");
899
+ var shrSL = /* @__PURE__ */ __name((h, l, s) => h << 32 - s | l >>> s, "shrSL");
900
+ var rotrSH = /* @__PURE__ */ __name((h, l, s) => h >>> s | l << 32 - s, "rotrSH");
901
+ var rotrSL = /* @__PURE__ */ __name((h, l, s) => h << 32 - s | l >>> s, "rotrSL");
902
+ var rotrBH = /* @__PURE__ */ __name((h, l, s) => h << 64 - s | l >>> s - 32, "rotrBH");
903
+ var rotrBL = /* @__PURE__ */ __name((h, l, s) => h >>> s - 32 | l << 64 - s, "rotrBL");
904
+ var rotr32H = /* @__PURE__ */ __name((_h, l) => l, "rotr32H");
905
+ var rotr32L = /* @__PURE__ */ __name((h, _l) => h, "rotr32L");
906
+ var rotlSH = /* @__PURE__ */ __name((h, l, s) => h << s | l >>> 32 - s, "rotlSH");
907
+ var rotlSL = /* @__PURE__ */ __name((h, l, s) => l << s | h >>> 32 - s, "rotlSL");
908
+ var rotlBH = /* @__PURE__ */ __name((h, l, s) => l << s - 32 | h >>> 64 - s, "rotlBH");
909
+ var rotlBL = /* @__PURE__ */ __name((h, l, s) => h << s - 32 | l >>> 64 - s, "rotlBL");
883
910
  function add(Ah, Al, Bh, Bl) {
884
911
  const l = (Al >>> 0) + (Bl >>> 0);
885
912
  return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
886
913
  }
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;
914
+ __name(add, "add");
915
+ var add3L = /* @__PURE__ */ __name((Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0), "add3L");
916
+ var add3H = /* @__PURE__ */ __name((low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0, "add3H");
917
+ var add4L = /* @__PURE__ */ __name((Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0), "add4L");
918
+ var add4H = /* @__PURE__ */ __name((low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0, "add4H");
919
+ var add5L = /* @__PURE__ */ __name((Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0), "add5L");
920
+ var add5H = /* @__PURE__ */ __name((low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0, "add5H");
893
921
  var u64 = {
894
922
  fromBig,
895
923
  split,
@@ -1002,6 +1030,9 @@ var FastNear = (() => {
1002
1030
  var SHA512_W_H = /* @__PURE__ */ new Uint32Array(80);
1003
1031
  var SHA512_W_L = /* @__PURE__ */ new Uint32Array(80);
1004
1032
  var SHA512 = class extends HashMD {
1033
+ static {
1034
+ __name(this, "SHA512");
1035
+ }
1005
1036
  constructor() {
1006
1037
  super(128, 64, 16, false);
1007
1038
  this.Ah = 1779033703 | 0;
@@ -1122,14 +1153,17 @@ var FastNear = (() => {
1122
1153
  function isBytes2(a) {
1123
1154
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
1124
1155
  }
1156
+ __name(isBytes2, "isBytes");
1125
1157
  function abytes2(item) {
1126
1158
  if (!isBytes2(item))
1127
1159
  throw new Error("Uint8Array expected");
1128
1160
  }
1161
+ __name(abytes2, "abytes");
1129
1162
  function abool(title, value) {
1130
1163
  if (typeof value !== "boolean")
1131
1164
  throw new Error(title + " boolean expected, got " + value);
1132
1165
  }
1166
+ __name(abool, "abool");
1133
1167
  var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
1134
1168
  function bytesToHex(bytes) {
1135
1169
  abytes2(bytes);
@@ -1139,11 +1173,13 @@ var FastNear = (() => {
1139
1173
  }
1140
1174
  return hex;
1141
1175
  }
1176
+ __name(bytesToHex, "bytesToHex");
1142
1177
  function hexToNumber(hex) {
1143
1178
  if (typeof hex !== "string")
1144
1179
  throw new Error("hex string expected, got " + typeof hex);
1145
1180
  return hex === "" ? _0n : BigInt("0x" + hex);
1146
1181
  }
1182
+ __name(hexToNumber, "hexToNumber");
1147
1183
  var asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
1148
1184
  function asciiToBase16(ch) {
1149
1185
  if (ch >= asciis._0 && ch <= asciis._9)
@@ -1154,6 +1190,7 @@ var FastNear = (() => {
1154
1190
  return ch - (asciis.a - 10);
1155
1191
  return;
1156
1192
  }
1193
+ __name(asciiToBase16, "asciiToBase16");
1157
1194
  function hexToBytes(hex) {
1158
1195
  if (typeof hex !== "string")
1159
1196
  throw new Error("hex string expected, got " + typeof hex);
@@ -1173,19 +1210,24 @@ var FastNear = (() => {
1173
1210
  }
1174
1211
  return array;
1175
1212
  }
1213
+ __name(hexToBytes, "hexToBytes");
1176
1214
  function bytesToNumberBE(bytes) {
1177
1215
  return hexToNumber(bytesToHex(bytes));
1178
1216
  }
1217
+ __name(bytesToNumberBE, "bytesToNumberBE");
1179
1218
  function bytesToNumberLE(bytes) {
1180
1219
  abytes2(bytes);
1181
1220
  return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));
1182
1221
  }
1222
+ __name(bytesToNumberLE, "bytesToNumberLE");
1183
1223
  function numberToBytesBE(n, len) {
1184
1224
  return hexToBytes(n.toString(16).padStart(len * 2, "0"));
1185
1225
  }
1226
+ __name(numberToBytesBE, "numberToBytesBE");
1186
1227
  function numberToBytesLE(n, len) {
1187
1228
  return numberToBytesBE(n, len).reverse();
1188
1229
  }
1230
+ __name(numberToBytesLE, "numberToBytesLE");
1189
1231
  function ensureBytes(title, hex, expectedLength) {
1190
1232
  let res;
1191
1233
  if (typeof hex === "string") {
@@ -1204,6 +1246,7 @@ var FastNear = (() => {
1204
1246
  throw new Error(title + " of length " + expectedLength + " expected, got " + len);
1205
1247
  return res;
1206
1248
  }
1249
+ __name(ensureBytes, "ensureBytes");
1207
1250
  function concatBytes(...arrays) {
1208
1251
  let sum = 0;
1209
1252
  for (let i = 0; i < arrays.length; i++) {
@@ -1219,34 +1262,38 @@ var FastNear = (() => {
1219
1262
  }
1220
1263
  return res;
1221
1264
  }
1222
- var isPosBig = (n) => typeof n === "bigint" && _0n <= n;
1265
+ __name(concatBytes, "concatBytes");
1266
+ var isPosBig = /* @__PURE__ */ __name((n) => typeof n === "bigint" && _0n <= n, "isPosBig");
1223
1267
  function inRange(n, min, max) {
1224
1268
  return isPosBig(n) && isPosBig(min) && isPosBig(max) && min <= n && n < max;
1225
1269
  }
1270
+ __name(inRange, "inRange");
1226
1271
  function aInRange(title, n, min, max) {
1227
1272
  if (!inRange(n, min, max))
1228
1273
  throw new Error("expected valid " + title + ": " + min + " <= n < " + max + ", got " + n);
1229
1274
  }
1275
+ __name(aInRange, "aInRange");
1230
1276
  function bitLen(n) {
1231
1277
  let len;
1232
1278
  for (len = 0; n > _0n; n >>= _1n, len += 1)
1233
1279
  ;
1234
1280
  return len;
1235
1281
  }
1236
- var bitMask = (n) => (_2n << BigInt(n - 1)) - _1n;
1282
+ __name(bitLen, "bitLen");
1283
+ var bitMask = /* @__PURE__ */ __name((n) => (_2n << BigInt(n - 1)) - _1n, "bitMask");
1237
1284
  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)
1285
+ bigint: /* @__PURE__ */ __name((val) => typeof val === "bigint", "bigint"),
1286
+ function: /* @__PURE__ */ __name((val) => typeof val === "function", "function"),
1287
+ boolean: /* @__PURE__ */ __name((val) => typeof val === "boolean", "boolean"),
1288
+ string: /* @__PURE__ */ __name((val) => typeof val === "string", "string"),
1289
+ stringOrUint8Array: /* @__PURE__ */ __name((val) => typeof val === "string" || isBytes2(val), "stringOrUint8Array"),
1290
+ isSafeInteger: /* @__PURE__ */ __name((val) => Number.isSafeInteger(val), "isSafeInteger"),
1291
+ array: /* @__PURE__ */ __name((val) => Array.isArray(val), "array"),
1292
+ field: /* @__PURE__ */ __name((val, object) => object.Fp.isValid(val), "field"),
1293
+ hash: /* @__PURE__ */ __name((val) => typeof val === "function" && Number.isSafeInteger(val.outputLen), "hash")
1247
1294
  };
1248
1295
  function validateObject(object, validators, optValidators = {}) {
1249
- const checkField = (fieldName, type, isOptional) => {
1296
+ const checkField = /* @__PURE__ */ __name((fieldName, type, isOptional) => {
1250
1297
  const checkVal = validatorFns[type];
1251
1298
  if (typeof checkVal !== "function")
1252
1299
  throw new Error("invalid validator function");
@@ -1256,13 +1303,14 @@ var FastNear = (() => {
1256
1303
  if (!checkVal(val, object)) {
1257
1304
  throw new Error("param " + String(fieldName) + " is invalid. Expected " + type + ", got " + val);
1258
1305
  }
1259
- };
1306
+ }, "checkField");
1260
1307
  for (const [fieldName, type] of Object.entries(validators))
1261
1308
  checkField(fieldName, type, false);
1262
1309
  for (const [fieldName, type] of Object.entries(optValidators))
1263
1310
  checkField(fieldName, type, true);
1264
1311
  return object;
1265
1312
  }
1313
+ __name(validateObject, "validateObject");
1266
1314
  function memoized(fn) {
1267
1315
  const map = /* @__PURE__ */ new WeakMap();
1268
1316
  return (arg, ...args) => {
@@ -1274,6 +1322,7 @@ var FastNear = (() => {
1274
1322
  return computed;
1275
1323
  };
1276
1324
  }
1325
+ __name(memoized, "memoized");
1277
1326
 
1278
1327
  // ../../node_modules/@noble/curves/esm/abstract/modular.js
1279
1328
  var _0n2 = BigInt(0);
@@ -1289,6 +1338,7 @@ var FastNear = (() => {
1289
1338
  const result = a % b;
1290
1339
  return result >= _0n2 ? result : b + result;
1291
1340
  }
1341
+ __name(mod, "mod");
1292
1342
  function pow(num, power, modulo) {
1293
1343
  if (power < _0n2)
1294
1344
  throw new Error("invalid exponent, negatives unsupported");
@@ -1305,6 +1355,7 @@ var FastNear = (() => {
1305
1355
  }
1306
1356
  return res;
1307
1357
  }
1358
+ __name(pow, "pow");
1308
1359
  function pow2(x, power, modulo) {
1309
1360
  let res = x;
1310
1361
  while (power-- > _0n2) {
@@ -1313,6 +1364,7 @@ var FastNear = (() => {
1313
1364
  }
1314
1365
  return res;
1315
1366
  }
1367
+ __name(pow2, "pow2");
1316
1368
  function invert(number, modulo) {
1317
1369
  if (number === _0n2)
1318
1370
  throw new Error("invert: expected non-zero number");
@@ -1333,6 +1385,7 @@ var FastNear = (() => {
1333
1385
  throw new Error("invert: does not exist");
1334
1386
  return mod(x, modulo);
1335
1387
  }
1388
+ __name(invert, "invert");
1336
1389
  function tonelliShanks(P2) {
1337
1390
  const legendreC = (P2 - _1n2) / _2n2;
1338
1391
  let Q, S, Z;
@@ -1344,15 +1397,15 @@ var FastNear = (() => {
1344
1397
  }
1345
1398
  if (S === 1) {
1346
1399
  const p1div4 = (P2 + _1n2) / _4n;
1347
- return function tonelliFast(Fp2, n) {
1400
+ return /* @__PURE__ */ __name(function tonelliFast(Fp2, n) {
1348
1401
  const root = Fp2.pow(n, p1div4);
1349
1402
  if (!Fp2.eql(Fp2.sqr(root), n))
1350
1403
  throw new Error("Cannot find square root");
1351
1404
  return root;
1352
- };
1405
+ }, "tonelliFast");
1353
1406
  }
1354
1407
  const Q1div2 = (Q + _1n2) / _2n2;
1355
- return function tonelliSlow(Fp2, n) {
1408
+ return /* @__PURE__ */ __name(function tonelliSlow(Fp2, n) {
1356
1409
  if (Fp2.pow(n, legendreC) === Fp2.neg(Fp2.ONE))
1357
1410
  throw new Error("Cannot find square root");
1358
1411
  let r = S;
@@ -1375,21 +1428,22 @@ var FastNear = (() => {
1375
1428
  r = m;
1376
1429
  }
1377
1430
  return x;
1378
- };
1431
+ }, "tonelliSlow");
1379
1432
  }
1433
+ __name(tonelliShanks, "tonelliShanks");
1380
1434
  function FpSqrt(P2) {
1381
1435
  if (P2 % _4n === _3n) {
1382
1436
  const p1div4 = (P2 + _1n2) / _4n;
1383
- return function sqrt3mod4(Fp2, n) {
1437
+ return /* @__PURE__ */ __name(function sqrt3mod4(Fp2, n) {
1384
1438
  const root = Fp2.pow(n, p1div4);
1385
1439
  if (!Fp2.eql(Fp2.sqr(root), n))
1386
1440
  throw new Error("Cannot find square root");
1387
1441
  return root;
1388
- };
1442
+ }, "sqrt3mod4");
1389
1443
  }
1390
1444
  if (P2 % _8n === _5n) {
1391
1445
  const c1 = (P2 - _5n) / _8n;
1392
- return function sqrt5mod8(Fp2, n) {
1446
+ return /* @__PURE__ */ __name(function sqrt5mod8(Fp2, n) {
1393
1447
  const n2 = Fp2.mul(n, _2n2);
1394
1448
  const v = Fp2.pow(n2, c1);
1395
1449
  const nv = Fp2.mul(n, v);
@@ -1398,13 +1452,14 @@ var FastNear = (() => {
1398
1452
  if (!Fp2.eql(Fp2.sqr(root), n))
1399
1453
  throw new Error("Cannot find square root");
1400
1454
  return root;
1401
- };
1455
+ }, "sqrt5mod8");
1402
1456
  }
1403
1457
  if (P2 % _16n === _9n) {
1404
1458
  }
1405
1459
  return tonelliShanks(P2);
1406
1460
  }
1407
- var isNegativeLE = (num, modulo) => (mod(num, modulo) & _1n2) === _1n2;
1461
+ __name(FpSqrt, "FpSqrt");
1462
+ var isNegativeLE = /* @__PURE__ */ __name((num, modulo) => (mod(num, modulo) & _1n2) === _1n2, "isNegativeLE");
1408
1463
  var FIELD_FIELDS = [
1409
1464
  "create",
1410
1465
  "isValid",
@@ -1437,6 +1492,7 @@ var FastNear = (() => {
1437
1492
  }, initial);
1438
1493
  return validateObject(field, opts);
1439
1494
  }
1495
+ __name(validateField, "validateField");
1440
1496
  function FpPow(f, num, power) {
1441
1497
  if (power < _0n2)
1442
1498
  throw new Error("invalid exponent, negatives unsupported");
@@ -1454,6 +1510,7 @@ var FastNear = (() => {
1454
1510
  }
1455
1511
  return p;
1456
1512
  }
1513
+ __name(FpPow, "FpPow");
1457
1514
  function FpInvertBatch(f, nums) {
1458
1515
  const tmp = new Array(nums.length);
1459
1516
  const lastMultiplied = nums.reduce((acc, num, i) => {
@@ -1471,11 +1528,13 @@ var FastNear = (() => {
1471
1528
  }, inverted);
1472
1529
  return tmp;
1473
1530
  }
1531
+ __name(FpInvertBatch, "FpInvertBatch");
1474
1532
  function nLength(n, nBitLength) {
1475
1533
  const _nBitLength = nBitLength !== void 0 ? nBitLength : n.toString(2).length;
1476
1534
  const nByteLength = Math.ceil(_nBitLength / 8);
1477
1535
  return { nBitLength: _nBitLength, nByteLength };
1478
1536
  }
1537
+ __name(nLength, "nLength");
1479
1538
  function Field(ORDER, bitLen2, isLE = false, redef = {}) {
1480
1539
  if (ORDER <= _0n2)
1481
1540
  throw new Error("invalid field: expected ORDER > 0, got " + ORDER);
@@ -1490,46 +1549,47 @@ var FastNear = (() => {
1490
1549
  MASK: bitMask(BITS),
1491
1550
  ZERO: _0n2,
1492
1551
  ONE: _1n2,
1493
- create: (num) => mod(num, ORDER),
1494
- isValid: (num) => {
1552
+ create: /* @__PURE__ */ __name((num) => mod(num, ORDER), "create"),
1553
+ isValid: /* @__PURE__ */ __name((num) => {
1495
1554
  if (typeof num !== "bigint")
1496
1555
  throw new Error("invalid field element: expected bigint, got " + typeof num);
1497
1556
  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),
1557
+ }, "isValid"),
1558
+ is0: /* @__PURE__ */ __name((num) => num === _0n2, "is0"),
1559
+ isOdd: /* @__PURE__ */ __name((num) => (num & _1n2) === _1n2, "isOdd"),
1560
+ neg: /* @__PURE__ */ __name((num) => mod(-num, ORDER), "neg"),
1561
+ eql: /* @__PURE__ */ __name((lhs, rhs) => lhs === rhs, "eql"),
1562
+ sqr: /* @__PURE__ */ __name((num) => mod(num * num, ORDER), "sqr"),
1563
+ add: /* @__PURE__ */ __name((lhs, rhs) => mod(lhs + rhs, ORDER), "add"),
1564
+ sub: /* @__PURE__ */ __name((lhs, rhs) => mod(lhs - rhs, ORDER), "sub"),
1565
+ mul: /* @__PURE__ */ __name((lhs, rhs) => mod(lhs * rhs, ORDER), "mul"),
1566
+ pow: /* @__PURE__ */ __name((num, power) => FpPow(f, num, power), "pow"),
1567
+ div: /* @__PURE__ */ __name((lhs, rhs) => mod(lhs * invert(rhs, ORDER), ORDER), "div"),
1509
1568
  // 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),
1569
+ sqrN: /* @__PURE__ */ __name((num) => num * num, "sqrN"),
1570
+ addN: /* @__PURE__ */ __name((lhs, rhs) => lhs + rhs, "addN"),
1571
+ subN: /* @__PURE__ */ __name((lhs, rhs) => lhs - rhs, "subN"),
1572
+ mulN: /* @__PURE__ */ __name((lhs, rhs) => lhs * rhs, "mulN"),
1573
+ inv: /* @__PURE__ */ __name((num) => invert(num, ORDER), "inv"),
1515
1574
  sqrt: redef.sqrt || ((n) => {
1516
1575
  if (!sqrtP)
1517
1576
  sqrtP = FpSqrt(ORDER);
1518
1577
  return sqrtP(f, n);
1519
1578
  }),
1520
- invertBatch: (lst) => FpInvertBatch(f, lst),
1579
+ invertBatch: /* @__PURE__ */ __name((lst) => FpInvertBatch(f, lst), "invertBatch"),
1521
1580
  // TODO: do we really need constant cmov?
1522
1581
  // 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) => {
1582
+ cmov: /* @__PURE__ */ __name((a, b, c) => c ? b : a, "cmov"),
1583
+ toBytes: /* @__PURE__ */ __name((num) => isLE ? numberToBytesLE(num, BYTES) : numberToBytesBE(num, BYTES), "toBytes"),
1584
+ fromBytes: /* @__PURE__ */ __name((bytes) => {
1526
1585
  if (bytes.length !== BYTES)
1527
1586
  throw new Error("Field.fromBytes: expected " + BYTES + " bytes, got " + bytes.length);
1528
1587
  return isLE ? bytesToNumberLE(bytes) : bytesToNumberBE(bytes);
1529
- }
1588
+ }, "fromBytes")
1530
1589
  });
1531
1590
  return Object.freeze(f);
1532
1591
  }
1592
+ __name(Field, "Field");
1533
1593
 
1534
1594
  // ../../node_modules/@noble/curves/esm/abstract/curve.js
1535
1595
  var _0n3 = BigInt(0);
@@ -1538,16 +1598,19 @@ var FastNear = (() => {
1538
1598
  const neg = item.negate();
1539
1599
  return condition ? neg : item;
1540
1600
  }
1601
+ __name(constTimeNegate, "constTimeNegate");
1541
1602
  function validateW(W, bits) {
1542
1603
  if (!Number.isSafeInteger(W) || W <= 0 || W > bits)
1543
1604
  throw new Error("invalid window size, expected [1.." + bits + "], got W=" + W);
1544
1605
  }
1606
+ __name(validateW, "validateW");
1545
1607
  function calcWOpts(W, bits) {
1546
1608
  validateW(W, bits);
1547
1609
  const windows = Math.ceil(bits / W) + 1;
1548
1610
  const windowSize = 2 ** (W - 1);
1549
1611
  return { windows, windowSize };
1550
1612
  }
1613
+ __name(calcWOpts, "calcWOpts");
1551
1614
  function validateMSMPoints(points, c) {
1552
1615
  if (!Array.isArray(points))
1553
1616
  throw new Error("array expected");
@@ -1556,6 +1619,7 @@ var FastNear = (() => {
1556
1619
  throw new Error("invalid point at index " + i);
1557
1620
  });
1558
1621
  }
1622
+ __name(validateMSMPoints, "validateMSMPoints");
1559
1623
  function validateMSMScalars(scalars, field) {
1560
1624
  if (!Array.isArray(scalars))
1561
1625
  throw new Error("array of scalars expected");
@@ -1564,11 +1628,13 @@ var FastNear = (() => {
1564
1628
  throw new Error("invalid scalar at index " + i);
1565
1629
  });
1566
1630
  }
1631
+ __name(validateMSMScalars, "validateMSMScalars");
1567
1632
  var pointPrecomputes = /* @__PURE__ */ new WeakMap();
1568
1633
  var pointWindowSizes = /* @__PURE__ */ new WeakMap();
1569
1634
  function getW(P2) {
1570
1635
  return pointWindowSizes.get(P2) || 1;
1571
1636
  }
1637
+ __name(getW, "getW");
1572
1638
  function wNAF(c, bits) {
1573
1639
  return {
1574
1640
  constTimeNegate,
@@ -1709,6 +1775,7 @@ var FastNear = (() => {
1709
1775
  }
1710
1776
  };
1711
1777
  }
1778
+ __name(wNAF, "wNAF");
1712
1779
  function pippenger(c, fieldN, points, scalars) {
1713
1780
  validateMSMPoints(points, c);
1714
1781
  validateMSMScalars(scalars, fieldN);
@@ -1740,6 +1807,7 @@ var FastNear = (() => {
1740
1807
  }
1741
1808
  return sum;
1742
1809
  }
1810
+ __name(pippenger, "pippenger");
1743
1811
  function validateBasic(curve) {
1744
1812
  validateField(curve.Fp);
1745
1813
  validateObject(curve, {
@@ -1757,6 +1825,7 @@ var FastNear = (() => {
1757
1825
  ...{ p: curve.Fp.ORDER }
1758
1826
  });
1759
1827
  }
1828
+ __name(validateBasic, "validateBasic");
1760
1829
 
1761
1830
  // ../../node_modules/@noble/curves/esm/abstract/edwards.js
1762
1831
  var _0n4 = BigInt(0);
@@ -1779,6 +1848,7 @@ var FastNear = (() => {
1779
1848
  });
1780
1849
  return Object.freeze({ ...opts });
1781
1850
  }
1851
+ __name(validateOpts, "validateOpts");
1782
1852
  function twistedEdwards(curveDef) {
1783
1853
  const CURVE = validateOpts(curveDef);
1784
1854
  const { Fp: Fp2, n: CURVE_ORDER, prehash, hash: cHash, randomBytes: randomBytes2, nByteLength, h: cofactor } = CURVE;
@@ -1802,10 +1872,12 @@ var FastNear = (() => {
1802
1872
  function aCoordinate(title, n) {
1803
1873
  aInRange("coordinate " + title, n, _0n4, MASK);
1804
1874
  }
1875
+ __name(aCoordinate, "aCoordinate");
1805
1876
  function assertPoint(other) {
1806
1877
  if (!(other instanceof Point))
1807
1878
  throw new Error("ExtendedPoint expected");
1808
1879
  }
1880
+ __name(assertPoint, "assertPoint");
1809
1881
  const toAffineMemo = memoized((p, iz) => {
1810
1882
  const { ex: x, ey: y, ez: z } = p;
1811
1883
  const is0 = p.is0();
@@ -1841,6 +1913,9 @@ var FastNear = (() => {
1841
1913
  return true;
1842
1914
  });
1843
1915
  class Point {
1916
+ static {
1917
+ __name(this, "Point");
1918
+ }
1844
1919
  constructor(ex, ey, ez, et) {
1845
1920
  this.ex = ex;
1846
1921
  this.ey = ey;
@@ -2057,9 +2132,11 @@ var FastNear = (() => {
2057
2132
  function modN(a) {
2058
2133
  return mod(a, CURVE_ORDER);
2059
2134
  }
2135
+ __name(modN, "modN");
2060
2136
  function modN_LE(hash) {
2061
2137
  return modN(bytesToNumberLE(hash));
2062
2138
  }
2139
+ __name(modN_LE, "modN_LE");
2063
2140
  function getExtendedPublicKey(key) {
2064
2141
  const len = Fp2.BYTES;
2065
2142
  key = ensureBytes("private key", key, len);
@@ -2071,13 +2148,16 @@ var FastNear = (() => {
2071
2148
  const pointBytes = point.toRawBytes();
2072
2149
  return { head, prefix, scalar, point, pointBytes };
2073
2150
  }
2151
+ __name(getExtendedPublicKey, "getExtendedPublicKey");
2074
2152
  function getPublicKey(privKey) {
2075
2153
  return getExtendedPublicKey(privKey).pointBytes;
2076
2154
  }
2155
+ __name(getPublicKey, "getPublicKey");
2077
2156
  function hashDomainToScalar(context = new Uint8Array(), ...msgs) {
2078
2157
  const msg = concatBytes(...msgs);
2079
2158
  return modN_LE(cHash(domain(msg, ensureBytes("context", context), !!prehash)));
2080
2159
  }
2160
+ __name(hashDomainToScalar, "hashDomainToScalar");
2081
2161
  function sign(msg, privKey, options = {}) {
2082
2162
  msg = ensureBytes("message", msg);
2083
2163
  if (prehash)
@@ -2091,6 +2171,7 @@ var FastNear = (() => {
2091
2171
  const res = concatBytes(R, numberToBytesLE(s, Fp2.BYTES));
2092
2172
  return ensureBytes("result", res, Fp2.BYTES * 2);
2093
2173
  }
2174
+ __name(sign, "sign");
2094
2175
  const verifyOpts = VERIFY_DEFAULT;
2095
2176
  function verify(sig, msg, publicKey, options = verifyOpts) {
2096
2177
  const { context, zip215 } = options;
@@ -2117,11 +2198,12 @@ var FastNear = (() => {
2117
2198
  const RkA = R.add(A.multiplyUnsafe(k));
2118
2199
  return RkA.subtract(SB).clearCofactor().equals(Point.ZERO);
2119
2200
  }
2201
+ __name(verify, "verify");
2120
2202
  G._setWindowSize(8);
2121
2203
  const utils = {
2122
2204
  getExtendedPublicKey,
2123
2205
  // ed25519 private keys are uniform 32b. No need to check for modulo bias, like in secp256k1.
2124
- randomPrivateKey: () => randomBytes2(Fp2.BYTES),
2206
+ randomPrivateKey: /* @__PURE__ */ __name(() => randomBytes2(Fp2.BYTES), "randomPrivateKey"),
2125
2207
  /**
2126
2208
  * We're doing scalar multiplication (used in getPublicKey etc) with precomputed BASE_POINT
2127
2209
  * values. This slows down first getPublicKey() by milliseconds (see Speed section),
@@ -2143,6 +2225,7 @@ var FastNear = (() => {
2143
2225
  utils
2144
2226
  };
2145
2227
  }
2228
+ __name(twistedEdwards, "twistedEdwards");
2146
2229
 
2147
2230
  // ../../node_modules/@noble/curves/esm/ed25519.js
2148
2231
  var ED25519_P = BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");
@@ -2170,12 +2253,14 @@ var FastNear = (() => {
2170
2253
  const pow_p_5_8 = pow2(b250, _2n4, P2) * x % P2;
2171
2254
  return { pow_p_5_8, b2 };
2172
2255
  }
2256
+ __name(ed25519_pow_2_252_3, "ed25519_pow_2_252_3");
2173
2257
  function adjustScalarBytes(bytes) {
2174
2258
  bytes[0] &= 248;
2175
2259
  bytes[31] &= 127;
2176
2260
  bytes[31] |= 64;
2177
2261
  return bytes;
2178
2262
  }
2263
+ __name(adjustScalarBytes, "adjustScalarBytes");
2179
2264
  function uvRatio(u, v) {
2180
2265
  const P2 = ED25519_P;
2181
2266
  const v3 = mod(v * v * v, P2);
@@ -2196,6 +2281,7 @@ var FastNear = (() => {
2196
2281
  x = mod(-x, P2);
2197
2282
  return { isValid: useRoot1 || useRoot2, value: x };
2198
2283
  }
2284
+ __name(uvRatio, "uvRatio");
2199
2285
  var Fp = /* @__PURE__ */ (() => Field(ED25519_P, void 0, true))();
2200
2286
  var ed25519Defaults = /* @__PURE__ */ (() => ({
2201
2287
  // Param: a
@@ -2228,18 +2314,21 @@ var FastNear = (() => {
2228
2314
  function isBytes3(a) {
2229
2315
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
2230
2316
  }
2317
+ __name(isBytes3, "isBytes");
2231
2318
  function abytes3(b, ...lengths) {
2232
2319
  if (!isBytes3(b))
2233
2320
  throw new Error("Uint8Array expected");
2234
2321
  if (lengths.length > 0 && !lengths.includes(b.length))
2235
2322
  throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
2236
2323
  }
2324
+ __name(abytes3, "abytes");
2237
2325
  function aexists2(instance, checkFinished = true) {
2238
2326
  if (instance.destroyed)
2239
2327
  throw new Error("Hash instance has been destroyed");
2240
2328
  if (checkFinished && instance.finished)
2241
2329
  throw new Error("Hash#digest() has already been called");
2242
2330
  }
2331
+ __name(aexists2, "aexists");
2243
2332
  function aoutput2(out, instance) {
2244
2333
  abytes3(out);
2245
2334
  const min = instance.outputLen;
@@ -2247,35 +2336,42 @@ var FastNear = (() => {
2247
2336
  throw new Error("digestInto() expects output buffer of length at least " + min);
2248
2337
  }
2249
2338
  }
2339
+ __name(aoutput2, "aoutput");
2250
2340
 
2251
2341
  // ../../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;
2342
+ var createView2 = /* @__PURE__ */ __name((arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength), "createView");
2343
+ var rotr = /* @__PURE__ */ __name((word, shift) => word << 32 - shift | word >>> shift, "rotr");
2254
2344
  function utf8ToBytes2(str) {
2255
2345
  if (typeof str !== "string")
2256
2346
  throw new Error("utf8ToBytes expected string, got " + typeof str);
2257
2347
  return new Uint8Array(new TextEncoder().encode(str));
2258
2348
  }
2349
+ __name(utf8ToBytes2, "utf8ToBytes");
2259
2350
  function toBytes2(data) {
2260
2351
  if (typeof data === "string")
2261
2352
  data = utf8ToBytes2(data);
2262
2353
  abytes3(data);
2263
2354
  return data;
2264
2355
  }
2356
+ __name(toBytes2, "toBytes");
2265
2357
  var Hash2 = class {
2358
+ static {
2359
+ __name(this, "Hash");
2360
+ }
2266
2361
  // Safe version that clones internal state
2267
2362
  clone() {
2268
2363
  return this._cloneInto();
2269
2364
  }
2270
2365
  };
2271
2366
  function wrapConstructor2(hashCons) {
2272
- const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
2367
+ const hashC = /* @__PURE__ */ __name((msg) => hashCons().update(toBytes2(msg)).digest(), "hashC");
2273
2368
  const tmp = hashCons();
2274
2369
  hashC.outputLen = tmp.outputLen;
2275
2370
  hashC.blockLen = tmp.blockLen;
2276
2371
  hashC.create = () => hashCons();
2277
2372
  return hashC;
2278
2373
  }
2374
+ __name(wrapConstructor2, "wrapConstructor");
2279
2375
 
2280
2376
  // ../../node_modules/@noble/hashes/esm/_md.js
2281
2377
  function setBigUint642(view, byteOffset, value, isLE) {
@@ -2290,9 +2386,13 @@ var FastNear = (() => {
2290
2386
  view.setUint32(byteOffset + h, wh, isLE);
2291
2387
  view.setUint32(byteOffset + l, wl, isLE);
2292
2388
  }
2293
- var Chi = (a, b, c) => a & b ^ ~a & c;
2294
- var Maj = (a, b, c) => a & b ^ a & c ^ b & c;
2389
+ __name(setBigUint642, "setBigUint64");
2390
+ var Chi = /* @__PURE__ */ __name((a, b, c) => a & b ^ ~a & c, "Chi");
2391
+ var Maj = /* @__PURE__ */ __name((a, b, c) => a & b ^ a & c ^ b & c, "Maj");
2295
2392
  var HashMD2 = class extends Hash2 {
2393
+ static {
2394
+ __name(this, "HashMD");
2395
+ }
2296
2396
  constructor(blockLen, outputLen, padOffset, isLE) {
2297
2397
  super();
2298
2398
  this.blockLen = blockLen;
@@ -2458,6 +2558,9 @@ var FastNear = (() => {
2458
2558
  ]);
2459
2559
  var SHA256_W = /* @__PURE__ */ new Uint32Array(64);
2460
2560
  var SHA256 = class extends HashMD2 {
2561
+ static {
2562
+ __name(this, "SHA256");
2563
+ }
2461
2564
  constructor() {
2462
2565
  super(64, 32, 8, false);
2463
2566
  this.A = SHA256_IV[0] | 0;
@@ -2561,15 +2664,16 @@ var FastNear = (() => {
2561
2664
  )
2562
2665
  ]);
2563
2666
  }
2667
+ __name(base58_to_binary, "base58_to_binary");
2564
2668
  var base58_to_binary_default = base58_to_binary;
2565
2669
 
2566
2670
  // ../../node_modules/base58-js/create_base58_map.mjs
2567
- var create_base58_map = () => {
2671
+ var create_base58_map = /* @__PURE__ */ __name(() => {
2568
2672
  const base58M = Array(256).fill(-1);
2569
2673
  for (let i = 0; i < base58_chars_default.length; ++i)
2570
2674
  base58M[base58_chars_default.charCodeAt(i)] = i;
2571
2675
  return base58M;
2572
- };
2676
+ }, "create_base58_map");
2573
2677
  var create_base58_map_default = create_base58_map;
2574
2678
 
2575
2679
  // ../../node_modules/base58-js/binary_to_base58.mjs
@@ -2594,6 +2698,7 @@ var FastNear = (() => {
2594
2698
  result.reverse();
2595
2699
  return String.fromCharCode(...result);
2596
2700
  }
2701
+ __name(binary_to_base58, "binary_to_base58");
2597
2702
  var binary_to_base58_default = binary_to_base58;
2598
2703
 
2599
2704
  // ../../node_modules/js-base64/base64.mjs
@@ -2610,9 +2715,9 @@ var FastNear = (() => {
2610
2715
  var b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/;
2611
2716
  var _fromCC = String.fromCharCode.bind(String);
2612
2717
  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) => {
2718
+ var _mkUriSafe = /* @__PURE__ */ __name((src) => src.replace(/=/g, "").replace(/[+\/]/g, (m0) => m0 == "+" ? "-" : "_"), "_mkUriSafe");
2719
+ var _tidyB64 = /* @__PURE__ */ __name((s) => s.replace(/[^A-Za-z0-9\+\/]/g, ""), "_tidyB64");
2720
+ var btoaPolyfill = /* @__PURE__ */ __name((bin) => {
2616
2721
  let u32, c0, c1, c2, asc = "";
2617
2722
  const pad = bin.length % 3;
2618
2723
  for (let i = 0; i < bin.length; ) {
@@ -2622,7 +2727,7 @@ var FastNear = (() => {
2622
2727
  asc += b64chs[u32 >> 18 & 63] + b64chs[u32 >> 12 & 63] + b64chs[u32 >> 6 & 63] + b64chs[u32 & 63];
2623
2728
  }
2624
2729
  return pad ? asc.slice(0, pad - 3) + "===".substring(pad) : asc;
2625
- };
2730
+ }, "btoaPolyfill");
2626
2731
  var _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bin) => Buffer.from(bin, "binary").toString("base64") : btoaPolyfill;
2627
2732
  var _fromUint8Array = _hasBuffer ? (u8a) => Buffer.from(u8a).toString("base64") : (u8a) => {
2628
2733
  const maxargs = 4096;
@@ -2632,7 +2737,7 @@ var FastNear = (() => {
2632
2737
  }
2633
2738
  return _btoa(strs.join(""));
2634
2739
  };
2635
- var cb_utob = (c) => {
2740
+ var cb_utob = /* @__PURE__ */ __name((c) => {
2636
2741
  if (c.length < 2) {
2637
2742
  var cc = c.charCodeAt(0);
2638
2743
  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 +2745,13 @@ var FastNear = (() => {
2640
2745
  var cc = 65536 + (c.charCodeAt(0) - 55296) * 1024 + (c.charCodeAt(1) - 56320);
2641
2746
  return _fromCC(240 | cc >>> 18 & 7) + _fromCC(128 | cc >>> 12 & 63) + _fromCC(128 | cc >>> 6 & 63) + _fromCC(128 | cc & 63);
2642
2747
  }
2643
- };
2748
+ }, "cb_utob");
2644
2749
  var re_utob = /[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;
2645
- var utob = (u) => u.replace(re_utob, cb_utob);
2750
+ var utob = /* @__PURE__ */ __name((u) => u.replace(re_utob, cb_utob), "utob");
2646
2751
  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);
2752
+ var encode = /* @__PURE__ */ __name((src, urlsafe = false) => urlsafe ? _mkUriSafe(_encode(src)) : _encode(src), "encode");
2648
2753
  var re_btou = /[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;
2649
- var cb_btou = (cccc) => {
2754
+ var cb_btou = /* @__PURE__ */ __name((cccc) => {
2650
2755
  switch (cccc.length) {
2651
2756
  case 4:
2652
2757
  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 +2761,9 @@ var FastNear = (() => {
2656
2761
  default:
2657
2762
  return _fromCC((31 & cccc.charCodeAt(0)) << 6 | 63 & cccc.charCodeAt(1));
2658
2763
  }
2659
- };
2660
- var btou = (b) => b.replace(re_btou, cb_btou);
2661
- var atobPolyfill = (asc) => {
2764
+ }, "cb_btou");
2765
+ var btou = /* @__PURE__ */ __name((b) => b.replace(re_btou, cb_btou), "btou");
2766
+ var atobPolyfill = /* @__PURE__ */ __name((asc) => {
2662
2767
  asc = asc.replace(/\s+/g, "");
2663
2768
  if (!b64re.test(asc))
2664
2769
  throw new TypeError("malformed base64.");
@@ -2669,12 +2774,12 @@ var FastNear = (() => {
2669
2774
  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
2775
  }
2671
2776
  return bin;
2672
- };
2777
+ }, "atobPolyfill");
2673
2778
  var _atob = typeof atob === "function" ? (asc) => atob(_tidyB64(asc)) : _hasBuffer ? (asc) => Buffer.from(asc, "base64").toString("binary") : atobPolyfill;
2674
2779
  var _toUint8Array = _hasBuffer ? (a) => _U8Afrom(Buffer.from(a, "base64")) : (a) => _U8Afrom(_atob(a).split("").map((c) => c.charCodeAt(0)));
2675
2780
  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));
2781
+ var _unURI = /* @__PURE__ */ __name((a) => _tidyB64(a.replace(/[-_]/g, (m0) => m0 == "-" ? "+" : "/")), "_unURI");
2782
+ var decode = /* @__PURE__ */ __name((src) => _decode(_unURI(src)), "decode");
2678
2783
 
2679
2784
  // src/utils.ts
2680
2785
  var LsPrefix = "__fastnear_";
@@ -2687,6 +2792,7 @@ var FastNear = (() => {
2687
2792
  return encode(str);
2688
2793
  }
2689
2794
  }
2795
+ __name(toBase64, "toBase64");
2690
2796
  function fromBase64(str) {
2691
2797
  const binaryString = decode(str);
2692
2798
  const len = binaryString.length;
@@ -2696,6 +2802,7 @@ var FastNear = (() => {
2696
2802
  }
2697
2803
  return bytes;
2698
2804
  }
2805
+ __name(fromBase64, "fromBase64");
2699
2806
  function lsSet(key, value) {
2700
2807
  if (value === null || value === void 0) {
2701
2808
  localStorage.removeItem(LsPrefix + key);
@@ -2703,13 +2810,16 @@ var FastNear = (() => {
2703
2810
  localStorage.setItem(LsPrefix + key, JSON.stringify(value));
2704
2811
  }
2705
2812
  }
2813
+ __name(lsSet, "lsSet");
2706
2814
  function lsGet(key) {
2707
2815
  const value = localStorage.getItem(LsPrefix + key);
2708
2816
  return tryParseJson(value, null);
2709
2817
  }
2818
+ __name(lsGet, "lsGet");
2710
2819
  function deepCopy(obj) {
2711
2820
  return JSON.parse(JSON.stringify(obj));
2712
2821
  }
2822
+ __name(deepCopy, "deepCopy");
2713
2823
  function tryParseJson(...args) {
2714
2824
  try {
2715
2825
  return JSON.parse(args[0]);
@@ -2720,12 +2830,14 @@ var FastNear = (() => {
2720
2830
  return args[0];
2721
2831
  }
2722
2832
  }
2833
+ __name(tryParseJson, "tryParseJson");
2723
2834
  function canSignWithLAK(actions) {
2724
2835
  return actions.length === 1 && actions[0].type === "FunctionCall" && big_default(actions[0]?.deposit ?? "0").eq(0);
2725
2836
  }
2837
+ __name(canSignWithLAK, "canSignWithLAK");
2726
2838
 
2727
2839
  // src/cryptoUtils.ts
2728
- var keyFromString = (key) => base58_to_binary_default(
2840
+ var keyFromString = /* @__PURE__ */ __name((key) => base58_to_binary_default(
2729
2841
  key.includes(":") ? (() => {
2730
2842
  const [curve, keyPart] = key.split(":");
2731
2843
  if (curve !== "ed25519") {
@@ -2733,26 +2845,30 @@ var FastNear = (() => {
2733
2845
  }
2734
2846
  return keyPart;
2735
2847
  })() : key
2736
- );
2737
- var keyToString = (key) => `ed25519:${binary_to_base58_default(key)}`;
2848
+ ), "keyFromString");
2849
+ var keyToString = /* @__PURE__ */ __name((key) => `ed25519:${binary_to_base58_default(key)}`, "keyToString");
2738
2850
  function publicKeyFromPrivate(privateKey) {
2739
2851
  privateKey = keyFromString(privateKey).slice(0, 32);
2740
2852
  const publicKey = ed25519.getPublicKey(privateKey);
2741
2853
  return keyToString(publicKey);
2742
2854
  }
2855
+ __name(publicKeyFromPrivate, "publicKeyFromPrivate");
2743
2856
  function privateKeyFromRandom() {
2744
2857
  const privateKey = crypto.getRandomValues(new Uint8Array(64));
2745
2858
  return keyToString(privateKey);
2746
2859
  }
2860
+ __name(privateKeyFromRandom, "privateKeyFromRandom");
2747
2861
  function signHash(hash, privateKey) {
2748
2862
  privateKey = keyFromString(privateKey).slice(0, 32);
2749
2863
  const signature = ed25519.sign(base58_to_binary_default(hash), privateKey);
2750
2864
  return binary_to_base58_default(signature);
2751
2865
  }
2866
+ __name(signHash, "signHash");
2752
2867
  function signBytes(bytes, privateKey) {
2753
2868
  const hash = sha256(bytes);
2754
2869
  return signHash(binary_to_base58_default(hash), privateKey);
2755
2870
  }
2871
+ __name(signBytes, "signBytes");
2756
2872
 
2757
2873
  // ../../node_modules/borsh/lib/esm/types.js
2758
2874
  var integers = ["u8", "u16", "u32", "u64", "u128", "i8", "i16", "i32", "i64", "i128", "f32", "f64"];
@@ -2767,6 +2883,7 @@ var FastNear = (() => {
2767
2883
  this.buffer = new ArrayBuffer(this.buffer_size);
2768
2884
  this.view = new DataView(this.buffer);
2769
2885
  }
2886
+ __name(EncodeBuffer2, "EncodeBuffer");
2770
2887
  EncodeBuffer2.prototype.resize_if_necessary = function(needed_space) {
2771
2888
  if (this.buffer_size - this.offset < needed_space) {
2772
2889
  this.buffer_size = Math.max(this.buffer_size * 2, this.buffer_size + needed_space);
@@ -2805,6 +2922,7 @@ var FastNear = (() => {
2805
2922
  new Uint8Array(this.buffer).set(buf);
2806
2923
  this.view = new DataView(this.buffer);
2807
2924
  }
2925
+ __name(DecodeBuffer2, "DecodeBuffer");
2808
2926
  DecodeBuffer2.prototype.assert_enough_buffer = function(size) {
2809
2927
  if (this.offset + size > this.buffer.byteLength) {
2810
2928
  throw new Error("Error in schema, the buffer is smaller than expected");
@@ -2831,14 +2949,14 @@ var FastNear = (() => {
2831
2949
 
2832
2950
  // ../../node_modules/borsh/lib/esm/utils.js
2833
2951
  var __extends = /* @__PURE__ */ function() {
2834
- var extendStatics = function(d, b) {
2952
+ var extendStatics = /* @__PURE__ */ __name(function(d, b) {
2835
2953
  extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
2836
2954
  d2.__proto__ = b2;
2837
2955
  } || function(d2, b2) {
2838
2956
  for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p];
2839
2957
  };
2840
2958
  return extendStatics(d, b);
2841
- };
2959
+ }, "extendStatics");
2842
2960
  return function(d, b) {
2843
2961
  if (typeof b !== "function" && b !== null)
2844
2962
  throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
@@ -2846,17 +2964,20 @@ var FastNear = (() => {
2846
2964
  function __() {
2847
2965
  this.constructor = d;
2848
2966
  }
2967
+ __name(__, "__");
2849
2968
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
2850
2969
  };
2851
2970
  }();
2852
2971
  function isArrayLike(value) {
2853
2972
  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
2973
  }
2974
+ __name(isArrayLike, "isArrayLike");
2855
2975
  function expect_type(value, type, fieldPath) {
2856
2976
  if (typeof value !== type) {
2857
2977
  throw new Error("Expected ".concat(type, " not ").concat(typeof value, "(").concat(value, ") at ").concat(fieldPath.join(".")));
2858
2978
  }
2859
2979
  }
2980
+ __name(expect_type, "expect_type");
2860
2981
  function expect_bigint(value, fieldPath) {
2861
2982
  var basicType = ["number", "string", "bigint", "boolean"].includes(typeof value);
2862
2983
  var strObject = typeof value === "object" && value !== null && "toString" in value;
@@ -2864,16 +2985,19 @@ var FastNear = (() => {
2864
2985
  throw new Error("Expected bigint, number, boolean or string not ".concat(typeof value, "(").concat(value, ") at ").concat(fieldPath.join(".")));
2865
2986
  }
2866
2987
  }
2988
+ __name(expect_bigint, "expect_bigint");
2867
2989
  function expect_same_size(length, expected, fieldPath) {
2868
2990
  if (length !== expected) {
2869
2991
  throw new Error("Array length ".concat(length, " does not match schema length ").concat(expected, " at ").concat(fieldPath.join(".")));
2870
2992
  }
2871
2993
  }
2994
+ __name(expect_same_size, "expect_same_size");
2872
2995
  function expect_enum(value, fieldPath) {
2873
2996
  if (typeof value !== "object" || value === null) {
2874
2997
  throw new Error("Expected object not ".concat(typeof value, "(").concat(value, ") at ").concat(fieldPath.join(".")));
2875
2998
  }
2876
2999
  }
3000
+ __name(expect_enum, "expect_enum");
2877
3001
  var VALID_STRING_TYPES = integers.concat(["bool", "string"]);
2878
3002
  var VALID_OBJECT_KEYS = ["option", "enum", "array", "set", "map", "struct"];
2879
3003
  var ErrorSchema = (
@@ -2884,6 +3008,7 @@ var FastNear = (() => {
2884
3008
  var message = "Invalid schema: ".concat(JSON.stringify(schema), " expected ").concat(expected);
2885
3009
  return _super.call(this, message) || this;
2886
3010
  }
3011
+ __name(ErrorSchema2, "ErrorSchema");
2887
3012
  return ErrorSchema2;
2888
3013
  }(Error)
2889
3014
  );
@@ -2911,6 +3036,7 @@ var FastNear = (() => {
2911
3036
  }
2912
3037
  throw new ErrorSchema(schema, VALID_OBJECT_KEYS.join(", ") + " or " + VALID_STRING_TYPES.join(", "));
2913
3038
  }
3039
+ __name(validate_schema, "validate_schema");
2914
3040
  function validate_enum_schema(schema) {
2915
3041
  if (!Array.isArray(schema))
2916
3042
  throw new ErrorSchema(schema, "Array");
@@ -2925,6 +3051,7 @@ var FastNear = (() => {
2925
3051
  validate_schema({ struct: sch.struct });
2926
3052
  }
2927
3053
  }
3054
+ __name(validate_enum_schema, "validate_enum_schema");
2928
3055
  function validate_array_schema(schema) {
2929
3056
  if (typeof schema !== "object")
2930
3057
  throw new ErrorSchema(schema, "{ type, len? }");
@@ -2935,6 +3062,7 @@ var FastNear = (() => {
2935
3062
  return validate_schema(schema.type);
2936
3063
  throw new ErrorSchema(schema, "{ type, len? }");
2937
3064
  }
3065
+ __name(validate_array_schema, "validate_array_schema");
2938
3066
  function validate_map_schema(schema) {
2939
3067
  if (typeof schema === "object" && "key" in schema && "value" in schema) {
2940
3068
  validate_schema(schema.key);
@@ -2943,6 +3071,7 @@ var FastNear = (() => {
2943
3071
  throw new ErrorSchema(schema, "{ key, value }");
2944
3072
  }
2945
3073
  }
3074
+ __name(validate_map_schema, "validate_map_schema");
2946
3075
  function validate_struct_schema(schema) {
2947
3076
  if (typeof schema !== "object")
2948
3077
  throw new ErrorSchema(schema, "object");
@@ -2950,6 +3079,7 @@ var FastNear = (() => {
2950
3079
  validate_schema(schema[key]);
2951
3080
  }
2952
3081
  }
3082
+ __name(validate_struct_schema, "validate_struct_schema");
2953
3083
 
2954
3084
  // ../../node_modules/borsh/lib/esm/serialize.js
2955
3085
  var BorshSerializer = (
@@ -2960,6 +3090,7 @@ var FastNear = (() => {
2960
3090
  this.fieldPath = ["value"];
2961
3091
  this.checkTypes = checkTypes;
2962
3092
  }
3093
+ __name(BorshSerializer2, "BorshSerializer");
2963
3094
  BorshSerializer2.prototype.encode = function(value, schema) {
2964
3095
  this.encode_value(value, schema);
2965
3096
  return this.encoded.get_used_buffer();
@@ -3118,6 +3249,7 @@ var FastNear = (() => {
3118
3249
  function BorshDeserializer2(bufferArray) {
3119
3250
  this.buffer = new DecodeBuffer(bufferArray);
3120
3251
  }
3252
+ __name(BorshDeserializer2, "BorshDeserializer");
3121
3253
  BorshDeserializer2.prototype.decode = function(schema) {
3122
3254
  return this.decode_value(schema);
3123
3255
  };
@@ -3256,6 +3388,7 @@ var FastNear = (() => {
3256
3388
  var serializer = new BorshSerializer(validate);
3257
3389
  return serializer.encode(value, schema);
3258
3390
  }
3391
+ __name(serialize, "serialize");
3259
3392
 
3260
3393
  // src/transaction.ts
3261
3394
  function mapTransaction(jsonTransaction) {
@@ -3272,10 +3405,12 @@ var FastNear = (() => {
3272
3405
  actions: jsonTransaction.actions.map(mapAction)
3273
3406
  };
3274
3407
  }
3408
+ __name(mapTransaction, "mapTransaction");
3275
3409
  function serializeTransaction(jsonTransaction) {
3276
3410
  const transaction = mapTransaction(jsonTransaction);
3277
3411
  return serialize(SCHEMA.Transaction, transaction);
3278
3412
  }
3413
+ __name(serializeTransaction, "serializeTransaction");
3279
3414
  function serializeSignedTransaction(jsonTransaction, signature) {
3280
3415
  const signedTransaction = {
3281
3416
  transaction: mapTransaction(jsonTransaction),
@@ -3287,6 +3422,7 @@ var FastNear = (() => {
3287
3422
  };
3288
3423
  return serialize(SCHEMA.SignedTransaction, signedTransaction);
3289
3424
  }
3425
+ __name(serializeSignedTransaction, "serializeSignedTransaction");
3290
3426
  function mapAction(action) {
3291
3427
  switch (action.type) {
3292
3428
  case "CreateAccount": {
@@ -3384,7 +3520,11 @@ var FastNear = (() => {
3384
3520
  }
3385
3521
  }
3386
3522
  }
3523
+ __name(mapAction, "mapAction");
3387
3524
  var SCHEMA = new class BorshSchema {
3525
+ static {
3526
+ __name(this, "BorshSchema");
3527
+ }
3388
3528
  Ed25519Signature = {
3389
3529
  struct: {
3390
3530
  data: { array: { type: "u8", len: 64 } }
@@ -3544,7 +3684,7 @@ var FastNear = (() => {
3544
3684
  // src/near.ts
3545
3685
  big_default.DP = 27;
3546
3686
  var MaxBlockDelayMs = 1e3 * 60 * 60 * 6;
3547
- var WIDGET_URL = "http://localhost:3000/";
3687
+ var WIDGET_URL = "https://wallet-adapter.fastnear.com";
3548
3688
  var DEFAULT_NETWORK_ID = "mainnet";
3549
3689
  var NETWORKS = {
3550
3690
  testnet: {
@@ -3582,6 +3722,7 @@ var FastNear = (() => {
3582
3722
  networkId: DEFAULT_NETWORK_ID
3583
3723
  };
3584
3724
  }
3725
+ __name(getWalletAdapterState, "getWalletAdapterState");
3585
3726
  var _adapter;
3586
3727
  function updateState(newState) {
3587
3728
  const oldState = _state;
@@ -3603,6 +3744,7 @@ var FastNear = (() => {
3603
3744
  _adapter.setState(getWalletAdapterState());
3604
3745
  }
3605
3746
  }
3747
+ __name(updateState, "updateState");
3606
3748
  function updateTxHistory(txStatus) {
3607
3749
  const txId = txStatus.txId;
3608
3750
  _txHistory[txId] = {
@@ -3613,6 +3755,7 @@ var FastNear = (() => {
3613
3755
  lsSet("txHistory", _txHistory);
3614
3756
  notifyTxListeners(_txHistory[txId]);
3615
3757
  }
3758
+ __name(updateTxHistory, "updateTxHistory");
3616
3759
  function onAdapterStateUpdate(state) {
3617
3760
  console.log("Adapter state update:", state);
3618
3761
  const { accountId, lastWalletId, privateKey } = state;
@@ -3622,6 +3765,7 @@ var FastNear = (() => {
3622
3765
  ...privateKey && { privateKey }
3623
3766
  });
3624
3767
  }
3768
+ __name(onAdapterStateUpdate, "onAdapterStateUpdate");
3625
3769
  _adapter = new WalletAdapter({
3626
3770
  onStateUpdate: onAdapterStateUpdate,
3627
3771
  lastState: getWalletAdapterState(),
@@ -3639,9 +3783,11 @@ var FastNear = (() => {
3639
3783
  }
3640
3784
  }
3641
3785
  }
3786
+ __name(parseJsonFromBytes, "parseJsonFromBytes");
3642
3787
  function withBlockId(params, blockId) {
3643
3788
  return blockId === "final" || blockId === "optimistic" ? { ...params, finality: blockId } : blockId ? { ...params, block_id: blockId } : { ...params, finality: "optimistic" };
3644
3789
  }
3790
+ __name(withBlockId, "withBlockId");
3645
3791
  async function queryRpc(method, params) {
3646
3792
  const response = await fetch(_config.nodeUrl, {
3647
3793
  method: "POST",
@@ -3659,6 +3805,7 @@ var FastNear = (() => {
3659
3805
  }
3660
3806
  return result.result;
3661
3807
  }
3808
+ __name(queryRpc, "queryRpc");
3662
3809
  function afterTxSent(txId) {
3663
3810
  queryRpc("tx", {
3664
3811
  tx_hash: _txHistory[txId].txHash,
@@ -3682,6 +3829,7 @@ var FastNear = (() => {
3682
3829
  });
3683
3830
  });
3684
3831
  }
3832
+ __name(afterTxSent, "afterTxSent");
3685
3833
  function sendTxToRpc(signedTxBase64, waitUntil, txId) {
3686
3834
  queryRpc("send_tx", {
3687
3835
  signed_tx_base64: signedTxBase64,
@@ -3703,6 +3851,7 @@ var FastNear = (() => {
3703
3851
  });
3704
3852
  });
3705
3853
  }
3854
+ __name(sendTxToRpc, "sendTxToRpc");
3706
3855
  function notifyAccountListeners(accountId) {
3707
3856
  if (_eventListeners.account.size === 0) {
3708
3857
  _unbroadcastedEvents.account.push(accountId);
@@ -3716,6 +3865,7 @@ var FastNear = (() => {
3716
3865
  }
3717
3866
  });
3718
3867
  }
3868
+ __name(notifyAccountListeners, "notifyAccountListeners");
3719
3869
  function notifyTxListeners(tx) {
3720
3870
  if (_eventListeners.tx.size === 0) {
3721
3871
  _unbroadcastedEvents.tx.push(tx);
@@ -3729,6 +3879,7 @@ var FastNear = (() => {
3729
3879
  }
3730
3880
  });
3731
3881
  }
3882
+ __name(notifyTxListeners, "notifyTxListeners");
3732
3883
  function convertUnit(s, ...args) {
3733
3884
  if (Array.isArray(s)) {
3734
3885
  s = s.reduce((acc, part, i) => {
@@ -3761,6 +3912,7 @@ var FastNear = (() => {
3761
3912
  }
3762
3913
  return big_default(s).toFixed(0);
3763
3914
  }
3915
+ __name(convertUnit, "convertUnit");
3764
3916
  var api = {
3765
3917
  // Context
3766
3918
  get accountId() {
@@ -4063,7 +4215,7 @@ var FastNear = (() => {
4063
4215
  },
4064
4216
  // Action Helpers
4065
4217
  actions: {
4066
- functionCall: ({
4218
+ functionCall: /* @__PURE__ */ __name(({
4067
4219
  methodName,
4068
4220
  gas,
4069
4221
  deposit,
@@ -4076,22 +4228,22 @@ var FastNear = (() => {
4076
4228
  argsBase64,
4077
4229
  gas,
4078
4230
  deposit
4079
- }),
4080
- transfer: (yoctoAmount) => ({
4231
+ }), "functionCall"),
4232
+ transfer: /* @__PURE__ */ __name((yoctoAmount) => ({
4081
4233
  type: "Transfer",
4082
4234
  deposit: yoctoAmount
4083
- }),
4084
- stakeNEAR: ({ amount, publicKey }) => ({
4235
+ }), "transfer"),
4236
+ stakeNEAR: /* @__PURE__ */ __name(({ amount, publicKey }) => ({
4085
4237
  type: "Stake",
4086
4238
  stake: amount,
4087
4239
  publicKey
4088
- }),
4089
- addFullAccessKey: ({ publicKey }) => ({
4240
+ }), "stakeNEAR"),
4241
+ addFullAccessKey: /* @__PURE__ */ __name(({ publicKey }) => ({
4090
4242
  type: "AddKey",
4091
4243
  publicKey,
4092
4244
  accessKey: { permission: "FullAccess" }
4093
- }),
4094
- addLimitedAccessKey: ({
4245
+ }), "addFullAccessKey"),
4246
+ addLimitedAccessKey: /* @__PURE__ */ __name(({
4095
4247
  publicKey,
4096
4248
  allowance,
4097
4249
  accountId,
@@ -4105,22 +4257,22 @@ var FastNear = (() => {
4105
4257
  receiverId: accountId,
4106
4258
  methodNames
4107
4259
  }
4108
- }),
4109
- deleteKey: ({ publicKey }) => ({
4260
+ }), "addLimitedAccessKey"),
4261
+ deleteKey: /* @__PURE__ */ __name(({ publicKey }) => ({
4110
4262
  type: "DeleteKey",
4111
4263
  publicKey
4112
- }),
4113
- deleteAccount: ({ beneficiaryId }) => ({
4264
+ }), "deleteKey"),
4265
+ deleteAccount: /* @__PURE__ */ __name(({ beneficiaryId }) => ({
4114
4266
  type: "DeleteAccount",
4115
4267
  beneficiaryId
4116
- }),
4117
- createAccount: () => ({
4268
+ }), "deleteAccount"),
4269
+ createAccount: /* @__PURE__ */ __name(() => ({
4118
4270
  type: "CreateAccount"
4119
- }),
4120
- deployContract: ({ codeBase64 }) => ({
4271
+ }), "createAccount"),
4272
+ deployContract: /* @__PURE__ */ __name(({ codeBase64 }) => ({
4121
4273
  type: "DeployContract",
4122
4274
  codeBase64
4123
- })
4275
+ }), "deployContract")
4124
4276
  },
4125
4277
  utils: {
4126
4278
  toBase64,
@@ -4224,4 +4376,4 @@ var FastNear = (() => {
4224
4376
  @noble/hashes/esm/utils.js:
4225
4377
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
4226
4378
  */
4227
- //# sourceMappingURL=index.js.map
4379
+ //# sourceMappingURL=browser.global.js.map