diff --git a/pkg/compiler/syscall.go b/pkg/compiler/syscall.go index bb6429f10..26307270d 100644 --- a/pkg/compiler/syscall.go +++ b/pkg/compiler/syscall.go @@ -69,6 +69,7 @@ var syscalls = map[string]map[string]string{ "GetReferences": "Neo.Transaction.GetReferences", "GetScript": "Neo.InvocationTransaction.GetScript", "GetType": "Neo.Transaction.GetType", + "GetWitnesses": "Neo.Transaction.GetWitnesses", }, "asset": { "Create": "Neo.Asset.Create", @@ -114,4 +115,7 @@ var syscalls = map[string]map[string]string{ "Value": "Neo.Iterator.Value", "Values": "Neo.Iterator.Values", }, + "witness": { + "GetVerificationScript": "Neo.Witness.GetVerificationScript", + }, } diff --git a/pkg/interop/transaction/transaction.go b/pkg/interop/transaction/transaction.go index 0969da5b7..00d06c25e 100644 --- a/pkg/interop/transaction/transaction.go +++ b/pkg/interop/transaction/transaction.go @@ -7,6 +7,7 @@ import ( "github.com/nspcc-dev/neo-go/pkg/interop/attribute" "github.com/nspcc-dev/neo-go/pkg/interop/input" "github.com/nspcc-dev/neo-go/pkg/interop/output" + "github.com/nspcc-dev/neo-go/pkg/interop/witness" ) // Transaction represents a NEO transaction, it's an opaque data structure @@ -72,3 +73,10 @@ func GetOutputs(t Transaction) []output.Output { func GetScript(t Transaction) []byte { return nil } + +// GetWitnesses returns a slice of witnesses of a given Transaction. Refer to +// witness package on how to use them. This function uses +// `Neo.Transaction.GetWitnesses` syscall. +func GetWitnesses(t Transaction) []witness.Witness { + return []witness.Witness{} +} diff --git a/pkg/interop/witness/witness.go b/pkg/interop/witness/witness.go new file mode 100644 index 000000000..5bf742f83 --- /dev/null +++ b/pkg/interop/witness/witness.go @@ -0,0 +1,14 @@ +/* +Package witness provides functions dealing with transaction's witnesses. +*/ +package witness + +// Witness is an opaque data structure that can only be created by +// transaction.GetWitnesses and representing transaction's witness. +type Witness struct{} + +// GetVerificationScript returns verification script stored in the given +// witness. It uses `Neo.Witness.GetVerificationScript` syscall. +func GetVerificationScript(w Witness) []byte { + return nil +}