iost.js icon indicating copy to clipboard operation
iost.js copied to clipboard

Remove redundancy statement on iost.transfer

Open nujabes403 opened this issue 6 years ago • 0 comments

let t = this.callABI("token.iost", "transfer", [token, from, to, amount, memo]);

In above statement, this.callABI already do t.addApprove("*", this.config.defaultLimit); internally.

So there is no reason to set defaultGasLimit twice when call transfer.

cf)

  1. callABI function
    callABI(contract, abi, args) {
        const t = new Tx(this.config.gasRatio, this.config.gasLimit);
        t.addAction(contract, abi, JSON.stringify(args));
        t.setTime(this.config.expiration, this.config.delay);
        t.addApprove("*", this.config.defaultLimit); // already approve defaultLimit!
        return t
    }
  1. transfer function
    transfer(token, from, to, amount, memo = "") {
        let t = this.callABI("token.iost", "transfer", [token, from, to, amount, memo]);
        t.addApprove("*", this.config.defaultLimit); // redundant!
        t.addApprove("iost", amount); 
        return t;
    }

nujabes403 avatar Jan 16 '19 14:01 nujabes403