-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #326 from pimlicolabs/re-write
Make config simpler
- Loading branch information
Showing
22 changed files
with
829 additions
and
1,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { PimlicoEntryPointSimulationsDeployBytecode } from "@alto/types" | ||
import { | ||
type Chain, | ||
createWalletClient, | ||
type Hex, | ||
http, | ||
type PublicClient, | ||
type Transport | ||
} from "viem" | ||
import type { CamelCasedProperties } from "./parseArgs" | ||
import type { IOptions } from "@alto/cli" | ||
|
||
export const deploySimulationsContract = async ({ | ||
args, | ||
publicClient | ||
}: { | ||
args: CamelCasedProperties<IOptions> | ||
publicClient: PublicClient<Transport, Chain> | ||
}): Promise<Hex> => { | ||
const utilityPrivateKey = args.utilityPrivateKey | ||
if (!utilityPrivateKey) { | ||
throw new Error( | ||
"Cannot deploy entryPoint simulations without utility-private-key" | ||
) | ||
} | ||
|
||
const walletClient = createWalletClient({ | ||
transport: http(args.rpcUrl), | ||
account: utilityPrivateKey | ||
}) | ||
|
||
const deployHash = await walletClient.deployContract({ | ||
chain: publicClient.chain, | ||
abi: [], | ||
bytecode: PimlicoEntryPointSimulationsDeployBytecode | ||
}) | ||
|
||
const receipt = await publicClient.getTransactionReceipt({ | ||
hash: deployHash | ||
}) | ||
|
||
const simulationsContract = receipt.contractAddress | ||
|
||
if (simulationsContract === null || simulationsContract === undefined) { | ||
throw new Error("Failed to deploy simulationsContract") | ||
} | ||
|
||
return simulationsContract | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.