Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,12 @@ export const TRUSTED_DAPPS: {
image: 'Governance.webp',
isFeatured: true,
},
{
name: 'Superhero Swap',
url: 'https://swap.superhero.com',
image: 'bridgeswap.svg',
isFeatured: true,
},
{
name: 'Graffiti Aepp',
url: 'https://graffiti.aeternity.com',
Expand Down
3 changes: 3 additions & 0 deletions src/icons/bridgeswap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions src/icons/dapp/bridgeswap.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/image/dashboard/bridge-swap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/popup/components/Card.vue
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ export default defineComponent({
}

.description {
@extend %face-sans-13-regular;
@extend %face-sans-13-medium;

opacity: 0.7;
margin-top: 4px;
Expand Down
5 changes: 5 additions & 0 deletions src/popup/components/buttons/BtnBase.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const BTN_VARIANT = [
'muted',
'danger',
'purple',
'teal',
'dark',
'outlined',
] as const;
Expand Down Expand Up @@ -197,6 +198,10 @@ export default defineComponent({
--bg-color: #{$color-purple};
}

&-teal {
--bg-color: #{$color-teal};
}

&-dark {
--bg-color: #{$color-bg-6};
}
Expand Down
5 changes: 5 additions & 0 deletions src/popup/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@
"description": "Explore æpps from within your wallet with the new built-in browser.",
"button": "Browse"
},
"bridgeSwapBrowserCard": {
"title": "Exchange With Superhero Swap",
"description": "Exchange ETH to AE or aeETH to AE in just a few easy steps.",
"button": "Exchange"
},
"buyCard": {
"title": "Buy AE",
"description": "Use Simplex to buy æternity coins with your credit card or bank account.",
Expand Down
38 changes: 35 additions & 3 deletions src/popup/pages/Assets/AssetDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
:icon="SwapIcon"
:href="AE_DEX_URL"
/>
<BtnBox
v-if="isEthCoin"
:text="$t('common.swap')"
:icon="BridgeSwapIcon"
@click="onSwapClick"
/>
</div>

<div
Expand Down Expand Up @@ -106,7 +112,7 @@ import {
nextTick,
watch,
} from 'vue';
import { useRoute } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';
import { useI18n } from 'vue-i18n';
import { Contract, Encoded } from '@aeternity/aepp-sdk';

Expand All @@ -115,12 +121,15 @@ import {
ICON_SIZES,
IS_FIREFOX,
IS_IOS,
IS_MOBILE_APP,
IS_TRANSITIONS_DISABLED,
PROTOCOLS,
TRUSTED_DAPPS,
UNFINISHED_FEATURES,
} from '@/constants';
import { excludeFalsy } from '@/utils';
import { excludeFalsy, setLocalStorageItem } from '@/utils';
import {
ROUTE_APPS_BROWSER,
ROUTE_COIN,
ROUTE_COIN_DETAILS,
ROUTE_MULTISIG_COIN,
Expand All @@ -143,6 +152,7 @@ import { ProtocolAdapterFactory } from '@/lib/ProtocolAdapterFactory';
import { fadeAnimation } from '@/popup/animations';
import AedexV2PairACI from '@/protocols/aeternity/aci/AedexV2PairACI.json';
import { AE_CONTRACT_ID, AE_DEX_URL } from '@/protocols/aeternity/config';
import { ETH_CONTRACT_ID } from '@/protocols/ethereum/config';
import {
buildAeFaucetUrl,
buildSimplexLink,
Expand All @@ -162,6 +172,7 @@ import TransactionAndTokenFilter from '../../components/TransactionAndTokenFilte
import SwapIcon from '../../../icons/swap.svg?vue-component';
import BuyIcon from '../../../icons/credit-card.svg?vue-component';
import FaucetIcon from '../../../icons/faucet.svg?vue-component';
import BridgeSwapIcon from '../../../icons/bridgeswap.svg?vue-component';

export default defineComponent({
name: 'AssetDetails',
Expand All @@ -180,6 +191,7 @@ export default defineComponent({
},
setup() {
const route = useRoute();
const router = useRouter();
const { t } = useI18n();
const { setSharedAssetDetails, resetSharedAssetDetails } = useAssetDetails();
const { setLoaderVisible } = useUi();
Expand Down Expand Up @@ -209,7 +221,7 @@ export default defineComponent({
const currentActiveProtocol = computed(
() => isMultisig.value
? PROTOCOLS.aeternity
: activeAccount.value.protocol,
: activeAccount.value?.protocol,
);

const isCoin: boolean = !!route.matched.find(
Expand All @@ -222,6 +234,7 @@ export default defineComponent({
);
const contractId = route.params.id as AssetContractId;
const isAeCoin = contractId === AE_CONTRACT_ID;
const isEthCoin = contractId === ETH_CONTRACT_ID;

const detailsRouteName = isCoin ? ROUTE_COIN_DETAILS : ROUTE_TOKEN_DETAILS;
const transactionRouteName = isCoin ? ROUTE_COIN : ROUTE_TOKEN;
Expand Down Expand Up @@ -360,6 +373,20 @@ export default defineComponent({
}
}

function onSwapClick() {
const superheroSwapDapp = TRUSTED_DAPPS.filter(({ isFeatured, name }) => (
isFeatured && name === 'Superhero Swap'
))[0];
if (superheroSwapDapp) {
if (IS_MOBILE_APP || UNFINISHED_FEATURES) {
setLocalStorageItem(['selected-app'], superheroSwapDapp);
router.push({ name: ROUTE_APPS_BROWSER });
} else {
window.open(superheroSwapDapp.url, '_blank');
}
}
}

onMounted(async () => {
if (isContract(contractId) && !isAeCoin) {
setLoaderVisible(true);
Expand Down Expand Up @@ -396,10 +423,12 @@ export default defineComponent({
IS_IOS,
IS_TRANSITIONS_DISABLED,
AE_DEX_URL,
ROUTE_APPS_BROWSER,

BuyIcon,
FaucetIcon,
SwapIcon,
BridgeSwapIcon,

assetBalance,
assetData,
Expand All @@ -410,6 +439,7 @@ export default defineComponent({
stickyTabsWrapperEl,
fungibleToken,
isAeCoin,
isEthCoin,
isCoin,
isNodeMainnet,
isNodeTestnet,
Expand All @@ -425,6 +455,8 @@ export default defineComponent({
route,
routerHeight,
fadeAnimation,

onSwapClick,
};
},
});
Expand Down
36 changes: 35 additions & 1 deletion src/popup/pages/Dashboard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@
:to="{ name: ROUTE_APPS_BROWSER }"
:card-id="DASHBOARD_CARD_ID.daeppBrowser!"
/>
<DashboardCard
:title="$t('dashboard.bridgeSwapBrowserCard.title')"
:description="$t('dashboard.bridgeSwapBrowserCard.description')"
:btn-text="$t('dashboard.bridgeSwapBrowserCard.button')"
:background="bridgeSwapBackground"
:icon="BridgeSwapIcon"
:card-id="DASHBOARD_CARD_ID.daeppBrowser!"
style="background-blend-mode: soft-light"
variant="teal"
@click="onSwapClick"
/>
<DashboardCard
v-if="isNodeMainnet && UNFINISHED_FEATURES"
:title="$t('dashboard.buyCard.title')"
Expand Down Expand Up @@ -90,12 +101,13 @@ import {
onIonViewWillEnter,
onIonViewDidLeave,
} from '@ionic/vue';
import { useRoute } from 'vue-router';
import { useRoute, useRouter } from 'vue-router';

import {
DASHBOARD_CARD_ID,
IS_MOBILE_APP,
PROTOCOLS,
TRUSTED_DAPPS,
UNFINISHED_FEATURES,
} from '@/constants';
import {
Expand Down Expand Up @@ -125,11 +137,14 @@ import ArrowSendIcon from '@/icons/arrow-send.svg?vue-component';
import CardIcon from '@/icons/credit-card.svg?vue-component';
import GlobeIcon from '@/icons/globe-small.svg?vue-component';
import ActionIcon from '@/icons/action.svg?vue-component';
import BridgeSwapIcon from '@/icons/bridgeswap.svg?vue-component';

import buyBackground from '@/image/dashboard/buy-ae.webp';
import chainNameBackground from '@/image/dashboard/chain-name.webp';
import daeppBrowserBackground from '@/image/dashboard/aepp-browser.webp';
import bridgeSwapBackground from '@/image/dashboard/bridge-swap.png';
import OpenTransferReceiveModalBtn from '@/popup/components/OpenTransferReceiveModalBtn.vue';
import { setLocalStorageItem } from '../../utils';

export default defineComponent({
name: 'Dashboard',
Expand All @@ -148,6 +163,7 @@ export default defineComponent({
const pageIsActive = ref(true);

const route = useRoute();
const router = useRouter();

const {
accounts,
Expand All @@ -172,6 +188,20 @@ export default defineComponent({
(+accountsTotalBalance.value + +accountsTotalTokenBalance.value).toString()
));

function onSwapClick() {
const superheroSwapDapp = TRUSTED_DAPPS.filter(({ isFeatured, name }) => (
isFeatured && name === 'Superhero Swap'
))[0];
if (superheroSwapDapp) {
if (IS_MOBILE_APP || UNFINISHED_FEATURES) {
setLocalStorageItem(['selected-app'], superheroSwapDapp);
router.push({ name: ROUTE_APPS_BROWSER });
} else {
window.open(superheroSwapDapp.url, '_blank');
}
}
}

watch(
() => route.query,
() => checkIfOpenTransferSendModal(route),
Expand Down Expand Up @@ -203,6 +233,7 @@ export default defineComponent({
CardIcon,
GlobeIcon,
ActionIcon,
BridgeSwapIcon,

multisigAccounts,
accounts,
Expand All @@ -215,12 +246,15 @@ export default defineComponent({
buyBackground,
chainNameBackground,
daeppBrowserBackground,
bridgeSwapBackground,
isNodeMainnet,
isNodeTestnet,
pageIsActive,
totalBalance,
setActiveAccountByGlobalIdx,
setActiveAccountByAddress,

onSwapClick,
};
},
});
Expand Down
1 change: 1 addition & 0 deletions src/styles/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ $color-grey-dark: #787878;
$color-grey-border: #444;
$color-grey-border-avatar: #9e9e9e;
$color-purple: #8f00ff;
$color-teal: #53B6BF;

$color-dialog: #2b2b2b;

Expand Down
Loading