It is a project for Bytom Chrome extension JS SDK https://bytom.github.io/Bytom-JS-SDK
Revision | 62dbd0252a9a50955d5ec7a7473fa3a54104f401 (tree) |
---|---|
Zeit | 2021-04-27 18:54:37 |
Autor | j <coffce404@gmai...> |
Commiter | j |
feat(transaction): support multi toAddress
@@ -98,7 +98,7 @@ transactionSDK.prototype.submitPayment = function(address, raw_transaction, sign | ||
98 | 98 | * |
99 | 99 | * @see https://gist.github.com/HAOYUatHZ/0c7446b8f33e7cddd590256b3824b08f#apiv1btmmerchantbuild-payment |
100 | 100 | * @param {String} guid unique id for each wallet |
101 | - * @param {String} to destination address | |
101 | + * @param {String|{[asset: string]: number}} to destination address | |
102 | 102 | * @param {String} asset hexdecimal asset id |
103 | 103 | * @param {Number} amount transfer amount |
104 | 104 | * @param {Number} fee transaction fee amount |
@@ -113,7 +113,12 @@ transactionSDK.prototype.buildPayment = function(address, to, asset, amount, con | ||
113 | 113 | forbid_chain_tx: false |
114 | 114 | }; |
115 | 115 | |
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 | + } | |
117 | 122 | |
118 | 123 | if (memo) { |
119 | 124 | pm.memo = memo; |
@@ -182,6 +187,7 @@ transactionSDK.prototype.buildVote = function(address, vote, amount, confirmatio | ||
182 | 187 | }; |
183 | 188 | |
184 | 189 | transactionSDK.prototype.estimateFee = function(address, asset_amounts, confirmations=1) { |
190 | + console.log('estimateFee', arguments); | |
185 | 191 | let net = this.bytom.net; |
186 | 192 | let pm = {asset_amounts, confirmations}; |
187 | 193 |