mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2025-05-06 19:55:10 +00:00
vm: allow to convert stack to a slice
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
805f746f15
commit
7b4acd5a7f
2 changed files with 25 additions and 0 deletions
|
@ -396,6 +396,15 @@ func (s *Stack) PopSigElements() ([][]byte, error) {
|
|||
return elems, nil
|
||||
}
|
||||
|
||||
// ToArray converts stack to an array of stackitems with top item being the last.
|
||||
func (s *Stack) ToArray() []stackitem.Item {
|
||||
items := make([]stackitem.Item, 0, s.len)
|
||||
s.IterBack(func(e *Element) {
|
||||
items = append(items, e.Item())
|
||||
})
|
||||
return items
|
||||
}
|
||||
|
||||
// ToContractParameters converts Stack to slice of smartcontract.Parameter.
|
||||
func (s *Stack) ToContractParameters() []smartcontract.Parameter {
|
||||
items := make([]smartcontract.Parameter, 0, s.Len())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue