Skip to content

Commit

Permalink
enhancement: added ability to pass string instead of balance
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Jul 26, 2023
1 parent 00a4a67 commit 5b2d246
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/elements/input/token/selector/row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
$balances && $balances.find((balance) => balance.tokenKey === token.key)?.quantity
}
if (balance) {
if (typeof balance === 'string') {
formattedTokenBalance = balance
} else if (balance) {
const tokenPrecision = balance.symbol.precision
const unitValue = balance.units.value
const fullTokenBalanceString = (
Expand Down
2 changes: 0 additions & 2 deletions src/pages/evm/swap.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@
try {
ethWalletAccount = await connectEthWallet()
} catch (e) {
console.log({code: e.code})
if (e.code === -32002) {
return
}
Expand Down
2 changes: 1 addition & 1 deletion src/pages/evm/swap/form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
...$systemToken,
name: 'EOS (EVM)',
contract: 'eosio.evm',
balance: evmBalance,
balance: evmBalance || 'Connect',
}
fromOptions = [$systemToken, evmToken]
if (from?.name === 'EOS (EVM)') {
Expand Down
2 changes: 1 addition & 1 deletion src/stores/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface Token {
name: NameType
price?: number
logo?: string
balance?: Asset
balance?: Asset | string
}

export interface TokenKeyParams {
Expand Down

0 comments on commit 5b2d246

Please sign in to comment.