-
lockNFT
- 此方法锁定指定的不可替换令牌。要锁定令牌,必须具有
TokenSys
vault
角色的用户充当 Vault 管理器。此方法只能由令牌的所有者调用。
-
@Validator(yup.string())
public async lockNFT(tokenId: string) {
return await this.Ctx.ERC721Token.lockNFT(tokenId);
}
- 参数:
tokenID: string
- 要锁定的令牌的 ID。
- 返回:
- 返回值示例:
{
"assetType":"otoken",
"tokenId":"token1",
"tokenName":"artcollection",
"symbol":"ART",
"tokenStandard":"erc721+",
"tokenType":"nonfungible",
"tokenUnit":"whole",
"behaviors":[
"indivisible",
"singleton",
"mintable",
"transferable",
"lockable",
"burnable",
"roles"
],
"roles":{
"minter_role_name":"minter"
},
"mintable":{
"max_mint_quantity":20000
},
"createdBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"creationDate":"2023-10-20T10:26:29.000Z",
"owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"isBurned":false,
"isLocked":true,
"tokenUri":"token1.example.com",
"price":120,
"on_sale_flag":false
}
-
isNFTLocked
- 此方法返回布尔值以指示指定的标记是否已锁定。此方法只能由令牌所有者、 Vault 管理器(具有
TokenSys
vault
角色的用户)或链代码的 Token Admin
调用。
-
@GetMethod()
@Validator(yup.string())
public async isNFTLocked(tokenId: string) {
try {
await this.Ctx.ERC721Auth.checkAuthorization("ERC721TOKEN.isNFTLocked", "TOKEN", { tokenId });
} catch(err) {
const isCallerTokenSysRoleHolder = await this.Ctx.ERC721Token.isCallerTokenSysRoleHolder(TOKEN_SYS_ROLE_TYPE.VAULT);
if(!isCallerTokenSysRoleHolder)
throw err;
}
const isLocked = await this.Ctx.ERC721Token.isNFTLocked(tokenId);
return {isLocked: isLocked}
}
- 参数:
tokenID: string
- 标记的 ID。
- 返回:
- 返回值示例:
{
"isNFTLocked":true
}
-
getAllLockedNFTs
- 此方法返回所有锁定的不可替代标记的列表。此方法只能由 Vault 管理器(具有
TokenSys
vault
角色的用户)或链代码的 Token Admin
调用。
-
@GetMethod()
@Validator()
public async getAllLockedNFTs() {
try {
await this.Ctx.ERC721Auth.checkAuthorization("ERC721TOKEN.getAllLockedNFTs", "TOKEN");
} catch(err) {
const isCallerTokenSysRoleHolder = await this.Ctx.ERC721Token.isCallerTokenSysRoleHolder(TOKEN_SYS_ROLE_TYPE.VAULT);
if(!isCallerTokenSysRoleHolder)
throw err;
}
return this.Ctx.ERC721Token.getAllLockedNFTs();
}
- 参数:
- 返回:
- 返回值示例:
[
{
"key":"token1",
"valueJson":{
"assetType":"otoken",
"tokenId":"token1",
"tokenName":"artcollection",
"symbol":"ART",
"tokenStandard":"erc721+",
"tokenType":"nonfungible",
"tokenUnit":"whole",
"behaviors":[
"indivisible",
"singleton",
"mintable",
"transferable",
"lockable",
"burnable",
"roles"
],
"roles":{
"minter_role_name":"minter"
},
"mintable":{
"max_mint_quantity":20000
},
"createdBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"creationDate":"2023-10-20T10:26:29.000Z",
"owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"isBurned":false,
"isLocked":true,
"tokenUri":"token1.example.com",
"price":120,
"on_sale_flag":false
}
}
]
-
getAllLockedNFTsByOrg
- 此方法返回指定组织和(可选)指定用户的所有锁定的不可替代标记的列表。此方法只能由 Vault 管理器(具有
TokenSys
vault
角色的用户)或链代码的 Token Admin
调用。
-
@GetMethod()
@Validator(yup.string(), yup.string())
public async getLockedNFTsByOrg(orgId: string, userId?: string) {
try {
await this.Ctx.ERC721Auth.checkAuthorization("ERC721TOKEN.getLockedNFTsByOrg", "TOKEN");
} catch(err) {
const isCallerTokenSysRoleHolder = await this.Ctx.ERC721Token.isCallerTokenSysRoleHolder(TOKEN_SYS_ROLE_TYPE.VAULT);
if(!isCallerTokenSysRoleHolder)
throw err;
}
return await this.Ctx.ERC721Token.getLockedNFTsByOrg(orgId, userId);
}
- 参数:
orgId: string
- 当前组织中用户的成员服务提供者 (MSP) ID。
userId: string
- 用户的用户名或电子邮件 ID(可选)。
- 返回:
- 返回值示例:
[
{
"key":"token1",
"valueJson":{
"assetType":"otoken",
"tokenId":"token1",
"tokenName":"artcollection",
"symbol":"ART",
"tokenStandard":"erc721+",
"tokenType":"nonfungible",
"tokenUnit":"whole",
"behaviors":[
"indivisible",
"singleton",
"mintable",
"transferable",
"lockable",
"burnable",
"roles"
],
"roles":{
"minter_role_name":"minter"
},
"mintable":{
"max_mint_quantity":20000
},
"createdBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"creationDate":"2023-10-20T10:26:29.000Z",
"owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"isBurned":false,
"isLocked":true,
"tokenUri":"token1.examplecom",
"price":120,
"on_sale_flag":false
}
}
]