Skip to content

Cairo Zeroable type not supported #1144

@PhilippeR26

Description

@PhilippeR26

Describe the bug
Try to interact with a Cairo function that use the type NonZero generates an Error.

To Reproduce
The contract 0x07be990e59999c2e4210d2e42f99c5701bb641da25ccccad14b206c2f0acb2c2 deployed in Sepolia Testnet has a pause function using NonZero :

{
    "name": "pause",
    "type": "function",
    "inputs": [
      {
        "name": "some_param",
        "type": "core::zeroable::NonZero::<core::integer::u128>"
      }
    ],
    "outputs": [],
    "state_mutability": "external"
  }

code :

const testAddress= "0x07be990e59999c2e4210d2e42f99c5701bb641da25ccccad14b206c2f0acb2c2";
const testContract = await myProvider.getClassAt(testAddress);
const myContract=new Contract( testContract.abi,testAddress,account0);
const res=await myContract.invoke("pause",[200]);

Error :

Error: Validate Unhandled: argument some_param, type core::zeroable::NonZero::<core::integer::u128>, value 200
    at /D/starknetFork/starknet.js/src/utils/calldata/validate.ts:320:15

Expected behavior
Full compatibility with core::zerable.

Screenshots
N/A
Desktop (please complete the following information):

  • Browser & version [e.g. chrome, safari, webworker] N/A
  • Node version [e.g. 16.0.1]
  • Starknet.js version v6.9.0
  • Network [devnet, testnet]

Additional context
I will investigate is there are other types in core::zeroable that fails also.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions