starknet 8.5.5 → 8.6.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/dist/index.js CHANGED
@@ -128,6 +128,7 @@ __export(index_exports, {
128
128
  addAddressPadding: () => addAddressPadding,
129
129
  byteArray: () => byteArray_exports,
130
130
  cairo: () => cairo_exports,
131
+ compareVersions: () => compareVersions,
131
132
  config: () => config,
132
133
  constants: () => constants_exports,
133
134
  contractClassResponseToLegacyCompiledContract: () => contractClassResponseToLegacyCompiledContract,
@@ -489,7 +490,8 @@ var DEFAULT_GLOBAL_CONFIG = {
489
490
  defaultTipType: "recommendedTip",
490
491
  fetch: void 0,
491
492
  websocket: void 0,
492
- buffer: void 0
493
+ buffer: void 0,
494
+ blake: void 0
493
495
  };
494
496
  var RPC_DEFAULT_NODES = {
495
497
  SN_MAIN: [`https://starknet-mainnet.public.blastapi.io/rpc/`],
@@ -4786,12 +4788,16 @@ var CallData = class _CallData {
4786
4788
  // src/utils/hash/index.ts
4787
4789
  var hash_exports = {};
4788
4790
  __export(hash_exports, {
4791
+ COMPILED_CLASS_VERSION: () => COMPILED_CLASS_VERSION,
4792
+ blake2sHashMany: () => blake2sHashMany,
4789
4793
  calculateContractAddressFromHash: () => calculateContractAddressFromHash,
4790
4794
  calculateDeclareTransactionHash: () => calculateDeclareTransactionHash3,
4791
4795
  calculateDeployAccountTransactionHash: () => calculateDeployAccountTransactionHash3,
4792
4796
  calculateInvokeTransactionHash: () => calculateInvokeTransactionHash2,
4793
4797
  calculateL2MessageTxHash: () => calculateL2MessageTxHash,
4794
4798
  computeCompiledClassHash: () => computeCompiledClassHash,
4799
+ computeCompiledClassHashBlake: () => computeCompiledClassHashBlake,
4800
+ computeCompiledClassHashPoseidon: () => computeCompiledClassHashPoseidon,
4795
4801
  computeContractClassHash: () => computeContractClassHash,
4796
4802
  computeHashOnElements: () => computeHashOnElements2,
4797
4803
  computeHintedClassHash: () => computeHintedClassHash,
@@ -4801,13 +4807,17 @@ __export(hash_exports, {
4801
4807
  computePoseidonHash: () => computePoseidonHash,
4802
4808
  computePoseidonHashOnElements: () => computePoseidonHashOnElements,
4803
4809
  computeSierraContractClassHash: () => computeSierraContractClassHash,
4810
+ encodeBuiltins: () => encodeBuiltins,
4811
+ flattenEntryPointData: () => flattenEntryPointData,
4804
4812
  formatSpaces: () => formatSpaces,
4805
4813
  getL1MessageHash: () => getL1MessageHash,
4806
4814
  getL2MessageHash: () => getL2MessageHash,
4807
4815
  getSelector: () => getSelector,
4808
4816
  getSelectorFromName: () => getSelectorFromName,
4809
4817
  hashByteCodeSegments: () => hashByteCodeSegments,
4818
+ hashByteCodeSegmentsBlake: () => hashByteCodeSegmentsBlake,
4810
4819
  keccakBn: () => keccakBn,
4820
+ nullSkipReplacer: () => nullSkipReplacer,
4811
4821
  poseidon: () => poseidon,
4812
4822
  solidityUint256PackedKeccak256: () => solidityUint256PackedKeccak256,
4813
4823
  starknetKeccak: () => starknetKeccak
@@ -5072,21 +5082,51 @@ function calculateDeployAccountTransactionHash3(args) {
5072
5082
  throw new Error("Invalid Tx version for hash calculation");
5073
5083
  }
5074
5084
 
5075
- // src/utils/hash/classHash.ts
5076
- var import_starknet3 = require("@scure/starknet");
5085
+ // src/utils/hash/classHash/util.ts
5086
+ var COMPILED_CLASS_VERSION = "COMPILED_CLASS_V1";
5087
+ function formatSpaces(json2) {
5088
+ let insideQuotes = false;
5089
+ const newString = [];
5090
+ for (const char of json2) {
5091
+ if (char === '"' && (newString.length > 0 && newString.slice(-1)[0] === "\\") === false) {
5092
+ insideQuotes = !insideQuotes;
5093
+ }
5094
+ if (insideQuotes) {
5095
+ newString.push(char);
5096
+ } else {
5097
+ newString.push(char === ":" ? ": " : char === "," ? ", " : char);
5098
+ }
5099
+ }
5100
+ return newString.join("");
5101
+ }
5102
+ function nullSkipReplacer(key, value) {
5103
+ if (key === "attributes" || key === "accessible_scopes") {
5104
+ return Array.isArray(value) && value.length === 0 ? void 0 : value;
5105
+ }
5106
+ if (key === "debug_info") {
5107
+ return null;
5108
+ }
5109
+ return value === null ? void 0 : value;
5110
+ }
5111
+ function encodeBuiltins(builtins) {
5112
+ return builtins.map((it) => BigInt(encodeShortString(it)));
5113
+ }
5114
+ function flattenEntryPointData(data, encodedBuiltinsArray) {
5115
+ return data.flatMap((it, index) => [
5116
+ BigInt(it.selector),
5117
+ BigInt(it.offset),
5118
+ ...encodedBuiltinsArray[index]
5119
+ ]);
5120
+ }
5121
+
5122
+ // src/utils/hash/classHash/pedersen.ts
5077
5123
  function computePedersenHash(a, b) {
5078
5124
  return starkCurve.pedersen(BigInt(a), BigInt(b));
5079
5125
  }
5080
- function computePoseidonHash(a, b) {
5081
- return toHex(starkCurve.poseidonHash(BigInt(a), BigInt(b)));
5082
- }
5083
5126
  function computeHashOnElements2(data) {
5084
5127
  return [...data, data.length].reduce((x, y) => starkCurve.pedersen(BigInt(x), BigInt(y)), 0).toString();
5085
5128
  }
5086
5129
  var computePedersenHashOnElements = computeHashOnElements2;
5087
- function computePoseidonHashOnElements(data) {
5088
- return toHex((0, import_starknet3.poseidonHashMany)(data.map((x) => BigInt(x))));
5089
- }
5090
5130
  function calculateContractAddressFromHash(salt, classHash, constructorCalldata, deployerAddress) {
5091
5131
  const compiledCalldata = CallData.compile(constructorCalldata);
5092
5132
  const constructorCalldataHash = computeHashOnElements2(compiledCalldata);
@@ -5100,30 +5140,6 @@ function calculateContractAddressFromHash(salt, classHash, constructorCalldata,
5100
5140
  ]);
5101
5141
  return toHex(BigInt(hash) % ADDR_BOUND);
5102
5142
  }
5103
- function nullSkipReplacer(key, value) {
5104
- if (key === "attributes" || key === "accessible_scopes") {
5105
- return Array.isArray(value) && value.length === 0 ? void 0 : value;
5106
- }
5107
- if (key === "debug_info") {
5108
- return null;
5109
- }
5110
- return value === null ? void 0 : value;
5111
- }
5112
- function formatSpaces(json2) {
5113
- let insideQuotes = false;
5114
- const newString = [];
5115
- for (const char of json2) {
5116
- if (char === '"' && (newString.length > 0 && newString.slice(-1)[0] === "\\") === false) {
5117
- insideQuotes = !insideQuotes;
5118
- }
5119
- if (insideQuotes) {
5120
- newString.push(char);
5121
- } else {
5122
- newString.push(char === ":" ? ": " : char === "," ? ", " : char);
5123
- }
5124
- }
5125
- return newString.join("");
5126
- }
5127
5143
  function computeHintedClassHash(compiledContract) {
5128
5144
  const { abi, program } = compiledContract;
5129
5145
  const contractClass = { abi, program };
@@ -5157,12 +5173,17 @@ function computeLegacyContractClassHash(contract) {
5157
5173
  dataHash
5158
5174
  ]);
5159
5175
  }
5176
+
5177
+ // src/utils/hash/classHash/poseidon.ts
5178
+ var import_starknet3 = require("@scure/starknet");
5179
+ function computePoseidonHash(a, b) {
5180
+ return toHex(starkCurve.poseidonHash(BigInt(a), BigInt(b)));
5181
+ }
5182
+ function computePoseidonHashOnElements(data) {
5183
+ return toHex((0, import_starknet3.poseidonHashMany)(data.map((x) => BigInt(x))));
5184
+ }
5160
5185
  function hashBuiltins(builtins) {
5161
- return (0, import_starknet3.poseidonHashMany)(
5162
- builtins.flatMap((it) => {
5163
- return BigInt(encodeShortString(it));
5164
- })
5165
- );
5186
+ return (0, import_starknet3.poseidonHashMany)(encodeBuiltins(builtins));
5166
5187
  }
5167
5188
  function hashEntryPoint(data) {
5168
5189
  const base = data.flatMap((it) => {
@@ -5180,8 +5201,7 @@ function hashByteCodeSegments(casm) {
5180
5201
  });
5181
5202
  return 1n + (0, import_starknet3.poseidonHashMany)(hashLeaves);
5182
5203
  }
5183
- function computeCompiledClassHash(casm) {
5184
- const COMPILED_CLASS_VERSION = "COMPILED_CLASS_V1";
5204
+ function computeCompiledClassHashPoseidon(casm) {
5185
5205
  const compiledClassVersion = BigInt(encodeShortString(COMPILED_CLASS_VERSION));
5186
5206
  const externalEntryPointsHash = hashEntryPoint(casm.entry_points_by_type.EXTERNAL);
5187
5207
  const l1Handlers = hashEntryPoint(casm.entry_points_by_type.L1_HANDLER);
@@ -5226,6 +5246,161 @@ function computeSierraContractClassHash(sierra) {
5226
5246
  ])
5227
5247
  );
5228
5248
  }
5249
+
5250
+ // src/utils/connect/blake.ts
5251
+ var import_blake2s = require("@noble/hashes/blake2s");
5252
+ function blakeHash(uint8Array) {
5253
+ return config.get("blake")?.(uint8Array) || (0, import_blake2s.blake2s)(uint8Array, { dkLen: 32 });
5254
+ }
5255
+
5256
+ // src/utils/hash/classHash/blake.ts
5257
+ function blake2sHashMany(data) {
5258
+ const SMALL_THRESHOLD = 0x8000000000000000n;
5259
+ const BIG_MARKER = 2147483648;
5260
+ const u32Words = [];
5261
+ const buf = new ArrayBuffer(32);
5262
+ const feltView = new DataView(buf);
5263
+ for (const felt2 of data) {
5264
+ const u64_0 = felt2 & 0xffffffffffffffffn;
5265
+ const u64_1 = (felt2 & 0xffffffffffffffff0000000000000000n) >> 64n;
5266
+ const u64_2 = (felt2 & 0xffffffffffffffff00000000000000000000000000000000n) >> 128n;
5267
+ const u64_3 = (felt2 & 0xffffffffffffffff000000000000000000000000000000000000000000000000n) >> 192n;
5268
+ feltView.setBigUint64(0, u64_3, false);
5269
+ feltView.setBigUint64(8, u64_2, false);
5270
+ feltView.setBigUint64(16, u64_1, false);
5271
+ feltView.setBigUint64(24, u64_0, false);
5272
+ if (felt2 < SMALL_THRESHOLD) {
5273
+ const hi0 = feltView.getUint32(24, false);
5274
+ const lo0 = feltView.getUint32(28, false);
5275
+ u32Words.push(hi0, lo0);
5276
+ } else {
5277
+ const word0 = feltView.getUint32(0, false) | BIG_MARKER;
5278
+ const word1 = feltView.getUint32(4, false);
5279
+ const word2 = feltView.getUint32(8, false);
5280
+ const word3 = feltView.getUint32(12, false);
5281
+ const word4 = feltView.getUint32(16, false);
5282
+ const word5 = feltView.getUint32(20, false);
5283
+ const word6 = feltView.getUint32(24, false);
5284
+ const word7 = feltView.getUint32(28, false);
5285
+ u32Words.push(word0, word1, word2, word3, word4, word5, word6, word7);
5286
+ }
5287
+ }
5288
+ const bytes = new ArrayBuffer(u32Words.length * 4);
5289
+ const bytesView = new DataView(bytes);
5290
+ for (let i = 0; i < u32Words.length; i++) {
5291
+ bytesView.setUint32(i * 4, u32Words[i], true);
5292
+ }
5293
+ const hash = blakeHash(new Uint8Array(bytes));
5294
+ let hashBigInt = 0n;
5295
+ for (let i = 0; i < 32; i++) {
5296
+ hashBigInt |= BigInt(hash[i]) << BigInt(i * 8);
5297
+ }
5298
+ return hashBigInt % PRIME;
5299
+ }
5300
+ function hashBuiltinsBlake(builtins) {
5301
+ return blake2sHashMany(encodeBuiltins(builtins));
5302
+ }
5303
+ function hashEntryPointBlake(data) {
5304
+ const base = data.flatMap((it) => {
5305
+ return [BigInt(it.selector), BigInt(it.offset), hashBuiltinsBlake(it.builtins)];
5306
+ });
5307
+ return blake2sHashMany(base);
5308
+ }
5309
+ function bytecodeHashNodeBlake(iter, node) {
5310
+ if (typeof node === "number") {
5311
+ const data = [];
5312
+ for (let i = 0; i < node; i++) {
5313
+ const next = iter.next();
5314
+ if (next.done) throw new Error("Bytecode length mismatch");
5315
+ data.push(next.value);
5316
+ }
5317
+ return [node, blake2sHashMany(data)];
5318
+ }
5319
+ const innerNodes = node.map((child) => bytecodeHashNodeBlake(iter, child));
5320
+ const flatData = innerNodes.flatMap(([len, hash2]) => [BigInt(len), hash2]);
5321
+ const hash = blake2sHashMany(flatData) + 1n;
5322
+ const totalLen = innerNodes.reduce((sum, [len]) => sum + len, 0);
5323
+ return [totalLen, hash];
5324
+ }
5325
+ function hashByteCodeSegmentsBlake(casm) {
5326
+ const byteCode = casm.bytecode.map((n) => BigInt(n));
5327
+ const bytecodeSegmentLengths = casm.bytecode_segment_lengths;
5328
+ if (!bytecodeSegmentLengths) {
5329
+ return blake2sHashMany(byteCode);
5330
+ }
5331
+ const iter = byteCode[Symbol.iterator]();
5332
+ const [len, hash] = bytecodeHashNodeBlake(iter, bytecodeSegmentLengths);
5333
+ if (len !== byteCode.length) {
5334
+ throw new Error(`Bytecode length mismatch: expected ${byteCode.length}, got ${len}`);
5335
+ }
5336
+ return hash;
5337
+ }
5338
+ function computeCompiledClassHashBlake(casm) {
5339
+ const compiledClassVersion = BigInt(encodeShortString(COMPILED_CLASS_VERSION));
5340
+ const externalEntryPointsHash = hashEntryPointBlake(casm.entry_points_by_type.EXTERNAL);
5341
+ const l1Handlers = hashEntryPointBlake(casm.entry_points_by_type.L1_HANDLER);
5342
+ const constructor = hashEntryPointBlake(casm.entry_points_by_type.CONSTRUCTOR);
5343
+ const bytecode = hashByteCodeSegmentsBlake(casm);
5344
+ return toHex(
5345
+ blake2sHashMany([
5346
+ compiledClassVersion,
5347
+ externalEntryPointsHash,
5348
+ l1Handlers,
5349
+ constructor,
5350
+ bytecode
5351
+ ])
5352
+ );
5353
+ }
5354
+
5355
+ // src/utils/resolve.ts
5356
+ function isV3Tx(details) {
5357
+ const version = details.version ? toHex(details.version) : ETransactionVersion2.V3;
5358
+ return version === ETransactionVersion2.V3 || version === ETransactionVersion2.F3;
5359
+ }
5360
+ function isVersion(expected, provided) {
5361
+ const expectedParts = expected.split(".");
5362
+ const providedParts = provided.split(".");
5363
+ return expectedParts.every((part, index) => part === "*" || part === providedParts[index]);
5364
+ }
5365
+ function isSupportedSpecVersion(version, options = { allowAnyPatchVersion: false }) {
5366
+ return Object.values(_SupportedRpcVersion).some(
5367
+ (v) => isVersion(options.allowAnyPatchVersion ? toAnyPatchVersion(v) : v, version)
5368
+ );
5369
+ }
5370
+ function toAnyPatchVersion(version) {
5371
+ const parts = version.split(".");
5372
+ if (parts.length < 3) {
5373
+ return version;
5374
+ }
5375
+ return `${parts[0]}.${parts[1]}.*`;
5376
+ }
5377
+ function toApiVersion(version) {
5378
+ const [major, minor] = version.replace(/^v/, "").split(".");
5379
+ return `v${major}_${minor}`;
5380
+ }
5381
+ function compareVersions(a, b) {
5382
+ const aParts = a.split(".").map(Number);
5383
+ const bParts = b.split(".").map(Number);
5384
+ const maxLen = Math.max(aParts.length, bParts.length);
5385
+ for (let i = 0; i < maxLen; i += 1) {
5386
+ const aNum = aParts[i] || 0;
5387
+ const bNum = bParts[i] || 0;
5388
+ if (aNum > bNum) return 1;
5389
+ if (aNum < bNum) return -1;
5390
+ }
5391
+ return 0;
5392
+ }
5393
+ function isPendingBlock(response) {
5394
+ return response.status === "PENDING";
5395
+ }
5396
+ function isPendingTransaction(response) {
5397
+ return !("block_hash" in response);
5398
+ }
5399
+ function isPendingStateUpdate(response) {
5400
+ return !("block_hash" in response);
5401
+ }
5402
+
5403
+ // src/utils/hash/classHash/index.ts
5229
5404
  function computeContractClassHash(contract) {
5230
5405
  const compiledContract = isString(contract) ? parse2(contract) : contract;
5231
5406
  if ("sierra_program" in compiledContract) {
@@ -5233,6 +5408,12 @@ function computeContractClassHash(contract) {
5233
5408
  }
5234
5409
  return computeLegacyContractClassHash(compiledContract);
5235
5410
  }
5411
+ function computeCompiledClassHash(casm, specVersion) {
5412
+ if (specVersion && compareVersions(specVersion, "0.10.0") >= 0) {
5413
+ return computeCompiledClassHashBlake(casm);
5414
+ }
5415
+ return computeCompiledClassHashPoseidon(casm);
5416
+ }
5236
5417
 
5237
5418
  // src/utils/stark/index.ts
5238
5419
  var stark_exports = {};
@@ -5438,11 +5619,11 @@ function isSierra(contract) {
5438
5619
  const compiledContract = isString(contract) ? parse2(contract) : contract;
5439
5620
  return "sierra_program" in compiledContract;
5440
5621
  }
5441
- function extractContractHashes(payload) {
5622
+ function extractContractHashes(payload, specVersion) {
5442
5623
  const response = { ...payload };
5443
5624
  if (isSierra(payload.contract)) {
5444
5625
  if (!payload.compiledClassHash && payload.casm) {
5445
- response.compiledClassHash = computeCompiledClassHash(payload.casm);
5626
+ response.compiledClassHash = computeCompiledClassHash(payload.casm, specVersion);
5446
5627
  }
5447
5628
  if (!response.compiledClassHash)
5448
5629
  throw new Error(
@@ -5499,44 +5680,6 @@ __export(provider_exports, {
5499
5680
  validBlockTags: () => validBlockTags,
5500
5681
  wait: () => wait
5501
5682
  });
5502
-
5503
- // src/utils/resolve.ts
5504
- function isV3Tx(details) {
5505
- const version = details.version ? toHex(details.version) : ETransactionVersion2.V3;
5506
- return version === ETransactionVersion2.V3 || version === ETransactionVersion2.F3;
5507
- }
5508
- function isVersion(expected, provided) {
5509
- const expectedParts = expected.split(".");
5510
- const providedParts = provided.split(".");
5511
- return expectedParts.every((part, index) => part === "*" || part === providedParts[index]);
5512
- }
5513
- function isSupportedSpecVersion(version, options = { allowAnyPatchVersion: false }) {
5514
- return Object.values(_SupportedRpcVersion).some(
5515
- (v) => isVersion(options.allowAnyPatchVersion ? toAnyPatchVersion(v) : v, version)
5516
- );
5517
- }
5518
- function toAnyPatchVersion(version) {
5519
- const parts = version.split(".");
5520
- if (parts.length < 3) {
5521
- return version;
5522
- }
5523
- return `${parts[0]}.${parts[1]}.*`;
5524
- }
5525
- function toApiVersion(version) {
5526
- const [major, minor] = version.replace(/^v/, "").split(".");
5527
- return `v${major}_${minor}`;
5528
- }
5529
- function isPendingBlock(response) {
5530
- return response.status === "PENDING";
5531
- }
5532
- function isPendingTransaction(response) {
5533
- return !("block_hash" in response);
5534
- }
5535
- function isPendingStateUpdate(response) {
5536
- return !("block_hash" in response);
5537
- }
5538
-
5539
- // src/utils/provider.ts
5540
5683
  function wait(delay) {
5541
5684
  return new Promise((res) => {
5542
5685
  setTimeout(res, delay);
@@ -8710,7 +8853,10 @@ var RpcProvider = class {
8710
8853
  async isClassDeclared(contractClassIdentifier, blockIdentifier) {
8711
8854
  let classHash;
8712
8855
  if (!contractClassIdentifier.classHash && "contract" in contractClassIdentifier) {
8713
- const hashes = extractContractHashes(contractClassIdentifier);
8856
+ const hashes = extractContractHashes(
8857
+ contractClassIdentifier,
8858
+ await this.channel.setUpSpecVersion()
8859
+ );
8714
8860
  classHash = hashes.classHash;
8715
8861
  } else if (contractClassIdentifier.classHash) {
8716
8862
  classHash = contractClassIdentifier.classHash;
@@ -11081,7 +11227,10 @@ var Account = class extends RpcProvider2 {
11081
11227
  "Declare fee estimation is not supported for Cairo0 contracts"
11082
11228
  );
11083
11229
  const invocations = [
11084
- { type: api_exports.ETransactionType.DECLARE, payload: extractContractHashes(payload) }
11230
+ {
11231
+ type: api_exports.ETransactionType.DECLARE,
11232
+ payload: extractContractHashes(payload, await this.channel.setUpSpecVersion())
11233
+ }
11085
11234
  ];
11086
11235
  const estimateBulk = await this.estimateFeeBulk(invocations, details);
11087
11236
  return estimateBulk[0];
@@ -11244,7 +11393,10 @@ var Account = class extends RpcProvider2 {
11244
11393
  * @param transactionsDetail (optional)
11245
11394
  */
11246
11395
  async declareIfNot(payload, transactionsDetail = {}) {
11247
- const declareContractPayload = extractContractHashes(payload);
11396
+ const declareContractPayload = extractContractHashes(
11397
+ payload,
11398
+ await this.channel.setUpSpecVersion()
11399
+ );
11248
11400
  try {
11249
11401
  await this.getClassByHash(declareContractPayload.classHash);
11250
11402
  } catch (error) {
@@ -11257,7 +11409,10 @@ var Account = class extends RpcProvider2 {
11257
11409
  }
11258
11410
  async declare(payload, details = {}) {
11259
11411
  assert(isSierra(payload.contract), SYSTEM_MESSAGES.declareNonSierra);
11260
- const declareContractPayload = extractContractHashes(payload);
11412
+ const declareContractPayload = extractContractHashes(
11413
+ payload,
11414
+ await this.channel.setUpSpecVersion()
11415
+ );
11261
11416
  const detailsWithTip = await this.resolveDetailsWithTip(details);
11262
11417
  const { resourceBounds: providedResourceBounds } = details;
11263
11418
  let resourceBounds = providedResourceBounds;
@@ -11564,7 +11719,10 @@ var Account = class extends RpcProvider2 {
11564
11719
  };
11565
11720
  }
11566
11721
  async buildDeclarePayload(payload, details) {
11567
- const { classHash, contract, compiledClassHash } = extractContractHashes(payload);
11722
+ const { classHash, contract, compiledClassHash } = extractContractHashes(
11723
+ payload,
11724
+ await this.channel.setUpSpecVersion()
11725
+ );
11568
11726
  const compressedCompiledContract = parseContract(contract);
11569
11727
  assert(
11570
11728
  !isUndefined(compiledClassHash) && (details.version === ETransactionVersion3.F3 || details.version === ETransactionVersion3.V3),
@@ -11910,8 +12068,11 @@ var WalletAccount = class _WalletAccount extends Account {
11910
12068
  };
11911
12069
  return addInvokeTransaction(this.walletProvider, params);
11912
12070
  }
11913
- declare(payload) {
11914
- const declareContractPayload = extractContractHashes(payload);
12071
+ async declare(payload) {
12072
+ const declareContractPayload = extractContractHashes(
12073
+ payload,
12074
+ await this.channel.setUpSpecVersion()
12075
+ );
11915
12076
  const pContract = payload.contract;
11916
12077
  const cairo1Contract = {
11917
12078
  ...pContract,
@@ -12623,6 +12784,7 @@ function units(amount, simbol = "fri") {
12623
12784
  addAddressPadding,
12624
12785
  byteArray,
12625
12786
  cairo,
12787
+ compareVersions,
12626
12788
  config,
12627
12789
  constants,
12628
12790
  contractClassResponseToLegacyCompiledContract,