mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-03-21 22:58:49 +00:00
stellar sync error fix
This commit is contained in:
parent
9237e99f0c
commit
98f3046e04
1 changed files with 46 additions and 10 deletions
|
@ -572,14 +572,29 @@ class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
try {
|
try {
|
||||||
List<Tuple2<SWTransaction.Transaction, SWAddress.Address?>>
|
List<Tuple2<SWTransaction.Transaction, SWAddress.Address?>>
|
||||||
transactionList = [];
|
transactionList = [];
|
||||||
|
Page<OperationResponse> payments;
|
||||||
Page<OperationResponse> payments = await stellarSdk.payments
|
try {
|
||||||
.forAccount(await getAddressSW())
|
payments = await stellarSdk.payments
|
||||||
.order(RequestBuilderOrder.DESC)
|
.forAccount(await getAddressSW())
|
||||||
.execute()
|
.order(RequestBuilderOrder.DESC)
|
||||||
.onError(
|
.execute()
|
||||||
(error, stackTrace) => throw ("Could not fetch transactions"));
|
.onError((error, stackTrace) => throw error!);
|
||||||
|
} catch (e) {
|
||||||
|
if (e is ErrorResponse &&
|
||||||
|
e.body.contains("The resource at the url requested was not found. "
|
||||||
|
"This usually occurs for one of two reasons: "
|
||||||
|
"The url requested is not valid, or no data in our database "
|
||||||
|
"could be found with the parameters provided.")) {
|
||||||
|
// probably just doesn't have any history yet or whatever stellar needs
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Logging.instance.log(
|
||||||
|
"Stellar $walletName $walletId failed to fetch transactions",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
for (OperationResponse response in payments.records!) {
|
for (OperationResponse response in payments.records!) {
|
||||||
// PaymentOperationResponse por;
|
// PaymentOperationResponse por;
|
||||||
if (response is PaymentOperationResponse) {
|
if (response is PaymentOperationResponse) {
|
||||||
|
@ -717,8 +732,29 @@ class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
|
|
||||||
Future<void> updateBalance() async {
|
Future<void> updateBalance() async {
|
||||||
try {
|
try {
|
||||||
AccountResponse accountResponse =
|
AccountResponse accountResponse;
|
||||||
await stellarSdk.accounts.account(await getAddressSW());
|
|
||||||
|
try {
|
||||||
|
accountResponse = await stellarSdk.accounts
|
||||||
|
.account(await getAddressSW())
|
||||||
|
.onError((error, stackTrace) => throw error!);
|
||||||
|
} catch (e) {
|
||||||
|
if (e is ErrorResponse &&
|
||||||
|
e.body.contains("The resource at the url requested was not found. "
|
||||||
|
"This usually occurs for one of two reasons: "
|
||||||
|
"The url requested is not valid, or no data in our database "
|
||||||
|
"could be found with the parameters provided.")) {
|
||||||
|
// probably just doesn't have any history yet or whatever stellar needs
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
Logging.instance.log(
|
||||||
|
"Stellar $walletName $walletId failed to fetch transactions",
|
||||||
|
level: LogLevel.Warning,
|
||||||
|
);
|
||||||
|
rethrow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (Balance balance in accountResponse.balances) {
|
for (Balance balance in accountResponse.balances) {
|
||||||
switch (balance.assetType) {
|
switch (balance.assetType) {
|
||||||
case Asset.TYPE_NATIVE:
|
case Asset.TYPE_NATIVE:
|
||||||
|
|
Loading…
Reference in a new issue