Skip to main content

Reference / Modules / client / NoProtection

Class: NoProtection

client.NoProtection

A State instance is a state in the "state machine" sense. It comes with some behavior and state transition methods. A state transition method returns an instance of the next state given the executed operation, which discards current object.

This class should be extended by client class. It provides method enabling the client class to query if it was already discarded or not as well as methods actually discarding the state.

Hierarchy​

Table of contents​

Constructors​

Properties​

Accessors​

Methods​

Constructors​

constructor​

• new NoProtection(sharedState): NoProtection

Parameters​

NameType
sharedStateSharedState

Returns​

NoProtection

Overrides​

State.constructor

Defined in​

packages/client/src/Recovery.ts:169

Properties​

sharedState​

• Private Readonly sharedState: SharedState

Defined in​

packages/client/src/Recovery.ts:174

Accessors​

discarded​

• get discarded(): boolean

Returns​

boolean

Description

True if this state was discarded

Inherited from​

State.discarded

Defined in​

packages/client/src/State.ts:24


protectionParameters​

• get protectionParameters(): ProtectionParameters

Returns​

ProtectionParameters

Defined in​

packages/client/src/Recovery.ts:289

Methods​

_activateProtection​

▸ _activateProtection(params): Promise<ActiveProtection>

Parameters​

NameType
paramsBlockchainSubmission<ProtectionParams>

Returns​

Promise<ActiveProtection>

Defined in​

packages/client/src/Recovery.ts:195


_refresh​

▸ _refresh(): Promise<NoProtection>

Returns​

Promise<NoProtection>

Defined in​

packages/client/src/Recovery.ts:180


activateProtection​

▸ activateProtection(params): Promise<ActiveProtection>

Parameters​

NameType
paramsBlockchainSubmission<ProtectionParams>

Returns​

Promise<ActiveProtection>

Defined in​

packages/client/src/Recovery.ts:191


discard​

▸ discard(next): void

Parameters​

NameType
nextundefined | State

Returns​

void

Description

Discards current state. One must discard the state only if the state transition was successfully executed. It may be safer to use discardOnSuccess.

Inherited from​

State.discard

Defined in​

packages/client/src/State.ts:43


discardOnSuccess​

▸ discardOnSuccess<T, U>(action): Promise<U>

Type parameters​

NameType
Textends State
Uextends State = T

Parameters​

NameTypeDescription
action(current: T) => Promise<U>The state transition logic producing next state

Returns​

Promise<U>

Next state if state transition logic execution did not throw

Descripiton

Discards current state only if given state transition logic executed successfully (i.e. without throwing an error).

Inherited from​

State.discardOnSuccess

Defined in​

packages/client/src/State.ts:55


ensureCurrent​

▸ ensureCurrent(): void

Returns​

void

Description

Throws an error if this state was discarded. This should be called by all public methods of client class.

Inherited from​

State.ensureCurrent

Defined in​

packages/client/src/State.ts:32


finalizeOnSuccess​

▸ finalizeOnSuccess<T>(action): Promise<void>

Type parameters​

NameType
Textends State

Parameters​

NameTypeDescription
action(current: T) => Promise<void>The state transition logic producing next state

Returns​

Promise<void>

Next state if state transition logic execution did not throw

Descripiton

Finalizes (i.e. replaces with no new state) current state only if given state transition logic executed successfully (i.e. without throwing an error).

Inherited from​

State.finalizeOnSuccess

Defined in​

packages/client/src/State.ts:117


getCurrentState​

▸ getCurrentState(): undefined | State

Returns​

undefined | State

This state if not discareded or the current state or undefined when there is no current state.

Description

If the state has been discarded, provides the replacing current state if any.

Inherited from​

State.getCurrentState

Defined in​

packages/client/src/State.ts:90


getCurrentStateOrThrow​

▸ getCurrentStateOrThrow(): State

Returns​

State

Inherited from​

State.getCurrentStateOrThrow

Defined in​

packages/client/src/State.ts:102


refresh​

▸ refresh(): Promise<NoProtection>

Returns​

Promise<NoProtection>

Defined in​

packages/client/src/Recovery.ts:176


requestProtectionOrRecovery​

▸ requestProtectionOrRecovery(params): Promise<PendingProtection>

Parameters​

NameType
paramsProtectionOrRecoveryParams

Returns​

Promise<PendingProtection>

Defined in​

packages/client/src/Recovery.ts:254


requestProtectionOrRecoveryAndDiscard​

▸ requestProtectionOrRecoveryAndDiscard(params): Promise<PendingProtection>

Parameters​

NameType
paramsProtectionOrRecoveryParams

Returns​

Promise<PendingProtection>

Defined in​

packages/client/src/Recovery.ts:250


requestRecovery​

▸ requestRecovery(params): Promise<PendingProtection>

Parameters​

NameType
paramsBlockchainSubmission<RecoveryParams>

Returns​

Promise<PendingProtection>

Defined in​

packages/client/src/Recovery.ts:225


syncDiscardOnSuccess​

▸ syncDiscardOnSuccess<T, U>(action): U

Type parameters​

NameType
Textends State
Uextends State = T

Parameters​

NameTypeDescription
action(current: T) => UThe state transition logic producing next state

Returns​

U

Next state if state transition logic execution did not throw

Descripiton

Same as discardOnSuccess but with a synchronous action.

Inherited from​

State.syncDiscardOnSuccess

Defined in​

packages/client/src/State.ts:73