starknet 8.8.0 → 8.9.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [8.9.1](https://github.com/starknet-io/starknet.js/compare/v8.9.0...v8.9.1) (2025-11-26)
2
+
3
+ ### Bug Fixes
4
+
5
+ - default value for starknetVersion has to be set ([8f3e675](https://github.com/starknet-io/starknet.js/commit/8f3e67538c981cc6880829e04413502f6973538e))
6
+
7
+ # [8.9.0](https://github.com/starknet-io/starknet.js/compare/v8.8.0...v8.9.0) (2025-11-13)
8
+
9
+ ### Features
10
+
11
+ - paymaster snip-29 in Contract class ([#1470](https://github.com/starknet-io/starknet.js/issues/1470)) ([a6b839e](https://github.com/starknet-io/starknet.js/commit/a6b839eec40c2d610e98edba6b838749c7e89053))
12
+
1
13
  # [8.8.0](https://github.com/starknet-io/starknet.js/compare/v8.7.0...v8.8.0) (2025-11-12)
2
14
 
3
15
  ### Bug Fixes
package/dist/index.d.ts CHANGED
@@ -3244,6 +3244,8 @@ type ExecuteOptions = Pick<CommonContractOptions, 'parseRequest'> & {
3244
3244
  * Deployer contract salt
3245
3245
  */
3246
3246
  salt?: string;
3247
+ paymasterDetails?: PaymasterDetails;
3248
+ maxFeeInGasToken?: BigNumberish;
3247
3249
  /**
3248
3250
  * Wait for transaction to be included in a block
3249
3251
  * @default false
@@ -3917,7 +3919,7 @@ declare const DEFAULT_GLOBAL_CONFIG: {
3917
3919
  blake: ((uint8Array: Uint8Array) => Uint8Array) | undefined;
3918
3920
  };
3919
3921
  declare const RPC_DEFAULT_NODES: {
3920
- readonly SN_MAIN: readonly ["https://starknet-mainnet.g.alchemy.com/starknet/version/rpc"];
3922
+ readonly SN_MAIN: readonly ["https://starknet-mainnet.g.alchemy.com/starknet/version/rpc/"];
3921
3923
  readonly SN_SEPOLIA: readonly ["https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/"];
3922
3924
  };
3923
3925
  declare const PAYMASTER_RPC_NODES: {
@@ -3937,6 +3939,7 @@ declare const SYSTEM_MESSAGES: {
3937
3939
  consensusFailed: string;
3938
3940
  txFailsBlockBuildingValidation: string;
3939
3941
  };
3942
+ declare const SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS: "0.14.1";
3940
3943
 
3941
3944
  declare const constants_ADDR_BOUND: typeof ADDR_BOUND;
3942
3945
  declare const constants_API_VERSION: typeof API_VERSION;
@@ -3966,6 +3969,7 @@ declare const constants_RANGE_U96: typeof RANGE_U96;
3966
3969
  declare const constants_RPC_DEFAULT_NODES: typeof RPC_DEFAULT_NODES;
3967
3970
  declare const constants_SNIP9_V1_INTERFACE_ID: typeof SNIP9_V1_INTERFACE_ID;
3968
3971
  declare const constants_SNIP9_V2_INTERFACE_ID: typeof SNIP9_V2_INTERFACE_ID;
3972
+ declare const constants_SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS: typeof SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS;
3969
3973
  declare const constants_SYSTEM_MESSAGES: typeof SYSTEM_MESSAGES;
3970
3974
  type constants_SupportedCairoVersion = SupportedCairoVersion;
3971
3975
  type constants_SupportedTransactionVersion = SupportedTransactionVersion;
@@ -3973,7 +3977,7 @@ declare const constants_TEXT_TO_FELT_MAX_LEN: typeof TEXT_TO_FELT_MAX_LEN;
3973
3977
  declare const constants_UDC: typeof UDC;
3974
3978
  declare const constants_ZERO: typeof ZERO;
3975
3979
  declare namespace constants {
3976
- export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, _BaseUrl as BaseUrl, constants_DEFAULT_GLOBAL_CONFIG as DEFAULT_GLOBAL_CONFIG, constants_HARDENING_4BYTES as HARDENING_4BYTES, constants_HARDENING_BYTE as HARDENING_BYTE, constants_IS_BROWSER as IS_BROWSER, constants_LegacyUDC as LegacyUDC, constants_MASK_250 as MASK_250, constants_MASK_31 as MASK_31, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, _NetworkName as NetworkName, constants_OutsideExecutionCallerAny as OutsideExecutionCallerAny, constants_PAYMASTER_RPC_NODES as PAYMASTER_RPC_NODES, constants_PRIME as PRIME, constants_RANGE_FELT as RANGE_FELT, constants_RANGE_I128 as RANGE_I128, constants_RANGE_I16 as RANGE_I16, constants_RANGE_I32 as RANGE_I32, constants_RANGE_I64 as RANGE_I64, constants_RANGE_I8 as RANGE_I8, constants_RANGE_U128 as RANGE_U128, constants_RANGE_U16 as RANGE_U16, constants_RANGE_U32 as RANGE_U32, constants_RANGE_U64 as RANGE_U64, constants_RANGE_U8 as RANGE_U8, constants_RANGE_U96 as RANGE_U96, constants_RPC_DEFAULT_NODES as RPC_DEFAULT_NODES, constants_SNIP9_V1_INTERFACE_ID as SNIP9_V1_INTERFACE_ID, constants_SNIP9_V2_INTERFACE_ID as SNIP9_V2_INTERFACE_ID, constants_SYSTEM_MESSAGES as SYSTEM_MESSAGES, _StarknetChainId as StarknetChainId, type constants_SupportedCairoVersion as SupportedCairoVersion, _SupportedRpcVersion as SupportedRpcVersion, type constants_SupportedTransactionVersion as SupportedTransactionVersion, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, _TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO };
3980
+ export { constants_ADDR_BOUND as ADDR_BOUND, constants_API_VERSION as API_VERSION, _BaseUrl as BaseUrl, constants_DEFAULT_GLOBAL_CONFIG as DEFAULT_GLOBAL_CONFIG, constants_HARDENING_4BYTES as HARDENING_4BYTES, constants_HARDENING_BYTE as HARDENING_BYTE, constants_IS_BROWSER as IS_BROWSER, constants_LegacyUDC as LegacyUDC, constants_MASK_250 as MASK_250, constants_MASK_31 as MASK_31, constants_MAX_STORAGE_ITEM_SIZE as MAX_STORAGE_ITEM_SIZE, _NetworkName as NetworkName, constants_OutsideExecutionCallerAny as OutsideExecutionCallerAny, constants_PAYMASTER_RPC_NODES as PAYMASTER_RPC_NODES, constants_PRIME as PRIME, constants_RANGE_FELT as RANGE_FELT, constants_RANGE_I128 as RANGE_I128, constants_RANGE_I16 as RANGE_I16, constants_RANGE_I32 as RANGE_I32, constants_RANGE_I64 as RANGE_I64, constants_RANGE_I8 as RANGE_I8, constants_RANGE_U128 as RANGE_U128, constants_RANGE_U16 as RANGE_U16, constants_RANGE_U32 as RANGE_U32, constants_RANGE_U64 as RANGE_U64, constants_RANGE_U8 as RANGE_U8, constants_RANGE_U96 as RANGE_U96, constants_RPC_DEFAULT_NODES as RPC_DEFAULT_NODES, constants_SNIP9_V1_INTERFACE_ID as SNIP9_V1_INTERFACE_ID, constants_SNIP9_V2_INTERFACE_ID as SNIP9_V2_INTERFACE_ID, constants_SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS as SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS, constants_SYSTEM_MESSAGES as SYSTEM_MESSAGES, _StarknetChainId as StarknetChainId, type constants_SupportedCairoVersion as SupportedCairoVersion, _SupportedRpcVersion as SupportedRpcVersion, type constants_SupportedTransactionVersion as SupportedTransactionVersion, constants_TEXT_TO_FELT_MAX_LEN as TEXT_TO_FELT_MAX_LEN, _TransactionHashPrefix as TransactionHashPrefix, constants_UDC as UDC, constants_ZERO as ZERO };
3977
3981
  }
3978
3982
 
3979
3983
  declare class RpcChannel$1 {
@@ -5355,7 +5359,7 @@ declare abstract class ContractInterface {
5355
5359
  */
5356
5360
  abstract estimate(method: string, args?: ArgsOrCalldata, options?: {
5357
5361
  blockIdentifier?: BlockIdentifier;
5358
- }): Promise<EstimateFeeResponseOverhead>;
5362
+ }): Promise<EstimateFeeResponseOverhead | PaymasterFeeEstimate>;
5359
5363
  /**
5360
5364
  * Populate transaction data for a contract method call
5361
5365
  *
@@ -5483,7 +5487,7 @@ declare class Contract implements ContractInterface {
5483
5487
  waitForTransaction: false;
5484
5488
  }): Promise<InvokeFunctionResponse>;
5485
5489
  invoke(method: string, args?: ArgsOrCalldata, options?: ExecuteOptions): Promise<InvokeFunctionResponse>;
5486
- estimate(method: string, args?: ArgsOrCalldata, estimateDetails?: UniversalDetails): Promise<EstimateFeeResponseOverhead>;
5490
+ estimate(method: string, args?: ArgsOrCalldata, estimateDetails?: ExecuteOptions): Promise<EstimateFeeResponseOverhead | PaymasterFeeEstimate>;
5487
5491
  populate(method: string, args?: RawArgs): Call;
5488
5492
  parseEvents(receipt: GetTransactionReceiptResponse): ParsedEvents;
5489
5493
  isCairo1(): boolean;
@@ -214,6 +214,7 @@ var starknet = (() => {
214
214
  RPC_DEFAULT_NODES: () => RPC_DEFAULT_NODES,
215
215
  SNIP9_V1_INTERFACE_ID: () => SNIP9_V1_INTERFACE_ID,
216
216
  SNIP9_V2_INTERFACE_ID: () => SNIP9_V2_INTERFACE_ID,
217
+ SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS: () => SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS,
217
218
  SYSTEM_MESSAGES: () => SYSTEM_MESSAGES,
218
219
  StarknetChainId: () => _StarknetChainId,
219
220
  SupportedRpcVersion: () => _SupportedRpcVersion,
@@ -1179,7 +1180,7 @@ var starknet = (() => {
1179
1180
  blake: void 0
1180
1181
  };
1181
1182
  var RPC_DEFAULT_NODES = {
1182
- SN_MAIN: [`https://starknet-mainnet.g.alchemy.com/starknet/version/rpc`],
1183
+ SN_MAIN: [`https://starknet-mainnet.g.alchemy.com/starknet/version/rpc/`],
1183
1184
  SN_SEPOLIA: [`https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/`]
1184
1185
  };
1185
1186
  var PAYMASTER_RPC_NODES = {
@@ -1199,6 +1200,7 @@ var starknet = (() => {
1199
1200
  consensusFailed: "Consensus failed to finalize the block proposal",
1200
1201
  txFailsBlockBuildingValidation: "Transaction fails block building validation"
1201
1202
  };
1203
+ var SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS = "0.14.1";
1202
1204
 
1203
1205
  // src/global/config.ts
1204
1206
  var Configuration = class _Configuration {
@@ -9938,8 +9940,8 @@ ${indent}}` : "}";
9938
9940
  }
9939
9941
  return computeLegacyContractClassHash(compiledContract);
9940
9942
  }
9941
- function computeCompiledClassHash(casm, starknetVersion) {
9942
- if (starknetVersion && compareVersions(starknetVersion, "0.14.1") >= 0) {
9943
+ function computeCompiledClassHash(casm, starknetVersion = SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS) {
9944
+ if (compareVersions(starknetVersion, SN_VERSION_IMPLEMENTING_BLAKE_FOR_COMPILED_CLASS) >= 0) {
9943
9945
  return computeCompiledClassHashBlake(casm);
9944
9946
  }
9945
9947
  return computeCompiledClassHashPoseidon(casm);
@@ -21694,7 +21696,7 @@ ${indent}}` : "}";
21694
21696
  });
21695
21697
  }
21696
21698
  async invoke(method, args = [], options = {}) {
21697
- const { parseRequest = true, signature, waitForTransaction, ...RestInvokeOptions } = options;
21699
+ const { parseRequest = true, signature, waitForTransaction, ...restInvokeOptions } = options;
21698
21700
  assert(this.address !== null, "contract is not connected to an address");
21699
21701
  const calldata = getCompiledCalldata(args, () => {
21700
21702
  if (parseRequest) {
@@ -21710,8 +21712,20 @@ ${indent}}` : "}";
21710
21712
  entrypoint: method
21711
21713
  };
21712
21714
  if (isAccount(this.providerOrAccount)) {
21715
+ if (restInvokeOptions.paymasterDetails) {
21716
+ const myCall = {
21717
+ contractAddress: this.address,
21718
+ entrypoint: method,
21719
+ calldata: args
21720
+ };
21721
+ return this.providerOrAccount.executePaymasterTransaction(
21722
+ [myCall],
21723
+ restInvokeOptions.paymasterDetails,
21724
+ restInvokeOptions.maxFeeInGasToken
21725
+ );
21726
+ }
21713
21727
  const result = await this.providerOrAccount.execute(invocation, {
21714
- ...RestInvokeOptions
21728
+ ...restInvokeOptions
21715
21729
  });
21716
21730
  if (waitForTransaction) {
21717
21731
  const result2 = await this.providerOrAccount.waitForTransaction(result.transaction_hash);
@@ -21722,7 +21736,7 @@ ${indent}}` : "}";
21722
21736
  }
21723
21737
  return result;
21724
21738
  }
21725
- if (!RestInvokeOptions.nonce)
21739
+ if (!restInvokeOptions.nonce)
21726
21740
  throw new Error(`Manual nonce is required when invoking a function without an account`);
21727
21741
  logger.warn(`Invoking ${method} without an account.`);
21728
21742
  return this.providerOrAccount.invokeFunction(
@@ -21731,8 +21745,8 @@ ${indent}}` : "}";
21731
21745
  signature
21732
21746
  },
21733
21747
  {
21734
- ...RestInvokeOptions,
21735
- nonce: RestInvokeOptions.nonce
21748
+ ...restInvokeOptions,
21749
+ nonce: restInvokeOptions.nonce
21736
21750
  }
21737
21751
  );
21738
21752
  }
@@ -21743,6 +21757,17 @@ ${indent}}` : "}";
21743
21757
  }
21744
21758
  const invocation = this.populate(method, args);
21745
21759
  if (isAccount(this.providerOrAccount)) {
21760
+ if (estimateDetails.paymasterDetails) {
21761
+ const myCall = {
21762
+ contractAddress: this.address,
21763
+ entrypoint: method,
21764
+ calldata: args
21765
+ };
21766
+ return this.providerOrAccount.estimatePaymasterTransactionFee(
21767
+ [myCall],
21768
+ estimateDetails.paymasterDetails
21769
+ );
21770
+ }
21746
21771
  return this.providerOrAccount.estimateInvokeFee(invocation, estimateDetails);
21747
21772
  }
21748
21773
  throw Error("Contract must be connected to the account contract to estimate");