prepareDeterministicDeployTransaction

Deploy a contract deterministically - will maintain the same address across chains. This is meant to be used with published contracts configured with the 'direct deploy' method. Under the hood, this uses a keyless transaction with a common create2 factory.

Example

import { prepareDeterministicDeployTransaction } from "thirdweb/deploys";
import { sepolia } from "thirdweb/chains";
const tx = prepareDeterministicDeployTransaction({
client,
chain: sepolia,
contractId: "AccountFactory",
constructorParams: [123],
});
function prepareDeterministicDeployTransaction(options: {
chain: Readonly<ChainOptions & { rpc: string }>;
client: ThirdwebClient;
constructorParams?: Record<string, unknown>;
contractId: string;
publisher?: string;
salt?: string;
version?: string;

Parameters

the options to deploy the contract

Type

let options: {
chain: Readonly<ChainOptions & { rpc: string }>;
client: ThirdwebClient;
constructorParams?: Record<string, unknown>;
contractId: string;
publisher?: string;
salt?: string;
version?: string;
};

Returns

let returnType: PreparedTransaction<
[],
AbiFunction,
>;
  • the transaction to deploy the contract