Non-Fungible Token Framework Wrapper API Package
Oracle Blockchain Platform Digital Assets Edition includes a wrapper API package that extends the REST API to support operations specific to a collectible NFT marketplace.
The wrapper API package uses the API Gateway service and OCI Functions to deploy API routes specifically designed for the collectible marketplace application. The non-fungible token framework wrapper API package is downloadable from the Oracle Blockchain
Platform console, and includes the following components.
NFTCollectiblesWithERC721WrapperAPI.zip, an archive file that contains the wrapper API package including the Terraform scripts required for deployment. You deploy this file to a Resource Manager stack on Oracle Cloud Infrastructure (OCI) to create the necessary Oracle resources for the Wrapper APIs.NFTCollectiblesWithERC721_WrapperAPI.postman_collection.json, a Postman collection that enables you to test the deployed wrapper APIs. The collection includes preconfigured requests with endpoints and payloads that correspond to the APIs defined in the wrapper API package.
Wrapper APIs
-
activateAccount - Original method name:
activateAccount - This POST method activates a token account. This method can be called only by an admin. For any accounts created prior to the account status functionality, you must call this method to see the account status to active.
- Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Returns:
- On success, a JSON representation of the account status object for the specified token account.
- Return Value Example:
{ "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 - Original method name:
addTokenAdmin - This POST method adds a user as a
Token Adminof the chaincode. This method can be called only by aToken Adminof the chaincode. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true } - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.sameOrgEndorser: boolean– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a message that includes details of the user who was added as a
Token Adminof the chaincode.
- On success, a message that includes details of the user who was added as a
- Return Value Example:
{ "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 - Original method name:
addRole - This method adds the role to the specified user and token.
- Payload:
{ "role": "role value (for example minter / burner)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - Parameters:
role: string– The name of the role to add to the specified user.orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
addTokenSysRole - This method adds
Org Adminsto the token chaincode. - Payload:
{ "role": "role value (for example vault)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - Parameters:
role: string– The name of the role to add to the specified user.orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
balanceOf - This GET method returns the total number of NFTs that a specified user holds. This method can be called only by a
Token Adminof the chaincode or by the account owner. - Query:
/balanceOf?orgId={{bc-org-id}}&userId={{bc-user-id}} - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "totalNfts": 0 }, "encode": "JSON" } } -
buy - Original method name:
buy - This POST method buys a token that is on sale.
- Payload:
{ "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}} } - Parameters:
fromOrgId: string– The membership service provider (MSP) ID of the sender (owner) in the current organization.fromUserId: string– The user name or email ID of the sender (owner).toOrgId: string– The membership service provider (MSP) ID of the receiver in the current organization.toUserId: string– The user name or email ID of the receiver.nonfungibleTokenId: string– The ID of the token to buy.amountPaid: number– The price of the token.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
createAccount - This method creates an account for a specified user and token. An account must be created for any user who will have tokens at any point. Accounts track the number of NFTs a user owns. An account ID is an alphanumeric set of characters, prefixed with
oaccount~and followed by an SHA-256 hash of the membership service provider ID (orgId) of the user in the current network organization, the user name or email ID (userId) of the instance owner or the user who is logged in to the instance, and the constant stringnft. This method can be called only by aToken Adminof the chaincode. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "tokenType": "nonfungible", "endorsers": {{endorsers}} } - Parameters:
orgId– The membership service provider (MSP) ID of the user to create the account for. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).userId– The user name or email ID of the user. The ID must begin with an alphanumeric character and can include letters, numbers, and special characters such as underscores (_), periods (.), at signs (@), and hyphens (-).tokenType: TokenType– The type of token, which must befungible.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
createArtCollectionToken - This POST method creates (mints) an NFT. The asset and associated properties are saved in the state database. The caller of this transaction must have a token account. The caller of this transaction becomes the owner of the NFT. If the token specification file includes the
rolessection forbehaviorsand theminter_role_nameproperty forroles, then the caller of the transaction must have the minter role. Otherwise, any caller can mint NFTs. - Payload:
{ "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 } - Parameters:
tokenAsset: <Token Class>– The token asset to mint. For more information about the properties of the token asset, see the input specification file.sameOrgEndorser: boolean– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "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 - Original method name:
deleteAccount - This POST method deletes a token account. After an account is deleted, the account is in a final state and cannot be updated or changed to any other state. To delete an account, the account balance must be zero. This method can be called only by a
Token Adminof the chaincode. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.
- Returns:
- On success, a JSON representation of the token account status.
- Return Value Example:
{ "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 - Original method name:
getAccountByUser - This method returns account details for a specified user. This method can be called only by a
Token Adminof the chaincode or theAccount Ownerof the account. - Query:
/getAccountByUser?orgId={{bc-org-id}}&userId={{bc-user-id}} - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.
- Return Value Example:
{ "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 - Original method name:
getAccountHistory - This method returns account history for a specified user. This is an asynchronous method. This method can be called only by the
Token Adminof the chaincode or by the account owner. - Query:
/getAccountHistory?orgId={{bc-org-id}}&userId={{bc-user-id}} - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.
- Return Value Example:
{ "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 - Original method name:
getAccountsByRole - This method returns a list of all account IDs for a specified role. This method can be called only by a
Token Adminof the chaincode. - Query:
/getAccountsByRole?role=role value (for example minter / burner) - Parameters:
role: string– The name of the role to search for.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "bd7416689b1acdace3c557faebbc0ad9a51671c10278ba6909350a6fe4b08eed", "payload": { "accounts": [ "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d" ] }, "encode": "JSON" } } -
getAccountsByTokenSysRole - Original method name:
getAccountsByTokenSysRole - This method returns a list of all account IDs for a specified
TokenSysrole. This method can be called only by aToken Adminof the chaincode. - Query:
/getAccountsByTokenSysRole?role=role value (for example vault) - Parameters:
role: string– The name of theTokenSysrole to search for.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "accountIds": [ "oaccount~bf07f584a94be44781e49d9101bfaf58c6fbbe77a4dfebdb83c874c2caf03eba" ] }, "encode": "JSON" } } -
getAccountStatus - Original method name:
getAccountStatus - This GET method retrieves the current status of the token account. This method can be called by the
Token Adminof the chaincode or by the token account owner. - Query:
/getAccountStatus?orgId={{bc-org-id}}&userId={{bc-user-id}} - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.
- Returns:
- On success, a JSON representation of the token account status.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "assetType": "oaccountStatus", "statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "active" }, "encode": "JSON" } } -
getAccountStatusHistory - Original method name:
getAccountStatusHistory - This GET method retrieves the history of the account status. This method can be called by the
Token Adminof the chaincode or by the token account owner. - Query:
/getAccountStatusHistory?orgId={{bc-org-id}}&userId={{bc-user-id}} - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.
- Returns:
- On success, the account status history in JSON format.
- Return Value Example:
{ "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 - Original method name:
getAccountTransactionHistory - This GET method returns account transaction history. This method can be called only by a
Token Adminof the chaincode or by the account owner. /getAccountTransactionHistory?orgId={{bc-org-id}}&userId={{bc-user-id}}- Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.
- Return Value Example:
{ "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 - Original method name:
getAccountTransactionHistoryWithFilters - This GET method returns account transaction history for a specified user, filtered by
PageSize,Bookmark,startTimeandendTime. This is an asynchronous method. This method can only be called when connected to the remote Oracle Blockchain Platform network. This method can be called only by theToken Adminof the chaincode or by the account owner. /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"}- Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.filters: object– An object of the Filter class that contains four attributes:pageSize,bookmark,startTimeandendTime.
- Return Value Example:
{ "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 - Original method name:
getAllAccounts - This GET method returns details of all user accounts. This method can be called only by a
Token Adminof the chaincode. - Query:
/getAllAccounts - Parameters:
- none
- Returns:
- On success, a JSON array of all accounts.
- Return Value Example:
{ "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 - Original method name:
getAllLockedNFTs - This GET method returns a list of all locked NFTs. This method can be called only by a
Token Adminof the chaincode or by the Vault Manager (the user with theTokenSys vaultrole). - Query:
/getAllLockedNFTs - Parameters:
- none
- Return Value Example:
{ "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 - Original method name:
getAllTokenAdmins - This method returns a list of all users who are a
Token Adminof the chaincode. This method can be called only by theToken Adminof the chaincode. - Query:
/getAllTokenAdmins - Parameters:
- none
- Returns:
- On success, an
adminsarray in JSON format that containsorgIdanduserIdobjects.
- On success, an
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "admins":[ { "orgId":"Org1MSP", "userId":"admin" } ] }, "encode": "JSON" } } -
getAllTokens - Original method name:
getAllTokens - This method returns all of the token assets that are saved in the state database. This method can be called only by a
Token Adminof the chaincode. This method uses Berkeley DB SQL rich queries and can only be called when connected to the remote Oracle Blockchain Platform network. - Query:
/getAllTokens - Parameters:
- none
- Return Value Example:
{ "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 - Original method name:
getAllTokensByUser - This GET method returns all of the token assets that are owned by a specified user. This method uses Berkeley DB SQL rich queries and can only be called when connected to the remote Oracle Blockchain Platform network. This method can be called only by a
Token Adminof the chaincode or by the account owner. - Query:
/getAllTokensByUser?orgId={{bc-org-id}}&userId={{bc-user-id}} - Parameters:
org_id: string– The membership service provider (MSP) ID of the user in the current organization.user_id: string– The user name or email ID of the user.
- Return Value Example:
{ "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 - Original method name:
getLockedNFTsByOrg - This method returns a list of all locked non-fungible tokens for a specified organization and optionally a specified user. This method can be called only by a
Token Adminof the chaincode or by the vault manager (the user with theTokenSys vaultrole). - Query:
/getLockedNFTsByOrg?orgId={{bc-org-id}}&userId={{bc-user-id}} - Parameters:
org_id: string– The membership service provider (MSP) ID of the user in the current organization.user_id: string– The user name or email ID of the user.
- Return Value Example:
{ "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 - Original method name:
getTokenById - This method returns a token object if the token is present in the state database. This method can be called only by a
Token Adminof the chaincode or the token owner. - Query:
/getTokenById?tokenId={{bc-token-id}} - Parameters:
tokenId: string– The ID of the token to get.
- Return Value Example:
{ "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 - Original method name:
getTokenHistory - This method returns the history for a specified token ID. This is an asynchronous method. This method can only be called when connected to the remote Oracle Blockchain Platform network. Anyone can call this method.
/getTokenHistory?tokenId={{bc-token-id}}- Parameters:
tokenId: string– The ID of the token.
- Return Value Example:
{ "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 - Original method name:
getTransactionById - This method returns transaction history for a specified transaction ID. This is an asynchronous method. This method can be called only by a
Token Adminof the chaincode. - Query:
/getTransactionById?transactionId=transactionId value - Parameters:
transactionId: string– The id of the transaction, which is the prefixotransaction~followed by the 64-bit hash in hexadecimal format.
- Return Value Example:
{ "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 - Original method name:
getUserByAccountId - This GET method returns the user details for a specified account.
- Query:
/getUserByAccountId?accountId=accountId value - Parameters:
accountId: string– The ID of the account.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "userId": "admin", "orgId": "Org1MSP" }, "encode": "JSON" } } -
getUsersByRole - Original method name:
getUsersByRole - This method returns a list of all users for a specified role.
/getUsersByRole?role=role value (for example minter / burner)- Parameters:
role: string– The name of the role to search for.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "users": [ { "userId": "admin", "orgId": "Org1MSP" } ] }, "encode": "JSON" } } -
init - Original method name:
init - This method is called when the chaincode is deployed. The user information is saved as the
Token Adminof the chaincode. - Payload:
{ "adminList": "[{\"orgId\":\"{{bc-org-id}}\",\"userId\":\"{{bc-admin-user}}\"}]" } - Parameters:
adminList array– An array of{user_id, org_id}information that specifies the list of token admins. TheadminListarray is a mandatory parameter.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "txid": "fdb7dc89832c8045a333823b77fa24ae628178148dc93b3550040e070d7cd807", "payload": "", "encode": "UTF-8", "sourceURL": "cb-oabcs1-bom.blockchain.ocp.example.com:20009", "blockNumber": 263 } } -
isInRole - Original method name:
isInRole - This GET method returns a Boolean value to indicate if a user has a specified role. This method can be called only by a
Token Adminof the chaincode or theAccount Ownerof the account. - Query:
/isInRole?orgId={{bc-org-id}}&userId={{bc-user-id}}&role=role value (for example minter / burner) - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.role: string– The name of the role to search for.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "result":"true" }, "encode": "JSON" } } -
isInTokenSysRole - Original method name:
isInTokenSysRole - This GET method returns a Boolean value to indicate if a user has a specified
TokenSysrole. This method can be called only by aToken Adminof the chaincode or theAccount Ownerof the account. - Query:
/isInTokenSysRole?orgId={{bc-org-id}}&userId={{bc-user-id}}&role=role value (for example vault) - Parameters:
role: string– The name of theTokenSysrole to search for.orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "result": true, "msg": "Account Id oaccount~bf07f584a94be44781e49d9101bfaf58c6fbbe77a4dfebdb83c874c2caf03eba (Org-Id: Org1MSP, User-Id: user1) has vault role" }, "encode": "JSON" } } -
isNFTLocked - Original method name:
isNFTLocked - This GET method returns a Boolean value to indicate if a specified token is locked. This method can be called only by a
Token Adminof the chaincode, the token owner, or the vault manager (the user with theTokenSys vaultrole). - Query:
/isNFTLocked?tokenId={{bc-token-id}} - Parameters:
tokenId: string– The ID of the token.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "isNFTLocked":true }, "encode": "JSON" } } -
lockNFT - Original method name:
lockNFT - This POST method locks a specified non-fungible token. To lock a token, there must be a user with the
TokenSys vaultrole, who acts as the vault manager. - Payload:
{ "tokenId": "{{bc-token-id}}", "sameOrgEndorser": true } - Parameters:
tokenId: string– The ID of the token to lock.sameOrgEndorser: boolean– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "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 } } -
name - Original method name:
name - This GET method returns the name of the token class. Anyone can call this method.
- Query:
/name - Parameters: None
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": {"tokenName": "artcollection"}, "encode": "JSON" } } -
ownerOf - Original method name:
ownerOf - This GET method returns the account ID of the owner of the specified token ID. Anyone can call this method.
- Query:
/ownerOf?tokenId={{bc-token-id}} - Parameters:
tokenId: string– The ID of the token.
- Returns:
- A JSON object of the owner's account ID.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "owner": "oaccount~d6d22c3167e3c6ab9ee5653e1a008c37c20cc47ebb0229ca0aedfafe64c675b8" }, "encode": "JSON" } } -
post - Original method name:
post - This POST method posts a token for sale for a specified price.
- Payload:
{ "tokenId": "{{bc-token-id}}", "sellingPrice": 1, "endorsers": {{endorsers}} } - Parameters:
tokenId: string– The ID of the token.sellingPrice: number– The price of the token.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
removeRole - This method removes a role from a specified user. This method can be called only by a
Token Adminof the chaincode. - Payload:
{ "role": "role value (for example minter / burner)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - Parameters:
role: string– The name of the role to remove from the specified user. Themintableandburnablebehaviors correspond to theminter_role_nameandburner_role_nameproperties of the specification file.orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
removeTokenAdmin - This POST method removes a user as a
Token Adminof the chaincode. This method can be called only by aToken Adminof the chaincode. An admin cannot remove themselves. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "sameOrgEndorser": true } - Parameters:
org_id: string– The membership service provider (MSP) ID of the user in the current organization.user_id: string– The user name or email ID of the user.sameOrgEndorser: boolean– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "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 - Original method name:
removeTokenSysRole - This method removes a
TokenSysrole from a specified user and token. This method can be called only by aToken Adminof the chaincode. - Payload:
{ "role": "role value (for example vault)", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - Parameters:
role: string– The name of theTokenSysrole to remove from the specified user.orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
safeTransferFrom - This is an asynchronous function. This POST method transfers ownership of the specified NFT from the caller to another account. This method includes the following validations:
- The token exists and is not burned.
- The sender account and receiver account exist and are not the same account.
- The sender account owns the token.
- The caller of the function is the sender.
- Payload:
{ "fromOrgId": "fromOrgId value", "fromUserId": "fromUserId value", "toOrgId": "toOrgId value", "toUserId": "toUserId value", "tokenId": "{{bc-token-id}}", "data": "data value", "endorsers": {{endorsers}} } - Parameters:
fromOrgId: string– The membership service provider (MSP) ID of the sender and token owner in the current organization.fromUserId: string– The user name or email ID of the sender and token owner.toOrgId: string– The membership service provider (MSP) ID of the receiver in the current organization.toUserId: string– The user name or email ID of the receiver.tokenId: string– The ID of the token to transfer.data: string– Optional additional information to store in the transaction record.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
suspendAccount - This method suspends a fungible token account. It throws an error if an
accountStatusvalue is not found in ledger. This method can be called only by aToken Adminof the chaincode. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} } - Parameters:
orgId: string– The membership service provider (MSP) ID of the user in the current organization.userId: string– The user name or email ID of the user.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
symbol - This method returns the symbol of the token class. Anyone can call this method.
- Query:
/symbol - Parameters:
- none
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "symbol": "PNT" }, "encode": "JSON" } } -
tokenURI - Original method name:
tokenURI - This method returns the URI of a specified token. Anyone can call this method.
- Query:
/tokenURI?tokenId={{bc-token-id}} - Parameters:
tokenId: string– The ID of the token.
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "tokenURI": "https://bafybeid6pmpp62bongoip5iy2skosvyxh3gr7r2e35x3ctvawjco6ddmsq\.ipfs.infura-ipfs.io/?filename=MonaLisa.jpeg" }, "encode": "JSON" } } -
totalNetSupply - Original method name:
totalNetSupply - This GET method returns the total number of minted tokens minus the number of burned tokens. This method can be called only by a
Token Adminof the chaincode. /totalNetSupply- Parameters:
- none
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "totalNetSupply": 1 }, "encode": "JSON" } } -
totalSupply - Original method name:
totalSupply - This GET method returns the total number of minted tokens. This method can be called only by a
Token Adminof the chaincode. - Query:
/totalSupply - Parameters:
- none
- Return Value Example:
{ "returnCode": "Success", "error": "", "result": { "payload": { "totalSupply": 3 }, "encode": "JSON" } } -
transferFrom - Original method name:
transferFrom - This is an asynchronous function. This method transfers ownership of the specified NFT from a sender account to a receiver account. It is the responsibility of the caller to pass the correct parameters. This method can be called by any user, not only the token owner. This method includes the following validations:
- The token exists and is not burned.
- The sender account and receiver account exist and are not the same account.
- The sender account owns the token.
- Payload:
{ "fromOrgId": "fromOrgId value", "fromUserId": "fromUserId value", "toOrgId": "toOrgId value", "toUserId": "toUserId value", "tokenId": "{{bc-token-id}}", "endorsers": {{endorsers}} } - Parameters:
fromOrgId: string– The membership service provider (MSP) ID of the sender in the current organization.fromUserId: string– The user name or email ID of the sender.toOrgId: string– The membership service provider (MSP) ID of the receiver in the current organization.toUserId: string– The user name or email ID of the receiver.tokenId: string– The ID of the token to transfer.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
transferTokenSysRole - This method transfers a
TokenSysrole from a user to another user. - Payload:
{ "role": "role value (for example vault)", "fromOrgId": "fromOrgId value", "fromUserId": "fromUserId value", "toOrgId": "toOrgId value", "toUserId": "toUserId value", "endorsers": {{endorsers}} } - Parameters:
role: string– The name of theTokenSysrole to transfer.fromOrgId: string– The membership service provider (MSP) ID of the sender in the current organization.fromUserId: string– The user name or email ID of the sender.toOrgId: string– The membership service provider (MSP) ID of the receiver in the current organization.toUserId: string– The user name or email ID of the receiver.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 - Original method name:
updateArtCollectionToken - This method updates token properties. After a token asset is created, only the token owner can update the token custom properties. If the user is both token owner and creator of a token, they can also update the
TokenDescproperty. Token metadata cannot be updated. You must pass all token properties to this method, even if you want to update only certain properties. - Payload:
{ "tokenAsset": "{\"tokenId\":\"{{bc-token-id}}\",\"tokenDesc\":\"tokenDesc value\",\"tokenUri\":\"tokenUri value\",\"Price\":999,\"On_Sale_Flag\":true}", "sameOrgEndorser": true } - Parameters:
tokenAsset: <Token Class>– The token asset to update. For more information about the properties of the token asset, see the input specification file.endorsers: string[]– An array of the peers (for example,peer1,peer2) that must endorse the transaction.
- Return Value Example:
{ "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 } }