- Oracle Blockchain Platform Digital Assets Edition
- Generic Token Frameworks
- Combined Token Framework
- Combined Token Framework Wrapper API Package
Combined 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.
NFTCollectiblesWithERC1155WrapperAPI.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.NFTCollectiblesWithERC1155_WrapperAPI.postman_collection.json
, a Postman collection that enables you to test the deployed wrapper APIs. The collection includes pre-configured 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 or account owner. For existing accounts where an
accountStatus
is not found in the ledger, the method returns anaccountStatus
object with the status set toactive
. - Payload:
{ "tokenId": "{{bc-token-id}}", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.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 updated account status object for the fungible token account.
- Return Value Example:
{ "assetType": "oaccountStatus", "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "active" }
-
addTokenAdmin
- Original method name:
addTokenAdmin
- This POST method adds a user as a
Token Admin
of the chaincode. This method can be called only by aToken Admin
of 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.
- Returns:
- On success, a message that includes details of the user who was added as a
Token Admin
of the chaincode.
- On success, a message that includes details of the user who was added as a
- Return Value Example:
{ "msg": "Successfully added Admin (OrgId: appDev, UserId: user1)" }
-
addRole
- Original method name:
addRole
- This POST method adds the role to the specified user and token. This method can be called only by a
Token Admin
of the chaincode. The tokenDetails parameter Fungible tokens require thetokenId
value as input. Non-fungible tokens require the tokenName as input, to achieve that we use tokenDetail parameter to specify details of fungible and nonfungible tokens differently. - Payload:
{ "tokenId": "{{bc-token-id}}", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "role": "role minter/burner" "tokenDetails": "{"tokenName": "token name value"}" "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.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 add to the specified user.tokenDetails: TokenDetail
– The details that specify the token. For fungible tokens, use the following format:
For non-fungible tokens, use the following format:{"tokenId":"token1"}
{"tokenName":"artCollection"}
endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "msg": "Successfully added role 'minter' to Account Id: oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: user2)" }
-
associateFungibleTokenToAccount
- Original method name:
associateFungibleTokenToAccount
- This POST method associates a user's fungible token account to a specified token.
- Payload:
{ "tokenId": "{{bc-token-id}}", "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "endorsers": {{endorsers}} }
- Parameters:
tokenId: string
– The ID of the token.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:
{ "assetType": "ouaccount", "accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc", "userId": "user2", "orgId": "appdev", "totalAccounts": 1, "totalFtAccounts": 1, "associatedFtAccounts": [ { "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a", "tokenId": "tokenOne" } ], "associatedNftAccount": "" }
-
buyWithEthCoin
- Original method name:
buyWithEthCoin
- Any account owner can use this POST method to buy an NFT using Ethereum and to transfer loyalty tokens as reward points.
- Payload:
{ "fromOrgId":"from_org_id value", "fromUserId":"from_user_id value", "toOrgId":"to_org_id value", "toUserId":"to_user_id value", "nftId":"[\"nft_id value\"]", "loyaltyId":"[\"loyalty_id value\"]", "ethQty":"[eth_qty value]", "loyaltyRewardQuantity":"[loyalty_reward_quantity value]", "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.nftId: string
– The ID of the token to buy.loyaltyId: string
– The ID of the fungible token that represents loyalty points.ethQty: number
– The price of the token in Ethereum.loyaltyRewardQuantity: string
– The quantity of loyalty points to transfer.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "msg": "Token ID : 'artcollection1' has been successfully transferred to UserID : 'user1'" }
-
balanceOfBatch
- Original method name:
balanceOfBatch
- This GET method completes a batch operation that gets the balances of token accounts. This method can be called only by a
Token Admin
of the chaincode or by the account owner. - Query:
/balanceOfBatch?orgIds=["{{bc-org-id}}"]&userIds=["{{bc-user-id}}"]&tokenIds=["{{bc-token-id}}"]
- Parameters:
orgIds: string[]
– A list of the membership service provider (MSP) IDs in the current organization.userIds: string[]
– A list of the user name or email IDs.tokenIds: string[]
– A list of the token IDs.
- Return Value Example:
[ { "orgId": "AppBldFFFFMay22", "userId": "user2", "userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38", "tokenAccountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371", "tokenId": "FNFT", "balance": 100 }, { "orgId": "AppBldFFFFMay22", "userId": "user2", "userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38", "tokenAccountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e", "tokenId": "FT", "balance": 50 }, { "orgId": "AppBldFFFFMay22", "userId": "example_minter", "userAccountId": "ouaccount~9501bb774c156eb8354dfe489250ea91f757523d70f08ee494bda98bb352003b", "tokenAccountId": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446", "tokenId": "FNFT", "balance": 10 } ]
-
batchTransferFrom
- Original method name:
batchTransferFrom
- This POST method completes a batch operation that transfers tokens specified in a list of token IDs from one user to another user. This method can be called by any user.
- Payload:
{ "fromOrgId": "fromOrgId value", "fromUserId": "fromUserId value", "toOrgId": "toOrgId value", "toUserId": "toUserId value", "tokenIds": "[\"{{bc-token-id}}\"]", "quantity": "[quantity value]", "endorsers": {{endorsers}} }
- Parameters:
fromOrgId: string
– The membership service provider (MSP) ID of the sender.fromUserId: string
– The user ID of the sender.toOrgId: string
– The membership service provider (MSP) ID of the receiver.toUserId: string
– The user ID of the receiver.tokenIds: string[]
– A list of token IDs for the tokens to transfer.quantity: number[]
– The list of quantities of tokens to transfer, corresponding to the token ID array.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Returns:
- On success, a message with details for each token transfer.
- Return Value Example:
[ { "msg": "Successfully transferred NFT token: 'FNFT' of '10' quantity from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: AppBldFFFFMay22, User-Id: user2) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: AppBldFFFFMay22, User-Id: example_minter)" }, { "msg": "Successfully transferred 10 FT token: 'FT' from Account-Id: oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e (Org-Id: AppBldFFFFMay22, User-Id: user2) to Account-Id: oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (Org-Id: AppBldFFFFMay22, User-Id: example_minter)" }, { "msg": "Successfully transferred NFT token: 'NFT' from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: AppBldFFFFMay22, User-Id: user2) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: AppBldFFFFMay22, User-Id: example_minter)" } ]
-
burnBatch
- Original method name:
burnBatch
- This POST method deactivates, or burns, the specified fungible and non-fungible tokens. Any user with the burner role can call this method.
- Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "tokenIds": "[\"{{bc-token-id}}\"]", "quantity": "[quantity value]", "sameOrgEndorser": true }
- Parameters:
orgId: string
– The membership service provider (MSP) ID in the current organization.userId: string
– The user name or email ID.tokenIds: string[]
– The list of the token IDs to burnquantity: number[]
– The list of quantities of tokens to burn, corresponding to the token ID array..sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a message with details about the burn operations.
- Return Value Example:
[ { "msg": "Successfully burned NFT token: 'art' from Account-Id: oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6 (Org-Id: appdev, User-Id: user2)" }, { "msg": "Successfully burned 5 tokens of tokenId: tokenOne from Account-ID oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: user2)" }, { "msg": "Successfully burned 2 token share of tokenId: FNFT from Account-ID oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a (Org-Id: AutoF1377358917, User-Id: user2)" } ]
-
burnNFT
- Original method name:
burnNFT
- This POST method deactivates, or burns, the specified non-fungible token, and returns a token object and token history. Any user with the burner role can call this method.
- Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "tokenId": "{{bc-token-id}}", "sameOrgEndorser": true }
- Parameters:
orgId: string
– The membership service provider (MSP) ID in the current organization.userId: string
– The user name or email ID.tokenId: string
– The ID of the non-fungible token to burnsameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a JSON array that contains a message about the burn operation.
- Return Value Example:
{ "msg": "Successfully burned NFT token: 'art' from Account-Id: oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6 (Org-Id: appdev, User-Id: user2)" }
-
createAccount
- Original method name:
createAccount
- This POST method creates an account for a specified user and associated token accounts for fungible or non-fungible tokens. An account must be created for any user who will have tokens at any point. The user account tracks the NFT account and the fungible token accounts that a user holds. Users must have accounts in the network to complete token-related operations. This method can be called only by a
Token Admin
of the chaincode.A user account has a unique ID, which is formed by an SHA-256 hash of the
orgId
parameter and theuserId
parameter.A user can have multiple fungible token accounts with unique account IDs. Fungible token account IDs are formed by an SHA-256 hash of the
orgId
parameter, theuserId
parameter, the constant stringft
separated by the tilde symbol (~
), and a counter number that signifies the index of the fungible account that is being created separated by the tilde symbol (~
).A user can have only one non-fungible token account. Non-fungible token account IDs are unique and are formed by an SHA-256 hash of the
orgId
parameter, theuserId
parameter, and the constant stringnft
separated by the tilde symbol (~
). All non-fungible tokens that a user owns, whether whole or fractional, are linked to this account.User account IDs start with with
ouaccount~
. Token account IDs start withoaccount~
. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "ftAccount": true, "nftAccount": true, "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.ftAccount: boolean
– If true, a fungible token account is created and associated with the user account.nftAccount: boolean
– If true, a non-fungible token account is created and associated with the user account.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "assetType": "ouaccount", "accountId": "ouaccount~cf20877546f52687f387e7c91d88b9722c97e1a456cc0484f40c747f7804feae", "userId": "user1", "orgId": "appdev", "totalAccounts": 2, "totalFtAccounts": 1, "associatedFtAccounts": [ { "accountId": "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b", "tokenId": "" } ], "associatedNftAccount": "oaccount~73c3e835dac6d0a56ca9d8def08269f83cefd59b9d297fe2cdc5a9083828fa58" }
-
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
roles
section forbehaviors
and theminter_role_name
property 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\",\"tokenMetadata\":{\"Painting_Name\":\"Painting_Name value\",\"Description\":\"Description value\",\"Painter_Name\":\"Painter_Name value\"},\"Price\":999,\"On_Sale_Flag\":true}", "quantity": 1, "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.quantity: number
– The number of tokens to mint. The only supported value for this parameter is1
.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "tokenMetadata": { "ISIN": "ISIN value", "Segment": "Segment value", "Issuer": "Issuer value", "FaceValue": 999, "IssueSize": 999, "CouponRate": 999, "InterestPaymentType": "simple", "InterestFrequency": "monthly", "IssueDate": "2023-03-28T15:16:36.000Z", "MaturityDate": "2023-03-28T15:16:36.000Z" }, "assetType": "otoken", "events": false, "tokenId": "token2", "tokenName": "bond", "tokenDesc": "tokenDesc value", "tokenStandard": "erc1155+", "tokenType": "nonfungible", "tokenUnit": "fractional", "behaviors": [ "divisible", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 0 }, "quantity": 10, "createdBy": "oaccount~85dfd98d1b99e5b8891e0a0fdcd7d2e07fc5d37958f5d2a5796290b6a9204a43", "creationDate": "2024-12-03T12:07:24.000Z", "divisible": { "decimal": 0 }, "isBurned": false, "isLocked": false, "tokenUri": "tokenUri value", "status": "created" }
-
createLoyaltyToken
- Original method name:
createLoyaltyToken
- This POST method creates tokens. Every token that is defined has its own create method. This method can be called only by a
Token Admin
of the chaincode. - Payload:
{ "tokenAsset": "{\"tokenId\":\"{{bc-token-id}}\",\"tokenDesc\":\"tokenDesc value\",\"Token_Name\":\"Token_Name value\",\"Token_to_Currency_Ratio\":999}", "sameOrgEndorser": true }
- Parameters:
tokenAsset: <Token Class>
– The token asset. The properties of the asset are defined in the model file.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Return Value Example:
{ "assetType": "otoken", "events": false, "tokenId": "token2", "tokenName": "loyalty", "tokenDesc": "tokenDesc value", "tokenStandard": "erc1155+", "tokenType": "fungible", "tokenUnit": "fractional", "behaviors": [ "divisible", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 0 }, "quantity": 10, "createdBy": "oaccount~85dfd98d1b99e5b8891e0a0fdcd7d2e07fc5d37958f5d2a5796290b6a9204a43", "creationDate": "2024-12-03T12:07:24.000Z", "divisible": { "decimal": 0 }, "isBurned": false, "isLocked": false, "tokenUri": "tokenUri value", "status": "created" }
-
createTokenAccount
- Original method name:
createTokenAccount
- This POST method creates a fungible or non-fungible token account to associate with a user account.
A user can have multiple fungible token accounts with unique account IDs. Fungible token account IDs are formed by an SHA-256 hash of the
orgId
parameter, theuserId
parameter, the constant stringft
separated by the tilde symbol (~
), and a counter number that signifies the index of the fungible account that is being created separated by the tilde symbol (~
).A user can have only one non-fungible token account. Non-fungible token account IDs are unique and are formed by an SHA-256 hash of the
orgId
parameter, theuserId
parameter, and the constant stringnft
separated by the tilde symbol (~
). All non-fungible tokens that a user owns, whether whole or fractional, are linked to this account.This method can be called only by a
Token Admin
of the chaincode. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "tokenType": "nonfungible", "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.tokenType: TokenType
– The type of token account to create. The only supported token types arenonfungible
andfungible
.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Returns:
- On success, a JSON object of the token account that was created.
- Return Value Example:
{ "assetType": "ouaccount", "accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc", "userId": "user2", "orgId": "appdev", "totalAccounts": 1, "totalFtAccounts": 1, "associatedFtAccounts": [ { "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a", "tokenId": "" } ], "associatedNftAccount": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a" }
-
createUserAccount
- Original method name:
createUserAccount
- This POST method creates an account for a specified user. An account must be created for any user who will have tokens at any point. The user account tracks the NFT account and the fungible token accounts that a user has. Users must have accounts in the network to complete token-related operations.
An account ID is an SHA-256 hash of the
orgId
parameter and theuserId
parameter. This method can be called only by aToken Admin
of 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.
- Returns:
- On success, a JSON object of the user account that was created.
- Return Value Example:
{ "assetType": "ouaccount", "accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc", "userId": "user2", "orgId": "appdev", "totalAccounts": 0, "totalFtAccounts": 0, "associatedFtAccounts": [], "associatedNftAccount": "" }
-
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 Admin
of 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.
- Returns:
- On success, a JSON representation of the token account status.
- Return Value Example:
{ "assetType": "oaccountStatus", "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "deleted" }
-
exchangeToken
- Original method name:
exchangeToken
- This method exchanges tokens between specified accounts. This method only supports exchanging between an NFT and a fungible token or a fungible token and an NFT. The NFT can be whole or fractional. This method can be called only by the account owner.
- Payload:
{ "fromTokenId": "fromTokenId value", "fromOrgId": "fromOrgId value", "fromUserId": "fromUserId value", "fromTokenQuantity": 1, "toTokenId": "toTokenId value", "toOrgId": "toOrgId value", "toUserId": "toUserId value", "toTokenQuantity": 1, "endorsers": {{endorsers}} }
- Parameters:
fromTokenId: string
– The ID of the token that the sender owns.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.fromTokenQuantity: number
– The quantity of tokens from the sender to exchange with the receiver.toTokenId: string
– The ID of the token that the receiver owns.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.toTokenQuantity: number
– The quantity of tokens from the receiver to exchange with the sender.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Returns:
- On success, a message with token exchange details.
- Return Value Example:
{ "msg": "Succesfully exchanged 10 tokens of type nonfungible with tokenId: [r1] from Account oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (OrgId: AppBldFFFFMay22, UserId: user2) to 10 tokens of type fungible with tokenId: [loy1] from Account oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (OrgId: AppBldFFFFMay22, UserId: example_minter)" }
-
getAccount
- Original method name:
getAccount
- This GET method returns token account details for a specified user. This method can be called only by a
Token Admin
of the chaincode or theAccount Owner
of the account. - Query:
/getAccount?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 object that includes token account details.
- Return Value Example
{ "assetType": "oaccount", "accountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371", "userId": "user2", "orgId": "AppBldFFFFMay22", "tokenType": "nonfungible", "noOfNfts": 3 }
-
getAccountDetailsByUser
- Original method name:
getAccountDetailsByUser
- This GET method returns account details for a specified user. This method can be called only by a
Token Admin
of the chaincode or theAccount Owner
of the account. - Query:
/getAccountDetailsByUser?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:
{ "userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38", "associatedFTAccounts": [ { "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e", "tokenId": "FT", "balance": 50 } ], "associatedNFTAccount": { "accountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371", "associatedNFTs": [ { "nftTokenId": "FNFT", "tokenShare": 100 }, { "nftTokenId": "FNFT2", "tokenShare": 110 }, { "nftTokenId": "NFT" } ] } }
-
getAccountHistory
- Original method name:
getAccountHistory
- This GET method returns account history for a specified token account. For NFT accounts, the
tokenId
parameter must be empty. This method can be called only by theToken Admin
of the chaincode or by the account owner. - Query:
/getAccountHistory?orgId={{bc-org-id}}&userId={{bc-user-id}}&tokenId={{bc-token-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.tokenId: string
– The ID of the fungible token.
- Return Value Example:
[ { "trxId": "a2cfc6fc064334d6b9931cdf67193711ec2ff5c50a4714f11855fe7384f00e35", "timeStamp": "2023-06-06T14:44:31.000Z", "value": { "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e", "assetType": "oaccount", "balance": 100, "orgId": "AppBldFFFFMay22", "tokenId": "loy1", "tokenName": "loyalty", "tokenType": "fungible", "userId": "user2" } }, { "trxId": "de483cf7505ae4e7018c4b604c3ab9327c2fb1f802d9408e22735667c1d6997f", "timeStamp": "2023-06-06T14:43:23.000Z", "value": { "assetType": "oaccount", "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e", "userId": "user2", "orgId": "AppBldFFFFMay22", "tokenType": "fungible", "tokenId": "loy1", "tokenName": "loyalty", "balance": 0 } }, { "trxId": "db053e653d3ad9aa5b7b6e04b7cd51aacfbb413272d857a155b60d2a6a12bf4d", "timeStamp": "2023-06-05T16:59:08.000Z", "value": { "assetType": "oaccount", "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e", "userId": "user2", "orgId": "AppBldFFFFMay22", "tokenType": "fungible", "tokenId": "", "balance": 0 } } ]
-
getAccountStatus
- Original method name:
getAccountStatus
- This GET method retrieves the current status of the token account. This method can be called by the
Token Admin
of 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:
{ "assetType": "oaccountStatus", "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "active" }
-
getAccountStatusHistory
- Original method name:
getAccountStatusHistory
- This GET method retrieves the history of the account status. This method can be called by the
Token Admin
of 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:
[ { "trxId": "d5c6d6f601257ba9b6edaf5b7660f00adc13c37d5321b8f7d3a35afab2e93e63", "timeStamp": "2022-12-02T10:39:14.000Z", "value": { "assetType": "oaccountStatus", "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "suspended" } }, { "trxId": "e6c850cfa084dc20ad95fb2bb8165eef3a3bd62a0ac867cccee57c2003125183", "timeStamp": "2022-12-02T10:37:50.000Z", "value": { "assetType": "oaccountStatus", "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "active" } } ]
-
getAccountTransactionHistory
- Original method name:
getAccountTransactionHistory
- This GET method returns account transaction history. This method can be called only by a
Token Admin
of the chaincode or by the account owner. - Query:
/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:
[ { "transactionId": "otransaction~3a6b23c3003626f3947e990eddbd7ac23398d2200e2eb3eac745e6ddfae140bc~7c88c736df38d5622512f1e8dcdd50710eb47c953f1ecb24ac44790a9e2f475b", "timestamp": "2023-06-06T14:48:08.000Z", "tokenId": "FNFT", "transactedAmount": 10, "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38", "transactedAccount": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446", "transactionType": "DEBIT", "balance": 90 }, { "transactionId": "otransaction~3a6b23c3003626f3947e990eddbd7ac23398d2200e2eb3eac745e6ddfae140bc~178e3730bc5bee50d02f1464a4eebf733a051905f651e5789039adb4a3edc114", "timestamp": "2023-06-06T14:48:08.000Z", "tokenId": "NFT", "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38", "transactedAccount": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446", "transactionType": "DEBIT" }, { "transactionId": "otransaction~c369929e28e78de06c72d020f1418c9a154a7dd280b2e22ebb4ea4485e249124~a7cefb22ff39ee7e36967be71de27da6798548c872061a62dabc56d88d50b930", "timestamp": "2023-06-06T14:47:08.000Z", "tokenId": "NFT", "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38", "transactedAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371", "transactionType": "MINT" }, { "transactionId": "otransaction~114a1bc78d04be48ee6dc140c32c042ee9481cb118959626f090eec744522422~e4eb15d9354f694230df8835ade012100d82aa43672896a2c7125a86e3048f9f", "timestamp": "2023-06-05T17:17:57.000Z", "tokenId": "FNFT", "transactedAmount": 100, "triggeredByUserAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38", "transactedAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371", "transactionType": "MINT", "balance": 100 } ]
-
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 Admin
of the chaincode. - Query:
/getAccountsByRole?role=role value (for example minter / burner)&tokenDetail={"tokenName":"tokenName value"}
- Parameters:
role: string
– The name of the role to search for.tokenDetails: TokenDetail
– The details that specify the token. For fungible tokens, use the following format:
For non-fungible tokens, use the following format:{"tokenId":"token1"}
{"tokenName":"artCollection"}
- Return Value Example:
{ "accounts": [ "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a", "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b" ] }
-
getAllAccounts
- Original method name:
getAllAccounts
- This GET method returns details of all user accounts. This method can be called only by a
Token Admin
of the chaincode. - Query:
/getAllAccounts
- Parameters:
- none
- Returns:
- On success, a JSON array of all accounts.
- Return Value Example:
[ { "assetType": "ouaccount", "accountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38", "userId": "user2", "orgId": "AppBldFFFFMay22", "totalAccounts": 2, "totalFtAccounts": 1, "associatedFtAccounts": [ { "accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e", "tokenId": "loy1" } ], "associatedNftAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371" }, { "assetType": "ouaccount", "accountId": "ouaccount~9501bb774c156eb8354dfe489250ea91f757523d70f08ee494bda98bb352003b", "userId": "example_minter", "orgId": "AppBldFFFFMay22", "totalAccounts": 2, "totalFtAccounts": 1, "associatedFtAccounts": [ { "accountId": "oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c", "tokenId": "loy1" } ], "associatedNftAccount": "oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446" }, ]
-
getAllTokenAdmins
- Original method name:
getAllTokenAdmins
- This GET method returns a list of all users who are a
Token Admin
of the chaincode. This method can be called only by theToken Admin
of the chaincode. - Query:
/getAllTokenAdmins
- Parameters:
- none
- Returns:
- On success, an
admins
array in JSON format that containsorgId
anduserId
objects.
- On success, an
- Return Value Example:
{ "admins": [ { "orgId": "appdev", "userId": "user2" }, { "orgId": "appdev", "userId": "user1" } ] }
-
getAllTokens
- Original method name:
getAllTokens
- This GET method returns all of the token assets that are saved in the state database. This method can be called only by a
Token Admin
of 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:
[{ "tokenMetadata": { "ISIN": "ISIN value", "Segment": "Segment value", "Issuer": "Issuer value", "FaceValue": 999, "IssueSize": 999, "CouponRate": 999, "InterestPaymentType": "simple", "InterestFrequency": "monthly", "IssueDate": "2023-03-28T15:16:36.000Z", "MaturityDate": "2023-03-28T15:16:36.000Z" }, "assetType": "otoken", "events": false, "tokenId": "token2", "tokenName": "bond", "tokenDesc": "tokenDesc value", "tokenStandard": "erc1155+", "tokenType": "nonfungible", "tokenUnit": "fractional", "behaviors": [ "divisible", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 0 }, "quantity": 10, "createdBy": "oaccount~85dfd98d1b99e5b8891e0a0fdcd7d2e07fc5d37958f5d2a5796290b6a9204a43", "creationDate": "2024-12-03T12:07:24.000Z", "divisible": { "decimal": 0 }, "isBurned": false, "isLocked": false, "tokenUri": "tokenUri value", "status": "status value" }]
-
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 Admin
of 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:
[{ "tokenMetadata": { "ISIN": "ISIN value", "Segment": "Segment value", "Issuer": "Issuer value", "FaceValue": 999, "IssueSize": 999, "CouponRate": 999, "InterestPaymentType": "simple", "InterestFrequency": "monthly", "IssueDate": "2023-03-28T15:16:36.000Z", "MaturityDate": "2023-03-28T15:16:36.000Z" }, "assetType": "otoken", "events": false, "tokenId": "token2", "tokenName": "bond", "tokenDesc": "tokenDesc value", "tokenStandard": "erc1155+", "tokenType": "nonfungible", "tokenUnit": "fractional", "behaviors": [ "divisible", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 0 }, "quantity": 10, "createdBy": "oaccount~85dfd98d1b99e5b8891e0a0fdcd7d2e07fc5d37958f5d2a5796290b6a9204a43", "creationDate": "2024-12-03T12:07:24.000Z", "divisible": { "decimal": 0 }, "isBurned": false, "isLocked": false, "tokenUri": "tokenUri value", "status": "status value" }]
-
getTokenById
- Original method name:
getTokenById
- This GET method returns a token object if the token is present in the state database. This method can be called only by a
Token Admin
of the chaincode or the token owner. For fractional NFTs, the response includes the list of token owners. - Query:
/getTokenById?tokenId={{bc-token-id}}
- Parameters:
tokenId: string
– The ID of the token to get.
- Return Value Example:
[{ "tokenMetadata":{ "ISIN":"ISIN value", "Segment":"Segment value", "Issuer":"Issuer value", "FaceValue":10, "IssueSize":999, "CouponRate":10, "InterestPaymentType":"simple", "InterestFrequency":"monthly", "IssueDate":"2023-03-28T15:16:36.000Z", "MaturityDate":"2023-03-28T15:16:36.000Z" }, "assetType":"otoken", "events":true, "tokenId":"bond1", "tokenName":"bond", "tokenDesc":"tokenDesc value", "tokenStandard":"erc1155+", "tokenType":"nonfungible", "tokenUnit":"fractional", "behaviors":[ "divisible", "mintable", "transferable", "burnable", "roles" ], "roles":{ "minter_role_name":"minter", "burner_role_name":"burner" }, "mintable":{ "max_mint_quantity":0 }, "quantity":100, "createdBy":"oaccount~276bcf1324b1ad1e493e22432db3b39f7a4b9bb17b8525c0391ea3ba36138e00", "creationDate":"2024-12-02T12:42:09.000Z", "divisible":{ "decimal":0 }, "isBurned":false, "isLocked":false, "tokenUri":"tokenUri value", "status":"posted" } ]
-
getTokenDecimal
- Original method name:
getTokenDecimal
- This method returns the number of decimal places for a specified token. This method can be called only by a
Token Admin
of the chaincode. - Query:
/getTokenDecimal?tokenId={{bc-token-id}}
- Parameters:
tokenId: string
– The ID of the token.
- Return Value Example:
{ "msg": "Token Id: tokenOne has 2 decimal places." }
-
getTokenHistory
- Original method name:
getTokenHistory
- This GET method returns the history for a specified token ID. Anyone can call this method.
/getTokenHistory?tokenId={{bc-token-id}}
- Parameters:
tokenId: string
– The ID of the token.
- Return Value Example:
[{ "tokenMetadata":{ "ISIN":"ISIN value", "Segment":"Segment value", "Issuer":"Issuer value", "FaceValue":10, "IssueSize":999, "CouponRate":10, "InterestPaymentType":"simple", "InterestFrequency":"monthly", "IssueDate":"2023-03-28T15:16:36.000Z", "MaturityDate":"2023-03-28T15:16:36.000Z" }, "assetType":"otoken", "events":true, "tokenId":"bond1", "tokenName":"bond", "tokenDesc":"tokenDesc value", "tokenStandard":"erc1155+", "tokenType":"nonfungible", "tokenUnit":"fractional", "behaviors":[ "divisible", "mintable", "transferable", "burnable", "roles" ], "roles":{ "minter_role_name":"minter", "burner_role_name":"burner" }, "mintable":{ "max_mint_quantity":0 }, "quantity":100, "createdBy":"oaccount~276bcf1324b1ad1e493e22432db3b39f7a4b9bb17b8525c0391ea3ba36138e00", "creationDate":"2024-12-02T12:42:09.000Z", "divisible":{ "decimal":0 }, "isBurned":false, "isLocked":false, "tokenUri":"tokenUri value", "status":"posted" } ]
-
getTokensByName
- Original method name:
getTokensByName
- This GET method returns all of the token assets for a specified token name. 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 Admin
of the chaincode. - Query:
/getTokensByName?tokenName=tokenName value
- Parameters:
tokenName: string
– The name of the token.
- Return Value Example:
[ { "key": "tokenOne", "valueJson": { "assetType": "otoken", "tokenId": "tokenOne", "tokenName": "moneytok", "tokenStandard": "erc1155+", "tokenType": "fungible", "tokenUnit": "fractional", "behaviors": [ "divisible", "mintable", "transferable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 1000 }, "divisible": { "decimal": 2 } } }, { "key": "tokenTwo", "valueJson": { "assetType": "otoken", "tokenId": "tokenTwo", "tokenName": "moneytok", "tokenStandard": "erc1155+", "tokenType": "fungible", "tokenUnit": "fractional", "behaviors": [ "divisible", "mintable", "transferable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 1000 }, "divisible": { "decimal": 2 } } } ]
-
getTransactionById
- Original method name:
getTransactionById
- This GET method returns transaction history for a specified transaction ID. This is an asynchronous method. This method can be called by any user.
- 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:
{ "transactionId": "otransaction~9ea7b05ab099f7ff4db8342b8c3609031f1d54f11205906e7f1fe88661fe3cbe~33b59ce0c89e96c1e16449f24301581e8e71954f38ad977c7eb6f065e87f2a53", "history": [ { "trxId": "9ea7b05ab099f7ff4db8342b8c3609031f1d54f11205906e7f1fe88661fe3cbe", "timeStamp": "2022-12-08T09:01:28.000Z", "value": { "assetType": "otransaction", "transactionId": "otransaction~9ea7b05ab099f7ff4db8342b8c3609031f1d54f11205906e7f1fe88661fe3cbe~33b59ce0c89e96c1e16449f24301581e8e71954f38ad977c7eb6f065e87f2a53", "tokenId": "tokenOne", "fromAccountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a", "toAccountId": "", "transactionType": "BURN", "amount": 5, "timestamp": "2022-12-08T09:01:28.000Z", "triggeredByUserAccountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc" } } ] }
-
getUserByAccountId
- Original method name:
getUserByAccountId
- This GET method returns the organization ID and user ID for a specified account ID.
- Query:
/getUserByAccountId?accountId=accountId value
- Parameters:
accountId: string
– The ID of the account.
- Return Value Example:
{ "orgId": "AppBldFFFFMay22", "userId": "user2" }
-
getUsersByRole
- Original method name:
getUsersByRole
- This GET method returns a list of all users for a specified role.
- Query:
/getUsersByRole?role=role value (for example minter / burner)&tokenDetail={"tokenName":"tokenName value"}
- Parameters:
role: string
– The name of the role to search for.tokenDetail: TokenDetail
– The details that specify the token. For fungible tokens, use the following format:
For non-fungible tokens, use the following format:{"tokenId":"token1"}
{"tokenName":"artCollection"}
- Return Value Example:
{ "users": [ { "accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a", "orgId": "appdev", "userId": "user2" }, { "accountId": "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b", "orgId": "appdev", "userId": "user1" } ] }
-
init
- Original method name:
init
- This POST method is called when the chaincode is deployed. The user information is saved as the
Token Admin
of the chaincode. - Payload:
{ "adminList": "[{\"orgId\":\"{{bc-org-id}}\",\"userId\":\"{{bc-user-id}}\"}]" }
- Parameters:
adminList array
– An array of{user_id, org_id}
information that specifies the list of token admins. TheadminList
array is a mandatory parameter.
- Returns:
- On success, a message with no payload.
- Return Value Example:
{ }
-
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 Admin
of the chaincode or theAccount Owner
of the account. - Query:
/isInRole?orgId={{bc-org-id}}&userId={{bc-user-id}}&role=role value (for example minter / burner)&tokenDetail={"tokenName":"tokenName value"}
- 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.tokenDetail: TokenDetail
– The details that specify the token. For fungible tokens, use the following format:
For non-fungible tokens, use the following format:{"tokenId":"token1"}
{"tokenName":"artCollection"}
- Return Value Example:
{ "result": true, "msg": "Account Id oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: user2) has minter role" }
-
isTokenAdmin
- Original method name:
isTokenAdmin
- This GET method returns the Boolean value
true
if the caller of the function is aToken Admin
, otherwise it returnsfalse
. This method can be called only by aToken Admin
of the chaincode. - Query:
/isTokenAdmin?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:
- The method returns
true
if the caller is aToken Admin
, otherwise it returnsfalse
.
- The method returns
- Return Value Example:
{ "result": true }
-
mintBatch
- Original method name:
mintBatch
- This POST method creates (mints) multiple tokens in a batch operation. This method creates only fungible tokens or fractional non-fungible tokens.
For fungible tokens, if the minter role is defined in the specification file, then any user with the minter role can call this method. If not, any user can use this method to mint tokens. You cannot mint more than the
max_mint_quantity
property of the token, if that property was specified when the token was created or updated.For non-fungible tokens, if the minter role is defined in the specification file, then any user with the minter role can call this method. If not, any user can use this method to mint tokens. Additionally, the caller must also be the creator of the token. There is no upper limit to the quantity of fractional non-fungible tokens that can be minted.
You cannot use this method to mint a whole non-fungible token.
- Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "tokenIds": "[\"{{bc-token-id}}\"]", "quantity": "[quantity value]", "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.tokenIds: string[]
– The list of token IDs to mint tokens for.quantity: number[]
– The list of quantities of tokens to mint, corresponding to the token ID array.sameOrgEndorser: boolean
– A Boolean value that indicates whether transaction endorsements must be from the same organization as the requester.
- Returns:
- On success, a JSON object that includes details on the minted tokens.
- Return Value Example:
{ "msg": "Successfully minted batch of tokens for User-Account-Id ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38 (Org-Id: AppBldFFFFMay22, User-Id: user2).", "details": [ { "msg": "Successfully minted 100 tokens of fractional tokenId: plot55 to Org-Id: AppBldFFFFMay22, User-Id: user2" }, { "msg": "Successfully minted 100 tokens of tokenId: loyalty to Token-Account-Id oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e" } ] }
-
name
- Original method name:
name
- This GET method returns the name of the token class. Anyone can call this method.
- Query:
/name?tokenId={{bc-token-id}}
- Parameters:
tokenId: string
– The ID of the token.
- Return Value Example:
{ "tokenName": "artcollection" }
-
ownerOf
- Original method name:
ownerOf
- This GET method returns the account ID of the owners 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 account IDs of the owners.
- Return Value Example:
[ { "accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d", "orgId": "Org1MSP", "userId": "admin" }, { "accountId": "oaccount~74108eca702bab6d8548e740254f2cc7955d886885251d52d065042172a59db0", "orgId": "Org1MSP", "userId": "user" } ]
-
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:
{ "msg": "Token ID : 'artCollection1' has been posted for selling in the marketplace" }
-
removeRole
- Original method name:
removeRole
- This method removes a role from a specified user. This method can be called only by a
Token Admin
of the chaincode. - Payload:
{ "orgId": "{{bc-org-id}}", "userId": "{{bc-user-id}}", "role": "role value (for example minter / burner)", "tokenDetail": "{\"tokenName\":\"tokenName value\"}", "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.role: string
– The name of the role to remove from the specified user.tokenDetail: TokenDetail
– The details that specify the token. For fungible tokens, use the following format:
For non-fungible tokens, use the following format:{"tokenId":"token1"}
{"tokenName":"artCollection"}
endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
{ "msg": "Successfully removed role 'minter' from Account Id: oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b (Org-Id: appdev, User-Id: user1)" }
-
removeTokenAdmin
- Original method name:
removeTokenAdmin
- This POST method removes a user as a
Token Admin
of the chaincode. This method can be called only by aToken Admin
of 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:
{ "msg": "Successfully removed Admin (OrgId: appDev, UserId: user1)" }
-
safeBatchTransferFrom
- Original method name:
safeBatchTransferFrom
- This POST method transfers ownership of the specified tokens from the caller to another account. The caller of this method must be the sender of the tokens and must own the specified tokens. For fractional NFTs, if a user transfers all of their shares to another user, they lose ownership of the token.
- Payload:
{ "fromOrgId": "fromOrgId value", "fromUserId": "fromUserId value", "toOrgId": "toOrgId value", "toUserId": "toUserId value", "tokenIds": "[\"{{bc-token-id}}\"]", "quantity": "[quantity 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.tokenIds: string[]
– An array of the IDs of the tokens to transfer.quantity: number[]
– The list of quantities of tokens to transfer, corresponding to the token ID array.endorsers: string[]
– An array of the peers (for example,peer1
,peer2
) that must endorse the transaction.
- Return Value Example:
[ { "msg": "Successfully transferred NFT token: 'FNFT' of '10' quantity from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: AppBldFFFFMay22, User-Id: user2) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: AppBldFFFFMay22, User-Id: example_minter)" }, { "msg": "Successfully transferred 10 FT token: 'FT' from Account-Id: oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e (Org-Id: AppBldFFFFMay22, User-Id: user2) to Account-Id: oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (Org-Id: AppBldFFFFMay22, User-Id: example_minter)" }, { "msg": "Successfully transferred NFT token: 'NFT' from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: AppBldFFFFMay22, User-Id: user2) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: AppBldFFFFMay22, User-Id: example_minter)" } ]
-
suspendAccount
- Original method name:
suspendAccount
- This POST method suspends a fungible token account. It throws an error if an
accountStatus
value is not found in ledger. This method can be called only by aToken Admin
of 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:
{ "assetType": "oaccountStatus", "status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7", "account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1", "status": "suspended" }
-
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 Admin
of the chaincode. - Query (Fungible Tokens):
/totalNetSupply?tokenDetail={"tokenId":"{{bc-token-id}}"}
- Query (Non-Fungible Tokens):
/totalNetSupply?tokenDetail={"tokenName":"tokenName value"}
- Parameters:
tokenDetail: TokenDetail
– The details that specify the token. For fungible tokens, use the following format:
For non-fungible tokens, use the following format:{"tokenId":"token1"}
{"tokenName":"artCollection"}
- Return Value Example:
{ "totalNetSupply": 105 }
-
totalSupply
- Original method name:
totalSupply
- This GET method returns the total number of minted tokens. This method can be called only by a
Token Admin
of the chaincode. - Query (Fungible Tokens):
/totalSupply?tokenDetail={"tokenId":"{{bc-token-id}}"}
- Query (Non-Fungible Tokens):
/totalSupply?tokenDetail={"tokenName":"tokenName value"}
- Parameters:
tokenDetail: TokenDetail
– The details that specify the token. For fungible tokens, use the following format:
For non-fungible tokens, use the following format:{"tokenId":"token1"}
{"tokenName":"artCollection"}
- Return Value Example:
{ "totalSupply": 110 }
-
updateArtCollectionToken
- Original method name:
updateArtCollectionToken
- This POST method updates token properties. Only the token owner can call this method. For NFTs, the token metadata and token URI cannot be updated after the token is minted.
- Payload:
{ "tokenAsset": "{\"tokenId\":\"{{bc-token-id}}\",\"tokenDesc\":\"tokenDesc value\",\"tokenUri\":\"tokenUri value\",\"status\":\"status value\", \"tokenMetadata\":{\"ISIN\":\"ISIN value\",\"Segment\":\"Segment value\",\"Issuer\":\"Issuer value\",\"FaceValue\":999,\"IssueSize\":999,\"CouponRate\":999,\"InterestPaymentType\":\"InterestPaymentType value\",\"InterestFrequency\":\"InterestFrequency value\",\"IssueDate\":\"2023-03-28T15:16:36+00:00\",\"MaturityDate\":\"2023-03-28T15:16:36+00:00\"},\"status\":\"status value\"}", "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:
{ "tokenMetadata": { "ISIN": "ISIN value", "Segment": "Segment value", "Issuer": "Issuer value", "FaceValue": 999, "IssueSize": 999, "CouponRate": 999, "InterestPaymentType": "simple", "InterestFrequency": "monthly", "IssueDate": "2023-03-28T15:16:36.000Z", "MaturityDate": "2023-03-28T15:16:36.000Z" }, "assetType": "otoken", "events": false, "tokenId": "token2", "tokenName": "bond", "tokenDesc": "tokenDesc value", "tokenStandard": "erc1155+", "tokenType": "nonfungible", "tokenUnit": "fractional", "behaviors": [ "divisible", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 0 }, "quantity": 10, "createdBy": "oaccount~85dfd98d1b99e5b8891e0a0fdcd7d2e07fc5d37958f5d2a5796290b6a9204a43", "creationDate": "2024-12-03T12:07:24.000Z", "divisible": { "decimal": 0 }, "isBurned": false, "isLocked": false, "tokenUri": "tokenUri value", "status": "created" }
-
updateLoyaltyToken
- Original method name:
updateLoyaltyToken
- This POST method updates token properties. Only the token owner can call this method. For NFTs, the token metadata and token URI cannot be updated after the token is minted.
- Payload:
{ "tokenAsset": "{\"tokenId\":\"{{bc-token-id}}\",\"tokenDesc\":\"tokenDesc value\",\"Token_Name\":\"Token_Name value\",\"Token_to_Currency_Ratio\":999}", "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:
{ "assetType": "otoken", "events": false, "tokenId": "token2", "tokenName": "loyalty", "tokenDesc": "tokenDesc value", "tokenStandard": "erc1155+", "tokenType": "fungible", "tokenUnit": "fractional", "behaviors": [ "divisible", "mintable", "transferable", "burnable", "roles" ], "roles": { "minter_role_name": "minter", "burner_role_name": "burner" }, "mintable": { "max_mint_quantity": 0 }, "quantity": 10, "createdBy": "oaccount~85dfd98d1b99e5b8891e0a0fdcd7d2e07fc5d37958f5d2a5796290b6a9204a43", "creationDate": "2024-12-03T12:07:24.000Z", "divisible": { "decimal": 0 }, "isBurned": false, "isLocked": false, "tokenUri": "tokenUri value", "status": "created" }
-
URI
- Original method name:
URI
- This GET method returns the URI of a specified token. Only the token creator can call this method.
- Query
/URI?tokenId={{bc-token-id}}
- Parameters:
tokenId: string
– The ID of the token.
- Return Value Example:
{ "tokenUri": "example.com" }