机密批发 CBDC 模型

区块链应用程序构建器的增强版本包括模型属性,为批发中央银行数字货币 (CBDC) 场景的机密版本生成其他方法。

如果您在使用扩展令牌分类框架标准的令牌的规范文件中包含 model: wcbdcconfidential: true 参数,Blockchain App Builder 将生成特定于应用程序的链代码,包括以下用于机密批发 CBDC 应用程序的附加 TypeScript 方法和功能。此外,对机密批发 CBDC 模型的 createAccount 方法进行了修改。

有关配置和安装示例批发 CBDC 应用程序(包括通用版本和机密版本)的信息,请参阅:Oracle Database View Definitions for Wholesale CBDCWholesale CBDC Sample Application and Analytics Package

TypeScript 机密批发 CBDC 的方法

机密批发 CBDC 链代码包括扩展的令牌分类框架链代码中可用的所有方法。提供了以下特定于机密批发 CBDC 方案的其他方法。
createAccount
此方法为指定的用户和令牌创建帐户。必须为在任何时候将具有令牌的任何用户创建账户。此方法只能由指定组织的 Token AdminOrg Admin 调用。
@Validator(yup.string(), yup.string(), yup.string(), yup.array().of(yup.string()), yup.object().nullable())
  public async createAccount(org_id: string, user_id: string, token_type: string, application_groups: string[], dailyLimits?: DailyLimits) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.createAccount", "TOKEN", { org_id });
    await this.Ctx.Model.createEvent(EVENT_NAME.CREATE_ACCOUNT, { org_id, user_id, token_type, application_groups, dailyLimits });
    return await this.Ctx.Account.createAccount(org_id, user_id, token_type, application_groups, dailyLimits);
  }
参数:
  • org_id- 要为其创建帐户的用户的成员资格服务提供商 (membership service provider,MSP) ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。
  • user_id- 用户的用户名或电子邮件 ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。
  • token_type: string- 标记的类型,必须是 fungible
  • application_groups: string[]- 用户 ID 所属的应用程序组的列表,用于在 CBDC 应用程序中定义用户的关联。
  • daily_limits: DailyLimits- 以下类型的 JSON 对象。
    {
         "max_daily_amount": 100000
         "max_daily_transactions": 10000
     }
    在示例中,max_daily_amount 值是每天可以处理的最大标记量,max_daily_transactions 值是每天可以完成的最大事务处理数。
返回值示例:
{
    "bapAccountVersion": 0,
    "assetType": "oaccount",
    "account_id": "oaccount~b53cb2c19c92d1d5c8cb9f6e988e7761c34e03e014e6c4b889565fc0abf46c8a",
    "org_id": "CentralBank",
    "token_type": "fungible",
    "token_id": "",
    "token_name": "",
    "balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "onhold_balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "onhold_burn_balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "application_groups": [
        "CENTRAL_BANK_USERS"
    ]
}
setApplicationGroups
此方法在 API 中指定应用程序组的帐户详细信息中设置 application_groups 参数。此方法只能由指定组织的 Token AdminOrg Admin 调用。
@Validator(yup.string(), yup.array().of(yup.string()))
  public async setApplicationGroups (account_id: string, application_groups: string[]) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization('CBDC_TOKEN.setApplicationGroups', 'TOKEN', { org_id: account.org_id });
    const token_asset = await this.getTokenObject(account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.SET_APPLICATION_GROUPS, { account_id, application_groups }, token_asset);
    return this.Ctx.Account.setApplicationGroups (account_id, application_groups)
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • application_groups: string[]- 帐户 ID 所属的应用程序组的列表,用于在 CBDC 应用程序中定义用户的关联。
返回值示例:
{
          "bapAccountVersion": 10,
          "assetType": "oaccount",
          "account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
          "org_id": "CentralBank",
          "token_type": "fungible",
          "token_id": "USD",
          "token_name": "cbdc",
          "balance": "02c4601262fa7ece1ffc909811f829ad973d4133ca27c9c0fa82972d441400ad3e",
          "onhold_balance": "028954d23bfabee1a10d9f5a07793dec08ab0f93fd506079b0fa33f525d527595f",
          "onhold_burn_balance": "028954d23bfabee1a10d9f5a07793dec08ab0f93fd506079b0fa33f525d527595f",
          "application_groups": [
              "SYSTEM_RETIRERS"
          ]
      }
getBurnQuantity
此方法返回指定组织的消耗标记的总数量。此方法只能由 Token AdminToken Auditor 或具有刻录器角色的用户调用。
@GetMethod()
  @Validator(yup.string())
  public async getBurnQuantity(token_id: string) {
    return await this.Ctx.CBDCToken.getBurnQuantity(token_id);
  }
参数:
  • token_id: string- 令牌的 ID。
返回值示例:
{
           "burnt_quantity": 1200
       }
getActionHistory
此方法检索调用方对薄荷、消耗和转移(发放)操作进行的审批或拒绝的历史记录,包括组织的详细信息以及涉及的帐户(发件人、收件人和公证人)的用户 ID。
@GetMethod()
  @Validator(yup.string())
  public async getActionHistory(token_id: string) {
    return await this.Ctx.CBDCToken.getActionHistory(token_id);
  }
参数:
  • token_id: string- 令牌的 ID。
返回值示例:
[
           {
               "from_account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~b770",
               "holding_status": "APPROVE_BURN",
               "last_updated_time": "2025-08-25T13:21:24.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": null,
               "to_org_id": null,
               "token_name": null,
               "quantity": 200
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~e7b6",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-25T13:20:50.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 1000
           },
           {
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~81d7c4ac",
               "holding_status": "EXECUTEHOLD",
               "last_updated_time": "2025-08-25T13:16:55.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
               "to_org_id": "Org1",
               "token_name": null,
               "quantity": 200
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~1e19",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-13T06:12:41.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 10000
           },
           {
               "from_account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~1f74",
               "holding_status": "REJECT_BURN",
               "last_updated_time": "2025-08-12T21:09:53.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "",
               "to_org_id": null,
               "token_name": null,
               "quantity": 1000
           },
           {
               "from_account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~d67c",
               "holding_status": "REJECT_BURN",
               "last_updated_time": "2025-08-12T21:09:47.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "",
               "to_org_id": null,
               "token_name": null,
               "quantity": 2000
           },
           {
               "from_account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~911b",
               "holding_status": "APPROVE_BURN",
               "last_updated_time": "2025-08-12T21:09:40.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": null,
               "to_org_id": null,
               "token_name": null,
               "quantity": 1000
           },
           {
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~ed815e20",
               "holding_status": "EXECUTEHOLD",
               "last_updated_time": "2025-08-12T21:09:25.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~3954f54a8bc7acdd0c3d0960104240f60d56c26c8a179430267359cd80ce3709",
               "to_org_id": "org2",
               "token_name": null,
               "quantity": 10000
           },
           {
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~12d87129",
               "holding_status": "EXECUTEHOLD",
               "last_updated_time": "2025-08-12T21:09:17.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
               "to_org_id": "Org1",
               "token_name": null,
               "quantity": 10000
           },
           {
               "from_account_id": "",
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~54a4",
               "holding_status": "REJECT_MINT",
               "last_updated_time": "2025-08-12T21:01:27.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 40000
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~9b27",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-12T21:01:16.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 30000
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~eda0",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-12T21:01:05.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 20000
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~1baa",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-12T21:01:03.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 10000
           }
       ]
getPendingIssuance
此方法检索调用方被分配为审批人的所有待决发放(转移)事务处理,包括组织的详细信息以及相关账户(发件人、收件人和公证人)的用户 ID。此方法只能由链代码的 Token AdminToken Auditor、指定组织的 Org AdminOrg AuditorNotary 调用。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getPendingIssuance(token_id: string, org_id: string) {
    return await this.Ctx.CBDCToken.getPendingIssuance(token_id, org_id);
  }
参数:
  • token_id: string- 令牌的 ID。
  • org_id: string- 要获取其待定转移的组织的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
[
           {
               "asset_type": "ONHOLD",
               "category": "issuance",
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~77b75873",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": "77b75873",
               "timetoexpiration": "0",
               "to_account_id": "oaccount~3954f54a8bc7acdd0c3d0960104240f60d56c26c8a179430267359cd80ce3709",
               "to_org_id": "org2",
               "token_id": "USD",
               "token_name": "cbdc",
               "quantity": 200
           },
           {
               "asset_type": "ONHOLD",
               "category": "transfer",
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~e26f11da",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": "e26f11da",
               "timetoexpiration": "0",
               "to_account_id": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
               "to_org_id": "Org1",
               "token_id": "USD",
               "token_name": "cbdc",
               "quantity": 100
           }
       ]
getPendingRequest
此方法检索指定类型的所有待处理请求,其中调用者被分配为审批人。此方法只能由链代码的 Token AdminToken Auditor、指定组织的 Org AdminOrg AuditorNotary 调用。
@GetMethod()
  @Validator(yup.string(), yup.string(), yup.string())
  public async getPendingRequest(token_id: string, request_type: string, org_id: string) {
    return await this.Ctx.CBDCToken.getPendingRequest(token_id, request_type, org_id);
  }
参数:
  • token_id: string- 令牌的 ID。
  • org_id: string- 用于获取待处理请求的组织的成员服务提供商 (membership service provider,MSP) ID。
  • request_type: string –事务处理类型。例如,mintburn
返回值示例:
[
           {
               "valueJson": {
                   "assetType": "ohold",
                   "holding_id": "ohold~cbdc~USD~89ce",
                   "operation_id": "89ce",
                   "token_name": "cbdc",
                   "from_org_id": "CentralBank",
                   "operation_type": "mint",
                   "status": "pending",
                   "from_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                   "to_account_id": "",
                   "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                   "token_id": "USD",
                   "quantity": 2000,
                   "time_to_expiration": "0",
                   "description": "Minting 2000 tokens"
               }
           },
           {
               "valueJson": {
                   "assetType": "ohold",
                   "holding_id": "ohold~cbdc~USD~cf73",
                   "operation_id": "cf73",
                   "token_name": "cbdc",
                   "from_org_id": "CentralBank",
                   "operation_type": "mint",
                   "status": "pending",
                   "from_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                   "to_account_id": "",
                   "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                   "token_id": "USD",
                   "quantity": 200,
                   "time_to_expiration": "0",
                   "description": "Minting 200"
               }
           }
       ]
getTotalBalanceByCallerOrgId
此方法检索调用方组织的总余额。它可以由 Token AdminToken AuditorOrg AdminOrg Auditor 或任何帐户所有者调用。
@GetMethod()
  @Validator()
  public async getTotalBalanceByCallerOrgId() {
    const org_id =  await this.Ctx.Model.getCallerOrgId()
    await this.Ctx.Auth.checkAuthorization("CBDC_TOKEN.getTotalBalanceByCallerOrgId", "TOKEN", { org_id });
    return await this.Ctx.CBDCToken.getTotalBalanceByCallerOrgId();
  }
返回值示例:
{
           "totalBalance": 50500
       }
getTransactionWithBlockNumber
此方法返回指定事务处理 ID 的事务处理详细信息。此方法只能由 Token AdminToken AuditorOrg AdminOrg Auditor 或事务处理的任何参与者调用。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getTransactionWithBlockNumber(token_id: string, transaction_id: string) {
    return await this.Ctx.CBDCToken.getTransactionWithBlockNumber(token_id, transaction_id);
  }
参数:
  • token_id: string- 令牌的 ID。
  • transaction_id: string- 事务处理的 ID。
返回值示例:
[
          {
              "blockNo": 340,
              "key": "otransaction~3140569a4ecb3c3f141cc2468fe21276640b7fd79013d951d9104b79072d8f9c",
              "metadata": null,
              "txnNo": 0,
              "value": null,
              "valueJson": {
                  "assetType": "otransaction",
                  "blockNo": 336,
                  "txnNo": 1,
                  "transaction_id": "otransaction~3140569a4ecb3c3f141cc2468fe21276640b7fd79013d951d9104b79072d8f9c",
                  "token_id": "USD",
                  "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
                  "from_account_balance": 26800,
                  "from_account_onhold_balance": 300,
                  "to_account_id": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
                  "transaction_type": "EXECUTE_HOLD_SENDER",
                  "amount": 200,
                  "timestamp": "2025-08-25T13:16:55.000Z",
                  "number_of_sub_transactions": 0,
                  "holding_id": "ohold~cbdc~USD~81d7c4ac",
                  "sub_transaction": "false",
                  "category": "transfer",
                  "global_transaction_id": "b54d4333-f4bb-4ca4-a7b7-cc75b659d912"
              }
          }
      ]
getAllActiveAccounts
此方法返回与指定令牌 ID 关联的所有活动帐户。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getAllActiveAccounts(orgId: string, tokenId: string) {
    return this.Ctx.CBDCToken.getAllActiveAccounts(orgId, tokenId);
  }
参数:
  • token_id: string- 令牌的 ID。
  • org_id: string- 要获取其有效帐户的组织的成员服务提供商 (membership service provider,MSP) ID。
返回:
  • 成功时,包含用户详细信息的消息。输出因用户的角色而异,如以下示例中所示。
返回值示例(令牌管理员、令牌审计员、组织管理员、组织审计员):
[
           {
               "key": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
               "role_name": null,
               "valueJson": {
                   "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_ADMINS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": [
                   "token_admin"
               ]
           },
           {
               "key": "oaccount~1a6ea9aaa59c9ae8385bfdc870bf02616995c881ffeb111f526c8b31dbbdd43c",
               "role_name": null,
               "valueJson": {
                   "account_id": "oaccount~1a6ea9aaa59c9ae8385bfdc870bf02616995c881ffeb111f526c8b31dbbdd43c",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_AUDITORS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": [
                   "token_auditor"
               ]
           },
           {
               "key": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "role_name": "minter",
               "valueJson": {
                   "account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_CREATORS"
                   ],
                   "max_daily_amount": "1000000",
                   "max_daily_transactions": "100000"
               },
               "non_account_role_name": []
           },
           {
               "key": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "role_name": "notary",
               "valueJson": {
                   "account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_MANAGERS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": []
           },
           {
               "key": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "role_name": null,
               "valueJson": {
                   "account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_ISSUERS"
                   ],
                   "max_daily_amount": "100000",
                   "max_daily_transactions": "10000"
               },
               "non_account_role_name": []
           },
           {
               "key": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "role_name": "burner",
               "valueJson": {
                   "account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_RETIRERS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": []
           }
       ]
返回值示例(所有其他用户):
[
            {
                "key": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                "role_name": null,
                "valueJson": {
                    "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_ADMINS"
                    ]
                }
            },
            {
                "key": "oaccount~1a6ea9aaa59c9ae8385bfdc870bf02616995c881ffeb111f526c8b31dbbdd43c",
                "role_name": null,
                "valueJson": {
                    "account_id": "oaccount~1a6ea9aaa59c9ae8385bfdc870bf02616995c881ffeb111f526c8b31dbbdd43c",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_AUDITORS"
                    ]
                }
            },
            {
                "key": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                "role_name": "minter",
                "valueJson": {
                    "account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_CREATORS"
                    ]
                }
            },
            {
                "key": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                "role_name": "notary",
                "valueJson": {
                    "account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_MANAGERS"
                    ]
                }
            },
            {
                "key": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
                "role_name": null,
                "valueJson": {
                    "account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_ISSUERS"
                    ]
                }
            },
            {
                "key": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
                "role_name": "burner",
                "valueJson": {
                    "account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_RETIRERS"
                    ]
                }
            }
        ]
getAllSuspendedAccounts
此方法返回与指定令牌 ID 关联的所有暂停帐户。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getAllSuspendedAccounts(orgId: string, tokenId: string) {
    return this.Ctx.CBDCToken.getAllSuspendedAccounts(orgId, tokenId);
  }
参数:
  • token_id: string- 令牌的 ID。
  • org_id: string- 用于获取暂停帐户的组织的成员服务提供商 (Membership Service Provider,MSP) ID。
返回:
  • 成功时,包含用户详细信息的消息。输出因用户的角色而异,如以下示例中所示。
返回值示例(令牌管理员、令牌审计员、组织管理员、组织审计员):
[
           {
               "key": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
               "role_name": null,
               "valueJson": {
                   "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_ADMINS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": [
                   "token_admin"
               ]
           }
       ]
返回值示例(所有其他用户):
[
            {
                "key": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                "role_name": null,
                "valueJson": {
                    "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_ADMINS"
                    ]
                }
            }
        ]

TypeScript 用于机密批发 CBDC 的 SDK 方法

机密批发 CBDC 链代码包括通用的令牌分类框架 NFT 链代码中可用的所有 SDK 方法。提供了以下特定于机密批发 CBDC 方案的附加 SDK 方法。

createAccount
此方法为指定的用户和令牌创建帐户。每个在任何时候都有令牌的用户都必须有一个帐户。
Ctx.Account.createAccount(org_id: string, user_id: string, token_type: string, application_groups: string[], dailyLimits);
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。
  • user_id: string- 用户的用户名或电子邮件 ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。
  • token_type: string- 令牌的类型,必须是 fungible
  • application_groups: string[]- 帐户 ID 所属的应用程序组的列表,用于在 CBDC 应用程序中定义用户的关联。
  • daily_limits: DailyLimits- 以下类型的 JSON 对象。
    {
         "max_daily_amount": 100000
         "max_daily_transactions": 10000
     }
    在示例中,max_daily_amount 值是每天可以处理的最大标记量,max_daily_transactions 值是每天可以完成的最大事务处理数。
返回值示例:
{
    "bapAccountVersion": 0,
    "assetType": "oaccount",
    "account_id": "oaccount~b53cb2c19c92d1d5c8cb9f6e988e7761c34e03e014e6c4b889565fc0abf46c8a",
    "org_id": "CentralBank",
    "token_type": "fungible",
    "token_id": "",
    "token_name": "",
    "balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "onhold_balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "onhold_burn_balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "application_groups": [
        "CENTRAL_BANK_USERS"
    ]
}
setApplicationGroups
此方法在 API 中指定应用程序组的帐户详细信息中设置 application_groups 参数。
Ctx.Account.setApplicationGroups (account_id: string, application_groups: string[])
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • application_groups: string[]- 帐户 ID 所属的应用程序组的列表,用于在 CBDC 应用程序中定义用户的关联。
返回值示例:
{
          "bapAccountVersion": 10,
          "assetType": "oaccount",
          "account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
          "org_id": "CentralBank",
          "token_type": "fungible",
          "token_id": "USD",
          "token_name": "cbdc",
          "balance": "02c4601262fa7ece1ffc909811f829ad973d4133ca27c9c0fa82972d441400ad3e",
          "onhold_balance": "028954d23bfabee1a10d9f5a07793dec08ab0f93fd506079b0fa33f525d527595f",
          "onhold_burn_balance": "028954d23bfabee1a10d9f5a07793dec08ab0f93fd506079b0fa33f525d527595f",
          "application_groups": [
              "SYSTEM_RETIRERS"
          ]
      }
getBurnQuantity
此方法返回指定组织的消耗标记的总数量。
Ctx.CBDCToken.getBurnQuantity(token_id: string);
参数:
  • token_id: string- 令牌的 ID。
返回值示例:
{
           "burnt_quantity": 1200
       }
getActionHistory
此方法检索调用方对薄荷、消耗和转移(发放)操作进行的审批或拒绝的历史记录,包括组织的详细信息以及涉及的帐户(发件人、收件人和公证人)的用户 ID。
Ctx.CBDCToken.getActionHistory(token_id: string);
参数:
  • token_id: string- 令牌的 ID。
返回值示例:
[
           {
               "from_account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~b770",
               "holding_status": "APPROVE_BURN",
               "last_updated_time": "2025-08-25T13:21:24.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": null,
               "to_org_id": null,
               "token_name": null,
               "quantity": 200
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~e7b6",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-25T13:20:50.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 1000
           },
           {
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~81d7c4ac",
               "holding_status": "EXECUTEHOLD",
               "last_updated_time": "2025-08-25T13:16:55.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
               "to_org_id": "Org1",
               "token_name": null,
               "quantity": 200
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~1e19",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-13T06:12:41.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 10000
           },
           {
               "from_account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~1f74",
               "holding_status": "REJECT_BURN",
               "last_updated_time": "2025-08-12T21:09:53.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "",
               "to_org_id": null,
               "token_name": null,
               "quantity": 1000
           },
           {
               "from_account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~d67c",
               "holding_status": "REJECT_BURN",
               "last_updated_time": "2025-08-12T21:09:47.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "",
               "to_org_id": null,
               "token_name": null,
               "quantity": 2000
           },
           {
               "from_account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~911b",
               "holding_status": "APPROVE_BURN",
               "last_updated_time": "2025-08-12T21:09:40.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": null,
               "to_org_id": null,
               "token_name": null,
               "quantity": 1000
           },
           {
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~ed815e20",
               "holding_status": "EXECUTEHOLD",
               "last_updated_time": "2025-08-12T21:09:25.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~3954f54a8bc7acdd0c3d0960104240f60d56c26c8a179430267359cd80ce3709",
               "to_org_id": "org2",
               "token_name": null,
               "quantity": 10000
           },
           {
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~12d87129",
               "holding_status": "EXECUTEHOLD",
               "last_updated_time": "2025-08-12T21:09:17.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
               "to_org_id": "Org1",
               "token_name": null,
               "quantity": 10000
           },
           {
               "from_account_id": "",
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~54a4",
               "holding_status": "REJECT_MINT",
               "last_updated_time": "2025-08-12T21:01:27.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 40000
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~9b27",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-12T21:01:16.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 30000
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~eda0",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-12T21:01:05.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 20000
           },
           {
               "from_account_id": null,
               "from_org_id": null,
               "holding_id": "ohold~cbdc~USD~1baa",
               "holding_status": "APPROVE_MINT",
               "last_updated_time": "2025-08-12T21:01:03.000Z",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": null,
               "timetoexpiration": null,
               "to_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "to_org_id": "CentralBank",
               "token_name": null,
               "quantity": 10000
           }
       ]
getPendingIssuance
此方法检索调用方被分配为审批人的所有待决发放(转移)事务处理,包括组织的详细信息以及相关账户(发件人、收件人和公证人)的用户 ID。
Ctx.CBDCToken.getPendingIssuance(token_id: string, org_id: string);
参数:
  • token_id: string- 令牌的 ID。
  • org_id: string- 要获取其待定转移的组织的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
[
           {
               "asset_type": "ONHOLD",
               "category": "issuance",
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~77b75873",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": "77b75873",
               "timetoexpiration": "0",
               "to_account_id": "oaccount~3954f54a8bc7acdd0c3d0960104240f60d56c26c8a179430267359cd80ce3709",
               "to_org_id": "org2",
               "token_id": "USD",
               "token_name": "cbdc",
               "quantity": 200
           },
           {
               "asset_type": "ONHOLD",
               "category": "transfer",
               "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "from_org_id": "CentralBank",
               "holding_id": "ohold~cbdc~USD~e26f11da",
               "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "notary_org_id": "CentralBank",
               "operation_id": "e26f11da",
               "timetoexpiration": "0",
               "to_account_id": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
               "to_org_id": "Org1",
               "token_id": "USD",
               "token_name": "cbdc",
               "quantity": 100
           }
       ]
getPendingRequest
此方法检索指定类型的所有待处理请求,其中调用者被分配为审批人。
Ctx.CBDCToken.getPendingRequest(token_id: string, request_type: string, org_id: string)
参数:
  • token_id: string- 令牌的 ID。
  • org_id: string- 用于获取待处理请求的组织的成员服务提供商 (membership service provider,MSP) ID。
  • request_type: string –事务处理类型。例如,mintburn
返回值示例:
[
           {
               "valueJson": {
                   "assetType": "ohold",
                   "holding_id": "ohold~cbdc~USD~89ce",
                   "operation_id": "89ce",
                   "token_name": "cbdc",
                   "from_org_id": "CentralBank",
                   "operation_type": "mint",
                   "status": "pending",
                   "from_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                   "to_account_id": "",
                   "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                   "token_id": "USD",
                   "quantity": 2000,
                   "time_to_expiration": "0",
                   "description": "Minting 2000 tokens"
               }
           },
           {
               "valueJson": {
                   "assetType": "ohold",
                   "holding_id": "ohold~cbdc~USD~cf73",
                   "operation_id": "cf73",
                   "token_name": "cbdc",
                   "from_org_id": "CentralBank",
                   "operation_type": "mint",
                   "status": "pending",
                   "from_account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                   "to_account_id": "",
                   "notary_account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                   "token_id": "USD",
                   "quantity": 200,
                   "time_to_expiration": "0",
                   "description": "Minting 200"
               }
           }
       ]
getTotalBalanceByCallerOrgId
此方法检索调用方组织的总余额。
Ctx.CBDCToken.getTotalBalanceByCallerOrgId();
返回值示例:
{
           "totalBalance": 50500
       }
getTransactionWithBlockNumber
此方法返回指定事务处理 ID 的事务处理详细信息。
Ctx.CBDCToken.getTransactionWithBlockNumber(token_id: string, transaction_id: string);
参数:
  • token_id: string- 令牌的 ID。
  • transaction_id: string- 事务处理的 ID。
返回值示例:
[
          {
              "blockNo": 340,
              "key": "otransaction~3140569a4ecb3c3f141cc2468fe21276640b7fd79013d951d9104b79072d8f9c",
              "metadata": null,
              "txnNo": 0,
              "value": null,
              "valueJson": {
                  "assetType": "otransaction",
                  "blockNo": 336,
                  "txnNo": 1,
                  "transaction_id": "otransaction~3140569a4ecb3c3f141cc2468fe21276640b7fd79013d951d9104b79072d8f9c",
                  "token_id": "USD",
                  "from_account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
                  "from_account_balance": 26800,
                  "from_account_onhold_balance": 300,
                  "to_account_id": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
                  "transaction_type": "EXECUTE_HOLD_SENDER",
                  "amount": 200,
                  "timestamp": "2025-08-25T13:16:55.000Z",
                  "number_of_sub_transactions": 0,
                  "holding_id": "ohold~cbdc~USD~81d7c4ac",
                  "sub_transaction": "false",
                  "category": "transfer",
                  "global_transaction_id": "b54d4333-f4bb-4ca4-a7b7-cc75b659d912"
              }
          }
      ]
getAllActiveAccounts
此方法返回与指定令牌 ID 关联的所有活动帐户。
Ctx.CBDCToken.getAllActiveAccounts(orgId: string, tokenId: string);
参数:
  • token_id: string- 令牌的 ID。
  • org_id: string- 要获取其有效帐户的组织的成员服务提供商 (membership service provider,MSP) ID。
返回:
  • 成功时,包含用户详细信息的消息。输出因用户的角色而异,如以下示例中所示。
返回值示例(令牌管理员、令牌审计员、组织管理员、组织审计员):
[
           {
               "key": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
               "role_name": null,
               "valueJson": {
                   "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_ADMINS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": [
                   "token_admin"
               ]
           },
           {
               "key": "oaccount~1a6ea9aaa59c9ae8385bfdc870bf02616995c881ffeb111f526c8b31dbbdd43c",
               "role_name": null,
               "valueJson": {
                   "account_id": "oaccount~1a6ea9aaa59c9ae8385bfdc870bf02616995c881ffeb111f526c8b31dbbdd43c",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_AUDITORS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": [
                   "token_auditor"
               ]
           },
           {
               "key": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
               "role_name": "minter",
               "valueJson": {
                   "account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_CREATORS"
                   ],
                   "max_daily_amount": "1000000",
                   "max_daily_transactions": "100000"
               },
               "non_account_role_name": []
           },
           {
               "key": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
               "role_name": "notary",
               "valueJson": {
                   "account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_MANAGERS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": []
           },
           {
               "key": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
               "role_name": null,
               "valueJson": {
                   "account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_ISSUERS"
                   ],
                   "max_daily_amount": "100000",
                   "max_daily_transactions": "10000"
               },
               "non_account_role_name": []
           },
           {
               "key": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
               "role_name": "burner",
               "valueJson": {
                   "account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_RETIRERS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": []
           }
       ]
返回值示例(所有其他用户):
[
            {
                "key": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                "role_name": null,
                "valueJson": {
                    "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_ADMINS"
                    ]
                }
            },
            {
                "key": "oaccount~1a6ea9aaa59c9ae8385bfdc870bf02616995c881ffeb111f526c8b31dbbdd43c",
                "role_name": null,
                "valueJson": {
                    "account_id": "oaccount~1a6ea9aaa59c9ae8385bfdc870bf02616995c881ffeb111f526c8b31dbbdd43c",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_AUDITORS"
                    ]
                }
            },
            {
                "key": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                "role_name": "minter",
                "valueJson": {
                    "account_id": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_CREATORS"
                    ]
                }
            },
            {
                "key": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                "role_name": "notary",
                "valueJson": {
                    "account_id": "oaccount~9b136ef4a60230846a8c14761683851a386d306b79493bc4d00433020c96cfa7",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_MANAGERS"
                    ]
                }
            },
            {
                "key": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
                "role_name": null,
                "valueJson": {
                    "account_id": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_ISSUERS"
                    ]
                }
            },
            {
                "key": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
                "role_name": "burner",
                "valueJson": {
                    "account_id": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_RETIRERS"
                    ]
                }
            }
        ]
getAllSuspendedAccounts
此方法返回与指定令牌 ID 关联的所有暂停帐户。
Ctx.CBDCToken.getAllSuspendedAccounts(orgId: string, tokenId: string);
参数:
  • token_id: string- 令牌的 ID。
  • org_id: string- 用于获取暂停帐户的组织的成员服务提供商 (Membership Service Provider,MSP) ID。
返回:
  • 成功时,包含用户详细信息的消息。输出因用户的角色而异,如以下示例中所示。
返回值示例(令牌管理员、令牌审计员、组织管理员、组织审计员):
[
           {
               "key": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
               "role_name": null,
               "valueJson": {
                   "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                   "org_id": "CentralBank",
                   "token_id": "USD",
                   "application_groups": [
                       "SYSTEM_ADMINS"
                   ],
                   "max_daily_amount": "10000",
                   "max_daily_transactions": "1000"
               },
               "non_account_role_name": [
                   "token_admin"
               ]
           }
       ]
返回值示例(所有其他用户):
[
            {
                "key": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                "role_name": null,
                "valueJson": {
                    "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
                    "org_id": "CentralBank",
                    "token_id": "USD",
                    "application_groups": [
                        "SYSTEM_ADMINS"
                    ]
                }
            }
        ]