From f653c4410af326ee8ae85d4300b84d838c87e1d0 Mon Sep 17 00:00:00 2001 From: nujabes403 Date: Sun, 23 Dec 2018 17:19:50 +0900 Subject: [PATCH] Add object style for calling iost.transfer --- iost/iost.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/iost/iost.js b/iost/iost.js index 875f2ae3..9612af81 100644 --- a/iost/iost.js +++ b/iost/iost.js @@ -50,6 +50,18 @@ class IOST { * @returns {Tx} */ transfer(token, from, to, amount, memo = "") { + // For object-style input + if (arguments.length === 1 && typeof arguments[0] === 'object') { + const transferStructure = arguments[0] + return transfer( + transferStructure.token, + transferStructure.from, + transferStructure.to, + transferStructure.amount, + transferStructure.memo + ) + } + let t = this.callABI("token.iost", "transfer", [token, from, to, amount, memo]); t.addApprove("*", this.config.defaultLimit); t.addApprove("iost", amount); @@ -77,4 +89,4 @@ class IOST { } } -module.exports = IOST; \ No newline at end of file +module.exports = IOST;