Skip to content

Commit

Permalink
Support Banxa on Interlay (#1458)
Browse files Browse the repository at this point in the history
* refactor: remove redundant env variable and UI component

* refactor: remove redundant URL parameter

* update translation file

* revert change to wallet parameter

* update translation parameter

* fix: missed file save
  • Loading branch information
tomjeatt authored Jul 18, 2023
1 parent 2d0f3de commit 278f54f
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 149 deletions.
1 change: 0 additions & 1 deletion .env.dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@

/* FEATURE FLAGS */
REACT_APP_FEATURE_FLAG_BANXA=enabled
REACT_APP_FEATURE_FLAG_STRATEGIES=enabled
REACT_APP_FEATURE_FLAG_ONBOARDING=enabled

Expand Down
4 changes: 2 additions & 2 deletions src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -632,10 +632,10 @@
},
"fund_wallet_modal": {
"buy": "Buy",
"buy_via_banxa": "Purchase KINT via Banxa.",
"buy_via_banxa": "Purchase {{ticker}} via Banxa.",
"banxa_leading_solution": "Banxa is the leading global Web3 on-and-off ramp solution.",
"exchange": "Exchange",
"please_check_terms": "Please check the individual terms and conditions of each exchange before you buy / trade {{token}}."
"please_check_terms": "Please check the individual terms and conditions of each exchange before you buy / trade {{ticker}}."
},
"wallet": {
"available_assets": "Available assets",
Expand Down
4 changes: 2 additions & 2 deletions src/components/FundWallet/FundWallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const getData = (method: FundWalletMethod, entities: UseEntitiesResult, t: TFunc
title: t('fund_wallet_modal.buy'),
description: (
<Flex direction='column' gap='spacing1'>
<P color='tertiary'>{t('fund_wallet_modal.buy_via_banxa')}</P>
<P color='tertiary'>{t('fund_wallet_modal.buy_via_banxa', { ticker: GOVERNANCE_TOKEN.ticker })}</P>
<P color='tertiary'>{t('fund_wallet_modal.banxa_leading_solution')}</P>
</Flex>
),
Expand All @@ -29,7 +29,7 @@ const getData = (method: FundWalletMethod, entities: UseEntitiesResult, t: TFunc
exchange: {
title: t('fund_wallet_modal.exchange'),
description: (
<P color='tertiary'>{t('fund_wallet_modal.please_check_terms', { token: GOVERNANCE_TOKEN.ticker })}</P>
<P color='tertiary'>{t('fund_wallet_modal.please_check_terms', { ticker: GOVERNANCE_TOKEN.ticker })}</P>
),
entities: entities.exchanges
}
Expand Down
2 changes: 1 addition & 1 deletion src/config/links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const INTERLAY_VAULT_DOCS_LINK = 'https://docs.interlay.io/#/vault/overview';
const INTERLAY_DOS_AND_DONTS_DOCS_LINK = 'https://docs.interlay.io/#/vault/installation?id=dos-and-donts';
const INTERLAY_WHITEPAPPER = 'https://gateway.pinata.cloud/ipfs/QmWp62gdLssFpAoG2JqK8sy3m3rTRUa8LyzoSY8ZFisYNB';

const BANXA_LINK = 'http://talisman.banxa.com/';
const BANXA_LINK = 'http://checkout.banxa.com/';

const GEOBLOCK_API_ENDPOINT = '/check_access';
const GEOBLOCK_REDIRECTION_LINK = 'https://www.interlay.io/geoblock';
Expand Down
137 changes: 0 additions & 137 deletions src/parts/Topbar/GetGovernanceTokenUI/index.tsx

This file was deleted.

5 changes: 1 addition & 4 deletions src/parts/Topbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ import { BitcoinNetwork } from '@/types/bitcoin';
import { POLKADOT } from '@/utils/constants/relay-chain-names';
import { NotificationToastType, useNotifications } from '@/utils/context/Notifications';
import { useGetBalances } from '@/utils/hooks/api/tokens/use-get-balances';
import { FeatureFlags, useFeatureFlag } from '@/utils/hooks/use-feature-flag';
import { useSignMessage } from '@/utils/hooks/use-sign-message';

import GetGovernanceTokenUI from './GetGovernanceTokenUI';
import ManualIssueExecutionActionsBadge from './ManualIssueExecutionActionsBadge';

const SMALL_SIZE_BUTTON_CLASSES = clsx('leading-7', '!px-3');
Expand All @@ -36,7 +34,6 @@ const Topbar = (): JSX.Element => {
const dispatch = useDispatch();
const { t } = useTranslation();
const { getAvailableBalance } = useGetBalances();
const isBanxaEnabled = useFeatureFlag(FeatureFlags.BANXA);
const { setSelectedAccount, removeSelectedAccount } = useSubstrate();
const { selectProps } = useSignMessage();
const notifications = useNotifications();
Expand Down Expand Up @@ -109,7 +106,7 @@ const Topbar = (): JSX.Element => {
<>
<div className={clsx('p-4', 'flex', 'items-center', 'justify-end', 'space-x-2')}>
<ManualIssueExecutionActionsBadge />
{isBanxaEnabled ? <FundWallet /> : <GetGovernanceTokenUI className={SMALL_SIZE_BUTTON_CLASSES} />}
<FundWallet />
{selectedAccount !== undefined && (
<>
{process.env.REACT_APP_FAUCET_URL && governanceTokenBalanceIsZero && (
Expand Down
2 changes: 0 additions & 2 deletions src/utils/hooks/use-feature-flag.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
enum FeatureFlags {
BANXA = 'banxa',
STRATEGIES = 'strategies',
GEOBLOCK = 'geoblock',
ONBOARDING = 'onboarding'
}

const featureFlags: Record<FeatureFlags, string | undefined> = {
[FeatureFlags.BANXA]: process.env.REACT_APP_FEATURE_FLAG_BANXA,
[FeatureFlags.STRATEGIES]: process.env.REACT_APP_FEATURE_FLAG_EARN_STRATEGIES,
[FeatureFlags.GEOBLOCK]: process.env.REACT_APP_FEATURE_FLAG_GEOBLOCK,
[FeatureFlags.ONBOARDING]: process.env.REACT_APP_FEATURE_FLAG_ONBOARDING
Expand Down

2 comments on commit 278f54f

@vercel
Copy link

@vercel vercel bot commented on 278f54f Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 278f54f Jul 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.