Die folgende API wurde für das CBDC-Großhandelsmodell geändert.
-
setApplicationGroups
- Mit dieser Methode wird der Parameter
application_groups in den Accountdetails für die angegebenen Anwendungsgruppen in der API festgelegt. Diese Methode kann nur von einem Token Admin oder Org Admin der angegebenen Organisation aufgerufen werden.
public async setApplicationGroups (org_id: string, user_id: string, token_id: string, application_groups: string[])
- Parameter:
org_id: string: Die Mitgliedsdienstanbieter-(MSP-)ID des Benutzers in der aktuellen Organisation.
user_id: string: Der Benutzername oder die E-Mail-ID des Benutzers.
token_id: string: Die ID des Tokens.
application_groups: string[]: Eine Liste der Anwendungsgruppen, zu denen die Benutzer-ID gehört, die Zuordnungen des Benutzers in der CBDC-Anwendung definieren.
- Beispiel für Rückgabewert:
{
"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
- Diese Methode gibt alle aktiven Konten zurück, die mit der angegebenen Token-ID verknüpft sind. Jeder Benutzer kann diese Methode aufrufen.
public async getAllActiveAccounts(token_id: string)
- Parameter:
token_id: string: Die ID des Tokens.
- Rückgabewert:
- Bei Erfolg eine Meldung mit Benutzerdetails. Die Ausgabe variiert je nach Benutzerrolle, wie in den folgenden Beispielen gezeigt.
- Beispiel für Rückgabewert (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"
}
}
- Beispiel für Rücksendungswerte (Organisations-Admin, Organisations-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"
}
}
- Beispiel für Rückgabewert (alle anderen Benutzer):
{
"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
- Diese Methode gibt alle ausgesetzten Accounts zurück, die mit der angegebenen Token-ID verknüpft sind. Jeder Benutzer kann diese Methode aufrufen.
func (t *Controller) GetAllSuspendedAccounts(token_id string) (interface{}, error)
- Parameter:
token_id: string: Die ID des Tokens.
- Rückgabewert:
- Bei Erfolg eine Meldung mit Benutzerdetails. Die Ausgabe variiert je nach Benutzerrolle, wie in den folgenden Beispielen gezeigt.
- Beispiel für Rückgabewert (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"
}
}
- Beispiel für Rücksendungswerte (Organisations-Admin, Organisations-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"
}
}
- Beispiel für Rückgabewert (alle anderen Benutzer):
{
"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
- Diese Methode gibt die Gesamtmenge der verbrannten Token für eine bestimmte Organisation zurück. Diese Methode kann nur von einem
Token Admin, Token Auditor oder einem Benutzer mit der Burner-Rolle aufgerufen werden.
public async getBurnQuantity(token_id: string)
- Parameter:
token_id: string: Die ID des Tokens.
- Beispiel für Rückgabewert:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": {
"burnt_quantity": 31
},
"encode": "JSON"
}
}
-
getActionHistory
- Diese Methode ruft die Historie der Genehmigungen oder Ablehnungen ab, die der Anrufer für Mint-, Burn- und Transfervorgänge (Abgabevorgänge) vorgenommen hat, einschließlich Details der Organisation und Benutzer-IDs der beteiligten Konten (Absender, Empfänger und Notar).
public async getActionHistory(token_id: string)
- Parameter:
token_id: string: Die ID des Tokens.
- Beispiel für Rückgabewert:
{
"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
- Diese Methode ruft alle Transaktionen mit ausstehender Ausstellung (Übertragung) ab, bei denen der Anrufer als Genehmiger zugewiesen ist, einschließlich Details der Organisation und Benutzer-IDs der beteiligten Konten (Absender, Empfänger und Notar). Diese Methode kann nur von einer
Token Admin oder Token Auditor des Chaincodes, einer Org Admin oder Org Auditor der angegebenen Organisation oder der Notary aufgerufen werden.
public async getPendingIssuance(token_id: string)
- Parameter:
token_id: string: Die ID des Tokens.
- Beispiel für Rückgabewert:
{
"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
- Diese Methode ruft alle ausstehenden Anforderungen eines bestimmten Typs ab, bei denen der Aufrufer als Genehmiger zugewiesen ist. Diese Methode kann nur von einer
Token Admin oder Token Auditor des Chaincodes, einer Org Admin oder Org Auditor der angegebenen Organisation oder der Notary aufgerufen werden.
public async getPendingRequest(token_id: string, request_type: string)
- Parameter:
token_id: string: Die ID des Tokens.
request_type: string: Der Transaktionstyp. Beispiel: mint oder burn.
- Beispiel für Rückgabewert:
{
"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
- Diese Methode ruft den Gesamtsaldo der Organisation des Aufrufers ab. Er kann von einem
Token Admin, Token Auditor, Org Admin, Org Auditor oder einem beliebigen Accounteigentümer aufgerufen werden.
public async getTotalBalanceByCallerOrgId()
- Parameter:
token_id: string: Die ID des Tokens.
- Beispiel für Rückgabewert:
{
"returnCode": "Success",
"error": "",
"result": {
"payload": [
{
"totalBalance": 704
}
],
"encode": "JSON"
}
}
-
getTransactionWithBlockNumber
- Diese Methode gibt die Details der Transaktion für die angegebene Transaktions-ID zurück.
public async getTransactionWithBlockNumber(token_id: string, transaction_id: string)
- Parameter:
token_id: string: Die ID des Tokens.
transaction_id: string: Die ID der Transaktion.
- Beispiel für Rückgabewert:
{
"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"
}
}