@stellar-broker/client 0.6.13 → 0.6.14
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/index.d.ts +1 -1
- package/src/mediator.js +8 -3
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
package/src/mediator.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {Asset, Keypair, Memo, Operation, TransactionBuilder, Horizon, Networks, StrKey, TimeoutInfinite} from '@stellar/stellar-sdk'
|
|
1
|
+
import {Asset, Keypair, Memo, Operation, TransactionBuilder, Horizon, Networks, StrKey, TimeoutInfinite, NotFoundError} 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'
|
|
@@ -267,7 +267,7 @@ export class Mediator {
|
|
|
267
267
|
//load account
|
|
268
268
|
let mediatorAccount = await this.loadAccount(address)
|
|
269
269
|
if (!mediatorAccount) {
|
|
270
|
-
//remove reference from local storage
|
|
270
|
+
//remove reference from local storage only if account doesn't exist on the ledger
|
|
271
271
|
localStorage.removeItem(this.storagePrefix + address)
|
|
272
272
|
throw new Error(`Mediator account ${address} doesn't exist on the ledger`)
|
|
273
273
|
}
|
|
@@ -353,9 +353,14 @@ export class Mediator {
|
|
|
353
353
|
*/
|
|
354
354
|
async loadAccount(address) {
|
|
355
355
|
try {
|
|
356
|
-
return this.constructor.createHorizon().loadAccount(address)
|
|
356
|
+
return await this.constructor.createHorizon().loadAccount(address)
|
|
357
357
|
} catch (e) {
|
|
358
|
+
if (e instanceof NotFoundError) {
|
|
359
|
+
console.warn(`Account ${address} doesn't exist on the ledger`)
|
|
360
|
+
return null
|
|
361
|
+
}
|
|
358
362
|
console.error(e)
|
|
363
|
+
throw e
|
|
359
364
|
}
|
|
360
365
|
}
|
|
361
366
|
|