Fungible Token Framework Wrapper API 程序包

Oracle Blockchain Platform Digital Assets Edition 包含一个包装 API 程序包,该程序包扩展了 REST API,以支持特定于存款令牌方案的操作。

包装器 API 程序包使用 API 网关服务和 OCI 函数部署专为存款令牌应用程序设计的 API 路由。可替代的令牌框架包装器 API 程序包可从 Oracle Blockchain Platform 控制台下载,其中包括以下组件。
  • DepositTokenWrapperAPI.zip,包含包装器 API 程序包(包括部署所需的 Terraform 脚本)的归档文件。将此文件部署到 Oracle Cloud Infrastructure (OCI) 上的资源管理器堆栈,以便为包装器 API 创建必要的 Oracle 资源。
  • DepositToken_WrapperAPI.postman_collection.json,一个 Postman 集合,可用于测试部署的包装器 API。该集合包括预配置的请求,其中包含与包装器 API 程序包中定义的 API 相对应的端点和有效负载。

包装器 API

activateAccount
原始方法名称:activateAccount
此 POST 方法会激活令牌账户。此方法只能由指定组织的 Token AdminOrg Admin 调用。对于在账户状态功能之前创建的任何账户,必须调用此方法才能查看账户状态为“有效”。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "endorsers": {{endorsers}}
}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回:
  • 成功时,指定令牌账户的账户状态对象的 JSON 表示形式。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "db0738d4a44f6d9c80b24fce7c518c07023f7be19edaa69b272eaf7886b4b925",
        "payload": {
            "assetType": "oaccountStatus",
            "status_id": "oaccountStatus~d5814d96d8517ac31727d60aace0519c58a425892ab0d378fcfb0a35771f65ae",
            "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
            "status": "active"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 194
    }
}
addTokenAdmin
原始方法名称:addTokenAdmin
此 POST 方法将用户添加为链代码的 Token Admin。此方法只能由链代码的 Token Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "sameOrgEndorser": true
}
参数:
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回:
  • 成功时,将出现一条消息,其中包含作为链代码的 Token Admin 添加的用户的详细信息。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed",
        "payload": {
            "msg": "User (Org_Id: CB, User_Id: cb) is already Token Admin."
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 193
    }
}
addTokenAuditor
此 POST 方法将用户添加为链代码的 Token Auditor。此方法只能由链代码的 Token Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "sameOrgEndorser": true
}
参数:
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回:
  • 成功时,将出现一条消息,其中包含作为链代码的 Token Auditor 添加的用户的详细信息。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "cd81f6c4c9e7c18ece357dbf5c139ef66ef2d6566be3b14de5f6d0a3fd4bb2f0",
        "payload": {
            "msg": "Successfully added Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 196
    }
}
addOrgAdmin
原始方法名称:addOrgAdmin
此 POST 方法将用户添加为链代码的 Token Admin。此方法只能由链代码的 Token Admin 或指定的组织的 Org Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "sameOrgEndorser": true
}
参数:
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回:
  • 成功时,将出现一条消息,其中包含作为链代码的 Org Admin 添加的用户的详细信息。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "96a84dffcb9156f7271dfb414e8c43b540595044cf9145f5fd56e9873797fc4a",
        "payload": {
            "msg": "Successfully added Org Admin (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 197
    }
}
addOrgAuditor
此 POST 方法将用户添加为链代码的 Org Auditor。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "sameOrgEndorser": true
}
参数:
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回:
  • 成功时,将出现一条消息,其中包含作为链代码的 Org Auditor 添加的用户的详细信息。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "44bbad35a1478cb714e32f7cfd551897868a203520aab9cea5771d3aadc1cf03",
        "payload": {
            "msg": "Successfully added Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 198
    }
}
addRole
原始方法名称:addRole
此方法将角色添加到指定的用户和令牌。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "role": "role value (for example minter / burner / notary)",
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "endorsers": {{endorsers}}
}
参数:
  • tokenId: string- 令牌的 ID。
  • role: string —要添加到指定用户的角色的名称。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "29ea766dee8e6d273eba3c40a9fea75a1aa85dc3c280d40695f6224c5c52d93c",
        "payload": {
            "msg": "Successfully added role 'notary' to Account Id: oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8 (Org-Id: CB, User-Id: manager_user_cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 201
    }
}
approveMint
原始方法名称:approveMint
公证人可以调用此 POST 方法来批准薄荷请求。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "operationId": "operation_id value",
    "sameOrgEndorser": true
}
参数:
  • tokenId: string- 令牌的 ID。
  • operationId: string —要批准的薄荷请求的唯一操作 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "a4537ef34a955b023b7c205b9abf06a6c79e4fdd761fb24f41b8eb34126b66c0",
        "payload": {
            "msg": "Successfully minted 10 tokens to Account Id: oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0 (Org-Id: CB, User-Id: creator_user_cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 204
    }
}
executeHoldTokens
原始方法名称:executeHoldTokens
公证人调用此方法来批准对令牌的暂挂。令牌所有者之前暂挂的令牌数量现在转移给收件人。如果 quantity 值小于实际暂挂值,则令牌的所有者可以再次获得剩余金额。如果在标记模型的 behaviors 部分中指定了 roles 行为并且设置了 notary_role_name 值,则调用方帐户必须具有公证人角色。否则,任何具有帐户的呼叫者都可以作为公证人。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "operationId": "operation_id value",
    "quantity": 1,
    "endorsers": {{endorsers}}
}
参数:
  • tokenId: string- 令牌的 ID。
  • operationId: string —要批准的薄荷请求的唯一操作 ID。
  • quantity: number- 要传输的暂挂令牌数。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "c1149aaa486abc4931d9024c18dfcb230bb321723d1160b0bf981c0011c4856a",
        "payload": {
            "msg": "Account Id: oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594 (Org-Id: CB, User-Id: issuer_user_cb) is successfully executed '10' tokens from Operation Id '8e3145'."
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 213
    }
}
associateTokenToAccount
原始方法名称:associateTokenToAccount
此 POST 方法将指定的账户 ID 与指定的令牌关联。可以通过 Token AdminOrg Admin 调用它。
有效负载:
{
    "accountId": "account_id value",
    "tokenId": "{{bc-token-id}}",
    "endorsers": {{endorsers}}
}
参数:
  • accountId: string –帐户的 ID。
  • tokenId: string- 令牌的 ID。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "efc7381fb6fc6174a40e83ff5f09d2bbf7f6f490365e3bbf19d5502c2cfec474",
        "payload": {
            "bapAccountVersion": 0,
            "assetType": "oaccount",
            "account_id": "oaccount~1c6aa60e220b8fc70caf4cea1ed723ddb193a00321e5e0004def062816b77090",
            "user_id": "cb12",
            "org_id": "CB",
            "token_type": "fungible",
            "token_id": "USD",
            "token_name": "cbdc",
            "balance": 0,
            "onhold_balance": 0,
            "max_daily_amount": 10000,
            "daily_amount": 0,
            "max_daily_transactions": 100,
            "daily_transactions": 0,
            "current_date": "2024-12-11T00:00:00.000Z"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 216
    }
}
createAccount
原始方法名称:createAccount
此方法为指定的用户和令牌创建帐户。必须为在任何时候都具有令牌的任何用户创建账户。通过连接资产类型和令牌 ID,然后通过连接组织 ID 和用户 ID 创建 SHA-256 散列来形成账户 ID。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "tokenType": "fungible",
    "dailyLimits": "{\"max_daily_amount\":10000,\"max_daily_transactions\":100}",
    "endorsers": {{endorsers}}
}
参数:
  • orgId —要为其创建账户的用户的成员服务提供商 (MSP) ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、符号 (@) 和连字符 (-)。
  • userId —用户的用户名或电子邮件 ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、符号 (@) 和连字符 (-)。
  • tokenType: TokenType- 令牌的类型,必须为 fungible
  • daily_limits: DailyLimits —以下类型的 JSON 对象。
    {
         "max_daily_amount": 100000
         "max_daily_transactions": 10000
     }
    在示例中,max_daily_amount 值是每天可以处理的最大令牌数,max_daily_transactions 值是每天可以完成的最大事务处理数。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "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,
            "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
    }
}
getAccount
原始方法名称:getAccount
此方法返回指定用户的帐户详细信息。此方法只能由链代码的 Token Admin 或帐户的 Account Owner 调用。
查询:
/getAccount?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "bapAccountVersion": 0,
            "assetType": "oaccount",
            "status": "active",
            "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,
            "max_daily_amount": 10000,
            "daily_amount": 0,
            "max_daily_transactions": 1000,
            "daily_transactions": 0,
            "current_date": "2024-11-20T00:00:00.000Z"
        },
        "encode": "JSON"
    }
}
getAccountBalance
原始方法名称:getAccountBalance
此 GET 方法返回指定帐户和令牌的当前余额。此方法只能由帐户的 Token AdminAccountOwner 调用。
/getAccountBalance?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "msg": "Current Balance is: 100",
            "user_balance": 100
        },
        "encode": "JSON"
    }
}
getAccountsByUser
原始方法名称:getAccountsByUser
此方法返回指定用户的所有帐户的列表。此方法只能由链代码的 Token Admin 或帐户的 Account Owner 调用。
查询:
/getAccountsByUser?orgId={{bc-org-id}}&userId={{bc-user-id}}
参数:
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "bapAccountVersion": 0,
                "assetType": "oaccount",
                "account_id": "oaccount~8db15b42910eeec401e1bf22c69dfdd11c820ecc26539ea03a3426fa25cb8c28",
                "user_id": "admin_user_cb",
                "org_id": "CB",
                "token_type": "fungible",
                "token_id": "",
                "token_name": "",
                "balance": 0,
                "onhold_balance": 0,
                "max_daily_amount": 10000,
                "daily_amount": 0,
                "max_daily_transactions": 1000,
                "daily_transactions": 0,
                "current_date": "2024-11-20T00:00:00.000Z"
            },
            {
                "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,
                "max_daily_amount": 10000,
                "daily_amount": 0,
                "max_daily_transactions": 1000,
                "daily_transactions": 0,
                "current_date": "2024-11-20T00:00:00.000Z"
            },
            {
                "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,
                "max_daily_amount": 10000,
                "daily_amount": 0,
                "max_daily_transactions": 100,
                "daily_transactions": 0,
                "current_date": "2024-12-09T00:00:00.000Z"
            }
        ],
        "encode": "JSON"
    }
}
getAccountTransactionHistory
原始方法名称:getAccountTransactionHistory
此 GET 方法返回账户事务处理历史记录。此方法只能由链代码的 Token Admin 或账户所有者调用。
/getAccountTransactionHistory?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "transaction_id": "otransaction~64c5a4830949eae1424600f3d4a438c6f603a7c3ea31a68e374b899803999e22",
                "transacted_amount": 10,
                "timestamp": "2024-12-11T13:37:28.000Z",
                "balance": 550,
                "onhold_balance": 10,
                "token_id": "USD",
                "category": "category value",
                "description": "description value",
                "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "transaction_type": "REJECT_MINT",
                "transacted_org_id": "CB",
                "transacted_user_id'": "creator_user_cb"
            },
            {
                "transaction_id": "otransaction~a4537ef34a955b023b7c205b9abf06a6c79e4fdd761fb24f41b8eb34126b66c0",
                "transacted_amount": 10,
                "timestamp": "2024-12-11T13:36:32.000Z",
                "balance": 550,
                "onhold_balance": 10,
                "token_id": "USD",
                "description": "description value",
                "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "transaction_type": "APPROVE_MINT",
                "transacted_org_id": "CB",
                "transacted_user_id'": "creator_user_cb"
            },
            {
                "transaction_id": "otransaction~6237a759422bd9fb112742e8cd7e6450df5a74a32236d9b1005571afed8904a4",
                "transacted_amount": 10,
                "timestamp": "2024-12-11T13:36:18.000Z",
                "balance": 540,
                "onhold_balance": 10,
                "token_id": "USD",
                "category": "category value",
                "description": "description value",
                "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "transaction_type": "REQUEST_MINT",
                "transacted_org_id": "CB",
                "transacted_user_id'": "creator_user_cb"
            },
            {
                "transaction_id": "otransaction~06b35071415d74aa1a7c18449149c937d886cae76a832c44cf8d98e84586e76e",
                "transacted_amount": 10,
                "timestamp": "2024-12-11T13:35:46.000Z",
                "balance": 540,
                "onhold_balance": 10,
                "token_id": "USD",
                "category": "category value",
                "description": "description value",
                "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "transaction_type": "REQUEST_MINT",
                "transacted_org_id": "CB",
                "transacted_user_id'": "creator_user_cb"
            }
        ],
        "encode": "JSON"
    }
}
getAccountTransactionHistoryWithFiltersFromRichHistDB
原始方法名称:getAccountTransactionHistoryWithFiltersFromRichHistDB
此方法返回富历史记录数据库中的账户事务处理历史记录详细信息。此方法只能由帐户的 Token AdminAccountOwner 调用。使用此方法之前,必须运行启用了 Oracle REST Data Services (ORDS) 和 OAuth 的 Oracle Autonomous Database,如Oracle Database View Definitions for Wholesale CBDC 中所述。
/getAccountTransactionHistoryWithFiltersFromRichHistDB?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}&customEndpoint=custom_endpoint value&bearerToken=bearer_token value&filters={"pageSize":20,"bookmark":"","startTime":"2022-01-16T15:16:36+00:00","endTime":"2022-01-17T15:16:36+00:00"}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • customEndpoint —要从中提取事务处理历史记录的富历史记录数据库的 RESTful 服务端点。
  • bearerToken- 用于调用 RESTful 端点以确保请求得到授权的标记。
  • filters: string- 可选参数。如果为空,将返回所有记录。PageSize 属性确定要返回的记录数。如果 PageSize 为 0,则默认页面大小为 20。Bookmark 属性确定要返回的记录起始索引。必须以 RFC-3339 格式指定 StartTimeEndTime 属性。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
                "transaction_id": "otransaction~64c5a4830949eae1424600f3d4a438c6f603a7c3ea31a68e374b899803999e22",
                "transacted_amount": 10,
                "timestamp": "2024-12-11T13:37:28.000Z",
                "balance": 550,
                "onhold_balance": 10,
                "token_id": "USD",
                "category": "category value",
                "description": "description value",
                "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "transaction_type": "REJECT_MINT",
                "transacted_org_id": "CB",
                "transacted_user_id'": "creator_user_cb"
            },
            {
                "transaction_id": "otransaction~a4537ef34a955b023b7c205b9abf06a6c79e4fdd761fb24f41b8eb34126b66c0",
                "transacted_amount": 10,
                "timestamp": "2024-12-11T13:36:32.000Z",
                "balance": 550,
                "onhold_balance": 10,
                "token_id": "USD",
                "description": "description value",
                "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "transaction_type": "APPROVE_MINT",
                "transacted_org_id": "CB",
                "transacted_user_id'": "creator_user_cb"
            },
            {
                "transaction_id": "otransaction~6237a759422bd9fb112742e8cd7e6450df5a74a32236d9b1005571afed8904a4",
                "transacted_amount": 10,
                "timestamp": "2024-12-11T13:36:18.000Z",
                "balance": 540,
                "onhold_balance": 10,
                "token_id": "USD",
                "category": "category value",
                "description": "description value",
                "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "transaction_type": "REQUEST_MINT",
                "transacted_org_id": "CB",
                "transacted_user_id'": "creator_user_cb"
            },
            {
                "transaction_id": "otransaction~06b35071415d74aa1a7c18449149c937d886cae76a832c44cf8d98e84586e76e",
                "transacted_amount": 10,
                "timestamp": "2024-12-11T13:35:46.000Z",
                "balance": 540,
                "onhold_balance": 10,
                "token_id": "USD",
                "category": "category value",
                "description": "description value",
                "transacted_account": "oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0",
                "transaction_type": "REQUEST_MINT",
                "transacted_org_id": "CB",
                "transacted_user_id'": "creator_user_cb"
            }
        ],
        "encode": "JSON"
    }
}
getNetTokens
原始方法名称:getNetTokens
此 GET 方法返回系统中指定令牌的可用令牌总数。净令牌总数是指刻录令牌后剩余的令牌数量。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
/getNetCBDCTokens?tokenId={{bc-token-id}}
参数:
  • tokenId: string- 令牌的 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "msg": "Net supply of token for Token Id: USD is 878 tokens.",
            "quantity": 878
        },
        "encode": "JSON"
    }
}
getOnHoldIds
原始方法名称:getOnHoldIds
此 GET 方法返回指定用户和令牌的所有保留 ID 的列表。此方法只能由帐户的 Token AdminOrg AdminAccountOwner 调用。
/getOnHoldIds?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "msg": "Holding Ids are: ohold~cbdc~USD~8e3147,ohold~cbdc~USD~8e315",
            "holding_ids": [
                "ohold~cbdc~USD~8e3147",
                "ohold~cbdc~USD~8e315"
            ]
        },
        "encode": "JSON"
    }
}
getTotalMintedTokens
原始方法名称:getTotalMintedTokens
此 GET 方法返回指定令牌的铸造令牌总数。此方法只能由 Token AdminOrg Admin 调用。
查询:
/getTotalMintedTokens?tokenId={{bc-token-id}}
参数:
  • tokenId: string- 令牌的 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "msg": "Total minted token for Token Id: USD is 910 tokens.",
            "quantity": 910
        },
        "encode": "JSON"
    }
}
getUserByAccountId
原始方法名称:getUserByAccountId
此 GET 方法返回指定账户的用户详细信息。此方法可由 Token AdminToken AuditorOrg Auditor 调用。
查询:
/getUserByAccountId?accountId=account_id value
参数:
  • accountId: string –帐户的 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "token_id": "USD",
            "user_id": "admin_user_cb",
            "org_id": "CB"
        },
        "encode": "JSON"
    }
}
getUsersByRole
原始方法名称:getUsersByRole
此方法返回指定角色和令牌的所有用户的列表。此方法只能由 Token Admin 调用。
/getUsersByRole?tokenId={{bc-token-id}}&role=role value (for example minter / burner / notary)
参数:
  • tokenId: string- 令牌的 ID。
  • role: string —要搜索的角色的名称。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
            "users": [
                {
                    "token_id": "USD",
                    "user_id": "creator_user_cb",
                    "org_id": "CB"
                },
                {
                    "token_id": "USD",
                    "user_id": "cb4",
                    "org_id": "CB"
                }
            ]
        },
        "encode": "JSON"
    }
}
holdTokens
原始方法名称:holdTokens
此方法代表具有 to_account_id 帐户的令牌的所有者创建暂挂。指定了公证帐户,该帐户负责完成或释放暂挂。创建暂挂时,付款人指定的标记余额将被暂挂。在完成或释放暂挂之前,无法转移暂挂余额。此方法的调用者必须已创建账户。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "operationId": "operation_id value",
    "toOrgId": "to_org_id value",
    "toUserId": "to_user_id value",
    "notaryOrgId": "notary_org_id value",
    "notaryUserId": "notary_user_id value",
    "quantity": 1,
    "timeToExpiration": "time_to_expiration value",
    "infoDetails": "{\"category\":\"category value\",\"description\":\"description value\"}",
    "endorsers": {{endorsers}}
}
参数:
  • tokenId: string- 令牌的 ID。
  • operationId: string —用于标识暂挂操作的唯一 ID。通常,此 ID 由客户机应用程序传递。
  • toOrgId: string —当前组织中接收方的成员服务提供商 (MSP) ID。
  • toUserId: string- 接收者的用户名或电子邮件 ID。
  • notaryOrgId: string —当前组织中公证人的成员服务提供商 (MSP) ID。
  • notaryUserId: string —公证人的用户名或电子邮件 ID。
  • quantity: number —要暂挂的令牌数。
  • timeToExpiration- 暂挂到期的时间。为永久暂挂指定 0 。否则,请使用 RFC-3339 格式。例如 2021-06-02T12:46:06Z
  • infoDetails: JSON- 如以下示例中所示的说明和类别。
    {
       "category" : "category input",
       "description" : "description input"
    }
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "e575d339299bb98afe83207e749cd07654f209673c84c6973738b6094da33062",
        "payload": {
            "msg": "AccountId oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594 (Org-Id: CB , User-Id: issuer_user_cb) is successfully holding 10 tokens"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 211
    }
}
init
原始方法名称:init
部署链代码时将调用此方法。用户信息将保存为链代码的 Token Admin
有效负载:
{
    "adminList": "[{\"org_id\":\"{{bc-org-id}}\",\"user_id\":\"{{bc-admin-user}}\"}]"
}
参数:
  • adminList array- 由 {user_id, org_id} 信息组成的数组,用于指定令牌管理员列表。adminList 数组是必需参数。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "fdb7dc89832c8045a333823b77fa24ae628178148dc93b3550040e070d7cd807",
        "payload": "",
        "encode": "UTF-8",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 263
    }
}
initializeDepositToken
原始方法名称:initializeDepositToken
此方法创建令牌并初始化令牌属性。资产及其属性保存在状态数据库中。此方法只能由链代码的 Token Admin 调用。
有效负载:
{
    "tokenAsset": "{\"token_id\":\"{{bc-token-id}}\",\"token_desc\":\"token_desc value\"}",
    "sameOrgEndorser": true
}
参数:
  • tokenAsset: <Token Class> —将令牌资产作为参数传递到此方法。模型文件中介绍了令牌资产的属性。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回:
  • 成功后,创建的令牌资产的 JSON 表示形式。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "aa7a4f4cc214e1a041a5a6fb7ca7530f08256559e538c9f9582e6fd12c9e65c8",
        "payload": {
            "assetType": "otoken",
            "events": false,
            "token_id": "t1",
            "token_name": "cbdc",
            "token_desc": "token_desc value",
            "token_standard": "ttf+",
            "token_type": "fungible",
            "token_unit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "holdable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter",
                "burner_role_name": "burner",
                "notary_role_name": "notary",
                "mint_approver_role_name": "notary",
                "burn_approver_role_name": "notary"
            },
            "mintable": {
                "max_mint_quantity": 1000,
                "mint_approval_required": true
            },
            "burnable": {
                "burn_approval_required": true
            },
            "divisible": {
                "decimal": 2
            },
            "token_to_currency_ratio": 999
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 267
    }
}
getAccountHistory
原始方法名称:getAccountHistory
此 GET 方法返回指定用户和令牌的帐户历史记录详细信息。
查询:
/getAccountHistory?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
            {
              "trxId":"2gsdh17fff222467e5667be042e33ce18e804b3e065cca15de306f837e416d7c3e",
              "timeStamp":1629718288,
              "value":{
                 "assetType":"oaccount",
                 "account_id":"oaccount~digicur~b4f45440aa2a7942db64443d047027e9d714d62cba5c3d546d64f368642f622f",
                 "user_id":"user1",
                 "org_id":"Org1MSP",
                 "token_id":"digiCurr101",
                 "token_name":"digicur",
                 "balance":100,
                 "onhold_balance":0,
                 "bapAccountVersion": 1
           },
           {
              "trxId":"9fd07fff222467e5667be042e33ce18e804b3e065cca15de306f837e416d7c3e",
              "timeStamp":1629718288,
              "value":{
                 "assetType":"oaccount",
                 "account_id":"oaccount~digicur~b4f45440aa2a7942db64443d047027e9d714d62cba5c3d546d64f368642f622f",
                 "user_id":"user1",
                 "org_id":"Org1MSP",
                 "token_id":"digiCurr101",
                 "token_name":"digicur",
                 "balance":0,
                 "onhold_balance":0,
                 "bapAccountVersion": 0
              }
           }
        ],
        "encode": "JSON"
    }
}
rejectMint
原始方法名称:rejectMint
公证人可以调用此方法来拒绝铸造请求。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "operationId": "operation_id value",
    "sameOrgEndorser": true
}
参数:
  • token_id: string- 要拒绝铸造的标记的 ID。
  • operation_id: string- 表示 mint 请求的唯一操作 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "64c5a4830949eae1424600f3d4a438c6f603a7c3ea31a68e374b899803999e22",
        "payload": {
            "msg": "Successfully rejected mint request with Operation Id 'op1234' to mint 10 tokens of token id USD"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 205
    }
}
releaseHoldTokens
原始方法名称:releaseHoldTokens
此 POST 方法释放暂挂令牌。转移未完成,所有保留的令牌都可供原始所有者使用。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "operationId": "operation_id value",
    "endorsers": {{endorsers}}
}
参数:
  • token_id: string- 令牌的 ID。
  • operation_id: string —用于标识暂挂操作的唯一 ID。通常,此 ID 由客户机应用程序传递。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "f04ba8895d52bc636d843f88476002bc99d01480c36be87c8fa259cd47a29380",
        "payload": {
            "msg": "Successfully released '10' tokens from Operation Id '8e3144' to Account Id: oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594 (Org-Id: CB, User-Id: issuer_user_cb)."
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 214
    }
}
removeTokenAdmin
原始方法名称:removeTokenAdmin
此 POST 方法将用户删除为链代码的 Token Admin。此方法只能由链代码的 Token Admin 调用。管理员无法自行删除。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "sameOrgEndorser": true
}
参数:
  • org_id: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "6a3b9b568d04b5beb29830f91efe4e8c6310b6cf36940cecfb4ab690fbfde739",
        "payload": {
            "msg": "Successfully removed Token Admin (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 218
    }
}
removeTokenAuditor
原始方法名称:removeTokenAuditor
此 POST 方法将用户删除为链代码的 Token Auditor。此方法只能由链代码的 Token Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "sameOrgEndorser": true
}
参数:
  • org_id: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "a886a6040fbc76374a3c78c89ab0ffc9f7b8391cc5239b169bf3b878cf40c67b",
        "payload": {
            "msg": "Successfully removed Token Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 219
    }
}
removeOrgAdmin
原始方法名称:removeOrgAdmin
此 POST 方法将用户删除为链代码的 Org Admin。此方法只能由指定组织的 Token AdminOrg Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "sameOrgEndorser": true
}
参数:
  • org_id: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "e2a634f6093f89b1984e20ff86a513fabb7c3ade7cc9e27d9734b4aaf6c88597",
        "payload": {
            "msg": "Successfully removed Org Admin (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 220
    }
}
removeOrgAuditor
原始方法名称:removeOrgAuditor
此 POST 方法将用户删除为链代码的 Org Auditor。此方法只能由指定组织的 Token AdminOrg Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "sameOrgEndorser": true
}
参数:
  • org_id: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "c3bc720461004a53b37c68d4bb264858b88d980bc093a0a3ebb62a32974fb306",
        "payload": {
            "msg": "Successfully removed Org Auditor (Org_Id: CB, User_Id: cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 221
    }
}
removeRole
原始方法名称:removeRole
此方法将角色从指定用户中删除。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "role": "role value (for example minter / burner / notary)",
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "endorsers": {{endorsers}}
}
参数:
  • tokenId: string- 令牌的 ID。
  • role: string- 要从指定用户删除的角色的名称。mintableburnable 行为对应于规范文件的 minter_role_nameburner_role_name 属性。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "274f0d0a2c4c3929817fb85b2e857519695c3c238ccf9903b084b87e9be7ee12",
        "payload": {
            "msg": "Successfully removed role 'notary' from Account Id: oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8 (Org-Id: CB, User-Id: manager_user_cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 200
    }
}
requestMint
原始方法名称:requestMint
矿工可以调用此方法,向公证人发送请求以创建指定数量的令牌。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "operationId": "operation_id value",
    "notaryOrgId": "notary_org_id value",
    "notaryUserId": "notary_user_id value",
    "quantity": 1,
    "timeToExpiration": "time_to_expiration value",
    "infoDetails": "{\"category\":\"category value\",\"description\":\"description value\"}",
    "sameOrgEndorser": true
}
参数:
  • tokenId: string- 要 mint 的令牌的 ID。
  • operationId: string- 表示 mint 请求的唯一操作 ID。
  • notaryOrgId: string —将处理请求的矿工公证人的成员服务提供商 (MSP) ID。
  • notaryUserId: string —将处理请求的 minter 公证人的用户名或电子邮件 ID。
  • quantity: number- 要铸币的标记数量。
  • timeToExpiration- 铸造请求到期且不再有效的时间。
  • infoDetails: JSON- 指定请求的类别 (category) 和说明 (description) 的对象,如以下示例中所示。
    {
         "category" : "category input",
         "description" : "description input"
    }
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "06b35071415d74aa1a7c18449149c937d886cae76a832c44cf8d98e84586e76e",
        "payload": {
            "msg": "AccountId oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0 (Org-Id: CB , User-Id: creator_user_cb) has successfully submitted request to mint 10 tokens"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 202
    }
}
burnTokens
原始方法名称:burnTokens
此 POST 方法从事务处理调用者的账户中停用或刻录令牌。此方法的调用者必须具有帐户和刻录器角色。数量必须在规范文件中 divisible 行为的 decimal 参数指定的小数值范围内。此方法可由具有刻录器角色的帐户的 AccountOwner 调用。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "quantity": 1,
    "infoDetails": "{\"category\":\"category value\",\"description\":\"description value\"}",
    "sameOrgEndorser": true
}
参数:
  • tokenId: string- 令牌的 ID。
  • quantity- 要刻录的标记数。
  • infoDetails: JSON- 指定请求的类别 (category) 和说明 (description) 的对象,如以下示例中所示。
    {
         "category" : "category input",
         "description" : "description input"
    }
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回:
  • 成功后,将显示一条成功消息,其中包含已刻录的令牌数量和账户 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "aff0b2dbb163ec8076747525db81fbe8f678ac88a277c5f234337f0747eb1a8d",
        "payload": {
            "msg": "Successfully burned 10 tokens from account id: oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0 (Org-Id: CB, User-Id: creator_user_cb)"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 96
    }
}
setMaxDailyAmount
原始方法名称:setMaxDailyAmount
此 POST 方法用于在帐户详细信息中设置指定金额的 maxDailyAmount 参数。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "tokenId": "{{bc-token-id}}",
    "maxDailyAmount": 1,
    "endorsers": {{endorsers}}
}
参数:
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • tokenId: string- 令牌的 ID。
  • maxDailyAmount: number —指定账户的最大每日金额值,该值定义每天可处理的最大金额。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "28682e0564e4721b6c1a8ec106f8c5c98319e9439959dbb9f83d8e6f111d9975",
        "payload": {
            "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,
            "max_daily_amount": 10000,
            "daily_amount": 0,
            "max_daily_transactions": 1000,
            "daily_transactions": 0,
            "current_date": "2024-11-20T00:00:00.000Z"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 222
    }
}
setMaxDailyTransactionCount
原始方法名称:setMaxDailyTransactionCount
此 POST 方法用于在帐户详细信息中设置指定金额的 maxDailyTransactions 参数。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "tokenId": "{{bc-token-id}}",
    "maxDailyTransactions": 1,
    "endorsers": {{endorsers}}
}
参数:
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • tokenId: string- 令牌的 ID。
  • maxDailyTransactions: number —指定账户的最大每日金额值,该值定义每天允许的最大事务处理数。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "8b6fb01de697562ee098110054f05d4a314933bd11ef471991cb43e25b68bad9",
        "payload": {
            "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,
            "max_daily_amount": 10000,
            "daily_amount": 0,
            "max_daily_transactions": 1000,
            "daily_transactions": 0,
            "current_date": "2024-11-20T00:00:00.000Z"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20010",
        "blockNumber": 223
    }
}
suspendAccount
原始方法名称:suspendAccount
此方法将暂停可替换令牌账户。如果在分类账中未找到 accountStatus 值,则会引发错误。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "endorsers": {{endorsers}}
}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294",
        "payload": {
            "assetType": "oaccountStatus",
            "status_id": "oaccountStatus~d5814d96d8517ac31727d60aace0519c58a425892ab0d378fcfb0a35771f65ae",
            "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6",
            "status": "suspended"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 195
    }
}
transferTokens
原始方法名称:transferTokens
此方法将令牌从调用方转移到指定的帐户。方法的调用者必须有一个帐户。数量必须在规范文件中 divisible 行为的 decimal 参数指定的小数值范围内。
有效负载:
{
    "tokenId": "{{bc-token-id}}",
    "toOrgId": "to_org_id value",
    "toUserId": "to_user_id value",
    "quantity": 1,
    "infoDetails": "{\"category\":\"category value\",\"description\":\"description value\"}",
    "endorsers": {{endorsers}}
}
参数:
  • tokenId: string- 令牌的 ID。
  • toOrgId: string —当前组织中接收者(收款人)的成员服务提供商 (MSP) ID。
  • toUserId: string- 接收者的用户名或电子邮件 ID。
  • quantity: number- 要传输的令牌数。
  • infoDetails: JSON- 指定请求的类别 (category) 和说明 (description) 的对象,如以下示例中所示。
    {
         "category" : "category input",
         "description" : "description input"
    }
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "d613b2494b965811b2fa2106152b7085f2d6d7d43e949b10b8668722d3636fe7",
        "payload": {
            "msg": "Successfully transferred 10 tokens from account id: oaccount~9d9806fa92aa0c4fdb34eaffac6e830181b5d47e64fbce752195e83024125ca0 (Org-Id: CB, User-Id: creator_user_cb) to account id: oaccount~51e676d7182a02ea7418ef58a6d54ecfe3858ef40b4ffb3d859b320da3921594 (Org-Id: CB, User-Id: issuer_user_cb). Only 999 number of transactions and 1990 amount transfer left for today: 12/11/2024"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 224
    }
}
initializeExchangePoolUser
原始方法名称:initializeExchangePoolUser
此方法初始化交换池用户,这是一次性活动。此方法只能由 Token Admin 调用。
有效负载:
{
    "orgId": "{{bc-org-id}}",
    "userId": "{{bc-user-id}}",
    "sameOrgEndorser": true
}
参数:
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294",
        "payload": {
            "assetType": "oconversion",
            "convertor_id": "bcb1f3b1442c625d3ce205660c5e717c5858a1fe1e12c325df799a851ceaa09b",
            "org_id": "Org1MSP",
            "user_id": "exchangepooluser"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 196
    }
}
createExchangePoolAccounts
原始方法名称:createExchangePoolAccounts
此方法为给定令牌 ID 数组创建交换池令牌账户。此方法只能由链代码的 Token Admin 调用。
有效负载:
{
    "tokenIds": "[{{bc-token-id}}]",
    "sameOrgEndorser": true
}
参数:
  • token_ids: string []- 令牌 ID 的数组。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294",
        "payload": [
            {
                "account_id": "oaccount~cc9d84f6d4a5976532493ef5200c9603e138adc35166ffd5fd1aad9c1647f034",
                "token_id": "USD",
                "status": "created"
            },
            {
                "account_id": "oaccount~3d4933111ec8bd6cc1ebb43f2b2c390deb929cfa534f9c6ada8e63bac04a13c0",
                "token_id": "INR",
                "status": "created"
            }
        ],
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 197
    }
}
addConversionRate
原始方法名称:addConversionRate
此方法为一对令牌添加一个转换率。令牌转换率最多可以指定八个小数位。此方法只能由链代码的 Token Admin 调用。
有效负载:
{
    "fromTokenId": "from_token_id value",
    "toTokenId": "to_token_id value",
    "tokenConversionRate": 10,
    "sameOrgEndorser": true
}
参数:
  • fromTokenId: string- 要从中转换的令牌的 ID。
  • toTokenId: string- 要转换为的标记的 ID。
  • tokenConversionRate: number- 将 fromTokenId 标记转换为 toTokenId 标记的速率。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294",
        "payload": {
          "assetType": "oconversionRate",
          "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b",
          "from_token_id": "USD",
          "to_token_id": "INR",
          "conversion_rate": 10
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 189
    }
}
updateConversionRate
原始方法名称:updateConversionRate
此方法更新一对令牌的当前转换率。令牌转换率最多可以指定八个小数位。此方法只能由链代码的 Token Admin 调用。
有效负载:
{
    "fromTokenId": "from_token_id value",
    "toTokenId": "to_token_id value",
    "tokenConversionRate": 20,
    "sameOrgEndorser": true
}
参数:
  • fromTokenId: string- 要从中转换的令牌的 ID。
  • toTokenId: string- 要转换为的标记的 ID。
  • tokenConversionRate: number- 将 fromTokenId 标记转换为 toTokenId 标记的速率。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294",
        "payload": {
          "assetType": "oconversionRate",
          "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b",
          "from_token_id": "USD",
          "to_token_id": "INR",
          "conversion_rate": 20
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 208
    }
}
mintWithFundingExchangePool
原始方法名称:mintWithFundingExchangePool
此方法根据指定的标记 ID 和数量在调用者的账户中铸造标记。然后将来自铸造数量的标记的百分比传输到交换池标记账户。
{
    "tokenId": "{{bc-token-id}}",
    "tokenQuantity": 100,
    "percentageTokenToExchangePool": 20,
    "sameOrgEndorser": true
}
参数:
  • tokenId: string- 要 mint 的令牌的 ID。
  • tokenQuantity: number- 要铸币的标记总数。
  • percentageTokenToExchangePool: number- 要转移到交换池令牌账户的铸造令牌百分比。
  • sameOrgEndorser: boolean —一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294",
        "payload": {
            "msg": "Successfully minted 100 tokens to Account Id: oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb (Org-Id: Org1MSP, User-Id: admin) and Successfully transfered 20 tokens to exchange pool Account with Account Id: oaccount~cc9d84f6d4a5976532493ef5200c9603e138adc35166ffd5fd1aad9c1647f034 (Org-Id: Org1MSP, User-Id: exchangepooluser) "
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 209
    }
}
tokenConversion
原始方法名称:tokenConversion
此方法将标记从调用者的帐户转换为由 to_token_idto_org_idto_user_id 值指定的帐户。此方法可由链代码的 Token Admin 和任何令牌账户所有者调用。交换池用户无法调用此方法。
{
    "fromTokenId": "from_token_id value",
    "toTokenId": "to_token_id value",
    "toOrgId": "to_org_id value",
    "toUserId": "to_user_id value",
    "tokenQuantity": 5,
    "endorsers": {{endorsers}}
}
参数:
  • fromTokenId: string- 要从中转换的令牌的 ID。
  • toTokenId: string- 要转换为的标记的 ID。
  • toOrgId: string- 接收令牌的当前组织中用户的成员服务提供商 (MSP) ID。
  • toUserId: string- 接收令牌的用户的用户名或电子邮件 ID。
  • tokenQuantity: number- 要传输的令牌总数。
  • endorsers: string[] —必须为事务处理背书的对等方数组(例如 peer1peer2)。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "txid": "e21d91d98091df77f90105d84074c0b802b01fc97a6b1304247774397fed1294",
        "payload": {
            "msg": "Succesfully converted 5 of tokens with tokenId: [USD] from AccountId: oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb (Org-Id: Org1MSP, User-Id: admin) to 100 of tokens with tokenId: [INR] to AccountId: oaccount~25e2e66718b6dbb59aea9c32acebec60e09d912b2578d4933d377ae5d0628f1e (Org-Id: Org1MSP, User-Id: user) as per the conversion rate of 20"
        },
        "encode": "JSON",
        "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009",
        "blockNumber": 213
    }
}
getConversionRate
原始方法名称:getConversionRate
此 GET 方法获取一对令牌的当前转换率。此方法可由 Token AdminToken AuditorOrg AdminOrg Auditor 调用。
查询:
/getConversionRate?fromTokenId=from_token_id value&toTokenId=to_token_id value
参数:
  • fromTokenId: string- 要从中转换的令牌的 ID。
  • toTokenId: string- 要转换为的标记的 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": {
          "assetType": "oconversionRate",
          "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b",
          "from_token_id": "USD",
          "to_token_id": "INR",
          "conversion_rate": 20
        },
        "encode": "JSON"
    }
}
getConversionHistory
原始方法名称:getConversionRate
此 GET 方法返回指定令牌账户的令牌转换历史记录。此方法可由 Token AdminToken AuditorOrg AdminOrg Auditor 或令牌账户所有者调用。
查询:
/getConversionHistory?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload": [
          {
            "transaction_id": "otransaction~34edd19e03ec8bbbc77bc3372081410a824a5c10f9aa522b3a6390d7e8cb11cf",
            "from_account_id": "oaccount~abc74791148b761352b98df58035601b6f5480448ac2b4a3a7eb54bdbebf48eb",
            "to_account_id": "oaccount~25e2e66718b6dbb59aea9c32acebec60e09d912b2578d4933d377ae5d0628f1e",
            "transacted_amount": 5,
            "converted_amount": 100,
            "conversion_rate": "20",
            "from_token_id": "USD",
            "to_token_id": "INR",
            "balance": 75,
            "onhold_balance": 0,
            "timestamp": "2022-11-30T11:03:20.000Z",
            "transaction_type": "TOKEN_CONVERSION_DEBIT"
          }
        ],
        "encode": "JSON"
    }
}
getConversionRateHistory
原始方法名称:getConversionRate
此方法返回一对标记的标记转换率历史记录。此方法可由 Token AdminToken AuditorOrg AdminOrg Auditor 和任何令牌账户所有者调用。
/getConversionRateHistory?fromTokenId=from_token_id value&toTokenId=to_token_id value
参数:
  • fromTokenId: string —要从中转换的标记的 ID,用于计算转换率。
  • toTokenId: string —要转换为的标记的 ID,用于计算转换率。
返回:
  • 成功后,可以使用转换率历史记录详细信息的 JSON 对象。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload":  [
          {
            "trxId": "0b1ba7bc2620e1438b6580365e5c0ab852247ccfa5a3eb2157d3baca02c0e521",
            "timeStamp": "2022-11-30T10:23:38.000Z",
            "value": {
              "assetType": "oconversionRate",
              "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b",
              "from_token_id": "USD",
              "to_token_id": "INR",
              "conversion_rate": 20
            }
          },
          {
            "trxId": "36fc40ddb3d8308ee7e156af700da131d78d941fe390fc57985b7589e7035d5c",
            "timeStamp": "2022-11-30T10:13:18.000Z",
            "value": {
              "assetType": "oconversionRate",
              "conversion_rate_id": "oconversionRate~91c7eeb0614e7a50b1d5ecad559fcbc80b94034648bf405c9491dacf8d57873b",
              "from_token_id": "USD",
              "to_token_id": "INR",
              "conversion_rate": 10
            }
          }
        ],
        "encode": "JSON"
    }
}
getExchangePoolUser
原始方法名称:getExchangePoolUser
此 GET 方法返回交换池用户的组织 ID 和用户 ID 值。此方法只能由链代码的 Token AdminToken Auditor 调用。
查询:
/getExchangePoolUser
参数:
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload":  {
           "assetType": "oconversion",
           "convertor_id": "bcb1f3b1442c625d3ce205660c5e717c5858a1fe1e12c325df799a851ceaa09b",
           "org_id": "Org1MSP",
           "user_id": "exchangepooluser"
        },
        "encode": "JSON"
    }
}
getAccountOnHoldBalance
原始方法名称:getAccountOnHoldBalance
此 GET 方法返回指定帐户和令牌的当前暂挂余额。此方法只能由帐户的 Token AdminToken AuditorOrg AdminOrg AuditorAccountOwner 调用。
查询:
/getAccountOnHoldBalance?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string —用户的用户名或电子邮件 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload":  {
            "msg":"Total Holding Balance is: 0","holding_balance":0
        },
        "encode": "JSON"
    }
}
getAccountStatus
原始方法名称:getAccountStatus
此 GET 方法检索令牌账户的当前状态。此方法可由 Token AdminToken AuditorOrg AdminOrg Auditor 或令牌账户所有者调用。
查询:
/getAccountStatus?tokenId={{bc-token-id}}&orgId={{bc-org-id}}&userId={{bc-user-id}}
参数:
  • tokenId: string- 令牌的 ID。
  • orgId: string —当前组织中用户的成员服务提供商 (MSP) ID。
  • userId: string- 用户的用户名或电子邮件 ID。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload":  {
            "assetType": "oaccountStatus",
            "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
            "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
            "status": "active"
        },
        "encode": "JSON"
    }
}
getAccountsByRole
原始方法名称:getAccountsByRole
此方法返回指定角色的所有帐户 ID 的列表。此方法只能由链代码的 Token Admin 调用。
查询:
/getAccountsByRole?tokenId={{bc-token-id}}&role=role value (for example minter / burner / notary)
参数:
  • tokenId: string- 令牌的 ID。
  • role: string —要搜索的角色的名称。
返回值示例:
{
    "returnCode": "Success",
    "error": "",
    "result": {
        "payload":  {
            "accounts":["oaccount~digicur~b4f45440aa2a7942db64443d047027e9d714d62cba5c3d546d64f368642f622f"]
        },
        "encode": "JSON"
    }
}