Go Methods for Token Account Status
Blockchain App Builder automatically generates methods that you can use to manage account status for fungible tokens that use the Token Taxonomy Framework standard.
You can use the following methods to put token user accounts in the active, suspended, or deleted states.
When an account is suspended, the account user cannot complete any write operations, which include minting, burning, transferring, and holding tokens. Additionally, other users cannot transfer tokens to or hold tokens in a suspended account. A suspended account can still complete read operations.
An account with a non-zero token balance cannot be deleted. You must transfer or burn all tokens in an account before you can delete the account. After an account is in the deleted state, the account state cannot be changed back to active or suspended.
Automatically Generated Account Status Methods
Blockchain App Builder automatically generates methods to manage token account status. Controller methods must be public to be invokable. Public method names begin with an upper case character. Method names that begin with a lower case character are private.
-
GetAccountStatus
- This method gets the current status of the token account. This method can be called by the
Token Admin
of the chaincode, anOrg Admin
of the specified organization, or by the token account owner. This method also supports data migration for existing chaincode that is upgraded to a newer version. -
GetAccountStatusHistory
- This method gets the history of the account status. This method can be called by the
Token Admin
of the chaincode, anOrg Admin
of the specified organization, or by the token account owner. -
ActivateAccount
- This method activates a token account. This method can be called only by a
Token Admin
of the chaincode or by anOrg Admin
of the specified organization. Deleted accounts cannot be activated. -
SuspendAccount
- This method suspends a token account. Suspended accounts can still complete read operations. Users with suspended accounts cannot send, receive, mint, or burn tokens. This method can be called only by a
Token Admin
of the chaincode or by anOrg Admin
of the specified organization. After an account is suspended, you cannot complete any operations that update the account. A deleted account cannot be suspended. -
DeleteAccount
- This method deletes a token account. This method can be called only by a
Token Admin
of the chaincode or by anOrg Admin
of the specified organization. After an account is deleted, you cannot complete any operations that update the account. The deleted account is in a final state and cannot be changed to any other state. To delete an account, the account balance and the on-hold balance must be zero.
-
GetAccountStatus
- This method gets the current status of the token account. This method can be called by the
Token Admin
orToken Auditor
, anOrg Admin
orOrg Auditor
of the specified organization, or by the token account owner. This method also supports data migration for existing chaincode that is upgraded to a newer version. -
GetAccountStatusHistory
- This method gets the history of the account status. This method can be called by the
Token Admin
orToken Auditor
, anOrg Admin
orOrg Auditor
of the specified organization, or by the token account owner. -
ActivateAccount
- This method activates a token account. This method can be called only by a
Token Admin
of the chaincode or by anOrg Admin
of the specified organization. Deleted accounts cannot be activated. -
SuspendAccount
- This method suspends a token account. Suspended accounts can still complete read operations. Users with suspended accounts cannot send, receive, mint, or burn tokens. This method can be called only by a
Token Admin
of the chaincode or by anOrg Admin
of the specified organization. After an account is suspended, you cannot complete any operations that update the account. A deleted account cannot be suspended. -
DeleteAccount
- This method deletes a token account. This method can be called only by a
Token Admin
of the chaincode or by anOrg Admin
of the specified organization. After an account is deleted, you cannot complete any operations that update the account. The deleted account is in a final state and cannot be changed to any other state. To delete an account, the account balance and the on-hold balance must be zero.
Account Status SDK Methods
-
GetDefaultAccountStatus
- This method gets the current status of a token account, with the
status as
active
for any account that does not have account status stored in the ledger (because the account was created prior to the account status functionality). -
GetAccountStatus
- This method gets the current status of the token account.
-
SaveAccountStatus
- This method saves the status object (if a status object is not present) for the token account, and sets the status to the specified value.
-
GetAccountStatusHistory
- This method gets the history of the account status.
-
ActivateAccount
- This method activates a token account.
-
SuspendAccount
- This method suspends a token account.
-
DeleteAccount
- This method deletes a token account.