-
LockNFT
- 此方法锁定指定的不可替换令牌。要锁定令牌,必须具有
TokenSys
vault
角色的用户充当 Vault 管理器。此方法只能由令牌的所有者调用。
-
func (t *Controller) LockNFT(orgId string, userId string, tokenId string) (interface{}, error) {
return t.Ctx.ERC1155Token.LockNFT(orgId, userId, tokenId)
}
- 参数:
orgId: string
- 当前组织中用户的成员服务提供者 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID(可选)。
tokenID: string
- 要锁定的令牌的 ID。
- 返回:
- 返回值示例:
{
"AssetType":"otoken",
"Behaviors":[
"indivisible",
"mintable",
"transferable",
"burnable",
"lockable",
"roles"
],
"CreatedBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"CreationDate":"2023-10-20T12:22:47Z",
"IsBurned":false,
"IsLocked":true,
"Mintable":{
"Max_mint_quantity":20000
},
"On_sale_flag":false,
"Owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"Price":120,
"Quantity":1,
"Roles":{
"minter_role_name":"minter"
},
"TokenDesc":"",
"TokenId":"token1",
"TokenMetadata":{
"Description":"",
"Image":"",
"Painter_name":"",
"Painting_name":""
},
"TokenName":"artcollection",
"TokenStandard":"erc1155+",
"TokenType":"nonfungible",
"TokenUnit":"whole",
"TokenUri":"token1.example.com"
}
-
IsNFTLocked
- 此方法返回布尔值以指示指定的标记是否已锁定。此方法只能由令牌所有者、 Vault 管理器(具有
TokenSys
vault
角色的用户)或链代码的 Token Admin
调用。
-
func (t *Controller) IsNFTLocked(tokenId string) (interface{}, error) {
auth, err := t.Ctx.ERC1155Auth.CheckAuthorization("ERC1155Token.IsNFTLocked", "TOKEN", map[string]string{"tokenId": tokenId})
if err != nil && !auth {
isCallerTokenSysRoleHolder, error := t.Ctx.ERC1155Token.IsCallerTokenSysRoleHolder(constants.Vault)
if error != nil {
return nil, error
}
if !isCallerTokenSysRoleHolder {
return nil, fmt.Errorf("error in authorizing the caller %s", err.Error())
}
}
return t.Ctx.ERC1155Token.IsNFTLocked(tokenId)
}
- 参数:
tokenID: string
- 标记的 ID。
- 返回:
- 返回值示例:
{
"isNFTLocked":true
}
-
GetAllLockedNFTs
- 此方法返回所有锁定的不可替代标记的列表。此方法只能由 Vault 管理器(具有
TokenSys
vault
角色的用户)或链代码的 Token Admin
调用。
-
func (t *Controller) GetAllLockedNFTs() (interface{}, error) {
auth, err := t.Ctx.ERC1155Auth.CheckAuthorization("ERC1155Token.GetAllLockedNFTs", "TOKEN")
if err != nil && !auth {
isCallerTokenSysRoleHolder, error := t.Ctx.ERC1155Token.IsCallerTokenSysRoleHolder(constants.Vault)
if error != nil {
return nil, error
}
if !isCallerTokenSysRoleHolder {
return nil, fmt.Errorf("error in authorizing the caller %s", err.Error())
}
}
return t.Ctx.ERC1155Token.GetAllLockedNFTs()
}
- 参数:
- 返回:
- 返回值示例:
[
{
"key":"token1",
"valueJson":{
"AssetType":"otoken",
"Behaviors":[
"indivisible",
"mintable",
"transferable",
"burnable",
"lockable",
"roles"
],
"CreatedBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"CreationDate":"2023-10-20T12:22:47Z",
"IsBurned":false,
"IsLocked":true,
"Mintable":{
"Max_mint_quantity":20000
},
"On_sale_flag":false,
"Owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"Price":120,
"Quantity":1,
"Roles":{
"minter_role_name":"minter"
},
"TokenDesc":"",
"TokenId":"token1",
"TokenMetadata":{
"Description":"",
"Image":"",
"Painter_name":"",
"Painting_name":""
},
"TokenName":"artcollection",
"TokenStandard":"erc1155+",
"TokenType":"nonfungible",
"TokenUnit":"whole",
"TokenUri":"token1.example.com"
}
}
]
-
GetAllLockedNFTsByOrg
- 此方法返回指定组织和(可选)指定用户的所有锁定的不可替代标记的列表。此方法只能由 Vault 管理器(具有
TokenSys
vault
角色的用户)或链代码的 Token Admin
调用。
-
func (t *Controller) GetLockedNFTsByOrg(orgId string, userId ...string) (interface{}, error) {
auth, err := t.Ctx.ERC1155Auth.CheckAuthorization("ERC1155Token.GetLockedNFTsByOrg", "TOKEN")
if err != nil && !auth {
isCallerTokenSysRoleHolder, error := t.Ctx.ERC1155Token.IsCallerTokenSysRoleHolder(constants.Vault)
if error != nil {
return nil, error
}
if !isCallerTokenSysRoleHolder {
return nil, fmt.Errorf("error in authorizing the caller %s", err.Error())
}
}
return t.Ctx.ERC1155Token.GetLockedNFTsByOrg(orgId, userId...)
}
- 参数:
orgId: string
- 当前组织中用户的成员服务提供者 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID(可选)。
- 返回:
- 返回值示例:
[
{
"key":"token1",
"valueJson":{
"AssetType":"otoken",
"Behaviors":[
"indivisible",
"mintable",
"transferable",
"burnable",
"lockable",
"roles"
],
"CreatedBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"CreationDate":"2023-10-20T12:22:47Z",
"IsBurned":false,
"IsLocked":true,
"Mintable":{
"Max_mint_quantity":20000
},
"On_sale_flag":false,
"Owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"Price":120,
"Quantity":1,
"Roles":{
"minter_role_name":"minter"
},
"TokenDesc":"",
"TokenId":"token1",
"TokenMetadata":{
"Description":"",
"Image":"",
"Painter_name":"",
"Painting_name":""
},
"TokenName":"artcollection",
"TokenStandard":"erc1155+",
"TokenType":"nonfungible",
"TokenUnit":"whole",
"TokenUri":"token1.example.com"
}
}
]