Recovery

Calls

asRecovered

Send a call through a recovered account.

The dispatch origin for this call must be Signed and registered to be able to make calls on behalf of the recovered account.

Parameters:

  • account: The recovered account you want to make a call on-behalf-of.

  • call: The call you want to make with the recovered account.

Namespace

api.tx.recovery.asRecovered

Type

function asRecovered(
  account: SeedPrimitivesSignatureAccountId20,
  call: Call
)

cancelRecovered

Cancel the ability to use as_recovered for account.

The dispatch origin for this call must be Signed and registered to be able to make calls on behalf of the recovered account.

Parameters:

  • account: The recovered account you are able to call on-behalf-of.

Namespace

api.tx.recovery.cancelRecovered

Type

function cancelRecovered(
  account: SeedPrimitivesSignatureAccountId20
)

claimRecovery

Allow a successful rescuer to claim their recovered account.

The dispatch origin for this call must be Signed and must be a "rescuer" who has successfully completed the account recovery process: collected threshold or more vouches, waited delay_period blocks since initiation.

Parameters:

  • account: The lost account that you want to claim has been successfully recovered by you.

Namespace

api.tx.recovery.claimRecovery

Type

function claimRecovery(
  account: SeedPrimitivesSignatureAccountId20
)

closeRecovery

As the controller of a recoverable account, close an active recovery process for your account.

Payment: By calling this function, the recoverable account will receive the recovery deposit RecoveryDeposit placed by the rescuer.

The dispatch origin for this call must be Signed and must be a recoverable account with an active recovery process for it.

Parameters:

  • rescuer: The account trying to rescue this recoverable account.

Namespace

api.tx.recovery.closeRecovery

Type

function closeRecovery(
  rescuer: SeedPrimitivesSignatureAccountId20
)

createRecovery

Create a recovery configuration for your account. This makes your account recoverable.

Payment: ConfigDepositBase + FriendDepositFactor * #_of_friends balance will be reserved for storing the recovery configuration. This deposit is returned in full when the user calls remove_recovery.

The dispatch origin for this call must be Signed.

Parameters:

  • friends: A list of friends you trust to vouch for recovery attempts. Should be ordered and contain no duplicate values.

  • threshold: The number of friends that must vouch for a recovery attempt before the account can be recovered. Should be less than or equal to the length of the list of friends.

  • delay_period: The number of blocks after a recovery attempt is initialized that needs to pass before the account can be recovered.

Namespace

api.tx.recovery.createRecovery

Type

function createRecovery(
  friends: Vec<SeedPrimitivesSignatureAccountId20>,
  threshold: u16,
  delay_period: u32
)

initiateRecovery

Initiate the process for recovering a recoverable account.

Payment: RecoveryDeposit balance will be reserved for initiating the recovery process. This deposit will always be repatriated to the account trying to be recovered. See close_recovery.

The dispatch origin for this call must be Signed.

Parameters:

  • account: The lost account that you want to recover. This account needs to be recoverable (i.e. have a recovery configuration).

Namespace

api.tx.recovery.initiateRecovery

Type

function initiateRecovery(
  account: SeedPrimitivesSignatureAccountId20
)

removeRecovery

Remove the recovery process for your account. Recovered accounts are still accessible.

Note: The user must make sure to call close_recovery on all active recovery attempts before calling this function else it will fail.

Payment: By calling this function the recoverable account will unreserve their recovery configuration deposit. (ConfigDepositBase + FriendDepositFactor * #_of_friends)

The dispatch origin for this call must be Signed and must be a recoverable account (i.e. has a recovery configuration).

Namespace

api.tx.recovery.removeRecovery

Type

function removeRecovery(

)

setRecovered

Allow ROOT to bypass the recovery process and set an a rescuer account for a lost account directly.

The dispatch origin for this call must be ROOT.

Parameters:

  • lost: The "lost account" to be recovered.

  • rescuer: The "rescuer account" which can call as the lost account.

Namespace

api.tx.recovery.setRecovered

Type

function setRecovered(
  lost: SeedPrimitivesSignatureAccountId20,
  rescuer: SeedPrimitivesSignatureAccountId20
)

vouchRecovery

Allow a "friend" of a recoverable account to vouch for an active recovery process for that account.

The dispatch origin for this call must be Signed and must be a "friend" for the recoverable account.

Parameters:

  • lost: The lost account that you want to recover.

  • rescuer: The account trying to rescue the lost account that you want to vouch for.

The combination of these two parameters must point to an active recovery process.

Namespace

api.tx.recovery.vouchRecovery

Type

function vouchRecovery(
  lost: SeedPrimitivesSignatureAccountId20,
  rescuer: SeedPrimitivesSignatureAccountId20
)

Storage

activeRecoveries

Active recovery attempts.

First account is the account to be recovered, and the second account is the user trying to recover the account.

Namespace

api.query.recovery.activeRecoveries

Type

function activeRecoveries(
  SeedPrimitivesSignatureAccountId20,
  SeedPrimitivesSignatureAccountId20
): Option<PalletRecoveryActiveRecovery>

proxy

The list of allowed proxy accounts.

Map from the user who can access it to the recovered account.

Namespace

api.query.recovery.proxy

Type

function proxy(
  SeedPrimitivesSignatureAccountId20
): Option<SeedPrimitivesSignatureAccountId20>

recoverable

The set of recoverable accounts and their recovery configuration.

Namespace

api.query.recovery.recoverable

Type

function recoverable(
  SeedPrimitivesSignatureAccountId20
): Option<PalletRecoveryRecoveryConfig>

Events

AccountRecovered

Lost account has been successfully recovered by the rescuer account.

Namespace

api.events.recovery.AccountRecovered

Type

type AccountRecovered = {
  lost_account: SeedPrimitivesSignatureAccountId20,
  rescuer_account: SeedPrimitivesSignatureAccountId20
}

RecoveryClosed

A recovery process for lost account by rescuer account has been closed.

Namespace

api.events.recovery.RecoveryClosed

Type

type RecoveryClosed = {
  lost_account: SeedPrimitivesSignatureAccountId20,
  rescuer_account: SeedPrimitivesSignatureAccountId20
}

RecoveryCreated

A recovery process has been set up for an account.

Namespace

api.events.recovery.RecoveryCreated

Type

type RecoveryCreated = {
  account: SeedPrimitivesSignatureAccountId20
}

RecoveryInitiated

A recovery process has been initiated for lost account by rescuer account.

Namespace

api.events.recovery.RecoveryInitiated

Type

type RecoveryInitiated = {
  lost_account: SeedPrimitivesSignatureAccountId20,
  rescuer_account: SeedPrimitivesSignatureAccountId20
}

RecoveryRemoved

A recovery process has been removed for an account.

Namespace

api.events.recovery.RecoveryRemoved

Type

type RecoveryRemoved = {
  lost_account: SeedPrimitivesSignatureAccountId20
}

RecoveryVouched

A recovery process for a lost account by rescuer account has been vouched for by the sender.

Namespace

api.events.recovery.RecoveryVouched

Type

type RecoveryVouched = {
  lost_account: SeedPrimitivesSignatureAccountId20,
  rescuer_account: SeedPrimitivesSignatureAccountId20,
  sender: SeedPrimitivesSignatureAccountId20
}

Errors

AlreadyProxy

This account is already set up for recovery

Namespace

api.errors.recovery.AlreadyProxy

AlreadyRecoverable

This account is already set up for recovery

Namespace

api.errors.recovery.AlreadyRecoverable

AlreadyStarted

A recovery process has already started for this account

Namespace

api.errors.recovery.AlreadyStarted

AlreadyVouched

This user has already vouched for this recovery

Namespace

api.errors.recovery.AlreadyVouched

BadState

Some internal state is broken.

Namespace

api.errors.recovery.BadState

DelayPeriod

The friend must wait until the delay period to vouch for this recovery

Namespace

api.errors.recovery.DelayPeriod

MaxFriends

Friends list must be less than max friends

Namespace

api.errors.recovery.MaxFriends

NotAllowed

User is not allowed to make a call on behalf of this account

Namespace

api.errors.recovery.NotAllowed

NotEnoughFriends

Friends list must be greater than zero and threshold

Namespace

api.errors.recovery.NotEnoughFriends

NotFriend

This account is not a friend who can vouch

Namespace

api.errors.recovery.NotFriend

NotRecoverable

This account is not set up for recovery

Namespace

api.errors.recovery.NotRecoverable

NotSorted

Friends list must be sorted and free of duplicates

Namespace

api.errors.recovery.NotSorted

NotStarted

A recovery process has not started for this rescuer

Namespace

api.errors.recovery.NotStarted

StillActive

There are still active recovery attempts that need to be closed

Namespace

api.errors.recovery.StillActive

Threshold

The threshold for recovering this account has not been met

Namespace

api.errors.recovery.Threshold

ZeroThreshold

Threshold must be greater than zero

Namespace

api.errors.recovery.ZeroThreshold

Constants

configDepositBase

The base amount of currency needed to reserve for creating a recovery configuration.

This is held for an additional storage item whose value size is 2 + sizeof(BlockNumber, Balance) bytes.

Namespace

api.consts.recovery.configDepositBase

Type

type configDepositBase = u128

friendDepositFactor

The amount of currency needed per additional user when creating a recovery configuration.

This is held for adding sizeof(AccountId) bytes more into a pre-existing storage value.

Namespace

api.consts.recovery.friendDepositFactor

Type

type friendDepositFactor = u128

maxFriends

The maximum amount of friends allowed in a recovery configuration.

NOTE: The threshold programmed in this Pallet uses u16, so it does not make sense to have a limit here greater than u16::MAX. But also, that is a lot more than you should probably set this value to anyway.

Namespace

api.consts.recovery.maxFriends

Type

type maxFriends = u32

recoveryDeposit

The base amount of currency needed to reserve for starting a recovery.

This is primarily held for deterring malicious recovery attempts, and should have a value large enough that a bad actor would choose not to place this deposit. It also acts to fund additional storage item whose value size is sizeof(BlockNumber, Balance + T * AccountId) bytes. Where T is a configurable threshold.

Namespace

api.consts.recovery.recoveryDeposit

Type

type recoveryDeposit = u128

Last updated

© 2023 -> ♾️