Deploy contracts
Initialize ContractDeployer
ContractDeployerimport { DedotClient, WsProvider } from 'dedot';
import { ContractDeployer } from 'dedot/contract';
import { stringToHex } from 'dedot/utils'
import { FlipperContractApi } from './flipper';
import flipperMetadata from './flipper.json' assert { type: 'json' };
// instanciate an api client
const client = await DedotClient.new(new WsProvider('...'));
// load contract wasm or prepare a codeHash
const code = '0x...'; // wasm or polkavm (from .wasm or .polkavm files)
const existingCodeHash = '0x...' // uploaded wasm/polkavm
// create a ContractDeployer instance
const deployer = new ContractDeployer<FlipperContractApi>(client, flipperMetadata, code);
// OR from existingCodeHash
// const deployer = new ContractDeployer<FlipperContractApi>(client, flipperMetadata, existingCodeHash);[ink! v6 & solidity] Map the account before interacting with pallet-revive
ink! v6 & solidity] Map the account before interacting with pallet-reviveDry-run the contract instantiation
Error handling if contract constructor returning a Result<Self, Error>
Result<Self, Error>Submit contract instantiation transaction
Retrieve contract address & contract instance after deployment
Calculate contract address manually
Last updated