The following API is modified for the wholesale CBDC model.
-
setApplicationGroups
- This method sets the
application_groups parameter in the account details for the specified application groups in the API. This method can be called only by a Token Admin or Org Admin of the specified organization.
public async setApplicationGroups (org_id: string, user_id: string, token_id: string, application_groups: string[])
- Parameters:
org_id: string – The membership service provider (MSP) ID of the user in the current organization.
user_id: string – The user name or email ID of the user.
token_id: string – The ID of the token.
application_groups: string[] – A list of application groups the user ID belongs to, which define the user's associations in the CBDC application.
- Return Value Example:
{
"returnCode": "Success",
"error": "",
"result": {
"txid": "453821c7ffd477987ef8ccbd836b893969531ab768098cd4a99e3b89cd38a391",
"payload": {
"bapAccountVersion": 0,
"assetType": "oaccount",
"account_id": "oaccount~28ac774001f374064029d51af4fb67e26ea1ea9ef62828b7a72dbf3beb8efd8d",
"user_id": "admin_user_cb",
"org_id": "CB",
"token_type": "fungible",
"token_id": "",
"token_name": "",
"balance": 0,
"onhold_balance": 0,
"onhold_burn_balance": 0,
"application_groups": [
"System_Admins"
],
"max_daily_amount": 10000,
"daily_amount": 0,
"max_daily_transactions": 100,
"daily_transactions": 0,
"current_date": "2024-12-09T00:00:00.000Z"
},
"encode": "JSON",
"sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
"blockNumber": 188
}
}
-
getAllActiveAccounts
- This method returns all of the active accounts that are associated with the specified token ID. Any user can call this method.
public async getAllActiveAccounts(token_id: string)
- Parameters:
token_id: string – The ID of the token.
- Returns:
- On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
- Return Value Example (Token Admin, Token Auditor):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"key": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
"non_account_role_name": [
"token_admin"
],
"role_name": null,
"valueJson": {
"bapAccountVersion": 0,
"assetType": "oaccount",
"account_id": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
"user_id": "admin_user_cb",
"org_id": "CB",
"token_type": "fungible",
"token_id": "USD",
"token_name": "cbdc",
"balance": 0,
"onhold_balance": 0,
"onhold_burn_balance": 0,
"application_groups": [
"System_Admins"
],
"max_daily_amount": 10000,
"daily_amount": 0,
"max_daily_transactions": 1000,
"daily_transactions": 0,
"current_date": "2024-11-20T00:00:00.000Z"
}
}
],
"encode": "JSON"
}
}
- Return Value Example (Organization Admin, Organization Auditor):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"key": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
"non_account_role_name": [
"token_admin"
],
"role_name": null,
"valueJson": {
"account_id": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
"org_id": "CB",
"user_id": "admin_user_cb",
"token_id": "USD",
"max_daily_amount": 10000,
"max_daily_transactions": 1000
}
}
],
"encode": "JSON"
}
}
- Return Value Example (all other users):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"key": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
"non_account_role_name": [
"token_admin"
],
"role_name": null,
"valueJson": {
"account_id": "oaccount~cdc6fa5e64bc29f700f99da69f980d8cbb768c7e1a11dd17274e75651f6afafe",
"org_id": "CB",
"user_id": "admin_user_cb",
"token_id": "USD",
"max_daily_amount": 10000,
"max_daily_transactions": 1000
}
}
],
"encode": "JSON"
}
}
-
getAllSuspendedAccounts
- This method returns all of the suspended accounts that are associated with the specified token ID. Any user can call this method.
func (t *Controller) GetAllSuspendedAccounts(token_id string) (interface{}, error)
- Parameters:
token_id: string – The ID of the token.
- Returns:
- On success, a message that includes user details. The output varies based on the user's role, as shown in the following examples.
- Return Value Example (Token Admin, Token Auditor):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"key": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
"non_account_role_name": null,
"role_name": null,
"valueJson": {
"assetType": "oaccount",
"bapAccountVersion": 1,
"account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
"user_id": "user1_fi1",
"org_id": "FI1",
"token_type": "fungible",
"token_id": "USD",
"token_name": "cbdc",
"balance": 5,
"onhold_balance": 0,
"onhold_burn_balance": 0,
"application_groups": [
"Org_Users"
],
"max_daily_amount": 10000,
"daily_amount": 0,
"max_daily_transactions": 1000,
"daily_transactions": 0,
"current_date": "2024-11-20T00:00:00.000Z"
}
}
],
"encode": "JSON"
}
}
- Return Value Example (Organization Admin, Organization Auditor):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"key": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
"non_account_role_name": null,
"role_name": null,
"valueJson": {
"account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
"org_id": "FI1",
"user_id": "user1_fi1",
"token_id": "USD",
"max_daily_amount": 10000,
"max_daily_transactions": 1000
}
}
],
"encode": "JSON"
}
}
- Return Value Example (all other users):
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"key": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
"non_account_role_name": null,
"role_name": null,
"valueJson": {
"account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
"org_id": "FI1",
"user_id": "user1_fi1",
"token_id": "USD"
}
}
],
"encode": "JSON"
}
}
-
getBurnQuantity
- This method returns the total quantity of burned tokens for a specified organization. This method can be called only by a
Token Admin, Token Auditor, or a user with the burner role.
public async getBurnQuantity(token_id: string)
- Parameters:
token_id: string – The ID of the token.
- Return Value Example:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": {
"burnt_quantity": 31
},
"encode": "JSON"
}
}
-
getActionHistory
- This method retrieves the history of approvals or rejections made by the caller for mint, burn, and transfer (issuance) operations, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary).
public async getActionHistory(token_id: string)
- Parameters:
token_id: string – The ID of the token.
- Return Value Example:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"from_account_id": "oaccount~0d7b3f73aea28065017ce8b79c0bb19256dc0cb475a0b2a85192bd110f69535c",
"from_org_id": "CB",
"from_user_id": "retirer_user_cb",
"holding_id": "ohold~cbdc~USD~eaf6",
"holding_status": "REJECT_BURN",
"last_updated_time": "2024-11-26T21:43:22.000Z",
"notary_account_id": null,
"notary_org_id": null,
"notary_user_id": null,
"operation_id": null,
"quantity": 3,
"timetoexpiration": null,
"to_account_id": "",
"to_org_id": null,
"to_user_id": null,
"token_id": "USD",
"token_name": null
},
{
"from_account_id": "oaccount~0d7b3f73aea28065017ce8b79c0bb19256dc0cb475a0b2a85192bd110f69535c",
"from_org_id": "CB",
"from_user_id": "retirer_user_cb",
"holding_id": "ohold~cbdc~USD~0031",
"holding_status": "REJECT_BURN",
"last_updated_time": "2024-11-26T21:43:15.000Z",
"notary_account_id": null,
"notary_org_id": null,
"notary_user_id": null,
"operation_id": null,
"quantity": 2,
"timetoexpiration": null,
"to_account_id": "",
"to_org_id": null,
"to_user_id": null,
"token_id": "USD",
"token_name": null
}
],
"encode": "JSON"
}
}
-
getPendingIssuance
- This method retrieves all pending issuance (transfer) transactions where the caller is assigned as an approver, including details of the organization, and user IDs of accounts involved (sender, recipient, and notary). This method can be called only by a
Token Admin or Token Auditor of the chaincode, an Org Admin or Org Auditor of the specified organization, or the Notary.
public async getPendingIssuance(token_id: string)
- Parameters:
token_id: string – The ID of the token.
- Return Value Example:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"asset_type": "ONHOLD",
"category": "category value",
"from_account_id": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"from_org_id": "CB",
"from_user_id": "creator_user_cb",
"holding_id": "ohold~cbdc~USD~8e314",
"notary_account_id": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
"notary_org_id": "CB",
"notary_user_id": "manager_user_cb",
"operation_id": "8e314",
"quantity": 10,
"timetoexpiration": "0",
"to_account_id": "oaccount~44b844deccc6c314e14b8b9b95b51db5c8de499dbdbd3def2a44ba54c899c142",
"to_org_id": "FI1",
"to_user_id": "officer_user1_fi1",
"token_id": "USD",
"token_name": "cbdc"
},
{
"asset_type": "ONHOLD",
"category": "category value",
"from_account_id": "oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594",
"from_org_id": "CB",
"from_user_id": "issuer_user_cb",
"holding_id": "ohold~cbdc~USD~8e315",
"notary_account_id": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
"notary_org_id": "CB",
"notary_user_id": "manager_user_cb",
"operation_id": "8e315",
"quantity": 10,
"timetoexpiration": "0",
"to_account_id": "oaccount~44b844deccc6c314e14b8b9b95b51db5c8de499dbdbd3def2a44ba54c899c142",
"to_org_id": "FI1",
"to_user_id": "officer_user1_fi1",
"token_id": "USD",
"token_name": "cbdc"
}
],
"encode": "JSON"
}
}
-
getPendingRequest
- This method retrieves all pending requests of a specified type where the caller is assigned as an approver. This method can be called only by a
Token Admin or Token Auditor of the chaincode, an Org Admin or Org Auditor of the specified organization, or the Notary.
public async getPendingRequest(token_id: string, request_type: string)
- Parameters:
token_id: string – The ID of the token.
request_type: string – The transaction type. For example, mint or burn.
- Return Value Example:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"valueJson": {
"assetType": "ohold",
"holding_id": "ohold~cbdc~USD~op123",
"operation_id": "op123",
"token_id": "USD",
"token_name": "cbdc",
"operation_type": "mint",
"status": "pending",
"from_account_id": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"to_account_id": "",
"notary_account_id": "oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8",
"quantity": 10,
"time_to_expiration": "0",
"category": "category value",
"description": "description value"
}
}
],
"encode": "JSON"
}
}
-
getTotalBalanceByCallerOrgId
- This method retrieves the total balance of the caller's organization. It can be called by a
Token Admin, Token Auditor, Org Admin, Org Auditor, or any account owner.
public async getTotalBalanceByCallerOrgId()
- Parameters:
token_id: string – The ID of the token.
- Return Value Example:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"totalBalance": 704
}
],
"encode": "JSON"
}
}
-
getTransactionWithBlockNumber
- This method returns the details of the transaction for the specified transaction ID.
public async getTransactionWithBlockNumber(token_id: string, transaction_id: string)
- Parameters:
token_id: string – The ID of the token.
transaction_id: string – The ID of the transaction.
- Return Value Example:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"blockNo": 82,
"key": "otransaction~24f391919a8837d654beaa7346148ea8b2b9704624aef482ce68078c485f5b1b",
"metadata": null,
"txnNo": 0,
"value": null,
"valueJson": {
"assetType": "otransaction",
"transaction_id": "otransaction~24f391919a8837d654beaa7346148ea8b2b9704624aef482ce68078c485f5b1b",
"token_id": "USD",
"from_account_id": "",
"from_account_balance": 0,
"from_account_onhold_balance": 0,
"to_account_id": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
"to_account_balance": 100,
"to_account_onhold_balance": 0,
"transaction_type": "REQUEST_MINT",
"amount": 200,
"timestamp": "2024-11-20T06:48:42.000Z",
"number_of_sub_transactions": 0,
"holding_id": "",
"sub_transaction": "false",
"description": ""
}
}
],
"encode": "JSON"
}
}