github.com/MetalBlockchain/metalgo@v1.11.9/vms/example/xsvm/cmd/issue/status/status.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package status
     5  
     6  import (
     7  	"encoding/json"
     8  	"fmt"
     9  	"time"
    10  
    11  	"github.com/MetalBlockchain/metalgo/ids"
    12  	"github.com/MetalBlockchain/metalgo/vms/example/xsvm/tx"
    13  )
    14  
    15  type TxIssuance struct {
    16  	Tx        *tx.Tx
    17  	TxID      ids.ID
    18  	Nonce     uint64
    19  	StartTime time.Time
    20  }
    21  
    22  func (s *TxIssuance) String() string {
    23  	txJSON, err := json.MarshalIndent(s.Tx, "", "  ")
    24  	if err != nil {
    25  		return "failed to marshal transaction: " + err.Error()
    26  	}
    27  	return fmt.Sprintf("issued tx %s in %s\n%s\n", s.TxID, time.Since(s.StartTime), string(txJSON))
    28  }