github.com/ava-labs/avalanchego@v1.11.11/vms/nftfx/mint_output.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package nftfx
     5  
     6  import (
     7  	"encoding/json"
     8  
     9  	"github.com/ava-labs/avalanchego/vms/components/verify"
    10  	"github.com/ava-labs/avalanchego/vms/secp256k1fx"
    11  )
    12  
    13  var _ verify.State = (*MintOutput)(nil)
    14  
    15  type MintOutput struct {
    16  	verify.IsState `json:"-"`
    17  
    18  	GroupID                  uint32 `serialize:"true" json:"groupID"`
    19  	secp256k1fx.OutputOwners `serialize:"true"`
    20  }
    21  
    22  // MarshalJSON marshals Amt and the embedded OutputOwners struct
    23  // into a JSON readable format
    24  // If OutputOwners cannot be serialized then this will return error
    25  func (out *MintOutput) MarshalJSON() ([]byte, error) {
    26  	result, err := out.OutputOwners.Fields()
    27  	if err != nil {
    28  		return nil, err
    29  	}
    30  
    31  	result["groupID"] = out.GroupID
    32  	return json.Marshal(result)
    33  }