-
activateAccount
- Original method name:
activateAccount
- This POST method activates a token account. This method can be called only by an admin or account owner. Deleted accounts cannot be activated.
- 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.
- Returns:
- On success, a JSON representation of the account status object for the specified 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 other admins to the token chaincode. This method can be called only by the 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.
- Returns:
- On success, a message that includes details of the user who was added as a
Token Admin
of the chaincode.
- Return Value Example:
{
"msg": "Successfully added Admin (OrgId: appDev, UserId: user1)"
}
-
addRole
- Original method name:
addRole
- This POST method adds a role to a specified user and token. This method can be called only by a
Token Admin
of the chaincode. Non-fungible tokens are specified by the token name. The specified user must have a non-fungible token account. The specified role must exist in the specification file for the token.
- 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:
- Returns:
- On success, a message with account details.
- Return Value Example:
{
"msg": "Successfully added role 'minter' to Account Id: oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: idcqa)"
}
-
approveBondRedemption
- Original method name:
approveBondRedemption
- This POST method can be called only by the token creator to approve a request for the redemption of bond tokens. The approval operation transfers the bond NFT from the owner’s account (the user who raised the request) to the creator’s account, and transfers CBDC tokens from the bond creator’s to the owner’s account. Because of this, this method must be executed in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
and userId
for the transfer. The orgId
and userId
must correspond to the account of the token owner who raised the redemption request, and the CBDC token transfer value must be equal to the calculated redemption price that was calculated by the chaincode while raising the redemption request.
- Payload:
{
"fromOrgId": "fromOrgId value",
"fromUserId": "fromUserId value",
"settlementId": "settlementId value",
"tokenId": "{{bc-token-id}}",
"CBDCTokenId": "CBDCTokenId value",
"CBDCFromOrgId": "CBDCFromOrgId value",
"CBDCFromUserId": "CBDCFromUserId value",
"CBDCQuantity": 0,
"CBDCRemark": "{\\\"category\\\":\\\"category value\\\",\\\"description\\\":\\\"description value\\\"}",
"endorsers": {{endorsers}}
}
- Parameters:
fromOrgId: string
– The membership service provider (MSP) ID of the user.
fromUserId: string
– The user name or email ID of the user.
settlementId: string
– The settlement ID for the redemption operation.
tokenId: string
– The ID of the token.
CBDCTokenId: string
– The ID of the token in the CBDC chaincode.
CBDCOrgId: string
– The MSP ID of the user in the CBDC chaincode.
CBDCUserId: string
– The user name or email ID of the user in the CBDC chaincode.
CBDCQuantity: string
– The quantity of tokens to transfer in the CBDC chaincode.
CBDCRemark: string
– A remark for the transfer in the CBDC chaincode, which must be in the format shown previously.
- Return Value Example:
{
"returnCode":"Success",
"error":"",
"result":{
"transactions":[
{
"channel":"test",
"chaincode":"BondMarketplace",
"txstatus":"Committed",
"prepare":{
"txid":"e969f962df5efda2ea6287380e308cc974efd79dfff3567840ed3844bf936160"
},
"commit":{
"txid":"5544e928d3242291fb39189e8329679a9c81d61d6f72db60ca89135cd20fffef"
},
"rollback":{
}
},
{
"channel":"cbdctest",
"chaincode":"cbdc",
"txstatus":"Committed",
"prepare":{
"txid":"1245885b1a0c7f12c41fa2f2905549b8a5f37ab3a5e094b9dca122cb0611a117"
},
"commit":{
"txid":"3c83e20c7d470cdc9c1b0e2e0ea8d9962d58ada8d1b8f0d2606c8aa1f0ae7741"
},
"rollback":{
}
}
],
"lrc":{
},
"globalStatus":"Success",
"globalTxid":"761bb7cc-1d66-4645-aeb2-50e4dbd23d83",
"txStartTime":"2024-12-05T12:01:21.881988035Z"
}
}
-
balanceOfBatch
- Original method name:
balanceOfBatch
- This GET method completes a batch operation that gets the balance of token accounts. The account details are specified in three separate lists of organization IDs, user IDs, and token IDs. This method can be called only by a
Token Admin
of the chaincode or by account owners. Account owners can see balance details only for accounts that they own.
- 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:
In the following example, the token ID FNFT
represents a fractional non-fungible token and the token ID FT
represents a fungible token.
[
{
"orgId": "appdev",
"userId": "idcqa",
"userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
"tokenAccountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
"tokenId": "FNFT",
"balance": 100
},
{
"orgId": "appdev",
"userId": "idcqa",
"userAccountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
"tokenAccountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
"tokenId": "FT",
"balance": 50
},
{
"orgId": "appdev",
"userId": "user1_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.
- 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[]
– 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.
- 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: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
},
{
"msg": "Successfully transferred 10 FT token: 'FT' from Account-Id: oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (Org-Id: appdev, User-Id: user1_minter)"
},
{
"msg": "Successfully transferred NFT token: 'NFT' from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
}
]
-
burnBatch
- Original method name:
burnBatch
- This POST method deactivates, or burns, the specified 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 burn
quantity: number[]
– The list of quantities of tokens to burn, corresponding to the token ID array..
- 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: idcqa)"
},
{
"msg": "Successfully burned 5 tokens of tokenId: tokenOne from Account-ID oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: idcqa)"
},
{
"msg": "Successfully burned 2 token share of tokenId: FNFT from Account-ID oaccount~87bcb699d507368ee3966cd03ee6d7736ffc55dde8c0f0e16b14866334ac504a (Org-Id: AutoF1377358917, User-Id: idcqa)"
}
]
-
createAccount
- Original method name:
createAccount
- This POST method creates an account for a specified user and associated token accounts for 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 the userId
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, the userId
parameter, the constant string ft
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, the userId
parameter, and the constant string nft
separated by the tilde symbol (~
). All non-fungible tokens that a user owns, whether whole or fractional, are linked to this account.
- Payload:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"ftAccount": true,
"nftAccount": true,
"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 (-).
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.
- Returns:
- On success, a JSON object of the account that was created.
- Return Value Example:
{
"assetType": "ouaccount",
"accountId": "ouaccount~cf20877546f52687f387e7c91d88b9722c97e1a456cc0484f40c747f7804feae",
"userId": "user1",
"orgId": "appdev",
"totalAccounts": 2,
"totalFtAccounts": 1,
"associatedFtAccounts": [
{
"accountId": "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b",
"tokenId": ""
}
],
"associatedNftAccount": "oaccount~73c3e835dac6d0a56ca9d8def08269f83cefd59b9d297fe2cdc5a9083828fa58"
}
-
createAccountWithEnrollment
- Original method name:
createAccountWithEnrollment
- This POST method creates an enrollment for a user in the REST proxy of the instance, and creates an NFT account in the bond marketplace chaincode.
- Payload:
{
"orgId": "orgId value",
"userId": "userId 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.
- Returns:
- On success, a JSON object of the account that was created.
- Return Value Example:
{
"blockNumber": 44,
"encode": "JSON",
"payload": {
"accountId": "ouaccount~1930ec223036c0fe2ea97c58fd9a8d2456d13c0fd0c98217ce075ceddb8add02",
"assetType": "ouaccount",
"associatedFtAccounts": [],
"associatedNftAccount": "oaccount~03f8a6949f6c5c453354a4a8eed8503a39766085b476430e95ce305769fba861",
"orgId": "BondMPTest",
"totalAccounts": 1,
"totalFtAccounts": 0,
"userId": "u14"
},
"sourceURL": "bondmptest-oabcs1-iad.blockchain.ocp.example.com:20010",
"txid": "9fa75a631f0de2ddf2ed85742dcc4d4b97b7afb0d3f9a07988e5cb9120ed633f"
}
-
createBondToken
- Original method name:
createBondToken
- This POST method creates tokens. Every token that is defined has its own create method. For non-fungible tokens, the caller of this method becomes the owner of the NFT. If
roles
behavior is defined in the token model behaviors
property and a minter_role_name
is specified, the caller account must have the minter role.
- Payload:
{
"tokenAsset": "{\"tokenId\":\"{{bc-token-id}}\",\"tokenDesc\":\"tokenDesc value\",\"tokenUri\":\"tokenUri 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\"}",
"quantity": 1,
"sameOrgEndorser": true
}
- Parameters:
tokenAsset: <Token Class>
– The token asset. The properties of the asset are defined in the model file.
quantity: number
– The number of tokens to mint. The only supported value for this parameter is 1
.
- Returns:
- On success, a JSON object of the account that was created.
- 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"
}
-
createIDSCUser
- Original method name:
createIDCSUser
- This POST method creates an Identity Cloud Service user in the tenancy specified by the URL in the
terraform.tfvars
file and assigns the user to the specified user group.
- Payload:
{
"userName": "userName value",
"firstName": "firstName value",
"lastName": "lastName value",
"email": "email value",
"groupName": "groupName value"
}
- Parameters:
userName: string
– The ID of the user.
firstName: string
– The first name of the user.
lastName: string
– The last name of the user.
email: string
– The email address of the user.
groupName: string
– The name of the Identity Cloud Service group to assign to the user.
- Return Value Example:
{
"status": "Success",
"msg": "User user1 is created and assigned to the group BOND_ADMIN"
}
-
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, the userId
parameter, the constant string ft
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, the userId
parameter, and the constant string nft
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 are nonfungible
and fungible
.
- 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": ""
}
-
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 the userId
parameter. 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.
- 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. This method can be called only by a
Token Admin
of the chaincode. This method throws an error if an accountStatus
value for the account is not found in the ledger.
- 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:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "deleted"
}
-
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 the Account 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.
tokenId?: string
– For a non-fungible token account, an empty string. For a fungible token account, the token ID.
- 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
}
-
getAccountBondSummary
- Original method name:
getAccountBondSummary
- This GET method returns an account summary for the specified user, including details of purchased or redeemed tokens and their purchase and redemption prices.
- 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 the token account summary.
- Return Value Example
[
{
"userAccountId":"ouaccount~df36ebaeb728c7768c0d5a3ecab435985c506ff57fd582212029b6f3c9cabf14",
"orgId":"BondMPTest",
"userId":"u10",
"accountSummary":[
{
"purchasedQuantity":1,
"assetType":"oUserBondDetails",
"id":"ouserbonddetails~ed3aaa9979bfe6302dcc83b1b903bd383fda60ff17747ca25af3369e26289747~bond1~op1",
"tokenId":"bond1",
"status":"Redeemed",
"purchasedAmount":11,
"purchasedDate":"2024-12-02T00:00:00.000Z",
"purchasedFromAccountId":"ouaccount~e76f696c0d6c626b24d35b3ac21de377a6da24c1bfdab1411f6702a507003a15",
"orderId":"op1"
"redeemPrice":11,
"quantityRedeem":1,
"redeemStatus":"REJECTED"
},
{
"purchasedQuantity":1,
"assetType":"oUserBondDetails",
"id":"ouserbonddetails~ed3aaa9979bfe6302dcc83b1b903bd383fda60ff17747ca25af3369e26289747~bond1~op2",
"tokenId":"bond1",
"status":"Purchased",
"purchasedAmount":11,
"purchasedDate":"2024-12-02T00:00:00.000Z",
"purchasedFromAccountId":"ouaccount~e76f696c0d6c626b24d35b3ac21de377a6da24c1bfdab1411f6702a507003a15",
"orderId":"op2",
"redeemPrice":11,
"quantityRedeem":1,
"redeemStatus":"APPROVED"
}
]
-
getAccountBondSummaryWithPagination
- Original method name:
getAccountBondSummaryWithPagination
- This GET method returns an account summary for the specified user, including details of purchased or redeemed tokens and their purchase and redemption prices. This method can return results with pagination based on pagesize and bookmark values, and also filtered by start time and end time.
- Query:
/getAccountBondSummary?orgId={{bc-org-id}}&userId={{bc-user-id}}&pageSize=1&bookmark={{bookmark}}
- 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.
pageSize: number
– The page size of the returned result.
bookmark: string
– The bookmark of the returned result.
- Returns:
- On success, a JSON object that includes the token account summary.
- Return Value Example
[
{
"userAccountId":"ouaccount~df36ebaeb728c7768c0d5a3ecab435985c506ff57fd582212029b6f3c9cabf14",
"orgId":"BondMPTest",
"userId":"u10",
"accountSummary":[
{
"purchasedQuantity":1,
"assetType":"oUserBondDetails",
"id":"ouserbonddetails~ed3aaa9979bfe6302dcc83b1b903bd383fda60ff17747ca25af3369e26289747~bond1~op1",
"tokenId":"bond1",
"status":"Redeemed",
"purchasedAmount":11,
"purchasedDate":"2024-12-02T00:00:00.000Z",
"purchasedFromAccountId":"ouaccount~e76f696c0d6c626b24d35b3ac21de377a6da24c1bfdab1411f6702a507003a15",
"orderId":"op1"
"redeemPrice":11,
"quantityRedeem":1,
"redeemStatus":"REJECTED"
},
{
"purchasedQuantity":1,
"assetType":"oUserBondDetails",
"id":"ouserbonddetails~ed3aaa9979bfe6302dcc83b1b903bd383fda60ff17747ca25af3369e26289747~bond1~op2",
"tokenId":"bond1",
"status":"Purchased",
"purchasedAmount":11,
"purchasedDate":"2024-12-02T00:00:00.000Z",
"purchasedFromAccountId":"ouaccount~e76f696c0d6c626b24d35b3ac21de377a6da24c1bfdab1411f6702a507003a15",
"orderId":"op2",
"redeemPrice":11,
"quantityRedeem":1,
"redeemStatus":"APPROVED"
}
]
-
getAccountDetailsByUser
- Original method name:
getAccountDetailsByUser
- This GET method returns an account summary for a specified user and details of fungible and non-fungible tokens that are associated with the user. This method can be called only by a
Token Admin
of the chaincode or the Account 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.
- Returns:
- On success, a JSON account object that includes and account summary for the specified user and details of fungible and non-fungible tokens that are associated with the user. For fractional non-fungible tokens, the
tokenShare
property in the associatedNFTs
section shows the share that the user owns.
- 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"
}
]
}
}
-
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",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "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",
"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"
}
}
]
-
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.
/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 GET method returns a list of all account IDs for a specified role and token.
- Query:
/getAccountsByRole?role=role value (for example minter / burner)&tokenDetail={"tokenName":"tokenName value"}
- Parameters:
role: string
– The name of the role to search for.
tokenDetail: JSON
– For fungible tokens, the token ID. For non-fungible tokens, the require token name.
- 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:
- Returns:
- On success, a JSON array of all accounts.
- Return Value Example:
[
{
"assetType": "ouaccount",
"accountId": "ouaccount~412de5e3998dcd100973e1bad6e8729fddc1c7ff610beab8376d733a35c51f38",
"userId": "user2",
"orgId": "appdev",
"totalAccounts": 2,
"totalFtAccounts": 1,
"associatedFtAccounts": [
{
"accountId": "oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e",
"tokenId": "loy1"
}
],
"associatedNftAccount": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371"
},
{
"assetType": "ouaccount",
"accountId": "ouaccount~9501bb774c156eb8354dfe489250ea91f757523d70f08ee494bda98bb352003b",
"userId": "user1_minter",
"orgId": "appdev",
"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 a Token Admin
of the chaincode.
- Query:
/getAllTokenAdmins
- Parameters:
- Returns:
- On success, an
admins
array in JSON format that contains orgId
and userId
objects.
- Return Value Example:
{
"admins": [
{
"orgId": "appdev",
"userId": "user2"
},
{
"orgId": "appdev",
"userId": "user1"
}
]
}
-
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 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.
/getAllTokens
- Parameters:
- Returns:
- A list of all token assets in JSON format.
- 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:
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:
[{
"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"
}]
-
getAllTokensWithFilters
- Original method name:
getAllTokensWithFilters
- The admin can call this GET method to fetch all the tokens filtered by status.
- Query:
/getAllTokensWithFilters?status=status&pageSize=pageSize&bookmark=bookmark
- Parameters:
status: string
– The status of the token, which can either be CREATED
or POSTED
.
pageSize: number
– The page size of the returned result.
bookmark: string
– The bookmark of the returned result.
- 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"
}
]
-
getTokenApprovalRequestByUser
- Original method name:
getTokenApprovalRequestByUser
- Any account holder can call this GET method to get the details of all the token approval requests (redemption requests) they have made.
- Query:
/getTokenApprovalRequestByUser?status=status value
- Parameters:
status: string
– The status of the request, which can be PENDING
, REJECTED
, or APPROVED
.
- Return Value Example:
[
{
"tokenName":"bond",
"assetType":"otokenApproval",
"id":"otokenApproval~5b2a94283ae95e3d6e5b76ffd6f75b7bff231e4df270a82cdc1f6badd17dea4b",
"settlementId":"op1",
"userBondDetailsId":"ouserbonddetails~ed3aaa9979bfe6302dcc83b1b903bd383fda60ff17747ca25af3369e26289747~bond1~op1",
"fromAccountId":"ouaccount~df36ebaeb728c7768c0d5a3ecab435985c506ff57fd582212029b6f3c9cabf14",
"toAccountId":"ouaccount~e76f696c0d6c626b24d35b3ac21de377a6da24c1bfdab1411f6702a507003a15",
"tokenId":"bond1",
"quantity":2,
"status":"APPROVED",
"orderId":"op1",
"redeemPrice":1,
"purchasedPrice":11,
"interestEarned":0
},
{
"tokenName":"bond",
"assetType":"otokenApproval",
"id":"otokenApproval~fdf28b2d271ac9c0fbd94a2dedbf365728c77795f3e931e5a4a2dcf48039a989",
"settlementId":"op3",
"userBondDetailsId":"ouserbonddetails~ed3aaa9979bfe6302dcc83b1b903bd383fda60ff17747ca25af3369e26289747~bond1~op3",
"fromAccountId":"ouaccount~df36ebaeb728c7768c0d5a3ecab435985c506ff57fd582212029b6f3c9cabf14",
"toAccountId":"ouaccount~e76f696c0d6c626b24d35b3ac21de377a6da24c1bfdab1411f6702a507003a15",
"tokenId":"bond1",
"quantity":1,
"status":"APPROVED",
"orderId":"op3",
"redeemPrice":11,
"purchasedPrice":11,
"interestEarned":0
}
]
-
getTokenApprovalRequestForUserByStatus
- Original method name:
getTokenApprovalRequestByUser
- Any account holder can call this GET method to get the details of all the token approval requests (redemption requests) they have made.
- Query:
/getTokenApprovalRequestForUserByStatus?status=status value
- Parameters:
status: string
– The status of the request, which can be PENDING
, REJECTED
, or APPROVED
.
- Return Value Example:
[
{
"tokenName":"bond",
"assetType":"otokenApproval",
"id":"otokenApproval~5b2a94283ae95e3d6e5b76ffd6f75b7bff231e4df270a82cdc1f6badd17dea4b",
"settlementId":"op1",
"userBondDetailsId":"ouserbonddetails~ed3aaa9979bfe6302dcc83b1b903bd383fda60ff17747ca25af3369e26289747~bond1~op1",
"fromAccountId":"ouaccount~df36ebaeb728c7768c0d5a3ecab435985c506ff57fd582212029b6f3c9cabf14",
"toAccountId":"ouaccount~e76f696c0d6c626b24d35b3ac21de377a6da24c1bfdab1411f6702a507003a15",
"tokenId":"bond1",
"quantity":2,
"status":"APPROVED",
"orderId":"op1",
"redeemPrice":1,
"purchasedPrice":11,
"interestEarned":0
},
{
"tokenName":"bond",
"assetType":"otokenApproval",
"id":"otokenApproval~fdf28b2d271ac9c0fbd94a2dedbf365728c77795f3e931e5a4a2dcf48039a989",
"settlementId":"op3",
"userBondDetailsId":"ouserbonddetails~ed3aaa9979bfe6302dcc83b1b903bd383fda60ff17747ca25af3369e26289747~bond1~op3",
"fromAccountId":"ouaccount~df36ebaeb728c7768c0d5a3ecab435985c506ff57fd582212029b6f3c9cabf14",
"toAccountId":"ouaccount~e76f696c0d6c626b24d35b3ac21de377a6da24c1bfdab1411f6702a507003a15",
"tokenId":"bond1",
"quantity":1,
"status":"APPROVED",
"orderId":"op3",
"redeemPrice":11,
"purchasedPrice":11,
"interestEarned":0
}
]
-
getTokenById
- Original method name:
getTokenById
- This GET method returns a token object if the token is present in the state database. For fractional NFTs, the list of owners is also returned. This method can be called only by a
Token Admin
of 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:
[{
"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"
}
]
-
getTokenHistory
- Original method name:
getTokenHistory
- This GET method returns the history for a specified token ID.
- Query:
/getTokenHistory?tokenId={{bc-token-id}}
- Parameters:
tokenId: string
– The ID of the token.
- Returns:
- On success, a JSON array that contains the token history.
- 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"
}
]
-
getUsersByRole
- Original method name:
getUsersByRole
- This method returns a list of all users for a specified role and token. This method can be called only by a
Token Admin
of the chaincode.
- 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: JSON
– For fungible tokens, the token ID. For non-fungible tokens, the require token name.
- 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 instantiated. Every
Token Admin
is identified by the userId
and orgId
information in the adminList
parameter. The userId
is the user name or email ID of the instance owner or the user who is logged in to the instance. The orgId
is the membership service provider (MSP) ID of the user in the current network organization. The adminList
parameter is mandatory the first time you deploy the chaincode. If you are upgrading the chaincode, pass an empty list ([]
). If you are the user who initially deployed the chaincode, you can also specify new admins in the adminList
parameter when you are upgrading the chaincode. Any other information in the adminList
parameter is ignored during upgrades.
- Payload:
{
"adminList": "[{\"orgId\":\"{{bc-org-id}}\",\"userId\":\"{{bc-user-id}}\"}]"
}
- Parameters:
adminList array
– An array of {orgId, userId}
information that specifies the list of token admins. The adminList
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. Non-fungible tokens are specified by the token name. This method can be called only by a
Token Admin
of the chaincode or the Account Owner
of the account. The specified user must have a token account that is associated with the fungible token, or a non-fungible token account for NFT roles. The specified role must exist in the specification file for the token.
- Query:
/isInRole?orgId={{bc-org-id}}&userId={{bc-user-id}}&role=role value (for example minter / burner)&tokenDetail={"tokenName":"tokenName value"}
- Parameters:
- Return Value Example:
{
"result": true,
"msg": "Account Id oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: idcqa) has minter role"
}
-
isTokenAdmin
- Original method name:
isTokenAdmin
- This GET method returns the Boolean value
true
if the caller of the function is a Token Admin
, otherwise it returns false
. This method can be called only by a Token Admin
of the chaincode.
/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 a Token Admin
, otherwise it returns false
.
- 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.
- 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: appdev, User-Id: idcqa).",
"details": [
{
"msg": "Successfully minted 100 tokens of fractional tokenId: plot55 to Org-Id: appdev, User-Id: idcqa"
},
{
"msg": "Successfully minted 100 tokens of tokenId: loyalty to Token-Account-Id oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e"
}
]
}
-
ownerOf
- Original method name:
ownerOf
- This GET method returns the account ID, organization ID, and user 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.
- Return Value Example:
[
{
"accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
"orgId": "Org1MSP",
"userId": "admin"
},
{
"accountId": "oaccount~74108eca702bab6d8548e740254f2cc7955d886885251d52d065042172a59db0",
"orgId": "Org1MSP",
"userId": "user"
}
]
-
payInterest
- Original method name:
ownerOf
- This POST method can be called only by the token creator or admin to pay the interest earned on the bond token. This method can be called only if the interest frequency of the token is monthly, quarterly, or annually. Interest cannot be paid if the interest frequency is at maturity. Interest is calculated by the chaincode based on the coupon rate of the token. The purchase operation transfers CBDC tokens from the caller's account to the bond owner’s account. Because of this, this method must be run in the context of an atomic transaction. The method also verifies the transfer process, ensuring the appropriate CBDC chaincode is called with the correct
orgId
and userId
for the transfer. The orgId
and userId
must correspond to the token owner, and the CBDC token transfer value must be equal to the interest calculated by the bond chaincode.
- Payload:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"tokenId": "{{bc-token-id}}",
"orderId": "orderId value",
"CBDCTokenId": "CBDCTokenId value",
"CBDCFromOrgId": "CBDCFromOrgId value",
"CBDCFromUserId": "CBDCFromUserId value",
"CBDCQuantity": 0,
"CBDCRemark": "{\\\"category\\\":\\\"category value\\\",\\\"description\\\":\\\"description value\\\"}",
"endorsers": {{endorsers}}
}
- Parameters:
orgId: string
– The membership service provider (MSP) ID of the user.
userId: string
– The user name or email ID of the user.
tokenId: string
– The ID of the token.
orderId: string
– The order ID for the operation.
CBDCTokenId: string
– The ID of the token in the CBDC chaincode.
CBDCOrgId: string
– The MSP ID of the user in the CBDC chaincode.
CBDCUserId: string
– The user name or email ID of the user in the CBDC chaincode.
CBDCQuantity: string
– The quantity of tokens to transfer in the CBDC chaincode.
CBDCRemark: string
– A remark for the transfer in the CBDC chaincode, which must be in the format shown previously.
- Return Value Example:
{
"returnCode":"Success",
"error":"",
"result":{
"transactions":[
{
"channel":"test",
"chaincode":"BondMarketplace",
"txstatus":"Committed",
"prepare":{
"txid":"e969f962df5efda2ea6287380e308cc974efd79dfff3567840ed3844bf936160"
},
"commit":{
"txid":"5544e928d3242291fb39189e8329679a9c81d61d6f72db60ca89135cd20fffef"
},
"rollback":{
}
},
{
"channel":"cbdctest",
"chaincode":"cbdc",
"txstatus":"Committed",
"prepare":{
"txid":"1245885b1a0c7f12c41fa2f2905549b8a5f37ab3a5e094b9dca122cb0611a117"
},
"commit":{
"txid":"3c83e20c7d470cdc9c1b0e2e0ea8d9962d58ada8d1b8f0d2606c8aa1f0ae7741"
},
"rollback":{
}
}
],
"lrc":{
},
"globalStatus":"Success",
"globalTxid":"761bb7cc-1d66-4645-aeb2-50e4dbd23d83",
"txStartTime":"2024-12-05T12:01:21.881988035Z"
}
}
-
postBondToken
- Original method name:
postBondToken
- This POST method can be called only by a token creator. The method submits the bond token for listing in the marketplace. When a token is created, its status is initially set to
created
. This method updates the status to posted
. Users can run the getAllTokensWithFilter
method to retrieve all NFTs with a posted
status.
- Payload:
{
"tokenId": "{{bc-token-id}}",
"sameOrgEndorser": true
}
- Parameters:
tokenId: string
– The ID of the token to post.
- Return Value Example:
{
"isValid":true,
"payload":{
"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":"created"
},
"message":"Successfully updated asset with ID bond1"
}
-
purchaseBondToken
- Original method name:
purchaseBondToken
- This POST method can be called by any account holder to purchase a listed bond NFT. The purchase transfers the bond NFT from the creator's account to the caller's account, and transfers CBDC tokens from the caller's account to the creator's account. Because of this, the method must be run in the context of an atomic transaction. The method also verifies the transfer process, ensuring that the appropriate CBDC chaincode is called with the correct
orgId
and userId
for the transfer. The orgId
and userId
must correspond to the token creator, and the CBDC token transfer value must be equal to the face value of the bond token multiplied by the quantity being purchased.
- Payload:
{
"tokenId": "{{bc-token-id}}",
"quantity": 1,
"orderId": "orderId value",
"additionalFees": 1,
"CBDCTokenId": "CBDCTokenId value",
"CBDCFromOrgId": "CBDCFromOrgId value",
"CBDCFromUserId": "CBDCFromUserId value",
"CBDCQuantity": 0,
"CBDCRemark": "{\\\"category\\\":\\\"category value\\\",\\\"description\\\":\\\"description value\\\"}",
"endorsers": {{endorsers}}
}
- Parameters:
tokenId: string
– The ID of the token to purchase.
orgId: string
– The membership service provider (MSP) ID of the user.
userId: string
– The user name or email ID of the user.
settlementId: string
– The settlement ID for the operation.
CBDCTokenId: string
– The ID of the token in the CBDC chaincode.
CBDCOrgId: string
– The MSP ID of the user in the CBDC chaincode.
CBDCUserId: string
– The user name or email ID of the user in the CBDC chaincode.
CBDCQuantity: string
– The quantity of tokens to transfer in the CBDC chaincode.
CBDCRemark: string
– A remark for the transfer in the CBDC chaincode, which must be in the format shown previously.
- Return Value Example:
{
"returnCode":"Success",
"error":"",
"result":{
"transactions":[
{
"channel":"test",
"chaincode":"BondMarketplace",
"txstatus":"Committed",
"prepare":{
"txid":"e969f962df5efda2ea6287380e308cc974efd79dfff3567840ed3844bf936160"
},
"commit":{
"txid":"5544e928d3242291fb39189e8329679a9c81d61d6f72db60ca89135cd20fffef"
},
"rollback":{
}
},
{
"channel":"cbdctest",
"chaincode":"cbdc",
"txstatus":"Committed",
"prepare":{
"txid":"1245885b1a0c7f12c41fa2f2905549b8a5f37ab3a5e094b9dca122cb0611a117"
},
"commit":{
"txid":"3c83e20c7d470cdc9c1b0e2e0ea8d9962d58ada8d1b8f0d2606c8aa1f0ae7741"
},
"rollback":{
}
}
],
"lrc":{
},
"globalStatus":"Success",
"globalTxid":"761bb7cc-1d66-4645-aeb2-50e4dbd23d83",
"txStartTime":"2024-12-05T12:01:21.881988035Z"
}
}
-
rejectBondRedemption
- Original method name:
rejectBondRedemption
- The token creator can call this POST method to reject the redemption request. Token owners can raise a redemption request again by using a different settlement ID.
- Payload:
{
"fromOrgId": "fromOrgId value",
"fromUserId": "fromUserId value",
"settlementId": "settlementId value",
"tokenId": "{{bc-token-id}}",
"endorsers": {{endorsers}}
}
- Parameters:
fromOrgId: string
– The membership service provider (MSP) ID of the user.
fromUserId: string
– The user name or email ID of the user.
settlementId: string
– The settlement ID for the redemption operation.
tokenId: string
– The ID of the token.
- Return Value Example:
{
"status":"success",
"msg":"Successfully rejected the token approval request"
}
-
removeRole
- Original method name:
removeRole
- This POST method removes a role from a specified user and token. Fungible tokens are specified by the token ID. Non-fungible tokens are specified by the token name. This method can be called only by a
Token Admin
of the chaincode.
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"role": "role value (for example minter / burner)",
"tokenDetail": "{\"tokenName\":\"tokenName value\"}",
"endorsers": {{endorsers}}
}
- Parameters:
- 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 a Token Admin
of the chaincode. You cannot remove yourself as a Token Admin
.
- 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.
- Returns:
- On success, a message that includes details of the user who was removed as a
Token Admin
of the chaincode.
- Return Value Example:
{"msg": "Successfully removed Admin (OrgId: appDev, UserId: user1)"}
-
requestBondRedemption
- Original method name:
requestBondRedemption
- This POST method can be called only by the token owner to raise a request for the redemption of bond tokens after maturity. This method is also involved the calculation of the redemption price by the chaincode. Redemption requests can be raised only on the entire quantity of the bond token that the user owns. Users can raise multiple redemption requests based on different settlement IDs but only one can be approved by the token creator.
- Payload:
{
"settlementId": "settlementId value",
"tokenId": "{{bc-token-id}}",
"orderId": "orderId value",
"additionalFees": 1,
"endorsers": {{endorsers}}
}
- Parameters:
settlementId: string
– The settlement ID for the redemption operation.
tokenId: string
– The ID of the token.
orderId: string
– The order ID for the purchase operation.
additionalFees: number
– The additional fees to add to the redemption price.
- Return Value Example:
{
"tokenName":"bond",
"assetType":"otokenApproval",
"id":"otokenApproval~9e006057ac96ae997e3964531b1a08ad2316555701c7fe9ec7b88e38e20892bf",
"settlementId":"op4",
"userBondDetailsId":"ouserbonddetails~ed3aaa9979bfe6302dcc83b1b903bd383fda60ff17747ca25af3369e26289747~bond1~op4",
"fromAccountId":"ouaccount~df36ebaeb728c7768c0d5a3ecab435985c506ff57fd582212029b6f3c9cabf14",
"toAccountId":"ouaccount~e76f696c0d6c626b24d35b3ac21de377a6da24c1bfdab1411f6702a507003a15",
"tokenId":"bond1",
"quantity":1,
"status":"PENDING",
"orderId":"op4",
"redeemPrice":11
}
-
safeBatchTransferFrom
- Original method name:
safeBatchTransferFrom
- This POST method completes a batch operation that transfers tokens specified in a list of token IDs from one user to another user.
For NFTs, because the method transfers ownership of the NFT, the sender of the NFT must own the token.
For fractional NFTs, if a user (including the creator of the token) transfers all of the shares that they own, then they lose ownership of the token. If any share of a token is transferred to a user, that user automatically becomes one of the owners of the fractional NFT.
The caller of the method must be the specified sender.
{
"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[]
– 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.
- 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: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
},
{
"msg": "Successfully transferred 10 FT token: 'FT' from Account-Id: oaccount~21206f309941a2a23c4f158a0fe1b8f12bb8e2b0c9a2e1358f5efebc0c7d410e (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~1089ee5122f367ee0ca38c6660298f4b81f199627e4f67f3691c0f628237974c (Org-Id: appdev, User-Id: user1_minter)"
},
{
"msg": "Successfully transferred NFT token: 'NFT' from Account-Id: oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371 (Org-Id: appdev, User-Id: idcqa) to Account-Id: oaccount~dcee860665db8740cb77b846e823752185a1e9a185814d0acb305890f5903446 (Org-Id: appdev, User-Id: user1_minter)"
}
]
-
suspendAccount
- Original method name:
suspendAccount
- This POST method suspends a token account. This method can be called only by a
Token Admin
of the chaincode. After an account is suspended, you cannot complete any operations that update the account. A deleted account cannot be suspended.
- 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:
{
"assetType": "oaccountStatus",
"statusId": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"accountId": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "suspended"
}
-
updateBondToken
- Original method name:
updateBondToken
- This POST method updates tokens. Every token that is defined has its own update method. You cannot update token metadata or the token URI of non-fungible tokens. This method can be called only by the token owner.
- 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. The properties of the asset are defined in the model file.
- Returns:
- On success, the updated token asset in JSON format.
- Return Value Example (Whole NFT
{
"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"
}
-
URI
- Original method name:
URI
- This method returns the URI of a specified token.
- Query:
/URI?tokenId={{bc-token-id}}
- Parameters:
tokenId: string
– The ID of the token.
- Return Value Example:
{
"tokenUri": "example.com"
}