Skip to content

Commit

Permalink
enhancement: getting chain swapping working better
Browse files Browse the repository at this point in the history
  • Loading branch information
dafuga committed Nov 24, 2023
1 parent e7e85de commit e3c47ad
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ export async function activate(id: SessionLike) {

if (get(activeEvmSession)) {
activeEvmSession.set(undefined)
startEvmSession()
await startEvmSession()
}
}
6 changes: 5 additions & 1 deletion src/components/layout/account/sidebar.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<script>
import {activate} from '~/auth'
import type {SessionLike} from '~/auth'
import {activeSession} from '~/store'
import { fetchBalances } from '~/stores/balances'
import Icon from '~/components/elements/icon.svelte'
Expand All @@ -9,7 +11,9 @@
export let open = false
function onSelect(session: SessionLike) {
activate(session)
activate(session).then(() => {
fetchBalances($activeSession!)
})
open = false
}
</script>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/balance-providers/light-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class LightAPIProvider implements BalanceProvider {

async fetchData(account: Name) {
//Example: https://eos.light-api.net/api/account/eos/teamgreymass
const apiUrl = `https://balances.unicove.com/api/balances/${this.chain.id}/danchorsmart`
const apiUrl = `https://balances.unicove.com/api/balances/${this.chain.id}/${account}`

return await fetch(apiUrl)
.then(async (response) => {
Expand Down
7 changes: 7 additions & 0 deletions src/pages/transfer/form.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@
}
}
$: {
const fromInOptions = fromOptions.find(token => from?.symbol.equals(token.symbol) && token.name !== from?.name)
if (!fromInOptions) {
toOptions = []
}
}
$: {
if ($tokens) {
generateOptions()
Expand Down
2 changes: 1 addition & 1 deletion src/pages/transfer/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
step = 'success'
}
function handleBack(updateBalances = false) {
function handleBack() {
step = 'form'
errorMessage = undefined
transactResult = undefined
Expand Down
5 changes: 0 additions & 5 deletions src/pages/transfer/managers/eosEvmBridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ export class EosEvmBridge extends TransferManager {
})
}

async updateBalances() {
updateEvmBalance()
updateActiveAccount()
}

updateMainBalance() {
return updateEvmBalance()
}
Expand Down

0 comments on commit e3c47ad

Please sign in to comment.