權杖分類架構增強功能
區塊鏈 App 產生器的增強版本包含與擴充權杖分類標準架構標準相關的新功能。
每日交易限額
您可以限制帳戶每天可完成的交易數,以及可執行的記號數。createAccount
方法的 max_daily_amount
和 max_daily_transactions
輸入參數會控制此行為。這些參數是選擇性的。
如果您未設定帳戶的每日交易限額,則可以提高處理量。
-
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...) }
採礦與燒錄的核准需求
您可以設定用於採礦和燒錄記號的核准,這樣具有礦工或燒錄機角色的使用者必須將要求提交給核准者,而不是直接採礦或燒錄記號。核准者可以接受或拒絕提示或燒錄記號的要求。若要啟用採礦和燒錄的核准,請使用 mint_approval_required
和 burn_approval_required
參數。然後還必須指定 mint_approver_role_name
和 burn_approval_role_name
的值,如下列範例所示。
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
下列方法支援要求、接受及拒絕核准薄荷和燒錄記號。TypeScript 採礦與燒錄核准的方法
採礦與燒錄核准的執行方式
從 Rich History 資料庫擷取交易歷史記錄
您可以將資料同步至豐富的歷史記錄資料庫,然後使用鏈碼 API 呼叫來擷取資料。下列方法 (如 TypeScript 和 Go 中所示) 會從 Rich History 資料庫擷取交易歷史記錄。您必須先執行 Oracle Autonomous Database 並啟用 Oracle REST Data Services (ORDS) 和 OAuth (如 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 }
交易物件中的類目與描述屬性
- 類別和描述屬性必須包含在控制器檔案中的
transferTokens
、holdTokens
、issueTokens
、requestMint
、requestBurn
、burnTokens
和rejectBurn
方法中。對應的 SDK 方法也必須包含類別和描述屬性。 - 類別和描述屬性輸入的格式為
info_details
的 JSON 物件,如下列範例所示。{ "category" : "category input", "description" : "description input" }
info_details
欄位為選擇性欄位。您只能視需要傳送類目或僅傳送描述。- 與
transferTokens
、holdTokens
、executeHold
、releaseHold
、requestMint
、approveMint
、rejectMint
、requestBurn
、approveBurn
及rejectBurn
之任何交易相關的 GET 方法,如果它們存在,必須在有效負載回應中包含類別和描述屬性。 - 種類欄位限制為 20 個字元,且描述欄位限制為 250 個字元。
TypeScript 含有已修改輸入值的方法
當您使用增強版的區塊鏈 App 產生器時,下列方法支援選擇性的類別和描述屬性。
具有已修改輸入的執行方法
當您使用增強版的區塊鏈 App 產生器時,下列方法支援選擇性的類別和描述屬性。
TypeScript 含有已修改輸出的方法
當您使用增強版的區塊鏈 App 產生器時,下列方法會傳回相關的組織和使用者 ID。