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

refactor(crypto-transaction-evm-call): add interface types to break up cyclic dependency on evm #462

Merged
merged 3 commits into from
Mar 1, 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
20 changes: 20 additions & 0 deletions packages/contracts/source/contracts/evm/evm.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
export interface Instance {
transact(txContext: TransactionContext): Promise<TransactionResult>;
view(txContext: TransactionContext): Promise<TransactionResult>;
}

export interface TransactionContext {
caller: string;
/** Omit recipient when deploying a contract */
recipient?: string;
data: Buffer;
}

export interface TransactionResult {
gasUsed: bigint;
gasRefunded: bigint;
success: boolean;
deployedContractAddress?: string;
logs: any;
output?: Buffer;
}
1 change: 1 addition & 0 deletions packages/contracts/source/contracts/evm/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./evm";
1 change: 1 addition & 0 deletions packages/contracts/source/contracts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * as ApiSync from "./api-sync";
export * as Consensus from "./consensus";
export * as Crypto from "./crypto";
export * as Database from "./database";
export * as Evm from "./evm";
export * as Fee from "./fees";
export * as Kernel from "./kernel";
export * as NetworkGenerator from "./network-generator";
Expand Down
1 change: 0 additions & 1 deletion packages/crypto-transaction-evm-call/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"@mainsail/container": "workspace:*",
"@mainsail/contracts": "workspace:*",
"@mainsail/crypto-transaction": "workspace:*",
"@mainsail/evm": "workspace:*",
"@mainsail/kernel": "workspace:*",
"@mainsail/transactions": "workspace:*",
"@mainsail/utils": "workspace:*"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { inject, injectable } from "@mainsail/container";
import { Contracts, Identifiers } from "@mainsail/contracts";
import Transactions from "@mainsail/crypto-transaction";
import { Bindings } from "@mainsail/evm";
import { Utils as AppUtils } from "@mainsail/kernel";
import { Handlers } from "@mainsail/transactions";

Expand All @@ -10,7 +9,7 @@ import { EvmCallTransaction } from "../versions";
@injectable()
export class EvmCallTransactionHandler extends Handlers.TransactionHandler {
@inject(Identifiers.Evm.Instance)
private readonly evm!: Bindings.Evm;
private readonly evm!: Contracts.Evm.Instance;

public dependencies(): ReadonlyArray<Handlers.TransactionHandlerConstructor> {
return [];
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading