starknet 7.0.1 → 7.1.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.
@@ -143,7 +143,7 @@ var starknet = (() => {
143
143
  __export(constants_exports, {
144
144
  ADDR_BOUND: () => ADDR_BOUND,
145
145
  API_VERSION: () => API_VERSION,
146
- BaseUrl: () => BaseUrl,
146
+ BaseUrl: () => _BaseUrl,
147
147
  DEFAULT_GLOBAL_CONFIG: () => DEFAULT_GLOBAL_CONFIG,
148
148
  HARDENING_4BYTES: () => HARDENING_4BYTES,
149
149
  HARDENING_BYTE: () => HARDENING_BYTE,
@@ -151,7 +151,7 @@ var starknet = (() => {
151
151
  MASK_250: () => MASK_250,
152
152
  MASK_31: () => MASK_31,
153
153
  MAX_STORAGE_ITEM_SIZE: () => MAX_STORAGE_ITEM_SIZE,
154
- NetworkName: () => NetworkName,
154
+ NetworkName: () => _NetworkName,
155
155
  OutsideExecutionCallerAny: () => OutsideExecutionCallerAny,
156
156
  PRIME: () => PRIME,
157
157
  RANGE_FELT: () => RANGE_FELT,
@@ -161,11 +161,11 @@ var starknet = (() => {
161
161
  SNIP9_V1_INTERFACE_ID: () => SNIP9_V1_INTERFACE_ID,
162
162
  SNIP9_V2_INTERFACE_ID: () => SNIP9_V2_INTERFACE_ID,
163
163
  SYSTEM_MESSAGES: () => SYSTEM_MESSAGES,
164
- StarknetChainId: () => StarknetChainId,
165
- SupportedRpcVersion: () => SupportedRpcVersion,
164
+ StarknetChainId: () => _StarknetChainId,
165
+ SupportedRpcVersion: () => _SupportedRpcVersion,
166
166
  TEXT_TO_FELT_MAX_LEN: () => TEXT_TO_FELT_MAX_LEN,
167
167
  TRANSACTION_VERSION: () => TRANSACTION_VERSION,
168
- TransactionHashPrefix: () => TransactionHashPrefix,
168
+ TransactionHashPrefix: () => _TransactionHashPrefix,
169
169
  UDC: () => UDC,
170
170
  ZERO: () => ZERO
171
171
  });
@@ -835,29 +835,6 @@ var starknet = (() => {
835
835
  var RANGE_FELT = range(ZERO, PRIME - 1n);
836
836
  var RANGE_I128 = range(-(2n ** 127n), 2n ** 127n - 1n);
837
837
  var RANGE_U128 = range(ZERO, 2n ** 128n - 1n);
838
- var BaseUrl = /* @__PURE__ */ ((BaseUrl2) => {
839
- BaseUrl2["SN_MAIN"] = "https://alpha-mainnet.starknet.io";
840
- BaseUrl2["SN_SEPOLIA"] = "https://alpha-sepolia.starknet.io";
841
- return BaseUrl2;
842
- })(BaseUrl || {});
843
- var NetworkName = /* @__PURE__ */ ((NetworkName2) => {
844
- NetworkName2["SN_MAIN"] = "SN_MAIN";
845
- NetworkName2["SN_SEPOLIA"] = "SN_SEPOLIA";
846
- return NetworkName2;
847
- })(NetworkName || {});
848
- var StarknetChainId = /* @__PURE__ */ ((StarknetChainId6) => {
849
- StarknetChainId6["SN_MAIN"] = "0x534e5f4d41494e";
850
- StarknetChainId6["SN_SEPOLIA"] = "0x534e5f5345504f4c4941";
851
- return StarknetChainId6;
852
- })(StarknetChainId || {});
853
- var TransactionHashPrefix = /* @__PURE__ */ ((TransactionHashPrefix2) => {
854
- TransactionHashPrefix2["DECLARE"] = "0x6465636c617265";
855
- TransactionHashPrefix2["DEPLOY"] = "0x6465706c6f79";
856
- TransactionHashPrefix2["DEPLOY_ACCOUNT"] = "0x6465706c6f795f6163636f756e74";
857
- TransactionHashPrefix2["INVOKE"] = "0x696e766f6b65";
858
- TransactionHashPrefix2["L1_HANDLER"] = "0x6c315f68616e646c6572";
859
- return TransactionHashPrefix2;
860
- })(TransactionHashPrefix || {});
861
838
  var UDC = {
862
839
  ADDRESS: "0x041a78e741e5af2fec34b695679bc6891742439f7afb8484ecd7766661ad02bf",
863
840
  ENTRYPOINT: "deployContract"
@@ -867,9 +844,37 @@ var starknet = (() => {
867
844
  var SNIP9_V2_INTERFACE_ID = "0x1d1144bb2138366ff28d8e9ab57456b1d332ac42196230c3a602003c89872";
868
845
  var HARDENING_BYTE = 128;
869
846
  var HARDENING_4BYTES = 2147483648n;
870
- var SupportedRpcVersion = {
847
+ var _BaseUrl = {
848
+ SN_MAIN: "https://alpha-mainnet.starknet.io",
849
+ SN_SEPOLIA: "https://alpha-sepolia.starknet.io"
850
+ };
851
+ var _NetworkName = {
852
+ SN_MAIN: "SN_MAIN",
853
+ SN_SEPOLIA: "SN_SEPOLIA"
854
+ };
855
+ var _StarknetChainId = {
856
+ SN_MAIN: "0x534e5f4d41494e",
857
+ // encodeShortString('SN_MAIN'),
858
+ SN_SEPOLIA: "0x534e5f5345504f4c4941"
859
+ // encodeShortString('SN_SEPOLIA')
860
+ };
861
+ var _TransactionHashPrefix = {
862
+ DECLARE: "0x6465636c617265",
863
+ // encodeShortString('declare'),
864
+ DEPLOY: "0x6465706c6f79",
865
+ // encodeShortString('deploy'),
866
+ DEPLOY_ACCOUNT: "0x6465706c6f795f6163636f756e74",
867
+ // encodeShortString('deploy_account'),
868
+ INVOKE: "0x696e766f6b65",
869
+ // encodeShortString('invoke'),
870
+ L1_HANDLER: "0x6c315f68616e646c6572"
871
+ // encodeShortString('l1_handler'),
872
+ };
873
+ var _SupportedRpcVersion = {
871
874
  0.7: "0.7",
872
- 0.8: "0.8"
875
+ 0.8: "0.8",
876
+ v07: "0.7",
877
+ v08: "0.8"
873
878
  };
874
879
  var DEFAULT_GLOBAL_CONFIG = {
875
880
  legacyMode: false,
@@ -1713,12 +1718,11 @@ ${indent}}` : "}";
1713
1718
  { name: "Calldata", type: "felt*" }
1714
1719
  ]
1715
1720
  };
1716
- var OutsideExecutionVersion = /* @__PURE__ */ ((OutsideExecutionVersion2) => {
1717
- OutsideExecutionVersion2["UNSUPPORTED"] = "0";
1718
- OutsideExecutionVersion2["V1"] = "1";
1719
- OutsideExecutionVersion2["V2"] = "2";
1720
- return OutsideExecutionVersion2;
1721
- })(OutsideExecutionVersion || {});
1721
+ var OutsideExecutionVersion = {
1722
+ UNSUPPORTED: "0",
1723
+ V1: "1",
1724
+ V2: "2"
1725
+ };
1722
1726
 
1723
1727
  // src/utils/batch/index.ts
1724
1728
  var BatchClient = class {
@@ -7008,7 +7012,7 @@ ${indent}}` : "}";
7008
7012
  }
7009
7013
  function calculateDeclareTransactionHash(classHash, senderAddress, version, maxFee, chainId, nonce, compiledClassHash) {
7010
7014
  return calculateTransactionHashCommon(
7011
- "0x6465636c617265" /* DECLARE */,
7015
+ _TransactionHashPrefix.DECLARE,
7012
7016
  version,
7013
7017
  senderAddress,
7014
7018
  0,
@@ -7021,7 +7025,7 @@ ${indent}}` : "}";
7021
7025
  function calculateDeployAccountTransactionHash(contractAddress, classHash, constructorCalldata, salt, version, maxFee, chainId, nonce) {
7022
7026
  const calldata = [classHash, salt, ...constructorCalldata];
7023
7027
  return calculateTransactionHashCommon(
7024
- "0x6465706c6f795f6163636f756e74" /* DEPLOY_ACCOUNT */,
7028
+ _TransactionHashPrefix.DEPLOY_ACCOUNT,
7025
7029
  version,
7026
7030
  contractAddress,
7027
7031
  0,
@@ -7033,7 +7037,7 @@ ${indent}}` : "}";
7033
7037
  }
7034
7038
  function calculateTransactionHash(contractAddress, version, calldata, maxFee, chainId, nonce) {
7035
7039
  return calculateTransactionHashCommon(
7036
- "0x696e766f6b65" /* INVOKE */,
7040
+ _TransactionHashPrefix.INVOKE,
7037
7041
  version,
7038
7042
  contractAddress,
7039
7043
  0,
@@ -7046,7 +7050,7 @@ ${indent}}` : "}";
7046
7050
  function calculateL2MessageTxHash(l1FromAddress, l2ToAddress, l2Selector, l2Calldata, l2ChainId, l1Nonce) {
7047
7051
  const payload = [l1FromAddress, ...l2Calldata];
7048
7052
  return calculateTransactionHashCommon(
7049
- "0x6c315f68616e646c6572" /* L1_HANDLER */,
7053
+ _TransactionHashPrefix.L1_HANDLER,
7050
7054
  0,
7051
7055
  l2ToAddress,
7052
7056
  getSelector(l2Selector),
@@ -7120,7 +7124,7 @@ ${indent}}` : "}";
7120
7124
  }
7121
7125
  function calculateDeployAccountTransactionHash2(contractAddress, classHash, compiledConstructorCalldata, salt, version, chainId, nonce, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
7122
7126
  return calculateTransactionHashCommon2(
7123
- "0x6465706c6f795f6163636f756e74" /* DEPLOY_ACCOUNT */,
7127
+ _TransactionHashPrefix.DEPLOY_ACCOUNT,
7124
7128
  version,
7125
7129
  contractAddress,
7126
7130
  chainId,
@@ -7135,7 +7139,7 @@ ${indent}}` : "}";
7135
7139
  }
7136
7140
  function calculateDeclareTransactionHash2(classHash, compiledClassHash, senderAddress, version, chainId, nonce, accountDeploymentData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
7137
7141
  return calculateTransactionHashCommon2(
7138
- "0x6465636c617265" /* DECLARE */,
7142
+ _TransactionHashPrefix.DECLARE,
7139
7143
  version,
7140
7144
  senderAddress,
7141
7145
  chainId,
@@ -7150,7 +7154,7 @@ ${indent}}` : "}";
7150
7154
  }
7151
7155
  function calculateInvokeTransactionHash(senderAddress, version, compiledCalldata, chainId, nonce, accountDeploymentData, nonceDataAvailabilityMode, feeDataAvailabilityMode, resourceBounds, tip, paymasterData) {
7152
7156
  return calculateTransactionHashCommon2(
7153
- "0x696e766f6b65" /* INVOKE */,
7157
+ _TransactionHashPrefix.INVOKE,
7154
7158
  version,
7155
7159
  senderAddress,
7156
7160
  chainId,
@@ -12121,7 +12125,7 @@ ${JSON.stringify(data, null, 2)}`;
12121
12125
  logger.info("Using default public node url, please provide nodeUrl in provider options!");
12122
12126
  }
12123
12127
  const rpcNodes = getDefaultNodes(rpcVersion ?? config2.get("rpcVersion"));
12124
- const nodes = rpcNodes[networkName ?? "SN_SEPOLIA" /* SN_SEPOLIA */];
12128
+ const nodes = rpcNodes[networkName ?? _NetworkName.SN_SEPOLIA];
12125
12129
  const randIdx = Math.floor(Math.random() * nodes.length);
12126
12130
  return nodes[randIdx];
12127
12131
  };
@@ -12380,7 +12384,7 @@ ${JSON.stringify(data, null, 2)}`;
12380
12384
  transactionRetryIntervalFallback,
12381
12385
  waitMode
12382
12386
  } = optionsOrProvider || {};
12383
- if (Object.values(NetworkName).includes(nodeUrl)) {
12387
+ if (Object.values(_NetworkName).includes(nodeUrl)) {
12384
12388
  this.nodeUrl = getDefaultNodeUrl(nodeUrl, optionsOrProvider?.default, "0.7");
12385
12389
  } else if (nodeUrl) {
12386
12390
  this.nodeUrl = nodeUrl;
@@ -12986,7 +12990,7 @@ ${JSON.stringify(data, null, 2)}`;
12986
12990
  transactionRetryIntervalFallback,
12987
12991
  waitMode
12988
12992
  } = optionsOrProvider || {};
12989
- if (Object.values(NetworkName).includes(nodeUrl)) {
12993
+ if (Object.values(_NetworkName).includes(nodeUrl)) {
12990
12994
  this.nodeUrl = getDefaultNodeUrl(nodeUrl, optionsOrProvider?.default, "0.8");
12991
12995
  } else if (nodeUrl) {
12992
12996
  this.nodeUrl = nodeUrl;
@@ -14513,7 +14517,7 @@ ${JSON.stringify(data, null, 2)}`;
14513
14517
  }
14514
14518
 
14515
14519
  // src/provider/rpc.ts
14516
- var RpcProvider = class _RpcProvider {
14520
+ var RpcProvider = class {
14517
14521
  responseParser;
14518
14522
  channel;
14519
14523
  constructor(optionsOrProvider) {
@@ -14540,16 +14544,17 @@ ${JSON.stringify(data, null, 2)}`;
14540
14544
  * auto configure channel based on provided node
14541
14545
  * leave space for other async before constructor
14542
14546
  */
14547
+ // NOTE: the generic T and 'this' reference are used so that the expanded class is generated when a mixin is applied
14543
14548
  static async create(optionsOrProvider) {
14544
14549
  const channel = new rpc_0_7_exports.RpcChannel({ ...optionsOrProvider });
14545
14550
  const spec = await channel.getSpecVersion();
14546
14551
  if (isVersion("0.7", spec)) {
14547
- return new _RpcProvider({ ...optionsOrProvider, specVersion: "0.7" });
14552
+ return new this({ ...optionsOrProvider, specVersion: "0.7" });
14548
14553
  }
14549
14554
  if (isVersion("0.8", spec)) {
14550
- return new _RpcProvider({ ...optionsOrProvider, specVersion: "0.8" });
14555
+ return new this({ ...optionsOrProvider, specVersion: "0.8" });
14551
14556
  }
14552
- throw new Error("unable to detect specification version");
14557
+ throw new LibraryError("Unable to detect specification version");
14553
14558
  }
14554
14559
  fetch(method, params, id = 0) {
14555
14560
  return this.channel.fetch(method, params, id);
@@ -15292,9 +15297,9 @@ ${JSON.stringify(data, null, 2)}`;
15292
15297
  };
15293
15298
  function getStarknetIdContract(chainId) {
15294
15299
  switch (chainId) {
15295
- case "0x534e5f4d41494e" /* SN_MAIN */:
15300
+ case _StarknetChainId.SN_MAIN:
15296
15301
  return StarknetIdContract.MAINNET;
15297
- case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
15302
+ case _StarknetChainId.SN_SEPOLIA:
15298
15303
  return StarknetIdContract.TESTNET_SEPOLIA;
15299
15304
  default:
15300
15305
  throw new Error("Starknet.id is not yet deployed on this network");
@@ -15306,9 +15311,9 @@ ${JSON.stringify(data, null, 2)}`;
15306
15311
  };
15307
15312
  function getStarknetIdIdentityContract(chainId) {
15308
15313
  switch (chainId) {
15309
- case "0x534e5f4d41494e" /* SN_MAIN */:
15314
+ case _StarknetChainId.SN_MAIN:
15310
15315
  return StarknetIdIdentityContract.MAINNET;
15311
- case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
15316
+ case _StarknetChainId.SN_SEPOLIA:
15312
15317
  return StarknetIdIdentityContract.TESTNET_SEPOLIA;
15313
15318
  default:
15314
15319
  throw new Error("Starknet.id verifier contract is not yet deployed on this network");
@@ -15317,9 +15322,9 @@ ${JSON.stringify(data, null, 2)}`;
15317
15322
  var StarknetIdMulticallContract = "0x034ffb8f4452df7a613a0210824d6414dbadcddce6c6e19bf4ddc9e22ce5f970";
15318
15323
  function getStarknetIdMulticallContract(chainId) {
15319
15324
  switch (chainId) {
15320
- case "0x534e5f4d41494e" /* SN_MAIN */:
15325
+ case _StarknetChainId.SN_MAIN:
15321
15326
  return StarknetIdMulticallContract;
15322
- case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
15327
+ case _StarknetChainId.SN_SEPOLIA:
15323
15328
  return StarknetIdMulticallContract;
15324
15329
  default:
15325
15330
  throw new Error("Starknet.id multicall contract is not yet deployed on this network");
@@ -15331,9 +15336,9 @@ ${JSON.stringify(data, null, 2)}`;
15331
15336
  };
15332
15337
  function getStarknetIdVerifierContract(chainId) {
15333
15338
  switch (chainId) {
15334
- case "0x534e5f4d41494e" /* SN_MAIN */:
15339
+ case _StarknetChainId.SN_MAIN:
15335
15340
  return StarknetIdVerifierContract.MAINNET;
15336
- case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
15341
+ case _StarknetChainId.SN_SEPOLIA:
15337
15342
  return StarknetIdVerifierContract.TESTNET_SEPOLIA;
15338
15343
  default:
15339
15344
  throw new Error("Starknet.id verifier contract is not yet deployed on this network");
@@ -15345,9 +15350,9 @@ ${JSON.stringify(data, null, 2)}`;
15345
15350
  };
15346
15351
  function getStarknetIdPfpContract(chainId) {
15347
15352
  switch (chainId) {
15348
- case "0x534e5f4d41494e" /* SN_MAIN */:
15353
+ case _StarknetChainId.SN_MAIN:
15349
15354
  return StarknetIdPfpContract.MAINNET;
15350
- case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
15355
+ case _StarknetChainId.SN_SEPOLIA:
15351
15356
  return StarknetIdPfpContract.TESTNET_SEPOLIA;
15352
15357
  default:
15353
15358
  throw new Error(
@@ -15361,9 +15366,9 @@ ${JSON.stringify(data, null, 2)}`;
15361
15366
  };
15362
15367
  function getStarknetIdPopContract(chainId) {
15363
15368
  switch (chainId) {
15364
- case "0x534e5f4d41494e" /* SN_MAIN */:
15369
+ case _StarknetChainId.SN_MAIN:
15365
15370
  return StarknetIdPopContract.MAINNET;
15366
- case "0x534e5f5345504f4c4941" /* SN_SEPOLIA */:
15371
+ case _StarknetChainId.SN_SEPOLIA:
15367
15372
  return StarknetIdPopContract.TESTNET_SEPOLIA;
15368
15373
  default:
15369
15374
  throw new Error(
@@ -16906,9 +16911,9 @@ ${JSON.stringify(data, null, 2)}`;
16906
16911
  const myOutsideTransactions = Array.isArray(outsideTransaction) ? outsideTransaction : [outsideTransaction];
16907
16912
  const multiCall = myOutsideTransactions.map((outsideTx) => {
16908
16913
  let entrypoint;
16909
- if (outsideTx.version === "1" /* V1 */) {
16914
+ if (outsideTx.version === OutsideExecutionVersion.V1) {
16910
16915
  entrypoint = "execute_from_outside";
16911
- } else if (outsideTx.version === "2" /* V2 */) {
16916
+ } else if (outsideTx.version === OutsideExecutionVersion.V2) {
16912
16917
  entrypoint = "execute_from_outside_v2";
16913
16918
  } else {
16914
16919
  throw new Error("Unsupported OutsideExecution version");
@@ -16961,6 +16966,12 @@ ${JSON.stringify(data, null, 2)}`;
16961
16966
  channel: this.channel.id
16962
16967
  });
16963
16968
  }
16969
+ /** @deprecated @hidden */
16970
+ // The deprecation tag is meant to discourage use, not to signal future removal
16971
+ // it should only be removed if the relationship with the corresponding Provider.create(...) method changes
16972
+ static async create() {
16973
+ throw new LibraryError("Not supported");
16974
+ }
16964
16975
  // provided version or contract based preferred transactionVersion
16965
16976
  getPreferredVersion(type12, type3) {
16966
16977
  if (this.transactionVersion === ETransactionVersion5.V3) return type3;
@@ -17325,12 +17336,12 @@ ${JSON.stringify(data, null, 2)}`;
17325
17336
  */
17326
17337
  async getSnip9Version() {
17327
17338
  if (await supportsInterface(this, this.address, SNIP9_V2_INTERFACE_ID)) {
17328
- return "2" /* V2 */;
17339
+ return OutsideExecutionVersion.V2;
17329
17340
  }
17330
17341
  if (await supportsInterface(this, this.address, SNIP9_V1_INTERFACE_ID)) {
17331
- return "1" /* V1 */;
17342
+ return OutsideExecutionVersion.V1;
17332
17343
  }
17333
- return "0" /* UNSUPPORTED */;
17344
+ return OutsideExecutionVersion.UNSUPPORTED;
17334
17345
  }
17335
17346
  /**
17336
17347
  * Verify if a SNIP-9 nonce has not yet been used by the account.