starknet 8.8.0 → 8.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # [8.9.0](https://github.com/starknet-io/starknet.js/compare/v8.8.0...v8.9.0) (2025-11-13)
2
+
3
+ ### Features
4
+
5
+ - 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))
6
+
1
7
  # [8.8.0](https://github.com/starknet-io/starknet.js/compare/v8.7.0...v8.8.0) (2025-11-12)
2
8
 
3
9
  ### 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: {
@@ -5355,7 +5357,7 @@ declare abstract class ContractInterface {
5355
5357
  */
5356
5358
  abstract estimate(method: string, args?: ArgsOrCalldata, options?: {
5357
5359
  blockIdentifier?: BlockIdentifier;
5358
- }): Promise<EstimateFeeResponseOverhead>;
5360
+ }): Promise<EstimateFeeResponseOverhead | PaymasterFeeEstimate>;
5359
5361
  /**
5360
5362
  * Populate transaction data for a contract method call
5361
5363
  *
@@ -5483,7 +5485,7 @@ declare class Contract implements ContractInterface {
5483
5485
  waitForTransaction: false;
5484
5486
  }): Promise<InvokeFunctionResponse>;
5485
5487
  invoke(method: string, args?: ArgsOrCalldata, options?: ExecuteOptions): Promise<InvokeFunctionResponse>;
5486
- estimate(method: string, args?: ArgsOrCalldata, estimateDetails?: UniversalDetails): Promise<EstimateFeeResponseOverhead>;
5488
+ estimate(method: string, args?: ArgsOrCalldata, estimateDetails?: ExecuteOptions): Promise<EstimateFeeResponseOverhead | PaymasterFeeEstimate>;
5487
5489
  populate(method: string, args?: RawArgs): Call;
5488
5490
  parseEvents(receipt: GetTransactionReceiptResponse): ParsedEvents;
5489
5491
  isCairo1(): boolean;
@@ -1179,7 +1179,7 @@ var starknet = (() => {
1179
1179
  blake: void 0
1180
1180
  };
1181
1181
  var RPC_DEFAULT_NODES = {
1182
- SN_MAIN: [`https://starknet-mainnet.g.alchemy.com/starknet/version/rpc`],
1182
+ SN_MAIN: [`https://starknet-mainnet.g.alchemy.com/starknet/version/rpc/`],
1183
1183
  SN_SEPOLIA: [`https://starknet-sepolia.g.alchemy.com/starknet/version/rpc/`]
1184
1184
  };
1185
1185
  var PAYMASTER_RPC_NODES = {
@@ -21694,7 +21694,7 @@ ${indent}}` : "}";
21694
21694
  });
21695
21695
  }
21696
21696
  async invoke(method, args = [], options = {}) {
21697
- const { parseRequest = true, signature, waitForTransaction, ...RestInvokeOptions } = options;
21697
+ const { parseRequest = true, signature, waitForTransaction, ...restInvokeOptions } = options;
21698
21698
  assert(this.address !== null, "contract is not connected to an address");
21699
21699
  const calldata = getCompiledCalldata(args, () => {
21700
21700
  if (parseRequest) {
@@ -21710,8 +21710,20 @@ ${indent}}` : "}";
21710
21710
  entrypoint: method
21711
21711
  };
21712
21712
  if (isAccount(this.providerOrAccount)) {
21713
+ if (restInvokeOptions.paymasterDetails) {
21714
+ const myCall = {
21715
+ contractAddress: this.address,
21716
+ entrypoint: method,
21717
+ calldata: args
21718
+ };
21719
+ return this.providerOrAccount.executePaymasterTransaction(
21720
+ [myCall],
21721
+ restInvokeOptions.paymasterDetails,
21722
+ restInvokeOptions.maxFeeInGasToken
21723
+ );
21724
+ }
21713
21725
  const result = await this.providerOrAccount.execute(invocation, {
21714
- ...RestInvokeOptions
21726
+ ...restInvokeOptions
21715
21727
  });
21716
21728
  if (waitForTransaction) {
21717
21729
  const result2 = await this.providerOrAccount.waitForTransaction(result.transaction_hash);
@@ -21722,7 +21734,7 @@ ${indent}}` : "}";
21722
21734
  }
21723
21735
  return result;
21724
21736
  }
21725
- if (!RestInvokeOptions.nonce)
21737
+ if (!restInvokeOptions.nonce)
21726
21738
  throw new Error(`Manual nonce is required when invoking a function without an account`);
21727
21739
  logger.warn(`Invoking ${method} without an account.`);
21728
21740
  return this.providerOrAccount.invokeFunction(
@@ -21731,8 +21743,8 @@ ${indent}}` : "}";
21731
21743
  signature
21732
21744
  },
21733
21745
  {
21734
- ...RestInvokeOptions,
21735
- nonce: RestInvokeOptions.nonce
21746
+ ...restInvokeOptions,
21747
+ nonce: restInvokeOptions.nonce
21736
21748
  }
21737
21749
  );
21738
21750
  }
@@ -21743,6 +21755,17 @@ ${indent}}` : "}";
21743
21755
  }
21744
21756
  const invocation = this.populate(method, args);
21745
21757
  if (isAccount(this.providerOrAccount)) {
21758
+ if (estimateDetails.paymasterDetails) {
21759
+ const myCall = {
21760
+ contractAddress: this.address,
21761
+ entrypoint: method,
21762
+ calldata: args
21763
+ };
21764
+ return this.providerOrAccount.estimatePaymasterTransactionFee(
21765
+ [myCall],
21766
+ estimateDetails.paymasterDetails
21767
+ );
21768
+ }
21746
21769
  return this.providerOrAccount.estimateInvokeFee(invocation, estimateDetails);
21747
21770
  }
21748
21771
  throw Error("Contract must be connected to the account contract to estimate");