Skip to content
Merged
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
16 changes: 11 additions & 5 deletions packages/format/src/types/program/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,9 @@ export namespace Context {
Invoke.isInvocation(value.invoke);

export namespace Invoke {
export type Invocation = Function.Identity &
(
export type Invocation = Function.Identity & {
activation?: string;
} & (
| Invocation.InternalCall
| Invocation.ExternalCall
| Invocation.ContractCreation
Expand All @@ -180,7 +181,8 @@ export namespace Context {
Function.isIdentity(value) &&
(Invocation.isInternalCall(value) ||
Invocation.isExternalCall(value) ||
Invocation.isContractCreation(value));
Invocation.isContractCreation(value)) &&
(!("activation" in value) || typeof value.activation === "string");

export namespace Invocation {
export interface InternalCall extends Function.Identity {
Expand Down Expand Up @@ -254,14 +256,16 @@ export namespace Context {
export interface Info extends Function.Identity {
data?: Function.PointerRef;
success?: Function.PointerRef;
activation?: string;
}

export const isInfo = (value: unknown): value is Info =>
Function.isIdentity(value) &&
typeof value === "object" &&
!!value &&
(!("data" in value) || Function.isPointerRef(value.data)) &&
(!("success" in value) || Function.isPointerRef(value.success));
(!("success" in value) || Function.isPointerRef(value.success)) &&
(!("activation" in value) || typeof value.activation === "string");
}

export interface Revert {
Expand All @@ -278,14 +282,16 @@ export namespace Context {
export interface Info extends Function.Identity {
reason?: Function.PointerRef;
panic?: number;
activation?: string;
}

export const isInfo = (value: unknown): value is Info =>
Function.isIdentity(value) &&
typeof value === "object" &&
!!value &&
(!("reason" in value) || Function.isPointerRef(value.reason)) &&
(!("panic" in value) || typeof value.panic === "number");
(!("panic" in value) || typeof value.panic === "number") &&
(!("activation" in value) || typeof value.activation === "string");
}

export interface Transform {
Expand Down
Loading