github 0xSpaceShard/starknet-hardhat-plugin v0.7.0

23 months ago

Breaking usage changes

  • Contract deployment needs to be done through an account (invoking UDC under the hood):
const contractFactory = starknet.getContractFactory(...);

// old
await contractFactory.deploy({ args }, { options });

// new
const account = ...;
await account.declare(contractFactory);
await account.deploy(contractFactory, { args }, { options });
  • Accounts:
    • starknet.getAccountFromAddress and starknet.deployAccount are history
    • Separate account creation and deployment
    • To be able to deploy an ArgentAccount, the chain you are using is expected to have ArgentAccount contracts declared. If you are using Devnet, this is most easily achievable by running a Devnet forked from e.g. alpha-goerli.
import { starknet } from "hardhat";
const account = await starknet.OpenZeppelinAccount.createAccount(...);
// somehow fund account.address
// ...
await account.deployAccount();

// alternatively
const account = await starknet.OpenZeppelinAccout.getAccountFromAddress(...);

// same for starknet.ArgentAccount - no longer requires separate initialization
  • Implicitly calculate invocation max fee:
// maxFee will be `1 + overhead` times the estimated fee; if overhead not provided, the default 0.5 is used.
// For example this is how a 40% overhead is specified:
await account.invoke(contract, "foo", { arg1: ... }, { overhead: 0.4 });
  • Fix return type of StarknetContract.decodeEvents (no longer a Promise)
  • Make --account-contract of hardhat starknet-verify a flag rather than a param
  • Remove redundant CLI commands
    • Namely: hh starknet-deploy, hh starknet-call, hh starknet-invoke, hh starknet-estimate-fee
    • Done after consulting with users - nobody was against removal
    • All those commands have their JS/TS counterparts
    • If you really need CLI, you can Starknet CLI
  • You are welcome to take a look into the examples in the docs and in the example repo.

Other usage changes

  • Adapt to StarkNet/cairo-lang 0.10.3
  • Integrated-devnet uses starknet-devnet v0.4.2
  • Predefine alpha-goerli2 network with the new chain ID:
    • npx hardhat test --starknet-network alpha-goerli2
  • Add getTransactionTrace function to hre.starknet
  • Add getClassHash method to StarknetContractFactory class.

Development related changes

  • Convert tests from bash to TS
  • Dynamically import HardhatRuntimeEnvironment where needed

Merged PRs

Full Changelog: v0.6.8...v0.7.0

Don't miss a new starknet-hardhat-plugin release

NewReleases is sending notifications on new releases.