github.com/ava-labs/avalanchego@v1.11.11/vms/avm/txs/export_tx.go (about)

     1  // Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved.
     2  // See the file LICENSE for licensing terms.
     3  
     4  package txs
     5  
     6  import (
     7  	"github.com/ava-labs/avalanchego/ids"
     8  	"github.com/ava-labs/avalanchego/snow"
     9  	"github.com/ava-labs/avalanchego/vms/components/avax"
    10  	"github.com/ava-labs/avalanchego/vms/secp256k1fx"
    11  )
    12  
    13  var (
    14  	_ UnsignedTx             = (*ExportTx)(nil)
    15  	_ secp256k1fx.UnsignedTx = (*ExportTx)(nil)
    16  )
    17  
    18  // ExportTx is a transaction that exports an asset to another blockchain.
    19  type ExportTx struct {
    20  	BaseTx `serialize:"true"`
    21  
    22  	// Which chain to send the funds to
    23  	DestinationChain ids.ID `serialize:"true" json:"destinationChain"`
    24  
    25  	// The outputs this transaction is sending to the other chain
    26  	ExportedOuts []*avax.TransferableOutput `serialize:"true" json:"exportedOutputs"`
    27  }
    28  
    29  func (t *ExportTx) InitCtx(ctx *snow.Context) {
    30  	for _, out := range t.ExportedOuts {
    31  		out.InitCtx(ctx)
    32  	}
    33  	t.BaseTx.InitCtx(ctx)
    34  }
    35  
    36  func (t *ExportTx) Visit(v Visitor) error {
    37  	return v.ExportTx(t)
    38  }