NEWTON

NEWTON


Popular tags

    Hey, is there anyway to debug Cairo contracts in hardhat environment? Something like hardhat console in solidity

    Asked

    4 months ago

    16

    views


    0

    Hey, is there anyway to debug Cairo contracts in hardhat environment? Something like hardhat console in Solidity?

      cairocairo-langhardhattestingdebug

    Newton

    asked

    4 months ago


    2 answers

    0

    If you're using Devnet, check this: https://github.com/Shard-Labs/starknet-devnet/#contract-debugging

    Basically, you can use print in cairo hints in your contract, and the printed lines will appear in Devnet's log (by default - stdout)

    If you're using starknet-hardhat-plugin, instead of spawning Devnet in a separate terminal, you can pass --starknet-network integrated-devnet to your hardhat test or hardhat run. In your hardhat config file, under stdout, you can specify STDOUT to have those print lines logged, as documented here: https://github.com/Shard-Labs/starknet-hardhat-plugin#runtime-network---integrated-devnet

    answered

    4 months ago

    0

    with protostar you can use %{ print() %} during tests

    answered

    4 months ago

    Your answer

    NEWTON

    NEWTON