diff --git a/packages/typewriter-evm/test/utils.ts b/packages/typewriter-evm/test/utils.ts index 04503cb..db12afa 100644 --- a/packages/typewriter-evm/test/utils.ts +++ b/packages/typewriter-evm/test/utils.ts @@ -1,12 +1,8 @@ import { AbiFunction, AbiParameters, type Address, Hash, Hex } from "ox"; import type { StorageLayout } from "storage-layout"; -import type { Abi, Hex as ViemHex } from "viem"; +import { type Abi, encodeDeployData, type Hex as ViemHex } from "viem"; import { anvil } from "viem/chains"; -import { - SCHEDULER_ACCOUNT, - TEST_PUBLIC_CLIENT, - TEST_WALLET_CLIENT, -} from "./setup"; +import { SCHEDULER_ACCOUNT, TEST_WALLET_CLIENT } from "./setup"; export const TOKEN_ADDR = "0x0000000000000000000000000000000000000e20" as const; export const SCHEDULER_ADDR = SCHEDULER_ACCOUNT.address; @@ -143,16 +139,22 @@ export function callBurnData(target: Address.Address, count: bigint): Hex.Hex { return AbiFunction.encodeData(callBurn, [target, count]); } +// eth_sendRawTransactionSync returns the receipt once the tx is mined. Anvil +// replies to eth_sendRawTransaction before the receipt exists, and viem then +// polls for it every 4s. export async function deployArtifact( artifact: ForgeArtifact, + args: readonly unknown[] = [], ): Promise