Skip to content

Commit

Permalink
feat(cli): getApplicationAddress always return address
Browse files Browse the repository at this point in the history
  • Loading branch information
tuler committed Sep 18, 2024
1 parent 2532205 commit b81edf5
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions apps/cli/src/baseCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import chalk from "chalk";
import { execa } from "execa";
import fs from "fs";
import path from "path";
import { Address, Hash, isHash } from "viem";
import { Address, Hash, getAddress, isHash } from "viem";

import {
authorityHistoryPairFactoryAddress,
Expand Down Expand Up @@ -77,15 +77,18 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
this.log(`${chalk.green("?")} ${title} ${chalk.cyan(value)}`);
}

protected async getApplicationAddress(): Promise<Address | undefined> {
protected async getApplicationAddress(): Promise<Address> {
// fixed value, as we do deterministic deployment with a zero hash
return "0xab7528bb862fb57e8a2bcd567a2e929a0be56a5e";
return getAddress("0xab7528bb862fb57e8a2bcd567a2e929a0be56a5e");
}

protected async getAddressBook(): Promise<AddressBook> {
const applicationAddress = await this.getApplicationAddress();

// build rollups contracts address book
const contracts: AddressBook = {
AuthorityHistoryPairFactory: authorityHistoryPairFactoryAddress,
CartesiDApp: applicationAddress,
CartesiDAppFactory: cartesiDAppFactoryAddress,
DAppAddressRelay: dAppAddressRelayAddress,
EntryPointV06: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
Expand All @@ -110,11 +113,6 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
VerifyingPaymasterV07: "0xc5c97885C67F7361aBAfD2B95067a5bBdA603608",
};

// get dapp address
const applicationAddress = await this.getApplicationAddress();
if (applicationAddress) {
contracts["CartesiDApp"] = applicationAddress;
}
return contracts;
}

Expand Down

0 comments on commit b81edf5

Please sign in to comment.