starknet 6.10.2 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,8 +9,7 @@ var starknet = (() => {
9
9
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
10
10
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
11
11
  }) : x)(function(x) {
12
- if (typeof require !== "undefined")
13
- return require.apply(this, arguments);
12
+ if (typeof require !== "undefined") return require.apply(this, arguments);
14
13
  throw Error('Dynamic require of "' + x + '" is not supported');
15
14
  });
16
15
  var __esm = (fn, res) => function __init() {
@@ -298,8 +297,7 @@ var starknet = (() => {
298
297
  module.exports = function required(port, protocol) {
299
298
  protocol = protocol.split(":")[0];
300
299
  port = +port;
301
- if (!port)
302
- return false;
300
+ if (!port) return false;
303
301
  switch (protocol) {
304
302
  case "http":
305
303
  case "ws":
@@ -343,8 +341,7 @@ var starknet = (() => {
343
341
  var parser = /([^=?#&]+)=?([^&]*)/g, result = {}, part;
344
342
  while (part = parser.exec(query)) {
345
343
  var key = decode3(part[1]), value = decode3(part[2]);
346
- if (key === null || value === null || key in result)
347
- continue;
344
+ if (key === null || value === null || key in result) continue;
348
345
  result[key] = value;
349
346
  }
350
347
  return result;
@@ -352,8 +349,7 @@ var starknet = (() => {
352
349
  function querystringify(obj, prefix) {
353
350
  prefix = prefix || "";
354
351
  var pairs = [], value, key;
355
- if ("string" !== typeof prefix)
356
- prefix = "?";
352
+ if ("string" !== typeof prefix) prefix = "?";
357
353
  for (key in obj) {
358
354
  if (has.call(obj, key)) {
359
355
  value = obj[key];
@@ -362,8 +358,7 @@ var starknet = (() => {
362
358
  }
363
359
  key = encode2(key);
364
360
  value = encode2(value);
365
- if (key === null || value === null)
366
- continue;
361
+ if (key === null || value === null) continue;
367
362
  pairs.push(key + "=" + value);
368
363
  }
369
364
  }
@@ -411,14 +406,10 @@ var starknet = (() => {
411
406
  var ignore = { hash: 1, query: 1 };
412
407
  function lolcation(loc) {
413
408
  var globalVar;
414
- if (typeof window !== "undefined")
415
- globalVar = window;
416
- else if (typeof global !== "undefined")
417
- globalVar = global;
418
- else if (typeof self !== "undefined")
419
- globalVar = self;
420
- else
421
- globalVar = {};
409
+ if (typeof window !== "undefined") globalVar = window;
410
+ else if (typeof global !== "undefined") globalVar = global;
411
+ else if (typeof self !== "undefined") globalVar = self;
412
+ else globalVar = {};
422
413
  var location = globalVar.location || {};
423
414
  loc = loc || location;
424
415
  var finaldestination = {}, type = typeof loc, key;
@@ -426,12 +417,10 @@ var starknet = (() => {
426
417
  finaldestination = new Url(unescape(loc.pathname), {});
427
418
  } else if ("string" === type) {
428
419
  finaldestination = new Url(loc, {});
429
- for (key in ignore)
430
- delete finaldestination[key];
420
+ for (key in ignore) delete finaldestination[key];
431
421
  } else if ("object" === type) {
432
422
  for (key in loc) {
433
- if (key in ignore)
434
- continue;
423
+ if (key in ignore) continue;
435
424
  finaldestination[key] = loc[key];
436
425
  }
437
426
  if (finaldestination.slashes === void 0) {
@@ -490,8 +479,7 @@ var starknet = (() => {
490
479
  };
491
480
  }
492
481
  function resolve(relative, base2) {
493
- if (relative === "")
494
- return base2;
482
+ if (relative === "") return base2;
495
483
  var path = (base2 || "/").split("/").slice(0, -1).concat(relative.split("/")), i = path.length, last = path[i - 1], unshift = false, up = 0;
496
484
  while (i--) {
497
485
  if (path[i] === ".") {
@@ -500,16 +488,13 @@ var starknet = (() => {
500
488
  path.splice(i, 1);
501
489
  up++;
502
490
  } else if (up) {
503
- if (i === 0)
504
- unshift = true;
491
+ if (i === 0) unshift = true;
505
492
  path.splice(i, 1);
506
493
  up--;
507
494
  }
508
495
  }
509
- if (unshift)
510
- path.unshift("");
511
- if (last === "." || last === "..")
512
- path.push("");
496
+ if (unshift) path.unshift("");
497
+ if (last === "." || last === "..") path.push("");
513
498
  return path.join("/");
514
499
  }
515
500
  function Url(address, location, parser) {
@@ -523,8 +508,7 @@ var starknet = (() => {
523
508
  parser = location;
524
509
  location = null;
525
510
  }
526
- if (parser && "function" !== typeof parser)
527
- parser = qs.parse;
511
+ if (parser && "function" !== typeof parser) parser = qs.parse;
528
512
  location = lolcation(location);
529
513
  extracted = extractProtocol(address || "", location);
530
514
  relative = !extracted.protocol && !extracted.slashes;
@@ -560,11 +544,9 @@ var starknet = (() => {
560
544
  address = address.slice(0, index.index);
561
545
  }
562
546
  url[key] = url[key] || (relative && instruction[3] ? location[key] || "" : "");
563
- if (instruction[4])
564
- url[key] = url[key].toLowerCase();
547
+ if (instruction[4]) url[key] = url[key].toLowerCase();
565
548
  }
566
- if (parser)
567
- url.query = parser(url.query);
549
+ if (parser) url.query = parser(url.query);
568
550
  if (relative && location.slashes && url.pathname.charAt(0) !== "/" && (url.pathname !== "" || location.pathname !== "")) {
569
551
  url.pathname = resolve(url.pathname, location.pathname);
570
552
  }
@@ -611,8 +593,7 @@ var starknet = (() => {
611
593
  break;
612
594
  case "hostname":
613
595
  url[part] = value;
614
- if (url.port)
615
- value += ":" + url.port;
596
+ if (url.port) value += ":" + url.port;
616
597
  url.host = value;
617
598
  break;
618
599
  case "host":
@@ -656,25 +637,21 @@ var starknet = (() => {
656
637
  }
657
638
  for (var i = 0; i < rules.length; i++) {
658
639
  var ins = rules[i];
659
- if (ins[4])
660
- url[ins[1]] = url[ins[1]].toLowerCase();
640
+ if (ins[4]) url[ins[1]] = url[ins[1]].toLowerCase();
661
641
  }
662
642
  url.auth = url.password ? url.username + ":" + url.password : url.username;
663
643
  url.origin = url.protocol !== "file:" && isSpecial(url.protocol) && url.host ? url.protocol + "//" + url.host : "null";
664
644
  url.href = url.toString();
665
645
  return url;
666
646
  }
667
- function toString3(stringify3) {
668
- if (!stringify3 || "function" !== typeof stringify3)
669
- stringify3 = qs.stringify;
647
+ function toString2(stringify3) {
648
+ if (!stringify3 || "function" !== typeof stringify3) stringify3 = qs.stringify;
670
649
  var query, url = this, host = url.host, protocol = url.protocol;
671
- if (protocol && protocol.charAt(protocol.length - 1) !== ":")
672
- protocol += ":";
650
+ if (protocol && protocol.charAt(protocol.length - 1) !== ":") protocol += ":";
673
651
  var result = protocol + (url.protocol && url.slashes || isSpecial(url.protocol) ? "//" : "");
674
652
  if (url.username) {
675
653
  result += url.username;
676
- if (url.password)
677
- result += ":" + url.password;
654
+ if (url.password) result += ":" + url.password;
678
655
  result += "@";
679
656
  } else if (url.password) {
680
657
  result += ":" + url.password;
@@ -687,13 +664,11 @@ var starknet = (() => {
687
664
  }
688
665
  result += host + url.pathname;
689
666
  query = "object" === typeof url.query ? stringify3(url.query) : url.query;
690
- if (query)
691
- result += "?" !== query.charAt(0) ? "?" + query : query;
692
- if (url.hash)
693
- result += url.hash;
667
+ if (query) result += "?" !== query.charAt(0) ? "?" + query : query;
668
+ if (url.hash) result += url.hash;
694
669
  return result;
695
670
  }
696
- Url.prototype = { set, toString: toString3 };
671
+ Url.prototype = { set, toString: toString2 };
697
672
  Url.extractProtocol = extractProtocol;
698
673
  Url.location = lolcation;
699
674
  Url.trimLeft = trimLeft;
@@ -10326,13 +10301,11 @@ var starknet = (() => {
10326
10301
  "use strict";
10327
10302
  exports.fromCallback = function(fn) {
10328
10303
  return Object.defineProperty(function() {
10329
- if (typeof arguments[arguments.length - 1] === "function")
10330
- fn.apply(this, arguments);
10304
+ if (typeof arguments[arguments.length - 1] === "function") fn.apply(this, arguments);
10331
10305
  else {
10332
10306
  return new Promise((resolve, reject) => {
10333
10307
  arguments[arguments.length] = (err2, res) => {
10334
- if (err2)
10335
- return reject(err2);
10308
+ if (err2) return reject(err2);
10336
10309
  resolve(res);
10337
10310
  };
10338
10311
  arguments.length++;
@@ -10344,8 +10317,7 @@ var starknet = (() => {
10344
10317
  exports.fromPromise = function(fn) {
10345
10318
  return Object.defineProperty(function() {
10346
10319
  const cb = arguments[arguments.length - 1];
10347
- if (typeof cb !== "function")
10348
- return fn.apply(this, arguments);
10320
+ if (typeof cb !== "function") return fn.apply(this, arguments);
10349
10321
  else {
10350
10322
  delete arguments[arguments.length - 1];
10351
10323
  arguments.length--;
@@ -10640,6 +10612,7 @@ var starknet = (() => {
10640
10612
  var require_validators = __commonJS({
10641
10613
  "node_modules/tough-cookie/lib/validators.js"(exports) {
10642
10614
  "use strict";
10615
+ var toString2 = Object.prototype.toString;
10643
10616
  function isFunction(data) {
10644
10617
  return typeof data === "function";
10645
10618
  }
@@ -10656,7 +10629,7 @@ var starknet = (() => {
10656
10629
  return typeof data === "string" || data instanceof String;
10657
10630
  }
10658
10631
  function isObject3(data) {
10659
- return toString.call(data) === "[object Object]";
10632
+ return toString2.call(data) === "[object Object]";
10660
10633
  }
10661
10634
  function isInstanceStrict(data, prototype) {
10662
10635
  try {
@@ -10665,6 +10638,9 @@ var starknet = (() => {
10665
10638
  return false;
10666
10639
  }
10667
10640
  }
10641
+ function isUrlStringOrObject(data) {
10642
+ return isNonEmptyString(data) || isObject3(data) && "hostname" in data && "pathname" in data && "protocol" in data || isInstanceStrict(data, URL);
10643
+ }
10668
10644
  function isInteger2(data) {
10669
10645
  return typeof data === "number" && data % 1 === 0;
10670
10646
  }
@@ -10673,8 +10649,7 @@ var starknet = (() => {
10673
10649
  options = cb;
10674
10650
  cb = null;
10675
10651
  }
10676
- if (!isObject3(options))
10677
- options = { Error: "Failed Check" };
10652
+ if (!isObject3(options)) options = { Error: "Failed Check" };
10678
10653
  if (!bool) {
10679
10654
  if (cb) {
10680
10655
  cb(new ParameterError(options));
@@ -10695,6 +10670,7 @@ var starknet = (() => {
10695
10670
  exports.isEmptyString = isEmptyString;
10696
10671
  exports.isString = isString2;
10697
10672
  exports.isObject = isObject3;
10673
+ exports.isUrlStringOrObject = isUrlStringOrObject;
10698
10674
  exports.validate = validate;
10699
10675
  }
10700
10676
  });
@@ -10703,7 +10679,7 @@ var starknet = (() => {
10703
10679
  var require_version = __commonJS({
10704
10680
  "node_modules/tough-cookie/lib/version.js"(exports, module) {
10705
10681
  "use strict";
10706
- module.exports = "4.1.3";
10682
+ module.exports = "4.1.4";
10707
10683
  }
10708
10684
  });
10709
10685
 
@@ -10926,8 +10902,7 @@ var starknet = (() => {
10926
10902
  return path.slice(0, rightSlash);
10927
10903
  }
10928
10904
  function trimTerminator(str) {
10929
- if (validators.isEmptyString(str))
10930
- return str;
10905
+ if (validators.isEmptyString(str)) return str;
10931
10906
  for (let t = 0; t < TERMINATORS.length; t++) {
10932
10907
  const terminatorIdx = str.indexOf(TERMINATORS[t]);
10933
10908
  if (terminatorIdx !== -1) {
@@ -11418,7 +11393,7 @@ var starknet = (() => {
11418
11393
  this.serializeSync = syncWrap("serialize");
11419
11394
  }
11420
11395
  setCookie(cookie, url, options, cb) {
11421
- validators.validate(validators.isNonEmptyString(url), cb, options);
11396
+ validators.validate(validators.isUrlStringOrObject(url), cb, options);
11422
11397
  let err2;
11423
11398
  if (validators.isFunction(url)) {
11424
11399
  cb = url;
@@ -11548,7 +11523,7 @@ var starknet = (() => {
11548
11523
  }
11549
11524
  // RFC6365 S5.4
11550
11525
  getCookies(url, options, cb) {
11551
- validators.validate(validators.isNonEmptyString(url), cb, url);
11526
+ validators.validate(validators.isUrlStringOrObject(url), cb, url);
11552
11527
  const context = getCookieContext(url);
11553
11528
  if (validators.isFunction(options)) {
11554
11529
  cb = options;
@@ -12117,8 +12092,7 @@ var starknet = (() => {
12117
12092
  }
12118
12093
  }
12119
12094
  function consumed(body) {
12120
- if (body._noBody)
12121
- return;
12095
+ if (body._noBody) return;
12122
12096
  if (body.bodyUsed) {
12123
12097
  return Promise.reject(new TypeError("Already read"));
12124
12098
  }
@@ -12608,12 +12582,9 @@ var starknet = (() => {
12608
12582
  "node_modules/url-join/lib/url-join.js"(exports, module) {
12609
12583
  "use strict";
12610
12584
  (function(name, context, definition) {
12611
- if (typeof module !== "undefined" && module.exports)
12612
- module.exports = definition();
12613
- else if (typeof define === "function" && define.amd)
12614
- define(definition);
12615
- else
12616
- context[name] = definition();
12585
+ if (typeof module !== "undefined" && module.exports) module.exports = definition();
12586
+ else if (typeof define === "function" && define.amd) define(definition);
12587
+ else context[name] = definition();
12617
12588
  })("urljoin", exports, function() {
12618
12589
  function normalize(strArray) {
12619
12590
  var resultArray = [];
@@ -13354,9 +13325,9 @@ var starknet = (() => {
13354
13325
  utf8ToBytes: () => utf8ToBytes,
13355
13326
  validateObject: () => validateObject
13356
13327
  });
13357
- var _0n = BigInt(0);
13358
- var _1n = BigInt(1);
13359
- var _2n = BigInt(2);
13328
+ var _0n = /* @__PURE__ */ BigInt(0);
13329
+ var _1n = /* @__PURE__ */ BigInt(1);
13330
+ var _2n = /* @__PURE__ */ BigInt(2);
13360
13331
  function isBytes2(a) {
13361
13332
  return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
13362
13333
  }
@@ -14110,8 +14081,7 @@ var starknet = (() => {
14110
14081
  return (+value).toString();
14111
14082
  }
14112
14083
  function hexToBytes2(str) {
14113
- if (!isHex(str))
14114
- throw new Error(`${str} needs to be a hex-string`);
14084
+ if (!isHex(str)) throw new Error(`${str} needs to be a hex-string`);
14115
14085
  let adaptedValue = removeHexPrefix(str);
14116
14086
  if (adaptedValue.length % 2 !== 0) {
14117
14087
  adaptedValue = `0${adaptedValue}`;
@@ -16614,15 +16584,12 @@ var starknet = (() => {
16614
16584
  return longStr.match(regex) || [];
16615
16585
  }
16616
16586
  function encodeShortString(str) {
16617
- if (!isASCII(str))
16618
- throw new Error(`${str} is not an ASCII string`);
16619
- if (!isShortString(str))
16620
- throw new Error(`${str} is too long`);
16587
+ if (!isASCII(str)) throw new Error(`${str} is not an ASCII string`);
16588
+ if (!isShortString(str)) throw new Error(`${str} is too long`);
16621
16589
  return addHexPrefix(str.replace(/./g, (char) => char.charCodeAt(0).toString(16)));
16622
16590
  }
16623
16591
  function decodeShortString(str) {
16624
- if (!isASCII(str))
16625
- throw new Error(`${str} is not an ASCII string`);
16592
+ if (!isASCII(str)) throw new Error(`${str} is not an ASCII string`);
16626
16593
  if (isHex(str)) {
16627
16594
  return removeHexPrefix(str).replace(/.{2}/g, (hex) => String.fromCharCode(parseInt(hex, 16)));
16628
16595
  }
@@ -16750,10 +16717,8 @@ var starknet = (() => {
16750
16717
  */
16751
16718
  static validate(bigNumberish) {
16752
16719
  const bigInt = BigInt(bigNumberish);
16753
- if (bigInt < UINT_256_MIN)
16754
- throw Error("bigNumberish is smaller than UINT_256_MIN");
16755
- if (bigInt > UINT_256_MAX)
16756
- throw new Error("bigNumberish is bigger than UINT_256_MAX");
16720
+ if (bigInt < UINT_256_MIN) throw Error("bigNumberish is smaller than UINT_256_MIN");
16721
+ if (bigInt > UINT_256_MAX) throw new Error("bigNumberish is bigger than UINT_256_MAX");
16757
16722
  return bigInt;
16758
16723
  }
16759
16724
  /**
@@ -16864,10 +16829,8 @@ var starknet = (() => {
16864
16829
  */
16865
16830
  static validate(bigNumberish) {
16866
16831
  const bigInt = BigInt(bigNumberish);
16867
- if (bigInt < UINT_512_MIN)
16868
- throw Error("bigNumberish is smaller than UINT_512_MIN.");
16869
- if (bigInt > UINT_512_MAX)
16870
- throw Error("bigNumberish is bigger than UINT_512_MAX.");
16832
+ if (bigInt < UINT_512_MIN) throw Error("bigNumberish is smaller than UINT_512_MIN.");
16833
+ if (bigInt > UINT_512_MAX) throw Error("bigNumberish is bigger than UINT_512_MAX.");
16871
16834
  return bigInt;
16872
16835
  }
16873
16836
  /**
@@ -17304,10 +17267,8 @@ var starknet = (() => {
17304
17267
  throw Error(`Unsupported ABI version ${version}`);
17305
17268
  }
17306
17269
  function getAbiVersion(abi) {
17307
- if (abi.find((it) => it.type === "interface"))
17308
- return 2;
17309
- if (isCairo1Abi(abi))
17310
- return 1;
17270
+ if (abi.find((it) => it.type === "interface")) return 2;
17271
+ if (isCairo1Abi(abi)) return 1;
17311
17272
  return 0;
17312
17273
  }
17313
17274
  function isNoConstructorValid(method, argsCalldata, abiMethod) {
@@ -17321,8 +17282,7 @@ var starknet = (() => {
17321
17282
  return { name, type };
17322
17283
  }
17323
17284
  function parseSubTuple(s) {
17324
- if (!s.includes("("))
17325
- return { subTuple: [], result: s };
17285
+ if (!s.includes("(")) return { subTuple: [], result: s };
17326
17286
  const subTuple = [];
17327
17287
  let result = "";
17328
17288
  let i = 0;
@@ -17332,10 +17292,8 @@ var starknet = (() => {
17332
17292
  const lBracket = i;
17333
17293
  i++;
17334
17294
  while (counter) {
17335
- if (s[i] === ")")
17336
- counter--;
17337
- if (s[i] === "(")
17338
- counter++;
17295
+ if (s[i] === ")") counter--;
17296
+ if (s[i] === "(") counter++;
17339
17297
  i++;
17340
17298
  }
17341
17299
  subTuple.push(s.substring(lBracket, i));
@@ -17642,8 +17600,7 @@ var starknet = (() => {
17642
17600
  }
17643
17601
  if (type === "core::starknet::eth_address::EthAddress")
17644
17602
  return parseBaseTypes(type, element);
17645
- if (type === "core::byte_array::ByteArray")
17646
- return parseByteArray(element);
17603
+ if (type === "core::byte_array::ByteArray") return parseByteArray(element);
17647
17604
  const { members } = structs[type];
17648
17605
  const subElement = element;
17649
17606
  return members.reduce((acc, it) => {
@@ -17963,8 +17920,7 @@ var starknet = (() => {
17963
17920
  isString(parameter) || isNumber(parameter) || isBigInt(parameter),
17964
17921
  `Validate: arg ${input.name} should be a felt typed as (String, Number or BigInt)`
17965
17922
  );
17966
- if (isString(parameter) && !isHex(parameter))
17967
- return;
17923
+ if (isString(parameter) && !isHex(parameter)) return;
17968
17924
  const param = BigInt(parameter.toString(10));
17969
17925
  assert(
17970
17926
  // from : https://github.com/starkware-libs/starknet-specs/blob/29bab650be6b1847c92d4461d4c33008b5e50b1a/api/starknet_api_openrpc.json#L1266
@@ -18270,8 +18226,7 @@ var starknet = (() => {
18270
18226
  validate(type, method, args = []) {
18271
18227
  if (type !== "DEPLOY" /* DEPLOY */) {
18272
18228
  const invocableFunctionNames = this.abi.filter((abi) => {
18273
- if (abi.type !== "function")
18274
- return false;
18229
+ if (abi.type !== "function") return false;
18275
18230
  const isView = abi.stateMutability === "view" || abi.state_mutability === "view";
18276
18231
  return type === "INVOKE" /* INVOKE */ ? !isView : isView;
18277
18232
  }).map((abi) => abi.name);
@@ -18349,13 +18304,10 @@ var starknet = (() => {
18349
18304
  const oe = Array.isArray(o) ? [o.length.toString(), ...o] : o;
18350
18305
  return Object.entries(oe).flatMap(([k, v]) => {
18351
18306
  let value = v;
18352
- if (k === "entrypoint")
18353
- value = getSelectorFromName(value);
18354
- else if (isLongText(value))
18355
- value = byteArrayFromString(value);
18307
+ if (k === "entrypoint") value = getSelectorFromName(value);
18308
+ else if (isLongText(value)) value = byteArrayFromString(value);
18356
18309
  const kk = Array.isArray(oe) && k === "0" ? "$$len" : k;
18357
- if (isBigInt(value))
18358
- return [[`${prefix}${kk}`, felt(value)]];
18310
+ if (isBigInt(value)) return [[`${prefix}${kk}`, felt(value)]];
18359
18311
  if (Object(value) === value) {
18360
18312
  const methodsKeys = Object.getOwnPropertyNames(Object.getPrototypeOf(value));
18361
18313
  const keys = [...Object.getOwnPropertyNames(value), ...methodsKeys];
@@ -20735,8 +20687,7 @@ var starknet = (() => {
20735
20687
 
20736
20688
  // src/utils/json.ts
20737
20689
  var parseIntAsNumberOrBigInt = (str) => {
20738
- if (!isInteger(str))
20739
- return parseFloat(str);
20690
+ if (!isInteger(str)) return parseFloat(str);
20740
20691
  const num = parseInt(str, 10);
20741
20692
  return Number.isSafeInteger(num) ? num : BigInt(str);
20742
20693
  };
@@ -23052,10 +23003,8 @@ var starknet = (() => {
23052
23003
  if (this.ended) {
23053
23004
  return false;
23054
23005
  }
23055
- if (flush_mode === ~~flush_mode)
23056
- _flush_mode = flush_mode;
23057
- else
23058
- _flush_mode = flush_mode === true ? Z_FINISH$2 : Z_NO_FLUSH$1;
23006
+ if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;
23007
+ else _flush_mode = flush_mode === true ? Z_FINISH$2 : Z_NO_FLUSH$1;
23059
23008
  if (typeof data === "string") {
23060
23009
  strm.input = strings.string2buf(data);
23061
23010
  } else if (toString$1.call(data) === "[object ArrayBuffer]") {
@@ -23095,8 +23044,7 @@ var starknet = (() => {
23095
23044
  strm.avail_out = 0;
23096
23045
  continue;
23097
23046
  }
23098
- if (strm.avail_in === 0)
23099
- break;
23047
+ if (strm.avail_in === 0) break;
23100
23048
  }
23101
23049
  return true;
23102
23050
  };
@@ -24804,8 +24752,7 @@ var starknet = (() => {
24804
24752
  state.hold = hold;
24805
24753
  state.bits = bits;
24806
24754
  if (state.wsize || _out !== strm.avail_out && state.mode < BAD && (state.mode < CHECK || flush !== Z_FINISH$1)) {
24807
- if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out))
24808
- ;
24755
+ if (updatewindow(strm, strm.output, strm.next_out, _out - strm.avail_out)) ;
24809
24756
  }
24810
24757
  _in -= strm.avail_in;
24811
24758
  _out -= strm.avail_out;
@@ -24907,7 +24854,7 @@ var starknet = (() => {
24907
24854
  this.done = false;
24908
24855
  }
24909
24856
  var gzheader = GZheader;
24910
- var toString2 = Object.prototype.toString;
24857
+ var toString = Object.prototype.toString;
24911
24858
  var {
24912
24859
  Z_NO_FLUSH,
24913
24860
  Z_FINISH,
@@ -24957,7 +24904,7 @@ var starknet = (() => {
24957
24904
  if (opt.dictionary) {
24958
24905
  if (typeof opt.dictionary === "string") {
24959
24906
  opt.dictionary = strings.string2buf(opt.dictionary);
24960
- } else if (toString2.call(opt.dictionary) === "[object ArrayBuffer]") {
24907
+ } else if (toString.call(opt.dictionary) === "[object ArrayBuffer]") {
24961
24908
  opt.dictionary = new Uint8Array(opt.dictionary);
24962
24909
  }
24963
24910
  if (opt.raw) {
@@ -24973,13 +24920,10 @@ var starknet = (() => {
24973
24920
  const chunkSize = this.options.chunkSize;
24974
24921
  const dictionary = this.options.dictionary;
24975
24922
  let status, _flush_mode, last_avail_out;
24976
- if (this.ended)
24977
- return false;
24978
- if (flush_mode === ~~flush_mode)
24979
- _flush_mode = flush_mode;
24980
- else
24981
- _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;
24982
- if (toString2.call(data) === "[object ArrayBuffer]") {
24923
+ if (this.ended) return false;
24924
+ if (flush_mode === ~~flush_mode) _flush_mode = flush_mode;
24925
+ else _flush_mode = flush_mode === true ? Z_FINISH : Z_NO_FLUSH;
24926
+ if (toString.call(data) === "[object ArrayBuffer]") {
24983
24927
  strm.input = new Uint8Array(data);
24984
24928
  } else {
24985
24929
  strm.input = data;
@@ -25023,24 +24967,21 @@ var starknet = (() => {
25023
24967
  let utf8str = strings.buf2string(strm.output, next_out_utf8);
25024
24968
  strm.next_out = tail;
25025
24969
  strm.avail_out = chunkSize - tail;
25026
- if (tail)
25027
- strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);
24970
+ if (tail) strm.output.set(strm.output.subarray(next_out_utf8, next_out_utf8 + tail), 0);
25028
24971
  this.onData(utf8str);
25029
24972
  } else {
25030
24973
  this.onData(strm.output.length === strm.next_out ? strm.output : strm.output.subarray(0, strm.next_out));
25031
24974
  }
25032
24975
  }
25033
24976
  }
25034
- if (status === Z_OK && last_avail_out === 0)
25035
- continue;
24977
+ if (status === Z_OK && last_avail_out === 0) continue;
25036
24978
  if (status === Z_STREAM_END) {
25037
24979
  status = inflate_1$2.inflateEnd(this.strm);
25038
24980
  this.onEnd(status);
25039
24981
  this.ended = true;
25040
24982
  return true;
25041
24983
  }
25042
- if (strm.avail_in === 0)
25043
- break;
24984
+ if (strm.avail_in === 0) break;
25044
24985
  }
25045
24986
  return true;
25046
24987
  };
@@ -25062,8 +25003,7 @@ var starknet = (() => {
25062
25003
  function inflate$1(input, options) {
25063
25004
  const inflator = new Inflate$1(options);
25064
25005
  inflator.push(input);
25065
- if (inflator.err)
25066
- throw inflator.msg || messages[inflator.err];
25006
+ if (inflator.err) throw inflator.msg || messages[inflator.err];
25067
25007
  return inflator.result;
25068
25008
  }
25069
25009
  function inflateRaw$1(input, options) {
@@ -25095,8 +25035,7 @@ var starknet = (() => {
25095
25035
  return btoaUniversal(compressedProgram);
25096
25036
  }
25097
25037
  function decompressProgram(base642) {
25098
- if (Array.isArray(base642))
25099
- return base642;
25038
+ if (Array.isArray(base642)) return base642;
25100
25039
  const decompressed = arrayBufferToString(ungzip_1(atobUniversal(base642)));
25101
25040
  return parse2(decompressed);
25102
25041
  }
@@ -25108,8 +25047,7 @@ var starknet = (() => {
25108
25047
  return addHexPrefix(input).toLowerCase();
25109
25048
  }
25110
25049
  function formatSignature(sig) {
25111
- if (!sig)
25112
- throw Error("formatSignature: provided signature is undefined");
25050
+ if (!sig) throw Error("formatSignature: provided signature is undefined");
25113
25051
  if (Array.isArray(sig)) {
25114
25052
  return sig.map((it) => toHex(it));
25115
25053
  }
@@ -25147,10 +25085,8 @@ var starknet = (() => {
25147
25085
  };
25148
25086
  }
25149
25087
  function intDAM(dam) {
25150
- if (dam === EDataAvailabilityMode2.L1)
25151
- return EDAMode2.L1;
25152
- if (dam === EDataAvailabilityMode2.L2)
25153
- return EDAMode2.L2;
25088
+ if (dam === EDataAvailabilityMode2.L1) return EDAMode2.L1;
25089
+ if (dam === EDataAvailabilityMode2.L2) return EDAMode2.L2;
25154
25090
  throw Error("EDAM conversion");
25155
25091
  }
25156
25092
  function toTransactionVersion(defaultVersion, providedVersion) {
@@ -25165,17 +25101,12 @@ var starknet = (() => {
25165
25101
  return providedVersion ? providedVersion0xs : defaultVersion0xs;
25166
25102
  }
25167
25103
  function toFeeVersion(providedVersion) {
25168
- if (!providedVersion)
25169
- return void 0;
25104
+ if (!providedVersion) return void 0;
25170
25105
  const version = toHex(providedVersion);
25171
- if (version === ETransactionVersion4.V0)
25172
- return ETransactionVersion4.F0;
25173
- if (version === ETransactionVersion4.V1)
25174
- return ETransactionVersion4.F1;
25175
- if (version === ETransactionVersion4.V2)
25176
- return ETransactionVersion4.F2;
25177
- if (version === ETransactionVersion4.V3)
25178
- return ETransactionVersion4.F3;
25106
+ if (version === ETransactionVersion4.V0) return ETransactionVersion4.F0;
25107
+ if (version === ETransactionVersion4.V1) return ETransactionVersion4.F1;
25108
+ if (version === ETransactionVersion4.V2) return ETransactionVersion4.F2;
25109
+ if (version === ETransactionVersion4.V3) return ETransactionVersion4.F3;
25179
25110
  throw Error(`toFeeVersion: ${version} is not supported`);
25180
25111
  }
25181
25112
  function v3Details(details) {
@@ -25189,10 +25120,8 @@ var starknet = (() => {
25189
25120
  };
25190
25121
  }
25191
25122
  function reduceV2(providedVersion) {
25192
- if (providedVersion === ETransactionVersion4.F2)
25193
- return ETransactionVersion4.F1;
25194
- if (providedVersion === ETransactionVersion4.V2)
25195
- return ETransactionVersion4.V1;
25123
+ if (providedVersion === ETransactionVersion4.F2) return ETransactionVersion4.F1;
25124
+ if (providedVersion === ETransactionVersion4.V2) return ETransactionVersion4.V1;
25196
25125
  return providedVersion;
25197
25126
  }
25198
25127
 
@@ -26252,10 +26181,8 @@ var starknet = (() => {
26252
26181
  } = simulateTransactionOptions;
26253
26182
  const block_id = new Block(blockIdentifier).identifier;
26254
26183
  const simulationFlags = [];
26255
- if (skipValidate)
26256
- simulationFlags.push(rpcspec_0_6_exports.ESimulationFlag.SKIP_VALIDATE);
26257
- if (skipFeeCharge)
26258
- simulationFlags.push(rpcspec_0_6_exports.ESimulationFlag.SKIP_FEE_CHARGE);
26184
+ if (skipValidate) simulationFlags.push(rpcspec_0_6_exports.ESimulationFlag.SKIP_VALIDATE);
26185
+ if (skipFeeCharge) simulationFlags.push(rpcspec_0_6_exports.ESimulationFlag.SKIP_FEE_CHARGE);
26259
26186
  return this.fetchEndpoint("starknet_simulateTransactions", {
26260
26187
  block_id,
26261
26188
  transactions: invocations.map((it) => this.buildTransaction(it)),
@@ -26804,10 +26731,8 @@ var starknet = (() => {
26804
26731
  } = simulateTransactionOptions;
26805
26732
  const block_id = new Block(blockIdentifier).identifier;
26806
26733
  const simulationFlags = [];
26807
- if (skipValidate)
26808
- simulationFlags.push(esm_exports.ESimulationFlag.SKIP_VALIDATE);
26809
- if (skipFeeCharge)
26810
- simulationFlags.push(esm_exports.ESimulationFlag.SKIP_FEE_CHARGE);
26734
+ if (skipValidate) simulationFlags.push(esm_exports.ESimulationFlag.SKIP_VALIDATE);
26735
+ if (skipFeeCharge) simulationFlags.push(esm_exports.ESimulationFlag.SKIP_FEE_CHARGE);
26811
26736
  return this.fetchEndpoint("starknet_simulateTransactions", {
26812
26737
  block_id,
26813
26738
  transactions: invocations.map((it) => this.buildTransaction(it)),
@@ -27352,12 +27277,10 @@ var starknet = (() => {
27352
27277
  * ```
27353
27278
  */
27354
27279
  async waitForBlock(blockIdentifier = "pending", retryInterval = 5e3) {
27355
- if (blockIdentifier === "latest" /* LATEST */)
27356
- return;
27280
+ if (blockIdentifier === "latest" /* LATEST */) return;
27357
27281
  const currentBlock = await this.getBlockNumber();
27358
27282
  const targetBlock = blockIdentifier === "pending" /* PENDING */ ? currentBlock + 1 : Number(toHex(blockIdentifier));
27359
- if (targetBlock <= currentBlock)
27360
- return;
27283
+ if (targetBlock <= currentBlock) return;
27361
27284
  const { retries } = this.channel;
27362
27285
  let retriesCount = retries;
27363
27286
  let isTargetBlock = false;
@@ -27852,17 +27775,14 @@ var starknet = (() => {
27852
27775
  if (nextSubdomain === ZERO) {
27853
27776
  const code2 = subdomain % bigAlphabetSizePlusOne;
27854
27777
  subdomain = nextSubdomain;
27855
- if (code2 === ZERO)
27856
- decoded += basicAlphabet[0];
27857
- else
27858
- decoded += bigAlphabet[Number(code2) - 1];
27778
+ if (code2 === ZERO) decoded += basicAlphabet[0];
27779
+ else decoded += bigAlphabet[Number(code2) - 1];
27859
27780
  } else {
27860
27781
  const code2 = subdomain % bigAlphabetSize;
27861
27782
  decoded += bigAlphabet[Number(code2)];
27862
27783
  subdomain /= bigAlphabetSize;
27863
27784
  }
27864
- } else
27865
- decoded += basicAlphabet[Number(code)];
27785
+ } else decoded += basicAlphabet[Number(code)];
27866
27786
  }
27867
27787
  const [str, k] = extractStars(decoded);
27868
27788
  if (k)
@@ -27882,8 +27802,7 @@ var starknet = (() => {
27882
27802
  decoded = str + bigAlphabet[bigAlphabet.length - 1].repeat(2 * (k + 1));
27883
27803
  } else {
27884
27804
  const [str, k] = extractStars(decoded);
27885
- if (k)
27886
- decoded = str + bigAlphabet[bigAlphabet.length - 1].repeat(1 + 2 * (k - 1));
27805
+ if (k) decoded = str + bigAlphabet[bigAlphabet.length - 1].repeat(1 + 2 * (k - 1));
27887
27806
  }
27888
27807
  for (let i = 0; i < decoded.length; i += 1) {
27889
27808
  const char = decoded[i];
@@ -28538,8 +28457,7 @@ var starknet = (() => {
28538
28457
  const variantType = enumType.find((t) => t.name === variantKey);
28539
28458
  const variantIndex = enumType.indexOf(variantType);
28540
28459
  const encodedSubtypes = variantType.type.slice(1, -1).split(",").map((subtype, index) => {
28541
- if (!subtype)
28542
- return subtype;
28460
+ if (!subtype) return subtype;
28543
28461
  const subtypeData = variantData[index];
28544
28462
  return encodeValue(types, subtype, subtypeData, void 0, revision)[1];
28545
28463
  });
@@ -28927,19 +28845,16 @@ var starknet = (() => {
28927
28845
  const findName = (variant) => variant.type === name;
28928
28846
  while (true) {
28929
28847
  const eventEnum = abiEventsEnums.find((eventE) => eventE.variants.some(findName));
28930
- if (typeof eventEnum === "undefined")
28931
- break;
28848
+ if (typeof eventEnum === "undefined") break;
28932
28849
  const variant = eventEnum.variants.find(findName);
28933
28850
  nameList.unshift(variant.name);
28934
- if (variant.kind === "flat")
28935
- flat = true;
28851
+ if (variant.kind === "flat") flat = true;
28936
28852
  name = eventEnum.name;
28937
28853
  }
28938
28854
  if (nameList.length === 0) {
28939
28855
  throw new Error("inconsistency in ABI events definition.");
28940
28856
  }
28941
- if (flat)
28942
- nameList = [nameList[nameList.length - 1]];
28857
+ if (flat) nameList = [nameList[nameList.length - 1]];
28943
28858
  const final = nameList.pop();
28944
28859
  let result = {
28945
28860
  [addHexPrefix(esm_exports2.keccak(utf8ToArray(final)).toString(16))]: event
@@ -28965,10 +28880,8 @@ var starknet = (() => {
28965
28880
  if (isObject2(target) && isObject2(source)) {
28966
28881
  Object.keys(source).forEach((key) => {
28967
28882
  if (isObject2(source[key])) {
28968
- if (!(key in target))
28969
- Object.assign(output3, { [key]: source[key] });
28970
- else
28971
- output3[key] = mergeAbiEvents(target[key], source[key]);
28883
+ if (!(key in target)) Object.assign(output3, { [key]: source[key] });
28884
+ else output3[key] = mergeAbiEvents(target[key], source[key]);
28972
28885
  } else {
28973
28886
  Object.assign(output3, { [key]: source[key] });
28974
28887
  }
@@ -29055,10 +28968,8 @@ var starknet = (() => {
29055
28968
  }
29056
28969
  // provided version or contract based preferred transactionVersion
29057
28970
  getPreferredVersion(type12, type3) {
29058
- if (this.transactionVersion === ETransactionVersion4.V3)
29059
- return type3;
29060
- if (this.transactionVersion === ETransactionVersion4.V2)
29061
- return type12;
28971
+ if (this.transactionVersion === ETransactionVersion4.V3) return type3;
28972
+ if (this.transactionVersion === ETransactionVersion4.V2) return type12;
29062
28973
  return ETransactionVersion4.V3;
29063
28974
  }
29064
28975
  async getNonce(blockIdentifier) {
@@ -29764,13 +29675,11 @@ var starknet = (() => {
29764
29675
  super(providerOrOptions, "", "", cairoVersion);
29765
29676
  this.walletProvider = walletProvider;
29766
29677
  this.walletProvider.on("accountsChanged", (res) => {
29767
- if (!res)
29768
- return;
29678
+ if (!res) return;
29769
29679
  this.address = res[0].toLowerCase();
29770
29680
  });
29771
29681
  this.walletProvider.on("networkChanged", (res) => {
29772
- if (!res)
29773
- return;
29682
+ if (!res) return;
29774
29683
  this.channel.setChainId(res);
29775
29684
  });
29776
29685
  walletProvider.request({
@@ -29910,8 +29819,7 @@ var starknet = (() => {
29910
29819
  };
29911
29820
  }
29912
29821
  function getCalldata(args, callback) {
29913
- if (Array.isArray(args) && "__compiled__" in args)
29914
- return args;
29822
+ if (Array.isArray(args) && "__compiled__" in args) return args;
29915
29823
  if (Array.isArray(args) && Array.isArray(args[0]) && "__compiled__" in args[0])
29916
29824
  return args[0];
29917
29825
  return callback();
@@ -29951,8 +29859,7 @@ var starknet = (() => {
29951
29859
  estimateFee: { enumerable: true, value: {}, writable: false }
29952
29860
  });
29953
29861
  this.abi.forEach((abiElement) => {
29954
- if (abiElement.type !== "function")
29955
- return;
29862
+ if (abiElement.type !== "function") return;
29956
29863
  const signature = abiElement.name;
29957
29864
  if (!this[signature]) {
29958
29865
  Object.defineProperty(this, signature, {
@@ -30052,8 +29959,7 @@ var starknet = (() => {
30052
29959
  nonce
30053
29960
  });
30054
29961
  }
30055
- if (!nonce)
30056
- throw new Error(`Nonce is required when invoking a function without an account`);
29962
+ if (!nonce) throw new Error(`Nonce is required when invoking a function without an account`);
30057
29963
  console.warn(`Invoking ${method} without an account. This will not work on a public node.`);
30058
29964
  return this.providerOrAccount.invokeFunction(
30059
29965
  {