starknet 5.13.2 → 5.14.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/dist/index.mjs CHANGED
@@ -2406,6 +2406,7 @@ __export(cairo_exports, {
2406
2406
  Uint: () => Uint,
2407
2407
  felt: () => felt,
2408
2408
  getArrayType: () => getArrayType,
2409
+ isCairo1Abi: () => isCairo1Abi,
2409
2410
  isCairo1Type: () => isCairo1Type,
2410
2411
  isLen: () => isLen,
2411
2412
  isTypeArray: () => isTypeArray,
@@ -2475,6 +2476,19 @@ var getArrayType = (type) => {
2475
2476
  }
2476
2477
  return type.replace("*", "");
2477
2478
  };
2479
+ function isCairo1Abi(abi) {
2480
+ const firstFunction = abi.find((entry) => entry.type === "function");
2481
+ if (!firstFunction) {
2482
+ throw new Error(`Error in ABI. No function in ABI.`);
2483
+ }
2484
+ if (firstFunction.inputs.length) {
2485
+ return isCairo1Type(firstFunction.inputs[0].type);
2486
+ }
2487
+ if (firstFunction.outputs.length) {
2488
+ return isCairo1Type(firstFunction.outputs[0].type);
2489
+ }
2490
+ throw new Error(`Error in ABI. No input/output in function ${firstFunction.name}`);
2491
+ }
2478
2492
  var uint256 = (it) => {
2479
2493
  const bn = BigInt(it);
2480
2494
  if (!isUint256(bn))
@@ -6186,6 +6200,9 @@ var Contract = class {
6186
6200
  calldata
6187
6201
  };
6188
6202
  }
6203
+ isCairo1() {
6204
+ return cairo_exports.isCairo1Abi(this.abi);
6205
+ }
6189
6206
  };
6190
6207
 
6191
6208
  // src/contract/interface.ts