Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint and cosmetic changes #75

Merged
merged 4 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 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 All @@ -26,14 +26,7 @@ export type Flags<T extends typeof Command> = Interfaces.InferredFlags<
(typeof BaseCommand)["baseFlags"] & T["flags"]
>;
export type Args<T extends typeof Command> = Interfaces.InferredArgs<T["args"]>;

export type AddressBook = Record<string, Address>;
export interface DApp {
address: Address;
blockHash: Address;
blockNumber: number;
transactionHash: Address;
}

export abstract class BaseCommand<T extends typeof Command> extends Command {
protected flags!: Flags<T>;
Expand Down Expand Up @@ -77,15 +70,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 +106,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
8 changes: 1 addition & 7 deletions apps/cli/src/commands/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,7 @@ Update your application Dockerfile using one of the templates at https://github.
outputFilePath: string,
): Promise<void> {
// create docker tarball from app image
const { stdout: appCid } = await execa("docker", [
"image",
"save",
image,
"-o",
outputFilePath,
]);
await execa("docker", ["image", "save", image, "-o", outputFilePath]);
}

// this wraps the call to the sdk image with a one-shot approach
Expand Down
6 changes: 0 additions & 6 deletions apps/cli/test/helpers/init.js

This file was deleted.

194 changes: 0 additions & 194 deletions apps/cli/test/node/database.test.ts

This file was deleted.

Loading