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.js CHANGED
@@ -2483,6 +2483,7 @@ __export(cairo_exports, {
2483
2483
  Uint: () => Uint,
2484
2484
  felt: () => felt,
2485
2485
  getArrayType: () => getArrayType,
2486
+ isCairo1Abi: () => isCairo1Abi,
2486
2487
  isCairo1Type: () => isCairo1Type,
2487
2488
  isLen: () => isLen,
2488
2489
  isTypeArray: () => isTypeArray,
@@ -2552,6 +2553,19 @@ var getArrayType = (type) => {
2552
2553
  }
2553
2554
  return type.replace("*", "");
2554
2555
  };
2556
+ function isCairo1Abi(abi) {
2557
+ const firstFunction = abi.find((entry) => entry.type === "function");
2558
+ if (!firstFunction) {
2559
+ throw new Error(`Error in ABI. No function in ABI.`);
2560
+ }
2561
+ if (firstFunction.inputs.length) {
2562
+ return isCairo1Type(firstFunction.inputs[0].type);
2563
+ }
2564
+ if (firstFunction.outputs.length) {
2565
+ return isCairo1Type(firstFunction.outputs[0].type);
2566
+ }
2567
+ throw new Error(`Error in ABI. No input/output in function ${firstFunction.name}`);
2568
+ }
2555
2569
  var uint256 = (it) => {
2556
2570
  const bn = BigInt(it);
2557
2571
  if (!isUint256(bn))
@@ -6263,6 +6277,9 @@ var Contract = class {
6263
6277
  calldata
6264
6278
  };
6265
6279
  }
6280
+ isCairo1() {
6281
+ return cairo_exports.isCairo1Abi(this.abi);
6282
+ }
6266
6283
  };
6267
6284
 
6268
6285
  // src/contract/interface.ts