aboutsummaryrefslogtreecommitdiffstats
path: root/mobile
diff options
context:
space:
mode:
authorcroath <croathliu@gmail.com>2018-01-23 19:10:23 +0800
committercroath <croathliu@gmail.com>2018-01-23 19:10:23 +0800
commita6787a6308d2109006b036c8a6a331afa938912d (patch)
treedf1c7c3aadb4ed7fc54b32fed2791947be82370f /mobile
parent88e67c552e5da4d114d80be3ff471f4f2ed030f5 (diff)
downloaddexon-a6787a6308d2109006b036c8a6a331afa938912d.tar
dexon-a6787a6308d2109006b036c8a6a331afa938912d.tar.gz
dexon-a6787a6308d2109006b036c8a6a331afa938912d.tar.bz2
dexon-a6787a6308d2109006b036c8a6a331afa938912d.tar.lz
dexon-a6787a6308d2109006b036c8a6a331afa938912d.tar.xz
dexon-a6787a6308d2109006b036c8a6a331afa938912d.tar.zst
dexon-a6787a6308d2109006b036c8a6a331afa938912d.zip
accounts/abi: fix the `output` at the beginning instead of making a workaround
Diffstat (limited to 'mobile')
-rw-r--r--mobile/bind.go18
1 files changed, 13 insertions, 5 deletions
diff --git a/mobile/bind.go b/mobile/bind.go
index 7b79bedaf..e8164d523 100644
--- a/mobile/bind.go
+++ b/mobile/bind.go
@@ -154,12 +154,20 @@ func (c *BoundContract) GetDeployer() *Transaction {
// Call invokes the (constant) contract method with params as input values and
// sets the output to result.
func (c *BoundContract) Call(opts *CallOpts, out *Interfaces, method string, args *Interfaces) error {
- results := make([]interface{}, len(out.objects))
- copy(results, out.objects)
- if err := c.contract.Call(&opts.opts, &results, method, args.objects...); err != nil {
- return err
+ if len(out.objects) == 1 {
+ result := out.objects[0]
+ if err := c.contract.Call(&opts.opts, result, method, args.objects...); err != nil {
+ return err
+ }
+ out.objects[0] = result
+ } else {
+ results := make([]interface{}, len(out.objects))
+ copy(results, out.objects)
+ if err := c.contract.Call(&opts.opts, &results, method, args.objects...); err != nil {
+ return err
+ }
+ copy(out.objects, results)
}
- copy(out.objects, results)
return nil
}