14.05.2026 rip
This commit is contained in:
@@ -37,6 +37,8 @@ export interface ChainConfig {
|
||||
unit: string
|
||||
/** Accent color used for the chain dot in dropdowns */
|
||||
color: string
|
||||
/** Decimal places for the native coin (used to convert human input → base units) */
|
||||
nativeDecimals: number
|
||||
}
|
||||
|
||||
export const CHAIN_CONFIG: Record<Chain, ChainConfig> = {
|
||||
@@ -48,6 +50,7 @@ export const CHAIN_CONFIG: Record<Chain, ChainConfig> = {
|
||||
addressPlaceholder: '0x…',
|
||||
unit: 'wei',
|
||||
color: '#627EEA',
|
||||
nativeDecimals: 18,
|
||||
},
|
||||
BSC: {
|
||||
label: 'BNB Chain',
|
||||
@@ -57,6 +60,7 @@ export const CHAIN_CONFIG: Record<Chain, ChainConfig> = {
|
||||
addressPlaceholder: '0x…',
|
||||
unit: 'wei',
|
||||
color: '#F3BA2F',
|
||||
nativeDecimals: 18,
|
||||
},
|
||||
BTC: {
|
||||
label: 'Bitcoin',
|
||||
@@ -66,6 +70,7 @@ export const CHAIN_CONFIG: Record<Chain, ChainConfig> = {
|
||||
addressPlaceholder: 'bc1q…',
|
||||
unit: 'satoshi',
|
||||
color: '#F7931A',
|
||||
nativeDecimals: 8,
|
||||
},
|
||||
TRX: {
|
||||
label: 'Tron',
|
||||
@@ -75,6 +80,7 @@ export const CHAIN_CONFIG: Record<Chain, ChainConfig> = {
|
||||
addressPlaceholder: 'T…',
|
||||
unit: 'sun',
|
||||
color: '#FF060A',
|
||||
nativeDecimals: 6,
|
||||
},
|
||||
SOL: {
|
||||
label: 'Solana',
|
||||
@@ -84,6 +90,7 @@ export const CHAIN_CONFIG: Record<Chain, ChainConfig> = {
|
||||
addressPlaceholder: 'Fg3R…',
|
||||
unit: 'lamport',
|
||||
color: '#9945FF',
|
||||
nativeDecimals: 9,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -96,7 +103,6 @@ export const TICKER_TO_CHAIN: Record<string, Chain> = {
|
||||
SOL: 'SOL',
|
||||
TRX: 'TRX',
|
||||
BNB: 'BSC',
|
||||
ARB: 'ETH',
|
||||
}
|
||||
|
||||
// ─── API request / response types ───────────────────────────────────────────
|
||||
|
||||
@@ -88,11 +88,19 @@ export function SendModal({ open, onClose, network, tokens = [], initialToken =
|
||||
if (openDropdown) { setOpenDropdown(null) } else { onClose() }
|
||||
}
|
||||
|
||||
function toBaseUnits(value: string, decimals: number): string {
|
||||
const [intPart, fracPart = ''] = value.split('.')
|
||||
const frac = fracPart.slice(0, decimals).padEnd(decimals, '0')
|
||||
return (BigInt(intPart || '0') * (10n ** BigInt(decimals)) + BigInt(frac || '0')).toString()
|
||||
}
|
||||
|
||||
function handleSubmit() {
|
||||
const isNative = selectedToken === ''
|
||||
const convertedAmount = isNative ? toBaseUnits(amount, cfg.nativeDecimals) : amount
|
||||
mutation.mutate({
|
||||
chain: network,
|
||||
to: address,
|
||||
amount,
|
||||
amount: convertedAmount,
|
||||
...(selectedToken ? { token: selectedToken } : {}),
|
||||
...(cfg.hasFeeTier ? { feeTier: speed } : {}),
|
||||
})
|
||||
|
||||
@@ -2,7 +2,7 @@ import btc from '@shared/assets/btc.svg'
|
||||
import eth from '@shared/assets/eth.svg'
|
||||
import sol from '@shared/assets/sol.svg'
|
||||
import trx from '@shared/assets/trx.svg'
|
||||
import arb from '@shared/assets/arb.svg'
|
||||
import bnb from '@shared/assets/bnb.svg'
|
||||
|
||||
export interface Token {
|
||||
ticker: string
|
||||
@@ -21,5 +21,5 @@ export const TOKENS: readonly Token[] = [
|
||||
{ ticker: 'ETH', name: 'Ethereum', logo: eth, color: '#627EEA', price: '$2,053.97', change: -0.12, bal: '0.07636', usd: '$156.51', fav: false },
|
||||
{ ticker: 'SOL', name: 'Solana', logo: sol, color: '#9945FF', price: '$163.84', change: -1.57, bal: '0.07636', usd: '$156.51', fav: false },
|
||||
{ ticker: 'TRX', name: 'Tron', logo: trx, color: '#FF060A', price: '$0.1197', change: 1.33, bal: '0.07636', usd: '$156.51', fav: false },
|
||||
{ ticker: 'ARB', name: 'Arbitrum', logo: arb, color: '#4A6DFF', price: '$0.9214', change: 2.56, bal: '0.07636', usd: '$156.51', fav: false },
|
||||
{ ticker: 'BNB', name: 'BNB Chain', logo: bnb, color: '#F3BA2F', price: '$0.00', change: 0, bal: '0.00000', usd: '$0.00', fav: false },
|
||||
] as const
|
||||
|
||||
@@ -3,10 +3,10 @@ import { CHAINS } from '@features/wallet'
|
||||
import { TOKENS } from './tokens'
|
||||
import type { WalletBalanceData } from '@features/wallet'
|
||||
|
||||
const PRICE_SYMBOLS = ['BTC', 'ETH', 'SOL', 'TRX', 'ARB']
|
||||
const PRICE_SYMBOLS = ['BTC', 'ETH', 'SOL', 'TRX', 'BNB']
|
||||
|
||||
type ChainSource =
|
||||
| { chain: 'BTC' | 'ETH' | 'SOL' | 'TRX'; type: 'native' }
|
||||
| { chain: 'BTC' | 'ETH' | 'SOL' | 'TRX' | 'BSC'; type: 'native' }
|
||||
| { chain: 'ETH'; type: 'token'; symbol: string }
|
||||
|
||||
const CHAIN_MAP: Record<string, ChainSource> = {
|
||||
@@ -14,7 +14,7 @@ const CHAIN_MAP: Record<string, ChainSource> = {
|
||||
ETH: { chain: 'ETH', type: 'native' },
|
||||
SOL: { chain: 'SOL', type: 'native' },
|
||||
TRX: { chain: 'TRX', type: 'native' },
|
||||
ARB: { chain: 'ETH', type: 'token', symbol: 'ARB' },
|
||||
BNB: { chain: 'BSC', type: 'native' },
|
||||
}
|
||||
|
||||
function formatUsd(value: number): string {
|
||||
|
||||
@@ -59,7 +59,6 @@ export function TokenTable() {
|
||||
<th className={styles.thStar}>☆</th>
|
||||
<th>Токены</th>
|
||||
<th className={styles.right}>Цена</th>
|
||||
<th className={styles.right}>Изменение</th>
|
||||
<th className={styles.right}>Баланс</th>
|
||||
<th className={styles.center}></th>
|
||||
</tr>
|
||||
@@ -80,7 +79,7 @@ export function TokenTable() {
|
||||
<td>
|
||||
<div className={styles.tokId}>
|
||||
<div className={styles.tokLogo} style={{ background: t.color }}>
|
||||
{t.logo && <img src={t.logo} alt={t.ticker} className={t.ticker === 'ARB' ? styles.arb : ''} />}
|
||||
{t.logo && <img src={t.logo} alt={t.ticker} className={''} />}
|
||||
</div>
|
||||
<div className={styles.balCol}>
|
||||
<b className={styles.cardTicker}>{t.ticker}</b>
|
||||
@@ -91,11 +90,6 @@ export function TokenTable() {
|
||||
<td className={styles.right}>
|
||||
<span className={styles.price}>{t.price}</span>
|
||||
</td>
|
||||
<td className={styles.right}>
|
||||
<span className={`${styles.change} ${t.change >= 0 ? styles.up : styles.dn}`}>
|
||||
{t.change >= 0 ? '↑' : '↓'} {t.change >= 0 ? '+' : ''}{t.change}%
|
||||
</span>
|
||||
</td>
|
||||
<td className={styles.right}>
|
||||
<div className={styles.balCol}>
|
||||
<b>{t.bal}</b>
|
||||
@@ -141,7 +135,7 @@ export function TokenTable() {
|
||||
</button>
|
||||
<div className={styles.tokLogo} style={{ background: t.color }}>
|
||||
{t.logo
|
||||
? <img src={t.logo} alt={t.ticker} className={t.ticker === 'ARB' ? styles.arb : ''} />
|
||||
? <img src={t.logo} alt={t.ticker} className={''} />
|
||||
: t.ticker[0]}
|
||||
</div>
|
||||
<div className={styles.cardInfo}>
|
||||
@@ -154,12 +148,7 @@ export function TokenTable() {
|
||||
</div>
|
||||
<div className={styles.cardBot}>
|
||||
<span className={styles.cardPrice}>{t.price}</span>
|
||||
<div className={styles.cardBotRight}>
|
||||
<span className={styles.cardBalUsd}>{t.usd}</span>
|
||||
<span className={`${styles.change} ${t.change >= 0 ? styles.up : styles.dn}`}>
|
||||
{t.change >= 0 ? '↑' : '↓'} {Math.abs(t.change)}%
|
||||
</span>
|
||||
</div>
|
||||
<span className={styles.cardBalUsd}>{t.usd}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user