Examples
Create NFT Schema
// Read JSON data from file
jsonData, err := ioutil.ReadFile("schema.json")
if err != nil {
fmt.Println(err)
return
}
// Decode JSON data into a map[string]interface{} variable
var data map[string]interface{}
err = json.Unmarshal(jsonData, &data)
if err != nil {
fmt.Println(err)
return
}
// Encode the JSON data as a base64 string
base64Data := base64.StdEncoding.EncodeToString(jsonData)
msg := &nftmngrtypes.MsgCreateNFTSchema{
Creator: client.ConnectedAddress,
NftSchemaBase64: base64Data,
}
txResponse, err := client.GenerateOrBroadcastTx(msg)
if err != nil {
fmt.Println(err)
return
}
Create NFT Metadata
// Read JSON data from file
jsonData, err := ioutil.ReadFile("metadata.json")
if err != nil {
fmt.Println(err)
return
}
// Decode JSON data into a map[string]interface{} variable
var data map[string]interface{}
err = json.Unmarshal(jsonData, &data)
if err != nil {
fmt.Println(err)
return
}
// Encode the JSON data as a base64 string
base64Data := base64.StdEncoding.EncodeToString(jsonData)
msg := &nftmngrtypes.MsgCreateMetadata{
Creator: client.ConnectedAddress,
NftSchemaCode: "six-protocol.develop_v220",
TokenId: "1",
Base64NFTData: base64Data,
}
txResponse, err := client.GenerateOrBroadcastTx(msg)
if err != nil {
fmt.Println(err)
return
}
Perform Action by Admin
refID := uuid.New()
msg := &nftmngrtypes.MsgPerformActionByAdmin{
Creator: client.ConnectedAddress,
NftSchemaCode: "six-protocol.develop_v220",
TokenId: "1",
Action: "test_read_nft",
RefId: refID.String(),
Parameters: []*nftmngrtypes.ActionParameter{},
}
txResponse, err := client.GenerateOrBroadcastTx(msg)
if err != nil {
fmt.Println(err)
return
}
Last updated