机密事务处理模型

区块链应用程序构建器的增强版本包括一个模型属性,用于为机密模式生成其他方法。

如果您在使用扩展令牌分类框架标准的令牌的规范文件中包含 confidential: true 参数,Blockchain App Builder 将生成链代码以用于机密模式,包括自动生成的标准和 SDK 方法的以下修改版本(仅限 TypeScript)。

有关机密事务处理和机密中央银行数字货币 (CBDC) 方案的更多信息,请参见 Wholesale Central Bank Digital Currency with Confidential Transactions

下表汇总了在机密模式下按脚注标记分类框架项目时生成的方法。

方法种类 自动生成的方法 SDK 方法 说明
访问控制管理 isTokenAdmin isUserTokenAdmin 如果调用方为管理员,则返回 true
addTokenAdmin addTokenAdmin 添加管理员
removeTokenAdmin removeTokenAdmin 删除管理员
getAllTokenAdmins 返回所有管理员
addOrgAdmin addOrgAdmin 添加组织管理员
removeOrgAdmin removeOrgAdmin 删除组织管理员
getAllOrgAdmins 返回所有组织管理员
addTokenAuditor addTokenAuditor 添加审计员
removeTokenAuditor removeTokenAuditor 删除审计者
getAllTokenAuditors 返回所有审计员
addOrgAuditor addOrgAuditor 添加组织审核员
removeOrgAuditor removeOrgAuditor 删除组织审核者
getAllOrgAuditors 返回所有组织审核员
标记管理 getAllTokens 返回所有令牌资产
getDecimals 返回指定标记的小数位数
history 返回令牌的历史记录
getTokensByName 返回指定标记名称的所有标记资产
账户管理 createAccount createAccount 创建用户帐户
associateTokenToAccount associateToken 将帐户与令牌关联
getAllAccounts getAllAccounts 返回所有用户帐户的详细信息
getAllOrgAccounts getAllOrgAccounts 返回组织中所有用户帐户的详细信息
getAccountsByUser getAccountsByUser 返回用户的所有帐户 ID
getUserByAccountId getUserByAccountId 返回账户 ID 的用户详细信息
getAccount getAccountWithStatus 返回令牌账户的详细信息
getAccountDetailsByCustomAccountId getAccountDetailsByCustomAccountId 返回自定义账户 ID 的账户详细信息
getAccountBalance getAccountBalance 返回帐户的当前余额
getAccountStatus getAccountStatus 返回帐户的状态
getAccountStatusHistory history 返回令牌账户的历史记录
activateAccount activateAccount 激活令牌账户
suspendAccount suspendAccount 挂起令牌账户
deleteAccount deleteAccount 删除令牌账户
setMaxDailyAmount setMaxDailyAmount 设置用户每天可以传输的最大标记量
setMaxDailyTransactionCount setMaxDailyTransactionCount 设置用户每天可以完成的最大事务处理数
getMaxDailyAmount getMaxDailyAmount 返回用户每天可以传输的最大令牌数量
getMaxDailyTransactionCount getMaxDailyTransactionCount 返回用户每天可以完成的最大事务处理数
getAccountOnHoldBalance getAccountOnHoldBalance 返回账户的当前暂挂余额
角色管理 addRole addRoleMember 向用户添加角色
removeRole removeRoleMember 从用户中删除角色
getAccountsByRole getAccountsByRole 返回指定角色的账户 ID
getOrgAccountsByRole getOrgAccountsByRole 返回组织中指定角色的账户 ID
getUsersByRole getUsersByRole 返回指定角色的用户列表
getOrgUsersByRole getOrgUsersByRole 返回组织中指定角色的用户列表
isInRole isInRole 返回用户是否具有指定的角色
事务处理管理 getAccountTransactionHistory getAccountTransactionHistory 返回账户的事务处理历史记录
getAccountTransactionHistoryWithFilters getAccountTransactionHistoryWithFilters 退回账户的已筛选事务处理历史记录
getAccountTransactionHistoryWithFiltersFromRichHistDB getAccountTrxHistoryWithFiltersFromRichHistDB 从丰富的历史记录数据库中返回账户的筛选事务处理历史记录
getOrgAccountsTransactionHistoryWithFiltersFromRichHistDB getOrgAccountsTrxHistoryWithFiltersFromRichHistDB 从丰富的历史记录数据库中返回组织的筛选事务处理历史记录
getAllAccountsTransactionHistoryWithFiltersFromRichHistDB getAllAccountsTrxHistoryWithFiltersFromRichHistDB 从丰富的历史记录数据库中返回所有账户的筛选事务处理历史记录
consolidateRunningBalanceInTransactions consolidateRunningBalanceInTransactions 更新待定事务处理的运行账户余额
processSendersAndReceivers processSendersAndReceivers 在组织间转移期间更新账户余额
deleteHistoricalTransactions deleteTransactions 删除旧事务处理
getTransactionById getTransactionById 返回事务处理资产的历史记录
可管理的行为 requestMint 请求发放令牌
approveMint 批准 mint 请求
rejectMint 拒绝 mint 请求
issueTokens issueTokens 铸币厂代币
getTotalMintedTokens getTotalMintedTokens 返回铸造的标记总数
getNetTokens getNetTokens 返回可用令牌的净数量
可转移行为 transferTokens transferTokens 转移令牌
可暂挂行为 holdTokens hold 将令牌余额暂挂
executeHoldTokens executeHold 完成令牌保留
releaseHoldTokens releaseHold 释放令牌暂挂
getOnHoldIds getOnHoldIds 返回帐户的所有持有 ID
getOnHoldDetailsWithOperationId getOnHoldDetailsWithOperationId 返回工序 ID 的暂挂事务处理详细信息
getOnHoldBalanceWithOperationId getOnHoldBalanceWithOperationId 返回工序 ID 的暂挂余额
可燃行为 requestBurn 请求销毁令牌
approveBurn 批准刻录请求
rejectBurn 拒绝刻录请求
组织间转账 executeHoldTokensSender executeHoldTokensSender 从发件人的账户中扣除令牌
executeHoldTokensReceiver executeHoldTokensReceiver 将令牌贷记到接收者的账户

已修改机密链代码的 TypeScript 方法

如果您在使用扩展标记分类框架标准的标记的规范文件中包括 confidential: true 参数,则 Blockchain App Builder 将生成标准自动生成方法的修改版本以及其他方法。

isTokenAdmin
如果函数的调用方为 Token Admin,则此方法返回布尔值 true,否则返回 falseToken AdminToken Auditor、任何 Org Admin 或任何 Org Auditor 可以在区块链网络中的任何其他用户上调用此功能。其他用户只能在自己的账户上调用此方法。
@GetMethod()
 @Validator(yup.string(), yup.string())
 public async isTokenAdmin(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ADMIN.isUserTokenAdmin", "TOKEN", { org_id });
    return await this.Ctx.Auth.isUserTokenAdmin(org_id, user_id);
 }
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回:
  • 如果调用方为 Token Admin,则该方法返回 true,否则返回 false
addTokenAdmin
此方法将用户添加为链代码的 Token Admin。此方法只能由链代码的 Token Admin 调用。由于 user_id 值存储在公共分类账中,因此不要将任何个人身份信息 (PII) 用于 user_id 值。
@Validator(yup.string(), yup.string())
  public async addTokenAdmin(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ADMIN.addTokenAdmin", "TOKEN");
    await this.Ctx.Model.createEvent(EVENT_NAME.ADD_TOKEN_ADMIN, { org_id, user_id });
    return await this.Ctx.Admin.addTokenAdmin(org_id, user_id);
  }
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回:
  • 成功后,将包含作为链代码的 Token Admin 添加的用户详细信息的消息。
返回值示例:
{
  "msg": "Successfully added Token Admin (Org_Id: CentralBank, User_Id: cb1)"
}
removeTokenAdmin
此方法将用户删除为链代码的 Token Admin。此方法只能由链代码的 Token Admin 调用。
@Validator(yup.string(), yup.string())
  public async removeTokenAdmin(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ADMIN.removeTokenAdmin", "TOKEN");
    await this.Ctx.Model.createEvent(EVENT_NAME.REMOVE_TOKEN_ADMIN, { org_id, user_id });
    return await this.Ctx.Admin.removeTokenAdmin(org_id, user_id);
  }
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回:
  • 成功后,将包含被删除为链代码 Token Admin 的用户的详细信息的消息。
返回值示例:
{"msg": "Successfully removed Admin (Org_Id: Org1MSP, User_Id: User1)"}
addOrgAdmin
此方法将用户添加为组织的 Org Admin。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。由于 user_id 值存储在公共分类账中,因此不要将任何个人身份信息 (PII) 用于 user_id 值。
@Validator(yup.string(), yup.string())
  public async addOrgAdmin(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ADMIN.addOrgAdmin", "TOKEN", { org_id });
    await this.Ctx.Model.createEvent(EVENT_NAME.ADD_ORG_ADMIN, { org_id, user_id });
    return await this.Ctx.Admin.addOrgAdmin(org_id, user_id);
  }
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回:
  • 成功后,包含添加为组织的 Org Admin 的用户的详细信息的消息。
返回值示例:
{
    "msg": "Successfully added Org Admin (Org_Id: Org1MSP, User_Id: orgAdmin)"
}
removeOrgAdmin
此方法将用户删除为组织的 Org Admin。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
@Validator(yup.string(), yup.string())
  public async removeOrgAdmin(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ADMIN.removeOrgAdmin", "TOKEN", { org_id });
    await this.Ctx.Model.createEvent(EVENT_NAME.REMOVE_ORG_ADMIN, { org_id, user_id });
    return await this.Ctx.Admin.removeOrgAdmin(org_id, user_id);
  }
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回:
  • 成功后,包含被删除为组织的 Org Admin 的用户的详细信息的消息。
返回值示例:
{
  "msg": "Successfully removed Org Admin (Org_Id Org1MSP User_Id orgAdmin)"
}
addTokenAuditor
此方法将用户添加为链代码的 Token Auditor。此方法只能由链代码的 Token Admin 调用。由于 user_id 值存储在公共分类账中,因此不要将任何个人身份信息 (PII) 用于 user_id 值。
@Validator(yup.string(), yup.string())
  public async addTokenAuditor(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ADMIN.addTokenAuditor", "TOKEN");
    await this.Ctx.Model.createEvent(EVENT_NAME.ADD_TOKEN_AUDITOR, { org_id, user_id });
    return await this.Ctx.Admin.addTokenAuditor(org_id, user_id);
  }
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回值示例:
{
  "msg": "Successfully added Token Auditor (Org_Id: CentralBank, User_Id: cb_admin_demo)"
}
removeTokenAuditor
此方法将用户删除为链代码的 Token Auditor。此方法只能由链代码的 Token Admin 调用。
@Validator(yup.string(), yup.string())
  public async removeTokenAuditor(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ADMIN.removeTokenAuditor", "TOKEN");
    await this.Ctx.Model.createEvent(EVENT_NAME.REMOVE_TOKEN_AUDITOR, { org_id, user_id });
    return await this.Ctx.Admin.removeTokenAuditor(org_id, user_id);
  }
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回值示例:
{
           "msg": "Successfully removed Token Auditor (Org_Id: CB, User_Id: cb)"
       }
addOrgAuditor
此方法将用户添加为链代码的 Org Auditor。此方法只能由链代码的 Token AdminOrg Admin 调用。由于 user_id 值存储在公共分类账中,因此不要将任何个人身份信息 (PII) 用于 user_id 值。
@Validator(yup.string(), yup.string())
  public async addOrgAuditor(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ADMIN.addOrgAuditor", "TOKEN", { org_id });
    await this.Ctx.Model.createEvent(EVENT_NAME.ADD_ORG_AUDITOR, { org_id, user_id });
    return await this.Ctx.Admin.addOrgAuditor(org_id, user_id);
  }
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回:
  • 成功后,将包含作为链代码的 Org Auditor 添加的用户详细信息的消息。
返回值示例:
{
           "msg": "Successfully added Org Auditor (Org_Id: CentralBank, User_Id: cb_admin_demo)"
       }
removeOrgAuditor
此方法将用户删除为链代码的 Org Auditor。此方法只能由链代码的 Token AdminOrg Admin 调用。
@Validator(yup.string(), yup.string())
  public async removeOrgAuditor(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ADMIN.removeOrgAuditor", "TOKEN", { org_id });
    await this.Ctx.Model.createEvent(EVENT_NAME.REMOVE_ORG_AUDITOR, { org_id, user_id });
    return await this.Ctx.Admin.removeOrgAuditor(org_id, user_id);
  }
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回值示例:
{
           "msg": "Successfully removed Org Auditor (Org_Id: CB, User_Id: cb)"
       }
createAccount
此方法为指定的用户和令牌创建帐户。必须为在任何时候将具有令牌的任何用户创建账户。账户跟踪余额、暂挂余额和事务处理历史记录。帐户 ID 通过串联资产类型和标记 ID,然后对组织 ID 和用户 ID 的串联创建 SHA-256 散列来形成。此方法只能由指定组织的 Token AdminOrg Admin 调用。
@Validator(yup.string(),yup.string(), yup.string(), yup.object().nullable())
  public async createAccount(org_id: string, user_id: string, token_type: 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, dailyLimits });
    return await this.Ctx.Account.createAccount(org_id, user_id, token_type, dailyLimits);
  }
参数:
  • org_id- 要为其创建帐户的用户的成员资格服务提供商 (membership service provider,MSP) ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。
  • user_id- 用户的用户名或电子邮件 ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。
  • token_type: string- 标记的类型,必须是 fungible
  • 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",
}
associateTokenToAccount
此方法将可变令牌与账户关联。此方法只能由链代码的 Token Admin 或相关组织的 Org Admin 调用。
@Validator(yup.string(), yup.string(), yup.string().optional())
  public async associateTokenToAccount(account_id: string, token_id: string, custom_account_id?: string) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.associateToken", "TOKEN", { account_id });
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.ASSOCIATE_TOKEN_TO_ACCOUNT, { account_id, token_asset }, token_asset);
    return await this.Ctx.Account.associateToken(account_id, token_id, custom_account_id);
  }
参数:
  • account_id: string- 帐户的 ID。
  • token_id: string- 令牌的 ID。
  • custom_account_id: string- 对于保密模式,账户的银行账户 ID 是唯一的随机字母数字标识符。默认情况下,长度为 14 个字符。
返回:
  • 成功后,更新账户的 JSON 对象。bapAccountVersion 参数在帐户对象中定义供内部使用。
返回值示例:
{
    "bapAccountVersion": 0,
    "assetType": "oaccount",
    "account_id": "oaccount~b53cb2c19c92d1d5c8cb9f6e988e7761c34e03e014e6c4b889565fc0abf46c8a",
    "org_id": "CentralBank",
    "token_type": "fungible",
    "token_id": "USD",
    "token_name": "cbdc",
    "balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "onhold_balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "onhold_burn_balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "application_groups": [
        "CENTRAL_BANK_USERS"
    ]
}
getAllAccounts
此方法返回所有帐户的列表。此方法只能由 Token AdminToken Auditor 调用。此方法使用 Berkeley DB SQL 丰富的查询,并且只能在连接到远程 Oracle Blockchain Platform 网络时调用。
@GetMethod()
  @Validator()
  public async getAllAccounts() {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAllAccounts", "TOKEN");
    return await this.Ctx.Account.getAllAccounts();
  }
参数:
返回值示例:
[
    {
        "key": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
        "valueJson": {
            "bapAccountVersion": 3,
            "assetType": "oaccount",
            "account_id": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
            "org_id": "CentralBank",
            "token_type": "fungible",
            "token_id": "token",
            "token_name": "cbdc",
            "balance": "028a27c752e9b518d156e61da6589e723b179b6d7351dc34ec92bbb27b783ed1dc",
            "onhold_balance": "02d53a7eda9484bda7252212714f647b70d32663cfa416f93f488ef6b6bc8fb2eb",
            "onhold_burn_balance": "02d53a7eda9484bda7252212714f647b70d32663cfa416f93f488ef6b6bc8fb2eb",
            "application_groups": [
                "application_groups value"
            ]
        }
    },
    {
        "key": "oaccount~1da238c1491c919b151f777a615fb5779032c34b3ef3adeca6afe591bac10aaf",
        "valueJson": {
            "bapAccountVersion": 0,
            "assetType": "oaccount",
            "account_id": "oaccount~1da238c1491c919b151f777a615fb5779032c34b3ef3adeca6afe591bac10aaf",
            "org_id": "CentralBank",
            "token_type": "fungible",
            "token_id": "token",
            "token_name": "cbdc",
            "balance": "020da01cd57249c6470b6dd03c2ee4c49de58c71ccc64f2de1203e835967a0846d",
            "onhold_balance": "020da01cd57249c6470b6dd03c2ee4c49de58c71ccc64f2de1203e835967a0846d",
            "onhold_burn_balance": "020da01cd57249c6470b6dd03c2ee4c49de58c71ccc64f2de1203e835967a0846d",
            "application_groups": [
                "application_groups value"
            ]
        }
    }
]
getAllOrgAccounts
此方法返回属于指定组织的所有令牌帐户的列表。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string())
  public async getAllOrgAccounts(org_id: string) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAllOrgAccounts", "TOKEN", { org_id });
    return await this.Ctx.Account.getAllOrgAccounts(org_id);
  }
参数:
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
返回:
  • 成功后,将列出指定组织的所有客户。
返回值示例:
[
    {
        "key": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
        "valueJson": {
            "bapAccountVersion": 2,
            "assetType": "oaccount",
            "account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
            "org_id": "CentralBank",
            "token_type": "fungible",
            "token_id": "token",
            "token_name": "cbdc",
            "balance": "18",
            "onhold_balance": "0",
            "onhold_burn_balance": "0",
            "application_groups": [
                "application_groups value"
            ],
            "user_id": "cb",
            "custom_account_id": "1234567jh"
        }
    },
    {
        "key": "oaccount~5e3b5a3306d7ca3f3e3fe7cc27b6ae547e94dba1c5af58a69a771d7a619b6a66",
        "valueJson": {
            "bapAccountVersion": 1,
            "assetType": "oaccount",
            "account_id": "oaccount~5e3b5a3306d7ca3f3e3fe7cc27b6ae547e94dba1c5af58a69a771d7a619b6a66",
            "org_id": "CentralBank",
            "token_type": "fungible",
            "token_id": "token",
            "token_name": "cbdc",
            "balance": "22",
            "onhold_balance": "0",
            "onhold_burn_balance": "0",
            "application_groups": [
                "application_groups value"
            ],
            "user_id": "cb1",
            "custom_account_id": "1234567jh"
        }
    }
]
getAccountsByUser
此方法返回指定组织 ID 和用户 ID 的所有帐户 ID 的列表。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 或参数中指定的 Account Owner 调用。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getAccountsByUser(org_id: string, user_id: string) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAccountsByUser", "TOKEN", { org_id, user_id });
    return await this.Ctx.Account.getAccountsByUser(org_id, user_id);
  }
参数:
  • org_id string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id string- 用户的用户名或电子邮件 ID。
返回:
  • 成功后,会出现帐户 ID 的 JSON 数组。
返回值示例:
[
    {
        "bapAccountVersion": 2,
        "assetType": "oaccount",
        "user_id": "cb",
        "custom_account_id": "1234567jh",
        "account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
        "org_id": "CentralBank",
        "token_type": "fungible",
        "token_id": "token",
        "token_name": "cbdc",
        "balance": "18",
        "onhold_balance": "0",
        "onhold_burn_balance": "0",
        "application_groups": [
            "application_groups value"
        ]
    }
]
getUserByAccountId
此方法返回指定帐户的用户详细信息(org_iduser_id)。此方法可由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string())
  public async getUserByAccountId(account_id: string) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getUserByAccountId", "TOKEN", { account_id });
    return await this.Ctx.Account.getUserByAccountId(account_id);
  }
参数:
  • account_id: string- 帐户的 ID。
返回:
  • 成功后,用户详细信息的 JSON 对象(org_idtoken_iduser_id)。
返回值示例:
{
    "token_id": "USD",
    "org_id": "CentralBank",
    "user_id": "cb_admin_demo",
    "custom_account_id": "10101234000123"
}
getAccount
此方法返回指定帐户的详细信息。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 或帐户的 AccountOwner 调用。
@GetMethod()
  @Validator(yup.string())
  public async getAccount(account_id: string) {
    await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAccount", "TOKEN", { account_id });
    return await this.Ctx.Account.getAccountWithStatus(account_id);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
    "bapAccountVersion": 2,
    "assetType": "oaccount",
    "user_id": "cb",
    "custom_account_id": "1234567jh",
    "status": "active",
    "account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
    "org_id": "CentralBank",
    "token_type": "fungible",
    "token_id": "token",
    "token_name": "cbdc",
    "balance": "18",
    "onhold_balance": "0",
    "onhold_burn_balance": "0",
    "application_groups": [
        "application_groups value"
    ]
}
getAccountDetailsByCustomAccountId
此方法返回指定自定义账户 ID 的详细信息。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getAccountDetailsByCustomAccountId(custom_account_id: string, org_id: string) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAccountDetailsByCustomAccountId", "TOKEN", { org_id });
    return await this.Ctx.Account.getAccountDetailsByCustomAccountId(custom_account_id, org_id);
  }
参数:
  • custom_account_id: string —账户的银行账户 ID,一个唯一的随机字母数字标识符。
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
[
    {
        "bapAccountVersion": 0,
        "assetType": "oaccount",
        "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
        "org_id": "CentralBank",
        "token_type": "fungible",
        "token_id": "USD",
        "token_name": "cbdc",
        "balance": "0",
        "onhold_balance": "0",
        "onhold_burn_balance": "0",
        "application_groups": [
            "SYSTEM_ADMINS"
        ],
        "user_id": "cb_admin_demo",
        "custom_account_id": "10101234000123"
    }
]
getAccountBalance
此方法返回指定帐户的当前余额。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 或帐户的 AccountOwner 调用。
@GetMethod()
  @Validator(yup.string())
  public async getAccountBalance(account_id: string) {
    await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAccountBalance", "TOKEN", { account_id });
    return await this.Ctx.Account.getAccountBalance(account_id);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回:
  • 成功后,当前帐户余额的 JSON 表示形式。
返回值示例:
{
    "msg": "Current Balance is: 100",
    "user_balance": 100
}
getAccountStatus
此方法获取令牌帐户的当前状态。此方法可由链代码的 Token Admin、指定组织的 Org Admin 或令牌帐户所有者调用。
@GetMethod()
  @Validator(yup.string())
  public async getAccountStatus(account_id: string) {
    await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT_STATUS.get", "TOKEN", { account_id });
    try {
      return await this.Ctx.AccountStatus.getAccountStatus(account_id);
    } catch (err) {
      return await this.Ctx.AccountStatus.getDefaultAccountStatus(account_id);
    }
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回:
  • 成功时,包含令牌帐户状态详细信息的消息。
返回值示例:
{
    "assetType": "oaccountStatus",
    "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
    "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
    "status": "active"
}
getAccountStatusHistory
此方法获取帐户状态的历史记录。此方法可由链代码的 Token Admin、指定组织的 Org Admin 或令牌帐户所有者调用。
@GetMethod()
  @Validator(yup.string())
  public async getAccountStatusHistory(account_id: string) {
    await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT_STATUS.history", "TOKEN", { account_id });
    const status_id = await this.Ctx.AccountStatus.generateAccountStatusId(account_id);
    let account_status_history: any;
    try {
      account_status_history = await this.Ctx.AccountStatus.history(status_id);
    } catch (err) {
      return [];
    }
    return account_status_history;
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回:
  • 成功时,包含账户状态历史记录详细信息的消息。
返回值示例:
[
  {
    "trxId": "d5c6d6f601257ba9b6edaf5b7660f00adc13c37d5321b8f7d3a35afab2e93e63",
    "timeStamp": "2025-12-02T10:39:14.000Z",
    "value": {
      "assetType": "oaccountStatus",
      "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
      "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
      "status": "suspended"
    }
  },
  {
    "trxId": "e6c850cfa084dc20ad95fb2bb8165eef3a3bd62a0ac867cccee57c2003125183",
    "timeStamp": "2025-12-02T10:37:50.000Z",
    "value": {
      "assetType": "oaccountStatus",
      "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
      "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
      "status": "active"
    }
  }
]
activateAccount
此方法激活令牌帐户。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。无法激活已删除的账户。
@Validator(yup.string())
  public async activateAccount(account_id: string) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT_STATUS.activateAccount", "TOKEN", { org_id: account.org_id });
    const token_asset = await this.getTokenObject(account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.ACTIVATE_ACCOUNT, { account_id }, token_asset);
    return await this.Ctx.Account.activateAccount(account_id);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回:
  • 成功时,指定令牌账户的账户状态对象的 JSON 表示形式。
返回值示例:
{
  "assetType": "oaccountStatus",
  "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
  "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
  "status": "active"
}
suspendAccount
此方法暂停令牌帐户。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。账户挂起后,您无法完成任何更新账户的操作。已删除的账户无法暂停。
@Validator(yup.string())
  public async suspendAccount(account_id: string) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT_STATUS.suspendAccount", "TOKEN", { org_id: account.org_id });
    const token_asset = await this.getTokenObject(account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.SUSPEND_ACCOUNT, { account }, token_asset);
    return await this.Ctx.Account.suspendAccount(account_id);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回:
  • 成功时,指定令牌账户的账户状态对象的 JSON 表示形式。
返回值示例:
{
    "assetType": "oaccountStatus",
    "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
    "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
    "status": "suspended"
}
deleteAccount
此方法将删除令牌帐户。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。在删除帐户后,您无法完成更新帐户的任何操作。已删除的帐户处于最终状态,无法更改为任何其他状态。要删除帐户,帐户余额和暂挂余额必须为零。
@Validator(yup.string())
  public async deleteAccount(account_id: string) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT_STATUS.deleteAccount", "TOKEN", { org_id: account.org_id });
    const token_asset = await this.getTokenObject(account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.DELETE_ACCOUNT, { account_id }, token_asset);
    return await this.Ctx.Account.deleteAccount(account_id);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回:
  • 成功时,指定令牌账户的账户状态对象的 JSON 表示形式。
返回值示例:
{
  "assetType": "oaccountStatus",
  "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
  "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
  "status": "deleted"
}
setMaxDailyAmount
此方法为指定的帐户设置 max_daily_amount 值。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
@Validator(yup.string(), yup.string().optional())
  public async setMaxDailyAmount (account_id: string, max_daily_amount?: string) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization('ACCOUNT.setMaxDailyAmount', 'TOKEN', { org_id: account.org_id });
    const token_asset = await this.getTokenObject(account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.SET_MAX_DAILY_AMOUNT, { account_id, max_daily_amount }, token_asset);
    return this.Ctx.Account.setMaxDailyAmount (account_id, max_daily_amount);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • max_daily_amount?: string-(可选)用户每天可以传输的最大标记量。如果未指定,则用户可以每天传输任意数量的令牌。
返回值示例:
{
           "msg": "Successfully set max daily amount for account id oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a to 1000000"
       }
setMaxDailyTransactionCount
此方法为指定的帐户设置 max_daily_transactions 值。此方法只能由链代码的 Token Admin 或指定组织的 Org Admin 调用。
@Validator(yup.string(), yup.string().optional())
  public async setMaxDailyTransactionCount (account_id: string, max_daily_transactions?: string) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization('ACCOUNT.setMaxDailyTransactionCount', 'TOKEN', { org_id: account.org_id });
    const token_asset = await this.getTokenObject(account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.SET_MAX_DAILY_TRANSACTION_COUNT, { account_id, max_daily_transactions}, token_asset);
    return this.Ctx.Account.setMaxDailyTransactionCount (account_id, max_daily_transactions);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • max_daily_transactions?: string-(可选)用户每天可以完成的最大事务处理数。如果未指定,用户可以每天完成任意数量的事务处理。
返回值示例:
{
            "msg": "Successfully set max daily transactions for account id oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a to 100000"
        }
getMaxDailyAmount
此方法获取指定帐户的 max_daily_amount 值。此方法只能由链代码的 Token AdminToken Auditor、指定组织的 Org AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string())
  public async getMaxDailyAmount (account_id: string) {
    await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization('ACCOUNT.getMaxDailyAmount', 'TOKEN', { account_id });
    return this.Ctx.Account.getMaxDailyAmount (account_id);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
           "max_daily_amount": "10000"
       }
getMaxDailyTransactionCount
此方法获取指定帐户的 max_daily_transactions 值。此方法只能由链代码的 Token AdminToken Auditor、指定组织的 Org AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string())
  public async getMaxDailyTransactionCount (account_id: string) {
    await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization('ACCOUNT.getMaxDailyTransactionCount', 'TOKEN', { account_id });
    return this.Ctx.Account.getMaxDailyTransactionCount (account_id);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
           "max_daily_transactions": "100"
       }
getAccountOnHoldBalance
此方法返回指定账户的当前暂挂余额。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 或帐户的 AccountOwner 调用。
@GetMethod()
  @Validator(yup.string())
  public async getAccountOnHoldBalance(account_id: string) {
    await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAccountOnHoldBalance", "TOKEN", { account_id });
    return await this.Ctx.Account.getAccountOnHoldBalance(account_id);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回:
  • 成功后,当前暂挂余额的 JSON 表示形式。
返回值示例:
{
           "msg": "Total Holding Balance is: 0",
           "holding_balance": 0
       }
addRole
此方法将角色添加到指定的用户和令牌。此方法只能由链代码的 Token Admin 或同时具有指定角色的指定组织的 Org Admin 调用。
@Validator(yup.string(), yup.string())
  public async addRole(account_id: string, role: string) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    const token_asset = await this.getTokenObject(account.token_id);
    await this.Ctx.Auth.checkAuthorization("TOKEN.addRoleMember", "TOKEN", { token_id: account.token_id, org_id: account.org_id, role });
    await this.Ctx.Model.createEvent(EVENT_NAME.ADD_ROLE, { role, account_id }, token_asset);
    return await this.Ctx.Token.addRoleMember(role, account_id, token_asset);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • role: string- 要添加到指定用户的角色的名称。mintableburnable 行为对应于规范文件的 minter_role_nameburner_role_name 属性。同样,notary 角色对应于规范文件的 notary_role_name 属性。
返回:
  • 成功后,将显示包含客户详细信息的消息。
返回值示例:
{
     "msg": "Successfully added role 'notary' to Account Id: oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8"
}
removeRole
此方法从指定用户和令牌中删除角色。此方法只能由链代码的 Token Admin 或同时具有指定角色的指定组织的 Org Admin 调用。
@Validator(yup.string(), yup.string())
  public async removeRole(account_id: string, role: string) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    const token_asset = await this.getTokenObject(account.token_id);
    await this.Ctx.Auth.checkAuthorization("TOKEN.removeRoleMember", "TOKEN", { token_id: account.token_id, org_id: account.org_id, role });
    await this.Ctx.Model.createEvent(EVENT_NAME.REMOVE_ROLE, { role, account_id }, token_asset);
    return await this.Ctx.Token.removeRoleMember(role, account_id, token_asset);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • role: string- 要从指定用户中删除的角色的名称。mintableburnable 行为对应于规范文件的 minter_role_nameburner_role_name 属性。同样,notary 角色对应于规范文件的 notary_role_name 属性。
返回:
  • 成功后,将显示包含客户详细信息的消息。
返回值示例:
{
   "msg": "Successfully removed role 'notary' from Account Id: oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8"
}
getAccountsByRole
此方法返回指定角色和令牌的所有账户 ID 的列表。此方法只能由 Token AdminToken Auditor 调用。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getAccountsByRole(token_id: string, role: string) {
    await this.Ctx.Auth.checkAuthorization("ROLE.getAccountsByRole", "TOKEN");
    return await this.Ctx.Role.getAccountsByRole(token_id, role);
  }
参数:
  • token_id: string- 令牌的 ID。
  • role: string- 要搜索的角色的名称。
返回:
  • 成功后,会出现帐户 ID 的 JSON 数组。
返回值示例:
{
           "accounts": [
               "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75"
           ]
       }
getOrgAccountsByRole
此方法返回指定角色、令牌和组织的所有账户 ID 的列表。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string(), yup.string(), yup.string())
  public async getOrgAccountsByRole(token_id: string, role: string, org_id: string) {
    await this.Ctx.Auth.checkAuthorization("ROLE.getOrgAccountsByRole", "TOKEN", { org_id });
    return await this.Ctx.Role.getOrgAccountsByRole(token_id, role, org_id);
  }
参数:
  • token_id: string- 令牌的 ID。
  • role: string- 要搜索的角色的名称。
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
返回:
  • 成功后,会出现帐户 ID 的 JSON 数组。
返回值示例:
{
           "accounts": [
               "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75"
           ]
       }
getUsersByRole
此方法返回指定角色和令牌的所有用户的列表。此方法只能由 Token AdminToken Auditor 调用。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getUsersByRole(token_id: string, role: string) {
    await this.Ctx.Auth.checkAuthorization("ROLE.getUsersByRole", "TOKEN");
    return await this.Ctx.Role.getUsersByRole(token_id, role);
  }
参数:
  • token_id: string- 令牌的 ID。
  • role: string- 要搜索的角色的名称。
返回值示例:
{
          "users": [
              {
                  "token_id": "token",
                  "org_id": "CentralBank"
              }
          ]
      }
getOrgUsersByRole
此方法返回指定角色、令牌和组织的所有用户的列表。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string(), yup.string(), yup.string())
  public async getOrgUsersByRole(token_id: string, role: string, org_id: string) {
    await this.Ctx.Auth.checkAuthorization("ROLE.getOrgUsersByRole", "TOKEN", { org_id });
    return await this.Ctx.Role.getOrgUsersByRole(token_id, role, org_id);
  }
参数:
  • token_id: string- 令牌的 ID。
  • role: string- 要搜索的角色的名称。
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
{
           "users": [
               {
                   "token_id": "token",
                   "org_id": "CentralBank",
                   "user_id": "cb1",
                   "custom_account_id": "1234567jh"
               }
           ]
       }
isInRole
此方法返回布尔值以指示用户是否具有指定的角色。此方法只能由指定的组织的 Token AdminToken Auditor、帐户的 AccountOwnerOrg AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async isInRole(account_id: string, role: string) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    const token_asset = await this.getTokenObject(account.token_id);
    await this.Ctx.Auth.checkAuthorization("TOKEN.isInRole", "TOKEN", { account_id });
    return { result: await this.Ctx.Token.isInRole(role, account_id, token_asset) };
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • role: string- 要搜索的角色的名称。
返回:
  • 成功时,布尔结果的 JSON 字符串。
返回值示例:
{
           "result": "true"
       }
getAccountTransactionHistory
此方法返回指定账户的账户事务处理历史记录详细信息数组。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 或帐户的 AccountOwner 调用。
@GetMethod()
  @Validator(yup.string())
  public async getAccountTransactionHistory(account_id: string) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAccountTransactionHistory", "TOKEN", { account_id });
    return await this.Ctx.Account.getAccountTransactionHistory(account_id, account.org_id);
  }
参数:
  • account_id: string- 帐户的唯一 ID。
返回值示例:
[
    {
        "transaction_id": "otransaction~4514aa229ebcc4d2fedcaa47c4301615e30c4a9bae45cf0256a5b80d75b3697a",
        "transacted_amount": 1000,
        "timestamp": "2025-08-25T13:20:50.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "APPROVE_MINT",
        "balance": 21000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~1982f73495060e0eef4d78282a91c41e27e8c95572739b0677a1e404a0d20aa9",
        "transacted_amount": 200,
        "timestamp": "2025-08-25T13:12:43.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REQUEST_MINT",
        "balance": 20000,
        "onhold_balance": 0
    },
    .
    .
    .  
    .
    {
        "transaction_id": "otransaction~396e6ca5a11a9609632d0864026409d46a708fb95e3e21b39fa5f3fb78f90872",
        "transacted_amount": 0,
        "timestamp": "2025-08-12T20:43:20.000Z",
        "token_id": "",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "CREATE_ACCOUNT",
        "balance": 0,
        "onhold_balance": 0
    }
]
getAccountTransactionHistoryWithFilters
此方法返回指定用户和令牌的账户事务处理历史记录详细信息的筛选数组。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 或帐户的 AccountOwner 调用。仅当连接到远程 Oracle Blockchain Platform 网络时,才能调用此方法。
@GetMethod()
  @Validator(yup.string(), yup.object().nullable())
  public async getAccountTransactionHistoryWithFilters(account_id: string, filters?: Filters) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAccountTransactionHistoryWithFilters", "TOKEN", { account_id });
    return await this.Ctx.Account.getAccountTransactionHistoryWithFilters(account_id, account.org_id, filters);
  }
参数:
  • account_id: string- 帐户的唯一 ID。
  • filters: string- 可选参数。如果为空,则返回所有记录。PageSize 属性确定要返回的记录数。如果 PageSize 为 0,则默认页面大小为 20。Bookmark 属性确定要返回的记录的起始索引。有关更多信息,请参见 Hyperledger Fabric 文档。必须以 RFC-3339 格式指定 StartTimeEndTime 属性,如以下示例中所示。
    {
         "pageSize": 20,
         "bookmark": "",
         "startTime": "1900-01-01T00:00:00+00:00",
         "endTime": "2100-01-01T00:00:00+00:00"
     }
Postman 请求正文示例:
curl --location 'https://centralbank-oabcs1-bom.blockchain.ocp.oraclecloud.com:7443/restproxy/api/v2/channels/default/chaincode-queries' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic Y2I6MTIzNDVAQXBwQnVpbGRlcg==' \
--data '{
    "chaincode": "confDev",
    "args": [
        "getAccountTransactionHistoryWithFilters"
    ],
    "timeout": 12000,
    "sync": true,
    "peer": "centralbank-oabcs1-bom.blockchain.ocp.oraclecloud.com:20010",
    "transientMap": {
        "args": "[\"oaccount~3a1b1c307883c0f74473fedfa62894d510b68959c4a21c7abb9d0224151aa573\",\"{\\\"pageSize\\\":20,\\\"bookmark\\\":\\\"\\\",\\\"startTime\\\":\\\"1900-01-01T00:00:00+00:00\\\",\\\"endTime\\\":\\\"2100-01-01T00:00:00+00:00\\\"}\"]"
    }
}'
返回值示例:
[
            {
                "transaction_id": "otransaction~ccc2c2e89ab7887af4fdad3dc9918ea057a8aa834a0ed8d0f23271049f084952",
                "transacted_amount": 8,
                "timestamp": "2025-08-20T23:22:53.000Z",
                "token_id": "token",
                "category": "category value",
                "description": "description value",
                "holding_id": "ohold~cbdc~token~hold1",
                "to_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "to_org_id": "Org1",
                "to_user_id": "cb",
                "to_custom_account_id": "1234567jh",
                "from_account_id": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
                "from_org_id": "CentralBank",
                "from_user_id": "Not Available",
                "from_custom_account_id": "Not Available",
                "transacted_account": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
                "transaction_type": "CREDIT",
                "balance": 18,
                "onhold_balance": 0,
                "transacted_org_id": "CentralBank",
                "transacted_user_id": "Not Available",
                "transacted_custom_account_id": "Not Available"
            },
            {
                "transaction_id": "otransaction~6c0452a58f13db93f1c308d60eab1fde6c911921b350c0bbbe0ce7dab394721d",
                "transacted_amount": 10,
                "timestamp": "2025-08-20T23:04:53.000Z",
                "token_id": "token",
                "category": "category value",
                "description": "description value",
                "holding_id": "ohold~cbdc~token~hold1",
                "to_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "to_org_id": "Org1",
                "to_user_id": "cb",
                "to_custom_account_id": "1234567jh",
                "from_account_id": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
                "from_org_id": "CentralBank",
                "from_user_id": "Not Available",
                "from_custom_account_id": "Not Available",
                "transacted_account": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
                "transaction_type": "CREDIT",
                "balance": 10,
                "onhold_balance": 0,
                "transacted_org_id": "CentralBank",
                "transacted_user_id": "Not Available",
                "transacted_custom_account_id": "Not Available"
            },
            .
            .
            .
            .
            {
                "transaction_id": "otransaction~df98e24a3b90661b54b54289b600b13a1051c922db0a4d20e3705a9820ae9c20",
                "transacted_amount": 0,
                "timestamp": "2025-08-20T22:55:09.000Z",
                "category": "",
                "description": "",
                "from_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "from_org_id": "Org1",
                "from_user_id": "cb",
                "from_custom_account_id": "1234567jh",
                "transacted_account": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "transaction_type": "CREATE_ACCOUNT",
                "balance": 0,
                "onhold_balance": 0,
                "transacted_org_id": "Org1",
                "transacted_user_id": "cb",
                "transacted_custom_account_id": "1234567jh"
            }
        ]
getAccountTransactionHistoryWithFiltersFromRichHistDB
此方法从富历史记录数据库中获取事务处理历史记录。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 或帐户的 AccountOwner 调用。
@GetMethod()
  @Validator(yup.string(), yup.string(), yup.string(), yup.object().nullable())
  public async getAccountTransactionHistoryWithFiltersFromRichHistDB(account_id: string, custom_endpoint: string, bearer_token: string, filters?: Filters) {
    const account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAccountTransactionHistoryWithFiltersFromRichHistDB", "TOKEN", { account_id });
    return await this.Ctx.Account.getAccountTrxHistoryWithFiltersFromRichHistDB(account_id, account.org_id, custom_endpoint, bearer_token, filters);
  }
参数:
  • account_id: string- 帐户的唯一 ID。
  • custom_endpoint- 富历史记录数据库的 RESTful 服务端点。
  • bearer_token-RESTful 服务端点的访问授权令牌。
  • filters: string- 可选参数。如果为空,则返回所有记录。PageSize 属性确定要返回的记录数。如果 PageSize 为 0,则默认页面大小为 20。Bookmark 属性确定要返回的记录的起始索引。有关更多信息,请参见 Hyperledger Fabric 文档。必须以 RFC-3339 格式指定 StartTimeEndTime 属性,如以下示例中所示。
    {
         "pageSize": 20,
         "bookmark": "",
         "startTime": "1900-01-01T00:00:00+00:00",
         "endTime": "2100-01-01T00:00:00+00:00"
     }
Postman 请求正文示例:
curl --location 'https://centralbank-oabcs1-bom.blockchain.ocp.oraclecloud.com:7443/restproxy/api/v2/channels/default/chaincode-queries' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic Y2I6MTIzNDVAQXBwQnVpbGRlcg==' \
--data '{
    "chaincode": "confDev",
    "args": [
        "getAccountTransactionHistoryWithFiltersFromRichHistDB"
    ],
    "timeout": 12000,
    "sync": true,
    "peer": "centralbank-oabcs1-bom.blockchain.ocp.oraclecloud.com:20010",
    "transientMap": {
        "args": "[\"oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc\",\"https://g5363dsasdade33f4-sampledb.adb.ap-sydney-1.oraclecloudapps.com/ords/obp2/conf_cc2/conf_cc2\",\"Dtbw-ehx7QjXfw2VbZsMzQ\",\"{\\\"pageSize\\\":20,\\\"bookmark\\\":\\\"\\\",\\\"startTime\\\":\\\"1900-01-01T00:00:00+00:00\\\",\\\"endTime\\\":\\\"2100-01-01T00:00:00+00:00\\\"}\"]"
    }
}'
返回值示例:
[
    {
        "transaction_id": "otransaction~3140569a4ecb3c3f141cc2468fe21276640b7fd79013d951d9104b79072d8f9c",
        "transacted_amount": 200,
        "timestamp": "2025-08-25T13:16:55.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_officer_demo",
        "transacted_custom_account_id": "20200222221111",
        "to_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "to_org_id": "Org1",
        "to_user_id": "fi1_org_officer_demo",
        "to_custom_account_id": "20200222221111",
        "from_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "from_org_id": "CentralBank",
        "from_user_id": "cb_issuer_demo",
        "from_custom_account_id": "10109999001234",
        "transaction_type": "EXECUTEHOLD",
        "category": "transfer",
        "balance": 26800,
        "onhold_balance": 300
    },
    {
        "transaction_id": "otransaction~5112f576c94c2d23c342479bfa37e34612414b3258a64b43cf51b920f4ff5868",
        "transacted_amount": 5000,
        "timestamp": "2025-08-12T21:05:02.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
        "transacted_org_id": "CentralBank",
        "transacted_user_id": "cb_retirer_demo",
        "transacted_custom_account_id": "10109999006543",
        "to_account": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
        "to_org_id": "CentralBank",
        "to_user_id": "cb_retirer_demo",
        "to_custom_account_id": "10109999006543",
        "from_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "from_org_id": "CentralBank",
        "from_user_id": "cb_issuer_demo",
        "from_custom_account_id": "10109999001234",
        "transaction_type": "DEBIT",
        "category": "burn",
        "balance": 45000,
        "onhold_balance": 0
    },
    .  
    .
    .
    .
    {
        "transaction_id": "otransaction~862aa9d9e877d3ea209b87299ab5b12c13ed5ce43d1cf1b934043c1dd02f58f6",
        "transacted_amount": 50000,
        "timestamp": "2025-08-12T21:04:22.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transacted_org_id": "CentralBank",
        "transacted_user_id": "cb__creator_demo",
        "transacted_custom_account_id": "10105678004567",
        "to_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "to_org_id": "CentralBank",
        "to_user_id": "cb_issuer_demo",
        "to_custom_account_id": "10109999001234",
        "from_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "from_org_id": "CentralBank",
        "from_user_id": "cb__creator_demo",
        "from_custom_account_id": "10105678004567",
        "transaction_type": "CREDIT",
        "category": "transfer",
        "balance": 50000,
        "onhold_balance": 0
    }
]
getOrgAccountsTransactionHistoryWithFiltersFromRichHistDB
此方法从指定组织的富历史记录数据库中获取事务处理历史记录。此方法只能由指定组织的 Token AdminToken AuditorOrg AdminOrg Auditor 或帐户的 AccountOwner 调用。
@GetMethod()
  @Validator(yup.string(), yup.string(), yup.string(), yup.object().nullable())
  public async getOrgAccountsTransactionHistoryWithFiltersFromRichHistDB(org_id: string, custom_endpoint: string, bearer_token: string, filters?: Filters) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getOrgAccountsTransactionHistoryWithFiltersFromRichHistDB", "TOKEN", { org_id });
    return await this.Ctx.Account.getOrgAccountsTrxHistoryWithFiltersFromRichHistDB(org_id, custom_endpoint, bearer_token, filters);
  }
参数:
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
  • custom_endpoint- 富历史记录数据库的 RESTful 服务端点。
  • bearer_token-RESTful 服务端点的访问授权令牌。
  • filters: string- 可选参数。如果为空,则返回所有记录。PageSize 属性确定要返回的记录数。如果 PageSize 为 0,则默认页面大小为 20。Bookmark 属性确定要返回的记录的起始索引。有关更多信息,请参见 Hyperledger Fabric 文档。必须以 RFC-3339 格式指定 StartTimeEndTime 属性,如以下示例中所示。
    {
         "pageSize": 20,
         "bookmark": "",
         "startTime": "1900-01-01T00:00:00+00:00",
         "endTime": "2100-01-01T00:00:00+00:00"
     }
Postman 请求正文示例:
curl --location 'https://org1-oabcs1-bom.blockchain.ocp.oraclecloud.com:7443/restproxy/api/v2/channels/default/chaincode-queries' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic Y2I6MTIzNDVAQXBwQnVpbGRlcg==' \
--data '{
    "chaincode": "confDev",
    "args": [
        "getOrgAccountsTransactionHistoryWithFiltersFromRichHistDB"
    ],
    "timeout": 12000,
    "sync": true,
    "peer": "org1-oabcs1-bom.blockchain.ocp.oraclecloud.com:20010",
    "transientMap": {
        "args": "[\"Org1\",\"https://g5363dsasdade33f4-sampledb.adb.ap-sydney-1.oraclecloudapps.com/ords/obp2/conf_cc2/conf_cc2AllOrgAccounts\",\"Dtbw-ehx7QjXfw2VbZsMzQ\",\"{\\\"pageSize\\\":20,\\\"bookmark\\\":\\\"\\\",\\\"startTime\\\":\\\"1900-01-01T00:00:00+00:00\\\",\\\"endTime\\\":\\\"2100-01-01T00:00:00+00:00\\\"}\"]"
    }
}'
返回值示例:
[
    {
        "transaction_id": "otransaction~4793f3907eefce2f9fca7ef107405b0f116efb3afbf83fa0e61fe763690c8235",
        "transacted_amount": 100,
        "timestamp": "2025-08-25T13:47:56.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_officer_demo",
        "transacted_custom_account_id": "20200222221111",
        "to_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "to_org_id": "CentralBank",
        "from_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_officer_demo",
        "from_custom_account_id": "20200222221111",
        "transaction_type": "ONHOLD",
        "holding_id": "ohold~cbdc~USD~2ac01689",
        "category": "issuance"
    },
    {
        "transaction_id": "otransaction~5177f7560d32838242a26ac74f2a90c6ff9b47aae0d0988f28d9b4cf7e27c097",
        "transacted_amount": 10,
        "timestamp": "2025-08-25T13:22:23.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~1e31495a0c149b08cb9d02bdcac5e83d88c0f1557d954dda12bb807d7f6fc111",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_user1_demo",
        "transacted_custom_account_id": "20200198765432",
        "to_account": "oaccount~d08ff55a040d5e5dcf406009bab1b3398e06c374356efb1bddbf2f17fc37f949",
        "to_org_id": "Org1",
        "to_user_id": "fi1_org_user2_demo",
        "to_custom_account_id": "20200211112222",
        "from_account": "oaccount~1e31495a0c149b08cb9d02bdcac5e83d88c0f1557d954dda12bb807d7f6fc111",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_user1_demo",
        "from_custom_account_id": "20200198765432",
        "transaction_type": "CREDIT",
        "holding_id": "ohold~cbdc~USD~454f4bf6",
        "category": "transfer"
    },
    .
    .
    .
    .
    {
        "transaction_id": "otransaction~b7c97d737fb978651c9132276ab677c0bcf795b9db13d0d39cba5243615c7389",
        "transacted_amount": 10,
        "timestamp": "2025-08-21T08:46:09.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_officer_demo",
        "transacted_custom_account_id": "20200222221111",
        "to_account": "oaccount~1e31495a0c149b08cb9d02bdcac5e83d88c0f1557d954dda12bb807d7f6fc111",
        "to_org_id": "Org1",
        "to_user_id": "fi1_org_user1_demo",
        "to_custom_account_id": "20200198765432",
        "from_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_officer_demo",
        "from_custom_account_id": "20200222221111",
        "transaction_type": "ONHOLD",
        "holding_id": "ohold~cbdc~USD~4fbbb846",
        "category": "transfer"
    }
]
getAllAccountsTransactionHistoryWithFiltersFromRichHistDB
此方法从丰富历史记录数据库中获取所有组织的事务处理历史记录。此方法只能由 Token AdminToken Auditor 调用。
@GetMethod()
  @Validator(yup.string(), yup.string(), yup.object().nullable())
  public async getAllAccountsTransactionHistoryWithFiltersFromRichHistDB(custom_endpoint: string, bearer_token: string, filters?: Filters) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getAllAccountsTransactionHistoryWithFiltersFromRichHistDB", "TOKEN");
    return await this.Ctx.Account.getAllAccountsTrxHistoryWithFiltersFromRichHistDB(custom_endpoint, bearer_token, filters);
  }
参数:
  • custom_endpoint- 富历史记录数据库的 RESTful 服务端点。
  • bearer_token-RESTful 服务端点的访问授权令牌。
  • filters: string- 可选参数。如果为空,则返回所有记录。PageSize 属性确定要返回的记录数。如果 PageSize 为 0,则默认页面大小为 20。Bookmark 属性确定要返回的记录的起始索引。有关更多信息,请参见 Hyperledger Fabric 文档。必须以 RFC-3339 格式指定 StartTimeEndTime 属性,如以下示例中所示。
    {
         "pageSize": 20,
         "bookmark": "",
         "startTime": "1900-01-01T00:00:00+00:00",
         "endTime": "2100-01-01T00:00:00+00:00"
     }
Postman 请求正文示例:
curl --location 'https://centralbank-oabcs1-bom.blockchain.ocp.oraclecloud.com:7443/restproxy/api/v2/channels/default/chaincode-queries' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic Y2I6MTIzNDVAQXBwQnVpbGRlcg==' \
--data '{
    "chaincode": "confDev",
    "args": [
        "getAllAccountsTransactionHistoryWithFiltersFromRichHistDB"
    ],
    "timeout": 12000,
    "sync": true,
    "peer": "centralbank-oabcs1-bom.blockchain.ocp.oraclecloud.com:20010",
    "transientMap": {
        "args": "[\"https://g5363dsasdade33f4-sampledb.adb.ap-sydney-1.oraclecloudapps.com/ords/obp2/conf_cc2/conf_cc2AllAccounts\",\"Dtbw-ehx7QjXfw2VbZsMzQ\",\"{\\\"pageSize\\\":20,\\\"bookmark\\\":\\\"\\\",\\\"startTime\\\":\\\"1900-01-01T00:00:00+00:00\\\",\\\"endTime\\\":\\\"2100-01-01T00:00:00+00:00\\\"}\"]"
    }
}'
返回值示例:
[
    {
        "transaction_id": "otransaction~62eb436be7c29fc2ed9cae221e874d9a31b163fa10374e7da09bf5e09a96c3ff",
        "transacted_amount": 10000,
        "timestamp": "2025-08-25T13:57:58.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "transacted_org_id": "CentralBank",
        "transacted_user_id": "cb_issuer_demo",
        "transacted_custom_account_id": "10109999001234",
        "to_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "to_org_id": "CentralBank",
        "to_user_id": "cb_issuer_demo",
        "to_custom_account_id": "10109999001234",
        "from_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "from_org_id": "CentralBank",
        "from_user_id": "cb__creator_demo",
        "from_custom_account_id": "10105678004567",
        "transaction_type": "DEBIT",
        "category": "issuance"
    },
    {
        "transaction_id": "otransaction~4793f3907eefce2f9fca7ef107405b0f116efb3afbf83fa0e61fe763690c8235",
        "transacted_amount": 100,
        "timestamp": "2025-08-25T13:47:56.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_officer_demo",
        "transacted_custom_account_id": "20200222221111",
        "to_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "to_org_id": "CentralBank",
        "to_user_id": "cb_issuer_demo",
        "to_custom_account_id": "10109999001234",
        "from_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_officer_demo",
        "from_custom_account_id": "20200222221111",
        "transaction_type": "ONHOLD",
        "holding_id": "ohold~cbdc~USD~2ac01689",
        "category": "issuance"
    },
    .
    .
    .
    .
    {
        "transaction_id": "otransaction~5177f7560d32838242a26ac74f2a90c6ff9b47aae0d0988f28d9b4cf7e27c097",
        "transacted_amount": 10,
        "timestamp": "2025-08-25T13:22:23.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~d08ff55a040d5e5dcf406009bab1b3398e06c374356efb1bddbf2f17fc37f949",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_user2_demo",
        "transacted_custom_account_id": "20200211112222",
        "to_account": "oaccount~d08ff55a040d5e5dcf406009bab1b3398e06c374356efb1bddbf2f17fc37f949",
        "to_org_id": "Org1",
        "to_user_id": "fi1_org_user2_demo",
        "to_custom_account_id": "20200211112222",
        "from_account": "oaccount~1e31495a0c149b08cb9d02bdcac5e83d88c0f1557d954dda12bb807d7f6fc111",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_user1_demo",
        "from_custom_account_id": "20200198765432",
        "transaction_type": "EXECUTEHOLD",
        "holding_id": "ohold~cbdc~USD~454f4bf6",
        "category": "transfer"
    }
]
deleteHistoricalTransactions
此方法从状态数据库中删除较早的事务处理。此方法只能由 Token Admin 调用。
@Validator(yup.date())
  public async deleteHistoricalTransactions(time_to_expiration: Date) {
    await this.Ctx.Auth.checkAuthorization("TRANSACTION.deleteTransactions", "TOKEN");
    await this.Ctx.Model.createEvent(EVENT_NAME.DELETE_HISTORICAL_TRANSACTIONS, { time_to_expiration });
    return await this.Ctx.Transaction.deleteTransactions(time_to_expiration);
  }
参数:
  • time_to_expiration Date- 指示何时删除事务的时间戳。将删除早于指定时间的事务处理资产。
返回值示例:
{
    "msg": "Successfully deleted transaction older than date: Thu Aug 19 2025 11:19:36 GMT+0000 (Coordinated Universal Time).",
    "transactions": [
           "otransaction~ec3366dd48b4ce2838f820f2f138648e6e55a07226713e59b411ff31b0d21058"
     ]
}
getTransactionById
此方法返回 Transaction 资产的历史记录。此方法只能由 Token AdminToken Auditor、指定组织的 Org AdminOrg Auditor 或事务处理参与者(发件人、收件人或公证人)调用。
@GetMethod()
  @Validator(yup.string())
  public async getTransactionById(transaction_id: string) {
    await this.Ctx.Auth.checkAuthorization("TRANSACTION.getTransactionById", "TOKEN", { transaction_id });
    return await this.Ctx.Transaction.getTransactionById(transaction_id);
  }
参数:
  • transaction_id string —事务处理资产的 ID。
返回:
  • 成功后,该事务处理的历史记录的 JSON 数组。
返回值示例:
{
    "transaction_id": "otransaction~6523597253e45b3c976aecdc54e2c6316d0a4f88ad5d7f3fff48c69213e4375a",
    "history": [
        {
            "trxId": "6523597253e45b3c976aecdc54e2c6316d0a4f88ad5d7f3fff48c69213e4375a",
            "timeStamp": "2025-08-20T23:21:45.000Z",
            "value": {
                "assetType": "otransaction",
                "transaction_id": "otransaction~6523597253e45b3c976aecdc54e2c6316d0a4f88ad5d7f3fff48c69213e4375a",
                "token_id": "token",
                "from_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "to_account_id": "oaccount~5e3b5a3306d7ca3f3e3fe7cc27b6ae547e94dba1c5af58a69a771d7a619b6a66",
                "transaction_type": "TRANSFER",
                "amount": 22,
                "timestamp": "2025-08-20T23:21:45.000Z",
                "number_of_sub_transactions": 0,
                "holding_id": "",
                "sub_transaction": "false",
                "category": "category value",
                "description": "description value"
            }
        }
    ],
    "sub_transactions": []
}
consolidateRunningBalanceInTransactions
此方法计算正在运行的账户余额,并将更新的值保存在事务处理键/值对中。通常,系统管理员使用 REST 代理调度程序调用此方法。此方法只能由 Token AdminOrg Admin 调用。
@Validator(yup.string())
  public async consolidateRunningBalanceInTransactions() {
    await this.Ctx.Auth.checkAuthorization("TRANSACTION.consolidateRunningBalanceInTransactions", "TOKEN");
    return this.Ctx.Transaction.consolidateRunningBalanceInTransactions(true);
  }
返回值示例:
{ msg: "Successfully updated account running balance for pending transactions."}
processSendersAndReceivers
此方法计算并更新在组织间转移期间创建的发送者和接收者键/值对中分布的标记账户余额,然后删除不再使用的发送者和接收者键/值对。通常,系统管理员使用 REST 代理调度程序调用此方法。此方法只能由 Token AdminOrg Admin 调用。
@Validator(yup.string())
  public async processSendersAndReceivers() {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.processSendersAndReceivers", "TOKEN");
    return this.Ctx.Account.processSendersAndReceivers(true);
  }
返回值示例:
{ msg: "Successfully updated balance for accounts from pending receivers."}
requestMint
矿工可以调用此方法,向矿工公证人发送请求以创建指定数量的令牌。
@Validator(
    yup.string(),
    yup.string(),
    yup.number().positive(),
    yup.date(),
    yup.object().nullable()
  )
  public async requestMint(
      operation_id: string,
      notary_account_id: string,
      quantity:number,
      time_to_expiration: Date,
      info_details ?: InfoDetails
  ) {
    const notary_account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(notary_account_id);
    const token_asset = await this.getTokenObject(notary_account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.REQUEST_MINT, { operation_id, notary_account_id, quantity, time_to_expiration, info_details }, token_asset);
    return await this.Ctx.Hold.hold(operation_id, null, notary_account_id, quantity, time_to_expiration, token_asset, HoldOperationType.MINT, info_details);
  }
参数:
  • operation_id: string- 表示 mint 请求的唯一操作 ID。
  • notary_account_id: string- 将处理请求的公证人的唯一帐户 ID。
  • quantity: number –要铸造的令牌数量。
  • time_to_expiration- 铸造请求过期且不再有效的时间。
  • info_details: JSON- 指定请求类别 (category) 和说明 (description) 的对象。

    如果使用的是 Visual Studio Code 与 CLI 或 Postman 集合,则可以采用不同的格式指定 info_details 参数。

    Visual Studio Code:{ "category": "category value", "description": "description value" }

    CLI / Postman: "{\"category\":\"category value\",\"description\":\"description value\"}"

返回值示例:
{
           "msg": "AccountId oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41 has successfully submitted request to mint 200 tokens"
       }
approveMint
矿工公证人可以调用此方法来批准铸造请求。
@Validator(yup.string(), yup.string())
  public async approveMint(token_id: string, operation_id: string) {
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.APPROVE_MINT, { token_asset, operation_id }, token_asset);
    return await this.Ctx.Hold.executeHold(operation_id, token_asset, HoldOperationType.MINT);
  }
参数:
  • token_id: string- 要铸造的令牌的 ID。
  • operation_id: string- 表示 mint 请求的唯一操作 ID。
返回值示例:
{
           "msg": "Successfully minted 1000 tokens to Account Id: oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41"
       }
rejectMint
矿工公证人可以调用此方法来拒绝铸造请求。
@Validator(yup.string(), yup.string())
  public async rejectMint(token_id: string, operation_id: string) {
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.REJECT_MINT, { token_asset, operation_id }, token_asset);
    return await this.Ctx.Hold.releaseHold(operation_id, token_asset, HoldOperationType.MINT);
  }
参数:
  • token_id: string- 要铸造的令牌的 ID。
  • operation_id: string- 表示 mint 请求的唯一操作 ID。
返回值示例:
{
           "msg": "Successfully rejected mint request with Operation Id '89ce' to mint 2000 tokens of token id USD"
       }
issueTokens
此方法用于生成标记,然后这些标记由该方法的调用方拥有。
@Validator(yup.string(), yup.number().positive(), yup.object().nullable())
  public async issueTokens(token_id: string, quantity: number, info_details?: InfoDetails) {
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.ISSUE_TOKENS, { quantity, token_asset, info_details }, token_asset);
    return await this.Ctx.Token.mint(quantity, token_asset, info_details);
  }
参数:
  • token_id: string- 令牌的 ID。
  • quantity- 要铸造的标记数。
  • info_details: JSON- 指定请求类别 (category) 和说明 (description) 的对象。

    如果使用的是 Visual Studio Code 与 CLI 或 Postman 集合,则可以采用不同的格式指定 info_details 参数。

    Visual Studio Code:{ "category": "category value", "description": "description value" }

    CLI / Postman: "{\"category\":\"category value\",\"description\":\"description value\"}"

返回值示例:
{
          "msg": "Successfully minted 1000 tokens to Account Id: oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41"
      }
getTotalMintedTokens
此方法返回指定标记的铸造标记总数。此方法只能由 Token AdminToken AuditorOrg AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string())
  public async getTotalMintedTokens(token_id: string) {
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Auth.checkAuthorization("TOKEN.getTotalMintedTokens", "TOKEN");
    const totalMintedTokens = await this.Ctx.Token.getTotalMintedTokens(token_asset);
    return {
      msg: `Total minted token for Token Id: ${token_id} is ${totalMintedTokens} tokens.`,
      quantity: totalMintedTokens,
    };
  }
参数:
  • token_id: string- 令牌的 ID。
返回:
  • 成功时,JSON 字符串指示令牌总数。
返回值示例:
{
    "msg": "Total minted token for Token Id: USD is 910 tokens.",
    "quantity": 910
}
getNetTokens
此方法返回系统中指定令牌的可用令牌净总数。净令牌总数是令牌被烧毁后剩余的令牌数量。在方程式中:净代币 = 总铸币代币 - 总烧毁代币。如果未刻录任何令牌,则净令牌数等于铸造的令牌总数。此方法只能由 Token AdminToken AuditorOrg AdminOrg Auditor 调用。
@GetMethod()
  @Validator(yup.string())
  public async getNetTokens(token_id: string) {
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Auth.checkAuthorization("TOKEN.getNetTokens", "TOKEN");
    const netTokens = await this.Ctx.Token.getNetTokens(token_asset);
    return {
      msg: `Net supply of token for Token Id: ${token_id} is ${netTokens} tokens.`,
      quantity: netTokens,
    };
  }
参数:
  • token_id: string- 令牌的 ID。
返回:
  • 成功时,指示令牌净数的 JSON 字符串。
返回值示例:
{
    "msg": "Net supply of token for Token Id: USD is 878 tokens.",
    "quantity": 878
}
transferTokens
此方法将令牌从调用方转移到指定的帐户。
@Validator(yup.string(), yup.number(), yup.object().nullable())
  public async transferTokens(to_account_id: string, quantity: number, info_details ?: InfoDetails) {
    if (quantity <= 0) {
      throw new Error("The quantity should be a positive number.")
    }
    const to_account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(to_account_id);
    const token_asset = await this.getTokenObject(to_account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.TRANSFER_TOKENS, { to_account_id, quantity, info_details }, token_asset);
    let isNotary = await this.Ctx.Token.checkNotary(to_account_id, token_asset);
    if(isNotary) {
      throw new Error(`To Account Id '${to_account_id}' can not have a notary role!`);
    }
    return await this.Ctx.Token.transfer(to_account_id, quantity, token_asset, info_details);
  }
参数:
  • to_account_id: string –接收者(收款人)的唯一账户 ID。
  • quantity: number- 要传输的标记数。
  • info_details: JSON- 指定请求类别 (category) 和说明 (description) 的对象。

    如果使用的是 Visual Studio Code 与 CLI 或 Postman 集合,则可以采用不同的格式指定 info_details 参数。

    Visual Studio Code:{ "category": "category value", "description": "description value" }

    CLI / Postman: "{\"category\":\"category value\",\"description\":\"description value\"}"

返回值示例:
{
          "msg": "Successfully transferred 10000 tokens from account id: oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41  to account id: oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a."
      }
holdTokens
此方法代表调用方(令牌的所有者)创建具有 to_account_id 帐户的暂挂。指定的公证账户负责完成或释放暂挂。创建暂挂时,付款人的指定标记余额将被暂挂。在暂挂完成或释放之前,无法转移暂挂余额。
@Validator(
    yup.string(),
    yup.string(),
    yup.string(),
    yup.number().positive(),
    yup.date(),
    yup.object().nullable()
  )
  public async holdTokens(
    operation_id: string,
    to_account_id: string,
    notary_account_id: string,
    quantity: number,
    time_to_expiration: Date,
    info_details ?: InfoDetails,
  ) {
    const to_account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(to_account_id);
    await this.Ctx.Account.getAccountWithTokenIdValidation(notary_account_id);
    const token_asset = await this.getTokenObject(to_account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.HOLD_TOKENS, {
      operation_id,
      to_account_id,
      notary_account_id,
      quantity,
      time_to_expiration,
      info_details
    }, token_asset);
    return await this.Ctx.Hold.hold(operation_id, to_account_id, notary_account_id, quantity, time_to_expiration, token_asset, HoldOperationType.TRANSFER, info_details);
  }
参数:
  • operation_id: string- 用于标识暂挂操作的唯一 ID。通常,此 ID 由客户端应用程序传递。
  • to_account_id: string –接收者的唯一账户 ID。
  • notary_account_id: string- 公证人的唯一账户 ID。
  • quantity: number –要暂挂的令牌数。
  • time_to_expiration- 暂挂到期的时间。为永久暂挂指定 0 。否则,请使用 RFC-3339 格式。例如 2021-06-02T12:46:06Z
  • info_details: JSON- 指定请求类别 (category) 和说明 (description) 的对象。

    如果使用的是 Visual Studio Code 与 CLI 或 Postman 集合,则可以采用不同的格式指定 info_details 参数。

    Visual Studio Code:{ "category": "category value", "description": "description value" }

    CLI / Postman: "{\"category\":\"category value\",\"description\":\"description value\"}"

返回值示例:
{
           "msg": "AccountId oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3 is successfully holding 100 tokens"
       }
executeHoldTokens
此方法完成对令牌的暂挂。令牌所有者以前持有的令牌数量将转移给接收者。如果 quantity 值小于实际暂挂值,则剩余金额将再次可供令牌的原始所有者使用。此方法只能由具有指定操作 ID 的 notary 角色的 AccountOwner ID 调用。暂停只能由公证人完成。
@Validator(yup.string(), yup.string(), yup.number().positive())
  public async executeHoldTokens(token_id: string, operation_id: string, quantity: number) {
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.EXECUTE_HOLD_TOKENS, { token_asset, operation_id, quantity }, token_asset);
    return await this.Ctx.Hold.executeHold(operation_id, token_asset, HoldOperationType.TRANSFER, quantity);
  }
参数:
  • token_id: string- 令牌的 ID。
  • operation_id: string- 用于标识暂挂操作的唯一 ID。通常,此 ID 由客户端应用程序传递。
  • quantity: number –要传输的暂挂令牌数。
返回:
  • 成功后,将收到一条消息,其中包含呼叫者的帐户 ID 和交易数量。
返回值示例:
{
           "msg": "Account Id: oaccount~1e31495a0c149b08cb9d02bdcac5e83d88c0f1557d954dda12bb807d7f6fc111 is successfully executed '10' tokens from Operation Id '454f4bf6'."
       }
releaseHoldTokens
此方法释放暂挂令牌。传输未完成,所有保留的令牌将再次提供给原始所有者。此方法可以由具有 notary 角色的 AccountOwner ID 在指定时间限制内调用,也可以由付款人、收款人或公证人在指定时间限制之后调用。
@Validator(yup.string(), yup.string())
  public async releaseHoldTokens(token_id: string, operation_id: string) {
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.RELEASE_HOLD_TOKENS, { token_asset, operation_id }, token_asset);
    return await this.Ctx.Hold.releaseHold(operation_id, token_asset, HoldOperationType.TRANSFER);
  }
参数:
  • token_id: string- 令牌的 ID。
  • operation_id: string- 用于标识暂挂操作的唯一 ID。通常,此 ID 由客户端应用程序传递。
返回:
  • 成功后,将发出一条消息,指示释放暂挂。
返回值示例:
{
           "msg": "Successfully released '200' tokens from Operation Id '77b75873' to Account Id: oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a."
       }
getOnHoldIds
此方法返回指定帐户的所有持有 ID 的列表。此方法可由链代码的 Token AdminToken Auditor、指定组织的 Org AdminOrg Auditor 或帐户的 AccountOwner 调用。
@GetMethod()
  @Validator(yup.string())
  public async getOnHoldIds(account_id: string) {
    await this.Ctx.Account.getAccountWithTokenIdValidation(account_id);
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getOnHoldIds", "TOKEN", { account_id });
    return await this.Ctx.Account.getOnHoldIds(account_id);
  }
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回:
  • 成功时,包含 ID 的 JSON 列表。
返回值示例:
{
           "msg": "Holding Ids are: ",
           "holding_ids": ["ohold~cbdc~token~hold1"]
       }
getOnHoldDetailsWithOperationId
此方法返回指定操作 ID 和令牌的暂挂事务处理详细信息。此方法可以由链代码的 Token AdminToken Auditor 调用,也可以由事务处理参与者(发件人、收件人、公证人)调用。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getOnHoldDetailsWithOperationId(token_id: string, operation_id: string) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getOnHoldDetailsWithOperationId", "TOKEN", { token_id, operation_id });
    return await this.Ctx.Hold.getOnHoldDetailsWithOperationId(token_id, operation_id);
  }
参数:
  • token_id: string- 令牌的 ID。
  • operation_id: string- 用于标识暂挂操作的唯一 ID。通常,此 ID 由客户端应用程序传递。
返回值示例:
{
          "assetType": "ohold",
          "holding_id": "ohold~cbdc~token~hold1",
          "operation_id": "hold1",
          "token_name": "cbdc",
          "from_org_id": "CentralBank",
          "operation_type": "transfer",
          "status": "approved",
          "from_account_id": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
          "to_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
          "notary_account_id": "oaccount~1da238c1491c919b151f777a615fb5779032c34b3ef3adeca6afe591bac10aaf",
          "token_id": "token",
          "quantity": "0",
          "time_to_expiration": "2029-01-04T00:00:00.000Z",
          "category": "category value",
          "description": "description value"
      }
getOnHoldBalanceWithOperationId
此方法返回指定操作 ID 和令牌的暂挂余额。此方法可以由链代码的 Token AdminToken Auditor 调用,也可以由事务处理参与者(发件人、收件人、公证人)调用。
@GetMethod()
  @Validator(yup.string(), yup.string())
  public async getOnHoldBalanceWithOperationId(token_id: string, operation_id: string) {
    await this.Ctx.Auth.checkAuthorization("ACCOUNT.getOnHoldBalanceWithOperationId", "TOKEN", { token_id, operation_id });
    return await this.Ctx.Hold.getOnHoldBalanceWithOperationId(token_id, operation_id);
  }
参数:
  • token_id: string- 令牌的 ID。
  • operation_id: string- 用于标识暂挂操作的唯一 ID。通常,此 ID 由客户端应用程序传递。
返回:
  • 成功时,JSON 字符串指示暂挂余额。
返回值示例:
{
           "msg": "Current Holding Balance of Operation 'hold1' for token 'token' is: 0",
           "holding_balance": 0
       }
requestBurn
刻录器可以调用此方法,向刻录器公证器发送请求以销毁指定数量的令牌。
@Validator(
    yup.string(),
    yup.string(),
    yup.number().positive(),
    yup.date(),
    yup.object().nullable()
  )
  public async requestBurn(
      operation_id: string,
      notary_account_id: string,
      quantity:number,
      time_to_expiration: Date,
      info_details ?: InfoDetails,
  ) {
    const notary_account: FungibleAccount = await this.Ctx.Account.getAccountWithTokenIdValidation(notary_account_id);
    const token_asset = await this.getTokenObject(notary_account.token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.REQUEST_BURN, { operation_id, notary_account_id, quantity, time_to_expiration, info_details }, token_asset);
    return await this.Ctx.Hold.hold(operation_id, null, notary_account_id, quantity, time_to_expiration, token_asset, HoldOperationType.BURN, info_details);
  }
参数:
  • operation_id: string- 表示刻录请求的唯一操作 ID。
  • notary_account_id: string- 将处理请求的刻录公证人的唯一帐户 ID。
  • quantity: number –要燃烧的令牌数量。
  • time_to_expiration- 燃烧请求过期且不再有效的时间。
  • info_details: JSON- 指定请求类别 (category) 和说明 (description) 的对象。

    如果使用的是 Visual Studio Code 与 CLI 或 Postman 集合,则可以采用不同的格式指定 info_details 参数。

    Visual Studio Code:{ "category": "category value", "description": "description value" }

    CLI / Postman: "{\"category\":\"category value\",\"description\":\"description value\"}"

返回值示例:
{
           "msg": "AccountId oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98 has successfully submitted request to burn 100 tokens"
       }
approveBurn
燃烧器公证人可以调用此方法来批准燃烧请求。
@Validator(yup.string(), yup.string())
  public async approveBurn(token_id: string, operation_id: string) {
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.APPROVE_BURN, { token_asset, operation_id }, token_asset);
    return await this.Ctx.Hold.executeHold(operation_id, token_asset, HoldOperationType.BURN);
  }
参数:
  • token_id: string- 要燃烧的令牌的 ID。
  • operation_id: string- 表示刻录请求的唯一操作 ID。
返回值示例:
{
           "msg": "Successfully burned 200 tokens from account id: oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98"
       }
rejectBurn
燃烧器公证人可以调用此方法来拒绝燃烧请求。
@Validator(yup.string(), yup.string())
  public async rejectBurn(token_id: string, operation_id: string) {
    const token_asset = await this.getTokenObject(token_id);
    await this.Ctx.Model.createEvent(EVENT_NAME.REJECT_BURN, { token_asset, operation_id }, token_asset);
    return await this.Ctx.Hold.releaseHold(operation_id, token_asset, HoldOperationType.BURN);
  }
参数:
  • token_id: string- 要燃烧的令牌的 ID。
  • operation_id: string- 表示刻录请求的唯一操作 ID。
返回值示例:
{
           "msg": "Successfully rejected burn request with Operation Id '8d34' to burn 100 tokens of token id USD"
       }

TypeScript 组织间转移的方法

组织间转移分为两部分:首先从发送方借记金额,然后将金额贷记到接收方。使用 Oracle Blockchain Platform REST 代理的双阶段提交 API,将以下两个 API 作为原子事务处理一起调用。机密传输是通过这种方式进行的,因为两个组织的私人数据收集是不同的,不能在单个事务处理中访问。

这两个事务处理都使用 REST 代理的两阶段提交 API 发送。有关详细信息,请参阅调用原子事务处理

您可以在 Postman 集合中创建 POST 请求,其中 URL 与 https://test-xyz-abc.blockchain.ocp.oraclecloud.com:7443/restproxy/api/v2/atomicTransactions 类似。您必须发送所有基本标头,包括以下标头。
- Content-Type: application/json
- Confidential-Transaction: true
在请求主体中,包括以下请求中所示的 executeHoldTokensSenderexecuteHoldTokensReceiver 方法。
{
 "transactions": [
   {
        "chaincode": "<chaincode>",
        "args": [
            "executeHoldTokensSender"
        ],
        "timeout": 6000,
        "sync": true,
        "transientMap": {
            "args": "[ \"bc-token-id value\",\"operation_id value\",\"quantity value\"]"
        },
        "endorsers" : <Sender's endorsers List>,
        "channel":"<channel name>"
   },
   {
        "chaincode": "<chaincode name>",
        "args": [
            "executeHoldTokensReceiver"
        ],
        "timeout": 6000,
        "sync": true,
        "transientMap": {
            "args": "[ \"bc-token-id value\",\"operation_id value\",\"quantity value\"]"
        },
        "endorsers" : <Recipient endorsers List>,
        "channel":"<channelName>"
    }
 ],
 "isolationLevel": "readCommitted",
 "prepareTimeout": 10000,
 "copyInputsToTransientMap": true,
 "sync": true,
 "parallelPrepare": true
}
以下示例显示了请求主体。
{
 "transactions": [
   {
        "chaincode": "WholesaleCBDCConfidential",
        "args": [
            "executeHoldTokensSender"
        ],
        "timeout": 6000,
        "sync": true,
        "transientMap": {
            "args": "[ \"bc-token-id value\",\"operation_id value\",\"quantity value\"]"
        },
        "endorsers" : ["org1-xyz-abc.blockchain.ocp.oraclecloud.com:20009", "org1-xyz-abc.blockchain.ocp.oraclecloud.com:20009"],
        "channel":"default"
   },
   {
        "chaincode": "WholesaleCBDCConfidential",
        "args": [
            "executeHoldTokensReceiver"
        ],
        "timeout": 6000,
        "sync": true,
        "transientMap": {
            "args": "[ \"bc-token-id value\",\"operation_id value\",\"quantity value\"]"
        },
        "endorsers" : ["org2-xyz-abc.blockchain.ocp.oraclecloud.com:20009", "org2-xyz-abc.blockchain.ocp.oraclecloud.com:20009"],
        "channel":"default"
    }
 ],
 "isolationLevel": "readCommitted",
 "prepareTimeout": 10000,
 "copyInputsToTransientMap": true,
 "sync": true,
 "parallelPrepare": true
}
executeHoldTokensSender
此方法只能由具有指定操作 ID 的公证角色的用户调用。此方法是对组织间调动的审批的第一部分。从发件人的帐户中扣除指定的金额。
@ExcludeFromPostmanCollection()
  @Validator(yup.string(), yup.string(), yup.number().positive(), yup.string(), yup.string())
  public async executeHoldTokensSender(token_id: string, operation_id: string, quantity: number,  isolationLevel: string, globalIdInput:string) {
    if (!this.Ctx.Utils.isValidInterOrgTransferRequest()) {
      throw new Error("The request for the inter-org transfer is invalid.")
    }
    const globalTxId =  this.Ctx.Utils.extractGlobalTransactionId(globalIdInput);
    const token_asset = await this.getTokenObject(token_id);
    return await this.Ctx.Hold.executeHoldSender(operation_id, quantity, globalTxId, token_asset);
  }
参数:
  • token_id: string- 要燃烧的令牌的 ID。
  • operation_id: string- 表示要审批的暂挂请求的唯一操作 ID。
  • quantity: number –要转移的持有令牌数量。
  • isolationLevel: string- 原子事务的隔离级别,即 serializablereadCommitted
  • globalIdInput: string
返回值示例:
{
      "msg":
        "Account Id: oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a is successfully executed '10' tokens from Operation Id 'hold1'."
    }
executeHoldTokensReceiver
此方法只能由具有指定操作 ID 的公证角色的用户调用。此方法是组织间调动审批的第二部分。指定的金额贷记到接收人的帐户。
@ExcludeFromPostmanCollection()
  @Validator(yup.string(), yup.string(), yup.number().positive(), yup.string(), yup.string())
  public async executeHoldTokensReceiver(token_id: string, operation_id: string, quantity: number,  isolationLevel: string, globalIdInput:string) {
    if (!this.Ctx.Utils.isValidInterOrgTransferRequest()) {
      throw new Error("The request for the inter-org transfer is invalid.")
    }
    const globalTxId =  this.Ctx.Utils.extractGlobalTransactionId(globalIdInput);
    const token_asset = await this.getTokenObject(token_id);
    return await this.Ctx.Hold.executeHoldReceiver(operation_id, quantity, globalTxId, token_asset);
  }
参数:
  • token_id: string- 要燃烧的令牌的 ID。
  • operation_id: string- 表示要审批的暂挂请求的唯一操作 ID。
  • quantity: number –要转移的持有令牌数量。
  • isolationLevel: string- 原子事务的隔离级别,即 serializablereadCommitted
  • globalIdInput: string
返回值示例:
{
      "msg":
        "Account Id: oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a is successfully executed '10' tokens from Operation Id 'hold1, receiverId oreceiver~72d9bfcf-2c68-4c33-b8c3-fe3374983bf2'."
    }

修改了机密链码的 TypeScript SDK 方法

如果您在使用扩展令牌分类框架标准的令牌的规范文件中包含 confidential: true 参数,Blockchain App Builder 将生成标准 SDK 方法的修改版本以及其他方法。

isUserTokenAdmin
如果函数的调用方为 Token Admin,则此方法返回布尔值 true。否则,该方法将返回 false
Ctx.Auth.isUserTokenAdmin(org_id: string, user_id: string);
参数:
  • org_id- 当前网络组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id- 用户的用户名或电子邮件 ID。
返回值示例:
{
    "result": true
}
addTokenAdmin
此方法将用户添加为令牌链代码的 Token Admin。由于 user_id 值存储在公共分类账中,因此不要将任何个人身份信息 (PII) 用于 user_id 值。
Ctx.Admin.addTokenAdmin(org_id: string, user_id: string);
参数:
  • user_id- 用户的用户名或电子邮件 ID。
  • org_id- 当前网络组织中用户的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
{
  "msg": "Successfully added Token Admin (Org_Id: CentralBank, User_Id: cb1)"
}
removeTokenAdmin
此方法将用户删除为令牌链代码的 Token Admin
Ctx.Admin.removeTokenAdmin(org_id: string, user_id: string);
参数:
  • user_id- 用户的用户名或电子邮件 ID。
  • org_id- 当前网络组织中用户的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
{"msg": "Successfully removed Admin (Org_Id: Org1MSP, User_Id: User1)"}
getAllTokenAdmins
此方法返回链代码为 Token Admin 的所有用户的列表。
Ctx.Admin.getAllTokenAdmins();
参数:
返回值示例:
{"admins":[{"org_id":"Org1MSP","user_id":"admin"}]}
addOrgAdmin
此方法将用户添加为组织的 Org Admin。由于 user_id 值存储在公共分类账中,因此不要将任何个人身份信息 (PII) 用于 user_id 值。
 Ctx.Admin.addOrgAdmin(org_id: string, user_id: string);
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回值示例:
{
    "msg": "Successfully added Org Admin (Org_Id: Org1MSP, User_Id: orgAdmin)"
}
removeOrgAdmin
此方法将用户删除为组织的 Org Admin
Ctx.Admin.removeOrgAdmin(org_id: string, user_id: string);
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回值示例:
{
  "msg": "Successfully removed Org Admin (Org_Id Org1MSP User_Id orgAdmin)"
}
getAllOrgAdmins
此方法返回属于组织 Org Admin 的所有用户的列表。
Ctx.Admin.getAllOrgAdmins();
参数:
返回值示例:
{
    "admins": [
        {
            "org_id": "Org1MSP",
            "user_id": "orgadmin"
        },
        {
            "org_id": "Org1MSP",
            "user_id": "orgadmin1"
        },
        {
            "org_id": "Org1MSP",
            "user_id": "orgadmin2"
        }
    ]
}
addTokenAuditor
此方法将用户添加为链代码的 Token Auditor。由于 user_id 值存储在公共分类账中,因此不要将任何个人身份信息 (PII) 用于 user_id 值。
Ctx.Admin.addTokenAuditor(org_id: string, user_id: string);
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回:
  • 成功后,将包含作为链代码的 Token Auditor 添加的用户详细信息的消息。
返回值示例:
{
  "msg": "Successfully added Token Auditor (Org_Id: CentralBank, User_Id: cb_admin_demo)"
}
removeTokenAuditor
此方法将用户删除为链代码的 Token Auditor
Ctx.Admin.removeTokenAuditor(org_id: string, user_id: string);
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回值示例:
{
           "msg": "Successfully removed Token Auditor (Org_Id: CB, User_Id: cb)"
       }
getAllTokenAuditors
此方法返回链代码的所有 Token Auditors
this.Ctx.Admin.getAllTokenAuditors();
addOrgAuditor
此方法将用户添加为链代码的 Org Auditor
Ctx.Admin.addOrgAuditor(org_id: string, user_id: string);
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回值示例:
{
           "msg": "Successfully added Org Auditor (Org_Id: CentralBank, User_Id: cb_admin_demo)"
       }
removeOrgAuditor
此方法将用户删除为链代码的 Org Auditor
this.Ctx.Admin.removeOrgAuditor(org_id: string, user_id: string);
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。
  • user_id: string- 用户的用户名或电子邮件 ID。
返回值示例:
{
           "msg": "Successfully removed Org Auditor (Org_Id: CB, User_Id: cb)"
       }
getAllOrgAuditors
此方法返回链代码的所有 Org Auditors
this.Ctx.Admin.getAllOrgAuditors()
getAllTokens
此方法返回保存在状态数据库中的所有令牌资产。此方法使用 Berkeley DB SQL 丰富的查询,并且只能在连接到远程 Oracle Blockchain Platform 网络时调用。
this.Ctx.Token.getAllTokens();
参数:
返回:
  • 成功后,它将返回具有所有令牌资产的承诺。出错时,将返回错误消息。
getDecimals
此方法返回小数标记的可用小数位数。如果未指定 divisible 行为,则默认值为 0。
this.Ctx.Token.getDecimals(token_asset)
参数:
  • token_id: string- 令牌的 ID。
返回值示例:
1
history
此方法返回指定标记的历史记录。
Ctx.Token.history(tokenId: string);
参数:
  • token_id: string- 令牌的 ID。
返回值示例:
[
    {
        "trxId": "0d75f09446a60088afb948c6aca046e261fddcd43df416076201cdc5565f1a35",
        "timeStamp": "2023-09-01T16:48:41.000Z",
        "value": {
            "assetType": "otoken",
            "token_id": "token",
            "token_name": "fiatmoneytok",
            "token_desc": "updatedDesc",
            "token_standard": "ttf+",
            "token_type": "fungible",
            "token_unit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter"
            },
            "mintable": {
                "max_mint_quantity": 1000
            },
            "divisible": {
                "decimal": 2
            }
        }
    },
    {
        "trxId": "3666344878b043b65d5b821cc79c042ba52aec467618800df5cf14eac69f72fa",
        "timeStamp": "2023-08-31T20:24:55.000Z",
        "value": {
            "assetType": "otoken",
            "token_id": "token",
            "token_name": "fiatmoneytok",
            "token_standard": "ttf+",
            "token_type": "fungible",
            "token_unit": "fractional",
            "behaviors": [
                "divisible",
                "mintable",
                "transferable",
                "burnable",
                "roles"
            ],
            "roles": {
                "minter_role_name": "minter"
            },
            "mintable": {
                "max_mint_quantity": 1000
            },
            "divisible": {
                "decimal": 2
            }
        }
    }
]
getTokensByName
此方法返回具有指定名称的所有标记资产。此方法使用 Berkeley DB SQL 丰富的查询,并且只能在连接到远程 Oracle Blockchain Platform 网络时调用。
Ctx.Token.getTokensByName(token_name: string);
参数:
  • token_name: string- 标记的名称,对应于模型的 Token_name 属性。该值是令牌的类名。
返回值示例:
[
 {
    "assetType": "otoken",
    "token_id": "digiCurr101",
    "token_name": "digicur",
    "token_desc": "Digital Currency equiv of dollar",
    "token_type": "fungible",
    "behaviors": [
        "divisible",
        "mintable",
        "transferable",
        "burnable",
        "roles"
    ],
    "roles": {
        "minter_role_name": "minter"
        "burner_role_name": "burner",
        "notary_role_name": "notary"
    },
    "mintable": {
        "max_mint_quantity": 2000
    },
    "divisible": {
        "decimal": 1
    },
    "currency_name": "DOLLAR",
    "token_to_currency_ratio": 1
 }
]
createAccount
此方法为指定的用户和令牌创建帐户。每个在任何时候都有令牌的用户都必须有一个帐户。
Ctx.Account.createAccount(org_id: string, user_id: string, token_type: string, dailyLimits);
参数:
  • org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。
  • user_id: string- 用户的用户名或电子邮件 ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。
  • token_type: string- 令牌的类型,必须是 fungible
  • 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"
}
associateToken
此方法将可变令牌与账户关联。
Ctx.Account.associateToken(account_id: string, token_id: string, custom_account_id?: string);
参数:
  • account_id: string- 帐户的 ID。
  • token_id: string- 令牌的 ID。
  • custom_account_id: string- 对于保密模式,账户的银行账户 ID 是唯一的随机字母数字标识符。默认情况下,长度为 14 个字符。
返回值示例:
{
    "bapAccountVersion": 0,
    "assetType": "oaccount",
    "account_id": "oaccount~b53cb2c19c92d1d5c8cb9f6e988e7761c34e03e014e6c4b889565fc0abf46c8a",
    "org_id": "CentralBank",
    "token_type": "fungible",
    "token_id": "USD",
    "token_name": "cbdc",
    "balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "onhold_balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "onhold_burn_balance": "028b72742c8aa9a0395c828fe4f0e46226a3e40d4e731d0b994c8028c8b7bd4df6",
    "application_groups": [
        "CENTRAL_BANK_USERS"
    ]
}
getAllAccounts
此方法返回所有帐户的列表。此方法使用 Berkeley DB SQL 丰富的查询,并且只能在连接到远程 Oracle Blockchain Platform 网络时调用。
this.Ctx.Account.getAllAccounts();
参数:
返回值示例:
[
    {
        "key": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
        "valueJson": {
            "bapAccountVersion": 3,
            "assetType": "oaccount",
            "account_id": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
            "org_id": "CentralBank",
            "token_type": "fungible",
            "token_id": "token",
            "token_name": "cbdc",
            "balance": "028a27c752e9b518d156e61da6589e723b179b6d7351dc34ec92bbb27b783ed1dc",
            "onhold_balance": "02d53a7eda9484bda7252212714f647b70d32663cfa416f93f488ef6b6bc8fb2eb",
            "onhold_burn_balance": "02d53a7eda9484bda7252212714f647b70d32663cfa416f93f488ef6b6bc8fb2eb",
            "application_groups": [
                "application_groups value"
            ]
        }
    },
    {
        "key": "oaccount~1da238c1491c919b151f777a615fb5779032c34b3ef3adeca6afe591bac10aaf",
        "valueJson": {
            "bapAccountVersion": 0,
            "assetType": "oaccount",
            "account_id": "oaccount~1da238c1491c919b151f777a615fb5779032c34b3ef3adeca6afe591bac10aaf",
            "org_id": "CentralBank",
            "token_type": "fungible",
            "token_id": "token",
            "token_name": "cbdc",
            "balance": "020da01cd57249c6470b6dd03c2ee4c49de58c71ccc64f2de1203e835967a0846d",
            "onhold_balance": "020da01cd57249c6470b6dd03c2ee4c49de58c71ccc64f2de1203e835967a0846d",
            "onhold_burn_balance": "020da01cd57249c6470b6dd03c2ee4c49de58c71ccc64f2de1203e835967a0846d",
            "application_groups": [
                "application_groups value"
            ]
        }
    }
]
getAllOrgAccounts
此方法返回属于指定组织的所有令牌帐户的列表。
Ctx.Account.getAllOrgAccounts(org_id: string);
参数:
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
[
    {
        "key": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
        "valueJson": {
            "bapAccountVersion": 2,
            "assetType": "oaccount",
            "account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
            "org_id": "CentralBank",
            "token_type": "fungible",
            "token_id": "token",
            "token_name": "cbdc",
            "balance": "18",
            "onhold_balance": "0",
            "onhold_burn_balance": "0",
            "application_groups": [
                "application_groups value"
            ],
            "user_id": "cb",
            "custom_account_id": "1234567jh"
        }
    },
    {
        "key": "oaccount~5e3b5a3306d7ca3f3e3fe7cc27b6ae547e94dba1c5af58a69a771d7a619b6a66",
        "valueJson": {
            "bapAccountVersion": 1,
            "assetType": "oaccount",
            "account_id": "oaccount~5e3b5a3306d7ca3f3e3fe7cc27b6ae547e94dba1c5af58a69a771d7a619b6a66",
            "org_id": "CentralBank",
            "token_type": "fungible",
            "token_id": "token",
            "token_name": "cbdc",
            "balance": "22",
            "onhold_balance": "0",
            "onhold_burn_balance": "0",
            "application_groups": [
                "application_groups value"
            ],
            "user_id": "cb1",
            "custom_account_id": "1234567jh"
        }
    }
]
getAccountsByUser
此方法返回指定用户和组织的所有帐户 ID 的列表。
Ctx.Account.getAccountsByUser(org_id: string, user_id: string);
参数:
  • org_id string- 组织的成员服务提供商 (membership service provider,MSP) ID。
  • user_id string- 用户的用户名或电子邮件 ID。
返回值示例:
[
    {
        "bapAccountVersion": 2,
        "assetType": "oaccount",
        "user_id": "cb",
        "custom_account_id": "1234567jh",
        "account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
        "org_id": "CentralBank",
        "token_type": "fungible",
        "token_id": "token",
        "token_name": "cbdc",
        "balance": "18",
        "onhold_balance": "0",
        "onhold_burn_balance": "0",
        "application_groups": [
            "application_groups value"
        ]
    }
]
getUserByAccountId
此方法返回指定帐户的用户详细信息。
this.Ctx.Account.getUserByAccountId(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
    "token_id": "USD",
    "org_id": "CentralBank",
    "user_id": "cb_admin_demo",
    "custom_account_id": "10101234000123"
}
getAccountWithStatus
此方法返回指定用户和令牌的帐户详细信息。
Ctx.Account.getAccountWithStatus(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
    "bapAccountVersion": 2,
    "assetType": "oaccount",
    "user_id": "cb",
    "custom_account_id": "1234567jh",
    "status": "active",
    "account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
    "org_id": "CentralBank",
    "token_type": "fungible",
    "token_id": "token",
    "token_name": "cbdc",
    "balance": "18",
    "onhold_balance": "0",
    "onhold_burn_balance": "0",
    "application_groups": [
        "application_groups value"
    ]
}
getAccountDetailsByCustomAccountId
此方法返回指定组织和账户 ID 的所有令牌账户详细信息。
Ctx.Account.getAccountDetailsByCustomAccountId(custom_account_id: string, org_id: string)
参数:
  • custom_account_id: string —账户的银行账户 ID,一个唯一的随机字母数字标识符。
  • org_id string- 组织的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
[
    {
        "bapAccountVersion": 0,
        "assetType": "oaccount",
        "account_id": "oaccount~c44ffac4c46718e9744cb0aae2016d26a87a5bef5e2d1c0d1abc7d8782f0ba61",
        "org_id": "CentralBank",
        "token_type": "fungible",
        "token_id": "USD",
        "token_name": "cbdc",
        "balance": "0",
        "onhold_balance": "0",
        "onhold_burn_balance": "0",
        "application_groups": [
            "SYSTEM_ADMINS"
        ],
        "user_id": "cb_admin_demo",
        "custom_account_id": "10101234000123"
    }
]
getAccountBalance
此方法返回指定帐户的帐户余额。
Ctx.Account.getAccountBalance(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
    "msg": "Current Balance is: 100",
    "user_balance": 100
}
getAccountStatus
此方法获取令牌帐户的当前状态。
Ctx.AccountStatus.getAccountStatus(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
    "assetType": "oaccountStatus",
    "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
    "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
    "status": "active"
}
history (Account Status)
此方法获取帐户状态的历史记录。
Ctx.AccountStatus.history(status_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
[
  {
    "trxId": "d5c6d6f601257ba9b6edaf5b7660f00adc13c37d5321b8f7d3a35afab2e93e63",
    "timeStamp": "2025-12-02T10:39:14.000Z",
    "value": {
      "assetType": "oaccountStatus",
      "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
      "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
      "status": "suspended"
    }
  },
  {
    "trxId": "e6c850cfa084dc20ad95fb2bb8165eef3a3bd62a0ac867cccee57c2003125183",
    "timeStamp": "2025-12-02T10:37:50.000Z",
    "value": {
      "assetType": "oaccountStatus",
      "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
      "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
      "status": "active"
    }
  }
]
activateAccount
此方法激活令牌帐户。无法激活已删除的账户。
Ctx.Account.activateAccount(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
  "assetType": "oaccountStatus",
  "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
  "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
  "status": "active"
}
suspendAccount
此方法暂停令牌帐户。账户挂起后,您无法完成任何更新账户的操作。已删除的账户无法暂停。
Ctx.Account.suspendAccount(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
    "assetType": "oaccountStatus",
    "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
    "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
    "status": "suspended"
}
deleteAccount
此方法将删除令牌帐户。在删除帐户后,您无法完成更新帐户的任何操作。已删除的帐户处于最终状态,无法更改为任何其他状态。要删除帐户,帐户余额和暂挂余额必须为零。
Ctx.Account.deleteAccount(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
  "assetType": "oaccountStatus",
  "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
  "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
  "status": "deleted"
}
setMaxDailyAmount
此方法为指定的帐户设置 max_daily_amount 值。
Ctx.Account.setMaxDailyAmount(account_id: string, max_daily_amount?: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • max_daily_amount?: string-(可选)用户每天可以传输的最大标记量。如果未指定,则用户可以每天传输任意数量的令牌。
返回值示例:
{
           "msg": "Successfully set max daily amount for account id oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a to 1000000"
       }
setMaxDailyTransactionCount
此方法为指定的帐户设置 max_daily_transactions 值。
Ctx.Account.setMaxDailyTransactionCount(account_id: string, max_daily_transactions?: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • max_daily_transactions?: string-(可选)用户每天可以完成的最大事务处理数。如果未指定,用户可以每天完成任意数量的事务处理。
返回值示例:
{
            "msg": "Successfully set max daily transactions for account id oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a to 100000"
        }
getMaxDailyAmount
此方法获取指定帐户的 max_daily_amount 值(每日可转移的最大金额)。
Ctx.Account.getMaxDailyAmount(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
           "max_daily_amount": "10000"
       }
getMaxDailyTransactionCount
此方法获取指定账户的 max_daily_transactions 值(每天允许的最大事务处理数)。
Ctx.Account.getMaxDailyTransactionCount(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
           "max_daily_transactions": "100"
       }
getAccountOnHoldBalance
此方法返回指定账户的暂挂余额。
Ctx.Account.getAccountOnHoldBalance(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
           "msg": "Total Holding Balance is: 0",
           "holding_balance": 0
       }
addRoleMember
此方法将角色添加到指定的帐户。
Ctx.Token.addRoleMember(role: string, account_id: string, token_asset);
参数:
  • account_id: number- 要将角色添加到的帐户 ID。
  • role: string- 要添加到指定用户的角色的名称。
  • token_asset: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
返回值示例:
{
     "msg": "Successfully added role 'notary' to Account Id: oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8"
}
removeRoleMember
此方法从指定的帐户中删除角色。
Ctx.Token.removeRoleMember(role: string, account_id: string, token_asset);
参数:
  • account_id: number- 用于从中删除角色的帐户 ID。
  • role: string- 要从指定用户中删除的角色的名称。
  • token_asset: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
返回值示例:
{
   "msg": "Successfully removed role 'notary' from Account Id: oaccount~2eb5f8a9bc561f8f41a4ea3be9511958cc6684ef14f2337ca396efc301b627d8"
}
getAccountsByRole
此方法返回指定角色和令牌的所有帐户的列表。
Ctx.Role.getAccountsByRole(token_id: string, role: string);
参数:
  • token_id: string- 令牌的 ID。
  • role: string- 要搜索的角色的名称。
返回值示例:
{
           "accounts": [
               "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75"
           ]
       }
getOrgAccountsByRole
此方法返回有关在指定组织中具有指定角色的所有帐户的信息。
Ctx.Role.getOrgAccountsByRole(token_id: string, role: string, org_id: string);
参数:
  • token_id: string- 令牌的 ID。
  • role: string- 要检查的角色的名称。
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
{
           "accounts": [
               "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75"
           ]
       }
getUsersByRole
此方法返回指定角色和令牌的所有用户的列表。
Ctx.Role.getUsersByRole(token_id: string, role: string);
参数:
  • token_id: string- 令牌的 ID。
  • role: string- 要搜索的角色的名称。
返回值示例:
{
          "users": [
              {
                  "token_id": "token",
                  "org_id": "CentralBank"
              }
          ]
      }
getOrgUsersByRole
此方法返回有关在指定组织中具有指定角色的所有用户的信息。
 Ctx.Role.getOrgUsersByRole(token_id: string, role: string, org_id: string);
参数:
  • token_id: string- 令牌的 ID。
  • role: string- 要检查的角色的名称。
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
返回值示例:
{
           "users": [
               {
                   "token_id": "token",
                   "org_id": "CentralBank",
                   "user_id": "cb1",
                   "custom_account_id": "1234567jh"
               }
           ]
       }
isInRole
此方法指示用户是否具有指定的角色。
Ctx.Token.isInRole(role: string, account_id: string, token_asset)
参数:
  • account_id: number- 令牌帐户的唯一 ID。
  • role: string- 要检查的角色的名称。
  • token_asset: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
返回值示例:
{
           "result": "true"
       }
getAccountTransactionHistory
此方法返回指定账户的事务处理历史记录详细信息数组。
Ctx.Account.getAccountTransactionHistory(account_id: string)
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
[
    {
        "transaction_id": "otransaction~4514aa229ebcc4d2fedcaa47c4301615e30c4a9bae45cf0256a5b80d75b3697a",
        "transacted_amount": 1000,
        "timestamp": "2025-08-25T13:20:50.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "APPROVE_MINT",
        "balance": 21000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~1982f73495060e0eef4d78282a91c41e27e8c95572739b0677a1e404a0d20aa9",
        "transacted_amount": 200,
        "timestamp": "2025-08-25T13:12:43.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REQUEST_MINT",
        "balance": 20000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~fedd714cf1509f7517819d7cd4c0921d0b2f5d1ff6a25dcb08ab411defd6b5f3",
        "transacted_amount": 2000,
        "timestamp": "2025-08-21T05:23:25.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REQUEST_MINT",
        "balance": 20000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~f33b47234f3ee0b636962c8c31c01d06523b789ca16b3b342d5080b71268bcc3",
        "transacted_amount": 1000,
        "timestamp": "2025-08-21T05:23:07.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REQUEST_MINT",
        "balance": 20000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~cf934527149bc24f62a8ddeeea7f74a19a0f84d8f161535a771be49d2520d5b3",
        "transacted_amount": 10000,
        "timestamp": "2025-08-13T06:12:41.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "APPROVE_MINT",
        "balance": 20000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~f5c0e11ca61d9adc843658929e6de2a738ad586304f9e020f75bf4aac5e42a2c",
        "transacted_amount": 10000,
        "timestamp": "2025-08-13T06:12:04.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REQUEST_MINT",
        "balance": 10000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~862aa9d9e877d3ea209b87299ab5b12c13ed5ce43d1cf1b934043c1dd02f58f6",
        "transacted_amount": 50000,
        "timestamp": "2025-08-12T21:04:22.000Z",
        "token_id": "USD",
        "category": "transfer",
        "transacted_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "transaction_type": "DEBIT",
        "balance": 10000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~8a74c6d87ca74a613aab9db5d40386f8d5b534f9800503af8ca27e8946d7616d",
        "transacted_amount": 40000,
        "timestamp": "2025-08-12T21:01:27.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REJECT_MINT",
        "balance": 60000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~28ac66ba33f7ad0648448964b2b74525c9e3f0c9908c7a0484690b9baa56c2db",
        "transacted_amount": 30000,
        "timestamp": "2025-08-12T21:01:16.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "APPROVE_MINT",
        "balance": 60000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~7e32ad8f365ff59814e112f27602f30ab599fb9c1638784496c66a61a6277c22",
        "transacted_amount": 20000,
        "timestamp": "2025-08-12T21:01:05.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "APPROVE_MINT",
        "balance": 30000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~1477050bb9e55f4f471872b31fce0d2097f5d5e57d89a842070df5e36d7ab0da",
        "transacted_amount": 10000,
        "timestamp": "2025-08-12T21:01:03.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "APPROVE_MINT",
        "balance": 10000,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~0e76c6931b7ee134e967e847d9730b867a0fd191d39697d83d36dd15745c02e3",
        "transacted_amount": 40000,
        "timestamp": "2025-08-12T21:00:20.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REQUEST_MINT",
        "balance": 0,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~07bbf9c190694371626da59ded5d87434d26f612891e13bb15bdd28f6086e760",
        "transacted_amount": 30000,
        "timestamp": "2025-08-12T21:00:01.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REQUEST_MINT",
        "balance": 0,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~8721175c6cbbce17b6c4bb6a444e475d07f52352dfd0d990679f342215153513",
        "transacted_amount": 20000,
        "timestamp": "2025-08-12T20:59:41.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REQUEST_MINT",
        "balance": 0,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~dc24c24d43a6525e807a39edcf8c6a2b6ccb81f0d755958f509509687eacee84",
        "transacted_amount": 10000,
        "timestamp": "2025-08-12T20:59:13.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "REQUEST_MINT",
        "balance": 0,
        "onhold_balance": 0
    },
    {
        "transaction_id": "otransaction~396e6ca5a11a9609632d0864026409d46a708fb95e3e21b39fa5f3fb78f90872",
        "transacted_amount": 0,
        "timestamp": "2025-08-12T20:43:20.000Z",
        "token_id": "",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transaction_type": "CREATE_ACCOUNT",
        "balance": 0,
        "onhold_balance": 0
    }
]
getAccountTransactionHistoryWithFilters
此方法返回指定账户的事务处理历史记录详细信息数组。仅当连接到远程 Oracle Blockchain Platform 网络时,才能调用此方法。
Ctx.Account.getAccountTransactionHistoryWithFilters(account_id: string, org_id: string, filters);
参数:
  • account_id: string- 帐户的 ID。
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
  • filters: string- 可选参数。如果为空,则返回所有记录。PageSize 属性确定要返回的记录数。如果 PageSize 为 0,则默认页面大小为 20。Bookmark 属性确定要返回的记录的起始索引。有关更多信息,请参见 Hyperledger Fabric 文档。必须以 RFC-3339 格式指定 StartTimeEndTime 属性。
返回值示例:
[
             {
                "transaction_id": "otransaction~ccc2c2e89ab7887af4fdad3dc9918ea057a8aa834a0ed8d0f23271049f084952",
                "transacted_amount": 8,
                "timestamp": "2025-08-20T23:22:53.000Z",
                "token_id": "token",
                "category": "category value",
                "description": "description value",
                "holding_id": "ohold~cbdc~token~hold1",
                "to_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "to_org_id": "Org1",
                "to_user_id": "cb",
                "to_custom_account_id": "1234567jh",
                "from_account_id": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
                "from_org_id": "CentralBank",
                "from_user_id": "Not Available",
                "from_custom_account_id": "Not Available",
                "transacted_account": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
                "transaction_type": "CREDIT",
                "balance": 18,
                "onhold_balance": 0,
                "transacted_org_id": "CentralBank",
                "transacted_user_id": "Not Available",
                "transacted_custom_account_id": "Not Available"
            },
            {
                "transaction_id": "otransaction~6c0452a58f13db93f1c308d60eab1fde6c911921b350c0bbbe0ce7dab394721d",
                "transacted_amount": 10,
                "timestamp": "2025-08-20T23:04:53.000Z",
                "token_id": "token",
                "category": "category value",
                "description": "description value",
                "holding_id": "ohold~cbdc~token~hold1",
                "to_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "to_org_id": "Org1",
                "to_user_id": "cb",
                "to_custom_account_id": "1234567jh",
                "from_account_id": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
                "from_org_id": "CentralBank",
                "from_user_id": "Not Available",
                "from_custom_account_id": "Not Available",
                "transacted_account": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
                "transaction_type": "CREDIT",
                "balance": 10,
                "onhold_balance": 0,
                "transacted_org_id": "CentralBank",
                "transacted_user_id": "Not Available",
                "transacted_custom_account_id": "Not Available"
            },
            .
            .
            .
            .
            {
                "transaction_id": "otransaction~df98e24a3b90661b54b54289b600b13a1051c922db0a4d20e3705a9820ae9c20",
                "transacted_amount": 0,
                "timestamp": "2025-08-20T22:55:09.000Z",
                "category": "",
                "description": "",
                "from_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "from_org_id": "Org1",
                "from_user_id": "cb",
                "from_custom_account_id": "1234567jh",
                "transacted_account": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "transaction_type": "CREATE_ACCOUNT",
                "balance": 0,
                "onhold_balance": 0,
                "transacted_org_id": "Org1",
                "transacted_user_id": "cb",
                "transacted_custom_account_id": "1234567jh"
            }
 ]
getAccountTrxHistoryWithFiltersFromRichHistDB
此方法返回富历史记录数据库中事务处理历史记录详细信息的数组。
Ctx.Account.getAccountTrxHistoryWithFiltersFromRichHistDB(account_id: string, org_id: string, custom_endpoint: string, bearer_token: string, filters);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
  • org_id: string- 组织的成员服务提供商 (membership service provider,MSP) ID。
  • custom_endpoint- 富历史记录数据库的 RESTful 服务端点。
  • bearer_token-RESTful 服务端点的访问授权令牌。
  • filters: string- 可选参数。如果为空,则返回所有记录。PageSize 属性确定要返回的记录数。如果 PageSize 为 0,则默认页面大小为 20。Bookmark 属性确定要返回的记录的起始索引。有关更多信息,请参见 Hyperledger Fabric 文档。必须以 RFC-3339 格式指定 StartTimeEndTime 属性。
返回值示例:
[
    {
        "transaction_id": "otransaction~3140569a4ecb3c3f141cc2468fe21276640b7fd79013d951d9104b79072d8f9c",
        "transacted_amount": 200,
        "timestamp": "2025-08-25T13:16:55.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_officer_demo",
        "transacted_custom_account_id": "20200222221111",
        "to_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "to_org_id": "Org1",
        "to_user_id": "fi1_org_officer_demo",
        "to_custom_account_id": "20200222221111",
        "from_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "from_org_id": "CentralBank",
        "from_user_id": "cb_issuer_demo",
        "from_custom_account_id": "10109999001234",
        "transaction_type": "EXECUTEHOLD",
        "category": "transfer",
        "balance": 26800,
        "onhold_balance": 300
    },
    {
        "transaction_id": "otransaction~5112f576c94c2d23c342479bfa37e34612414b3258a64b43cf51b920f4ff5868",
        "transacted_amount": 5000,
        "timestamp": "2025-08-12T21:05:02.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
        "transacted_org_id": "CentralBank",
        "transacted_user_id": "cb_retirer_demo",
        "transacted_custom_account_id": "10109999006543",
        "to_account": "oaccount~cea6080858337b1575d6a76ed0bd07a0eacd8871e3f2f7f793729a0e4b0e8e98",
        "to_org_id": "CentralBank",
        "to_user_id": "cb_retirer_demo",
        "to_custom_account_id": "10109999006543",
        "from_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "from_org_id": "CentralBank",
        "from_user_id": "cb_issuer_demo",
        "from_custom_account_id": "10109999001234",
        "transaction_type": "DEBIT",
        "category": "burn",
        "balance": 45000,
        "onhold_balance": 0
    },
    .  
    .
    .
    .
    {
        "transaction_id": "otransaction~862aa9d9e877d3ea209b87299ab5b12c13ed5ce43d1cf1b934043c1dd02f58f6",
        "transacted_amount": 50000,
        "timestamp": "2025-08-12T21:04:22.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "transacted_org_id": "CentralBank",
        "transacted_user_id": "cb__creator_demo",
        "transacted_custom_account_id": "10105678004567",
        "to_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "to_org_id": "CentralBank",
        "to_user_id": "cb_issuer_demo",
        "to_custom_account_id": "10109999001234",
        "from_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "from_org_id": "CentralBank",
        "from_user_id": "cb__creator_demo",
        "from_custom_account_id": "10105678004567",
        "transaction_type": "CREDIT",
        "category": "transfer",
        "balance": 50000,
        "onhold_balance": 0
    }
]
getOrgAccountsTrxHistoryWithFiltersFromRichHistDB
此方法从丰富的历史记录数据库中返回指定组织的事务处理历史记录详细信息数组。
Ctx.Account.getOrgAccountsTrxHistoryWithFiltersFromRichHistDB(org_id: string, custom_endpoint: string, bearer_token: string, filters);
参数:
  • org_id string- 组织的成员服务提供商 (membership service provider,MSP) ID。
  • custom_endpoint- 富历史记录数据库的 RESTful 服务端点。
  • bearer_token-RESTful 服务端点的访问授权令牌。
  • filters: string- 可选参数。如果为空,则返回所有记录。PageSize 属性确定要返回的记录数。如果 PageSize 为 0,则默认页面大小为 20。Bookmark 属性确定要返回的记录的起始索引。有关更多信息,请参见 Hyperledger Fabric 文档。必须以 RFC-3339 格式指定 StartTimeEndTime 属性。
返回值示例:
[
    {
        "transaction_id": "otransaction~4793f3907eefce2f9fca7ef107405b0f116efb3afbf83fa0e61fe763690c8235",
        "transacted_amount": 100,
        "timestamp": "2025-08-25T13:47:56.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_officer_demo",
        "transacted_custom_account_id": "20200222221111",
        "to_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "to_org_id": "CentralBank",
        "from_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_officer_demo",
        "from_custom_account_id": "20200222221111",
        "transaction_type": "ONHOLD",
        "holding_id": "ohold~cbdc~USD~2ac01689",
        "category": "issuance"
    },
    {
        "transaction_id": "otransaction~5177f7560d32838242a26ac74f2a90c6ff9b47aae0d0988f28d9b4cf7e27c097",
        "transacted_amount": 10,
        "timestamp": "2025-08-25T13:22:23.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~1e31495a0c149b08cb9d02bdcac5e83d88c0f1557d954dda12bb807d7f6fc111",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_user1_demo",
        "transacted_custom_account_id": "20200198765432",
        "to_account": "oaccount~d08ff55a040d5e5dcf406009bab1b3398e06c374356efb1bddbf2f17fc37f949",
        "to_org_id": "Org1",
        "to_user_id": "fi1_org_user2_demo",
        "to_custom_account_id": "20200211112222",
        "from_account": "oaccount~1e31495a0c149b08cb9d02bdcac5e83d88c0f1557d954dda12bb807d7f6fc111",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_user1_demo",
        "from_custom_account_id": "20200198765432",
        "transaction_type": "CREDIT",
        "holding_id": "ohold~cbdc~USD~454f4bf6",
        "category": "transfer"
    },
    .
    .
    .
    .
    {
        "transaction_id": "otransaction~b7c97d737fb978651c9132276ab677c0bcf795b9db13d0d39cba5243615c7389",
        "transacted_amount": 10,
        "timestamp": "2025-08-21T08:46:09.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_officer_demo",
        "transacted_custom_account_id": "20200222221111",
        "to_account": "oaccount~1e31495a0c149b08cb9d02bdcac5e83d88c0f1557d954dda12bb807d7f6fc111",
        "to_org_id": "Org1",
        "to_user_id": "fi1_org_user1_demo",
        "to_custom_account_id": "20200198765432",
        "from_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_officer_demo",
        "from_custom_account_id": "20200222221111",
        "transaction_type": "ONHOLD",
        "holding_id": "ohold~cbdc~USD~4fbbb846",
        "category": "transfer"
    }
]
getAllAccountsTrxHistoryWithFiltersFromRichHistDB
此方法返回富历史记录数据库中所有组织的事务处理历史记录详细信息数组。
Ctx.Account.getAllAccountsTrxHistoryWithFiltersFromRichHistDB(custom_endpoint: string, bearer_token: string, filters);
参数:
  • org_id string- 组织的成员服务提供商 (membership service provider,MSP) ID。
  • custom_endpoint- 富历史记录数据库的 RESTful 服务端点。
  • bearer_token-RESTful 服务端点的访问授权令牌。
  • filters: string- 可选参数。如果为空,则返回所有记录。PageSize 属性确定要返回的记录数。如果 PageSize 为 0,则默认页面大小为 20。Bookmark 属性确定要返回的记录的起始索引。有关更多信息,请参见 Hyperledger Fabric 文档。必须以 RFC-3339 格式指定 StartTimeEndTime 属性。
返回值示例:
[
    {
        "transaction_id": "otransaction~62eb436be7c29fc2ed9cae221e874d9a31b163fa10374e7da09bf5e09a96c3ff",
        "transacted_amount": 10000,
        "timestamp": "2025-08-25T13:57:58.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "transacted_org_id": "CentralBank",
        "transacted_user_id": "cb_issuer_demo",
        "transacted_custom_account_id": "10109999001234",
        "to_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "to_org_id": "CentralBank",
        "to_user_id": "cb_issuer_demo",
        "to_custom_account_id": "10109999001234",
        "from_account": "oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41",
        "from_org_id": "CentralBank",
        "from_user_id": "cb__creator_demo",
        "from_custom_account_id": "10105678004567",
        "transaction_type": "DEBIT",
        "category": "issuance"
    },
    {
        "transaction_id": "otransaction~4793f3907eefce2f9fca7ef107405b0f116efb3afbf83fa0e61fe763690c8235",
        "transacted_amount": 100,
        "timestamp": "2025-08-25T13:47:56.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_officer_demo",
        "transacted_custom_account_id": "20200222221111",
        "to_account": "oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a",
        "to_org_id": "CentralBank",
        "to_user_id": "cb_issuer_demo",
        "to_custom_account_id": "10109999001234",
        "from_account": "oaccount~76687c724ddbc2d6e6664d9618b2bf1c2a9fe10f84887462447e4caba6aaaff3",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_officer_demo",
        "from_custom_account_id": "20200222221111",
        "transaction_type": "ONHOLD",
        "holding_id": "ohold~cbdc~USD~2ac01689",
        "category": "issuance"
    },
    .
    .
    .
    .
    {
        "transaction_id": "otransaction~5177f7560d32838242a26ac74f2a90c6ff9b47aae0d0988f28d9b4cf7e27c097",
        "transacted_amount": 10,
        "timestamp": "2025-08-25T13:22:23.000Z",
        "token_id": "USD",
        "transacted_account": "oaccount~d08ff55a040d5e5dcf406009bab1b3398e06c374356efb1bddbf2f17fc37f949",
        "transacted_org_id": "Org1",
        "transacted_user_id": "fi1_org_user2_demo",
        "transacted_custom_account_id": "20200211112222",
        "to_account": "oaccount~d08ff55a040d5e5dcf406009bab1b3398e06c374356efb1bddbf2f17fc37f949",
        "to_org_id": "Org1",
        "to_user_id": "fi1_org_user2_demo",
        "to_custom_account_id": "20200211112222",
        "from_account": "oaccount~1e31495a0c149b08cb9d02bdcac5e83d88c0f1557d954dda12bb807d7f6fc111",
        "from_org_id": "Org1",
        "from_user_id": "fi1_org_user1_demo",
        "from_custom_account_id": "20200198765432",
        "transaction_type": "EXECUTEHOLD",
        "holding_id": "ohold~cbdc~USD~454f4bf6",
        "category": "transfer"
    }
]
consolidateRunningBalanceInTransactions
此方法计算正在运行的账户余额,并将更新的值保存在事务处理键/值对中。通常,系统管理员使用 REST 代理调度程序调用此方法。
Ctx.Transaction.consolidateRunningBalanceInTransactions(save: boolean);
返回值示例:
{ msg: "Successfully updated account running balance for pending transactions."}
processSendersAndReceivers
此方法计算并更新在组织间转移期间创建的发送者和接收者键/值对中分布的标记账户余额,然后删除不再使用的发送者和接收者键/值对。通常,系统管理员使用 REST 代理调度程序调用此方法。
Ctx.Account.processSendersAndReceivers(save: boolean);
返回值示例:
{ msg: "Successfully updated balance for accounts from pending receivers."}
deleteTransactions
此方法从状态数据库中删除较早的事务处理。
Ctx.Transaction.deleteTransactions(time_to_expiration: Date);
参数:
  • time_to_expiration: Date- 指示何时删除事务的时间戳。早于指定时间的事务处理资产将被删除。
返回值示例:
{
    "msg": "Successfully deleted transaction older than date: Thu Aug 19 2025 11:19:36 GMT+0000 (Coordinated Universal Time).",
    "transactions": [
           "otransaction~ec3366dd48b4ce2838f820f2f138648e6e55a07226713e59b411ff31b0d21058"
     ]
}
getTransactionById
此方法返回 Transaction 资产的历史记录。
Ctx.Transaction.getTransactionById(transaction_id: string);
参数:
  • transaction_id string —事务处理资产的 ID。
返回值示例:
{
    "transaction_id": "otransaction~6523597253e45b3c976aecdc54e2c6316d0a4f88ad5d7f3fff48c69213e4375a",
    "history": [
        {
            "trxId": "6523597253e45b3c976aecdc54e2c6316d0a4f88ad5d7f3fff48c69213e4375a",
            "timeStamp": "2025-08-20T23:21:45.000Z",
            "value": {
                "assetType": "otransaction",
                "transaction_id": "otransaction~6523597253e45b3c976aecdc54e2c6316d0a4f88ad5d7f3fff48c69213e4375a",
                "token_id": "token",
                "from_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
                "to_account_id": "oaccount~5e3b5a3306d7ca3f3e3fe7cc27b6ae547e94dba1c5af58a69a771d7a619b6a66",
                "transaction_type": "TRANSFER",
                "amount": 22,
                "timestamp": "2025-08-20T23:21:45.000Z",
                "number_of_sub_transactions": 0,
                "holding_id": "",
                "sub_transaction": "false",
                "category": "category value",
                "description": "description value"
            }
        }
    ],
    "sub_transactions": []
}
issueTokens
Minters 可以调用此方法来创建指定数量的令牌。
this.Ctx.Token.mint(quantity, token_asset, info_details)
参数:
  • token_id: string- 令牌的 ID。
  • quantity- 要铸造的标记数。
  • info_details: JSON- 指定请求类别 (category) 和说明 (description) 的对象。

    如果使用的是 Visual Studio Code 与 CLI 或 Postman 集合,则可以采用不同的格式指定 info_details 参数。

    Visual Studio Code:{ "category": "category value", "description": "description value" }

    CLI / Postman: "{\"category\":\"category value\",\"description\":\"description value\"}"

返回值示例:
{
          "msg": "Successfully minted 1000 tokens to Account Id: oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41"
      }
getTotalMintedTokens
此方法返回铸造的令牌总数。
Ctx.Token.getTotalMintedTokens(token_asset);
参数:
  • token_asset: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
返回值示例:
{
    "msg": "Total minted token for Token Id: USD is 910 tokens.",
    "quantity": 910
}
getNetTokens
此方法返回系统中可用的令牌的净数量。净令牌是指令牌被烧毁后剩余的令牌数量。在方程式中:净代币 = 总铸币代币 - 总烧毁代币。如果未刻录任何令牌,则净令牌数等于铸造的令牌总数。
Ctx.Token.getNetTokens(token_asset);
参数:
  • token_asset: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
返回值示例:
{
    "msg": "Net supply of token for Token Id: USD is 878 tokens.",
    "quantity": 878
}
transferTokens
此方法将令牌从调用方转移到指定的帐户。该方法的调用方必须具有帐户。数量必须在规范文件中 divisible 行为的 decimal 参数指定的小数值内。
this.Ctx.Token.transfer(to_account_id: string, quantity, token_asset, info_details);
参数:
  • to_account_id: string –接收者(收款人)的帐户 ID。
  • quantity: number- 要传输的标记数。
  • info_details: JSON- 指定请求类别 (category) 和说明 (description) 的对象。

    如果使用的是 Visual Studio Code 与 CLI 或 Postman 集合,则可以采用不同的格式指定 info_details 参数。

    Visual Studio Code:{ "category": "category value", "description": "description value" }

    CLI / Postman: "{\"category\":\"category value\",\"description\":\"description value\"}"

返回值示例:
{
          "msg": "Successfully transferred 10000 tokens from account id: oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41  to account id: oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a."
      }
hold
矿工使用此方法向矿工公证人发送请求以创建指定数量的令牌。指定的公证账户负责完成或释放暂挂。
Ctx.Hold.hold(operation_id: string, to_account_id: string, notary_account_id: string, quantity: number, time_to_expiration: Date, token, type: HoldOperationType, info_details?: InfoDetails)
参数:
  • operation_id: string- 用于标识暂挂操作的唯一 ID。通常,此 ID 由客户端应用程序传递。
  • to_account_id: string- 收件人帐户的 ID。
  • notary__account_id: string- 公证帐户的 ID。
  • quantity: number –要暂挂的令牌总数。
  • time_to_expiration: Date- 暂挂到期之前的持续时间。为永久暂挂指定 0 。否则,请使用 RFC-3339 格式。例如 2021-06-02T12
  • token: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
  • type: HoldOperationType- 要请求的暂挂操作类型。它必须是三个可能值之一:MINTBURNTRANSFER
  • info_details: JSON- 指定请求类别 (category) 和说明 (description) 的对象。

    如果使用的是 Visual Studio Code 与 CLI 或 Postman 集合,则可以采用不同的格式指定 info_details 参数。

    Visual Studio Code:{ "category": "category value", "description": "description value" }

    CLI / Postman: "{\"category\":\"category value\",\"description\":\"description value\"}"

返回值示例:
{
           "msg": "AccountId oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41 has successfully submitted request to mint 200 tokens"
       }
executeHold
公证人可以调用此方法来批准暂挂操作,该操作可以是以下三种类型之一:薄荷、燃烧或转移。
Ctx.Hold. executeHold(operation_id: string, token, operation_type: HoldOperationType, quantity? :number)
参数:
  • operation_type: HoldOperationType- 要批准的暂挂操作类型。它必须是三个可能值之一:MINTBURNTRANSFER
  • quantity: number-(可选)仅适用于传输操作,即批准传输给收件人的金额。
  • token: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
  • operation_id: string- 请求的唯一 ID。
返回值示例:
{
           "msg": "Successfully minted 1000 tokens to Account Id: oaccount~da6e14466a0ba9b48ebc18fa672addb92dffc371bf953c3229a95b2ff2d9cd41"
       }
releaseHold
公证人可以调用此方法来拒绝暂挂操作,该操作可以是以下三种类型之一:薄荷、燃烧或转移。
Ctx.Hold.releaseHold(operation_id: string, token, operation_type: HoldOperationType)
参数:
  • operation_type: HoldOperationType- 要拒绝的暂挂操作的类型。它必须是三个可能值之一:MINTBURNTRANSFER
  • token: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
  • operation_id: string- 请求的唯一 ID。
返回值示例:
{
           "msg": "Successfully rejected mint request with Operation Id '89ce' to mint 2000 tokens of token id USD"
       }
getOnHoldIds
此方法返回指定帐户的所有持有 ID 的列表。
Ctx.Account.getOnHoldIds(account_id: string);
参数:
  • account_id: string- 令牌帐户的唯一 ID。
返回值示例:
{
           "msg": "Holding Ids are: ",
           "holding_ids": ["ohold~cbdc~token~hold1"]
       }
getOnHoldDetailsWithOperationId
此方法返回指定操作 ID 和令牌的暂挂事务处理详细信息。
Ctx.Hold.getOnHoldDetailsWithOperationId(token_id: string, operation_id: string);
参数:
  • token_id: string- 令牌的 ID。
  • operation_id: string- 标识暂挂操作的唯一 ID。
返回值示例:
{
          "assetType": "ohold",
          "holding_id": "ohold~cbdc~token~hold1",
          "operation_id": "hold1",
          "token_name": "cbdc",
          "from_org_id": "CentralBank",
          "operation_type": "transfer",
          "status": "approved",
          "from_account_id": "oaccount~5abb4155f4b245bb1732321e3174ac81999b03495b5c74f8e1f270bafbadef75",
          "to_account_id": "oaccount~22776ada3efff6aaf4c68c204c1f063b139adfa1bca79ed53199117c34036cfc",
          "notary_account_id": "oaccount~1da238c1491c919b151f777a615fb5779032c34b3ef3adeca6afe591bac10aaf",
          "token_id": "token",
          "quantity": "0",
          "time_to_expiration": "2029-01-04T00:00:00.000Z",
          "category": "category value",
          "description": "description value"
      }
getOnHoldBalanceWithOperationId
此方法返回指定操作 ID 和令牌的暂挂余额。任何人都可以调用此方法。
Ctx.Hold.getOnHoldBalanceWithOperationId(token_id: string, operation_id: string);
参数:
  • token_id: string- 令牌的 ID。
  • operation_id: string- 标识暂挂操作的唯一 ID。
返回值示例:
{
           "msg": "Current Holding Balance of Operation 'hold1' for token 'token' is: 0",
           "holding_balance": 0
       }

TypeScript 用于组织间转移的 SDK 方法

组织间转移分为两部分:首先从发送方借记金额,然后将金额贷记到接收方。使用 Oracle Blockchain Platform REST 代理的双阶段提交 API,将以下两个 API 作为原子事务处理一起调用。机密传输是通过这种方式进行的,因为两个组织的私人数据收集是不同的,不能在单个事务处理中访问。

executeHoldTokensSender
此方法只能由具有指定操作 ID 的公证角色的用户调用。此方法是对组织间调动的审批的第一部分。从发件人的帐户中扣除指定的金额。
Ctx.Hold.executeHoldSender(operation_id: string, quantity, globalTxId: string, token: any);
参数:
  • token: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
  • operation_id: string- 表示要审批的暂挂请求的唯一操作 ID。
  • quantity: number –要转移的持有令牌数量。
  • globalTxid: string- 由 REST 代理为两阶段提交请求生成的全局事务处理 ID,在这种情况下,该 ID 用作绑定组织间转移中的借项和贷项操作的通用引用。
返回值示例:
{
      "msg":
        "Account Id: oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a is successfully executed '10' tokens from Operation Id 'hold1'."
    }
executeHoldTokensReceiver
此方法只能由具有指定操作 ID 的公证角色的用户调用。此方法是组织间调动审批的第二部分。指定的金额贷记到接收人的帐户。
Ctx.Hold.executeHoldReceiver(operation_id: string, quantity, globalTxId: string, token: any);
参数:
  • token: any- 作为参数传递的标记资产。令牌资产的属性在模型文件中介绍。
  • operation_id: string- 表示要审批的暂挂请求的唯一操作 ID。
  • quantity: number –要转移的持有令牌数量。
  • globalTxid: string- 由 REST 代理为两阶段提交请求生成的全局事务处理 ID,在这种情况下,该 ID 用作绑定组织间转移中的借项和贷项操作的通用引用。
返回值示例:
{
      "msg":
        "Account Id: oaccount~68d67712f500e9dac8c314c19744003a993250271d960e9b0d25267bb18dfe9a is successfully executed '10' tokens from Operation Id 'hold1, receiverId oreceiver~72d9bfcf-2c68-4c33-b8c3-fe3374983bf2'."
    }