Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add to verified when whitelist #62

Merged
merged 1 commit into from
Jan 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions src/forms/SwapToken.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -69,3 +69,29 @@ $name: 12px;
color: $blue;
font-size: 12px;
}

.verified_box {
width: 54px;
height: 18px;
margin-left: 10px;
padding: 5px 7px 2px 7px;
border-radius: 9px;
background-color: #0222ba;
text-align: center;
display: flex;
align-items: center;
}

.verified {
width: 40px;
height: 14px;
font-family: OpenSans;
font-size: 10px;
font-weight: bold;
font-stretch: normal;
font-style: normal;
line-height: normal;
letter-spacing: normal;
text-align: center;
color: #ffffff;
}
13 changes: 13 additions & 0 deletions src/forms/SwapToken.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { GetTokenSvg } from "../helpers/token"
interface Props extends AssetItem {
contract_addr?: string
icon: string[]
verified: boolean
formatTokenName?: (symbol: string) => string
}

Expand All @@ -15,6 +16,7 @@ const SwapToken = ({
balance,
contract_addr,
icon,
verified,
formatTokenName,
}: Props) => {
const symbols = symbol.split("-")
Expand All @@ -34,6 +36,12 @@ const SwapToken = ({
<div className={styles.name}>
<p>{formatTokenName?.(symbols[0]) ?? lookupSymbol(symbols[0])}</p>
</div>
{verified ? (
<div className={styles.verified_box}>
<p className={styles.verified}>verified</p>
</div>
) : undefined}

{symbols.length > 1 ? (
<div className={styles.divide}>
<span>-</span>
Expand All @@ -55,6 +63,11 @@ const SwapToken = ({
</p>
</div>
) : undefined}
{symbols.length > 1 && verified ? (
<div className={styles.verified_box}>
<p className={styles.verified}>verified</p>
</div>
) : undefined}
</div>
</div>
<div className={styles.token_address}>
Expand Down
3 changes: 3 additions & 0 deletions src/forms/SwapTokens.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ const SwapTokens = ({
name: "",
contract_addr: "",
icon: [""],
verified: false,
}

if (type === Type.WITHDRAW) {
Expand All @@ -172,6 +173,7 @@ const SwapTokens = ({
icon: tokenInfoList
? [tokenInfoList[0].icon, tokenInfoList[1].icon]
: ["", ""],
verified: false,
}
} else {
const tokenInfo = tokenInfos.get(item)
Expand All @@ -181,6 +183,7 @@ const SwapTokens = ({
name: tokenInfo?.name || "",
contract_addr: isNativeToken(item) ? "" : item,
icon: [tokenInfo ? tokenInfo.icon : ""],
verified: tokenInfo?.verified || false,
}
}

Expand Down
1 change: 1 addition & 0 deletions src/rest/useAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ interface TokenResult {
total_supply: string
contract_addr: string
icon: string
verified: boolean
}

interface PoolResponse {
Expand Down
152 changes: 135 additions & 17 deletions src/rest/usePairs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ interface TokenInfo {
contract_addr: string
decimals: number
icon: string
verified: boolean
}

interface PairsResponse {
Expand All @@ -78,72 +79,185 @@ interface TokenResult {
total_supply: string
contract_addr: string
icon: string
verified: boolean
}

export let tokenInfos: Map<string, TokenInfo> = new Map<string, TokenInfo>([
[
LUNA,
{ contract_addr: ULUNA, symbol: LUNA, name: ULUNA, decimals: 6, icon: "" },
{
contract_addr: ULUNA,
symbol: LUNA,
name: ULUNA,
decimals: 6,
icon: "",
verified: true,
},
],
[
KRT,
{ contract_addr: UKRW, symbol: KRT, name: UKRW, decimals: 6, icon: "" },
{
contract_addr: UKRW,
symbol: KRT,
name: UKRW,
decimals: 6,
icon: "",
verified: true,
},
],
[
MNT,
{ contract_addr: UMNT, symbol: MNT, name: UMNT, decimals: 6, icon: "" },
{
contract_addr: UMNT,
symbol: MNT,
name: UMNT,
decimals: 6,
icon: "",
verified: true,
},
],
[
SDT,
{ contract_addr: USDR, symbol: SDT, name: USDR, decimals: 6, icon: "" },
{
contract_addr: USDR,
symbol: SDT,
name: USDR,
decimals: 6,
icon: "",
verified: true,
},
],
[
UST,
{ contract_addr: UUSD, symbol: UST, name: UUSD, decimals: 6, icon: "" },
{
contract_addr: UUSD,
symbol: UST,
name: UUSD,
decimals: 6,
icon: "",
verified: true,
},
],
[
AUT,
{ contract_addr: UAUD, symbol: AUT, name: UAUD, decimals: 6, icon: "" },
{
contract_addr: UAUD,
symbol: AUT,
name: UAUD,
decimals: 6,
icon: "",
verified: true,
},
],
[
CAT,
{ contract_addr: UCAD, symbol: CAT, name: UCAD, decimals: 6, icon: "" },
{
contract_addr: UCAD,
symbol: CAT,
name: UCAD,
decimals: 6,
icon: "",
verified: true,
},
],
[
CHT,
{ contract_addr: UCHF, symbol: CHT, name: UCHF, decimals: 6, icon: "" },
{
contract_addr: UCHF,
symbol: CHT,
name: UCHF,
decimals: 6,
icon: "",
verified: true,
},
],
[
CNT,
{ contract_addr: UCNY, symbol: CNT, name: UCNY, decimals: 6, icon: "" },
{
contract_addr: UCNY,
symbol: CNT,
name: UCNY,
decimals: 6,
icon: "",
verified: true,
},
],
[
EUT,
{ contract_addr: UEUR, symbol: EUT, name: UEUR, decimals: 6, icon: "" },
{
contract_addr: UEUR,
symbol: EUT,
name: UEUR,
decimals: 6,
icon: "",
verified: true,
},
],
[
GBT,
{ contract_addr: UGBP, symbol: GBT, name: UGBP, decimals: 6, icon: "" },
{
contract_addr: UGBP,
symbol: GBT,
name: UGBP,
decimals: 6,
icon: "",
verified: true,
},
],
[
HKT,
{ contract_addr: UHKD, symbol: HKT, name: UHKD, decimals: 6, icon: "" },
{
contract_addr: UHKD,
symbol: HKT,
name: UHKD,
decimals: 6,
icon: "",
verified: true,
},
],
[
INT,
{ contract_addr: UINR, symbol: INT, name: UINR, decimals: 6, icon: "" },
{
contract_addr: UINR,
symbol: INT,
name: UINR,
decimals: 6,
icon: "",
verified: true,
},
],
[
JPT,
{ contract_addr: UJPY, symbol: JPT, name: UJPY, decimals: 6, icon: "" },
{
contract_addr: UJPY,
symbol: JPT,
name: UJPY,
decimals: 6,
icon: "",
verified: true,
},
],
[
SGT,
{ contract_addr: USGD, symbol: SGT, name: USGD, decimals: 6, icon: "" },
{
contract_addr: USGD,
symbol: SGT,
name: USGD,
decimals: 6,
icon: "",
verified: true,
},
],
[
THT,
{ contract_addr: UTHB, symbol: THT, name: UTHB, decimals: 6, icon: "" },
{
contract_addr: UTHB,
symbol: THT,
name: UTHB,
decimals: 6,
icon: "",
verified: true,
},
],
])

Expand Down Expand Up @@ -176,6 +290,7 @@ export default () => {
contract_addr: info.token.contract_addr,
decimals: 6,
icon: "",
verified: false,
}
if (tokenResult) {
tokenInfo = {
Expand All @@ -184,6 +299,7 @@ export default () => {
contract_addr: info.token.contract_addr,
decimals: tokenResult.decimals,
icon: tokenResult.icon,
verified: tokenResult.verified,
}
}
tokenInfos.set(info.token.contract_addr, tokenInfo)
Expand Down Expand Up @@ -218,7 +334,7 @@ export default () => {
console.log(error)
}

; (networkName === "testnet" ? testnetTokens : mainnetTokens).forEach(
;(networkName === "testnet" ? testnetTokens : mainnetTokens).forEach(
(token) => {
if (
token !== undefined &&
Expand All @@ -231,6 +347,7 @@ export default () => {
name: token.name,
decimals: token.decimals ? token.decimals : 6,
icon: "",
verified: false,
})
}
}
Expand Down Expand Up @@ -270,6 +387,7 @@ export default () => {
symbol: lpTokenInfo.symbol,
decimals: lpTokenInfo.decimals,
icon: "",
verified: false,
})

let pair: Pair = {
Expand Down