@stellar-broker/client 0.6.11 → 0.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/mediator.js +14 -7
package/package.json
CHANGED
package/src/mediator.js
CHANGED
|
@@ -192,6 +192,20 @@ export class Mediator {
|
|
|
192
192
|
amount: fromStroops(this.sellingAmount)
|
|
193
193
|
}))
|
|
194
194
|
}
|
|
195
|
+
//create trustline for buying asset
|
|
196
|
+
if (!buyingAsset.isNative()) {
|
|
197
|
+
ops.push(Operation.changeTrust({
|
|
198
|
+
source: this.mediatorAddress,
|
|
199
|
+
asset: buyingAsset
|
|
200
|
+
}))
|
|
201
|
+
//if source account itself doesn't have trustline for buying asset
|
|
202
|
+
if (!findTrustline(sourceAccount, buyingAsset)) {
|
|
203
|
+
ops.push(Operation.changeTrust({
|
|
204
|
+
source: this.source,
|
|
205
|
+
asset: buyingAsset
|
|
206
|
+
}))
|
|
207
|
+
}
|
|
208
|
+
}
|
|
195
209
|
|
|
196
210
|
if (sourceAccount.signers.length > 1) { //multisig or delegated schema
|
|
197
211
|
let {thresholds, signers} = sourceAccount
|
|
@@ -235,13 +249,6 @@ export class Mediator {
|
|
|
235
249
|
}))
|
|
236
250
|
}
|
|
237
251
|
|
|
238
|
-
//create trustline for buying asset
|
|
239
|
-
if (!buyingAsset.isNative()) {
|
|
240
|
-
ops.push(Operation.changeTrust({
|
|
241
|
-
source: this.mediatorAddress,
|
|
242
|
-
asset: buyingAsset
|
|
243
|
-
}))
|
|
244
|
-
}
|
|
245
252
|
//store the record in the localStorage
|
|
246
253
|
localStorage.setItem(this.storagePrefix + this.mediatorAddress, this.source)
|
|
247
254
|
//confirm tx
|