-
lockNFT
- 這個方法會鎖定指定的不可行記號。若要鎖定記號,則必須要有具備
TokenSys
vault
角色的使用者,該角色可作為保存庫管理員。此方法只能由記號的擁有者呼叫。
-
@Validator(yup.string())
public async lockNFT(orgId: string, userId: string, tokenId: string) {
return await this.Ctx.ERC1155Token.lockNFT(orgId, userId, tokenId);
}
- 參數:
orgId: string
- 目前組織中使用者的成員服務提供者 (MSP) ID。
userId: string
- 使用者的使用者名稱或電子郵件 ID (選擇性)。
tokenID: string
- 要鎖定的記號 ID。
- 傳回值:
- 傳回值範例:
{
"assetType":"otoken",
"tokenId":"token1",
"tokenName":"artcollection",
"tokenStandard":"erc1155+",
"tokenType":"nonfungible",
"tokenUnit":"whole",
"behaviors":[
"indivisible",
"mintable",
"transferable",
"burnable",
"lockable",
"roles"
],
"roles":{
"minter_role_name":"minter"
},
"mintable":{
"max_mint_quantity":20000
},
"quantity":1,
"createdBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"creationDate":"2023-10-20T09:16:29.000Z",
"owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"isBurned":false,
"isLocked":true,
"tokenUri":"token1.example.com",
"price":120,
"on_sale_flag":false
}
-
isNFTLocked
- 此方法會傳回布林值,指出指定的記號是否已鎖定。此方法只能由記號擁有者、保存庫管理員 (具有
TokenSys
vault
角色的使用者) 或鏈碼的 Token Admin
呼叫。
-
@GetMethod()
@Validator(yup.string())
public async isNFTLocked(tokenId: string) {
try {
await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.isNFTLocked", "TOKEN", { tokenId });
} catch(err) {
const isCallerTokenSysRoleHolder = await this.Ctx.ERC1155Token.isCallerTokenSysRoleHolder(TOKEN_SYS_ROLE_TYPE.VAULT);
if(!isCallerTokenSysRoleHolder)
throw err;
}
const isNFTLocked = await this.Ctx.ERC1155Token.isNFTLocked(tokenId);
return {isNFTLocked};
}
- 參數:
tokenID: string
- 記號的 ID。
- 傳回值:
- 傳回值範例:
{
"isNFTLocked":true
}
-
getAllLockedNFTs
- 此方法會傳回所有鎖定的不可行記號清單。此方法只能由 Vault 管理程式 (具有
TokenSys
vault
角色的使用者) 或鏈碼的 Token Admin
呼叫。
-
@GetMethod()
@Validator()
public async getAllLockedNFTs() {
try {
await this.Ctx.ERC1155Auth.checkAuthorization("ERC1155TOKEN.getAllLockedNFTs", "TOKEN");
} catch(err) {
const isCallerTokenSysRoleHolder = await this.Ctx.ERC1155Token.isCallerTokenSysRoleHolder(TOKEN_SYS_ROLE_TYPE.VAULT);
if(!isCallerTokenSysRoleHolder)
throw err;
}
return this.Ctx.ERC1155Token.getAllLockedNFTs();
}
- 參數:
- 傳回值:
- 傳回值範例:
[
{
"key":"token1",
"valueJson":{
"assetType":"otoken",
"tokenId":"token1",
"tokenName":"artcollection",
"tokenStandard":"erc1155+",
"tokenType":"nonfungible",
"tokenUnit":"whole",
"behaviors":[
"indivisible",
"mintable",
"transferable",
"burnable",
"lockable",
"roles"
],
"roles":{
"minter_role_name":"minter"
},
"mintable":{
"max_mint_quantity":20000
},
"quantity":1,
"createdBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"creationDate":"2023-10-20T09:16: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.ERC1155Auth.checkAuthorization("ERC1155TOKEN.getLockedNFTsByOrg", "TOKEN");
} catch(err) {
const isCallerTokenSysRoleHolder = await this.Ctx.ERC1155Token.isCallerTokenSysRoleHolder(TOKEN_SYS_ROLE_TYPE.VAULT);
if(!isCallerTokenSysRoleHolder)
throw err;
}
return await this.Ctx.ERC1155Token.getLockedNFTsByOrg(orgId, userId);
}
- 參數:
orgId: string
- 目前組織中使用者的成員服務提供者 (MSP) ID。
userId: string
- 使用者的使用者名稱或電子郵件 ID (選擇性)。
- 傳回值:
- 傳回值範例:
[
{
"key":"token1",
"valueJson":{
"assetType":"otoken",
"tokenId":"token1",
"tokenName":"artcollection",
"tokenStandard":"erc1155+",
"tokenType":"nonfungible",
"tokenUnit":"whole",
"behaviors":[
"indivisible",
"mintable",
"transferable",
"burnable",
"lockable",
"roles"
],
"roles":{
"minter_role_name":"minter"
},
"mintable":{
"max_mint_quantity":20000
},
"quantity":1,
"createdBy":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"creationDate":"2023-10-20T09:16:29.000Z",
"owner":"oaccount~208e3345ac84b4849f0d2648b2f2f018019886a1230f99304ebff1b6a7733463",
"isBurned":false,
"isLocked":true,
"tokenUri":"token1.example.com",
"price":120,
"on_sale_flag":false
}
}
]