• R/O
  • HTTP
  • SSH
  • HTTPS

Bytom-JS-SDK: Commit

It is a project for Bytom Chrome extension JS SDK https://bytom.github.io/Bytom-JS-SDK


Commit MetaInfo

Revision62dbd0252a9a50955d5ec7a7473fa3a54104f401 (tree)
Zeit2021-04-27 18:54:37
Autorj <coffce404@gmai...>
Commiterj

Log Message

feat(transaction): support multi toAddress

Ändern Zusammenfassung

Diff

--- a/src/sdk/transaction.js
+++ b/src/sdk/transaction.js
@@ -98,7 +98,7 @@ transactionSDK.prototype.submitPayment = function(address, raw_transaction, sign
9898 *
9999 * @see https://gist.github.com/HAOYUatHZ/0c7446b8f33e7cddd590256b3824b08f#apiv1btmmerchantbuild-payment
100100 * @param {String} guid unique id for each wallet
101- * @param {String} to destination address
101+ * @param {String|{[asset: string]: number}} to destination address
102102 * @param {String} asset hexdecimal asset id
103103 * @param {Number} amount transfer amount
104104 * @param {Number} fee transaction fee amount
@@ -113,7 +113,12 @@ transactionSDK.prototype.buildPayment = function(address, to, asset, amount, con
113113 forbid_chain_tx: false
114114 };
115115
116- pm['recipients'][`${to}`] = amount;
116+ // transfer to multi address
117+ if (typeof to === 'object') {
118+ pm.recipients = to;
119+ } else {
120+ pm.recipients[to] = amount;
121+ }
117122
118123 if (memo) {
119124 pm.memo = memo;
@@ -182,6 +187,7 @@ transactionSDK.prototype.buildVote = function(address, vote, amount, confirmatio
182187 };
183188
184189 transactionSDK.prototype.estimateFee = function(address, asset_amounts, confirmations=1) {
190+ console.log('estimateFee', arguments);
185191 let net = this.bytom.net;
186192 let pm = {asset_amounts, confirmations};
187193
Show on old repository browser