-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into feature/tx-review
- Loading branch information
Showing
38 changed files
with
729 additions
and
308 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
apps/wallet-mobile/src/features/WalletManager/common/hooks/useBestBlock.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import {Chain} from '@yoroi/types' | ||
import {useQuery, UseQueryOptions} from 'react-query' | ||
|
||
import {useSelectedNetwork} from './useSelectedNetwork' | ||
|
||
export const useBestBlock = ({options}: {options?: UseQueryOptions<Chain.Cardano.BestBlock, Error>}) => { | ||
const {networkManager, network} = useSelectedNetwork() | ||
const query = useQuery<Chain.Cardano.BestBlock, Error>({ | ||
suspense: true, | ||
staleTime: 10_000, | ||
retry: 3, | ||
retryDelay: 1_000, | ||
queryKey: [network, 'tipStatus'], | ||
queryFn: () => networkManager.api.bestBlock(), | ||
...options, | ||
}) | ||
|
||
if (!query.data) throw new Error('Failed to retrive tipStatus') | ||
|
||
return query.data | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import {Chain} from '@yoroi/types' | ||
|
||
export const bestBlockMockResponse: Chain.Cardano.BestBlock = { | ||
epoch: 510, | ||
slot: 130081, | ||
globalSlot: 135086881, | ||
hash: 'ab0093eb78bcb0146355741388632eb50c69407df8fa32de85e5f198d725e8f4', | ||
height: 10850697, | ||
} |
Oops, something went wrong.