accounts/abi, mobile: support jave binding

This commit is contained in:
rjl493456442 2020-03-16 13:17:58 +08:00
parent 5ab8562a85
commit b821eda702
3 changed files with 43 additions and 12 deletions

File diff suppressed because one or more lines are too long

View file

@ -659,6 +659,24 @@ import java.util.*;
return this.Contract.transact(opts, "{{.Original.Name}}" , args); return this.Contract.transact(opts, "{{.Original.Name}}" , args);
} }
{{end}} {{end}}
{{if .Fallback}}
// Fallback is a paid mutator transaction binding the contract fallback function.
//
// Solidity: {{formatmethod .Fallback.Original $structs}}
public Transaction Fallback(TransactOpts opts, byte[] calldata) throws Exception {
return this.Contract.rawTransact(opts, calldata);
}
{{end}}
{{if .Receive}}
// Receive is a paid mutator transaction binding the contract receive function.
//
// Solidity: {{formatmethod .Receive.Original $structs}}
public Transaction Receive(TransactOpts opts) throws Exception {
return this.Contract.rawTransact(opts, null);
}
{{end}}
} }
{{end}} {{end}}
` `

View file

@ -197,6 +197,15 @@ func (c *BoundContract) Transact(opts *TransactOpts, method string, args *Interf
return &Transaction{rawTx}, nil return &Transaction{rawTx}, nil
} }
// RawTransact invokes the (paid) contract method with raw calldata as input values.
func (c *BoundContract) RawTransact(opts *TransactOpts, calldata []byte) (tx *Transaction, _ error) {
rawTx, err := c.contract.RawTransact(&opts.opts, calldata)
if err != nil {
return nil, err
}
return &Transaction{rawTx}, nil
}
// Transfer initiates a plain transaction to move funds to the contract, calling // Transfer initiates a plain transaction to move funds to the contract, calling
// its default method if one is available. // its default method if one is available.
func (c *BoundContract) Transfer(opts *TransactOpts) (tx *Transaction, _ error) { func (c *BoundContract) Transfer(opts *TransactOpts) (tx *Transaction, _ error) {