starknet 6.1.5 → 6.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -12695,7 +12695,9 @@ var starknet = (() => {
12695
12695
  Provider: () => RpcProvider2,
12696
12696
  ProviderInterface: () => ProviderInterface,
12697
12697
  RPC: () => api_exports,
12698
- RpcChannel: () => RpcChannel,
12698
+ RPC06: () => rpc_0_6_exports,
12699
+ RPC07: () => rpc_0_7_exports,
12700
+ RpcChannel: () => RpcChannel2,
12699
12701
  RpcProvider: () => RpcProvider2,
12700
12702
  SIMULATION_FLAG: () => SIMULATION_FLAG,
12701
12703
  Signer: () => Signer,
@@ -12761,7 +12763,7 @@ var starknet = (() => {
12761
12763
  RPC_NODES: () => RPC_NODES,
12762
12764
  StarknetChainId: () => StarknetChainId,
12763
12765
  TEXT_TO_FELT_MAX_LEN: () => TEXT_TO_FELT_MAX_LEN,
12764
- TRANSACTION_VERSION: () => ETransactionVersion,
12766
+ TRANSACTION_VERSION: () => ETransactionVersion4,
12765
12767
  TransactionHashPrefix: () => TransactionHashPrefix,
12766
12768
  UDC: () => UDC,
12767
12769
  ZERO: () => ZERO
@@ -12770,6 +12772,30 @@ var starknet = (() => {
12770
12772
  // src/types/api/index.ts
12771
12773
  var api_exports = {};
12772
12774
  __export(api_exports, {
12775
+ EBlockTag: () => EBlockTag2,
12776
+ EDAMode: () => EDAMode2,
12777
+ EDataAvailabilityMode: () => EDataAvailabilityMode2,
12778
+ ESimulationFlag: () => ESimulationFlag2,
12779
+ ETransactionExecutionStatus: () => ETransactionExecutionStatus2,
12780
+ ETransactionFinalityStatus: () => ETransactionFinalityStatus2,
12781
+ ETransactionStatus: () => ETransactionStatus2,
12782
+ ETransactionType: () => ETransactionType2,
12783
+ ETransactionVersion: () => ETransactionVersion4,
12784
+ ETransactionVersion2: () => ETransactionVersion22,
12785
+ ETransactionVersion3: () => ETransactionVersion32,
12786
+ Errors: () => errors_exports2,
12787
+ JRPC: () => jsonrpc_exports,
12788
+ RPCSPEC06: () => rpcspec_0_6_exports,
12789
+ RPCSPEC07: () => rpcspec_0_7_exports,
12790
+ SPEC: () => components_exports2
12791
+ });
12792
+
12793
+ // src/types/api/jsonrpc/index.ts
12794
+ var jsonrpc_exports = {};
12795
+
12796
+ // src/types/api/rpcspec_0_6/index.ts
12797
+ var rpcspec_0_6_exports = {};
12798
+ __export(rpcspec_0_6_exports, {
12773
12799
  EBlockTag: () => EBlockTag,
12774
12800
  EDAMode: () => EDAMode,
12775
12801
  EDataAvailabilityMode: () => EDataAvailabilityMode,
@@ -12782,13 +12808,9 @@ var starknet = (() => {
12782
12808
  ETransactionVersion2: () => ETransactionVersion2,
12783
12809
  ETransactionVersion3: () => ETransactionVersion3,
12784
12810
  Errors: () => errors_exports,
12785
- JRPC: () => jsonrpc_exports,
12786
12811
  SPEC: () => components_exports
12787
12812
  });
12788
12813
 
12789
- // src/types/api/jsonrpc/index.ts
12790
- var jsonrpc_exports = {};
12791
-
12792
12814
  // src/types/api/rpcspec_0_6/errors.ts
12793
12815
  var errors_exports = {};
12794
12816
 
@@ -12796,77 +12818,173 @@ var starknet = (() => {
12796
12818
  var components_exports = {};
12797
12819
 
12798
12820
  // src/types/api/rpcspec_0_6/nonspec.ts
12799
- var ETransactionType = /* @__PURE__ */ ((ETransactionType2) => {
12800
- ETransactionType2["DECLARE"] = "DECLARE";
12801
- ETransactionType2["DEPLOY"] = "DEPLOY";
12802
- ETransactionType2["DEPLOY_ACCOUNT"] = "DEPLOY_ACCOUNT";
12803
- ETransactionType2["INVOKE"] = "INVOKE";
12804
- ETransactionType2["L1_HANDLER"] = "L1_HANDLER";
12805
- return ETransactionType2;
12821
+ var ETransactionType = /* @__PURE__ */ ((ETransactionType3) => {
12822
+ ETransactionType3["DECLARE"] = "DECLARE";
12823
+ ETransactionType3["DEPLOY"] = "DEPLOY";
12824
+ ETransactionType3["DEPLOY_ACCOUNT"] = "DEPLOY_ACCOUNT";
12825
+ ETransactionType3["INVOKE"] = "INVOKE";
12826
+ ETransactionType3["L1_HANDLER"] = "L1_HANDLER";
12827
+ return ETransactionType3;
12806
12828
  })(ETransactionType || {});
12807
- var ESimulationFlag = /* @__PURE__ */ ((ESimulationFlag2) => {
12808
- ESimulationFlag2["SKIP_VALIDATE"] = "SKIP_VALIDATE";
12809
- ESimulationFlag2["SKIP_FEE_CHARGE"] = "SKIP_FEE_CHARGE";
12810
- return ESimulationFlag2;
12829
+ var ESimulationFlag = /* @__PURE__ */ ((ESimulationFlag3) => {
12830
+ ESimulationFlag3["SKIP_VALIDATE"] = "SKIP_VALIDATE";
12831
+ ESimulationFlag3["SKIP_FEE_CHARGE"] = "SKIP_FEE_CHARGE";
12832
+ return ESimulationFlag3;
12811
12833
  })(ESimulationFlag || {});
12812
- var ETransactionStatus = /* @__PURE__ */ ((ETransactionStatus2) => {
12813
- ETransactionStatus2["RECEIVED"] = "RECEIVED";
12814
- ETransactionStatus2["REJECTED"] = "REJECTED";
12815
- ETransactionStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
12816
- ETransactionStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
12817
- return ETransactionStatus2;
12834
+ var ETransactionStatus = /* @__PURE__ */ ((ETransactionStatus3) => {
12835
+ ETransactionStatus3["RECEIVED"] = "RECEIVED";
12836
+ ETransactionStatus3["REJECTED"] = "REJECTED";
12837
+ ETransactionStatus3["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
12838
+ ETransactionStatus3["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
12839
+ return ETransactionStatus3;
12818
12840
  })(ETransactionStatus || {});
12819
- var ETransactionFinalityStatus = /* @__PURE__ */ ((ETransactionFinalityStatus2) => {
12820
- ETransactionFinalityStatus2["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
12821
- ETransactionFinalityStatus2["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
12822
- return ETransactionFinalityStatus2;
12841
+ var ETransactionFinalityStatus = /* @__PURE__ */ ((ETransactionFinalityStatus3) => {
12842
+ ETransactionFinalityStatus3["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
12843
+ ETransactionFinalityStatus3["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
12844
+ return ETransactionFinalityStatus3;
12823
12845
  })(ETransactionFinalityStatus || {});
12824
- var ETransactionExecutionStatus = /* @__PURE__ */ ((ETransactionExecutionStatus2) => {
12825
- ETransactionExecutionStatus2["SUCCEEDED"] = "SUCCEEDED";
12826
- ETransactionExecutionStatus2["REVERTED"] = "REVERTED";
12827
- return ETransactionExecutionStatus2;
12846
+ var ETransactionExecutionStatus = /* @__PURE__ */ ((ETransactionExecutionStatus3) => {
12847
+ ETransactionExecutionStatus3["SUCCEEDED"] = "SUCCEEDED";
12848
+ ETransactionExecutionStatus3["REVERTED"] = "REVERTED";
12849
+ return ETransactionExecutionStatus3;
12828
12850
  })(ETransactionExecutionStatus || {});
12829
- var EBlockTag = /* @__PURE__ */ ((EBlockTag2) => {
12830
- EBlockTag2["LATEST"] = "latest";
12831
- EBlockTag2["PENDING"] = "pending";
12832
- return EBlockTag2;
12851
+ var EBlockTag = /* @__PURE__ */ ((EBlockTag3) => {
12852
+ EBlockTag3["LATEST"] = "latest";
12853
+ EBlockTag3["PENDING"] = "pending";
12854
+ return EBlockTag3;
12833
12855
  })(EBlockTag || {});
12834
- var EDataAvailabilityMode = /* @__PURE__ */ ((EDataAvailabilityMode2) => {
12835
- EDataAvailabilityMode2["L1"] = "L1";
12836
- EDataAvailabilityMode2["L2"] = "L2";
12837
- return EDataAvailabilityMode2;
12856
+ var EDataAvailabilityMode = /* @__PURE__ */ ((EDataAvailabilityMode3) => {
12857
+ EDataAvailabilityMode3["L1"] = "L1";
12858
+ EDataAvailabilityMode3["L2"] = "L2";
12859
+ return EDataAvailabilityMode3;
12838
12860
  })(EDataAvailabilityMode || {});
12839
- var EDAMode = /* @__PURE__ */ ((EDAMode3) => {
12840
- EDAMode3[EDAMode3["L1"] = 0] = "L1";
12841
- EDAMode3[EDAMode3["L2"] = 1] = "L2";
12842
- return EDAMode3;
12861
+ var EDAMode = /* @__PURE__ */ ((EDAMode4) => {
12862
+ EDAMode4[EDAMode4["L1"] = 0] = "L1";
12863
+ EDAMode4[EDAMode4["L2"] = 1] = "L2";
12864
+ return EDAMode4;
12843
12865
  })(EDAMode || {});
12844
- var ETransactionVersion = /* @__PURE__ */ ((ETransactionVersion4) => {
12845
- ETransactionVersion4["V0"] = "0x0";
12846
- ETransactionVersion4["V1"] = "0x1";
12847
- ETransactionVersion4["V2"] = "0x2";
12848
- ETransactionVersion4["V3"] = "0x3";
12849
- ETransactionVersion4["F0"] = "0x100000000000000000000000000000000";
12850
- ETransactionVersion4["F1"] = "0x100000000000000000000000000000001";
12851
- ETransactionVersion4["F2"] = "0x100000000000000000000000000000002";
12852
- ETransactionVersion4["F3"] = "0x100000000000000000000000000000003";
12853
- return ETransactionVersion4;
12866
+ var ETransactionVersion = /* @__PURE__ */ ((ETransactionVersion5) => {
12867
+ ETransactionVersion5["V0"] = "0x0";
12868
+ ETransactionVersion5["V1"] = "0x1";
12869
+ ETransactionVersion5["V2"] = "0x2";
12870
+ ETransactionVersion5["V3"] = "0x3";
12871
+ ETransactionVersion5["F0"] = "0x100000000000000000000000000000000";
12872
+ ETransactionVersion5["F1"] = "0x100000000000000000000000000000001";
12873
+ ETransactionVersion5["F2"] = "0x100000000000000000000000000000002";
12874
+ ETransactionVersion5["F3"] = "0x100000000000000000000000000000003";
12875
+ return ETransactionVersion5;
12854
12876
  })(ETransactionVersion || {});
12855
- var ETransactionVersion2 = /* @__PURE__ */ ((ETransactionVersion23) => {
12856
- ETransactionVersion23["V0"] = "0x0";
12857
- ETransactionVersion23["V1"] = "0x1";
12858
- ETransactionVersion23["V2"] = "0x2";
12859
- ETransactionVersion23["F0"] = "0x100000000000000000000000000000000";
12860
- ETransactionVersion23["F1"] = "0x100000000000000000000000000000001";
12861
- ETransactionVersion23["F2"] = "0x100000000000000000000000000000002";
12862
- return ETransactionVersion23;
12877
+ var ETransactionVersion2 = /* @__PURE__ */ ((ETransactionVersion24) => {
12878
+ ETransactionVersion24["V0"] = "0x0";
12879
+ ETransactionVersion24["V1"] = "0x1";
12880
+ ETransactionVersion24["V2"] = "0x2";
12881
+ ETransactionVersion24["F0"] = "0x100000000000000000000000000000000";
12882
+ ETransactionVersion24["F1"] = "0x100000000000000000000000000000001";
12883
+ ETransactionVersion24["F2"] = "0x100000000000000000000000000000002";
12884
+ return ETransactionVersion24;
12863
12885
  })(ETransactionVersion2 || {});
12864
- var ETransactionVersion3 = /* @__PURE__ */ ((ETransactionVersion33) => {
12865
- ETransactionVersion33["V3"] = "0x3";
12866
- ETransactionVersion33["F3"] = "0x100000000000000000000000000000003";
12867
- return ETransactionVersion33;
12886
+ var ETransactionVersion3 = /* @__PURE__ */ ((ETransactionVersion34) => {
12887
+ ETransactionVersion34["V3"] = "0x3";
12888
+ ETransactionVersion34["F3"] = "0x100000000000000000000000000000003";
12889
+ return ETransactionVersion34;
12868
12890
  })(ETransactionVersion3 || {});
12869
12891
 
12892
+ // src/types/api/rpcspec_0_7/index.ts
12893
+ var rpcspec_0_7_exports = {};
12894
+ __export(rpcspec_0_7_exports, {
12895
+ EBlockTag: () => EBlockTag2,
12896
+ EDAMode: () => EDAMode2,
12897
+ EDataAvailabilityMode: () => EDataAvailabilityMode2,
12898
+ ESimulationFlag: () => ESimulationFlag2,
12899
+ ETransactionExecutionStatus: () => ETransactionExecutionStatus2,
12900
+ ETransactionFinalityStatus: () => ETransactionFinalityStatus2,
12901
+ ETransactionStatus: () => ETransactionStatus2,
12902
+ ETransactionType: () => ETransactionType2,
12903
+ ETransactionVersion: () => ETransactionVersion4,
12904
+ ETransactionVersion2: () => ETransactionVersion22,
12905
+ ETransactionVersion3: () => ETransactionVersion32,
12906
+ Errors: () => errors_exports2,
12907
+ SPEC: () => components_exports2
12908
+ });
12909
+
12910
+ // src/types/api/rpcspec_0_7/errors.ts
12911
+ var errors_exports2 = {};
12912
+
12913
+ // src/types/api/rpcspec_0_7/components.ts
12914
+ var components_exports2 = {};
12915
+
12916
+ // src/types/api/rpcspec_0_7/nonspec.ts
12917
+ var ETransactionType2 = /* @__PURE__ */ ((ETransactionType3) => {
12918
+ ETransactionType3["DECLARE"] = "DECLARE";
12919
+ ETransactionType3["DEPLOY"] = "DEPLOY";
12920
+ ETransactionType3["DEPLOY_ACCOUNT"] = "DEPLOY_ACCOUNT";
12921
+ ETransactionType3["INVOKE"] = "INVOKE";
12922
+ ETransactionType3["L1_HANDLER"] = "L1_HANDLER";
12923
+ return ETransactionType3;
12924
+ })(ETransactionType2 || {});
12925
+ var ESimulationFlag2 = /* @__PURE__ */ ((ESimulationFlag3) => {
12926
+ ESimulationFlag3["SKIP_VALIDATE"] = "SKIP_VALIDATE";
12927
+ ESimulationFlag3["SKIP_FEE_CHARGE"] = "SKIP_FEE_CHARGE";
12928
+ return ESimulationFlag3;
12929
+ })(ESimulationFlag2 || {});
12930
+ var ETransactionStatus2 = /* @__PURE__ */ ((ETransactionStatus3) => {
12931
+ ETransactionStatus3["RECEIVED"] = "RECEIVED";
12932
+ ETransactionStatus3["REJECTED"] = "REJECTED";
12933
+ ETransactionStatus3["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
12934
+ ETransactionStatus3["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
12935
+ return ETransactionStatus3;
12936
+ })(ETransactionStatus2 || {});
12937
+ var ETransactionFinalityStatus2 = /* @__PURE__ */ ((ETransactionFinalityStatus3) => {
12938
+ ETransactionFinalityStatus3["ACCEPTED_ON_L2"] = "ACCEPTED_ON_L2";
12939
+ ETransactionFinalityStatus3["ACCEPTED_ON_L1"] = "ACCEPTED_ON_L1";
12940
+ return ETransactionFinalityStatus3;
12941
+ })(ETransactionFinalityStatus2 || {});
12942
+ var ETransactionExecutionStatus2 = /* @__PURE__ */ ((ETransactionExecutionStatus3) => {
12943
+ ETransactionExecutionStatus3["SUCCEEDED"] = "SUCCEEDED";
12944
+ ETransactionExecutionStatus3["REVERTED"] = "REVERTED";
12945
+ return ETransactionExecutionStatus3;
12946
+ })(ETransactionExecutionStatus2 || {});
12947
+ var EBlockTag2 = /* @__PURE__ */ ((EBlockTag3) => {
12948
+ EBlockTag3["LATEST"] = "latest";
12949
+ EBlockTag3["PENDING"] = "pending";
12950
+ return EBlockTag3;
12951
+ })(EBlockTag2 || {});
12952
+ var EDataAvailabilityMode2 = /* @__PURE__ */ ((EDataAvailabilityMode3) => {
12953
+ EDataAvailabilityMode3["L1"] = "L1";
12954
+ EDataAvailabilityMode3["L2"] = "L2";
12955
+ return EDataAvailabilityMode3;
12956
+ })(EDataAvailabilityMode2 || {});
12957
+ var EDAMode2 = /* @__PURE__ */ ((EDAMode4) => {
12958
+ EDAMode4[EDAMode4["L1"] = 0] = "L1";
12959
+ EDAMode4[EDAMode4["L2"] = 1] = "L2";
12960
+ return EDAMode4;
12961
+ })(EDAMode2 || {});
12962
+ var ETransactionVersion4 = /* @__PURE__ */ ((ETransactionVersion5) => {
12963
+ ETransactionVersion5["V0"] = "0x0";
12964
+ ETransactionVersion5["V1"] = "0x1";
12965
+ ETransactionVersion5["V2"] = "0x2";
12966
+ ETransactionVersion5["V3"] = "0x3";
12967
+ ETransactionVersion5["F0"] = "0x100000000000000000000000000000000";
12968
+ ETransactionVersion5["F1"] = "0x100000000000000000000000000000001";
12969
+ ETransactionVersion5["F2"] = "0x100000000000000000000000000000002";
12970
+ ETransactionVersion5["F3"] = "0x100000000000000000000000000000003";
12971
+ return ETransactionVersion5;
12972
+ })(ETransactionVersion4 || {});
12973
+ var ETransactionVersion22 = /* @__PURE__ */ ((ETransactionVersion24) => {
12974
+ ETransactionVersion24["V0"] = "0x0";
12975
+ ETransactionVersion24["V1"] = "0x1";
12976
+ ETransactionVersion24["V2"] = "0x2";
12977
+ ETransactionVersion24["F0"] = "0x100000000000000000000000000000000";
12978
+ ETransactionVersion24["F1"] = "0x100000000000000000000000000000001";
12979
+ ETransactionVersion24["F2"] = "0x100000000000000000000000000000002";
12980
+ return ETransactionVersion24;
12981
+ })(ETransactionVersion22 || {});
12982
+ var ETransactionVersion32 = /* @__PURE__ */ ((ETransactionVersion34) => {
12983
+ ETransactionVersion34["V3"] = "0x3";
12984
+ ETransactionVersion34["F3"] = "0x100000000000000000000000000000003";
12985
+ return ETransactionVersion34;
12986
+ })(ETransactionVersion32 || {});
12987
+
12870
12988
  // src/utils/encode.ts
12871
12989
  var encode_exports = {};
12872
12990
  __export(encode_exports, {
@@ -13119,11 +13237,11 @@ var starknet = (() => {
13119
13237
  NetworkName2["SN_SEPOLIA"] = "SN_SEPOLIA";
13120
13238
  return NetworkName2;
13121
13239
  })(NetworkName || {});
13122
- var StarknetChainId = /* @__PURE__ */ ((StarknetChainId5) => {
13123
- StarknetChainId5["SN_MAIN"] = "0x534e5f4d41494e";
13124
- StarknetChainId5["SN_GOERLI"] = "0x534e5f474f45524c49";
13125
- StarknetChainId5["SN_SEPOLIA"] = "0x534e5f5345504f4c4941";
13126
- return StarknetChainId5;
13240
+ var StarknetChainId = /* @__PURE__ */ ((StarknetChainId6) => {
13241
+ StarknetChainId6["SN_MAIN"] = "0x534e5f4d41494e";
13242
+ StarknetChainId6["SN_GOERLI"] = "0x534e5f474f45524c49";
13243
+ StarknetChainId6["SN_SEPOLIA"] = "0x534e5f5345504f4c4941";
13244
+ return StarknetChainId6;
13127
13245
  })(StarknetChainId || {});
13128
13246
  var TransactionHashPrefix = /* @__PURE__ */ ((TransactionHashPrefix2) => {
13129
13247
  TransactionHashPrefix2["DECLARE"] = "0x6465636c617265";
@@ -13190,6 +13308,12 @@ var starknet = (() => {
13190
13308
  }
13191
13309
  };
13192
13310
 
13311
+ // src/channel/rpc_0_6.ts
13312
+ var rpc_0_6_exports = {};
13313
+ __export(rpc_0_6_exports, {
13314
+ RpcChannel: () => RpcChannel
13315
+ });
13316
+
13193
13317
  // src/types/index.ts
13194
13318
  var types_exports = {};
13195
13319
  __export(types_exports, {
@@ -16649,13 +16773,40 @@ var starknet = (() => {
16649
16773
  }
16650
16774
  return recomposed;
16651
16775
  }
16776
+ function getClosureOffset(input, open, close) {
16777
+ for (let i = 0, counter = 0; i < input.length; i++) {
16778
+ if (input[i] === open) {
16779
+ counter++;
16780
+ } else if (input[i] === close && --counter === 0) {
16781
+ return i;
16782
+ }
16783
+ }
16784
+ return Number.POSITIVE_INFINITY;
16785
+ }
16652
16786
  function extractCairo1Tuple(type) {
16653
- const cleanType = type.replace(/\s/g, "").slice(1, -1);
16654
- const { subTuple, result } = parseSubTuple(cleanType);
16655
- const recomposed = result.split(",").map((it) => {
16656
- return subTuple.length ? it.replace(" ", subTuple.shift()) : it;
16657
- });
16658
- return recomposed;
16787
+ const input = type.slice(1, -1);
16788
+ const result = [];
16789
+ let currentIndex = 0;
16790
+ let limitIndex;
16791
+ while (currentIndex < input.length) {
16792
+ switch (true) {
16793
+ case input[currentIndex] === "(": {
16794
+ limitIndex = currentIndex + getClosureOffset(input.slice(currentIndex), "(", ")") + 1;
16795
+ break;
16796
+ }
16797
+ case (input.startsWith("core::result::Result::<", currentIndex) || input.startsWith("core::array::Array::<", currentIndex) || input.startsWith("core::option::Option::<", currentIndex)): {
16798
+ limitIndex = currentIndex + getClosureOffset(input.slice(currentIndex), "<", ">") + 1;
16799
+ break;
16800
+ }
16801
+ default: {
16802
+ const commaIndex = input.indexOf(",", currentIndex);
16803
+ limitIndex = commaIndex !== -1 ? commaIndex : Number.POSITIVE_INFINITY;
16804
+ }
16805
+ }
16806
+ result.push(input.slice(currentIndex, limitIndex));
16807
+ currentIndex = limitIndex + 2;
16808
+ }
16809
+ return result;
16659
16810
  }
16660
16811
  function extractTupleMemberTypes(type) {
16661
16812
  if (isCairo1Type(type)) {
@@ -22881,10 +23032,10 @@ var starknet = (() => {
22881
23032
  function toTransactionVersion(defaultVersion, providedVersion) {
22882
23033
  const providedVersion0xs = providedVersion ? toHex(providedVersion) : void 0;
22883
23034
  const defaultVersion0xs = toHex(defaultVersion);
22884
- if (providedVersion && !Object.values(ETransactionVersion).includes(providedVersion0xs)) {
23035
+ if (providedVersion && !Object.values(ETransactionVersion4).includes(providedVersion0xs)) {
22885
23036
  throw Error(`providedVersion ${providedVersion} is not ETransactionVersion`);
22886
23037
  }
22887
- if (!Object.values(ETransactionVersion).includes(defaultVersion0xs)) {
23038
+ if (!Object.values(ETransactionVersion4).includes(defaultVersion0xs)) {
22888
23039
  throw Error(`defaultVersion ${defaultVersion} is not ETransactionVersion`);
22889
23040
  }
22890
23041
  return providedVersion ? providedVersion0xs : defaultVersion0xs;
@@ -23477,9 +23628,9 @@ var starknet = (() => {
23477
23628
  const block_id = new Block(blockIdentifier).identifier;
23478
23629
  const simulationFlags = [];
23479
23630
  if (skipValidate)
23480
- simulationFlags.push(api_exports.ESimulationFlag.SKIP_VALIDATE);
23631
+ simulationFlags.push(rpcspec_0_6_exports.ESimulationFlag.SKIP_VALIDATE);
23481
23632
  if (skipFeeCharge)
23482
- simulationFlags.push(api_exports.ESimulationFlag.SKIP_FEE_CHARGE);
23633
+ simulationFlags.push(rpcspec_0_6_exports.ESimulationFlag.SKIP_FEE_CHARGE);
23483
23634
  return this.fetchEndpoint("starknet_simulateTransactions", {
23484
23635
  block_id,
23485
23636
  transactions: invocations.map((it) => this.buildTransaction(it)),
@@ -23493,15 +23644,15 @@ var starknet = (() => {
23493
23644
  let isErrorState = false;
23494
23645
  const retryInterval = options?.retryInterval ?? 5e3;
23495
23646
  const errorStates = options?.errorStates ?? [
23496
- api_exports.ETransactionStatus.REJECTED
23647
+ rpcspec_0_6_exports.ETransactionStatus.REJECTED
23497
23648
  // TODO: commented out to preserve the long-standing behavior of "reverted" not being treated as an error by default
23498
23649
  // should decide which behavior to keep in the future
23499
23650
  // RPC.ETransactionExecutionStatus.REVERTED,
23500
23651
  ];
23501
23652
  const successStates = options?.successStates ?? [
23502
- api_exports.ETransactionExecutionStatus.SUCCEEDED,
23503
- api_exports.ETransactionStatus.ACCEPTED_ON_L2,
23504
- api_exports.ETransactionStatus.ACCEPTED_ON_L1
23653
+ rpcspec_0_6_exports.ETransactionExecutionStatus.SUCCEEDED,
23654
+ rpcspec_0_6_exports.ETransactionStatus.ACCEPTED_ON_L2,
23655
+ rpcspec_0_6_exports.ETransactionStatus.ACCEPTED_ON_L1
23505
23656
  ];
23506
23657
  let txStatus;
23507
23658
  while (!onchain) {
@@ -23584,9 +23735,9 @@ var starknet = (() => {
23584
23735
  async getEstimateFee(invocations, { blockIdentifier = this.blockIdentifier, skipValidate = true }) {
23585
23736
  const block_id = new Block(blockIdentifier).identifier;
23586
23737
  let flags = {};
23587
- if (isVersion("0.6", await this.getSpecVersion())) {
23738
+ if (!isVersion("0.5", await this.getSpecVersion())) {
23588
23739
  flags = {
23589
- simulation_flags: skipValidate ? [api_exports.ESimulationFlag.SKIP_VALIDATE] : []
23740
+ simulation_flags: skipValidate ? [rpcspec_0_6_exports.ESimulationFlag.SKIP_VALIDATE] : []
23590
23741
  };
23591
23742
  }
23592
23743
  return this.fetchEndpoint("starknet_estimateFee", {
@@ -23602,9 +23753,9 @@ var starknet = (() => {
23602
23753
  invoke_transaction: {
23603
23754
  sender_address: functionInvocation.contractAddress,
23604
23755
  calldata: CallData.toHex(functionInvocation.calldata),
23605
- type: api_exports.ETransactionType.INVOKE,
23756
+ type: rpcspec_0_6_exports.ETransactionType.INVOKE,
23606
23757
  max_fee: toHex(details.maxFee || 0),
23607
- version: "0x1" /* V1 */,
23758
+ version: rpcspec_0_6_exports.ETransactionVersion.V1,
23608
23759
  signature: signatureToHexArray(functionInvocation.signature),
23609
23760
  nonce: toHex(details.nonce)
23610
23761
  }
@@ -23612,10 +23763,10 @@ var starknet = (() => {
23612
23763
  } else {
23613
23764
  promise = this.fetchEndpoint("starknet_addInvokeTransaction", {
23614
23765
  invoke_transaction: {
23615
- type: api_exports.ETransactionType.INVOKE,
23766
+ type: rpcspec_0_6_exports.ETransactionType.INVOKE,
23616
23767
  sender_address: functionInvocation.contractAddress,
23617
23768
  calldata: CallData.toHex(functionInvocation.calldata),
23618
- version: "0x3" /* V3 */,
23769
+ version: rpcspec_0_6_exports.ETransactionVersion.V3,
23619
23770
  signature: signatureToHexArray(functionInvocation.signature),
23620
23771
  nonce: toHex(details.nonce),
23621
23772
  resource_bounds: details.resourceBounds,
@@ -23634,13 +23785,13 @@ var starknet = (() => {
23634
23785
  if (!isSierra(contract) && !isV3Tx(details)) {
23635
23786
  promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
23636
23787
  declare_transaction: {
23637
- type: api_exports.ETransactionType.DECLARE,
23788
+ type: rpcspec_0_6_exports.ETransactionType.DECLARE,
23638
23789
  contract_class: {
23639
23790
  program: contract.program,
23640
23791
  entry_points_by_type: contract.entry_points_by_type,
23641
23792
  abi: contract.abi
23642
23793
  },
23643
- version: "0x1" /* V1 */,
23794
+ version: rpcspec_0_6_exports.ETransactionVersion.V1,
23644
23795
  max_fee: toHex(details.maxFee || 0),
23645
23796
  signature: signatureToHexArray(signature),
23646
23797
  sender_address: senderAddress,
@@ -23650,7 +23801,7 @@ var starknet = (() => {
23650
23801
  } else if (isSierra(contract) && !isV3Tx(details)) {
23651
23802
  promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
23652
23803
  declare_transaction: {
23653
- type: api_exports.ETransactionType.DECLARE,
23804
+ type: rpcspec_0_6_exports.ETransactionType.DECLARE,
23654
23805
  contract_class: {
23655
23806
  sierra_program: decompressProgram(contract.sierra_program),
23656
23807
  contract_class_version: contract.contract_class_version,
@@ -23658,7 +23809,7 @@ var starknet = (() => {
23658
23809
  abi: contract.abi
23659
23810
  },
23660
23811
  compiled_class_hash: compiledClassHash || "",
23661
- version: "0x2" /* V2 */,
23812
+ version: rpcspec_0_6_exports.ETransactionVersion.V2,
23662
23813
  max_fee: toHex(details.maxFee || 0),
23663
23814
  signature: signatureToHexArray(signature),
23664
23815
  sender_address: senderAddress,
@@ -23668,10 +23819,10 @@ var starknet = (() => {
23668
23819
  } else if (isSierra(contract) && isV3Tx(details)) {
23669
23820
  promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
23670
23821
  declare_transaction: {
23671
- type: api_exports.ETransactionType.DECLARE,
23822
+ type: rpcspec_0_6_exports.ETransactionType.DECLARE,
23672
23823
  sender_address: senderAddress,
23673
23824
  compiled_class_hash: compiledClassHash || "",
23674
- version: "0x3" /* V3 */,
23825
+ version: rpcspec_0_6_exports.ETransactionVersion.V3,
23675
23826
  signature: signatureToHexArray(signature),
23676
23827
  nonce: toHex(details.nonce),
23677
23828
  contract_class: {
@@ -23701,9 +23852,9 @@ var starknet = (() => {
23701
23852
  constructor_calldata: CallData.toHex(constructorCalldata || []),
23702
23853
  class_hash: toHex(classHash),
23703
23854
  contract_address_salt: toHex(addressSalt || 0),
23704
- type: api_exports.ETransactionType.DEPLOY_ACCOUNT,
23855
+ type: rpcspec_0_6_exports.ETransactionType.DEPLOY_ACCOUNT,
23705
23856
  max_fee: toHex(details.maxFee || 0),
23706
- version: "0x1" /* V1 */,
23857
+ version: rpcspec_0_6_exports.ETransactionVersion.V1,
23707
23858
  signature: signatureToHexArray(signature),
23708
23859
  nonce: toHex(details.nonce)
23709
23860
  }
@@ -23711,8 +23862,8 @@ var starknet = (() => {
23711
23862
  } else {
23712
23863
  promise = this.fetchEndpoint("starknet_addDeployAccountTransaction", {
23713
23864
  deploy_account_transaction: {
23714
- type: api_exports.ETransactionType.DEPLOY_ACCOUNT,
23715
- version: "0x3" /* V3 */,
23865
+ type: rpcspec_0_6_exports.ETransactionType.DEPLOY_ACCOUNT,
23866
+ version: rpcspec_0_6_exports.ETransactionVersion.V3,
23716
23867
  signature: signatureToHexArray(signature),
23717
23868
  nonce: toHex(details.nonce),
23718
23869
  contract_address_salt: toHex(addressSalt || 0),
@@ -23795,7 +23946,7 @@ var starknet = (() => {
23795
23946
  if (invocation.type === "INVOKE_FUNCTION" /* INVOKE */) {
23796
23947
  return {
23797
23948
  // v0 v1 v3
23798
- type: api_exports.ETransactionType.INVOKE,
23949
+ type: rpcspec_0_6_exports.ETransactionType.INVOKE,
23799
23950
  // TODO: Diff between sequencer and rpc invoke type
23800
23951
  sender_address: invocation.contractAddress,
23801
23952
  calldata: CallData.toHex(invocation.calldata),
@@ -23841,106 +23992,645 @@ var starknet = (() => {
23841
23992
  }
23842
23993
  };
23843
23994
 
23844
- // src/utils/responseParser/rpc.ts
23845
- var RPCResponseParser = class {
23846
- parseGetBlockResponse(res) {
23847
- return { status: "PENDING", ...res };
23848
- }
23849
- parseTransactionReceipt(res) {
23850
- if ("actual_fee" in res && typeof res.actual_fee === "string") {
23851
- return {
23852
- ...res,
23853
- actual_fee: {
23854
- amount: res.actual_fee,
23855
- unit: "FRI"
23856
- }
23857
- };
23995
+ // src/channel/rpc_0_7.ts
23996
+ var rpc_0_7_exports = {};
23997
+ __export(rpc_0_7_exports, {
23998
+ RpcChannel: () => RpcChannel2
23999
+ });
24000
+ var defaultOptions2 = {
24001
+ headers: { "Content-Type": "application/json" },
24002
+ blockIdentifier: "pending" /* pending */,
24003
+ retries: 200
24004
+ };
24005
+ var RpcChannel2 = class {
24006
+ nodeUrl;
24007
+ headers;
24008
+ retries;
24009
+ requestId;
24010
+ blockIdentifier;
24011
+ chainId;
24012
+ speckVersion;
24013
+ waitMode;
24014
+ // behave like web2 rpc and return when tx is processed
24015
+ constructor(optionsOrProvider) {
24016
+ const { nodeUrl, retries, headers, blockIdentifier, chainId, waitMode } = optionsOrProvider || {};
24017
+ if (Object.values(NetworkName).includes(nodeUrl)) {
24018
+ this.nodeUrl = getDefaultNodeUrl(nodeUrl, optionsOrProvider?.default);
24019
+ } else if (nodeUrl) {
24020
+ this.nodeUrl = nodeUrl;
24021
+ } else {
24022
+ this.nodeUrl = getDefaultNodeUrl(void 0, optionsOrProvider?.default);
23858
24023
  }
23859
- return res;
24024
+ this.retries = retries || defaultOptions2.retries;
24025
+ this.headers = { ...defaultOptions2.headers, ...headers };
24026
+ this.blockIdentifier = blockIdentifier || defaultOptions2.blockIdentifier;
24027
+ this.chainId = chainId;
24028
+ this.waitMode = waitMode || false;
24029
+ this.requestId = 0;
23860
24030
  }
23861
- parseFeeEstimateResponse(res) {
23862
- const val = res[0];
23863
- return {
23864
- overall_fee: toBigInt(val.overall_fee),
23865
- gas_consumed: toBigInt(val.gas_consumed),
23866
- gas_price: toBigInt(val.gas_price),
23867
- unit: val.unit,
23868
- suggestedMaxFee: estimatedFeeToMaxFee(val.overall_fee),
23869
- resourceBounds: estimateFeeToBounds(val)
24031
+ fetch(method, params, id = 0) {
24032
+ const rpcRequestBody = {
24033
+ id,
24034
+ jsonrpc: "2.0",
24035
+ method,
24036
+ ...params && { params }
23870
24037
  };
23871
- }
23872
- parseFeeEstimateBulkResponse(res) {
23873
- return res.map((val) => ({
23874
- overall_fee: toBigInt(val.overall_fee),
23875
- gas_consumed: toBigInt(val.gas_consumed),
23876
- gas_price: toBigInt(val.gas_price),
23877
- unit: val.unit,
23878
- suggestedMaxFee: estimatedFeeToMaxFee(val.overall_fee),
23879
- resourceBounds: estimateFeeToBounds(val)
23880
- }));
23881
- }
23882
- parseSimulateTransactionResponse(res) {
23883
- return res.map((it) => {
23884
- return {
23885
- ...it,
23886
- suggestedMaxFee: estimatedFeeToMaxFee(BigInt(it.fee_estimation.overall_fee)),
23887
- resourceBounds: estimateFeeToBounds(it.fee_estimation)
23888
- };
24038
+ return fetchPonyfill_default(this.nodeUrl, {
24039
+ method: "POST",
24040
+ body: stringify2(rpcRequestBody),
24041
+ headers: this.headers
23889
24042
  });
23890
24043
  }
23891
- parseContractClassResponse(res) {
23892
- return {
23893
- ...res,
23894
- abi: typeof res.abi === "string" ? JSON.parse(res.abi) : res.abi
23895
- };
23896
- }
23897
- };
23898
-
23899
- // src/provider/rpc.ts
23900
- var RpcProvider = class {
23901
- responseParser = new RPCResponseParser();
23902
- channel;
23903
- constructor(optionsOrProvider) {
23904
- if (optionsOrProvider && "channel" in optionsOrProvider) {
23905
- this.channel = optionsOrProvider.channel;
23906
- } else {
23907
- this.channel = new RpcChannel({ ...optionsOrProvider, waitMode: false });
24044
+ errorHandler(method, params, rpcError, otherError) {
24045
+ if (rpcError) {
24046
+ const { code, message, data } = rpcError;
24047
+ throw new LibraryError(
24048
+ `RPC: ${method} with params ${stringify2(params, null, 2)}
24049
+
24050
+ ${code}: ${message}: ${stringify2(data)}`
24051
+ );
24052
+ }
24053
+ if (otherError instanceof LibraryError) {
24054
+ throw otherError;
24055
+ }
24056
+ if (otherError) {
24057
+ throw Error(otherError.message);
23908
24058
  }
23909
24059
  }
23910
- fetch(method, params, id = 0) {
23911
- return this.channel.fetch(method, params, id);
24060
+ async fetchEndpoint(method, params) {
24061
+ try {
24062
+ const rawResult = await this.fetch(method, params, this.requestId += 1);
24063
+ const { error: error2, result } = await rawResult.json();
24064
+ this.errorHandler(method, params, error2);
24065
+ return result;
24066
+ } catch (error2) {
24067
+ this.errorHandler(method, params, error2?.response?.data, error2);
24068
+ throw error2;
24069
+ }
23912
24070
  }
23913
24071
  async getChainId() {
23914
- return this.channel.getChainId();
24072
+ this.chainId ??= await this.fetchEndpoint("starknet_chainId");
24073
+ return this.chainId;
23915
24074
  }
23916
24075
  async getSpecVersion() {
23917
- return this.channel.getSpecVersion();
23918
- }
23919
- async getNonceForAddress(contractAddress, blockIdentifier) {
23920
- return this.channel.getNonceForAddress(contractAddress, blockIdentifier);
24076
+ this.speckVersion ??= await this.fetchEndpoint("starknet_specVersion");
24077
+ return this.speckVersion;
23921
24078
  }
23922
- async getBlock(blockIdentifier) {
23923
- return this.channel.getBlockWithTxHashes(blockIdentifier).then(this.responseParser.parseGetBlockResponse);
24079
+ getNonceForAddress(contractAddress, blockIdentifier = this.blockIdentifier) {
24080
+ const contract_address = toHex(contractAddress);
24081
+ const block_id = new Block(blockIdentifier).identifier;
24082
+ return this.fetchEndpoint("starknet_getNonce", {
24083
+ contract_address,
24084
+ block_id
24085
+ });
23924
24086
  }
23925
24087
  /**
23926
24088
  * Get the most recent accepted block hash and number
23927
24089
  */
23928
- async getBlockLatestAccepted() {
23929
- return this.channel.getBlockLatestAccepted();
24090
+ getBlockLatestAccepted() {
24091
+ return this.fetchEndpoint("starknet_blockHashAndNumber");
23930
24092
  }
23931
24093
  /**
23932
24094
  * Get the most recent accepted block number
23933
24095
  * redundant use getBlockLatestAccepted();
23934
24096
  * @returns Number of the latest block
23935
24097
  */
23936
- async getBlockNumber() {
23937
- return this.channel.getBlockNumber();
24098
+ getBlockNumber() {
24099
+ return this.fetchEndpoint("starknet_blockNumber");
23938
24100
  }
23939
- async getBlockWithTxHashes(blockIdentifier) {
23940
- return this.channel.getBlockWithTxHashes(blockIdentifier);
24101
+ getBlockWithTxHashes(blockIdentifier = this.blockIdentifier) {
24102
+ const block_id = new Block(blockIdentifier).identifier;
24103
+ return this.fetchEndpoint("starknet_getBlockWithTxHashes", { block_id });
23941
24104
  }
23942
- async getBlockWithTxs(blockIdentifier) {
23943
- return this.channel.getBlockWithTxs(blockIdentifier);
24105
+ getBlockWithTxs(blockIdentifier = this.blockIdentifier) {
24106
+ const block_id = new Block(blockIdentifier).identifier;
24107
+ return this.fetchEndpoint("starknet_getBlockWithTxs", { block_id });
24108
+ }
24109
+ getBlockWithReceipts(blockIdentifier = this.blockIdentifier) {
24110
+ const block_id = new Block(blockIdentifier).identifier;
24111
+ return this.fetchEndpoint("starknet_getBlockWithReceipts", { block_id });
24112
+ }
24113
+ getBlockStateUpdate(blockIdentifier = this.blockIdentifier) {
24114
+ const block_id = new Block(blockIdentifier).identifier;
24115
+ return this.fetchEndpoint("starknet_getStateUpdate", { block_id });
24116
+ }
24117
+ getBlockTransactionsTraces(blockIdentifier = this.blockIdentifier) {
24118
+ const block_id = new Block(blockIdentifier).identifier;
24119
+ return this.fetchEndpoint("starknet_traceBlockTransactions", { block_id });
24120
+ }
24121
+ getBlockTransactionCount(blockIdentifier = this.blockIdentifier) {
24122
+ const block_id = new Block(blockIdentifier).identifier;
24123
+ return this.fetchEndpoint("starknet_getBlockTransactionCount", { block_id });
24124
+ }
24125
+ getTransactionByHash(txHash) {
24126
+ const transaction_hash = toHex(txHash);
24127
+ return this.fetchEndpoint("starknet_getTransactionByHash", {
24128
+ transaction_hash
24129
+ });
24130
+ }
24131
+ getTransactionByBlockIdAndIndex(blockIdentifier, index) {
24132
+ const block_id = new Block(blockIdentifier).identifier;
24133
+ return this.fetchEndpoint("starknet_getTransactionByBlockIdAndIndex", { block_id, index });
24134
+ }
24135
+ getTransactionReceipt(txHash) {
24136
+ const transaction_hash = toHex(txHash);
24137
+ return this.fetchEndpoint("starknet_getTransactionReceipt", { transaction_hash });
24138
+ }
24139
+ getTransactionTrace(txHash) {
24140
+ const transaction_hash = toHex(txHash);
24141
+ return this.fetchEndpoint("starknet_traceTransaction", { transaction_hash });
24142
+ }
24143
+ /**
24144
+ * Get the status of a transaction
24145
+ */
24146
+ getTransactionStatus(transactionHash) {
24147
+ const transaction_hash = toHex(transactionHash);
24148
+ return this.fetchEndpoint("starknet_getTransactionStatus", { transaction_hash });
24149
+ }
24150
+ /**
24151
+ * @param invocations AccountInvocations
24152
+ * @param simulateTransactionOptions blockIdentifier and flags to skip validation and fee charge<br/>
24153
+ * - blockIdentifier<br/>
24154
+ * - skipValidate (default false)<br/>
24155
+ * - skipFeeCharge (default true)<br/>
24156
+ */
24157
+ simulateTransaction(invocations, {
24158
+ blockIdentifier = this.blockIdentifier,
24159
+ skipValidate = true,
24160
+ skipFeeCharge = true
24161
+ } = {}) {
24162
+ const block_id = new Block(blockIdentifier).identifier;
24163
+ const simulationFlags = [];
24164
+ if (skipValidate)
24165
+ simulationFlags.push(rpcspec_0_7_exports.ESimulationFlag.SKIP_VALIDATE);
24166
+ if (skipFeeCharge)
24167
+ simulationFlags.push(rpcspec_0_7_exports.ESimulationFlag.SKIP_FEE_CHARGE);
24168
+ return this.fetchEndpoint("starknet_simulateTransactions", {
24169
+ block_id,
24170
+ transactions: invocations.map((it) => this.buildTransaction(it)),
24171
+ simulation_flags: simulationFlags
24172
+ });
24173
+ }
24174
+ async waitForTransaction(txHash, options) {
24175
+ const transactionHash = toHex(txHash);
24176
+ let { retries } = this;
24177
+ let onchain = false;
24178
+ let isErrorState = false;
24179
+ const retryInterval = options?.retryInterval ?? 5e3;
24180
+ const errorStates = options?.errorStates ?? [
24181
+ rpcspec_0_7_exports.ETransactionStatus.REJECTED
24182
+ // TODO: commented out to preserve the long-standing behavior of "reverted" not being treated as an error by default
24183
+ // should decide which behavior to keep in the future
24184
+ // RPC.ETransactionExecutionStatus.REVERTED,
24185
+ ];
24186
+ const successStates = options?.successStates ?? [
24187
+ rpcspec_0_7_exports.ETransactionExecutionStatus.SUCCEEDED,
24188
+ rpcspec_0_7_exports.ETransactionStatus.ACCEPTED_ON_L2,
24189
+ rpcspec_0_7_exports.ETransactionStatus.ACCEPTED_ON_L1
24190
+ ];
24191
+ let txStatus;
24192
+ while (!onchain) {
24193
+ await wait(retryInterval);
24194
+ try {
24195
+ txStatus = await this.getTransactionStatus(transactionHash);
24196
+ const executionStatus = txStatus.execution_status;
24197
+ const finalityStatus = txStatus.finality_status;
24198
+ if (!finalityStatus) {
24199
+ const error2 = new Error("waiting for transaction status");
24200
+ throw error2;
24201
+ }
24202
+ if (errorStates.includes(executionStatus) || errorStates.includes(finalityStatus)) {
24203
+ const message = `${executionStatus}: ${finalityStatus}`;
24204
+ const error2 = new Error(message);
24205
+ error2.response = txStatus;
24206
+ isErrorState = true;
24207
+ throw error2;
24208
+ } else if (successStates.includes(executionStatus) || successStates.includes(finalityStatus)) {
24209
+ onchain = true;
24210
+ }
24211
+ } catch (error2) {
24212
+ if (error2 instanceof Error && isErrorState) {
24213
+ throw error2;
24214
+ }
24215
+ if (retries <= 0) {
24216
+ throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
24217
+ }
24218
+ }
24219
+ retries -= 1;
24220
+ }
24221
+ let txReceipt = null;
24222
+ while (txReceipt === null) {
24223
+ try {
24224
+ txReceipt = await this.getTransactionReceipt(transactionHash);
24225
+ } catch (error2) {
24226
+ if (retries <= 0) {
24227
+ throw new Error(`waitForTransaction timed-out with retries ${this.retries}`);
24228
+ }
24229
+ }
24230
+ retries -= 1;
24231
+ await wait(retryInterval);
24232
+ }
24233
+ return txReceipt;
24234
+ }
24235
+ getStorageAt(contractAddress, key, blockIdentifier = this.blockIdentifier) {
24236
+ const contract_address = toHex(contractAddress);
24237
+ const parsedKey = toStorageKey(key);
24238
+ const block_id = new Block(blockIdentifier).identifier;
24239
+ return this.fetchEndpoint("starknet_getStorageAt", {
24240
+ contract_address,
24241
+ key: parsedKey,
24242
+ block_id
24243
+ });
24244
+ }
24245
+ getClassHashAt(contractAddress, blockIdentifier = this.blockIdentifier) {
24246
+ const contract_address = toHex(contractAddress);
24247
+ const block_id = new Block(blockIdentifier).identifier;
24248
+ return this.fetchEndpoint("starknet_getClassHashAt", {
24249
+ block_id,
24250
+ contract_address
24251
+ });
24252
+ }
24253
+ getClass(classHash, blockIdentifier = this.blockIdentifier) {
24254
+ const class_hash = toHex(classHash);
24255
+ const block_id = new Block(blockIdentifier).identifier;
24256
+ return this.fetchEndpoint("starknet_getClass", {
24257
+ class_hash,
24258
+ block_id
24259
+ });
24260
+ }
24261
+ getClassAt(contractAddress, blockIdentifier = this.blockIdentifier) {
24262
+ const contract_address = toHex(contractAddress);
24263
+ const block_id = new Block(blockIdentifier).identifier;
24264
+ return this.fetchEndpoint("starknet_getClassAt", {
24265
+ block_id,
24266
+ contract_address
24267
+ });
24268
+ }
24269
+ async getEstimateFee(invocations, { blockIdentifier = this.blockIdentifier, skipValidate = true }) {
24270
+ const block_id = new Block(blockIdentifier).identifier;
24271
+ let flags = {};
24272
+ if (!isVersion("0.5", await this.getSpecVersion())) {
24273
+ flags = {
24274
+ simulation_flags: skipValidate ? [rpcspec_0_7_exports.ESimulationFlag.SKIP_VALIDATE] : []
24275
+ };
24276
+ }
24277
+ return this.fetchEndpoint("starknet_estimateFee", {
24278
+ request: invocations.map((it) => this.buildTransaction(it, "fee")),
24279
+ block_id,
24280
+ ...flags
24281
+ });
24282
+ }
24283
+ async invoke(functionInvocation, details) {
24284
+ let promise;
24285
+ if (!isV3Tx(details)) {
24286
+ promise = this.fetchEndpoint("starknet_addInvokeTransaction", {
24287
+ invoke_transaction: {
24288
+ sender_address: functionInvocation.contractAddress,
24289
+ calldata: CallData.toHex(functionInvocation.calldata),
24290
+ type: rpcspec_0_7_exports.ETransactionType.INVOKE,
24291
+ max_fee: toHex(details.maxFee || 0),
24292
+ version: rpcspec_0_7_exports.ETransactionVersion.V1,
24293
+ signature: signatureToHexArray(functionInvocation.signature),
24294
+ nonce: toHex(details.nonce)
24295
+ }
24296
+ });
24297
+ } else {
24298
+ promise = this.fetchEndpoint("starknet_addInvokeTransaction", {
24299
+ invoke_transaction: {
24300
+ type: rpcspec_0_7_exports.ETransactionType.INVOKE,
24301
+ sender_address: functionInvocation.contractAddress,
24302
+ calldata: CallData.toHex(functionInvocation.calldata),
24303
+ version: rpcspec_0_7_exports.ETransactionVersion.V3,
24304
+ signature: signatureToHexArray(functionInvocation.signature),
24305
+ nonce: toHex(details.nonce),
24306
+ resource_bounds: details.resourceBounds,
24307
+ tip: toHex(details.tip),
24308
+ paymaster_data: details.paymasterData.map((it) => toHex(it)),
24309
+ account_deployment_data: details.accountDeploymentData.map((it) => toHex(it)),
24310
+ nonce_data_availability_mode: details.nonceDataAvailabilityMode,
24311
+ fee_data_availability_mode: details.feeDataAvailabilityMode
24312
+ }
24313
+ });
24314
+ }
24315
+ return this.waitMode ? this.waitForTransaction((await promise).transaction_hash) : promise;
24316
+ }
24317
+ async declare({ contract, signature, senderAddress, compiledClassHash }, details) {
24318
+ let promise;
24319
+ if (!isSierra(contract) && !isV3Tx(details)) {
24320
+ promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
24321
+ declare_transaction: {
24322
+ type: rpcspec_0_7_exports.ETransactionType.DECLARE,
24323
+ contract_class: {
24324
+ program: contract.program,
24325
+ entry_points_by_type: contract.entry_points_by_type,
24326
+ abi: contract.abi
24327
+ },
24328
+ version: rpcspec_0_7_exports.ETransactionVersion.V1,
24329
+ max_fee: toHex(details.maxFee || 0),
24330
+ signature: signatureToHexArray(signature),
24331
+ sender_address: senderAddress,
24332
+ nonce: toHex(details.nonce)
24333
+ }
24334
+ });
24335
+ } else if (isSierra(contract) && !isV3Tx(details)) {
24336
+ promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
24337
+ declare_transaction: {
24338
+ type: rpcspec_0_7_exports.ETransactionType.DECLARE,
24339
+ contract_class: {
24340
+ sierra_program: decompressProgram(contract.sierra_program),
24341
+ contract_class_version: contract.contract_class_version,
24342
+ entry_points_by_type: contract.entry_points_by_type,
24343
+ abi: contract.abi
24344
+ },
24345
+ compiled_class_hash: compiledClassHash || "",
24346
+ version: rpcspec_0_7_exports.ETransactionVersion.V2,
24347
+ max_fee: toHex(details.maxFee || 0),
24348
+ signature: signatureToHexArray(signature),
24349
+ sender_address: senderAddress,
24350
+ nonce: toHex(details.nonce)
24351
+ }
24352
+ });
24353
+ } else if (isSierra(contract) && isV3Tx(details)) {
24354
+ promise = this.fetchEndpoint("starknet_addDeclareTransaction", {
24355
+ declare_transaction: {
24356
+ type: rpcspec_0_7_exports.ETransactionType.DECLARE,
24357
+ sender_address: senderAddress,
24358
+ compiled_class_hash: compiledClassHash || "",
24359
+ version: rpcspec_0_7_exports.ETransactionVersion.V3,
24360
+ signature: signatureToHexArray(signature),
24361
+ nonce: toHex(details.nonce),
24362
+ contract_class: {
24363
+ sierra_program: decompressProgram(contract.sierra_program),
24364
+ contract_class_version: contract.contract_class_version,
24365
+ entry_points_by_type: contract.entry_points_by_type,
24366
+ abi: contract.abi
24367
+ },
24368
+ resource_bounds: details.resourceBounds,
24369
+ tip: toHex(details.tip),
24370
+ paymaster_data: details.paymasterData.map((it) => toHex(it)),
24371
+ account_deployment_data: details.accountDeploymentData.map((it) => toHex(it)),
24372
+ nonce_data_availability_mode: details.nonceDataAvailabilityMode,
24373
+ fee_data_availability_mode: details.feeDataAvailabilityMode
24374
+ }
24375
+ });
24376
+ } else {
24377
+ throw Error("declare unspotted parameters");
24378
+ }
24379
+ return this.waitMode ? this.waitForTransaction((await promise).transaction_hash) : promise;
24380
+ }
24381
+ async deployAccount({ classHash, constructorCalldata, addressSalt, signature }, details) {
24382
+ let promise;
24383
+ if (!isV3Tx(details)) {
24384
+ promise = this.fetchEndpoint("starknet_addDeployAccountTransaction", {
24385
+ deploy_account_transaction: {
24386
+ constructor_calldata: CallData.toHex(constructorCalldata || []),
24387
+ class_hash: toHex(classHash),
24388
+ contract_address_salt: toHex(addressSalt || 0),
24389
+ type: rpcspec_0_7_exports.ETransactionType.DEPLOY_ACCOUNT,
24390
+ max_fee: toHex(details.maxFee || 0),
24391
+ version: rpcspec_0_7_exports.ETransactionVersion.V1,
24392
+ signature: signatureToHexArray(signature),
24393
+ nonce: toHex(details.nonce)
24394
+ }
24395
+ });
24396
+ } else {
24397
+ promise = this.fetchEndpoint("starknet_addDeployAccountTransaction", {
24398
+ deploy_account_transaction: {
24399
+ type: rpcspec_0_7_exports.ETransactionType.DEPLOY_ACCOUNT,
24400
+ version: rpcspec_0_7_exports.ETransactionVersion.V3,
24401
+ signature: signatureToHexArray(signature),
24402
+ nonce: toHex(details.nonce),
24403
+ contract_address_salt: toHex(addressSalt || 0),
24404
+ constructor_calldata: CallData.toHex(constructorCalldata || []),
24405
+ class_hash: toHex(classHash),
24406
+ resource_bounds: details.resourceBounds,
24407
+ tip: toHex(details.tip),
24408
+ paymaster_data: details.paymasterData.map((it) => toHex(it)),
24409
+ nonce_data_availability_mode: details.nonceDataAvailabilityMode,
24410
+ fee_data_availability_mode: details.feeDataAvailabilityMode
24411
+ }
24412
+ });
24413
+ }
24414
+ return this.waitMode ? this.waitForTransaction((await promise).transaction_hash) : promise;
24415
+ }
24416
+ callContract(call, blockIdentifier = this.blockIdentifier) {
24417
+ const block_id = new Block(blockIdentifier).identifier;
24418
+ return this.fetchEndpoint("starknet_call", {
24419
+ request: {
24420
+ contract_address: call.contractAddress,
24421
+ entry_point_selector: getSelectorFromName(call.entrypoint),
24422
+ calldata: CallData.toHex(call.calldata)
24423
+ },
24424
+ block_id
24425
+ });
24426
+ }
24427
+ /**
24428
+ * NEW: Estimate the fee for a message from L1
24429
+ * @param message Message From L1
24430
+ */
24431
+ estimateMessageFee(message, blockIdentifier = this.blockIdentifier) {
24432
+ const { from_address, to_address, entry_point_selector, payload } = message;
24433
+ const formattedMessage = {
24434
+ from_address: toHex(from_address),
24435
+ to_address: toHex(to_address),
24436
+ entry_point_selector: getSelector(entry_point_selector),
24437
+ payload: getHexStringArray(payload)
24438
+ };
24439
+ const block_id = new Block(blockIdentifier).identifier;
24440
+ return this.fetchEndpoint("starknet_estimateMessageFee", {
24441
+ message: formattedMessage,
24442
+ block_id
24443
+ });
24444
+ }
24445
+ /**
24446
+ * Returns an object about the sync status, or false if the node is not synching
24447
+ * @returns Object with the stats data
24448
+ */
24449
+ getSyncingStats() {
24450
+ return this.fetchEndpoint("starknet_syncing");
24451
+ }
24452
+ /**
24453
+ * Returns all events matching the given filter
24454
+ * @returns events and the pagination of the events
24455
+ */
24456
+ getEvents(eventFilter) {
24457
+ return this.fetchEndpoint("starknet_getEvents", { filter: eventFilter });
24458
+ }
24459
+ buildTransaction(invocation, versionType) {
24460
+ const defaultVersions = getVersionsByType(versionType);
24461
+ let details;
24462
+ if (!isV3Tx(invocation)) {
24463
+ details = {
24464
+ signature: signatureToHexArray(invocation.signature),
24465
+ nonce: toHex(invocation.nonce),
24466
+ max_fee: toHex(invocation.maxFee || 0)
24467
+ };
24468
+ } else {
24469
+ details = {
24470
+ signature: signatureToHexArray(invocation.signature),
24471
+ nonce: toHex(invocation.nonce),
24472
+ resource_bounds: invocation.resourceBounds,
24473
+ tip: toHex(invocation.tip),
24474
+ paymaster_data: invocation.paymasterData.map((it) => toHex(it)),
24475
+ nonce_data_availability_mode: invocation.nonceDataAvailabilityMode,
24476
+ fee_data_availability_mode: invocation.feeDataAvailabilityMode,
24477
+ account_deployment_data: invocation.accountDeploymentData.map((it) => toHex(it))
24478
+ };
24479
+ }
24480
+ if (invocation.type === "INVOKE_FUNCTION" /* INVOKE */) {
24481
+ return {
24482
+ // v0 v1 v3
24483
+ type: rpcspec_0_7_exports.ETransactionType.INVOKE,
24484
+ // TODO: Diff between sequencer and rpc invoke type
24485
+ sender_address: invocation.contractAddress,
24486
+ calldata: CallData.toHex(invocation.calldata),
24487
+ version: toHex(invocation.version || defaultVersions.v3),
24488
+ ...details
24489
+ };
24490
+ }
24491
+ if (invocation.type === "DECLARE" /* DECLARE */) {
24492
+ if (!isSierra(invocation.contract)) {
24493
+ return {
24494
+ type: invocation.type,
24495
+ contract_class: invocation.contract,
24496
+ sender_address: invocation.senderAddress,
24497
+ version: toHex(invocation.version || defaultVersions.v1),
24498
+ ...details
24499
+ };
24500
+ }
24501
+ return {
24502
+ // Cairo 1 - v2 v3
24503
+ type: invocation.type,
24504
+ contract_class: {
24505
+ ...invocation.contract,
24506
+ sierra_program: decompressProgram(invocation.contract.sierra_program)
24507
+ },
24508
+ compiled_class_hash: invocation.compiledClassHash || "",
24509
+ sender_address: invocation.senderAddress,
24510
+ version: toHex(invocation.version || defaultVersions.v3),
24511
+ ...details
24512
+ };
24513
+ }
24514
+ if (invocation.type === "DEPLOY_ACCOUNT" /* DEPLOY_ACCOUNT */) {
24515
+ const { account_deployment_data, ...restDetails } = details;
24516
+ return {
24517
+ type: invocation.type,
24518
+ constructor_calldata: CallData.toHex(invocation.constructorCalldata || []),
24519
+ class_hash: toHex(invocation.classHash),
24520
+ contract_address_salt: toHex(invocation.addressSalt || 0),
24521
+ version: toHex(invocation.version || defaultVersions.v3),
24522
+ ...restDetails
24523
+ };
24524
+ }
24525
+ throw Error("RPC buildTransaction received unknown TransactionType");
24526
+ }
24527
+ };
24528
+
24529
+ // src/utils/responseParser/rpc.ts
24530
+ var RPCResponseParser = class {
24531
+ parseGetBlockResponse(res) {
24532
+ return { status: "PENDING", ...res };
24533
+ }
24534
+ parseTransactionReceipt(res) {
24535
+ if ("actual_fee" in res && typeof res.actual_fee === "string") {
24536
+ return {
24537
+ ...res,
24538
+ actual_fee: {
24539
+ amount: res.actual_fee,
24540
+ unit: "FRI"
24541
+ }
24542
+ };
24543
+ }
24544
+ return res;
24545
+ }
24546
+ parseFeeEstimateResponse(res) {
24547
+ const val = res[0];
24548
+ return {
24549
+ overall_fee: toBigInt(val.overall_fee),
24550
+ gas_consumed: toBigInt(val.gas_consumed),
24551
+ gas_price: toBigInt(val.gas_price),
24552
+ unit: val.unit,
24553
+ suggestedMaxFee: estimatedFeeToMaxFee(val.overall_fee),
24554
+ resourceBounds: estimateFeeToBounds(val)
24555
+ };
24556
+ }
24557
+ parseFeeEstimateBulkResponse(res) {
24558
+ return res.map((val) => ({
24559
+ overall_fee: toBigInt(val.overall_fee),
24560
+ gas_consumed: toBigInt(val.gas_consumed),
24561
+ gas_price: toBigInt(val.gas_price),
24562
+ unit: val.unit,
24563
+ suggestedMaxFee: estimatedFeeToMaxFee(val.overall_fee),
24564
+ resourceBounds: estimateFeeToBounds(val)
24565
+ }));
24566
+ }
24567
+ parseSimulateTransactionResponse(res) {
24568
+ return res.map((it) => {
24569
+ return {
24570
+ ...it,
24571
+ suggestedMaxFee: estimatedFeeToMaxFee(BigInt(it.fee_estimation.overall_fee)),
24572
+ resourceBounds: estimateFeeToBounds(it.fee_estimation)
24573
+ };
24574
+ });
24575
+ }
24576
+ parseContractClassResponse(res) {
24577
+ return {
24578
+ ...res,
24579
+ abi: typeof res.abi === "string" ? JSON.parse(res.abi) : res.abi
24580
+ };
24581
+ }
24582
+ };
24583
+
24584
+ // src/provider/rpc.ts
24585
+ var RpcProvider = class {
24586
+ responseParser = new RPCResponseParser();
24587
+ channel;
24588
+ constructor(optionsOrProvider) {
24589
+ if (optionsOrProvider && "channel" in optionsOrProvider) {
24590
+ this.channel = optionsOrProvider.channel;
24591
+ } else {
24592
+ this.channel = new RpcChannel2({ ...optionsOrProvider, waitMode: false });
24593
+ }
24594
+ }
24595
+ fetch(method, params, id = 0) {
24596
+ return this.channel.fetch(method, params, id);
24597
+ }
24598
+ async getChainId() {
24599
+ return this.channel.getChainId();
24600
+ }
24601
+ async getSpecVersion() {
24602
+ return this.channel.getSpecVersion();
24603
+ }
24604
+ async getNonceForAddress(contractAddress, blockIdentifier) {
24605
+ return this.channel.getNonceForAddress(contractAddress, blockIdentifier);
24606
+ }
24607
+ async getBlock(blockIdentifier) {
24608
+ return this.channel.getBlockWithTxHashes(blockIdentifier).then(this.responseParser.parseGetBlockResponse);
24609
+ }
24610
+ /**
24611
+ * Get the most recent accepted block hash and number
24612
+ */
24613
+ async getBlockLatestAccepted() {
24614
+ return this.channel.getBlockLatestAccepted();
24615
+ }
24616
+ /**
24617
+ * Get the most recent accepted block number
24618
+ * redundant use getBlockLatestAccepted();
24619
+ * @returns Number of the latest block
24620
+ */
24621
+ async getBlockNumber() {
24622
+ return this.channel.getBlockNumber();
24623
+ }
24624
+ async getBlockWithTxHashes(blockIdentifier) {
24625
+ return this.channel.getBlockWithTxHashes(blockIdentifier);
24626
+ }
24627
+ async getBlockWithTxs(blockIdentifier) {
24628
+ return this.channel.getBlockWithTxs(blockIdentifier);
24629
+ }
24630
+ async getBlockWithReceipts(blockIdentifier) {
24631
+ if (this.channel instanceof rpc_0_6_exports.RpcChannel)
24632
+ throw new LibraryError("Unsupported method for RPC version");
24633
+ return this.channel.getBlockWithReceipts(blockIdentifier);
23944
24634
  }
23945
24635
  getStateUpdate = this.getBlockStateUpdate;
23946
24636
  async getBlockStateUpdate(blockIdentifier) {
@@ -24879,7 +25569,7 @@ var starknet = (() => {
24879
25569
  async signTransaction(transactions, details) {
24880
25570
  const compiledCalldata = getExecuteCalldata(transactions, details.cairoVersion);
24881
25571
  let msgHash;
24882
- if (Object.values(ETransactionVersion2).includes(details.version)) {
25572
+ if (Object.values(ETransactionVersion22).includes(details.version)) {
24883
25573
  const det = details;
24884
25574
  msgHash = calculateInvokeTransactionHash2({
24885
25575
  ...det,
@@ -24887,7 +25577,7 @@ var starknet = (() => {
24887
25577
  compiledCalldata,
24888
25578
  version: det.version
24889
25579
  });
24890
- } else if (Object.values(ETransactionVersion3).includes(details.version)) {
25580
+ } else if (Object.values(ETransactionVersion32).includes(details.version)) {
24891
25581
  const det = details;
24892
25582
  msgHash = calculateInvokeTransactionHash2({
24893
25583
  ...det,
@@ -24905,7 +25595,7 @@ var starknet = (() => {
24905
25595
  async signDeployAccountTransaction(details) {
24906
25596
  const compiledConstructorCalldata = CallData.compile(details.constructorCalldata);
24907
25597
  let msgHash;
24908
- if (Object.values(ETransactionVersion2).includes(details.version)) {
25598
+ if (Object.values(ETransactionVersion22).includes(details.version)) {
24909
25599
  const det = details;
24910
25600
  msgHash = calculateDeployAccountTransactionHash3({
24911
25601
  ...det,
@@ -24913,7 +25603,7 @@ var starknet = (() => {
24913
25603
  constructorCalldata: compiledConstructorCalldata,
24914
25604
  version: det.version
24915
25605
  });
24916
- } else if (Object.values(ETransactionVersion3).includes(details.version)) {
25606
+ } else if (Object.values(ETransactionVersion32).includes(details.version)) {
24917
25607
  const det = details;
24918
25608
  msgHash = calculateDeployAccountTransactionHash3({
24919
25609
  ...det,
@@ -24930,13 +25620,13 @@ var starknet = (() => {
24930
25620
  }
24931
25621
  async signDeclareTransaction(details) {
24932
25622
  let msgHash;
24933
- if (Object.values(ETransactionVersion2).includes(details.version)) {
25623
+ if (Object.values(ETransactionVersion22).includes(details.version)) {
24934
25624
  const det = details;
24935
25625
  msgHash = calculateDeclareTransactionHash3({
24936
25626
  ...det,
24937
25627
  version: det.version
24938
25628
  });
24939
- } else if (Object.values(ETransactionVersion3).includes(details.version)) {
25629
+ } else if (Object.values(ETransactionVersion32).includes(details.version)) {
24940
25630
  const det = details;
24941
25631
  msgHash = calculateDeclareTransactionHash3({
24942
25632
  ...det,
@@ -25060,7 +25750,7 @@ var starknet = (() => {
25060
25750
  async signTransaction(transactions, details) {
25061
25751
  const compiledCalldata = getExecuteCalldata(transactions, details.cairoVersion);
25062
25752
  let msgHash;
25063
- if (Object.values(ETransactionVersion2).includes(details.version)) {
25753
+ if (Object.values(ETransactionVersion22).includes(details.version)) {
25064
25754
  const det = details;
25065
25755
  msgHash = calculateInvokeTransactionHash2({
25066
25756
  ...det,
@@ -25068,7 +25758,7 @@ var starknet = (() => {
25068
25758
  compiledCalldata,
25069
25759
  version: det.version
25070
25760
  });
25071
- } else if (Object.values(ETransactionVersion3).includes(details.version)) {
25761
+ } else if (Object.values(ETransactionVersion32).includes(details.version)) {
25072
25762
  const det = details;
25073
25763
  msgHash = calculateInvokeTransactionHash2({
25074
25764
  ...det,
@@ -25086,7 +25776,7 @@ var starknet = (() => {
25086
25776
  async signDeployAccountTransaction(details) {
25087
25777
  const compiledConstructorCalldata = CallData.compile(details.constructorCalldata);
25088
25778
  let msgHash;
25089
- if (Object.values(ETransactionVersion2).includes(details.version)) {
25779
+ if (Object.values(ETransactionVersion22).includes(details.version)) {
25090
25780
  const det = details;
25091
25781
  msgHash = calculateDeployAccountTransactionHash3({
25092
25782
  ...det,
@@ -25094,7 +25784,7 @@ var starknet = (() => {
25094
25784
  constructorCalldata: compiledConstructorCalldata,
25095
25785
  version: det.version
25096
25786
  });
25097
- } else if (Object.values(ETransactionVersion3).includes(details.version)) {
25787
+ } else if (Object.values(ETransactionVersion32).includes(details.version)) {
25098
25788
  const det = details;
25099
25789
  msgHash = calculateDeployAccountTransactionHash3({
25100
25790
  ...det,
@@ -25111,13 +25801,13 @@ var starknet = (() => {
25111
25801
  }
25112
25802
  async signDeclareTransaction(details) {
25113
25803
  let msgHash;
25114
- if (Object.values(ETransactionVersion2).includes(details.version)) {
25804
+ if (Object.values(ETransactionVersion22).includes(details.version)) {
25115
25805
  const det = details;
25116
25806
  msgHash = calculateDeclareTransactionHash3({
25117
25807
  ...det,
25118
25808
  version: det.version
25119
25809
  });
25120
- } else if (Object.values(ETransactionVersion3).includes(details.version)) {
25810
+ } else if (Object.values(ETransactionVersion32).includes(details.version)) {
25121
25811
  const det = details;
25122
25812
  msgHash = calculateDeclareTransactionHash3({
25123
25813
  ...det,