forked from forbole/big-dipper-2.0-cosmos
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move cw20 token info to new screen
- Loading branch information
Showing
19 changed files
with
225 additions
and
120 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"overview": "CW20 Token Details", | ||
"name": "Name", | ||
"denom": "Denom", | ||
"exponent": "Exponent", | ||
"circulatingSupply": "Circulating Supply", | ||
"minter": "Minter", | ||
"maxSupply": "Maximum Supply", | ||
"projectUrl": "Project URL" | ||
} |
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 TokenDetails from '@src/screens/token_details'; | ||
|
||
const TokenDetailsPage = () => { | ||
return ( | ||
<TokenDetails /> | ||
); | ||
}; | ||
|
||
export default TokenDetailsPage; |
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,38 @@ | ||
import { | ||
useState, useEffect, | ||
} from 'react'; | ||
import * as R from 'ramda'; | ||
import { useRouter } from 'next/router'; | ||
import { Cw20TokenInfo } from './types'; | ||
import { fetchCW20TokenInfo } from './utils'; | ||
|
||
const initialState: Cw20TokenInfo = { | ||
address: '', | ||
name: '', | ||
denom: '', | ||
exponent: 0, | ||
circulatingSupply: 0, | ||
}; | ||
|
||
export const useTokenDetails = () => { | ||
const router = useRouter(); | ||
const [state, setState] = useState<Cw20TokenInfo>(initialState); | ||
|
||
const handleSetState = (stateChange: any) => { | ||
setState((prevState) => R.mergeDeepLeft(stateChange, prevState)); | ||
}; | ||
|
||
useEffect(() => { | ||
fetchTokenInfo(); | ||
}, [router.query.address]); | ||
|
||
const fetchTokenInfo = async () => { | ||
const address = router.query.address as string; | ||
const tokenInfo = await fetchCW20TokenInfo(address); | ||
handleSetState(tokenInfo); | ||
}; | ||
|
||
return { | ||
state, | ||
}; | ||
}; |
Oops, something went wrong.