非易变令牌框架包装 API 程序包
Oracle Blockchain Platform Digital Assets Edition 包含包装 API 包,可扩展 REST API 以支持特定于可收集 NFT 市场的操作。
包装 API 程序包使用 API 网关服务和 OCI 函数部署专门为可收集的市场应用设计的 API 路由。可从 Oracle Blockchain Platform 控制台下载不可替换的令牌框架包装 API 软件包,其中包括以下组件。
NFTCollectiblesWithERC721WrapperAPI.zip,包含包装 API 程序包的存档文件,包括部署所需的 Terraform 脚本。您可以将此文件部署到 Oracle Cloud Infrastructure (OCI) 上的资源管理器堆栈,以便为包装 API 创建必要的 Oracle 资源。NFTCollectiblesWithERC721_WrapperAPI.postman_collection.json是 Postman 集合,用于测试部署的包装 API。该集合包括具有端点和有效负载的预配置请求,这些端点和有效负载与包装 API 包中定义的 API 相对应。
包装 API
-
registerOrg - 原始方法名称:
registerOrg - 此 POST 方法在系统中注册组织。此方法只能由令牌管理员调用。
- 有效负载:
{ "orgId": "{{bc-org-id}}", "orgName": "org_name value", "endorsers": {{endorsers}} } - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。orgName: string-(可选)组织名称。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "assetType": "oorgregistry", "org_registry_id": "orgregistry", "registered_orgs": [ { "org_id": "Org1MSP", "org_name": "Organisation name" } ] } -
getAllRegisteredOrgs - 原始方法名称:
getAllRegisteredOrgs - 此 GET 方法检索所有注册组织的详细信息。此方法只能由令牌管理员调用。
- 查询:
/getAllRegisteredOrgs - 参数:
- 无
- 返回值示例:
[ { "org_id": "Org1MSP", "org_name": "Organisation name" } ] -
activateAccount - 原始方法名称:
activateAccount - 此 POST 方法激活令牌帐户。此方法只能由管理员调用。对于在帐户状态功能之前创建的任何帐户,必须调用此方法才能将帐户状态查看为“有效”。
- 有效负载:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回:
- 成功时,指定令牌账户的账户状态对象的 JSON 表示形式。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "db0738d4a44f6d9c80b24fce7c518c07023f7be19edaa69b272eaf7886b4b925", "payload": { "assetType": "oaccountStatus", "status_id": "oaccountStatus~d5814d96d8517ac31727d60aace0519c58a425892ab0d378fcfb0a35771f65ae", "account_id": "oaccount~802bf8da5579c6103b2dddaa6c4385df8e722d639a18029e0e93d7a5d6f826d6", "status": "active" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 194 } } -
addTokenAdmin - 原始方法名称:
addTokenAdmin - 此 POST 方法将用户添加为链代码的
Token Admin。此方法只能由链代码的Token Admin调用。 - 有效负载:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true } - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。sameOrgEndorser: boolean–一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回:
- 成功后,将包含作为链代码的
Token Admin添加的用户详细信息的消息。
- 成功后,将包含作为链代码的
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg":"Successfully added Admin (orgId: Org1MSP, userId: User1)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 190 } } -
addRole - 原始方法名称:
addRole - 此方法将角色添加到指定的用户和令牌。
- 有效负载:
{ "role": "role value (for example minter / burner)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - 参数:
role: string- 要添加到指定用户的角色的名称。orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "Successfully added role 'minter' to Account Id: oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d (Org-Id: Org1MSP, User-Id: admin)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
addTokenSysRole - 原始方法名称:
addTokenSysRole - 此方法将
Org Admins添加到令牌链代码。 - 有效负载:
{ "role": "role value (for example vault)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - 参数:
role: string- 要添加到指定用户的角色的名称。orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "96a84dffcb9156f7271dfb414e8c43b540595044cf9145f5fd56e9873797fc4a", "payload": { "msg": "Successfully added Org Admin (Org_Id: CB, User_Id: cb)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 197 } } -
balanceOf - 原始方法名称:
balanceOf - 此 GET 方法返回指定用户拥有的 NFT 总数。此方法只能由链代码的
Token Admin或帐户所有者调用。 - 查询:
/balanceOf?orgId={{bc-org-id}}&userId={{bc-user-id}} - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "totalNfts": 0 }, "encode": "JSON" } } -
buy - 原始方法名称:
buy - 此 POST 方法购买正在销售的令牌。
- 有效负载:
{ "fromOrgId": "from_org_id value", "fromUserId": "from_user_id value", "toOrgId": "to_org_id value", "toUserId": "to_user_id value", "nonfungibleTokenId": "nonfungible_token_id value", "amountPaid": 1, "endorsers": {{endorsers}} } - 参数:
fromOrgId: string- 当前组织中发送方(所有者)的成员资格服务提供商 (MSP) ID。fromUserId: string- 发件人(所有者)的用户名或电子邮件 ID。toOrgId: string- 当前组织中接收者的成员服务提供商 (MSP) ID。toUserId: string- 接收者的用户名或电子邮件 ID。nonfungibleTokenId: string- 要购买的令牌的 ID。amountPaid: number–令牌的价格。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "Token ID: 'monalisa' has been successfully transferred to UserID :oaccount~ec32cff8635a056f3dda3da70b1d6090d61f66c6a170c4a95fd008181f729dba" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
createAccount - 原始方法名称:
createAccount - 此方法为指定的用户和令牌创建帐户。必须为在任何时候将具有令牌的任何用户创建账户。帐户跟踪用户拥有的 NFT 数。帐户 ID 是一组字母数字字符,以
oaccount~为前缀,后跟当前网络组织中用户的成员服务提供者 ID (orgId) 的 SHA-256 散列、实例所有者或登录到实例的用户的用户的用户名或电子邮件 ID (userId) 以及常量字符串nft。此方法只能由链代码的Token Admin调用。 - 有效负载:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "tokenType": "nonfungible", "endorsers": {{endorsers}} } - 参数:
orgId- 要为其创建帐户的用户的成员资格服务提供商 (membership service provider,MSP) ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。userId- 用户的用户名或电子邮件 ID。ID 必须以字母数字字符开头,并且可以包含字母、数字和特殊字符,例如下划线 (_)、句点 (.)、点号 (@) 和连字符 (-)。tokenType: TokenType- 标记的类型,必须是fungible。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "assetType": "oaccount", "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "bapAccountVersion": 0, "userId": "admin", "orgId": "Org1MSP", "tokenType": "nonfungible", "noOfNfts": 0 }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
createArtCollectionToken - 原始方法名称:
createArtCollectionToken - 此 POST 方法创建 (mint) NFT。资产和关联的属性保存在状态数据库中。此事务处理的调用者必须具有令牌账户。此事务处理的调用方将成为 NFT 的所有者。如果令牌规范文件包括
behaviors的roles部分和roles的minter_role_name属性,则事务处理的调用方必须具有 minter 角色。否则,任何调用方都可以生成 NFT。 - 有效负载:
{ "tokenAsset": "{\"tokenId\":\"{{bc-token-id}}\",\"tokenDesc\":\"tokenDesc value\",\"tokenUri\":\"tokenUri value\",\"metadata\":{\"Painting_Name\":\"Painting_Name value\",\"Description\":\"Description value\",\"Painter_Name\":\"Painter_Name value\"},\"Price\":999,\"On_Sale_Flag\":true}", "sameOrgEndorser": true } - 参数:
tokenAsset: <Token Class>- 要铸造的令牌资产。有关令牌资产属性的更多信息,请参见输入规范文件。sameOrgEndorser: boolean–一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "metadata": { "painting_name": "Mona_Lisa", "description": "Mona Lisa Painting", "image": "monalisa.jpeg", "painter_name": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa", "tokenName": "artcollection", "tokenDesc": "token description", "symbol": "ART", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "creationDate": "2022-04-05T08:30:42.000Z", "isBurned": false, "tokenUri": "\"https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg\"", "price": 100, "on_sale_flag": false }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
deleteAccount - 原始方法名称:
deleteAccount - 此 POST 方法将删除令牌帐户。在删除帐户后,该帐户处于最终状态,无法更新或更改为任何其他状态。要删除帐户,帐户余额必须为零。此方法只能由链代码的
Token Admin调用。 - 有效负载:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。
- 返回:
- 成功时,标记帐户状态的 JSON 表示形式。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "assetType": "oaccountStatus", "statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "deleted" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
getAccountByUser - 原始方法名称:
getAccountByUser - 此方法返回指定用户的帐户详细信息。此方法只能由链代码的
Token Admin或帐户的Account Owner调用。 - 查询:
/getAccountByUser?orgId={{bc-org-id}}&userId={{bc-user-id}} - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "bapAccountVersion": 0, "assetType": "oaccount", "status": "active", "accountId": "oaccount~cc301bee057f14236a97d434909ec1084970921b008f6baab09c2a0f5f419a9a", "userId": "idcqa", "orgId": "appdev", "tokenType": "nonfungible", "noOfNfts": 0 }, "encode": "JSON" } } -
getAccountHistory - 原始方法名称:
getAccountHistory - 此方法返回指定用户的帐户历史记录。这是一种异步方法。此方法只能由链代码的
Token Admin或帐户所有者调用。 - 查询:
/getAccountHistory?orgId={{bc-org-id}}&userId={{bc-user-id}} - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": [ { "trxId": "6ffd0d94f234c12444a5d5aa559563b59dff4d2280b573fea956dc632bdaf5d4", "timeStamp": 1649151044, "value": { "assetType": "oaccount", "bapAccountVersion" : 5, "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "userId": "admin", "orgId": "Org1MSP", "tokenType": "nonfungible", "noOfNfts": 1 } }, { "trxId": "a605f1fa62e511c2945fce5437f983a5e70ec814b82520d3ecd2d81e3ecf53a3", "timeStamp": 1649151022, "value": { "assetType": "oaccount", "bapAccountVersion" : 4, "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "userId": "admin", "orgId": "Org1MSP", "tokenType": "nonfungible", "noOfNfts": 2 } }, { "trxId": "ca4c07bf04240345de918cbf1f4f3da4b4d0ab044c5b8bea94343e427d9ed4e7", "timeStamp": 1649150910, "value": { "assetType": "oaccount", "bapAccountVersion" : 3, "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "userId": "admin", "orgId": "Org1MSP", "tokenType": "nonfungible", "noOfNfts": 1 } }, { "trxId": "cfb52ffc8c34c7fd86210fcf8c5f53d9f92a056c45ed3a33671d638020c1f9cb", "timeStamp": 1649149545, "value": { "assetType": "oaccount", "bapAccountVersion" : 2, "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "userId": "admin", "orgId": "Org1MSP", "tokenType": "nonfungible", "noOfNfts": 0 } }, { "trxId": "e7747b3001a170f88688620956320e9402e1dd8edad8afb4818a08a34647337c", "timeStamp": 1649147442, "value": { "assetType": "oaccount", "bapAccountVersion" : 1, "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "userId": "admin", "orgId": "Org1MSP", "tokenType": "nonfungible", "noOfNfts": 1 } }, { "trxId": "d2d1f9c898707ae831e9361bc25da6369eac37b10c87dc04d18d6f3808222f08", "timeStamp": 1649137534, "value": { "assetType": "oaccount", "bapAccountVersion" : 0, "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "userId": "admin", "orgId": "Org1MSP", "tokenType": "nonfungible", "noOfNfts": 0 } } ], "encode": "JSON" } } -
getAccountsByRole - 原始方法名称:
getAccountsByRole - 此方法返回指定角色的所有帐户 ID 的列表。此方法只能由链代码的
Token Admin调用。 - 查询:
/getAccountsByRole?role=role value (for example minter / burner) - 参数:
role: string- 要搜索的角色的名称。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "accounts": [ "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d" ] }, "encode": "JSON" } } -
getAccountsByTokenSysRole - 原始方法名称:
getAccountsByTokenSysRole - 此方法返回指定
TokenSys角色的所有帐户 ID 的列表。此方法只能由链代码的Token Admin调用。 - 查询:
/getAccountsByTokenSysRole?role=role value (for example vault) - 参数:
role: string- 要搜索的TokenSys角色的名称。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "accountIds": [ "oaccount~bf07f584a94be44781e49d9101bfaf58c6fbbe77a4dfebdb83c874c2caf03eba" ] }, "encode": "JSON" } } -
getAccountStatus - 原始方法名称:
getAccountStatus - 此 GET 方法检索令牌帐户的当前状态。链代码的
Token Admin或令牌帐户所有者可以调用此方法。 - 查询:
/getAccountStatus?orgId={{bc-org-id}}&userId={{bc-user-id}} - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。
- 返回:
- 成功时,标记帐户状态的 JSON 表示形式。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "assetType": "oaccountStatus", "statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "active" }, "encode": "JSON" } } -
getAccountStatusHistory - 原始方法名称:
getAccountStatusHistory - 此 GET 方法检索帐户状态的历史记录。链代码的
Token Admin或令牌帐户所有者可以调用此方法。 - 查询:
/getAccountStatusHistory?orgId={{bc-org-id}}&userId={{bc-user-id}} - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。
- 返回:
- 成功后,账户状态历史记录采用 JSON 格式。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "trxId": "d5c6d6f601257ba9b6edaf5b7660f00adc13c37d5321b8f7d3a35afab2e93e63", "timeStamp": "2022-12-02T10:39:14.000Z", "value": { "assetType": "oaccountStatus", "statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "suspended" } }, { "trxId": "e6c850cfa084dc20ad95fb2bb8165eef3a3bd62a0ac867cccee57c2003125183", "timeStamp": "2022-12-02T10:37:50.000Z", "value": { "assetType": "oaccountStatus", "statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "active" } } ], "encode": "JSON" } } -
getAccountTransactionHistory - 原始方法名称:
getAccountTransactionHistory - 此 GET 方法返回账户事务处理历史记录。此方法只能由链代码的
Token Admin或帐户所有者调用。 /getAccountTransactionHistory?orgId={{bc-org-id}}&userId={{bc-user-id}}- 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "transactionId": "otransaction~6ffd0d94f234c12444a5d5aa559563b59dff4d2280b573fea956dc632bdaf5d4", "timestamp": "2022-04-05T09:30:44.000Z", "tokenId": "monalisa1", "noOfNfts": 1, "transactedAccount": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transactionType": "BURN" }, { "transactionId": "otransaction~a605f1fa62e511c2945fce5437f983a5e70ec814b82520d3ecd2d81e3ecf53a3", "timestamp": "2022-04-05T09:30:22.000Z", "tokenId": "monalisa1", "transactedAccount": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transactionType": "MINT" }, { "transactionId": "otransaction~ca4c07bf04240345de918cbf1f4f3da4b4d0ab044c5b8bea94343e427d9ed4e7", "timestamp": "2022-04-05T09:28:30.000Z", "tokenId": "monalisa", "transactedAccount": "oaccount~ec32cff8635a056f3dda3da70b1d6090d61f66c6a170c4a95fd008181f729dba", "transactionType": "CREDIT" }, { "transactionId": "otransaction~cfb52ffc8c34c7fd86210fcf8c5f53d9f92a056c45ed3a33671d638020c1f9cb", "timestamp": "2022-04-05T09:05:45.000Z", "tokenId": "monalisa", "transactedAccount": "oaccount~ec32cff8635a056f3dda3da70b1d6090d61f66c6a170c4a95fd008181f729dba", "transactionType": "DEBIT" }, { "transactionId": "otransaction~e7747b3001a170f88688620956320e9402e1dd8edad8afb4818a08a34647337c", "timestamp": "2022-04-05T08:30:42.000Z", "tokenId": "monalisa", "transactedAccount": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transactionType": "MINT" } ], "encode": "JSON" } } -
getAccountTransactionHistoryWithFilters - 原始方法名称:
getAccountTransactionHistoryWithFilters - 此 GET 方法返回由
PageSize、Bookmark、startTime和endTime筛选的指定用户的账户事务处理历史记录。这是一种异步方法。仅当连接到远程 Oracle Blockchain Platform 网络时,才能调用此方法。此方法只能由链代码的Token Admin或帐户所有者调用。 /getAccountTransactionHistoryWithFilters?orgId={{bc-org-id}}&userId={{bc-user-id}}&filters={"pageSize":20,"bookmark":"","startTime":"2022-01-16T15:16:36+00:00","endTime":"2022-01-17T15:16:36+00:00"}- 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。filters: object-Filter 类的一个对象,包含四个属性:pageSize、bookmark、startTime和endTime。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "transactionId": "otransaction~6ffd0d94f234c12444a5d5aa559563b59dff4d2280b573fea956dc632bdaf5d4", "timestamp": "2022-04-05T09:30:44.000Z", "tokenId": "monalisa1", "transactedAccount": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transactionType": "BURN" }, { "transactionId": "otransaction~a605f1fa62e511c2945fce5437f983a5e70ec814b82520d3ecd2d81e3ecf53a3", "timestamp": "2022-04-05T09:30:22.000Z", "tokenId": "monalisa1", "transactedAccount": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transactionType": "MINT" }, { "transactionId": "otransaction~ca4c07bf04240345de918cbf1f4f3da4b4d0ab044c5b8bea94343e427d9ed4e7", "timestamp": "2022-04-05T09:28:30.000Z", "tokenId": "monalisa", "transactedAccount": "oaccount~ec32cff8635a056f3dda3da70b1d6090d61f66c6a170c4a95fd008181f729dba", "transactionType": "CREDIT" }, { "transactionId": "otransaction~cfb52ffc8c34c7fd86210fcf8c5f53d9f92a056c45ed3a33671d638020c1f9cb", "timestamp": "2022-04-05T09:05:45.000Z", "tokenId": "monalisa", "transactedAccount": "oaccount~ec32cff8635a056f3dda3da70b1d6090d61f66c6a170c4a95fd008181f729dba", "transactionType": "DEBIT" }, { "transactionId": "otransaction~e7747b3001a170f88688620956320e9402e1dd8edad8afb4818a08a34647337c", "timestamp": "2022-04-05T08:30:42.000Z", "tokenId": "monalisa", "transactedAccount": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transactionType": "MINT" } ], "encode": "JSON" } } -
getAllAccounts - 原始方法名称:
getAllAccounts - 此 GET 方法返回所有用户帐户的详细信息。此方法只能由链代码的
Token Admin调用。 - 查询:
/getAllAccounts - 参数:
- 无
- 返回:
- 成功后,所有帐户的 JSON 数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "key": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "valueJson": { "assetType": "oaccount", "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "userId": "admin", "orgId": "Org1MSP", "tokenType": "nonfungible", "noOfNfts": 1 } } ], "encode": "JSON" } } -
getAllLockedNFTs - 原始方法名称:
getAllLockedNFTs - 此 GET 方法返回所有已锁定 NFT 的列表。此方法只能由链代码的
Token Admin或 Vault 管理器(具有TokenSys vault角色的用户)调用。 - 查询:
/getAllLockedNFTs - 参数:
- 无
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "key":"token1", "valueJson":{ "assetType":"otoken", "tokenId":"token1", "tokenName":"artcollection", "symbol":"ART", "tokenStandard":"erc721+", "tokenType":"nonfungible", "tokenUnit":"whole", "behaviors":[ "indivisible", "singleton", "mintable", "transferable", "lockable", "burnable", "roles" ], "roles":{ "minter_role_name":"minter" }, "mintable":{ "max_mint_quantity":20000 }, "createdBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463", "creationDate":"2023-10-20T10:26:29.000Z", "owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463", "isBurned":false, "isLocked":true, "tokenUri":"token1.example.com", "price":120, "on_sale_flag":false } } ], "encode": "JSON" } } -
getAllTokenAdmins - 原始方法名称:
getAllTokenAdmins - 此方法返回链代码为
Token Admin的所有用户的列表。此方法只能由链代码的Token Admin调用。 - 查询:
/getAllTokenAdmins - 参数:
- 无
- 返回:
- 成功后,包含
orgId和userId对象的 JSON 格式的admins数组。
- 成功后,包含
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "admins":[ { "orgId":"Org1MSP", "userId":"admin" } ] }, "encode": "JSON" } } -
getAllTokens - 原始方法名称:
getAllTokens - 此方法返回保存在状态数据库中的所有令牌资产。此方法只能由链代码的
Token Admin调用。此方法使用 Berkeley DB SQL 丰富的查询,并且只能在连接到远程 Oracle Blockchain Platform 网络时调用。 - 查询:
/getAllTokens - 参数:
- 无
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "key": "monalisa", "valueJson": { "metadata": { "PaintingName": "Mona_Lisa", "Description": "Mona Lisa Painting", "Image": "monalisa.jpeg", "PainterName": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa", "tokenName": "ravinft", "tokenDesc": "token Description", "symbol": "PNT", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~543c2258e351c3e7a40ea59b81e62154d38fbfc9d1b5b79f30ac5e08e7d0dfd1", "createdBy": "oaccount~543c2258e351c3e7a40ea59b81e62154d38fbfc9d1b5b79f30ac5e08e7d0dfd1", "creationDate": "2022-04-07T21:17:48.000Z", "isBurned": false, "tokenUri": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg", "NftBasePrice": 100 } }, { "key": "monalisa1", "valueJson": { "metadata": { "PaintingName": "Mona_Lisa", "Description": "Mona Lisa Painting", "Image": "monalisa.jpeg", "PainterName": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa1", "tokenName": "ravinft", "tokenDesc": "token Description", "symbol": "PNT", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~543c2258e351c3e7a40ea59b81e62154d38fbfc9d1b5b79f30ac5e08e7d0dfd1", "createdBy": "oaccount~543c2258e351c3e7a40ea59b81e62154d38fbfc9d1b5b79f30ac5e08e7d0dfd1", "creationDate": "2022-04-07T21:17:59.000Z", "isBurned": false, "tokenUri": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg", "NftBasePrice": 100 } } ], "encode": "JSON" } } -
getAllTokensByUser - 原始方法名称:
getAllTokensByUser - 此 GET 方法返回指定用户拥有的所有令牌资产。此方法使用 Berkeley DB SQL 丰富的查询,并且只能在连接到远程 Oracle Blockchain Platform 网络时调用。此方法只能由链代码的
Token Admin或帐户所有者调用。 - 查询:
/getAllTokensByUser?orgId={{bc-org-id}}&userId={{bc-user-id}} - 参数:
org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。user_id: string- 用户的用户名或电子邮件 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "key": "monalisa", "valueJson": { "metadata": { "PaintingName": "Mona_Lisa", "Description": "Mona Lisa Painting", "Image": "monalisa.jpeg", "PainterName": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa", "tokenName": "ravinft", "tokenDesc": "token Description", "symbol": "PNT", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~543c2258e351c3e7a40ea59b81e62154d38fbfc9d1b5b79f30ac5e08e7d0dfd1", "createdBy": "oaccount~543c2258e351c3e7a40ea59b81e62154d38fbfc9d1b5b79f30ac5e08e7d0dfd1", "creationDate": "2022-04-07T21:17:48.000Z", "isBurned": false, "tokenUri": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg", "NftBasePrice": 100 } }, { "key": "monalisa1", "valueJson": { "metadata": { "PaintingName": "Mona_Lisa", "Description": "Mona Lisa Painting", "Image": "monalisa.jpeg", "PainterName": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa1", "tokenName": "ravinft", "tokenDesc": "token Description", "symbol": "PNT", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~543c2258e351c3e7a40ea59b81e62154d38fbfc9d1b5b79f30ac5e08e7d0dfd1", "createdBy": "oaccount~543c2258e351c3e7a40ea59b81e62154d38fbfc9d1b5b79f30ac5e08e7d0dfd1", "creationDate": "2022-04-07T21:17:59.000Z", "isBurned": false, "tokenUri": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg", "NftBasePrice": 100 } } ], "encode": "JSON" } } -
getLockedNFTsByOrg - 原始方法名称:
getLockedNFTsByOrg - 此方法返回指定组织和(可选)指定用户的所有锁定不可替换标记的列表。此方法只能由链代码的
Token Admin或 Vault 管理器(具有TokenSys vault角色的用户)调用。 - 查询:
/getLockedNFTsByOrg?orgId={{bc-org-id}}&userId={{bc-user-id}} - 参数:
org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。user_id: string- 用户的用户名或电子邮件 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "key":"token1", "valueJson":{ "assetType":"otoken", "tokenId":"token1", "tokenName":"artcollection", "symbol":"ART", "tokenStandard":"erc721+", "tokenType":"nonfungible", "tokenUnit":"whole", "behaviors":[ "indivisible", "singleton", "mintable", "transferable", "lockable", "burnable", "roles" ], "roles":{ "minter_role_name":"minter" }, "mintable":{ "max_mint_quantity":20000 }, "createdBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463", "creationDate":"2023-10-20T10:26:29.000Z", "owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463", "isBurned":false, "isLocked":true, "tokenUri":"token1.examplecom", "price":120, "on_sale_flag":false } } ], "encode": "JSON" } } -
getTokenById - 原始方法名称:
getTokenById - 如果令牌存在于状态数据库中,则此方法将返回令牌对象。此方法只能由链代码的
Token Admin或令牌所有者调用。 - 查询:
/getTokenById?tokenId={{bc-token-id}} - 参数:
tokenId: string- 要获取的令牌的 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "metadata": { "painting_name": "Mona_Lisa", "description": "Mona Lisa Painting", "image": "monalisa.jpeg", "painter_name": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa", "tokenName": "artcollection", "tokenDesc": "token description", "symbol": "ART", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transferredBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "creationDate": "2022-04-05T08:30:42.000Z", "transferredDate": "2022-04-05T09:28:30.000Z", "isBurned": false, "tokenUri": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg", "price": 100, "on_sale_flag": true }, "encode": "JSON" } } -
getTokenHistory - 原始方法名称:
getTokenHistory - 此方法返回指定令牌 ID 的历史记录。这是一种异步方法。仅当连接到远程 Oracle Blockchain Platform 网络时,才能调用此方法。任何人都可以调用此方法。
/getTokenHistory?tokenId={{bc-token-id}}- 参数:
tokenId: string- 令牌的 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": [ { "trxId": "ca4c07bf04240345de918cbf1f4f3da4b4d0ab044c5b8bea94343e427d9ed4e7", "timeStamp": 1649150910, "value": { "metadata": { "painting_name": "Mona_Lisa", "description": "Mona Lisa Painting", "image": "monalisa.jpeg", "painter_name": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa", "tokenName": "artcollection", "tokenDesc": "token description", "symbol": "ART", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transferredBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "creationDate": "2022-04-05T08:30:42.000Z", "transferredDate": "2022-04-05T09:28:30.000Z", "isBurned": false, "tokenUri": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg", "price": 100, "on_sale_flag": true } }, { "trxId": "cfb52ffc8c34c7fd86210fcf8c5f53d9f92a056c45ed3a33671d638020c1f9cb", "timeStamp": 1649149545, "value": { "metadata": { "painting_name": "Mona_Lisa", "description": "Mona Lisa Painting", "image": "monalisa.jpeg", "painter_name": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa", "tokenName": "artcollection", "tokenDesc": "token description", "symbol": "ART", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~ec32cff8635a056f3dda3da70b1d6090d61f66c6a170c4a95fd008181f729dba", "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transferredBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "creationDate": "2022-04-05T08:30:42.000Z", "transferredDate": "2022-04-05T09:05:45.000Z", "isBurned": false, "tokenUri": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg", "price": 100, "on_sale_flag": true } }, { "trxId": "702e61cc8d6d2982521023d0d5f3195900f35e146d6a90ef66daae551e6075d2", "timeStamp": 1649147729, "value": { "metadata": { "painting_name": "Mona_Lisa", "description": "Mona Lisa Painting", "image": "monalisa.jpeg", "painter_name": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa", "tokenName": "artcollection", "tokenDesc": "token description", "symbol": "ART", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "creationDate": "2022-04-05T08:30:42.000Z", "isBurned": false, "tokenUri": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg", "price": 100, "on_sale_flag": true } }, { "trxId": "e7747b3001a170f88688620956320e9402e1dd8edad8afb4818a08a34647337c", "timeStamp": 1649147442, "value": { "metadata": { "painting_name": "Mona_Lisa", "description": "Mona Lisa Painting", "image": "monalisa.jpeg", "painter_name": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa", "tokenName": "artcollection", "tokenDesc": "token description", "symbol": "ART", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "creationDate": "2022-04-05T08:30:42.000Z", "isBurned": false, "tokenUri": "\"https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\ .ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg\"", "price": 100, "on_sale_flag": false } } ] "encode": "JSON" } } -
getTransactionById - 原始方法名称:
getTransactionById - 此方法返回指定事务处理 ID 的事务处理历史记录。这是一种异步方法。此方法只能由链代码的
Token Admin调用。 - 查询:
/getTransactionById?transactionId=transactionId value - 参数:
transactionId: string- 事务处理的 ID,前缀为otransaction~,后跟十六进制格式的 64 位散列。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "transactionId": "otransaction~6ffd0d94f234c12444a5d5aa559563b59dff4d2280b573fea956dc632bdaf5d4", "history": [ { "trxId": "6ffd0d94f234c12444a5d5aa559563b59dff4d2280b573fea956dc632bdaf5d4", "timeStamp": 1649151044, "value": { "assetType": "otransaction", "transactionId": "otransaction~6ffd0d94f234c12444a5d5aa559563b59dff4d2280b573fea956dc632bdaf5d4", "tokenId": "monalisa1", "fromAccountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "toAccountId": "", "triggeredByAccountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "transactionType": "BURN", "timestamp": "2022-04-05T09:30:44.000Z", } } ] }, "encode": "JSON" } } -
getUserByAccountId - 原始方法名称:
getUserByAccountId - 此 GET 方法返回指定帐户的用户详细信息。
- 查询:
/getUserByAccountId?accountId=accountId value - 参数:
accountId: string- 帐户的 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "userId": "admin", "orgId": "Org1MSP" }, "encode": "JSON" } } -
getUsersByRole - 原始方法名称:
getUsersByRole - 此方法返回指定角色的所有用户的列表。
/getUsersByRole?role=role value (for example minter / burner)- 参数:
role: string- 要搜索的角色的名称。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "users": [ { "userId": "admin", "orgId": "Org1MSP" } ] }, "encode": "JSON" } } -
init - 原始方法名称:
init - 部署链代码时会调用此方法。用户信息将另存为链代码的
Token Admin。 - 有效负载:
{ "adminList": "[{\"orgId\":\"{{bc-org-id}}\",\"userId\":\"{{bc-admin-user}}\"}]" } - 参数:
adminList array-{user_id, org_id}信息数组,用于指定令牌管理员的列表。adminList数组是必需参数。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "fdb7dc89832c8045a333823b77fa24ae628178148dc93b3550040e070d7cd807", "payload": "", "encode": "UTF-8", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 263 } } -
isInRole - 原始方法名称:
isInRole - 此 GET 方法返回布尔值以指示用户是否具有指定的角色。此方法只能由链代码的
Token Admin或帐户的Account Owner调用。 - 查询:
/isInRole?orgId={{bc-org-id}}&userId={{bc-user-id}}&role=role value (for example minter / burner) - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。role: string- 要搜索的角色的名称。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "result":"true" }, "encode": "JSON" } } -
isInTokenSysRole - 原始方法名称:
isInTokenSysRole - 此 GET 方法返回布尔值以指示用户是否具有指定的
TokenSys角色。此方法只能由链代码的Token Admin或帐户的Account Owner调用。 - 查询:
/isInTokenSysRole?orgId={{bc-org-id}}&userId={{bc-user-id}}&role=role value (for example vault) - 参数:
role: string- 要搜索的TokenSys角色的名称。orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "result": true, "msg": "Account Id oaccount~bf07f584a94be44781e49d9101bfaf58c6fbbe77a4dfebdb83c874c2caf03eba (Org-Id: Org1MSP, User-Id: user1) has vault role" }, "encode": "JSON" } } -
isNFTLocked - 原始方法名称:
isNFTLocked - 此 GET 方法返回布尔值以指示指定的标记是否已锁定。此方法只能由链代码的
Token Admin、令牌所有者或 Vault 管理器(具有TokenSys vault角色的用户)调用。 - 查询:
/isNFTLocked?tokenId={{bc-token-id}} - 参数:
tokenId: string- 令牌的 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "isNFTLocked":true }, "encode": "JSON" } } -
lockNFT - 原始方法名称:
lockNFT - 此 POST 方法锁定指定的不可替换令牌。要锁定令牌,必须具有
TokenSys vault角色的用户充当 Vault 管理器。 - 有效负载:
{ "tokenId": "{{bc-token-id}}", "sameOrgEndorser": true } - 参数:
tokenId: string- 要锁定的令牌的 ID。sameOrgEndorser: boolean–一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "assetType":"otoken", "tokenId":"token1", "tokenName":"artcollection", "symbol":"ART", "tokenStandard":"erc721+", "tokenType":"nonfungible", "tokenUnit":"whole", "behaviors":[ "indivisible", "singleton", "mintable", "transferable", "lockable", "burnable", "roles" ], "roles":{ "minter_role_name":"minter" }, "mintable":{ "max_mint_quantity":20000 }, "createdBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463", "creationDate":"2023-10-20T10:26:29.000Z", "owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463", "isBurned":false, "isLocked":true, "tokenUri":"token1.example.com", "price":120, "on_sale_flag":false }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
post - 原始方法名称:
post - 此 POST 方法按指定价格发布要销售的令牌。
- 有效负载:
{ "tokenId": "{{bc-token-id}}", "sellingPrice": 1, "endorsers": {{endorsers}} } - 参数:
tokenId: string- 令牌的 ID。sellingPrice: number–令牌的价格。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "Token ID: 'monalisa' has been posted for selling in the marketplace" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
removeRole - 原始方法名称:
removeRole - 此方法从指定用户中删除角色。此方法只能由链代码的
Token Admin调用。 - 有效负载:
{ "role": "role value (for example minter / burner)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - 参数:
role: string- 要从指定用户中删除的角色的名称。mintable和burnable行为对应于规范文件的minter_role_name和burner_role_name属性。orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "Successfully removed role 'minter' from Account Id: oaccount~ec32cff8635a056f3dda3da70b1d6090d61f66c6a170c4a95fd008181f729dba (Org-Id: Org1MSP, User-Id: user1)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
removeTokenAdmin - 原始方法名称:
removeTokenAdmin - 此 POST 方法将用户删除为链代码的
Token Admin。此方法只能由链代码的Token Admin调用。管理员无法自行删除。 - 有效负载:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true } - 参数:
org_id: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。user_id: string- 用户的用户名或电子邮件 ID。sameOrgEndorser: boolean–一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "Successfully removed Admin (orgId: Org1MSP, userId: User1)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
removeTokenSysRole - 原始方法名称:
removeTokenSysRole - 此方法从指定用户和令牌中删除
TokenSys角色。此方法只能由链代码的Token Admin调用。 - 有效负载:
{ "role": "role value (for example vault)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - 参数:
role: string- 要从指定用户中删除的TokenSys角色的名称。orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "Successfully removed role 'vault' from Account Id: oaccount~bf07f584a94be44781e49d9101bfaf58c6fbbe77a4dfebdb83c874c2caf03eba (Org-Id: Org1MSP, User-Id: user1)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
safeTransferFrom - 原始方法名称:
safeTransferFrom - 这是一个异步函数。此 POST 方法将指定 NFT 的所有权从调用方转移到其他帐户。此方法包括以下验证:
- 令牌存在且未刻录。
- 发送方账户和接收方账户存在,并且不是同一账户。
- 发件人帐户拥有该令牌。
- 该函数的调用方是发送方。
- 有效负载:
{ "fromOrgId": "fromOrgId value", "fromUserId": "fromUserId value", "toOrgId": "toOrgId value", "toUserId": "toUserId value", "tokenId": "{{bc-token-id}}", "data": "data value", "endorsers": {{endorsers}} } - 参数:
fromOrgId: string- 当前组织中发送者和令牌所有者的成员资格服务提供商 (Membership Service Provider,MSP) ID。fromUserId: string- 发件人和令牌所有者的用户名或电子邮件 ID。toOrgId: string- 当前组织中接收者的成员服务提供商 (MSP) ID。toUserId: string- 接收者的用户名或电子邮件 ID。tokenId: string- 要传输的令牌的 ID。data: string- 要存储在事务处理记录中的可选附加信息。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "Successfully transferred NFT token: 'monalisa' from Account-Id: oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d (Org-Id: Org1MSP, User-Id: admin) to Account-Id: oaccount~ec32cff8635a056f3dda3da70b1d6090d61f66c6a170c4a95fd008181f729dba (Org-Id: Org1MSP, User-Id: user1)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
suspendAccount - 原始方法名称:
suspendAccount - 此方法将暂停可变令牌帐户。如果未在分类帐中找到
accountStatus值,则会引发错误。此方法只能由链代码的Token Admin调用。 - 有效负载:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - 参数:
orgId: string- 当前组织中用户的成员服务提供商 (membership service provider,MSP) ID。userId: string- 用户的用户名或电子邮件 ID。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "assetType": "oaccountStatus", "statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "suspended" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
symbol - 原始方法名称:
symbol - 此方法返回令牌类的符号。任何人都可以调用此方法。
- 查询:
/symbol - 参数:
- 无
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "symbol": "PNT" }, "encode": "JSON" } } -
tokenURI - 原始方法名称:
tokenURI - 此方法返回指定标记的 URI。任何人都可以调用此方法。
- 查询:
/tokenURI?tokenId={{bc-token-id}} - 参数:
tokenId: string- 令牌的 ID。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "tokenURI": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\.ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg" }, "encode": "JSON" } } -
totalNetSupply - 原始方法名称:
totalNetSupply - 此 GET 方法返回铸造的令牌总数减去烧毁的令牌的数量。此方法只能由链代码的
Token Admin调用。 /totalNetSupply- 参数:
- 无
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "totalNetSupply": 1 }, "encode": "JSON" } } -
totalSupply - 原始方法名称:
totalSupply - 此 GET 方法返回铸币的总数。此方法只能由链代码的
Token Admin调用。 - 查询:
/totalSupply - 参数:
- 无
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "payload": { "totalSupply": 3 }, "encode": "JSON" } } -
transferFrom - 原始方法名称:
transferFrom - 这是一个异步函数。此方法将指定 NFT 的所有权从发送方账户转移到接收方账户。调用方有责任传递正确的参数。此方法可由任何用户调用,而不仅仅是令牌所有者。此方法包括以下验证:
- 令牌存在且未刻录。
- 发送方账户和接收方账户存在,并且不是同一账户。
- 发件人帐户拥有该令牌。
- 有效负载:
{ "fromOrgId": "fromOrgId value", "fromUserId": "fromUserId value", "toOrgId": "toOrgId value", "toUserId": "toUserId value", "tokenId": "{{bc-token-id}}", "endorsers": {{endorsers}} } - 参数:
fromOrgId: string- 当前组织中发件人的成员资格服务提供商 (MSP) ID。fromUserId: string- 发件人的用户名或电子邮件 ID。toOrgId: string- 当前组织中接收者的成员服务提供商 (MSP) ID。toUserId: string- 接收者的用户名或电子邮件 ID。tokenId: string- 要传输的令牌的 ID。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "Successfully transferred NFT token: 'monalisa' from Account-Id: oaccount~ec32cff8635a056f3dda3da70b1d6090d61f66c6a170c4a95fd008181f729dba (Org-Id: Org1MSP, User-Id: user1) to Account-Id: oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d (Org-Id: Org1MSP, User-Id: admin)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
transferTokenSysRole - 原始方法名称:
transferTokenSysRole - 此方法将
TokenSys角色从用户转移到其他用户。 - 有效负载:
{ "role": "role value (for example vault)", "fromOrgId": "fromOrgId value", "fromUserId": "fromUserId value", "toOrgId": "toOrgId value", "toUserId": "toUserId value", "endorsers": {{endorsers}} } - 参数:
role: string- 要传输的TokenSys角色的名称。fromOrgId: string- 当前组织中发件人的成员资格服务提供商 (MSP) ID。fromUserId: string- 发件人的用户名或电子邮件 ID。toOrgId: string- 当前组织中接收者的成员服务提供商 (MSP) ID。toUserId: string- 接收者的用户名或电子邮件 ID。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "msg": "Successfully transfered role 'vault' from Account Id: ouaccount~f4e311528f03fffa7810753d643f66289ff6c9080fcf839902f28a1d3aff1789 (Org-Id: Org1MSP, User-Id: user1) to Account Id: ouaccount~ae5be2ae8f98d6d32f5d02b43877d987114e7937c7bacbc30390dcce09996a19 (Org-Id: Org1MSP, User-Id: user2)" }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } } -
updateArtCollectionToken - 原始方法名称:
updateArtCollectionToken - 此方法更新令牌属性。创建令牌资产后,只有令牌所有者可以更新令牌定制属性。如果用户既是令牌所有者又是令牌的创建者,则他们还可以更新
TokenDesc属性。无法更新标记元数据。您必须将所有标记属性传递到此方法,即使您只想更新某些属性也是如此。 - 有效负载:
{ "tokenAsset": "{\"tokenId\":\"{{bc-token-id}}\",\"tokenDesc\":\"tokenDesc value\",\"tokenUri\":\"tokenUri value\",\"Price\":999,\"On_Sale_Flag\":true}", "sameOrgEndorser": true } - 参数:
tokenAsset: <Token Class>- 要更新的标记资产。有关令牌资产属性的更多信息,请参见输入规范文件。endorsers: string[]- 必须背书事务处理的对等节点(例如peer1、peer2)的数组。
- 返回值示例:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "metadata": { "painting_name": "Mona_Lisa", "description": "Mona Lisa Painting", "image": "monalisa.jpeg", "painter_name": "Leonardo_da_Vinci" }, "assetType": "otoken", "tokenId": "monalisa", "tokenName": "artcollection", "tokenDesc": "token description", "symbol": "ART", "tokenStandard": "erc721+", "tokenType": "nonfungible", "tokenUnit": "whole", "behaviors": [ "indivisible", "singleton", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter" }, "mintable": { "max_mint_quantity": 20000 }, "owner": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "createdBy": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "creationDate": "2022-04-05T08:30:42.000Z", "isBurned": false, "tokenUri": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\\.ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg", "price": 100, "on_sale_flag": true }, "encode": "JSON", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 193 } }