-
LockNFT
- このメソッドは、指定された非代替トークンをロックします。トークンをロックするには、ボールト・マネージャとして機能する
TokenSys 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。
- 戻り値:
- 成功の場合、トークン・オブジェクトのJSON表現。
- 戻り値の例:
{
"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
- このメソッドは、指定されたトークンがロックされているかどうかを示すブール値を返します。このメソッドは、トークン所有者、ボールト・マネージャ(
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
- このメソッドは、ロックされているすべての非代替トークンのリストを返します。このメソッドは、ボールト・マネージャ(
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
- このメソッドは、指定された組織およびオプションで指定されたユーザーについて、ロックされているすべての非代替トークンのリストを返します。このメソッドは、ボールト・マネージャ(
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"
}
}
]