starknet 10.4.0 → 10.5.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
+ # [10.5.0](https://github.com/starknet-io/starknet.js/compare/v10.4.0...v10.5.0) (2026-07-06)
2
+
3
+ ### Features
4
+
5
+ - add Contract.compile() to build calldata from the abi ([0cdcaf9](https://github.com/starknet-io/starknet.js/commit/0cdcaf927a75b4537ccc071794ae354f058c320c))
6
+
1
7
  # [10.4.0](https://github.com/starknet-io/starknet.js/compare/v10.3.3...v10.4.0) (2026-07-01)
2
8
 
3
9
  ### Features
package/dist/index.d.ts CHANGED
@@ -6278,6 +6278,27 @@ declare abstract class ContractInterface {
6278
6278
  * ```
6279
6279
  */
6280
6280
  abstract populate(method: string, args?: ArgsOrCalldata): Invocation;
6281
+ /**
6282
+ * Compile the calldata for a contract method, using the contract abi.
6283
+ *
6284
+ * Unlike {@link populate}, this returns only the compiled `Calldata` array, without wrapping it
6285
+ * in an `Invocation` object (no `contractAddress` nor `entrypoint`). It is the contract-bound
6286
+ * equivalent of `myCallData.compile(method, args)`.
6287
+ *
6288
+ * If `args` is already a compiled `Calldata`, it is returned as-is without recompilation.
6289
+ *
6290
+ * @param method - Name of the contract method, as defined in the abi
6291
+ * @param args - Method arguments as array (in abi order) or object (free order), or an already
6292
+ * compiled calldata
6293
+ * @returns The compiled calldata
6294
+ * @example
6295
+ * ```typescript
6296
+ * // 'amount' is a u256: the abi splits it into 2 felts automatically
6297
+ * const calldata = contract.compile('transfer', { recipient: '0x123', amount: 100n });
6298
+ * // calldata = ['0x123', '100', '0']
6299
+ * ```
6300
+ */
6301
+ abstract compile(method: string, args?: ArgsOrCalldata): Calldata;
6281
6302
  /**
6282
6303
  * Parse events from a transaction receipt using the contract's ABI
6283
6304
  *
@@ -6404,6 +6425,7 @@ declare class Contract implements ContractInterface {
6404
6425
  }): Promise<InvokeFunctionResponse>;
6405
6426
  invoke(method: string, args?: ArgsOrCalldata, options?: ExecuteOptions): Promise<InvokeFunctionResponse>;
6406
6427
  estimate(method: string, args?: ArgsOrCalldata, estimateDetails?: ExecuteOptions): Promise<EstimateFeeResponseOverhead | PaymasterFeeEstimate>;
6428
+ compile(method: string, args?: RawArgs): Calldata;
6407
6429
  populate(method: string, args?: RawArgs): Call;
6408
6430
  parseEvents(receipt: GetTransactionReceiptResponse): ParsedEvents;
6409
6431
  isCairo1(): boolean;
@@ -18548,12 +18548,14 @@ ${indent}}` : "}";
18548
18548
  }
18549
18549
  throw Error("Contract must be connected to the account contract to estimate");
18550
18550
  }
18551
+ compile(method, args = []) {
18552
+ return getCompiledCalldata(args, () => this.callData.compile(method, args));
18553
+ }
18551
18554
  populate(method, args = []) {
18552
- const calldata = getCompiledCalldata(args, () => this.callData.compile(method, args));
18553
18555
  return {
18554
18556
  contractAddress: this.address,
18555
18557
  entrypoint: method,
18556
- calldata
18558
+ calldata: this.compile(method, args)
18557
18559
  };
18558
18560
  }
18559
18561
  parseEvents(receipt) {