2020-03-04 09:40:01 +00:00
|
|
|
package context
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
|
|
|
"github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Item represents a transaction context item.
|
|
|
|
type Item struct {
|
2021-07-23 08:57:35 +00:00
|
|
|
Script []byte `json:"script"`
|
2020-03-04 09:40:01 +00:00
|
|
|
Parameters []smartcontract.Parameter `json:"parameters"`
|
2021-07-23 08:57:35 +00:00
|
|
|
Signatures map[string][]byte `json:"signatures"`
|
2020-03-04 09:40:01 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// GetSignature returns a signature for the pub if present.
|
2020-03-04 09:40:01 +00:00
|
|
|
func (it *Item) GetSignature(pub *keys.PublicKey) []byte {
|
2024-04-09 09:13:43 +00:00
|
|
|
return it.Signatures[pub.StringCompressed()]
|
2020-03-04 09:40:01 +00:00
|
|
|
}
|
|
|
|
|
2022-04-20 18:30:09 +00:00
|
|
|
// AddSignature adds a signature for the pub.
|
2020-03-04 09:40:01 +00:00
|
|
|
func (it *Item) AddSignature(pub *keys.PublicKey, sig []byte) {
|
2024-04-09 09:13:43 +00:00
|
|
|
pubHex := pub.StringCompressed()
|
2020-03-04 09:40:01 +00:00
|
|
|
it.Signatures[pubHex] = sig
|
|
|
|
}
|