forked from TrueCloudLab/neoneo-go
compiler/interop: add support for working with witnesses
This commit is contained in:
parent
085d50b430
commit
8c19b8f2a1
3 changed files with 26 additions and 0 deletions
|
@ -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",
|
||||
},
|
||||
}
|
||||
|
|
|
@ -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{}
|
||||
}
|
||||
|
|
14
pkg/interop/witness/witness.go
Normal file
14
pkg/interop/witness/witness.go
Normal file
|
@ -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
|
||||
}
|
Loading…
Reference in a new issue