@credenza-web3/contracts
v0.1.34
Published
Credenza Contracts
Downloads
624
Readme
Credenza3 Contracts
Getting the list of contract and types
Check https://unpkg.com/browse/@credenza-web3/contracts/
Using with credenza passport
Fetch artifact
const response = await fetch("https://unpkg.com/@credenza-web3/contracts/artifacts/{contractName}.json")
const data = await response.json()
Get provider from passport
const provider = await passport.getWeb3Provider()
Create contract instance
const contract = new ethers.Contract('0x...', data.abi, provider)
Advanced Sample Hardhat Project
yarn hardhat prepare-package
yarn hardhat accounts
yarn hardhat compile
yarn hardhat clean
yarn hardhat test
yarn hardhat node
yarn hardhat help
REPORT_GAS=true yarn hardhat test
yarn hardhat coverage
yarn hardhat run scripts/deploy.ts
TS_NODE_FILES=true yarn ts-node scripts/deploy.ts
yarn eslint '**/*.{js,ts}'
yarn eslint '**/*.{js,ts}' --fix
yarn prettier '**/*.{json,sol,md}' --check
yarn prettier '**/*.{json,sol,md}' --write
yarn solhint 'contracts/**/*.sol'
yarn solhint 'contracts/**/*.sol' --fix
Etherscan verification
In this project, copy the .env.example file to a file named .env, and then edit it to fill in the details. Enter your Etherscan API key, your Ropsten node URL (eg from Alchemy), and the private key of the account which will send the deployment transaction. With a valid .env file in place, first deploy your contract:
hardhat run --network ropsten scripts/deploy.ts
Then, copy the deployment address and paste it in to replace DEPLOYED_CONTRACT_ADDRESS
in this command:
npx hardhat verify --network ropsten DEPLOYED_CONTRACT_ADDRESS "Hello, Hardhat!"
Performance optimizations
For faster runs of your tests and scripts, consider skipping ts-node's type checking by setting the environment variable TS_NODE_TRANSPILE_ONLY
to 1
in hardhat's environment. For more details see the documentation.