starknet 5.24.5 → 5.25.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [5.25.0](https://github.com/starknet-io/starknet.js/compare/v5.24.5...v5.25.0) (2023-12-18)
2
+
3
+ ### Features
4
+
5
+ - sepolia ([26d7044](https://github.com/starknet-io/starknet.js/commit/26d70446edd7c098b7f257d9242cc9d9d220b11e))
6
+
1
7
  ## [5.24.5](https://github.com/starknet-io/starknet.js/compare/v5.24.4...v5.24.5) (2023-12-10)
2
8
 
3
9
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -133,15 +133,18 @@ declare const MAX_STORAGE_ITEM_SIZE = 256n;
133
133
  declare const ADDR_BOUND: bigint;
134
134
  declare enum BaseUrl {
135
135
  SN_MAIN = "https://alpha-mainnet.starknet.io",
136
- SN_GOERLI = "https://alpha4.starknet.io"
136
+ SN_GOERLI = "https://alpha4.starknet.io",
137
+ SN_SEPOLIA = "https://alpha-sepolia.starknet.io"
137
138
  }
138
139
  declare enum NetworkName {
139
140
  SN_MAIN = "SN_MAIN",
140
- SN_GOERLI = "SN_GOERLI"
141
+ SN_GOERLI = "SN_GOERLI",
142
+ SN_SEPOLIA = "SN_SEPOLIA"
141
143
  }
142
144
  declare enum StarknetChainId {
143
145
  SN_MAIN = "0x534e5f4d41494e",
144
- SN_GOERLI = "0x534e5f474f45524c49"
146
+ SN_GOERLI = "0x534e5f474f45524c49",
147
+ SN_SEPOLIA = "0x534e5f5345504f4c4941"
145
148
  }
146
149
  declare enum TransactionHashPrefix {
147
150
  DECLARE = "0x6465636c617265",
@@ -154,8 +157,12 @@ declare const UDC: {
154
157
  ADDRESS: string;
155
158
  ENTRYPOINT: string;
156
159
  };
157
- declare const RPC_GOERLI_NODES: string[];
158
- declare const RPC_MAINNET_NODES: string[];
160
+ declare const RPC_DEFAULT_VERSION = "v0_5";
161
+ declare const RPC_NODES: {
162
+ SN_GOERLI: string[];
163
+ SN_MAIN: string[];
164
+ SN_SEPOLIA: string[];
165
+ };
159
166
 
160
167
  declare const constants_ADDR_BOUND: typeof ADDR_BOUND;
161
168
  declare const constants_API_VERSION: typeof API_VERSION;
@@ -172,8 +179,8 @@ declare const constants_MASK_250: typeof MASK_250;
172
179
  declare const constants_MAX_STORAGE_ITEM_SIZE: typeof MAX_STORAGE_ITEM_SIZE;
173
180
  type constants_NetworkName = NetworkName;
174
181
  declare const constants_NetworkName: typeof NetworkName;
175
- declare const constants_RPC_GOERLI_NODES: typeof RPC_GOERLI_NODES;
176
- declare const constants_RPC_MAINNET_NODES: typeof RPC_MAINNET_NODES;
182
+ declare const constants_RPC_DEFAULT_VERSION: typeof RPC_DEFAULT_VERSION;
183
+ declare const constants_RPC_NODES: typeof RPC_NODES;
177
184
  type constants_StarknetChainId = StarknetChainId;
178
185
  declare const constants_StarknetChainId: typeof StarknetChainId;
179
186
  declare const constants_TEXT_TO_FELT_MAX_LEN: typeof TEXT_TO_FELT_MAX_LEN;
@@ -196,8 +203,8 @@ declare namespace constants {
196
203
  constants_MASK_250 as MASK_250,
197
204
  constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE,
198
205
  constants_NetworkName as NetworkName,
199
- constants_RPC_GOERLI_NODES as RPC_GOERLI_NODES,
200
- constants_RPC_MAINNET_NODES as RPC_MAINNET_NODES,
206
+ constants_RPC_DEFAULT_VERSION as RPC_DEFAULT_VERSION,
207
+ constants_RPC_NODES as RPC_NODES,
201
208
  constants_StarknetChainId as StarknetChainId,
202
209
  constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN,
203
210
  constants_TransactionHashPrefix as TransactionHashPrefix,
@@ -713,6 +720,7 @@ type RpcProviderOptions = {
713
720
  blockIdentifier?: BlockIdentifier;
714
721
  chainId?: StarknetChainId;
715
722
  default?: boolean;
723
+ rpcVersion?: 'v0_5' | 'v0_6';
716
724
  };
717
725
  type SequencerHttpMethod = 'POST' | 'GET';
718
726
  type SequencerProviderOptions = {
@@ -3586,7 +3594,7 @@ declare class SequencerProvider implements ProviderInterface {
3586
3594
  private chainId;
3587
3595
  private responseParser;
3588
3596
  constructor(optionsOrProvider?: SequencerProviderOptions);
3589
- protected static getNetworkFromName(name: NetworkName | StarknetChainId): BaseUrl;
3597
+ protected static getNetworkFromName(name: NetworkName | StarknetChainId): BaseUrl.SN_MAIN | BaseUrl.SN_GOERLI;
3590
3598
  protected static getChainIdFromBaseUrl(baseUrl: string): StarknetChainId;
3591
3599
  private getFetchUrl;
3592
3600
  private getFetchMethod;
@@ -3662,7 +3670,13 @@ declare class SequencerProvider implements ProviderInterface {
3662
3670
  buildTransaction(invocation: AccountInvocationItem, versionType?: 'fee' | 'transaction'): AccountTransactionItem;
3663
3671
  }
3664
3672
 
3665
- declare const getDefaultNodeUrl: (networkName?: NetworkName, mute?: boolean) => string;
3673
+ /**
3674
+ * Return randomly select available public node
3675
+ * @param networkName NetworkName
3676
+ * @param mute mute public node warning
3677
+ * @returns default node url
3678
+ */
3679
+ declare const getDefaultNodeUrl: (networkName?: NetworkName, mute?: boolean, version?: 'v0_5' | 'v0_6') => string;
3666
3680
  declare class RpcProvider implements ProviderInterface {
3667
3681
  nodeUrl: string;
3668
3682
  headers: object;
@@ -362,7 +362,7 @@ var starknet = (() => {
362
362
  statusText: xhr.statusText,
363
363
  headers: parseHeaders(xhr.getAllResponseHeaders() || "")
364
364
  };
365
- if (request.url.startsWith("file://") && (xhr.status < 200 || xhr.status > 599)) {
365
+ if (request.url.indexOf("file://") === 0 && (xhr.status < 200 || xhr.status > 599)) {
366
366
  options.status = 200;
367
367
  } else {
368
368
  options.status = xhr.status;
@@ -536,6 +536,7 @@ var starknet = (() => {
536
536
  };
537
537
  Response.error = function() {
538
538
  var response = new Response(null, { status: 200, statusText: "" });
539
+ response.ok = false;
539
540
  response.status = 0;
540
541
  response.type = "error";
541
542
  return response;
@@ -733,8 +734,8 @@ var starknet = (() => {
733
734
  MASK_250: () => MASK_250,
734
735
  MAX_STORAGE_ITEM_SIZE: () => MAX_STORAGE_ITEM_SIZE,
735
736
  NetworkName: () => NetworkName,
736
- RPC_GOERLI_NODES: () => RPC_GOERLI_NODES,
737
- RPC_MAINNET_NODES: () => RPC_MAINNET_NODES,
737
+ RPC_DEFAULT_VERSION: () => RPC_DEFAULT_VERSION,
738
+ RPC_NODES: () => RPC_NODES,
738
739
  StarknetChainId: () => StarknetChainId,
739
740
  TEXT_TO_FELT_MAX_LEN: () => TEXT_TO_FELT_MAX_LEN,
740
741
  TransactionHashPrefix: () => TransactionHashPrefix,
@@ -766,10 +767,14 @@ var starknet = (() => {
766
767
  if (!Number.isSafeInteger(n))
767
768
  throw new Error(`Wrong integer: ${n}`);
768
769
  }
770
+ function isBytes(a) {
771
+ return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
772
+ }
769
773
  function chain(...args) {
774
+ const id = (a) => a;
770
775
  const wrap = (a, b) => (c) => a(b(c));
771
- const encode = Array.from(args).reverse().reduce((acc, i) => acc ? wrap(acc, i.encode) : i.encode, void 0);
772
- const decode2 = args.reduce((acc, i) => acc ? wrap(acc, i.decode) : i.decode, void 0);
776
+ const encode = args.map((x) => x.encode).reduceRight(wrap, id);
777
+ const decode2 = args.map((x) => x.decode).reduce(wrap, id);
773
778
  return { encode, decode: decode2 };
774
779
  }
775
780
  function alphabet(alphabet2) {
@@ -905,13 +910,13 @@ var starknet = (() => {
905
910
  throw new Error("radix2: carry overflow");
906
911
  return {
907
912
  encode: (bytes2) => {
908
- if (!(bytes2 instanceof Uint8Array))
913
+ if (!isBytes(bytes2))
909
914
  throw new Error("radix2.encode input should be Uint8Array");
910
915
  return convertRadix2(Array.from(bytes2), 8, bits, !revPadding);
911
916
  },
912
917
  decode: (digits) => {
913
918
  if (!Array.isArray(digits) || digits.length && typeof digits[0] !== "number")
914
- throw new Error("radix2.decode input should be array of strings");
919
+ throw new Error("radix2.decode input should be array of numbers");
915
920
  return Uint8Array.from(convertRadix2(digits, bits, 8, revPadding));
916
921
  }
917
922
  };
@@ -1003,16 +1008,19 @@ var starknet = (() => {
1003
1008
  var BaseUrl = /* @__PURE__ */ ((BaseUrl2) => {
1004
1009
  BaseUrl2["SN_MAIN"] = "https://alpha-mainnet.starknet.io";
1005
1010
  BaseUrl2["SN_GOERLI"] = "https://alpha4.starknet.io";
1011
+ BaseUrl2["SN_SEPOLIA"] = "https://alpha-sepolia.starknet.io";
1006
1012
  return BaseUrl2;
1007
1013
  })(BaseUrl || {});
1008
1014
  var NetworkName = /* @__PURE__ */ ((NetworkName2) => {
1009
1015
  NetworkName2["SN_MAIN"] = "SN_MAIN";
1010
1016
  NetworkName2["SN_GOERLI"] = "SN_GOERLI";
1017
+ NetworkName2["SN_SEPOLIA"] = "SN_SEPOLIA";
1011
1018
  return NetworkName2;
1012
1019
  })(NetworkName || {});
1013
1020
  var StarknetChainId = /* @__PURE__ */ ((StarknetChainId4) => {
1014
1021
  StarknetChainId4["SN_MAIN"] = "0x534e5f4d41494e";
1015
1022
  StarknetChainId4["SN_GOERLI"] = "0x534e5f474f45524c49";
1023
+ StarknetChainId4["SN_SEPOLIA"] = "0x534e5f5345504f4c4941";
1016
1024
  return StarknetChainId4;
1017
1025
  })(StarknetChainId || {});
1018
1026
  var TransactionHashPrefix = /* @__PURE__ */ ((TransactionHashPrefix2) => {
@@ -1027,14 +1035,21 @@ var starknet = (() => {
1027
1035
  ADDRESS: "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",
1028
1036
  ENTRYPOINT: "deployContract"
1029
1037
  };
1030
- var RPC_GOERLI_NODES = [
1031
- "https://starknet-testnet.public.blastapi.io/rpc/v0.5",
1032
- "https://limited-rpc.nethermind.io/goerli-juno/v0_5"
1033
- ];
1034
- var RPC_MAINNET_NODES = [
1035
- "https://starknet-mainnet.public.blastapi.io/rpc/v0.5",
1036
- "https://limited-rpc.nethermind.io/mainnet-juno/v0_5"
1037
- ];
1038
+ var RPC_DEFAULT_VERSION = "v0_5";
1039
+ var RPC_NODES = {
1040
+ SN_GOERLI: [
1041
+ `https://starknet-testnet.public.blastapi.io/rpc/`,
1042
+ `https://free-rpc.nethermind.io/goerli-juno/`
1043
+ ],
1044
+ SN_MAIN: [
1045
+ `https://starknet-mainnet.public.blastapi.io/rpc/`,
1046
+ `https://free-rpc.nethermind.io/mainnet-juno/`
1047
+ ],
1048
+ SN_SEPOLIA: [
1049
+ `https://starknet-sepolia.public.blastapi.io/rpc/`,
1050
+ `https://free-rpc.nethermind.io/sepolia-juno/`
1051
+ ]
1052
+ };
1038
1053
 
1039
1054
  // src/types/index.ts
1040
1055
  var types_exports = {};
@@ -1248,6 +1263,7 @@ var starknet = (() => {
1248
1263
  equalBytes: () => equalBytes,
1249
1264
  hexToBytes: () => hexToBytes,
1250
1265
  hexToNumber: () => hexToNumber,
1266
+ isBytes: () => isBytes2,
1251
1267
  numberToBytesBE: () => numberToBytesBE,
1252
1268
  numberToBytesLE: () => numberToBytesLE,
1253
1269
  numberToHexUnpadded: () => numberToHexUnpadded,
@@ -1258,10 +1274,12 @@ var starknet = (() => {
1258
1274
  var _0n = BigInt(0);
1259
1275
  var _1n = BigInt(1);
1260
1276
  var _2n = BigInt(2);
1261
- var u8a = (a) => a instanceof Uint8Array;
1277
+ function isBytes2(a) {
1278
+ return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
1279
+ }
1262
1280
  var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
1263
1281
  function bytesToHex(bytes2) {
1264
- if (!u8a(bytes2))
1282
+ if (!isBytes2(bytes2))
1265
1283
  throw new Error("Uint8Array expected");
1266
1284
  let hex2 = "";
1267
1285
  for (let i = 0; i < bytes2.length; i++) {
@@ -1278,20 +1296,32 @@ var starknet = (() => {
1278
1296
  throw new Error("hex string expected, got " + typeof hex2);
1279
1297
  return BigInt(hex2 === "" ? "0" : `0x${hex2}`);
1280
1298
  }
1299
+ var asciis = { _0: 48, _9: 57, _A: 65, _F: 70, _a: 97, _f: 102 };
1300
+ function asciiToBase16(char) {
1301
+ if (char >= asciis._0 && char <= asciis._9)
1302
+ return char - asciis._0;
1303
+ if (char >= asciis._A && char <= asciis._F)
1304
+ return char - (asciis._A - 10);
1305
+ if (char >= asciis._a && char <= asciis._f)
1306
+ return char - (asciis._a - 10);
1307
+ return;
1308
+ }
1281
1309
  function hexToBytes(hex2) {
1282
1310
  if (typeof hex2 !== "string")
1283
1311
  throw new Error("hex string expected, got " + typeof hex2);
1284
- const len = hex2.length;
1285
- if (len % 2)
1286
- throw new Error("padded hex string expected, got unpadded hex of length " + len);
1287
- const array = new Uint8Array(len / 2);
1288
- for (let i = 0; i < array.length; i++) {
1289
- const j = i * 2;
1290
- const hexByte = hex2.slice(j, j + 2);
1291
- const byte = Number.parseInt(hexByte, 16);
1292
- if (Number.isNaN(byte) || byte < 0)
1293
- throw new Error("Invalid byte sequence");
1294
- array[i] = byte;
1312
+ const hl = hex2.length;
1313
+ const al = hl / 2;
1314
+ if (hl % 2)
1315
+ throw new Error("padded hex string expected, got unpadded hex of length " + hl);
1316
+ const array = new Uint8Array(al);
1317
+ for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
1318
+ const n1 = asciiToBase16(hex2.charCodeAt(hi));
1319
+ const n2 = asciiToBase16(hex2.charCodeAt(hi + 1));
1320
+ if (n1 === void 0 || n2 === void 0) {
1321
+ const char = hex2[hi] + hex2[hi + 1];
1322
+ throw new Error('hex string expected, got non-hex character "' + char + '" at index ' + hi);
1323
+ }
1324
+ array[ai] = n1 * 16 + n2;
1295
1325
  }
1296
1326
  return array;
1297
1327
  }
@@ -1299,7 +1329,7 @@ var starknet = (() => {
1299
1329
  return hexToNumber(bytesToHex(bytes2));
1300
1330
  }
1301
1331
  function bytesToNumberLE(bytes2) {
1302
- if (!u8a(bytes2))
1332
+ if (!isBytes2(bytes2))
1303
1333
  throw new Error("Uint8Array expected");
1304
1334
  return hexToNumber(bytesToHex(Uint8Array.from(bytes2).reverse()));
1305
1335
  }
@@ -1320,7 +1350,7 @@ var starknet = (() => {
1320
1350
  } catch (e) {
1321
1351
  throw new Error(`${title} must be valid hex string, got "${hex2}". Cause: ${e}`);
1322
1352
  }
1323
- } else if (u8a(hex2)) {
1353
+ } else if (isBytes2(hex2)) {
1324
1354
  res = Uint8Array.from(hex2);
1325
1355
  } else {
1326
1356
  throw new Error(`${title} must be hex string or Uint8Array`);
@@ -1331,23 +1361,29 @@ var starknet = (() => {
1331
1361
  return res;
1332
1362
  }
1333
1363
  function concatBytes(...arrays) {
1334
- const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
1335
- let pad = 0;
1336
- arrays.forEach((a) => {
1337
- if (!u8a(a))
1364
+ let sum = 0;
1365
+ for (let i = 0; i < arrays.length; i++) {
1366
+ const a = arrays[i];
1367
+ if (!isBytes2(a))
1338
1368
  throw new Error("Uint8Array expected");
1339
- r.set(a, pad);
1369
+ sum += a.length;
1370
+ }
1371
+ let res = new Uint8Array(sum);
1372
+ let pad = 0;
1373
+ for (let i = 0; i < arrays.length; i++) {
1374
+ const a = arrays[i];
1375
+ res.set(a, pad);
1340
1376
  pad += a.length;
1341
- });
1342
- return r;
1377
+ }
1378
+ return res;
1343
1379
  }
1344
- function equalBytes(b1, b2) {
1345
- if (b1.length !== b2.length)
1380
+ function equalBytes(a, b) {
1381
+ if (a.length !== b.length)
1346
1382
  return false;
1347
- for (let i = 0; i < b1.length; i++)
1348
- if (b1[i] !== b2[i])
1349
- return false;
1350
- return true;
1383
+ let diff = 0;
1384
+ for (let i = 0; i < a.length; i++)
1385
+ diff |= a[i] ^ b[i];
1386
+ return diff === 0;
1351
1387
  }
1352
1388
  function utf8ToBytes(str) {
1353
1389
  if (typeof str !== "string")
@@ -1422,7 +1458,7 @@ var starknet = (() => {
1422
1458
  function: (val) => typeof val === "function",
1423
1459
  boolean: (val) => typeof val === "boolean",
1424
1460
  string: (val) => typeof val === "string",
1425
- stringOrUint8Array: (val) => typeof val === "string" || val instanceof Uint8Array,
1461
+ stringOrUint8Array: (val) => typeof val === "string" || isBytes2(val),
1426
1462
  isSafeInteger: (val) => Number.isSafeInteger(val),
1427
1463
  array: (val) => Array.isArray(val),
1428
1464
  field: (val, object) => object.Fp.isValid(val),
@@ -1563,8 +1599,11 @@ var starknet = (() => {
1563
1599
  if (!Number.isSafeInteger(n) || n < 0)
1564
1600
  throw new Error(`Wrong positive integer: ${n}`);
1565
1601
  }
1602
+ function isBytes3(a) {
1603
+ return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
1604
+ }
1566
1605
  function bytes(b, ...lengths) {
1567
- if (!(b instanceof Uint8Array))
1606
+ if (!isBytes3(b))
1568
1607
  throw new Error("Expected Uint8Array");
1569
1608
  if (lengths.length > 0 && !lengths.includes(b.length))
1570
1609
  throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);
@@ -1615,8 +1654,10 @@ var starknet = (() => {
1615
1654
  var crypto = typeof globalThis === "object" && "crypto" in globalThis ? globalThis.crypto : void 0;
1616
1655
 
1617
1656
  // node_modules/@noble/hashes/esm/utils.js
1618
- var u8a2 = (a) => a instanceof Uint8Array;
1619
1657
  var u32 = (arr) => new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
1658
+ function isBytes4(a) {
1659
+ return a instanceof Uint8Array || a != null && typeof a === "object" && a.constructor.name === "Uint8Array";
1660
+ }
1620
1661
  var createView = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
1621
1662
  var rotr = (word, shift) => word << 32 - shift | word >>> shift;
1622
1663
  var isLE = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
@@ -1630,20 +1671,25 @@ var starknet = (() => {
1630
1671
  function toBytes(data) {
1631
1672
  if (typeof data === "string")
1632
1673
  data = utf8ToBytes2(data);
1633
- if (!u8a2(data))
1674
+ if (!isBytes4(data))
1634
1675
  throw new Error(`expected Uint8Array, got ${typeof data}`);
1635
1676
  return data;
1636
1677
  }
1637
1678
  function concatBytes2(...arrays) {
1638
- const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));
1639
- let pad = 0;
1640
- arrays.forEach((a) => {
1641
- if (!u8a2(a))
1679
+ let sum = 0;
1680
+ for (let i = 0; i < arrays.length; i++) {
1681
+ const a = arrays[i];
1682
+ if (!isBytes4(a))
1642
1683
  throw new Error("Uint8Array expected");
1643
- r.set(a, pad);
1684
+ sum += a.length;
1685
+ }
1686
+ const res = new Uint8Array(sum);
1687
+ for (let i = 0, pad = 0; i < arrays.length; i++) {
1688
+ const a = arrays[i];
1689
+ res.set(a, pad);
1644
1690
  pad += a.length;
1645
- });
1646
- return r;
1691
+ }
1692
+ return res;
1647
1693
  }
1648
1694
  var Hash = class {
1649
1695
  // Safe version that clones internal state
@@ -2649,7 +2695,7 @@ var starknet = (() => {
2649
2695
  toSig(hex2) {
2650
2696
  const { Err: E } = DER;
2651
2697
  const data = typeof hex2 === "string" ? h2b(hex2) : hex2;
2652
- if (!(data instanceof Uint8Array))
2698
+ if (!isBytes2(data))
2653
2699
  throw new Error("ui8a expected");
2654
2700
  let l = data.length;
2655
2701
  if (l < 2 || data[0] != 48)
@@ -2713,7 +2759,7 @@ var starknet = (() => {
2713
2759
  function normPrivateKeyToScalar(key) {
2714
2760
  const { allowedPrivateKeyLengths: lengths, nByteLength, wrapPrivateKey, n } = CURVE2;
2715
2761
  if (lengths && typeof key !== "bigint") {
2716
- if (key instanceof Uint8Array)
2762
+ if (isBytes2(key))
2717
2763
  key = bytesToHex(key);
2718
2764
  if (typeof key !== "string" || !lengths.includes(key.length))
2719
2765
  throw new Error("Invalid key");
@@ -3248,7 +3294,7 @@ var starknet = (() => {
3248
3294
  return Point.fromPrivateKey(privateKey).toRawBytes(isCompressed);
3249
3295
  }
3250
3296
  function isProbPub(item) {
3251
- const arr = item instanceof Uint8Array;
3297
+ const arr = isBytes2(item);
3252
3298
  const str = typeof item === "string";
3253
3299
  const len = (arr || str) && item.length;
3254
3300
  if (arr)
@@ -3343,7 +3389,7 @@ var starknet = (() => {
3343
3389
  let _sig = void 0;
3344
3390
  let P;
3345
3391
  try {
3346
- if (typeof sg === "string" || sg instanceof Uint8Array) {
3392
+ if (typeof sg === "string" || isBytes2(sg)) {
3347
3393
  try {
3348
3394
  _sig = Signature3.fromDER(sg);
3349
3395
  } catch (derError) {
@@ -10800,12 +10846,12 @@ var starknet = (() => {
10800
10846
  };
10801
10847
 
10802
10848
  // src/provider/rpc.ts
10803
- var getDefaultNodeUrl = (networkName, mute = false) => {
10849
+ var getDefaultNodeUrl = (networkName, mute = false, version = RPC_DEFAULT_VERSION) => {
10804
10850
  if (!mute)
10805
10851
  console.warn("Using default public node url, please provide nodeUrl in provider options!");
10806
- const nodes = networkName === "SN_MAIN" /* SN_MAIN */ ? RPC_MAINNET_NODES : RPC_GOERLI_NODES;
10852
+ const nodes = RPC_NODES[networkName ?? "SN_GOERLI" /* SN_GOERLI */];
10807
10853
  const randIdx = Math.floor(Math.random() * nodes.length);
10808
- return nodes[randIdx];
10854
+ return `${nodes[randIdx]}${version}`;
10809
10855
  };
10810
10856
  var defaultOptions = {
10811
10857
  headers: { "Content-Type": "application/json" },
@@ -10843,13 +10889,17 @@ var starknet = (() => {
10843
10889
  * @deprecated renamed to simulateTransaction();
10844
10890
  */
10845
10891
  this.getSimulateTransaction = this.simulateTransaction;
10846
- const { nodeUrl, retries, headers, blockIdentifier, chainId } = optionsOrProvider || {};
10892
+ const { nodeUrl, retries, headers, blockIdentifier, chainId, rpcVersion } = optionsOrProvider || {};
10847
10893
  if (Object.values(NetworkName).includes(nodeUrl)) {
10848
- this.nodeUrl = getDefaultNodeUrl(nodeUrl, optionsOrProvider?.default);
10894
+ this.nodeUrl = getDefaultNodeUrl(
10895
+ nodeUrl,
10896
+ optionsOrProvider?.default,
10897
+ rpcVersion
10898
+ );
10849
10899
  } else if (nodeUrl) {
10850
10900
  this.nodeUrl = nodeUrl;
10851
10901
  } else {
10852
- this.nodeUrl = getDefaultNodeUrl(void 0, optionsOrProvider?.default);
10902
+ this.nodeUrl = getDefaultNodeUrl(void 0, optionsOrProvider?.default, rpcVersion);
10853
10903
  }
10854
10904
  this.retries = retries || defaultOptions.retries;
10855
10905
  this.headers = { ...defaultOptions.headers, ...headers };