-
SetApplicationGroups
- 此方法會在 API 中指定之應用程式群組的帳戶詳細資訊中設定
application_groups 參數。只有指定的組織之 Token Admin 或 Org Admin 才能呼叫此方法。
func (t *Controller) SetApplicationGroups(token_id string, org_id string, user_id string, application_groups []string) (interface{}, error)
- 參數:
org_id: string – 目前組織中使用者的會員服務提供者 (MSP) ID。
user_id: string – 使用者的使用者名稱或電子郵件 ID。
token_id: string – 記號的 ID。
application_groups: string[] – 使用者 ID 所屬的應用程式群組清單,在 CBDC 應用程式中定義使用者的關聯。
- 傳回值範例:
{
"returnCode": "Success",
"error": "",
"result": {
"txid": "261c3da4bb6f1724bc8f674c7b001a9b986bc9900d0508363039424926b143ed",
"payload": {
"AssetType": "oaccount",
"AccountId": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
"UserId": "admin_user_cb",
"OrgId": "CB",
"TokenType": "fungible",
"TokenId": "",
"TokenName": "",
"Balance": 0,
"BalanceOnHold": 0,
"OnHoldBurnBalance": 0,
"BapAccountVersion": 0,
"ApplicationGroups": [
"System_Admins"
],
"MaxDailyAmount": 10000,
"DailyAmount": 0,
"MaxDailyTransactions": 100,
"DailyTransactions": 0,
"CurrentDate": "2024-12-09"
},
"encode": "JSON",
"sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
"blockNumber": 246
}
}
-
GetAllActiveAccounts
- 此方法會傳回與指定權杖 ID 相關聯的所有作用中帳戶。所有使用者都可以呼叫此方法。
func (t *Controller) GetAllActiveAccounts(token_id string) (interface{}, error)
- 參數:
token_id: string – 記號的 ID。
- 傳回值:
- 成功時,包含使用者詳細資訊的訊息。輸出會根據使用者的角色而有所不同,如下列範例所示。
- 傳回值範例 (權杖管理員、權杖稽核員):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"NonAccountRoleName": "[\"token_admin\"]",
"RoleName": null,
"key": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
"valueJson": {
"AccountId": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
"ApplicationGroups": [
"System_Issuers"
],
"AssetType": "oaccount",
"Balance": 0,
"BalanceOnHold": 0,
"OnHoldBurnBalance": 0,
"BapAccountVersion": 0,
"CurrentDate": "2024-11-21",
"DailyAmount": 0,
"DailyTransactions": 0,
"MaxDailyAmount": 10000,
"MaxDailyTransactions": 100,
"OrgId": "CB",
"TokenId": "USD",
"TokenName": "cbdc",
"TokenType": "fungible",
"UserId": "admin_user_cb"
}
}
],
"encode": "JSON"
}
}
- 傳回值範例 (組織管理、組織稽核者):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"NonAccountRoleName": "[\"token_auditor\"]",
"RoleName": null,
"key": "oaccount~bd6262ffdf582675dd9b2506c1d5488864feef0b9e297a9a3322b7c683ad6214",
"valueJson": {
"AccountId": "oaccount~bd6262ffdf582675dd9b2506c1d5488864feef0b9e297a9a3322b7c683ad6214",
"OrgId": "CB",
"TokenId": "USD",
"UserId": "auditor_user_cb",
"MaxDailyAmount": 10000,
"MaxDailyTransactions": 100,
}
}
],
"encode": "JSON"
}
}
- 傳回值範例 (所有其他使用者):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"NonAccountRoleName": "[\"token_admin\"]",
"RoleName": null,
"key": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
"valueJson": {
"AccountId": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
"OrgId": "CB",
"TokenId": "USD",
"UserId": "admin_user_cb"
}
}
],
"encode": "JSON"
}
}
-
GetAllSuspendedAccounts
- 這個方法會傳回與指定記號 ID 相關聯的所有暫停帳戶。所有使用者都可以呼叫此方法。
public async getAllSuspendedAccounts(token_id: string)
- 參數:
token_id: string – 記號的 ID。
- 傳回值:
- 成功時,包含使用者詳細資訊的訊息。輸出會根據使用者的角色而有所不同,如下列範例所示。
- 傳回值範例 (權杖管理員、權杖稽核員):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"NonAccountRoleName": null,
"RoleName": "minter",
"key": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"valueJson": {
"AccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"ApplicationGroups": [
"System_Admins"
],
"AssetType": "oaccount",
"Balance": 140,
"BalanceOnHold": 0,
"OnHoldBurnBalance": 0,
"BapAccountVersion": 8,
"CurrentDate": "2024-11-21",
"DailyAmount": 70,
"DailyTransactions": 3,
"MaxDailyAmount": 10000,
"MaxDailyTransactions": 100,
"OrgId": "CB",
"TokenId": "USD",
"TokenName": "cbdc",
"TokenType": "fungible",
"UserId": "creator_user_cb"
}
}
],
"encode": "JSON"
}
}
- 傳回值範例 (組織管理、組織稽核者):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"NonAccountRoleName": null,
"RoleName": "minter",
"key": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"valueJson": {
"AccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"OrgId": "CB",
"TokenId": "USD",
"UserId": "creator_user_cb",
"MaxDailyAmount": 10000,
"MaxDailyTransactions": 100,
}
}
],
"encode": "JSON"
}
}
- 傳回值範例 (所有其他使用者):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"NonAccountRoleName": null,
"RoleName": "minter",
"key": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"valueJson": {
"AccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"OrgId": "CB",
"TokenId": "USD",
"UserId": "creator_user_cb"
}
}
],
"encode": "JSON"
}
}
-
GetBurnQuantity
- 此方法會傳回指定組織的燒錄記號總數量。只有
Token Admin、Token Auditor 或具有燒錄機角色的使用者才能呼叫此方法。
func (t *Controller) GetBurnQuantity(token_id string) (interface{}, error)
- 參數:
token_id: string – 記號的 ID。
- 傳回值範例:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": {
"BurnQuantity": 10
},
"encode": "JSON"
}
}
-
GetActionHistory
- 此方法會擷取呼叫程式針對 mint、 burn 和 transfer (issuance) 作業所進行的核准或拒絕歷史記錄,包括組織的詳細資訊,以及相關帳戶的使用者 ID (寄件者、收件者和公證人)。
func (t *Controller) GetActionHistory(token_id string) (interface{}, error)
- 參數:
token_id: string – 記號的 ID。
- 傳回值範例:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"FromAccountId": "oaccount~0d7b3f73aea28065017ce8b79c0bb19256dc0cb475a0b2a85192bd110f69535c",
"FromOrgId": "CB",
"FromUserId": "retirer_user_cb",
"HoldingId": "ohold~cbdc~USD~6e1223",
"HoldingStatus": "REJECT_BURN",
"LastUpdatedTime": "2024-11-21T22:08:26Z",
"NotaryAccountId": null,
"NotaryOrgId": null,
"NotaryUserId": null,
"OperationId": null,
"Quantity": 5,
"TimeToExpiration": null,
"ToAccountId": "",
"ToOrgId": null,
"ToUserId": null,
"TokenId": "USD",
"TokenName": null
},
{
"FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"FromOrgId": "CB",
"FromUserId": "creator_user_cb",
"HoldingId": "ohold~cbdc~USD~hold2",
"HoldingStatus": "RELEASEHOLD",
"LastUpdatedTime": "2024-11-21T21:54:33Z",
"NotaryAccountId": null,
"NotaryOrgId": null,
"NotaryUserId": null,
"OperationId": null,
"Quantity": 10,
"TimeToExpiration": null,
"ToAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"ToOrgId": "CB",
"ToUserId": "creator_user_cb",
"TokenId": "USD",
"TokenName": null
}
],
"encode": "JSON"
}
}
-
GetPendingIssuance
- 此方法會擷取將來電者指派為核准者的所有待發放 (調動) 異動,包括組織的詳細資料,以及涉及帳戶的使用者 ID (寄件者、接收者與公證人)。只有鏈碼的
Token Admin 或 Token Auditor、指定組織的 Org Admin 或 Org Auditor 或 Notary 才能呼叫此方法。
func (t *Controller) GetPendingIssuance(token_id string) (interface{}, error)
- 參數:
token_id: string – 記號的 ID。
- 傳回值範例:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"AssetType": "ONHOLD",
"FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"FromOrgId": "CB",
"FromUserId": "creator_user_cb",
"HoldingId": "ohold~cbdc~USD~h123",
"NotaryAccountId": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
"NotaryOrgId": "CB",
"NotaryUserId": "manager_user_cb",
"OperationId": "h123",
"Quantity": 10,
"TimeToExpiration": "0",
"ToAccountId": "oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594",
"ToOrgId": "CB",
"ToUserId": "issuer_user_cb",
"TokenId": "USD",
"TokenName": "cbdc"
}
],
"encode": "JSON"
}
}
-
GetPendingRequest
- 此方法會擷取指定類型的所有待處理要求,其中呼叫者被指派為核准者。只有鏈碼的
Token Admin 或 Token Auditor、指定組織的 Org Admin 或 Org Auditor 或 Notary 才能呼叫此方法。
func (t *Controller) GetPendingRequest(token_id string, request_type string) (interface{}, error)
- 參數:
token_id: string – 記號的 ID。
request_type: string – 交易類型。例如,mint 或 burn。
- 傳回值範例:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"valueJson": {
"AssetType": "ohold",
"Category": "Category value",
"Description": "Description value",
"FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"HoldingId": "ohold~cbdc~USD~8e1232",
"NotaryAccountId": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
"OperationId": "8e1232",
"OperationType": "mint",
"Quantity": 100,
"Status": "pending",
"TimeToExpiration": "0",
"ToAccountId": "",
"TokenId": "USD",
"TokenName": "cbdc"
}
}
],
"encode": "JSON"
}
}
-
GetTotalBalanceByCallerOrgId
- 此方法會擷取呼叫者組織的總結餘。它可以由
Token Admin、Token Auditor、Org Admin、Org Auditor 或任何帳戶擁有者呼叫。
func (t *Controller) GetTotalBalanceByCallerOrgId() (interface{}, error)
- 參數:
token_id: string – 記號的 ID。
- 傳回值範例:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"TotalBalance": 180
}
],
"encode": "JSON"
}
}
-
GetTransactionWithBlockNumber
- 此方法會傳回指定交易 ID 之交易的詳細資料。
func (t *Controller) GetTransactionWithBlockNumber(token_id string, transaction_id string)
- 參數:
token_id: string – 記號的 ID。
transaction_id: string – 交易的 ID。
- 傳回值範例:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"blockNo": 152,
"key": "otransaction~eee2de20b4b042884da83e3b7b85d8532ad56f26a546ee25d227acce33375c1c",
"metadata": null,
"txnNo": 0,
"value": null,
"valueJson": {
"Amount": 10,
"AssetType": "otransaction",
"Category": "Category value",
"Description": "",
"FromAccountBalance": 130,
"FromAccountId": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"FromAccountOnHoldBalance": 10,
"HoldingId": "ohold~cbdc~USD~hold1",
"NumberOfSubTransactions": 0,
"SubTransaction": "false",
"SubTransactionType": "",
"Timestamp": "2024-11-21T20:43:59Z",
"ToAccountBalance": 10,
"ToAccountId": "oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594",
"ToAccountOnHoldBalance": 0,
"TokenId": "USD",
"TransactionId": "otransaction~eee2de20b4b042884da83e3b7b85d8532ad56f26a546ee25d227acce33375c1c",
"TransactionType": "EXECUTEHOLD"
}
}
],
"encode": "JSON"
}
}