Skip to main content

revoke

Revokes a delegate. It is possible to specify which operations should be revoked.

Accounts​

Below is the list of accounts expected by the approve instruction.

NameWritableSignerOptionalDescription
asset✅Initialized asset account
signer✅Owner of the asset or current delegate

Arguments​

The revoke instruction expects the information of roles to be revoked.

FieldOffsetSizeDescription
delegate_input0~A value from the DelegateInput enum.

The input accepts either an All value, which means that all roles will be revokes, or an array of DelegateRole values. The DelegateRole specify the valid roles of a delegate:

  • Transfer: revokes the ability of the delegate to transfer the asset;
  • Lock: revokes the ability of the delegate to lock the asset;
  • Burn: revokes the ability of the delegate to burn the asset.
info

If the delegate has no active roles, then it is completely revoked — the delegate field on the asset account is cleared.

Examples​

import { DelegateRole, delegateInput, revoke } from '@nifty-oss/asset';

// Accounts:
// - asset: PublicKey
// - signer: KeypairSigner
await revoke(umi, {
asset: asset,
signer,
delegateInput: delegateInput('Some', {
roles: [DelegateRole.Transfer],
}),
}).sendAndConfirm(umi);