Skip to content

Commit

Permalink
Rename futures
Browse files Browse the repository at this point in the history
  • Loading branch information
alcuadrado committed Sep 14, 2023
1 parent bb020a7 commit c5b048d
Show file tree
Hide file tree
Showing 43 changed files with 275 additions and 281 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { ArtifactResolver } from "../../../../types/artifact";
import {
Future,
FutureType,
NamedContractAtFuture,
NamedContractDeploymentFuture,
NamedLibraryDeploymentFuture,
NamedArtifactContractAtFuture,
NamedArtifactContractDeploymentFuture,
NamedArtifactLibraryDeploymentFuture,
} from "../../../../types/module";
import { DeploymentLoader } from "../../../deployment-loader/types";

Expand Down Expand Up @@ -38,9 +38,9 @@ export async function saveArtifactsForFuture(

async function _storeArtifactAndBuildInfoAgainstDeployment(
future:
| NamedLibraryDeploymentFuture<string>
| NamedContractDeploymentFuture<string>
| NamedContractAtFuture<string>,
| NamedArtifactLibraryDeploymentFuture<string>
| NamedArtifactContractDeploymentFuture<string>
| NamedArtifactContractAtFuture<string>,
{
deploymentLoader,
artifactResolver,
Expand Down
58 changes: 29 additions & 29 deletions packages/core/src/internal/module-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import {
AccountRuntimeValue,
AddressResolvableFuture,
ArgumentType,
ArtifactContractAtFuture,
ArtifactContractDeploymentFuture,
ArtifactLibraryDeploymentFuture,
ContractAtFuture,
ContractDeploymentFuture,
LibraryDeploymentFuture,
CallableContractFuture,
ContractFuture,
FutureType,
Expand All @@ -27,11 +27,11 @@ import {
ModuleParameterRuntimeValue,
ModuleParameterType,
ModuleParameters,
NamedContractAtFuture,
NamedContractCallFuture,
NamedContractDeploymentFuture,
NamedLibraryDeploymentFuture,
NamedStaticCallFuture,
NamedArtifactContractAtFuture,
ContractCallFuture,
NamedArtifactContractDeploymentFuture,
NamedArtifactLibraryDeploymentFuture,
StaticCallFuture,
ReadEventArgumentFuture,
SendDataFuture,
} from "../types/module";
Expand Down Expand Up @@ -180,21 +180,21 @@ class IgnitionModuleBuilderImplementation<
contractName: ContractNameT,
args?: ArgumentType[],
options?: ContractOptions
): NamedContractDeploymentFuture<ContractNameT>;
): NamedArtifactContractDeploymentFuture<ContractNameT>;
public contract(
contractName: string,
artifact: Artifact,
args?: ArgumentType[],
options?: ContractOptions
): ArtifactContractDeploymentFuture;
): ContractDeploymentFuture;
public contract<ContractNameT extends string>(
contractName: ContractNameT,
artifactOrArgs?: Artifact | ArgumentType[],
argsorOptions?: ArgumentType[] | ContractAtOptions,
maybeOptions?: ContractOptions
):
| NamedContractDeploymentFuture<ContractNameT>
| ArtifactContractDeploymentFuture {
| NamedArtifactContractDeploymentFuture<ContractNameT>
| ContractDeploymentFuture {
if (artifactOrArgs === undefined || Array.isArray(artifactOrArgs)) {
if (Array.isArray(argsorOptions)) {
this._throwErrorWithStackTrace(
Expand Down Expand Up @@ -229,7 +229,7 @@ class IgnitionModuleBuilderImplementation<
contractName: ContractNameT,
args: ArgumentType[] = [],
options: ContractOptions = {}
): NamedContractDeploymentFuture<ContractNameT> {
): NamedArtifactContractDeploymentFuture<ContractNameT> {
const futureId = toDeploymentFutureId(
this._module.id,
options.id,
Expand Down Expand Up @@ -280,7 +280,7 @@ class IgnitionModuleBuilderImplementation<
artifact: Artifact,
args: ArgumentType[] = [],
options: ContractOptions = {}
): ArtifactContractDeploymentFuture {
): ContractDeploymentFuture {
const futureId = toDeploymentFutureId(
this._module.id,
options.id,
Expand Down Expand Up @@ -332,12 +332,12 @@ class IgnitionModuleBuilderImplementation<
public library<LibraryNameT extends string>(
libraryName: LibraryNameT,
options?: LibraryOptions
): NamedLibraryDeploymentFuture<LibraryNameT>;
): NamedArtifactLibraryDeploymentFuture<LibraryNameT>;
public library(
libraryName: string,
artifact: Artifact,
options?: LibraryOptions
): ArtifactLibraryDeploymentFuture;
): LibraryDeploymentFuture;
public library<LibraryNameT extends string>(
libraryName: LibraryNameT,
artifactOrOptions?: Artifact | LibraryOptions,
Expand All @@ -353,7 +353,7 @@ class IgnitionModuleBuilderImplementation<
private _namedArtifactLibrary<LibraryNameT extends string>(
libraryName: LibraryNameT,
options: LibraryOptions = {}
): NamedLibraryDeploymentFuture<LibraryNameT> {
): NamedArtifactLibraryDeploymentFuture<LibraryNameT> {
const futureId = toDeploymentFutureId(
this._module.id,
options.id,
Expand Down Expand Up @@ -395,7 +395,7 @@ class IgnitionModuleBuilderImplementation<
libraryName: string,
artifact: Artifact,
options: LibraryOptions = {}
): ArtifactLibraryDeploymentFuture {
): LibraryDeploymentFuture {
const futureId = toDeploymentFutureId(
this._module.id,
options.id,
Expand Down Expand Up @@ -439,7 +439,7 @@ class IgnitionModuleBuilderImplementation<
functionName: FunctionNameT,
args: ArgumentType[] = [],
options: CallOptions = {}
): NamedContractCallFuture<ContractNameT, FunctionNameT> {
): ContractCallFuture<ContractNameT, FunctionNameT> {
const futureId = toCallFutureId(
this._module.id,
options.id,
Expand Down Expand Up @@ -489,7 +489,7 @@ class IgnitionModuleBuilderImplementation<
args: ArgumentType[] = [],
nameOrIndex: string | number = 0,
options: StaticCallOptions = {}
): NamedStaticCallFuture<ContractNameT, FunctionNameT> {
): StaticCallFuture<ContractNameT, FunctionNameT> {
const futureId = toCallFutureId(
this._module.id,
options.id,
Expand Down Expand Up @@ -538,7 +538,7 @@ class IgnitionModuleBuilderImplementation<
| AddressResolvableFuture
| ModuleParameterRuntimeValue<string>,
options?: ContractAtOptions
): NamedContractAtFuture<ContractNameT>;
): NamedArtifactContractAtFuture<ContractNameT>;
public contractAt(
contractName: string,
address:
Expand All @@ -547,7 +547,7 @@ class IgnitionModuleBuilderImplementation<
| ModuleParameterRuntimeValue<string>,
artifact: Artifact,
options?: ContractAtOptions
): ArtifactContractAtFuture;
): ContractAtFuture;
public contractAt<ContractNameT extends string>(
contractName: ContractNameT,
address:
Expand Down Expand Up @@ -580,7 +580,7 @@ class IgnitionModuleBuilderImplementation<
| AddressResolvableFuture
| ModuleParameterRuntimeValue<string>,
options: ContractAtOptions = {}
): NamedContractAtFuture<ContractNameT> {
): NamedArtifactContractAtFuture<ContractNameT> {
const futureId = toDeploymentFutureId(
this._module.id,
options.id,
Expand Down Expand Up @@ -622,7 +622,7 @@ class IgnitionModuleBuilderImplementation<
| ModuleParameterRuntimeValue<string>,
artifact: Artifact,
options: ContractAtOptions = {}
): ArtifactContractAtFuture {
): ContractAtFuture {
const futureId = toDeploymentFutureId(
this._module.id,
options.id,
Expand Down Expand Up @@ -660,10 +660,10 @@ class IgnitionModuleBuilderImplementation<

public readEventArgument(
futureToReadFrom:
| NamedContractDeploymentFuture<string>
| ArtifactContractDeploymentFuture
| NamedArtifactContractDeploymentFuture<string>
| ContractDeploymentFuture
| SendDataFuture
| NamedContractCallFuture<string, string>,
| ContractCallFuture<string, string>,
eventName: string,
nameOrIndex: string | number,
options: ReadEventArgumentOptions = {}
Expand All @@ -683,8 +683,8 @@ class IgnitionModuleBuilderImplementation<
"contract" in futureToReadFrom
? futureToReadFrom.contract
: (futureToReadFrom as
| ArtifactContractDeploymentFuture
| NamedContractDeploymentFuture<string>);
| ContractDeploymentFuture
| NamedArtifactContractDeploymentFuture<string>);

const emitter = options.emitter ?? contractToReadFrom;

Expand Down
38 changes: 19 additions & 19 deletions packages/core/src/internal/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ import {
AccountRuntimeValue,
AddressResolvableFuture,
ArgumentType,
ArtifactContractAtFuture,
ArtifactContractDeploymentFuture,
ArtifactLibraryDeploymentFuture,
ContractAtFuture,
ContractDeploymentFuture,
LibraryDeploymentFuture,
ContractFuture,
Future,
FutureType,
IgnitionModule,
IgnitionModuleResult,
ModuleParameterRuntimeValue,
ModuleParameterType,
NamedContractAtFuture,
NamedContractCallFuture,
NamedContractDeploymentFuture,
NamedLibraryDeploymentFuture,
NamedStaticCallFuture,
NamedArtifactContractAtFuture,
ContractCallFuture,
NamedArtifactContractDeploymentFuture,
NamedArtifactLibraryDeploymentFuture,
StaticCallFuture,
ReadEventArgumentFuture,
RuntimeValueType,
SendDataFuture,
Expand Down Expand Up @@ -54,7 +54,7 @@ export class NamedContractDeploymentFutureImplementation<
ContractNameT extends string
>
extends BaseFutureImplementation<FutureType.NAMED_ARTIFACT_CONTRACT_DEPLOYMENT>
implements NamedContractDeploymentFuture<ContractNameT>
implements NamedArtifactContractDeploymentFuture<ContractNameT>
{
constructor(
public readonly id: string,
Expand All @@ -73,7 +73,7 @@ export class ArtifactContractDeploymentFutureImplementation<
ContractNameT extends string
>
extends BaseFutureImplementation<FutureType.CONTRACT_DEPLOYMENT>
implements ArtifactContractDeploymentFuture
implements ContractDeploymentFuture
{
constructor(
public readonly id: string,
Expand All @@ -93,7 +93,7 @@ export class NamedLibraryDeploymentFutureImplementation<
LibraryNameT extends string
>
extends BaseFutureImplementation<FutureType.NAMED_ARTIFACT_LIBRARY_DEPLOYMENT>
implements NamedLibraryDeploymentFuture<LibraryNameT>
implements NamedArtifactLibraryDeploymentFuture<LibraryNameT>
{
constructor(
public readonly id: string,
Expand All @@ -110,7 +110,7 @@ export class ArtifactLibraryDeploymentFutureImplementation<
LibraryNameT extends string
>
extends BaseFutureImplementation<FutureType.LIBRARY_DEPLOYMENT>
implements ArtifactLibraryDeploymentFuture
implements LibraryDeploymentFuture
{
constructor(
public readonly id: string,
Expand All @@ -129,7 +129,7 @@ export class NamedContractCallFutureImplementation<
FunctionNameT extends string
>
extends BaseFutureImplementation<FutureType.CONTRACT_CALL>
implements NamedContractCallFuture<ContractNameT, FunctionNameT>
implements ContractCallFuture<ContractNameT, FunctionNameT>
{
constructor(
public readonly id: string,
Expand All @@ -149,7 +149,7 @@ export class NamedStaticCallFutureImplementation<
FunctionNameT extends string
>
extends BaseFutureImplementation<FutureType.STATIC_CALL>
implements NamedStaticCallFuture<ContractNameT, FunctionNameT>
implements StaticCallFuture<ContractNameT, FunctionNameT>
{
constructor(
public readonly id: string,
Expand All @@ -166,7 +166,7 @@ export class NamedStaticCallFutureImplementation<

export class NamedContractAtFutureImplementation<ContractNameT extends string>
extends BaseFutureImplementation<FutureType.NAMED_ARTIFACT_CONTRACT_AT>
implements NamedContractAtFuture<ContractNameT>
implements NamedArtifactContractAtFuture<ContractNameT>
{
constructor(
public readonly id: string,
Expand All @@ -183,7 +183,7 @@ export class NamedContractAtFutureImplementation<ContractNameT extends string>

export class ArtifactContractAtFutureImplementation
extends BaseFutureImplementation<FutureType.CONTRACT_AT>
implements ArtifactContractAtFuture
implements ContractAtFuture
{
constructor(
public readonly id: string,
Expand All @@ -207,10 +207,10 @@ export class ReadEventArgumentFutureImplementation
public readonly id: string,
public readonly module: IgnitionModuleImplementation,
public readonly futureToReadFrom:
| NamedContractDeploymentFuture<string>
| ArtifactContractDeploymentFuture
| NamedArtifactContractDeploymentFuture<string>
| ContractDeploymentFuture
| SendDataFuture
| NamedContractCallFuture<string, string>,
| ContractCallFuture<string, string>,
public readonly eventName: string,
public readonly nameOrIndex: string | number,
public readonly emitter: ContractFuture<string>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { ArtifactContractAtFuture } from "../../../types/module";
import { ContractAtFuture } from "../../../types/module";
import { ContractAtExecutionState } from "../../execution/types/execution-state";
import { reconcileAddress } from "../helpers/reconcile-address";
import { reconcileArtifacts } from "../helpers/reconcile-artifacts";
import { reconcileContractName } from "../helpers/reconcile-contract-name";
import { ReconciliationContext, ReconciliationFutureResult } from "../types";

export async function reconcileArtifactContractAt(
future: ArtifactContractAtFuture,
future: ContractAtFuture,
executionState: ContractAtExecutionState,
context: ReconciliationContext
): Promise<ReconciliationFutureResult> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArtifactContractDeploymentFuture } from "../../../types/module";
import { ContractDeploymentFuture } from "../../../types/module";
import { DeploymentExecutionState } from "../../execution/types/execution-state";
import { reconcileArguments } from "../helpers/reconcile-arguments";
import { reconcileArtifacts } from "../helpers/reconcile-artifacts";
Expand All @@ -9,7 +9,7 @@ import { reconcileValue } from "../helpers/reconcile-value";
import { ReconciliationContext, ReconciliationFutureResult } from "../types";

export async function reconcileArtifactContractDeployment(
future: ArtifactContractDeploymentFuture,
future: ContractDeploymentFuture,
executionState: DeploymentExecutionState,
context: ReconciliationContext
): Promise<ReconciliationFutureResult> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ArtifactLibraryDeploymentFuture } from "../../../types/module";
import { LibraryDeploymentFuture } from "../../../types/module";
import { DeploymentExecutionState } from "../../execution/types/execution-state";
import { reconcileArtifacts } from "../helpers/reconcile-artifacts";
import { reconcileContractName } from "../helpers/reconcile-contract-name";
Expand All @@ -7,7 +7,7 @@ import { reconcileLibraries } from "../helpers/reconcile-libraries";
import { ReconciliationContext, ReconciliationFutureResult } from "../types";

export async function reconcileArtifactLibraryDeployment(
future: ArtifactLibraryDeploymentFuture,
future: LibraryDeploymentFuture,
executionState: DeploymentExecutionState,
context: ReconciliationContext
): Promise<ReconciliationFutureResult> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { NamedContractAtFuture } from "../../../types/module";
import { NamedArtifactContractAtFuture } from "../../../types/module";
import { ContractAtExecutionState } from "../../execution/types/execution-state";
import { reconcileAddress } from "../helpers/reconcile-address";
import { reconcileArtifacts } from "../helpers/reconcile-artifacts";
import { reconcileContractName } from "../helpers/reconcile-contract-name";
import { ReconciliationContext, ReconciliationFutureResult } from "../types";

export async function reconcileNamedContractAt(
future: NamedContractAtFuture<string>,
future: NamedArtifactContractAtFuture<string>,
executionState: ContractAtExecutionState,
context: ReconciliationContext
): Promise<ReconciliationFutureResult> {
Expand Down
Loading

0 comments on commit c5b048d

Please sign in to comment.