-
activateAccount
- 原始方法名称:
activateAccount
- 此 POST 方法会激活令牌账户。此方法只能由管理员或账户所有者调用。对于在分类账中找不到
accountStatus
的现有账户,此方法返回状态设置为 active
的 accountStatus
对象。
- 有效负载:
{
"tokenId": "{{bc-token-id}}",
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"endorsers": {{endorsers}}
}
- 参数:
tokenId: string
- 令牌的 ID。
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回:
- 成功后,可替换令牌账户的更新账户状态对象的 JSON 表示形式。
- 返回值示例:
{
"assetType": "oaccountStatus",
"status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "active"
}
-
addTokenAdmin
- 原始方法名称:
addTokenAdmin
- 此 POST 方法将用户添加为链代码的
Token Admin
。此方法只能由链代码的 Token Admin
调用。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"endorsers": {{endorsers}}
}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回:
- 成功时,将出现一条消息,其中包含作为链代码的
Token Admin
添加的用户的详细信息。
- 返回值示例:
{
"msg": "Successfully added Admin (OrgId: appDev, UserId: user1)"
}
-
addRole
- 原始方法名称:
addRole
- 此 POST 方法将角色添加到指定的用户和令牌。此方法只能由链代码的
Token Admin
调用。tokenDetails 参数 Fungible 标记要求输入 tokenId
值。不可替代的令牌需要 tokenName 作为输入,以实现我们使用 tokenDetail 参数以不同的方式指定可替代和非可替代令牌的详细信息。
- 有效负载:
{
"tokenId": "{{bc-token-id}}",
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"role": "role minter/burner"
"tokenDetails": "{"tokenName": "token name value"}"
"endorsers": {{endorsers}}
}
- 参数:
- 返回值示例:
{
"msg": "Successfully added role 'minter' to Account Id: oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a
(Org-Id: appdev, User-Id: user2)"
}
-
associateFungibleTokenToAccount
- 原始方法名称:
associateFungibleTokenToAccount
- 此 POST 方法将用户的可替换令牌帐户与指定的令牌关联。
- 有效负载:
{
"tokenId": "{{bc-token-id}}",
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"endorsers": {{endorsers}}
}
- 参数:
tokenId: string
- 令牌的 ID。
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回值示例:
{
"assetType": "ouaccount",
"accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
"userId": "user2",
"orgId": "appdev",
"totalAccounts": 1,
"totalFtAccounts": 1,
"associatedFtAccounts": [
{
"accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
"tokenId": "tokenOne"
}
],
"associatedNftAccount": ""
}
-
buyWithEthCoin
- 原始方法名称:
buyWithEthCoin
- 任何账户所有者都可以使用这种 POST 方法使用以太坊购买 NFT,并将忠诚度代币作为奖励点。
- 有效负载:
{
"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"}}
}
- 参数:
fromOrgId: string
—当前组织中发件人(所有者)的成员服务提供商 (MSP) ID。
fromUserId: string
—发件人(所有者)的用户名或电子邮件 ID。
toOrgId: string
—当前组织中接收方的成员服务提供商 (MSP) ID。
toUserId: string
- 接收者的用户名或电子邮件 ID。
nftId: string
- 要购买的令牌的 ID。
loyaltyId: string
- 表示忠诚度积分的可替换令牌的 ID。
ethQty: number
–以太坊代币的价格。
loyaltyRewardQuantity: string
—要转移的忠诚度积分的数量。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回值示例:
{
"msg": "Token ID : 'artcollection1' has been successfully transferred to UserID : 'user1'"
}
-
balanceOfBatch
- 原始方法名称:
balanceOfBatch
- 此 GET 方法完成获取令牌账户余额的批处理操作。此方法只能由链代码的
Token Admin
或账户所有者调用。
- 查询:
/balanceOfBatch?orgIds=["{{bc-org-id}}"]&userIds=["{{bc-user-id}}"]&tokenIds=["{{bc-token-id}}"]
- 参数:
orgIds: string[]
—当前组织中的成员服务提供商 (Member Service Provider,MSP) ID 列表。
userIds: string[]
- 用户名或电子邮件 ID 的列表。
tokenIds: string[]
- 令牌 ID 的列表。
- 返回值示例:
[
{
"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
- 原始方法名称:
batchTransferFrom
- 此 POST 方法完成一个批处理操作,将标记 ID 列表中指定的标记从一个用户转移到另一个用户。任何用户都可以调用此方法。
- 有效负载:
{
"fromOrgId": "fromOrgId value",
"fromUserId": "fromUserId value",
"toOrgId": "toOrgId value",
"toUserId": "toUserId value",
"tokenIds": "[\"{{bc-token-id}}\"]",
"quantity": "[quantity value]",
"endorsers": {{endorsers}}
}
- 参数:
fromOrgId: string
—发件人的成员服务提供商 (MSP) ID。
fromUserId: string
—发送方的用户 ID。
toOrgId: string
- 接收方的成员服务提供商 (MSP) ID。
toUserId: string
- 接收方的用户 ID。
tokenIds: string[]
- 要传输的令牌的令牌 ID 列表。
quantity: number[]
- 要传输的令牌数量列表,对应于令牌 ID 数组。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回:
- 成功时,将显示一条消息,其中包含每个令牌传输的详细信息。
- 返回值示例:
[
{
"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
- 原始方法名称:
burnBatch
- 此 POST 方法会停用或刻录指定的可替代和非可替换标记。具有燃烧器角色的任何用户都可以调用此方法。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"tokenIds": "[\"{{bc-token-id}}\"]",
"quantity": "[quantity value]",
"sameOrgEndorser": true
}
- 参数:
orgId: string
—当前组织中的成员服务提供商 (MSP) ID。
userId: string
- 用户名或电子邮件 ID。
tokenIds: string[]
- 要刻录的标记 ID 的列表
quantity: number[]
- 要刻录的令牌数量列表,对应于令牌 ID 数组。
sameOrgEndorser: boolean
—一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回:
- 成功后,将显示一条消息,其中包含有关烧伤操作的详细信息。
- 返回值示例:
[
{
"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
- 原始方法名称:
burnNFT
- 此 POST 方法会停用或刻录指定的不可替换标记,并返回标记对象和标记历史记录。具有燃烧器角色的任何用户都可以调用此方法。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"tokenId": "{{bc-token-id}}",
"sameOrgEndorser": true
}
- 参数:
orgId: string
—当前组织中的成员服务提供商 (MSP) ID。
userId: string
- 用户名或电子邮件 ID。
tokenId: string
- 要刻录的非同质标记的 ID
sameOrgEndorser: boolean
—一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回:
- 成功时,包含有关刻录操作的消息的 JSON 数组。
- 返回值示例:
{
"msg": "Successfully burned NFT token: 'art' from Account-Id: oaccount~76cb672eeb1bd535899562a840d0c15a356db89e24bc8b43ac1dba845a4282c6 (Org-Id: appdev, User-Id: user2)"
}
-
createAccount
- 原始方法名称:
createAccount
- 此 POST 方法为指定用户和关联的令牌账户创建可替换或不可替换令牌的账户。必须为在任何时候都具有令牌的任何用户创建账户。用户帐户跟踪 NFT 帐户和用户持有的可替换令牌帐户。用户必须在网络中有账户才能完成与令牌相关的操作。此方法只能由链代码的
Token Admin
调用。
用户帐户具有唯一 ID,该 ID 由 orgId
参数和 userId
参数的 SHA-256 散列组成。
用户可以具有多个具有唯一账户 ID 的可互换令牌账户。可替换标记帐户 ID 由 orgId
参数的 SHA-256 散列、userId
参数、由波浪号 (~
) 分隔的常量字符串 ft
以及表示由波浪号 (~
) 分隔的可替换帐户的索引的计数器编号构成。
一个用户只能有一个不可替换的令牌账户。不可替代的令牌帐户 ID 是唯一的,由 orgId
参数的 SHA-256 散列、userId
参数以及用波浪号 (~
) 分隔的常量字符串 nft
构成。用户拥有的所有非同质代币(无论是整体代币还是小数代币)都链接到此账户。
用户帐户 ID 以 ouaccount~
开头。标记账户 ID 以 oaccount~
开头。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"ftAccount": true,
"nftAccount": true,
"endorsers": {{endorsers}}
}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
ftAccount: boolean
- 如果为 true,将创建可替换令牌账户并将其与用户账户关联。
nftAccount: boolean
- 如果为 true,将创建不可替换的令牌账户并将其与用户账户关联。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回值示例:
{
"assetType": "ouaccount",
"accountId": "ouaccount~cf20877546f52687f387e7c91d88b9722c97e1a456cc0484f40c747f7804feae",
"userId": "user1",
"orgId": "appdev",
"totalAccounts": 2,
"totalFtAccounts": 1,
"associatedFtAccounts": [
{
"accountId": "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b",
"tokenId": ""
}
],
"associatedNftAccount": "oaccount~73c3e835dac6d0a56ca9d8def08269f83cefd59b9d297fe2cdc5a9083828fa58"
}
-
createArtCollectionToken
- 原始方法名称:
createArtCollectionToken
- 此 POST 方法创建 (mint) NFT。资产和关联的属性保存在状态数据库中。此事务处理的调用方必须具有令牌账户。此事务处理的调用方将成为 NFT 的所有者。如果令牌规范文件包括
behaviors
的 roles
部分和 roles
的 minter_role_name
属性,则事务处理的调用方必须具有 minter 角色。否则,任何调用方都可以 mint NFT。
- 有效负载:
{
"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
}
- 参数:
tokenAsset: <Token Class>
—要铸币的令牌资产。有关令牌资产属性的更多信息,请参见输入规范文件。
quantity: number
- 要铸币的标记数。此参数唯一支持的值是 1
。
sameOrgEndorser: boolean
—一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回值示例:
{
"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
- 原始方法名称:
createLoyaltyToken
- 此 POST 方法创建令牌。定义的每个标记都有自己的 create 方法。此方法只能由链代码的
Token Admin
调用。
- 有效负载:
{
"tokenAsset": "{\"tokenId\":\"{{bc-token-id}}\",\"tokenDesc\":\"tokenDesc value\",\"Token_Name\":\"Token_Name value\",\"Token_to_Currency_Ratio\":999}",
"sameOrgEndorser": true
}
- 参数:
tokenAsset: <Token Class>
- 令牌资产。资产的属性在模型文件中定义。
sameOrgEndorser: boolean
—一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回值示例:
{
"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
- 原始方法名称:
createTokenAccount
- 此 POST 方法创建可替换或不可替换的令牌帐户以与用户帐户关联。
用户可以具有多个具有唯一账户 ID 的可互换令牌账户。可替换标记帐户 ID 由 orgId
参数的 SHA-256 散列、userId
参数、由波浪号 (~
) 分隔的常量字符串 ft
以及表示由波浪号 (~
) 分隔的可替换帐户的索引的计数器编号构成。
一个用户只能有一个不可替换的令牌账户。不可替代的令牌帐户 ID 是唯一的,由 orgId
参数的 SHA-256 散列、userId
参数以及用波浪号 (~
) 分隔的常量字符串 nft
构成。用户拥有的所有非同质代币(无论是整体代币还是小数代币)都链接到此账户。
此方法只能由链代码的 Token Admin
调用。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"tokenType": "nonfungible",
"endorsers": {{endorsers}}
}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
tokenType: TokenType
- 要创建的令牌账户的类型。唯一支持的标记类型是 nonfungible
和 fungible
。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回:
- 返回值示例:
{
"assetType": "ouaccount",
"accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
"userId": "user2",
"orgId": "appdev",
"totalAccounts": 1,
"totalFtAccounts": 1,
"associatedFtAccounts": [
{
"accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
"tokenId": ""
}
],
"associatedNftAccount": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a"
}
-
createUserAccount
- 原始方法名称:
createUserAccount
- 此 POST 方法为指定的用户创建帐户。必须为在任何时候都具有令牌的任何用户创建账户。用户帐户跟踪 NFT 帐户和用户具有的可替换令牌帐户。用户必须在网络中有账户才能完成与令牌相关的操作。
帐户 ID 是 orgId
参数和 userId
参数的 SHA-256 散列。此方法只能由链代码的 Token Admin
调用。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"endorsers": {{endorsers}}
}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回:
- 返回值示例:
{
"assetType": "ouaccount",
"accountId": "ouaccount~24ffd4d32a028a85b4b960f5d55536c837b5429bc7f346150adfa904ec2937cc",
"userId": "user2",
"orgId": "appdev",
"totalAccounts": 0,
"totalFtAccounts": 0,
"associatedFtAccounts": [],
"associatedNftAccount": ""
}
-
deleteAccount
- 原始方法名称:
deleteAccount
- 此 POST 方法删除令牌账户。账户被删除后,账户处于最终状态,无法更新或更改为任何其他状态。要删除帐户,帐户余额必须为零。此方法只能由链代码的
Token Admin
调用。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"endorsers": {{endorsers}}
}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回:
- 返回值示例:
{
"assetType": "oaccountStatus",
"status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "deleted"
}
-
exchangeToken
- 原始方法名称:
exchangeToken
- 此方法在指定帐户之间交换令牌。此方法仅支持在 NFT 和可互换令牌或可互换令牌与 NFT 之间进行交换。NFT 可以是整数或小数。此方法只能由账户所有者调用。
- 有效负载:
{
"fromTokenId": "fromTokenId value",
"fromOrgId": "fromOrgId value",
"fromUserId": "fromUserId value",
"fromTokenQuantity": 1,
"toTokenId": "toTokenId value",
"toOrgId": "toOrgId value",
"toUserId": "toUserId value",
"toTokenQuantity": 1,
"endorsers": {{endorsers}}
}
- 参数:
fromTokenId: string
—发件人拥有的令牌的 ID。
fromOrgId: string
—当前组织中发件人的成员服务提供商 (MSP) ID。
fromUserId: string
—发件人的用户名或电子邮件 ID。
fromTokenQuantity: number
—发件人与接收者交换的令牌数量。
toTokenId: string
- 接收方拥有的标记的 ID。
toOrgId: string
—当前组织中接收方的成员服务提供商 (MSP) ID。
toUserId: string
- 接收者的用户名或电子邮件 ID。
toTokenQuantity: number
—接收方与发送方交换的令牌数量。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回:
- 返回值示例:
{
"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
- 原始方法名称:
getAccount
- 此 GET 方法返回指定用户的令牌账户详细信息。此方法只能由链代码的
Token Admin
或帐户的 Account Owner
调用。
- 查询:
/getAccount?orgId={{bc-org-id}}&userId={{bc-user-id}}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
- 返回:
- 返回值示例
{
"assetType": "oaccount",
"accountId": "oaccount~e88276a3be547e31b567346bdddde52d37734da4d5fae83ab2e5c98a10097371",
"userId": "user2",
"orgId": "AppBldFFFFMay22",
"tokenType": "nonfungible",
"noOfNfts": 3
}
-
getAccountDetailsByUser
- 原始方法名称:
getAccountDetailsByUser
- 此 GET 方法返回指定用户的帐户详细信息。此方法只能由链代码的
Token Admin
或帐户的 Account Owner
调用。
- 查询:
/getAccountDetailsByUser?orgId={{bc-org-id}}&userId={{bc-user-id}}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
- 返回值示例:
{
"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
- 原始方法名称:
getAccountHistory
- 此 GET 方法返回指定令牌账户的账户历史记录。对于 NFT 账户,
tokenId
参数必须为空。此方法只能由链代码的 Token Admin
或账户所有者调用。
- 查询:
/getAccountHistory?orgId={{bc-org-id}}&userId={{bc-user-id}}&tokenId={{bc-token-id}}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
tokenId: string
- 可替换令牌的 ID。
- 返回值示例:
[
{
"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
- 原始方法名称:
getAccountStatus
- 此 GET 方法检索令牌账户的当前状态。此方法可由链代码的
Token Admin
或令牌账户所有者调用。
- 查询:
/getAccountStatus?orgId={{bc-org-id}}&userId={{bc-user-id}}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
- 返回:
- 返回值示例:
{
"assetType": "oaccountStatus",
"status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "active"
}
-
getAccountStatusHistory
- 原始方法名称:
getAccountStatusHistory
- 此 GET 方法检索帐户状态的历史记录。此方法可由链代码的
Token Admin
或令牌账户所有者调用。
- 查询:
/getAccountStatusHistory?orgId={{bc-org-id}}&userId={{bc-user-id}}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
- 返回:
- 返回值示例:
[
{
"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
- 原始方法名称:
getAccountTransactionHistory
- 此 GET 方法返回账户事务处理历史记录。此方法只能由链代码的
Token Admin
或账户所有者调用。
- 查询:
/getAccountTransactionHistory?orgId={{bc-org-id}}&userId={{bc-user-id}}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
- 返回值示例:
[
{
"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
- 原始方法名称:
getAccountsByRole
- 此方法返回指定角色的所有帐户 ID 的列表。此方法只能由链代码的
Token Admin
调用。
- 查询:
/getAccountsByRole?role=role value (for example minter / burner)&tokenDetail={"tokenName":"tokenName value"}
- 参数:
- 返回值示例:
{
"accounts": [
"oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
"oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b"
]
}
-
getAllAccounts
- 原始方法名称:
getAllAccounts
- 此 GET 方法返回所有用户帐户的详细信息。此方法只能由链代码的
Token Admin
调用。
- 查询:
/getAllAccounts
- 参数:
- 返回:
- 成功后,将生成一个包含所有账户的 JSON 数组。
- 返回值示例:
[
{
"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
- 原始方法名称:
getAllTokenAdmins
- 此 GET 方法返回链代码
Token Admin
的所有用户的列表。此方法只能由链代码的 Token Admin
调用。
- 查询:
/getAllTokenAdmins
- 参数:
- 返回:
- 成功后,使用 JSON 格式的
admins
数组,其中包含 orgId
和 userId
对象。
- 返回值示例:
{
"admins": [
{
"orgId": "appdev",
"userId": "user2"
},
{
"orgId": "appdev",
"userId": "user1"
}
]
}
-
getAllTokens
- 原始方法名称:
getAllTokens
- 此 GET 方法返回保存在状态数据库中的所有标记资产。此方法只能由链代码的
Token Admin
调用。此方法使用 Berkeley DB SQL 丰富的查询,并且只能在连接到远程 Oracle Blockchain Platform 网络时调用。
- 查询:
/getAllTokens
- 参数:
- 返回值示例:
[{
"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
- 原始方法名称:
getAllTokensByUser
- 此 GET 方法返回指定用户拥有的所有令牌资产。此方法使用 Berkeley DB SQL 丰富的查询,并且只能在连接到远程 Oracle Blockchain Platform 网络时调用。此方法只能由链代码的
Token Admin
或账户所有者调用。
- 查询:
/getAllTokensByUser?orgId={{bc-org-id}}&userId={{bc-user-id}}
- 参数:
org_id: string
—当前组织中用户的成员服务提供商 (MSP) ID。
user_id: string
- 用户的用户名或电子邮件 ID。
- 返回值示例:
[{
"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
- 原始方法名称:
getTokenById
- 如果标记存在于状态数据库中,则此 GET 方法将返回标记对象。此方法只能由链代码的
Token Admin
或令牌所有者调用。对于小数 NFT,响应包括令牌所有者的列表。
- 查询:
/getTokenById?tokenId={{bc-token-id}}
- 参数:
tokenId: string
- 要获取的令牌的 ID。
- 返回值示例:
[{
"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
- 原始方法名称:
getTokenDecimal
- 此方法返回指定标记的小数位数。此方法只能由链代码的
Token Admin
调用。
- 查询:
/getTokenDecimal?tokenId={{bc-token-id}}
- 参数:
- 返回值示例:
{
"msg": "Token Id: tokenOne has 2 decimal places."
}
-
getTokenHistory
- 原始方法名称:
getTokenHistory
- 此 GET 方法返回指定令牌 ID 的历史记录。任何人都可以调用此方法。
/getTokenHistory?tokenId={{bc-token-id}}
- 参数:
- 返回值示例:
[{
"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
- 原始方法名称:
getTokensByName
- 此 GET 方法返回指定令牌名称的所有令牌资产。此方法使用 Berkeley DB SQL 丰富的查询,并且只能在连接到远程 Oracle Blockchain Platform 网络时调用。此方法只能由链代码的
Token Admin
调用。
- 查询:
/getTokensByName?tokenName=tokenName value
- 参数:
tokenName: string
- 令牌的名称。
- 返回值示例:
[
{
"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
- 原始方法名称:
getTransactionById
- 此 GET 方法返回指定事务处理 ID 的事务处理历史记录。这是异步方法。任何用户都可以调用此方法。
- 查询:
/getTransactionById?transactionId=transactionId value
- 参数:
transactionId: string
—事务处理的 ID,即前缀 otransaction~
,后跟十六进制格式的 64 位散列。
- 返回值示例:
{
"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
- 原始方法名称:
getUserByAccountId
- 此 GET 方法返回指定帐户 ID 的组织 ID 和用户 ID。
- 查询:
/getUserByAccountId?accountId=accountId value
- 参数:
accountId: string
–帐户的 ID。
- 返回值示例:
{
"orgId": "AppBldFFFFMay22",
"userId": "user2"
}
-
getUsersByRole
- 原始方法名称:
getUsersByRole
- 此 GET 方法返回指定角色的所有用户的列表。
- 查询:
/getUsersByRole?role=role value (for example minter / burner)&tokenDetail={"tokenName":"tokenName value"}
- 参数:
- 返回值示例:
{
"users": [
{
"accountId": "oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a",
"orgId": "appdev",
"userId": "user2"
},
{
"accountId": "oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b",
"orgId": "appdev",
"userId": "user1"
}
]
}
-
init
- 原始方法名称:
init
- 此 POST 方法在部署链代码时调用。用户信息将保存为链代码的
Token Admin
。
- 有效负载:
{
"adminList": "[{\"orgId\":\"{{bc-org-id}}\",\"userId\":\"{{bc-user-id}}\"}]"
}
- 参数:
adminList array
- 由 {user_id, org_id}
信息组成的数组,用于指定令牌管理员列表。adminList
数组是必需参数。
- 返回:
- 返回值示例:
{
}
-
isInRole
- 原始方法名称:
isInRole
- 此 GET 方法返回布尔值以指示用户是否具有指定的角色。此方法只能由链代码的
Token Admin
或帐户的 Account Owner
调用。
- 查询:
/isInRole?orgId={{bc-org-id}}&userId={{bc-user-id}}&role=role value (for example minter / burner)&tokenDetail={"tokenName":"tokenName value"}
- 参数:
- 返回值示例:
{
"result": true,
"msg": "Account Id oaccount~1422a74d262a3a55a37cd9023ef8836f765d0be7b49d397696b9961d7434d22a (Org-Id: appdev, User-Id: user2) has minter role"
}
-
isTokenAdmin
- 原始方法名称:
isTokenAdmin
- 如果函数的调用方为
Token Admin
,则此 GET 方法返回布尔值 true
,否则返回 false
。此方法只能由链代码的 Token Admin
调用。
- 查询:
/isTokenAdmin?orgId={{bc-org-id}}&userId={{bc-user-id}}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
- 返回:
- 如果调用方为
Token Admin
,则方法返回 true
,否则返回 false
。
- 返回值示例:
{
"result": true
}
-
mintBatch
- 原始方法名称:
mintBatch
- 此 POST 方法在批处理操作中创建(铸造)多个标记。此方法仅创建可替换标记或小数非可替换标记。
对于可替换标记,如果在规范文件中定义了 minter 角色,则具有 minter 角色的任何用户都可以调用此方法。如果没有,任何用户都可以使用此方法来铸造标记。如果创建或更新令牌时指定了该属性,则不能超过该令牌的 max_mint_quantity
属性。
对于不可替换的标记,如果在规范文件中定义了 minter 角色,则具有 minter 角色的任何用户都可以调用此方法。如果没有,任何用户都可以使用此方法来铸造标记。此外,调用方还必须是令牌的创建者。对于可以铸造的小数非同质代币数量没有上限。
不能使用此方法铸造整个不可替换的标记。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"tokenIds": "[\"{{bc-token-id}}\"]",
"quantity": "[quantity value]",
"sameOrgEndorser": true
}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
tokenIds: string[]
- 用于 mint 令牌的令牌 ID 列表。
quantity: number[]
- 要 mint 的令牌数量列表,对应于令牌 ID 数组。
sameOrgEndorser: boolean
—一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回:
- 返回值示例:
{
"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
- 原始方法名称:
name
- 此 GET 方法返回令牌类的名称。任何人都可以调用此方法。
- 查询:
/name?tokenId={{bc-token-id}}
- 参数:
- 返回值示例:
{
"tokenName": "artcollection"
}
-
ownerOf
- 原始方法名称:
ownerOf
- 此 GET 方法返回指定令牌 ID 所有者的账户 ID。任何人都可以调用此方法。
- 查询:
/ownerOf?tokenId={{bc-token-id}}
- 参数:
- 返回:
- 返回值示例:
[
{
"accountId": "oaccount~42e89f4c72dfde9502814876423c6da630d466e87436dd1aae201d347ad1288d",
"orgId": "Org1MSP",
"userId": "admin"
},
{
"accountId": "oaccount~74108eca702bab6d8548e740254f2cc7955d886885251d52d065042172a59db0",
"orgId": "Org1MSP",
"userId": "user"
}
]
-
post
- 原始方法名称:
post
- 此 POST 方法为指定价格发布要销售的令牌。
- 有效负载:
{
"tokenId": "{{bc-token-id}}",
"sellingPrice": 1,
"endorsers": {{endorsers}}
}
- 参数:
tokenId: string
- 令牌的 ID。
sellingPrice: number
—令牌的价格。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回值示例:
{
"msg": "Token ID : 'artCollection1' has been posted for selling in the marketplace"
}
-
removeRole
- 原始方法名称:
removeRole
- 此方法将角色从指定用户中删除。此方法只能由链代码的
Token Admin
调用。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"role": "role value (for example minter / burner)",
"tokenDetail": "{\"tokenName\":\"tokenName value\"}",
"endorsers": {{endorsers}}
}
- 参数:
- 返回值示例:
{
"msg": "Successfully removed role 'minter' from Account Id: oaccount~60bb20c14a83f6e426e1437c479c5891e1c6477dfd7ad18b73acac5d80bc504b (Org-Id: appdev, User-Id: user1)"
}
-
removeTokenAdmin
- 原始方法名称:
removeTokenAdmin
- 此 POST 方法将用户删除为链代码的
Token Admin
。此方法只能由链代码的 Token Admin
调用。管理员无法自行删除。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"sameOrgEndorser": true
}
- 参数:
org_id: string
—当前组织中用户的成员服务提供商 (MSP) ID。
user_id: string
- 用户的用户名或电子邮件 ID。
sameOrgEndorser: boolean
—一个布尔值,指示事务处理背书是否必须来自与请求者相同的组织。
- 返回值示例:
{
"msg": "Successfully removed Admin (OrgId: appDev, UserId: user1)"
}
-
safeBatchTransferFrom
- 原始方法名称:
safeBatchTransferFrom
- 此 POST 方法将指定令牌的所有权从调用方转移到其他帐户。此方法的调用者必须是令牌的发送者,并且必须拥有指定的令牌。对于小数 NFT,如果用户将其所有共享资源传输给其他用户,则它们将失去令牌的所有权。
- 有效负载:
{
"fromOrgId": "fromOrgId value",
"fromUserId": "fromUserId value",
"toOrgId": "toOrgId value",
"toUserId": "toUserId value",
"tokenIds": "[\"{{bc-token-id}}\"]",
"quantity": "[quantity value]",
"endorsers": {{endorsers}}
}
- 参数:
fromOrgId: string
—当前组织中发件人和令牌所有者的成员服务提供商 (MSP) ID。
fromUserId: string
- 发件人和令牌所有者的用户名或电子邮件 ID。
toOrgId: string
—当前组织中接收方的成员服务提供商 (MSP) ID。
toUserId: string
- 接收者的用户名或电子邮件 ID。
tokenIds: string[]
—要传输的令牌的 ID 数组。
quantity: number[]
- 要传输的令牌数量列表,对应于令牌 ID 数组。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回值示例:
[
{
"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
- 原始方法名称:
suspendAccount
- 此 POST 方法将暂停可替换令牌账户。如果在分类账中未找到
accountStatus
值,则会引发错误。此方法只能由链代码的 Token Admin
调用。
- 有效负载:
{
"orgId": "{{bc-org-id}}",
"userId": "{{bc-user-id}}",
"endorsers": {{endorsers}}
}
- 参数:
orgId: string
—当前组织中用户的成员服务提供商 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回值示例:
{
"assetType": "oaccountStatus",
"status_id": "oaccountStatus~5a0b0d8b1c6433af9fedfe0d9e6580e7cf6b6bb62a0de6267aaf79f79d5e96d7",
"account_id": "oaccount~1c568151c4acbcd1bd265c766c677145760a61c47fc8a3ba681a4cfbe287f9c1",
"status": "suspended"
}
-
totalNetSupply
- 原始方法名称:
totalNetSupply
- 此 GET 方法返回铸造令牌总数减去已刻录令牌数。此方法只能由链代码的
Token Admin
调用。
- 查询(可替换令牌):
/totalNetSupply?tokenDetail={"tokenId":"{{bc-token-id}}"}
- 查询(非实物标记):
/totalNetSupply?tokenDetail={"tokenName":"tokenName value"}
- 参数:
- 返回值示例:
{
"totalNetSupply": 105
}
-
totalSupply
- 原始方法名称:
totalSupply
- 此 GET 方法返回铸造标记的总数。此方法只能由链代码的
Token Admin
调用。
- 查询(可替换令牌):
/totalSupply?tokenDetail={"tokenId":"{{bc-token-id}}"}
- 查询(非实物标记):
/totalSupply?tokenDetail={"tokenName":"tokenName value"}
- 参数:
- 返回值示例:
{
"totalSupply": 110
}
-
updateArtCollectionToken
- 原始方法名称:
updateArtCollectionToken
- 此 POST 方法更新标记属性。只有令牌所有者可以调用此方法。对于 NFT,标记元数据和标记 URI 在铸造标记后无法更新。
- 有效负载:
{
"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
}
- 参数:
tokenAsset: <Token Class>
—要更新的令牌资产。有关令牌资产属性的更多信息,请参见输入规范文件。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回值示例:
{
"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
- 原始方法名称:
updateLoyaltyToken
- 此 POST 方法更新标记属性。只有令牌所有者可以调用此方法。对于 NFT,标记元数据和标记 URI 在铸造标记后无法更新。
- 有效负载:
{
"tokenAsset": "{\"tokenId\":\"{{bc-token-id}}\",\"tokenDesc\":\"tokenDesc value\",\"Token_Name\":\"Token_Name value\",\"Token_to_Currency_Ratio\":999}",
"sameOrgEndorser": true
}
- 参数:
tokenAsset: <Token Class>
—要更新的令牌资产。有关令牌资产属性的更多信息,请参见输入规范文件。
endorsers: string[]
—必须为事务处理背书的对等方数组(例如 peer1
、peer2
)。
- 返回值示例:
{
"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
- 原始方法名称:
URI
- 此 GET 方法返回指定令牌的 URI。只有令牌创建者才能调用此方法。
- 查询
/URI?tokenId={{bc-token-id}}
- 参数:
- 返回值示例:
{
"tokenUri": "example.com"
}