starknet 8.5.3 → 8.5.4

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.
@@ -769,6 +769,12 @@ var starknet = (() => {
769
769
  function isBytes(a) {
770
770
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
771
771
  }
772
+ function abytes(b, ...lengths) {
773
+ if (!isBytes(b))
774
+ throw new Error("Uint8Array expected");
775
+ if (lengths.length > 0 && !lengths.includes(b.length))
776
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
777
+ }
772
778
  function isArrayOf(isString2, arr) {
773
779
  if (!Array.isArray(arr))
774
780
  return false;
@@ -941,7 +947,24 @@ var starknet = (() => {
941
947
  }
942
948
  };
943
949
  }
944
- var base64 = /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join(""));
950
+ var hasBase64Builtin = /* @__PURE__ */ (() => typeof Uint8Array.from([]).toBase64 === "function" && typeof Uint8Array.fromBase64 === "function")();
951
+ var decodeBase64Builtin = (s, isUrl) => {
952
+ astr("base64", s);
953
+ const re = isUrl ? /^[A-Za-z0-9=_-]+$/ : /^[A-Za-z0-9=+/]+$/;
954
+ const alphabet2 = isUrl ? "base64url" : "base64";
955
+ if (s.length > 0 && !re.test(s))
956
+ throw new Error("invalid base64");
957
+ return Uint8Array.fromBase64(s, { alphabet: alphabet2, lastChunkHandling: "strict" });
958
+ };
959
+ var base64 = hasBase64Builtin ? {
960
+ encode(b) {
961
+ abytes(b);
962
+ return b.toBase64();
963
+ },
964
+ decode(s) {
965
+ return decodeBase64Builtin(s, false);
966
+ }
967
+ } : /* @__PURE__ */ chain(/* @__PURE__ */ radix2(6), /* @__PURE__ */ alphabet("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"), /* @__PURE__ */ padding(6), /* @__PURE__ */ join(""));
945
968
 
946
969
  // src/utils/encode.ts
947
970
  var IS_BROWSER = typeof window !== "undefined";
@@ -1492,6 +1515,9 @@ ${JSON.stringify(data, null, 2)}`;
1492
1515
  }
1493
1516
  var NUMBER_REGEX = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
1494
1517
  function isSafeNumber(value, config3) {
1518
+ if (isInteger(value)) {
1519
+ return Number.isSafeInteger(Number.parseInt(value, 10));
1520
+ }
1495
1521
  const num = Number.parseFloat(value);
1496
1522
  const parsed = String(num);
1497
1523
  if (value === parsed) {
@@ -1510,13 +1536,13 @@ ${JSON.stringify(data, null, 2)}`;
1510
1536
  }
1511
1537
  return false;
1512
1538
  }
1513
- var UnsafeNumberReason = /* @__PURE__ */ function(UnsafeNumberReason2) {
1539
+ var UnsafeNumberReason = /* @__PURE__ */ (function(UnsafeNumberReason2) {
1514
1540
  UnsafeNumberReason2["underflow"] = "underflow";
1515
1541
  UnsafeNumberReason2["overflow"] = "overflow";
1516
1542
  UnsafeNumberReason2["truncate_integer"] = "truncate_integer";
1517
1543
  UnsafeNumberReason2["truncate_float"] = "truncate_float";
1518
1544
  return UnsafeNumberReason2;
1519
- }({});
1545
+ })({});
1520
1546
  function getUnsafeNumberReason(value) {
1521
1547
  if (isSafeNumber(value, {
1522
1548
  approx: false
@@ -2190,7 +2216,7 @@ ${indent}}` : "}";
2190
2216
  __export(utils_exports, {
2191
2217
  aInRange: () => aInRange,
2192
2218
  abool: () => abool,
2193
- abytes: () => abytes,
2219
+ abytes: () => abytes2,
2194
2220
  bitGet: () => bitGet,
2195
2221
  bitLen: () => bitLen,
2196
2222
  bitMask: () => bitMask,
@@ -2221,7 +2247,7 @@ ${indent}}` : "}";
2221
2247
  function isBytes2(a) {
2222
2248
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
2223
2249
  }
2224
- function abytes(item) {
2250
+ function abytes2(item) {
2225
2251
  if (!isBytes2(item))
2226
2252
  throw new Error("Uint8Array expected");
2227
2253
  }
@@ -2231,7 +2257,7 @@ ${indent}}` : "}";
2231
2257
  }
2232
2258
  var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
2233
2259
  function bytesToHex(bytes) {
2234
- abytes(bytes);
2260
+ abytes2(bytes);
2235
2261
  let hex = "";
2236
2262
  for (let i = 0; i < bytes.length; i++) {
2237
2263
  hex += hexes[bytes[i]];
@@ -2280,7 +2306,7 @@ ${indent}}` : "}";
2280
2306
  return hexToNumber(bytesToHex(bytes));
2281
2307
  }
2282
2308
  function bytesToNumberLE(bytes) {
2283
- abytes(bytes);
2309
+ abytes2(bytes);
2284
2310
  return hexToNumber(bytesToHex(Uint8Array.from(bytes).reverse()));
2285
2311
  }
2286
2312
  function numberToBytesBE(n, len) {
@@ -2314,7 +2340,7 @@ ${indent}}` : "}";
2314
2340
  let sum = 0;
2315
2341
  for (let i = 0; i < arrays.length; i++) {
2316
2342
  const a = arrays[i];
2317
- abytes(a);
2343
+ abytes2(a);
2318
2344
  sum += a.length;
2319
2345
  }
2320
2346
  const res = new Uint8Array(sum);
@@ -2461,18 +2487,12 @@ ${indent}}` : "}";
2461
2487
  function isBytes3(a) {
2462
2488
  return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
2463
2489
  }
2464
- function abytes2(b, ...lengths) {
2490
+ function abytes3(b, ...lengths) {
2465
2491
  if (!isBytes3(b))
2466
2492
  throw new Error("Uint8Array expected");
2467
2493
  if (lengths.length > 0 && !lengths.includes(b.length))
2468
2494
  throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
2469
2495
  }
2470
- function ahash(h) {
2471
- if (typeof h !== "function" || typeof h.create !== "function")
2472
- throw new Error("Hash should be wrapped by utils.wrapConstructor");
2473
- anumber2(h.outputLen);
2474
- anumber2(h.blockLen);
2475
- }
2476
2496
  function aexists(instance, checkFinished = true) {
2477
2497
  if (instance.destroyed)
2478
2498
  throw new Error("Hash instance has been destroyed");
@@ -2480,16 +2500,13 @@ ${indent}}` : "}";
2480
2500
  throw new Error("Hash#digest() has already been called");
2481
2501
  }
2482
2502
  function aoutput(out, instance) {
2483
- abytes2(out);
2503
+ abytes3(out);
2484
2504
  const min = instance.outputLen;
2485
2505
  if (out.length < min) {
2486
2506
  throw new Error("digestInto() expects output buffer of length at least " + min);
2487
2507
  }
2488
2508
  }
2489
2509
 
2490
- // node_modules/@noble/hashes/esm/crypto.js
2491
- var crypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
2492
-
2493
2510
  // node_modules/@noble/hashes/esm/utils.js
2494
2511
  var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
2495
2512
  var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
@@ -2509,24 +2526,9 @@ ${indent}}` : "}";
2509
2526
  function toBytes(data) {
2510
2527
  if (typeof data === "string")
2511
2528
  data = utf8ToBytes2(data);
2512
- abytes2(data);
2529
+ abytes3(data);
2513
2530
  return data;
2514
2531
  }
2515
- function concatBytes2(...arrays) {
2516
- let sum = 0;
2517
- for (let i = 0; i < arrays.length; i++) {
2518
- const a = arrays[i];
2519
- abytes2(a);
2520
- sum += a.length;
2521
- }
2522
- const res = new Uint8Array(sum);
2523
- for (let i = 0, pad = 0; i < arrays.length; i++) {
2524
- const a = arrays[i];
2525
- res.set(a, pad);
2526
- pad += a.length;
2527
- }
2528
- return res;
2529
- }
2530
2532
  var Hash = class {
2531
2533
  // Safe version that clones internal state
2532
2534
  clone() {
@@ -2549,15 +2551,6 @@ ${indent}}` : "}";
2549
2551
  hashC.create = (opts) => hashCons(opts);
2550
2552
  return hashC;
2551
2553
  }
2552
- function randomBytes(bytesLength = 32) {
2553
- if (crypto && typeof crypto.getRandomValues === "function") {
2554
- return crypto.getRandomValues(new Uint8Array(bytesLength));
2555
- }
2556
- if (crypto && typeof crypto.randomBytes === "function") {
2557
- return crypto.randomBytes(bytesLength);
2558
- }
2559
- throw new Error("crypto.getRandomValues must be defined");
2560
- }
2561
2554
 
2562
2555
  // node_modules/@noble/hashes/esm/_md.js
2563
2556
  function setBigUint64(view, byteOffset, value, isLE2) {
@@ -3121,7 +3114,7 @@ ${indent}}` : "}";
3121
3114
  }
3122
3115
  writeInto(out) {
3123
3116
  aexists(this, false);
3124
- abytes2(out);
3117
+ abytes3(out);
3125
3118
  this.finish();
3126
3119
  const bufferOut = this.state;
3127
3120
  const { blockLen } = this;
@@ -3924,7 +3917,7 @@ ${indent}}` : "}";
3924
3917
  toSig(hex) {
3925
3918
  const { Err: E, _int: int, _tlv: tlv } = DER;
3926
3919
  const data = typeof hex === "string" ? h2b(hex) : hex;
3927
- abytes(data);
3920
+ abytes2(data);
3928
3921
  const { v: seqBytes, l: seqLeftBytes } = tlv.decode(48, data);
3929
3922
  if (seqLeftBytes.length)
3930
3923
  throw new E("invalid signature: left bytes after parsing");
@@ -3951,7 +3944,7 @@ ${indent}}` : "}";
3951
3944
  const CURVE2 = validatePointOpts(opts);
3952
3945
  const { Fp } = CURVE2;
3953
3946
  const Fn = Field(CURVE2.n, CURVE2.nBitLength);
3954
- const toBytes2 = CURVE2.toBytes || ((_c, point, _isCompressed) => {
3947
+ const toBytes3 = CURVE2.toBytes || ((_c, point, _isCompressed) => {
3955
3948
  const a = point.toAffine();
3956
3949
  return concatBytes(Uint8Array.from([4]), Fp.toBytes(a.x), Fp.toBytes(a.y));
3957
3950
  });
@@ -4324,7 +4317,7 @@ ${indent}}` : "}";
4324
4317
  toRawBytes(isCompressed = true) {
4325
4318
  abool("isCompressed", isCompressed);
4326
4319
  this.assertValidity();
4327
- return toBytes2(Point2, this, isCompressed);
4320
+ return toBytes3(Point2, this, isCompressed);
4328
4321
  }
4329
4322
  toHex(isCompressed = true) {
4330
4323
  abool("isCompressed", isCompressed);
@@ -4771,14 +4764,104 @@ ${indent}}` : "}";
4771
4764
  };
4772
4765
  }
4773
4766
 
4774
- // node_modules/@noble/hashes/esm/hmac.js
4775
- var HMAC = class extends Hash {
4767
+ // node_modules/@noble/curves/node_modules/@noble/hashes/esm/_assert.js
4768
+ function anumber3(n) {
4769
+ if (!Number.isSafeInteger(n) || n < 0)
4770
+ throw new Error("positive integer expected, got " + n);
4771
+ }
4772
+ function isBytes4(a) {
4773
+ return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
4774
+ }
4775
+ function abytes4(b, ...lengths) {
4776
+ if (!isBytes4(b))
4777
+ throw new Error("Uint8Array expected");
4778
+ if (lengths.length > 0 && !lengths.includes(b.length))
4779
+ throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
4780
+ }
4781
+ function ahash(h) {
4782
+ if (typeof h !== "function" || typeof h.create !== "function")
4783
+ throw new Error("Hash should be wrapped by utils.wrapConstructor");
4784
+ anumber3(h.outputLen);
4785
+ anumber3(h.blockLen);
4786
+ }
4787
+ function aexists2(instance, checkFinished = true) {
4788
+ if (instance.destroyed)
4789
+ throw new Error("Hash instance has been destroyed");
4790
+ if (checkFinished && instance.finished)
4791
+ throw new Error("Hash#digest() has already been called");
4792
+ }
4793
+ function aoutput2(out, instance) {
4794
+ abytes4(out);
4795
+ const min = instance.outputLen;
4796
+ if (out.length < min) {
4797
+ throw new Error("digestInto() expects output buffer of length at least " + min);
4798
+ }
4799
+ }
4800
+
4801
+ // node_modules/@noble/curves/node_modules/@noble/hashes/esm/crypto.js
4802
+ var crypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
4803
+
4804
+ // node_modules/@noble/curves/node_modules/@noble/hashes/esm/utils.js
4805
+ var createView2 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
4806
+ var rotr2 = (word, shift) => word << 32 - shift | word >>> shift;
4807
+ function utf8ToBytes3(str) {
4808
+ if (typeof str !== "string")
4809
+ throw new Error("utf8ToBytes expected string, got " + typeof str);
4810
+ return new Uint8Array(new TextEncoder().encode(str));
4811
+ }
4812
+ function toBytes2(data) {
4813
+ if (typeof data === "string")
4814
+ data = utf8ToBytes3(data);
4815
+ abytes4(data);
4816
+ return data;
4817
+ }
4818
+ function concatBytes2(...arrays) {
4819
+ let sum = 0;
4820
+ for (let i = 0; i < arrays.length; i++) {
4821
+ const a = arrays[i];
4822
+ abytes4(a);
4823
+ sum += a.length;
4824
+ }
4825
+ const res = new Uint8Array(sum);
4826
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
4827
+ const a = arrays[i];
4828
+ res.set(a, pad);
4829
+ pad += a.length;
4830
+ }
4831
+ return res;
4832
+ }
4833
+ var Hash2 = class {
4834
+ // Safe version that clones internal state
4835
+ clone() {
4836
+ return this._cloneInto();
4837
+ }
4838
+ };
4839
+ function wrapConstructor2(hashCons) {
4840
+ const hashC = (msg) => hashCons().update(toBytes2(msg)).digest();
4841
+ const tmp = hashCons();
4842
+ hashC.outputLen = tmp.outputLen;
4843
+ hashC.blockLen = tmp.blockLen;
4844
+ hashC.create = () => hashCons();
4845
+ return hashC;
4846
+ }
4847
+ function randomBytes(bytesLength = 32) {
4848
+ if (crypto && typeof crypto.getRandomValues === "function") {
4849
+ return crypto.getRandomValues(new Uint8Array(bytesLength));
4850
+ }
4851
+ if (crypto && typeof crypto.randomBytes === "function") {
4852
+ return crypto.randomBytes(bytesLength);
4853
+ }
4854
+ throw new Error("crypto.getRandomValues must be defined");
4855
+ }
4856
+
4857
+ // node_modules/@noble/curves/node_modules/@noble/hashes/esm/hmac.js
4858
+ var HMAC = class extends Hash2 {
4776
4859
  constructor(hash, _key) {
4777
4860
  super();
4778
4861
  this.finished = false;
4779
4862
  this.destroyed = false;
4780
4863
  ahash(hash);
4781
- const key = toBytes(_key);
4864
+ const key = toBytes2(_key);
4782
4865
  this.iHash = hash.create();
4783
4866
  if (typeof this.iHash.update !== "function")
4784
4867
  throw new Error("Expected instance of class which extends utils.Hash");
@@ -4797,13 +4880,13 @@ ${indent}}` : "}";
4797
4880
  pad.fill(0);
4798
4881
  }
4799
4882
  update(buf) {
4800
- aexists(this);
4883
+ aexists2(this);
4801
4884
  this.iHash.update(buf);
4802
4885
  return this;
4803
4886
  }
4804
4887
  digestInto(out) {
4805
- aexists(this);
4806
- abytes2(out, this.outputLen);
4888
+ aexists2(this);
4889
+ abytes4(out, this.outputLen);
4807
4890
  this.finished = true;
4808
4891
  this.iHash.digestInto(out);
4809
4892
  this.oHash.update(out);
@@ -6017,10 +6100,13 @@ ${indent}}` : "}";
6017
6100
  UNSUPPORTED_TX_VERSION: 61,
6018
6101
  UNSUPPORTED_CONTRACT_CLASS_VERSION: 62,
6019
6102
  UNEXPECTED_ERROR: 63,
6103
+ REPLACEMENT_TRANSACTION_UNDERPRICED: 64,
6104
+ FEE_BELOW_MINIMUM: 65,
6020
6105
  INVALID_SUBSCRIPTION_ID: 66,
6021
6106
  TOO_MANY_ADDRESSES_IN_FILTER: 67,
6022
6107
  TOO_MANY_BLOCKS_BACK: 68,
6023
6108
  COMPILATION_ERROR: 100,
6109
+ //
6024
6110
  INVALID_ADDRESS: 150,
6025
6111
  TOKEN_NOT_SUPPORTED: 151,
6026
6112
  INVALID_SIGNATURE: 153,
@@ -13680,6 +13766,258 @@ ${indent}}` : "}";
13680
13766
  validateAndParseEthAddress: () => validateAndParseEthAddress
13681
13767
  });
13682
13768
 
13769
+ // node_modules/@noble/curves/node_modules/@noble/hashes/esm/_md.js
13770
+ function setBigUint642(view, byteOffset, value, isLE2) {
13771
+ if (typeof view.setBigUint64 === "function")
13772
+ return view.setBigUint64(byteOffset, value, isLE2);
13773
+ const _32n2 = BigInt(32);
13774
+ const _u32_max = BigInt(4294967295);
13775
+ const wh = Number(value >> _32n2 & _u32_max);
13776
+ const wl = Number(value & _u32_max);
13777
+ const h = isLE2 ? 4 : 0;
13778
+ const l = isLE2 ? 0 : 4;
13779
+ view.setUint32(byteOffset + h, wh, isLE2);
13780
+ view.setUint32(byteOffset + l, wl, isLE2);
13781
+ }
13782
+ var Chi2 = (a, b, c) => a & b ^ ~a & c;
13783
+ var Maj2 = (a, b, c) => a & b ^ a & c ^ b & c;
13784
+ var HashMD2 = class extends Hash2 {
13785
+ constructor(blockLen, outputLen, padOffset, isLE2) {
13786
+ super();
13787
+ this.blockLen = blockLen;
13788
+ this.outputLen = outputLen;
13789
+ this.padOffset = padOffset;
13790
+ this.isLE = isLE2;
13791
+ this.finished = false;
13792
+ this.length = 0;
13793
+ this.pos = 0;
13794
+ this.destroyed = false;
13795
+ this.buffer = new Uint8Array(blockLen);
13796
+ this.view = createView2(this.buffer);
13797
+ }
13798
+ update(data) {
13799
+ aexists2(this);
13800
+ const { view, buffer, blockLen } = this;
13801
+ data = toBytes2(data);
13802
+ const len = data.length;
13803
+ for (let pos = 0; pos < len; ) {
13804
+ const take = Math.min(blockLen - this.pos, len - pos);
13805
+ if (take === blockLen) {
13806
+ const dataView = createView2(data);
13807
+ for (; blockLen <= len - pos; pos += blockLen)
13808
+ this.process(dataView, pos);
13809
+ continue;
13810
+ }
13811
+ buffer.set(data.subarray(pos, pos + take), this.pos);
13812
+ this.pos += take;
13813
+ pos += take;
13814
+ if (this.pos === blockLen) {
13815
+ this.process(view, 0);
13816
+ this.pos = 0;
13817
+ }
13818
+ }
13819
+ this.length += data.length;
13820
+ this.roundClean();
13821
+ return this;
13822
+ }
13823
+ digestInto(out) {
13824
+ aexists2(this);
13825
+ aoutput2(out, this);
13826
+ this.finished = true;
13827
+ const { buffer, view, blockLen, isLE: isLE2 } = this;
13828
+ let { pos } = this;
13829
+ buffer[pos++] = 128;
13830
+ this.buffer.subarray(pos).fill(0);
13831
+ if (this.padOffset > blockLen - pos) {
13832
+ this.process(view, 0);
13833
+ pos = 0;
13834
+ }
13835
+ for (let i = pos; i < blockLen; i++)
13836
+ buffer[i] = 0;
13837
+ setBigUint642(view, blockLen - 8, BigInt(this.length * 8), isLE2);
13838
+ this.process(view, 0);
13839
+ const oview = createView2(out);
13840
+ const len = this.outputLen;
13841
+ if (len % 4)
13842
+ throw new Error("_sha2: outputLen should be aligned to 32bit");
13843
+ const outLen = len / 4;
13844
+ const state = this.get();
13845
+ if (outLen > state.length)
13846
+ throw new Error("_sha2: outputLen bigger than state");
13847
+ for (let i = 0; i < outLen; i++)
13848
+ oview.setUint32(4 * i, state[i], isLE2);
13849
+ }
13850
+ digest() {
13851
+ const { buffer, outputLen } = this;
13852
+ this.digestInto(buffer);
13853
+ const res = buffer.slice(0, outputLen);
13854
+ this.destroy();
13855
+ return res;
13856
+ }
13857
+ _cloneInto(to) {
13858
+ to || (to = new this.constructor());
13859
+ to.set(...this.get());
13860
+ const { blockLen, buffer, length, finished, destroyed, pos } = this;
13861
+ to.length = length;
13862
+ to.pos = pos;
13863
+ to.finished = finished;
13864
+ to.destroyed = destroyed;
13865
+ if (length % blockLen)
13866
+ to.buffer.set(buffer);
13867
+ return to;
13868
+ }
13869
+ };
13870
+
13871
+ // node_modules/@noble/curves/node_modules/@noble/hashes/esm/sha256.js
13872
+ var SHA256_K2 = /* @__PURE__ */ new Uint32Array([
13873
+ 1116352408,
13874
+ 1899447441,
13875
+ 3049323471,
13876
+ 3921009573,
13877
+ 961987163,
13878
+ 1508970993,
13879
+ 2453635748,
13880
+ 2870763221,
13881
+ 3624381080,
13882
+ 310598401,
13883
+ 607225278,
13884
+ 1426881987,
13885
+ 1925078388,
13886
+ 2162078206,
13887
+ 2614888103,
13888
+ 3248222580,
13889
+ 3835390401,
13890
+ 4022224774,
13891
+ 264347078,
13892
+ 604807628,
13893
+ 770255983,
13894
+ 1249150122,
13895
+ 1555081692,
13896
+ 1996064986,
13897
+ 2554220882,
13898
+ 2821834349,
13899
+ 2952996808,
13900
+ 3210313671,
13901
+ 3336571891,
13902
+ 3584528711,
13903
+ 113926993,
13904
+ 338241895,
13905
+ 666307205,
13906
+ 773529912,
13907
+ 1294757372,
13908
+ 1396182291,
13909
+ 1695183700,
13910
+ 1986661051,
13911
+ 2177026350,
13912
+ 2456956037,
13913
+ 2730485921,
13914
+ 2820302411,
13915
+ 3259730800,
13916
+ 3345764771,
13917
+ 3516065817,
13918
+ 3600352804,
13919
+ 4094571909,
13920
+ 275423344,
13921
+ 430227734,
13922
+ 506948616,
13923
+ 659060556,
13924
+ 883997877,
13925
+ 958139571,
13926
+ 1322822218,
13927
+ 1537002063,
13928
+ 1747873779,
13929
+ 1955562222,
13930
+ 2024104815,
13931
+ 2227730452,
13932
+ 2361852424,
13933
+ 2428436474,
13934
+ 2756734187,
13935
+ 3204031479,
13936
+ 3329325298
13937
+ ]);
13938
+ var SHA256_IV2 = /* @__PURE__ */ new Uint32Array([
13939
+ 1779033703,
13940
+ 3144134277,
13941
+ 1013904242,
13942
+ 2773480762,
13943
+ 1359893119,
13944
+ 2600822924,
13945
+ 528734635,
13946
+ 1541459225
13947
+ ]);
13948
+ var SHA256_W2 = /* @__PURE__ */ new Uint32Array(64);
13949
+ var SHA2562 = class extends HashMD2 {
13950
+ constructor() {
13951
+ super(64, 32, 8, false);
13952
+ this.A = SHA256_IV2[0] | 0;
13953
+ this.B = SHA256_IV2[1] | 0;
13954
+ this.C = SHA256_IV2[2] | 0;
13955
+ this.D = SHA256_IV2[3] | 0;
13956
+ this.E = SHA256_IV2[4] | 0;
13957
+ this.F = SHA256_IV2[5] | 0;
13958
+ this.G = SHA256_IV2[6] | 0;
13959
+ this.H = SHA256_IV2[7] | 0;
13960
+ }
13961
+ get() {
13962
+ const { A, B, C, D, E, F, G, H } = this;
13963
+ return [A, B, C, D, E, F, G, H];
13964
+ }
13965
+ // prettier-ignore
13966
+ set(A, B, C, D, E, F, G, H) {
13967
+ this.A = A | 0;
13968
+ this.B = B | 0;
13969
+ this.C = C | 0;
13970
+ this.D = D | 0;
13971
+ this.E = E | 0;
13972
+ this.F = F | 0;
13973
+ this.G = G | 0;
13974
+ this.H = H | 0;
13975
+ }
13976
+ process(view, offset) {
13977
+ for (let i = 0; i < 16; i++, offset += 4)
13978
+ SHA256_W2[i] = view.getUint32(offset, false);
13979
+ for (let i = 16; i < 64; i++) {
13980
+ const W15 = SHA256_W2[i - 15];
13981
+ const W2 = SHA256_W2[i - 2];
13982
+ const s0 = rotr2(W15, 7) ^ rotr2(W15, 18) ^ W15 >>> 3;
13983
+ const s1 = rotr2(W2, 17) ^ rotr2(W2, 19) ^ W2 >>> 10;
13984
+ SHA256_W2[i] = s1 + SHA256_W2[i - 7] + s0 + SHA256_W2[i - 16] | 0;
13985
+ }
13986
+ let { A, B, C, D, E, F, G, H } = this;
13987
+ for (let i = 0; i < 64; i++) {
13988
+ const sigma1 = rotr2(E, 6) ^ rotr2(E, 11) ^ rotr2(E, 25);
13989
+ const T1 = H + sigma1 + Chi2(E, F, G) + SHA256_K2[i] + SHA256_W2[i] | 0;
13990
+ const sigma0 = rotr2(A, 2) ^ rotr2(A, 13) ^ rotr2(A, 22);
13991
+ const T2 = sigma0 + Maj2(A, B, C) | 0;
13992
+ H = G;
13993
+ G = F;
13994
+ F = E;
13995
+ E = D + T1 | 0;
13996
+ D = C;
13997
+ C = B;
13998
+ B = A;
13999
+ A = T1 + T2 | 0;
14000
+ }
14001
+ A = A + this.A | 0;
14002
+ B = B + this.B | 0;
14003
+ C = C + this.C | 0;
14004
+ D = D + this.D | 0;
14005
+ E = E + this.E | 0;
14006
+ F = F + this.F | 0;
14007
+ G = G + this.G | 0;
14008
+ H = H + this.H | 0;
14009
+ this.set(A, B, C, D, E, F, G, H);
14010
+ }
14011
+ roundClean() {
14012
+ SHA256_W2.fill(0);
14013
+ }
14014
+ destroy() {
14015
+ this.set(0, 0, 0, 0, 0, 0, 0, 0);
14016
+ this.buffer.fill(0);
14017
+ }
14018
+ };
14019
+ var sha2562 = /* @__PURE__ */ wrapConstructor2(() => new SHA2562());
14020
+
13683
14021
  // node_modules/@noble/curves/esm/secp256k1.js
13684
14022
  var secp256k1P = BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f");
13685
14023
  var secp256k1N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
@@ -13756,7 +14094,7 @@ ${indent}}` : "}";
13756
14094
  return { k1neg, k1, k2neg, k2 };
13757
14095
  }
13758
14096
  }
13759
- }, sha256);
14097
+ }, sha2562);
13760
14098
  var _0n6 = BigInt(0);
13761
14099
  var Point = secp256k1.ProjectivePoint;
13762
14100
 
@@ -14175,7 +14513,7 @@ ${indent}}` : "}";
14175
14513
  }
14176
14514
  /**
14177
14515
  * fetch rpc node specVersion
14178
- * @example this.specVersion = "0.7.1"
14516
+ * @example this.specVersion = "0.8.1"
14179
14517
  */
14180
14518
  getSpecVersion() {
14181
14519
  return this.fetchEndpoint("starknet_specVersion");
@@ -14326,21 +14664,22 @@ ${indent}}` : "}";
14326
14664
  }
14327
14665
  async waitForTransaction(txHash, options) {
14328
14666
  const transactionHash = toHex(txHash);
14329
- let { retries } = this;
14667
+ let retries = options?.retries ?? this.retries;
14668
+ let lifeCycleRetries = options?.lifeCycleRetries ?? 3;
14330
14669
  let onchain = false;
14331
14670
  let isErrorState = false;
14332
14671
  const retryInterval = options?.retryInterval ?? this.transactionRetryIntervalDefault;
14333
- const errorStates = options?.errorStates ?? [
14334
- esm_exports.ETransactionStatus.REJECTED
14335
- // TODO: commented out to preserve the long-standing behavior of "reverted" not being treated as an error by default
14336
- // should decide which behavior to keep in the future
14337
- // RPC.ETransactionExecutionStatus.REVERTED,
14338
- ];
14672
+ const errorStates = options?.errorStates ?? [esm_exports.ETransactionStatus.REJECTED];
14339
14673
  const successStates = options?.successStates ?? [
14340
14674
  // RPC.ETransactionExecutionStatus.SUCCEEDED, Starknet 0.14.0 this one can have incomplete events
14341
14675
  esm_exports.ETransactionStatus.ACCEPTED_ON_L2,
14342
14676
  esm_exports.ETransactionStatus.ACCEPTED_ON_L1
14343
14677
  ];
14678
+ const LifeCycleErrorMessages = {
14679
+ [esm_exports2.ETransactionStatus.RECEIVED]: SYSTEM_MESSAGES.txEvictedFromMempool,
14680
+ [esm_exports2.ETransactionStatus.PRE_CONFIRMED]: SYSTEM_MESSAGES.consensusFailed,
14681
+ [esm_exports2.ETransactionStatus.CANDIDATE]: SYSTEM_MESSAGES.txFailsBlockBuildingValidation
14682
+ };
14344
14683
  const txLife = [];
14345
14684
  let txStatus;
14346
14685
  while (!onchain) {
@@ -14369,15 +14708,11 @@ ${indent}}` : "}";
14369
14708
  }
14370
14709
  if (error instanceof RpcError && error.isType("TXN_HASH_NOT_FOUND")) {
14371
14710
  logger.info("txLife: ", txLife);
14372
- const errorMessages = {
14373
- [esm_exports2.ETransactionStatus.RECEIVED]: SYSTEM_MESSAGES.txEvictedFromMempool,
14374
- [esm_exports2.ETransactionStatus.PRE_CONFIRMED]: SYSTEM_MESSAGES.consensusFailed,
14375
- [esm_exports2.ETransactionStatus.CANDIDATE]: SYSTEM_MESSAGES.txFailsBlockBuildingValidation
14376
- };
14377
- const errorMessage = errorMessages[txLife.at(-1)];
14378
- if (errorMessage) {
14711
+ const errorMessage = LifeCycleErrorMessages[txLife.at(-1)];
14712
+ if (errorMessage && lifeCycleRetries <= 0) {
14379
14713
  throw new Error(errorMessage);
14380
14714
  }
14715
+ lifeCycleRetries -= 1;
14381
14716
  }
14382
14717
  if (retries <= 0) {
14383
14718
  throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
@@ -14767,14 +15102,14 @@ ${indent}}` : "}";
14767
15102
  }
14768
15103
  /**
14769
15104
  * fetch rpc node specVersion
14770
- * @example this.specVersion = "0.7.1"
15105
+ * @example this.specVersion = "0.9.0"
14771
15106
  */
14772
15107
  getSpecVersion() {
14773
15108
  return this.fetchEndpoint("starknet_specVersion");
14774
15109
  }
14775
15110
  /**
14776
15111
  * fetch if undefined else just return this.specVersion
14777
- * @example this.specVersion = "0.8.1"
15112
+ * @example this.specVersion = "0.9.0"
14778
15113
  */
14779
15114
  async setUpSpecVersion() {
14780
15115
  if (!this.specVersion) {
@@ -14918,7 +15253,8 @@ ${indent}}` : "}";
14918
15253
  }
14919
15254
  async waitForTransaction(txHash, options) {
14920
15255
  const transactionHash = toHex(txHash);
14921
- let { retries } = this;
15256
+ let retries = options?.retries ?? this.retries;
15257
+ let lifeCycleRetries = options?.lifeCycleRetries ?? 3;
14922
15258
  let onchain = false;
14923
15259
  let isErrorState = false;
14924
15260
  const retryInterval = options?.retryInterval ?? this.transactionRetryIntervalDefault;
@@ -14928,6 +15264,11 @@ ${indent}}` : "}";
14928
15264
  esm_exports2.ETransactionFinalityStatus.ACCEPTED_ON_L2,
14929
15265
  esm_exports2.ETransactionFinalityStatus.ACCEPTED_ON_L1
14930
15266
  ];
15267
+ const errorMessages = {
15268
+ [esm_exports2.ETransactionStatus.RECEIVED]: SYSTEM_MESSAGES.txEvictedFromMempool,
15269
+ [esm_exports2.ETransactionStatus.PRE_CONFIRMED]: SYSTEM_MESSAGES.consensusFailed,
15270
+ [esm_exports2.ETransactionStatus.CANDIDATE]: SYSTEM_MESSAGES.txFailsBlockBuildingValidation
15271
+ };
14931
15272
  const txLife = [];
14932
15273
  let txStatus;
14933
15274
  while (!onchain) {
@@ -14956,15 +15297,11 @@ ${indent}}` : "}";
14956
15297
  }
14957
15298
  if (error instanceof RpcError && error.isType("TXN_HASH_NOT_FOUND")) {
14958
15299
  logger.info("txLife: ", txLife);
14959
- const errorMessages = {
14960
- [esm_exports2.ETransactionStatus.RECEIVED]: SYSTEM_MESSAGES.txEvictedFromMempool,
14961
- [esm_exports2.ETransactionStatus.PRE_CONFIRMED]: SYSTEM_MESSAGES.consensusFailed,
14962
- [esm_exports2.ETransactionStatus.CANDIDATE]: SYSTEM_MESSAGES.txFailsBlockBuildingValidation
14963
- };
14964
15300
  const errorMessage = errorMessages[txLife.at(-1)];
14965
- if (errorMessage) {
15301
+ if (errorMessage && lifeCycleRetries <= 0) {
14966
15302
  throw new Error(errorMessage);
14967
15303
  }
15304
+ lifeCycleRetries -= 1;
14968
15305
  }
14969
15306
  if (retries <= 0) {
14970
15307
  throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
@@ -16151,12 +16488,15 @@ ${indent}}` : "}";
16151
16488
  match(callbacks) {
16152
16489
  return statusReceipt in callbacks ? callbacks[statusReceipt](value) : callbacks._();
16153
16490
  },
16491
+ // @ts-ignore - docs
16154
16492
  isSuccess() {
16155
16493
  return statusReceipt === "SUCCEEDED";
16156
16494
  },
16495
+ // @ts-ignore - docs
16157
16496
  isReverted() {
16158
16497
  return statusReceipt === "REVERTED";
16159
16498
  },
16499
+ // @ts-ignore - docs
16160
16500
  isError() {
16161
16501
  return false;
16162
16502
  }
@@ -16169,12 +16509,15 @@ ${indent}}` : "}";
16169
16509
  match(callbacks) {
16170
16510
  return "ERROR" in callbacks ? callbacks.ERROR(errorValue) : callbacks._();
16171
16511
  },
16512
+ // @ts-ignore - docs
16172
16513
  isSuccess() {
16173
16514
  return false;
16174
16515
  },
16516
+ // @ts-ignore - docs
16175
16517
  isReverted() {
16176
16518
  return false;
16177
16519
  },
16520
+ // @ts-ignore - docs
16178
16521
  isError() {
16179
16522
  return true;
16180
16523
  }
@@ -21044,6 +21387,7 @@ ${indent}}` : "}";
21044
21387
  @noble/curves/esm/secp256k1.js:
21045
21388
  (*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
21046
21389
 
21390
+ @noble/hashes/esm/utils.js:
21047
21391
  @noble/hashes/esm/utils.js:
21048
21392
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
21049
21393