github.com/ava-labs/avalanchego@v1.11.11/vms/avm/txs/base_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/utils/set" 10 "github.com/ava-labs/avalanchego/vms/components/avax" 11 "github.com/ava-labs/avalanchego/vms/secp256k1fx" 12 ) 13 14 var ( 15 _ UnsignedTx = (*BaseTx)(nil) 16 _ secp256k1fx.UnsignedTx = (*BaseTx)(nil) 17 ) 18 19 // BaseTx is the basis of all transactions. 20 type BaseTx struct { 21 avax.BaseTx `serialize:"true"` 22 23 bytes []byte 24 } 25 26 func (t *BaseTx) InitCtx(ctx *snow.Context) { 27 for _, out := range t.Outs { 28 out.InitCtx(ctx) 29 } 30 } 31 32 func (t *BaseTx) SetBytes(bytes []byte) { 33 t.bytes = bytes 34 } 35 36 func (t *BaseTx) Bytes() []byte { 37 return t.bytes 38 } 39 40 func (t *BaseTx) InputIDs() set.Set[ids.ID] { 41 inputIDs := set.NewSet[ids.ID](len(t.Ins)) 42 for _, in := range t.Ins { 43 inputIDs.Add(in.InputID()) 44 } 45 return inputIDs 46 } 47 48 func (t *BaseTx) Visit(v Visitor) error { 49 return v.BaseTx(t) 50 }