Skip to content

Endo API documentation - v0.2.0 / Exports / @endo/patterns / GuardMakers

Interface: GuardMakers ​

@endo/patterns.GuardMakers

Table of contents ​

Properties ​

Properties ​

await ​

• await: (argPattern: any) => AwaitArgGuard

Guard a positional parameter in M.callWhen, awaiting it and matching its fulfillment against the provided pattern. For example, M.callWhen(M.await(M.nat())).returns() will await the first argument, check that its fulfillment satisfies M.nat(), and only then call the guarded method with that fulfillment. If the argument is a non-promise value that already satisfies M.nat(), then the result of awaiting it will still pass, and M.callWhen will still delay the guarded method call to a future turn. If the argument is a promise that rejects rather than fulfills, or if its fulfillment does not satisfy the nested pattern, then the call is rejected without ever invoking the guarded method.

Any AwaitArgGuard may not appear as a rest pattern or a result pattern, only a top-level single parameter pattern.

Type declaration ​

▸ (argPattern): AwaitArgGuard

Parameters ​
NameType
argPatternany
Returns ​

AwaitArgGuard

Defined in ​

patterns/src/types.js:506


call ​

• call: (...argPatterns: any[]) => MethodGuardMaker

Guard a synchronous call. Arguments not guarded by M.raw() are automatically hardened and must be at least Passable.

Type declaration ​

▸ (...argPatterns): MethodGuardMaker

Parameters ​
NameType
...argPatternsany[]
Returns ​

MethodGuardMaker

Defined in ​

patterns/src/types.js:498


callWhen ​

• callWhen: (...argGuards: any[]) => MethodGuardMaker

Guard an async call. Arguments not guarded by M.raw() are automatically hardened and must be at least Passable.

Type declaration ​

▸ (...argGuards): MethodGuardMaker

Parameters ​
NameType
...argGuardsany[]
Returns ​

MethodGuardMaker

Defined in ​

patterns/src/types.js:502


interface ​

• interface: MakeInterfaceGuard

Guard the interface of an exo object

Defined in ​

patterns/src/types.js:495


raw ​

• raw: () => RawGuard

In parameter position, pass this argument through without any hardening or checking. In rest position, pass the rest of the arguments through without any hardening or checking. In return position, return the result without any hardening or checking.

Type declaration ​

▸ (): RawGuard

Returns ​

RawGuard

Defined in ​

patterns/src/types.js:522