Documentation ¶
Overview ¶
Package unwrap provides a set of proxy methods to process invocation results.
Functions implemented there are intended to be used as wrappers for other functions that return (*result.Invoke, error) pair (of which there are many). These functions will check for error, check for VM state, check the number of results, cast them to appropriate type (if everything is OK) and then return a result or error. They're mostly useful for other higher-level contract-specific packages.
Index ¶
- func Array(r *result.Invoke, err error) ([]stackitem.Item, error)
- func ArrayOfBytes(r *result.Invoke, err error) ([][]byte, error)
- func BigInt(r *result.Invoke, err error) (*big.Int, error)
- func Bool(r *result.Invoke, err error) (bool, error)
- func Bytes(r *result.Invoke, err error) ([]byte, error)
- func Int64(r *result.Invoke, err error) (int64, error)
- func Item(r *result.Invoke, err error) (stackitem.Item, error)
- func LimitedInt64(r *result.Invoke, err error, min int64, max int64) (int64, error)
- func Map(r *result.Invoke, err error) (*stackitem.Map, error)
- func PrintableASCIIString(r *result.Invoke, err error) (string, error)
- func SessionIterator(r *result.Invoke, err error) (uuid.UUID, result.Iterator, error)
- func UTF8String(r *result.Invoke, err error) (string, error)
- func Uint160(r *result.Invoke, err error) (util.Uint160, error)
- func Uint256(r *result.Invoke, err error) (util.Uint256, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Array ¶
Array expects correct execution (HALT state) with a single array stack item returned. This item is returned to the caller. Notice that this function can be used for structures as well since they're also represented as slices of stack items (the number of them and their types are structure-specific).
func ArrayOfBytes ¶
ArrayOfBytes checks the result for correct state (HALT) and then extracts a slice of byte slices from the returned stack item.
func BigInt ¶
BigInt expects correct execution (HALT state) with a single stack item returned. A big.Int is extracted from this item and returned.
func Bool ¶
Bool expects correct execution (HALT state) with a single stack item returned. A bool is extracted from this item and returned.
func Bytes ¶
Bytes expects correct execution (HALT state) with a single stack item returned. A slice of bytes is extracted from this item and returned.
func Int64 ¶
Int64 expects correct execution (HALT state) with a single stack item returned. An int64 is extracted from this item and returned.
func Item ¶
Item returns a stack item from the result if execution was successful (HALT state) and if it's the only element on the result stack.
func LimitedInt64 ¶
LimitedInt64 is similar to Int64 except it allows to set minimum and maximum limits to be checked, so if it doesn't return an error the value is more than min and less than max.
func Map ¶
Map expects correct execution (HALT state) with a single stack item returned. A stackitem.Map is extracted from this item and returned.
func PrintableASCIIString ¶
PrintableASCIIString expects correct execution (HALT state) with a single stack item returned. A string is extracted from this item and checked to only contain ASCII characters in printable range, valid strings are then returned.
func SessionIterator ¶
SessionIterator expects correct execution (HALT state) with a single stack item returned. If this item is an iterator it's returned to the caller along with the session ID.
func UTF8String ¶
UTF8String expects correct execution (HALT state) with a single stack item returned. A string is extracted from this item and checked for UTF-8 correctness, valid strings are then returned.
Types ¶
This section is empty.