[#122] Add BigIntFromStackItem
Neo-go can return big.Int values on stack after contract execution. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
parent
330c4b42d9
commit
e3c060b739
2 changed files with 33 additions and 0 deletions
|
@ -2,6 +2,7 @@ package client
|
|||
|
||||
import (
|
||||
"encoding/binary"
|
||||
"math/big"
|
||||
|
||||
sc "github.com/nspcc-dev/neo-go/pkg/smartcontract"
|
||||
"github.com/nspcc-dev/neo-go/pkg/vm/stackitem"
|
||||
|
@ -157,6 +158,11 @@ func IntFromStackItem(param stackitem.Item) (int64, error) {
|
|||
}
|
||||
}
|
||||
|
||||
// BigIntFromStackItem receives numerical value from the value of a smart contract parameter.
|
||||
func BigIntFromStackItem(param stackitem.Item) (*big.Int, error) {
|
||||
return param.TryInteger()
|
||||
}
|
||||
|
||||
// BytesFromStackItem receives binary value from the value of a smart contract parameter.
|
||||
func BytesFromStackItem(param stackitem.Item) ([]byte, error) {
|
||||
switch param.Type() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue