Token Taxonomy Framework Enhancements
The enhanced version of Blockchain App Builder includes new functionality related to the extended Token Taxonomy Framework standard.
Daily Transaction Limits
You can restrict the number of transactions an account can complete daily, as well as the number of tokens that can be acted on. The max_daily_amount
and max_daily_transactions
input parameters to the createAccount
method control this behavior. These parameters are optional.
You can achieve higher throughput if you do not set the daily transaction limits for an account.
-
createAccount (TypeScript)
@Validator(yup.string(), yup.string(), yup.string(), yup.object().nullable()) public async createAccount(org_id: string, user_id: string, token_type: string, daily_limits: DailyLimits) { await this.Ctx.Auth.checkAuthorization("ACCOUNT.createAccount", "TOKEN", { org_id }); return await this.Ctx.Account.createAccount(org_id, user_id, token_type, daily_limits); }
-
CreateAccount (Go)
func (t *Controller) CreateAccount(org_id string, user_id string, token_type string, daily_limits ...account.AccountDailyLimits) (interface{}, error) { auth, err := t.Ctx.Auth.CheckAuthorization("Account.CreateAccount", "TOKEN", map[string]string{"org_id": org_id}) if err != nil && !auth { return nil, fmt.Errorf("error in authorizing the caller %s", err.Error()) } return t.Ctx.Account.CreateAccount(org_id, user_id, token_type, daily_limits...) }
Approval Requirements for Minting and Burning
You can set up approvals for minting and burning tokens, so that users with the minter or burner role must submit a request to an approver, instead of minting or burning tokens directly. Approvers can accept or reject requests to mint or burn tokens. To enable approvals for minting and burning, you use the mint_approval_required
and burn_approval_required
parameters. You must then also specify values for mint_approver_role_name
and burn_approval_role_name
, as shown in the following example.
behavior: # Token behaviors
- divisible:
decimal: 2
- mintable:
max_mint_quantity: 1000
mint_approval_required: true
- transferable
- burnable
burn_approval_required: true
- holdable
- roles:
minter_role_name: minter
notary_role_name: notary
mint_approver_role_name: minter_notary
burn_approver_role_name: burner_notary
The following methods support requesting, accepting, and rejecting approvals to mint and burn tokens.TypeScript Methods for Minting and Burning Approval
-
requestMint
- This method can be called by a minter to send a request to the minter notary to create a specified amount of tokens.
-
approveMint
- This method can be called by a minter notary to approve a minting request.
-
rejectMint
- This method can be called by a minter notary to reject a minting request.
-
requestBurn
- This method can be called by a burner to send a request to the burner notary to destroy a specified amount of tokens.
-
approveBurn
- This method can be called by a burner notary to approve a burning request.
-
rejectBurn
- This method can be called by a burner notary to reject a burning request.
Go Methods for Minting and Burning Approval
-
RequestMint
- This method can be called by a minter to send a request to the minter notary to create a specified amount of tokens.
-
ApproveMint
- This method can be called by a minter notary to approve a minting request.
-
RejectMint
- This method can be called by a minter notary to reject a minting request.
-
RequestBurn
- This method can be called by a burner to send a request to the burner notary to destroy a specified amount of tokens.
-
ApproveBurn
- This method can be called by a burner notary to approve a burning request.
-
RejectBurn
- This method can be called by a burner notary to reject a burning request.
Fetching Transaction History from the Rich History Database
You can synchronize data to the rich history database and then fetch the data using chaincode API calls. The following method, shown in TypeScript and in Go, fetchs transaction history from the rich history database. Before you can use these methods, you must run Oracle Autonomous Database with Oracle REST Data Services (ORDS) and OAuth enabled, as described in Oracle Database View Definitions for Wholesale CBDC.-
getAccountTransactionHistoryWithFiltersFromRichHistDB (TypeScript)
@GetMethod() @Validator(yup.string(), yup.string(), yup.string(), yup.string(), yup.string(), yup.object().nullable()) public async getAccountTransactionHistoryWithFiltersFromRichHistDB(token_id: string, org_id: string, user_id: string, custom_endpoint: string, bearer_token: string, filters?: Filters) { const account_id = await this.Ctx.Account.generateAccountId(token_id, org_id, user_id); await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAccountTransactionHistoryWithFilters", "TOKEN", { account_id }); return await this.Ctx.Account.getAccountTrxHistoryWithFiltersFromRichHistDB(account_id, org_id, user_id.toLowerCase(), custom_endpoint, bearer_token, filters); }
-
GetAccountTransactionHistoryWithFiltersFromRichHistDB (Go)
func (t *Controller) GetAccountTransactionHistoryWithFiltersFromRichHistDB(token_id string, org_id string, user_id string, custom_endPoint string, bearer_token string, filters ...account.AccountHistoryFilters) (interface{}, error) { account_id, err := t.Ctx.Account.GenerateAccountId(token_id, org_id, user_id) if err != nil { return nil, err } auth, err := t.Ctx.Auth.CheckAuthorization("Account.GetAccountTransactionHistoryWithFilters", "TOKEN", map[string]string{"account_id": account_id}) if err != nil && !auth { return nil, fmt.Errorf("error in authorizing the caller %s", err.Error()) } // sample format of filter: []string{"3", "", "2022-01-16T15:16:36+00:00", "2022-01-17T15:16:36+00:00"} transactionArray, err := t.Ctx.Account.GetAccountTransactionHistoryWithFiltersFromRichHistDB(account_id, org_id, user_id, custom_endPoint, bearer_token, filters...) return transactionArray, err }
Category and Description Attributes in Transaction Objects
- Category and description attributes must be included in the
transferTokens
,holdTokens
,issueTokens
,requestMint
,requestBurn
,burnTokens
andrejectBurn
methods in the controller file. The corresponding SDK methods must also include category and description attributes. - The category and description attribute input is in the form of a JSON object named
info_details
, as shown in the following example.{ "category" : "category input", "description" : "description input" }
- The
info_details
field is optional. You can pass only a category or only a description as needed. - The GET methods related to any transactions for
transferTokens
,holdTokens
,executeHold
,releaseHold
,requestMint
,approveMint
,rejectMint
,requestBurn
,approveBurn
andrejectBurn
must include category and description attributes in the payload response if they are present. - The category field is limited 20 characters and the description field is limited to 250 Characters.
TypeScript Methods with Modified Inputs
The following methods support optional category and description attributes when you use the enhanced version of Blockchain App Builder.
-
transferTokens
- This method transfers tokens from the caller to a specified account.
-
holdTokens
- This method creates a hold on behalf of the owner of the tokens with the
to_account_id
account. -
issueTokens
- This method mints tokens, which are then owned by the caller of the method.
-
burnTokens
- This method deactivates, or burns, tokens from the transaction caller's account.
Go Methods with Modified Inputs
The following methods support optional category and description attributes when you use the enhanced version of Blockchain App Builder.
-
TransferTokens
- This method transfers tokens from the caller to a specified account.
-
HoldTokens
- This method creates a hold on behalf of the owner of the tokens with the
to_account_id
account. -
IssueTokens
- This method mints tokens, which are then owned by the caller of the method.
-
BurnTokens
- This method deactivates, or burns, tokens from the transaction caller's account.
TypeScript Methods with Modified Outputs
The following methods return the relevant organization and user IDs when you use the enhanced version of Blockchain App Builder.
Go Methods with Modified Outputs
The following methods return the relevant organization and user IDs when you use the enhanced version of Blockchain App Builder.