github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/smartcontract/context/item.go (about)

     1  package context
     2  
     3  import (
     4  	"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
     5  	"github.com/nspcc-dev/neo-go/pkg/smartcontract"
     6  )
     7  
     8  // Item represents a transaction context item.
     9  type Item struct {
    10  	Script     []byte                    `json:"script"`
    11  	Parameters []smartcontract.Parameter `json:"parameters"`
    12  	Signatures map[string][]byte         `json:"signatures"`
    13  }
    14  
    15  // GetSignature returns a signature for the pub if present.
    16  func (it *Item) GetSignature(pub *keys.PublicKey) []byte {
    17  	return it.Signatures[pub.StringCompressed()]
    18  }
    19  
    20  // AddSignature adds a signature for the pub.
    21  func (it *Item) AddSignature(pub *keys.PublicKey, sig []byte) {
    22  	pubHex := pub.StringCompressed()
    23  	it.Signatures[pubHex] = sig
    24  }