accounts/abi/bind: surface raw wrappers to access low level ops

This commit is contained in:
Péter Szilágyi
2016-04-01 13:02:43 +03:00
parent 10d3466c93
commit 4097478884
3 changed files with 102 additions and 5 deletions

View File

@ -108,8 +108,7 @@ func (c *BoundContract) Call(opts *CallOpts, result interface{}, method string,
return c.abi.Unpack(result, method, output)
}
// Transact invokes the (paid) contract method with params as input values and
// value as the fund transfer to the contract.
// Transact invokes the (paid) contract method with params as input values.
func (c *BoundContract) Transact(opts *TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {
// Otherwise pack up the parameters and invoke the contract
input, err := c.abi.Pack(method, params...)
@ -119,6 +118,12 @@ func (c *BoundContract) Transact(opts *TransactOpts, method string, params ...in
return c.transact(opts, &c.address, input)
}
// Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available.
func (c *BoundContract) Transfer(opts *TransactOpts) (*types.Transaction, error) {
return c.transact(opts, &c.address, nil)
}
// transact executes an actual transaction invocation, first deriving any missing
// authorization fields, and then scheduling the transaction for execution.
func (c *BoundContract) transact(opts *TransactOpts, contract *common.Address, input []byte) (*types.Transaction, error) {