Skip to content

Commit

Permalink
REX only supported on eos and jungle4
Browse files Browse the repository at this point in the history
  • Loading branch information
apporc committed Jun 25, 2024
1 parent 3868746 commit bb613ae
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/components/layout/navigation/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import {activeBlockchain, preferences} from '~/store'
import type {NavigationItem} from '~/ui-types'
import {banxaIsAvailable} from '~/lib/banxa'
import {rexIsAvailable} from '~/lib/rex'
import MediaQuery from '~/components/utils/media-query.svelte'
import NavigationContent from '~/components/layout/navigation/content.svelte'
Expand All @@ -30,11 +31,15 @@
name: 'Transfer',
path: '/transfer',
},
{
icon: 'battery-charging',
name: 'Earn',
path: '/earn',
},
...(rexIsAvailable($activeBlockchain)
? [
{
icon: 'battery-charging',
name: 'Earn',
path: '/earn',
},
]
: []),
...(banxaIsAvailable($activeBlockchain)
? [
Expand Down
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ export interface ChainConfig {
banxaEnabled?: boolean
/** Banxa coin_code */
banxa_coin_code?: string
/** Is REX available for this chain */
rexEnabled?: boolean
}

/** Supported chains. */
Expand Down Expand Up @@ -105,6 +107,7 @@ export const chains: ChainConfig[] = [
bloksUrl: 'https://bloks.io',
balanceProviders: new Set([BalanceProviders.LightAPI]),
banxaEnabled: true,
rexEnabled: true,
},
{
id: 'fio',
Expand Down Expand Up @@ -172,6 +175,7 @@ export const chains: ChainConfig[] = [
nodeUrl: 'https://jungle4.greymass.com',
testnet: true,
bloksUrl: 'https://eosauthority.com/?network=jungle',
rexEnabled: true,
},
{
id: 'proton',
Expand Down
3 changes: 3 additions & 0 deletions src/lib/rex.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export const rexIsAvailable = (chainData: ChainConfig | undefined): boolean => {
return !!chainData?.rexEnabled
}
6 changes: 6 additions & 0 deletions src/pages/earn/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import {balances} from '~/stores/balances'
import {REXDeposit, REXWithdraw, REXBUYREX, REXSELLREX} from '~/abi-types'
import type {FormTransaction} from '~/ui-types'
import {rexIsAvailable} from '~/lib/rex'
import Page from '~/components/layout/page.svelte'
import TransactionForm from '~/components/elements/form/transaction.svelte'
Expand All @@ -28,6 +29,11 @@
let onConfirmBack: () => void
let error: string = ''
$: {
if (!rexIsAvailable($activeBlockchain)) {
window.location.href = window.origin
}
}
const availableSystemTokens: Readable<Asset> = derived(
[balances, currentAccount, systemTokenKey, activeBlockchain],
([$balances, $currentAccount, $systemTokenKey, $activeBlockchain]) => {
Expand Down

0 comments on commit bb613ae

Please sign in to comment.