Documentation ¶
Index ¶
- Constants
- func U256(n *big.Int) []byte
- type ABIContract
- func (abi *ABIContract) MethodById(sigdata []byte) (*Method, error)
- func (abi ABIContract) PackMethod(name string, args ...interface{}) ([]byte, error)
- func (abi ABIContract) PackVariable(name string, args ...interface{}) ([]byte, error)
- func (abi *ABIContract) UnmarshalJSON(data []byte) error
- func (abi ABIContract) UnpackEvent(v interface{}, name string, output []byte) (err error)
- func (abi ABIContract) UnpackMethod(v interface{}, name string, output []byte) (err error)
- func (abi ABIContract) UnpackVariable(v interface{}, name string, output []byte) (err error)
- type Argument
- type Arguments
- func (arguments Arguments) LengthNonIndexed() int
- func (arguments Arguments) NonIndexed() Arguments
- func (arguments Arguments) Pack(args ...interface{}) ([]byte, error)
- func (arguments Arguments) PackValues(args []interface{}) ([]byte, error)
- func (arguments Arguments) Unpack(v interface{}, data []byte) error
- func (arguments Arguments) UnpackValues(data []byte) ([]interface{}, error)
- type Event
- type Method
- type Type
- type Variable
Constants ¶
const ( IntTy byte = iota UintTy BoolTy StringTy SliceTy ArrayTy AddressTy TokenIdTy FixedBytesTy BytesTy HashTy FunctionTy BalanceTy SignatureTy )
Type enumerator
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ABIContract ¶
type ABIContract struct { Constructor Method Methods map[string]Method Events map[string]Event Variables map[string]Variable }
The ABIContract holds information about a contract's context and available invokable methods. It will allow you to type check function calls and packs data accordingly.
func JSONToABIContract ¶
func JSONToABIContract(reader io.Reader) (ABIContract, error)
JSONToABIContract returns a parsed ABI interface and error if it failed.
func (*ABIContract) MethodById ¶
func (abi *ABIContract) MethodById(sigdata []byte) (*Method, error)
MethodById looks up a method by the 4-byte id returns nil if none found
func (ABIContract) PackMethod ¶
func (abi ABIContract) PackMethod(name string, args ...interface{}) ([]byte, error)
Pack the given method name to conform the ABI. Method call's data will consist of method_id, args0, arg1, ... argN. Method id consists of 4 bytes and arguments are all 32 bytes. Method ids are created from the first 4 bytes of the hash of the methods string signature. (signature = baz(uint32,string32))
func (ABIContract) PackVariable ¶
func (abi ABIContract) PackVariable(name string, args ...interface{}) ([]byte, error)
func (*ABIContract) UnmarshalJSON ¶
func (abi *ABIContract) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler interface
func (ABIContract) UnpackEvent ¶
func (abi ABIContract) UnpackEvent(v interface{}, name string, output []byte) (err error)
UnpackEvent output in v according to the abi specification
func (ABIContract) UnpackMethod ¶
func (abi ABIContract) UnpackMethod(v interface{}, name string, output []byte) (err error)
UnpackMethod output in v according to the abi specification
func (ABIContract) UnpackVariable ¶
func (abi ABIContract) UnpackVariable(v interface{}, name string, output []byte) (err error)
type Argument ¶
Argument holds the name of the argument and the corresponding type. Types are used when packing and testing arguments.
func (*Argument) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler interface
type Arguments ¶
type Arguments []Argument
func (Arguments) LengthNonIndexed ¶
LengthNonIndexed returns the number of arguments when not counting 'indexed' ones. Only events can ever have 'indexed' arguments, it should always be false on arguments for method input/output
func (Arguments) NonIndexed ¶
NonIndexed returns the arguments with indexed arguments filtered out
func (Arguments) PackValues ¶
PackValues performs the operation Go format -> Hexdata It is the semantic opposite of UnpackValues
func (Arguments) UnpackValues ¶
UnpackValues can be used to unpack ABI-encoded hexdata according to the ABI-specification, without supplying a struct to unpack into. Instead, this method returns a list containing the values. An atomic argument will be a list with one element.
type Event ¶
Event is an event potentially triggered by the VM's LOG mechanism. The Event holds type information (inputs) about the yielded output. Anonymous events don't get the signature canonical representation as the first LOG topic.
type Method ¶
Method represents a callable given a `Name` and whether the method is a constant. If the method is `Const` no transaction needs to be created for this particular Method call. It can easily be simulated using a local VM. For example a `Balance()` method only needs to retrieve something from the storage and therefor requires no Tx to be send to the network. A method such as `Transact` does require a Tx and thus will be flagged `true`. Input specifies the required input parameters for this gives method.