@stellar-broker/client 0.6.8 → 0.6.9
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 +5 -4
package/package.json
CHANGED
package/src/mediator.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {Asset, Keypair, Memo, Operation, TransactionBuilder, Horizon, Networks, StrKey,
|
|
1
|
+
import {Asset, Keypair, Memo, Operation, TransactionBuilder, Horizon, Networks, StrKey, TimeoutInfinite} from '@stellar/stellar-sdk'
|
|
2
2
|
import {fromStroops, toStroops} from './stroops.js'
|
|
3
3
|
import {convertToStellarAsset} from './asset.js'
|
|
4
4
|
import {AuthorizationWrapper} from './authorization.js'
|
|
5
5
|
|
|
6
6
|
//additional XLM amount to cover tx fees
|
|
7
|
-
const defaultFeesReserve =
|
|
7
|
+
const defaultFeesReserve = 2.5
|
|
8
8
|
const defaultStoragePrefix = 'msb_'
|
|
9
9
|
|
|
10
10
|
export class Mediator {
|
|
@@ -137,7 +137,8 @@ export class Mediator {
|
|
|
137
137
|
if (!sourceAccount)
|
|
138
138
|
throw new Error('Mediator account doesn\'t exist on the ledger')
|
|
139
139
|
//calculate fees reserve + account entries reserve
|
|
140
|
-
const
|
|
140
|
+
const subentries = sourceAccount.signers.length - 1 + [this.sellingAsset, this.buyingAsset].filter(a => !a.isNative()).length
|
|
141
|
+
const feesReserve = defaultFeesReserve + 0.5 * subentries
|
|
141
142
|
const ops = []
|
|
142
143
|
//create new random keypair for the trade
|
|
143
144
|
this.mediator = Keypair.random()
|
|
@@ -310,7 +311,7 @@ export class Mediator {
|
|
|
310
311
|
fee: '1000000',
|
|
311
312
|
networkPassphrase: Networks.PUBLIC
|
|
312
313
|
})
|
|
313
|
-
builder.setTimeout(
|
|
314
|
+
builder.setTimeout(TimeoutInfinite)
|
|
314
315
|
//add memo if needed
|
|
315
316
|
if (memo) {
|
|
316
317
|
builder.addMemo(Memo.text(memo))
|