Deploy accounts on behalf of users
Last updated
Was this helpful?
Was this helpful?
type DeployAccountContractPayload = {
classHash: string;
constructorCalldata?: RawArgs;
addressSalt?: BigNumberish;
contractAddress?: string;
};const provider = new RpcProvider({
nodeUrl: "https://free-rpc.nethermind.io/sepolia-juno/rpc/v0_7",
});
const relayer = new Account(
provider,
process.env.REACT_APP_ADDRESS,
process.env.REACT_APP_PK
);const fees = await account.estimateAccountDeployFee(deployPayload, {version: "0x03"});
const deployDetails = {
maxFee: fees.suggestedMaxFee,
resourceBounds: fees.resourceBounds,
version: "0x03",
};const tx = await account.deployContract({
unique: false,
classHash: deployPayload.classHash,
constructorCalldata: deployPayload.constructorCalldata,
salt: deployPayload.addressSalt,
}, deployDetails)