compiler/interop: add support for working with witnesses
This commit is contained in:
parent
87e7e157ae
commit
7e96f82a5b
3 changed files with 26 additions and 0 deletions
|
@ -72,6 +72,7 @@ var syscalls = map[string]map[string]string{
|
||||||
"GetReferences": "Neo.Transaction.GetReferences",
|
"GetReferences": "Neo.Transaction.GetReferences",
|
||||||
"GetScript": "Neo.InvocationTransaction.GetScript",
|
"GetScript": "Neo.InvocationTransaction.GetScript",
|
||||||
"GetType": "Neo.Transaction.GetType",
|
"GetType": "Neo.Transaction.GetType",
|
||||||
|
"GetWitnesses": "Neo.Transaction.GetWitnesses",
|
||||||
},
|
},
|
||||||
"asset": {
|
"asset": {
|
||||||
"Create": "Neo.Asset.Create",
|
"Create": "Neo.Asset.Create",
|
||||||
|
@ -117,4 +118,7 @@ var syscalls = map[string]map[string]string{
|
||||||
"Value": "Neo.Iterator.Value",
|
"Value": "Neo.Iterator.Value",
|
||||||
"Values": "Neo.Iterator.Values",
|
"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/attribute"
|
||||||
"github.com/nspcc-dev/neo-go/pkg/interop/input"
|
"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/output"
|
||||||
|
"github.com/nspcc-dev/neo-go/pkg/interop/witness"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Transaction represents a NEO transaction, it's an opaque data structure
|
// 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 {
|
func GetScript(t Transaction) []byte {
|
||||||
return nil
|
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