-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dev See merge request ergo/rosen-bridge/ui!332
- Loading branch information
Showing
21 changed files
with
239 additions
and
110 deletions.
There are no files selected for viewing
File renamed without changes.
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,33 @@ | ||
import { useMemo } from 'react'; | ||
import { Network } from '@rosen-ui/types'; | ||
|
||
import useInfo from './useInfo'; | ||
|
||
type Addresses = { | ||
[key in 'cold' | 'hot']: { | ||
[key in Network]?: string; | ||
}; | ||
}; | ||
|
||
/** | ||
* returns hot and cold addresses | ||
*/ | ||
export const useAddresses = () => { | ||
const { data } = useInfo(); | ||
return useMemo(() => { | ||
const addresses: Addresses = { | ||
cold: {}, | ||
hot: {}, | ||
}; | ||
|
||
data?.balances.cold.forEach((item) => { | ||
addresses.cold[item.chain] = item.address; | ||
}); | ||
|
||
data?.balances.hot.forEach((item) => { | ||
addresses.hot[item.chain] = item.address; | ||
}); | ||
|
||
return addresses; | ||
}, [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
Oops, something went wrong.