deployContract

Deploy a contract on a given chain

Example

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(options: ({ bytecode: `0x${string}`; chain: Readonly<(ChainOptions) & ({ rpc: string })>; 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>

Parameters

the deploy options

Type

let options: ({ bytecode: `0x${string}`; chain: Readonly<(ChainOptions) & ({ rpc: string })>; 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 })

Returns

let returnType: Promise<string>;
  • a promise that resolves to the deployed contract address