File tree Expand file tree Collapse file tree 5 files changed +13
-11
lines changed Expand file tree Collapse file tree 5 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ import { useAccount } from "../../providers/AccountProvider";
25
25
import { router } from "expo-router" ;
26
26
import { SafeAreaView } from "react-native-safe-area-context" ;
27
27
import { CurrencyUtils } from "@ironfish/sdk" ;
28
+ import { CONFIRMATIONS } from "@/data/constants" ;
28
29
29
30
const MenuIcon = ( props : IconProps ) => < Icon { ...props } name = "menu-outline" /> ;
30
31
const SettingsIcon = ( props : IconProps ) => (
@@ -116,7 +117,11 @@ export default function Balances() {
116
117
) ;
117
118
}
118
119
119
- const isSyncing = getWalletStatusResult . data ?. status === "SCANNING" ;
120
+ const isSyncing =
121
+ account ?. head ?. sequence !== undefined &&
122
+ getWalletStatusResult . data ?. latestKnownBlock !== undefined &&
123
+ account . head . sequence <
124
+ Math . max ( getWalletStatusResult . data . latestKnownBlock - CONFIRMATIONS , 1 ) ;
120
125
const syncProgress = isSyncing
121
126
? ( ( account ?. head ?. sequence ?? 0 ) /
122
127
( getWalletStatusResult . data ?. latestKnownBlock ?? 1 ) ) *
Original file line number Diff line number Diff line change @@ -5,3 +5,6 @@ export enum Network {
5
5
6
6
export const IRON_ASSET_ID_HEX =
7
7
"51f33a2f14f92735e562dc658a5639279ddca3d5079a6d1242b2a588a9cbf44c" ;
8
+
9
+ // TODO: Make confirmations configurable
10
+ export const CONFIRMATIONS = 2 ;
Original file line number Diff line number Diff line change 1
- import { Network } from "../constants" ;
1
+ import { CONFIRMATIONS , Network } from "../constants" ;
2
2
import * as Crypto from "expo-crypto" ;
3
3
import * as Uint8ArrayUtils from "../../utils/uint8Array" ;
4
4
@@ -294,7 +294,7 @@ class OreowalletServer {
294
294
async getBalances (
295
295
network : Network ,
296
296
account : AccountInfo ,
297
- confirmations : number = 2 ,
297
+ confirmations : number = CONFIRMATIONS ,
298
298
) : Promise < GetBalancesResponse > {
299
299
const url = OREOWALLET_SERVER_URLS [ network ] + `getBalances` ;
300
300
Original file line number Diff line number Diff line change 8
8
decodeAccount ,
9
9
encodeAccount ,
10
10
} from "@ironfish/sdk" ;
11
- import { IRON_ASSET_ID_HEX , Network } from "../constants" ;
11
+ import { CONFIRMATIONS , IRON_ASSET_ID_HEX , Network } from "../constants" ;
12
12
import * as Uint8ArrayUtils from "../../utils/uint8Array" ;
13
13
import { AssetLoader } from "./assetLoader" ;
14
14
import { Output } from "../facades/wallet/types" ;
@@ -31,9 +31,6 @@ function assertStarted(state: WalletState): asserts state is StartedState {
31
31
}
32
32
}
33
33
34
- // TODO: Make confirmations configurable
35
- const CONFIRMATIONS = 2 ;
36
-
37
34
// Used when calculating a transaction's expiration sequence by adding it
38
35
// to the latest block sequence returned from the API.
39
36
const EXPIRATION_DELTA = 20 ;
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import {
11
11
encodeAccount ,
12
12
} from "@ironfish/sdk" ;
13
13
import { ChainProcessor } from "../chainProcessor" ;
14
- import { Network } from "../constants" ;
14
+ import { CONFIRMATIONS , Network } from "../constants" ;
15
15
import * as Uint8ArrayUtils from "../../utils/uint8Array" ;
16
16
import { LightBlock , LightTransaction } from "../walletServerApi/lightstreamer" ;
17
17
import { WriteQueue } from "./writeQueue" ;
@@ -37,9 +37,6 @@ function assertStarted(state: WalletState): asserts state is StartedState {
37
37
}
38
38
}
39
39
40
- // TODO: Make confirmations configurable
41
- const CONFIRMATIONS = 2 ;
42
-
43
40
// Used when calculating a transaction's expiration sequence by adding it
44
41
// to the latest block sequence returned from the API.
45
42
const EXPIRATION_DELTA = 20 ;
You can’t perform that action at this time.
0 commit comments