Skip to content

Commit

Permalink
fix: fixing token selector on send/receive page
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Nov 10, 2023
1 parent 280ef85 commit 84c6973
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions src/components/elements/input/token/selector.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
export let tokenOptions: Token[] | undefined = undefined
export let onTokenSelect: (token: Token) => void
export let showTokensWithoutBalance: boolean = false
export let includeEvmTokens: boolean = false
$: {
if (defaultToken) {
Expand Down Expand Up @@ -48,6 +49,8 @@
} else {
filteredTokens =
$tokens?.filter((token) => {
if (token.evm && !includeEvmTokens) return false
const blockchainMatches = token.chainId.equals($activeBlockchain.chainId)
let balanceExists
if (!showTokensWithoutBalance) {
Expand Down
9 changes: 6 additions & 3 deletions src/lib/evm/data/tokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
"zh": "EOS (Enterprise Operation System) \u662f\u4e00\u4e2a\u533a\u5757\u94fe\u667a\u80fd\u5408\u7ea6\u5e73\u53f0\uff0c\u7531Block.one \u5f00\u53d1\u3002\u5b83\u81f4\u529b\u4e8e\u4e3a\u9ad8\u6027\u80fd\u5206\u5e03\u5f0f\u5e94\u7528\u63d0\u4f9b\u533a\u5757\u94fe\u5e95\u5c42\u670d\u52a1\u3002"
}
},
"chain_rank": ""
"chain_rank": "",
"evm": true
},
{
"key": "evm-usdt",
Expand All @@ -33,7 +34,8 @@
"logo": "https://raw.githubusercontent.com/eoscafe/eos-airdrops/master/logos/USDT.png",
"created_at": "2022-08-15T13:34:32.002Z"
},
"chain_rank": ""
"chain_rank": "",
"evm": true
},
{
"key": "evm-tlos",
Expand All @@ -49,6 +51,7 @@
"logo": "",
"created_at": "2022-08-15T13:34:32.004Z"
},
"chain_rank": ""
"chain_rank": "",
"evm": true
}
]
6 changes: 0 additions & 6 deletions src/pages/transfer/form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,8 @@
let generatingOptions = false
$: console.log({ balances: $balances })
$: balance = $balances.find((balance) => balance.tokenKey === from?.key)
$: console.log({ balance, from })
console.log({ tokens: $tokens })
async function generateOptions(evmSession?: EvmSession) {
if (!!generatingOptions) return
Expand Down
3 changes: 2 additions & 1 deletion src/pages/transfer/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@
async function transfer() {
try {
transactResult = await transferManager?.transfer(deposit, received)
console.log({deposit})
transactResult = await transferManager?.transfer(deposit, from!.symbol)
} catch (error) {
return (errorMessage = `Could not transfer. Error: ${
error.underlyingError?.message || JSON.stringify(error) === '{}'
Expand Down
5 changes: 3 additions & 2 deletions src/pages/transfer/managers/transferManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ export abstract class TransferManager {
/* eslint-disable @typescript-eslint/no-unused-vars */
transfer(
_amount: string,
_tokenSymibol: Asset.SymbolType
_tokenSymbol: Asset.SymbolType,
_amountReceived?: string
): Promise<TransactResult | ethers.providers.TransactionResponse> {
throw new Error('transfer() not implemented')
}

transferFee(_amount?: string, tokenSymbol?: Asset.SymbolType): Promise<Asset> {
return Promise.resolve(Asset.from(0, tokenSymbol|| '4,EOS'))
return Promise.resolve(Asset.from(0, tokenSymbol || '4,EOS'))
}
/* eslint-enable @typescript-eslint/no-unused-vars */

Expand Down
1 change: 1 addition & 0 deletions src/stores/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface Token {
price?: number
logo?: string
balance?: Asset | string
evm?: boolean
}

export interface TokenKeyParams {
Expand Down

0 comments on commit 84c6973

Please sign in to comment.