Skip to content

Commit

Permalink
refactor: move internal types under own subfolders
Browse files Browse the repository at this point in the history
* move deploy-loader types under own folder
* move journal types under own folder
* move execution types under own folder

Resolves #374.
  • Loading branch information
kanej committed Aug 3, 2023
1 parent 3584a78 commit abda196
Show file tree
Hide file tree
Showing 60 changed files with 263 additions and 271 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/new-api/internal/batcher.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Future, IgnitionModule } from "../types/module";

import { ExecutionStateMap, ExecutionStatus } from "./types/execution-state";
import { ExecutionStateMap, ExecutionStatus } from "./execution/types";
import { AdjacencyList } from "./utils/adjacency-list";
import { AdjacencyListConverter } from "./utils/adjacency-list-converter";
import { getFuturesFromModule } from "./utils/get-futures-from-module";
Expand Down
18 changes: 9 additions & 9 deletions packages/core/src/new-api/internal/deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ import {

import { Batcher } from "./batcher";
import { defaultConfig } from "./defaultConfig";
import { DeploymentLoader } from "./deployment-loader/types";
import { ExecutionEngine } from "./execution/execution-engine";
import { executionStateReducer } from "./execution/execution-state-reducer";
import { BasicExecutionStrategy } from "./execution/execution-strategy";
import { TranactionLookupTimerImpl } from "./execution/transaction-lookup-timer";
import { ModuleConstructor } from "./module-builder";
import { Reconciler } from "./reconciliation/reconciler";
import { ArtifactMap } from "./reconciliation/types";
import { isContractExecutionStateArray } from "./type-guards";
import { ChainDispatcher } from "./types/chain-dispatcher";
import { DeploymentLoader } from "./types/deployment-loader";
import { ExecutionStrategy } from "./types/execution-engine";
import {
ChainDispatcher,
ContractAtExecutionState,
DeploymentExecutionState,
ExecutionStateMap,
} from "./types/execution-state";
import { TransactionLookupTimer } from "./types/transaction-timer";
ExecutionStrategy,
TransactionLookupTimer,
} from "./execution/types";
import { ModuleConstructor } from "./module-builder";
import { Reconciler } from "./reconciliation/reconciler";
import { ArtifactMap } from "./reconciliation/types";
import { isContractExecutionStateArray } from "./type-guards";
import { assertIgnitionInvariant } from "./utils/assertions";
import { getFuturesFromModule } from "./utils/get-futures-from-module";
import { validate } from "./validation/validate";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { Artifact, ArtifactResolver, BuildInfo } from "../../types/artifact";
import { MemoryJournal } from "../journal/memory-journal";
import { DeploymentLoader } from "../types/deployment-loader";
import { Journal, JournalableMessage } from "../types/journal";
import { Journal, JournalableMessage } from "../journal/types";
import { assertIgnitionInvariant } from "../utils/assertions";

import { DeploymentLoader } from "./types";

/**
* Stores and loads deployment related information without making changes
* on disk, by either storing in memory or loading already existing files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ import path from "path";

import { Artifact, BuildInfo } from "../../types/artifact";
import { FileJournal } from "../journal/file-journal";
import { DeploymentLoader } from "../types/deployment-loader";
import { Journal, JournalableMessage } from "../types/journal";
import { Journal, JournalableMessage } from "../journal/types";

import { DeploymentLoader } from "./types";

export class FileDeploymentLoader implements DeploymentLoader {
private _journal: Journal;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Artifact, BuildInfo } from "../../types/artifact";

import { JournalableMessage } from "./journal";
import { JournalableMessage } from "../journal/types";

/**
* Read and write to the deployment storage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Contract, ContractFactory, ethers } from "ethers";
import { IgnitionError } from "../../../errors";
import { Adapters } from "../../types/adapters";
import { ArgumentType } from "../../types/module";
import { ChainDispatcher } from "../types/chain-dispatcher";
import { assertIgnitionInvariant } from "../utils/assertions";

import { AccountsState } from "./execution-engine";
import { ChainDispatcher } from "./types";

export class ChainDispatcherImpl implements ChainDispatcher {
private _accountsState: AccountsState;
Expand Down
28 changes: 13 additions & 15 deletions packages/core/src/new-api/internal/execution/execution-engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,15 @@ import {
NamedContractDeploymentFuture,
NamedLibraryDeploymentFuture,
} from "../../types/module";
import {
isCallExecutionState,
isContractAtExecutionState,
isDeploymentExecutionState,
isReadEventArgumentExecutionState,
isSendDataExecutionState,
isStaticCallExecutionState,
} from "../type-guards";
import { DeploymentLoader } from "../types/deployment-loader";
import {
ExecutionEngineState,
ExecutionStrategyContext,
} from "../types/execution-engine";
import { DeploymentLoader } from "../deployment-loader/types";
import {
ContractAtExecutionState,
DeploymentExecutionState,
ExecutionEngineState,
ExecutionStateMap,
ExecutionStatus,
} from "../types/execution-state";
ExecutionStrategyContext,
} from "../execution/types";
import {
ExecutionResultMessage,
ExecutionTimeout,
Expand All @@ -54,7 +44,15 @@ import {
OnchainTransactionReset,
StartRunMessage,
TransactionMessage,
} from "../types/journal";
} from "../journal/types";
import {
isCallExecutionState,
isContractAtExecutionState,
isDeploymentExecutionState,
isReadEventArgumentExecutionState,
isSendDataExecutionState,
isStaticCallExecutionState,
} from "../type-guards";
import { isAddress } from "../utils";
import { assertIgnitionInvariant } from "../utils/assertions";
import { getFuturesFromModule } from "../utils/get-futures-from-module";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
import { IgnitionError } from "../../../errors";
import {
CallExecutionState,
ContractAtExecutionState,
DeploymentExecutionState,
ExecutionState,
ExecutionStateMap,
ExecutionStatus,
OnchainStatuses,
ReadEventArgumentExecutionState,
SendDataExecutionState,
StaticCallExecutionState,
} from "../execution/types";
import {
isCallFunctionStartMessage,
isContractAtStartMessage,
Expand All @@ -11,19 +23,7 @@ import {
isTransactionMessage,
isWipeMessage,
} from "../journal/type-guards";
import {
CallExecutionState,
ContractAtExecutionState,
DeploymentExecutionState,
ExecutionState,
ExecutionStateMap,
ExecutionStatus,
OnchainStatuses,
ReadEventArgumentExecutionState,
SendDataExecutionState,
StaticCallExecutionState,
} from "../types/execution-state";
import { FutureStartMessage, JournalableMessage } from "../types/journal";
import { FutureStartMessage, JournalableMessage } from "../journal/types";
import { assertIgnitionInvariant } from "../utils/assertions";

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { ExecutionState } from "../execution/types";
import { isOnChainResultMessage } from "../journal/type-guards";
import { ExecutionState } from "../types/execution-state";
import {
ExecutionSuccess,
OnchainInteractionMessage,
OnchainResultMessage,
TransactionMessage,
} from "../types/journal";
} from "../journal/types";
export class ExecutionStategyCycler {
/**
* Given a execution strategy and history of on chain transactions
Expand Down
22 changes: 11 additions & 11 deletions packages/core/src/new-api/internal/execution/execution-strategy.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,14 @@
import { IgnitionError } from "../../../errors";
import {
isCallExecutionState,
isContractAtExecutionState,
isDeploymentExecutionState,
isReadEventArgumentExecutionState,
isSendDataExecutionState,
isStaticCallExecutionState,
} from "../type-guards";
import { ExecutionStrategy } from "../types/execution-engine";
import {
CallExecutionState,
ContractAtExecutionState,
DeploymentExecutionState,
ExecutionState,
ExecutionStrategy,
ReadEventArgumentExecutionState,
SendDataExecutionState,
StaticCallExecutionState,
} from "../types/execution-state";
} from "../execution/types";
import {
CallFunctionInteractionMessage,
CalledFunctionExecutionSuccess,
Expand All @@ -39,7 +31,15 @@ import {
SendDataInteractionMessage,
StaticCallExecutionSuccess,
StaticCallInteractionMessage,
} from "../types/journal";
} from "../journal/types";
import {
isCallExecutionState,
isContractAtExecutionState,
isDeploymentExecutionState,
isReadEventArgumentExecutionState,
isSendDataExecutionState,
isStaticCallExecutionState,
} from "../type-guards";
import { assertIgnitionInvariant } from "../utils/assertions";

export class BasicExecutionStrategy implements ExecutionStrategy {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/new-api/internal/execution/guards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
SendDataInteractionMessage,
StaticCallExecutionSuccess,
StaticCallInteractionMessage,
} from "../types/journal";
} from "../journal/types";

export function isExecutionResultMessage(
potential: JournalableMessage
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { IgnitionError } from "../../../errors";
import { OnchainState, OnchainStatuses } from "../execution/types";
import {
isOnchainCallFunctionSuccessMessage,
isOnchainContractAtSuccessMessage,
Expand All @@ -11,9 +12,8 @@ import {
isOnchainTransactionRequest,
isOnchainTransactionReset,
} from "../journal/type-guards";
import { TransactionMessage } from "../journal/types";
import { serializeReplacer } from "../journal/utils/serialize-replacer";
import { OnchainState, OnchainStatuses } from "../types/execution-state";
import { TransactionMessage } from "../types/journal";
import { assertIgnitionInvariant } from "../utils/assertions";

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
import { ethers } from "ethers";

import { IgnitionError } from "../../../errors";
import { ArgumentType } from "../../types/module";
import {
DeploymentExecutionState,
ExecutionEngineState,
OnchainStatuses,
} from "../execution/types";
import {
isOnChainResultMessage,
isOnchainFailureMessage,
isOnchainTransactionAccept,
isOnchainTransactionRequest,
isOnchainTransactionReset,
} from "../journal/type-guards";
import {
CallFunctionInteractionMessage,
DeployContractInteractionMessage,
Expand All @@ -22,21 +35,8 @@ import {
SendDataInteractionMessage,
StaticCallInteractionMessage,
TransactionMessage,
} from "../../internal/types/journal";
import { ArgumentType } from "../../types/module";
import {
isOnChainResultMessage,
isOnchainFailureMessage,
isOnchainTransactionAccept,
isOnchainTransactionRequest,
isOnchainTransactionReset,
} from "../journal/type-guards";
} from "../journal/types";
import { serializeReplacer } from "../journal/utils/serialize-replacer";
import { ExecutionEngineState } from "../types/execution-engine";
import {
DeploymentExecutionState,
OnchainStatuses,
} from "../types/execution-state";
import { assertIgnitionInvariant } from "../utils/assertions";
import { collectLibrariesAndLink } from "../utils/collectLibrariesAndLink";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sortBy from "lodash/sortBy";

import { Future } from "../../types/module";
import { ExecutionEngineState } from "../types/execution-engine";
import { ExecutionEngineState } from "../execution/types";
import { assertIgnitionInvariant } from "../utils/assertions";

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import {
TransactionLookup,
TransactionLookupTimer,
} from "../types/transaction-timer";
import { assertIgnitionInvariant } from "../utils/assertions";

import { TransactionLookup, TransactionLookupTimer } from "./types";

type TransactionLookupEntry = TransactionLookup & {
start: Date;
};
Expand Down
Loading

0 comments on commit abda196

Please sign in to comment.