deployContract
Deploy a contract on a given chain
import { deployContract } from "thirdweb/deployContract"; const address = await deployContract({ client, chain, bytecode: "0x...", constructorAbi: { inputs: [{ type: "uint256", name: "value" }], type: "constructor", }, constructorParams: [123],});
function deployContract<TConstructor extends AbiConstructor>(options: ({ bytecode: `0x${string}`; chain: { readonly blockExplorers?: Array<{ apiUrl?: string; name: string; url: string }>; readonly experimental?: { increaseZeroByteCount?: boolean }; readonly faucets?: Array<string>; readonly icon?: Icon; readonly id: number; readonly name?: string; readonly nativeCurrency?: { decimals?: number; name?: string; symbol?: string }; readonly rpc: string; readonly testnet?: true }; client: ThirdwebClient; constructorAbi: TConstructor; constructorParams: {[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType<TConstructor["inputs"][key<key>], AbiParameterKind>}[key]} extends readonly Array<AbiParameter> ? (readonly Array<AbiParameter>) & ({[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType<TConstructor["inputs"][key<key>], AbiParameterKind>}[key]}) : readonly Array<unknown> }) & ({ account: Account })) : Promise<string>
the deploy options
let options: ({ bytecode: `0x${string}`; chain: { readonly blockExplorers?: Array<{ apiUrl?: string; name: string; url: string }>; readonly experimental?: { increaseZeroByteCount?: boolean }; readonly faucets?: Array<string>; readonly icon?: Icon; readonly id: number; readonly name?: string; readonly nativeCurrency?: { decimals?: number; name?: string; symbol?: string }; readonly rpc: string; readonly testnet?: true }; client: ThirdwebClient; constructorAbi: TConstructor; constructorParams: {[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType<TConstructor["inputs"][key<key>], AbiParameterKind>}[key]} extends readonly Array<AbiParameter> ? (readonly Array<AbiParameter>) & ({[key in string | number | symbol] : {[key in string | number | symbol] : AbiParameterToPrimitiveType<TConstructor["inputs"][key<key>], AbiParameterKind>}[key]}) : readonly Array<unknown> }) & ({ account: Account })