Skip to content

Commit

Permalink
Merge pull request #261 from soramitsu/adar-dev
Browse files Browse the repository at this point in the history
Adar dev
  • Loading branch information
timofeytrepalin authored Nov 10, 2023
2 parents a8ef269 + b06dd09 commit 05062f9
Show file tree
Hide file tree
Showing 158 changed files with 4,011 additions and 1,974 deletions.
1 change: 1 addition & 0 deletions env.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"soraCard": true
},
"SUBQUERY_ENDPOINT": "https://api.subquery.network/sq/sora-xor/sora-prod-sub4",
"SUBSQUID_ENDPOINT": "",
"DEFAULT_NETWORKS": [
{
"chain": "SORA",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "adar",
"version": "1.0.9",
"version": "1.0.10",
"repository": {
"type": "git",
"url": "https://github.com/soramitsu/adar.git"
Expand All @@ -24,7 +24,7 @@
},
"dependencies": {
"@metamask/detect-provider": "^2.0.0",
"@soramitsu/soraneo-wallet-web": "1.22.1",
"@soramitsu/soraneo-wallet-web": "1.23.4",
"@walletconnect/web3-provider": "^1.8.0",
"core-js": "^3.26.0",
"country-code-emoji": "^2.3.0",
Expand Down
1 change: 1 addition & 0 deletions public/.well-known/walletconnect.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4c5953fe-147b-468c-a916-4c6a8aadfbc8=9db69079be0a7f4f6ed6e2a1fd065f6077144011c52fdb544f891b52863fd5ef
5 changes: 3 additions & 2 deletions public/adar/template.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// RECIPIENT_NAME // Name of the recipient;// WALLET_ADDRESS // wallet address in SORA network;// AMOUNT // Amount to be received recipient should receive. Amounts can be expressed either in Dollars or in target tokens. If you want the recipient to receive tokens equivalent to the specified Dollar value, leave IS_AMOUNT_IN_TOKENS parameter empty. If you want to send a specific number of tokens to the recipient, set IS_AMOUNT_IN_TOKENS parameter to true.;// TARGET_TOKEN // The token that the recipient will receive (eg XOR, XSTUSD, etc);// IS_AMOUNT_IN_TOKENS // optional parameter, if true - the AMOUNT parameter becomes the value of tokens sent
// RECIPIENT_NAME // Name of the recipient;// WALLET_ADDRESS // wallet address in SORA network;// AMOUNT // Amount to be received recipient should receive. Amounts can be expressed either in Dollars or in target tokens. If you want the recipient to receive tokens equivalent to the specified Dollar value, leave IS_AMOUNT_IN_TOKENS parameter empty. If you want to send a specific number of tokens to the recipient, set IS_AMOUNT_IN_TOKENS parameter to true.;// TARGET_TOKEN // The token that the recipient will receive (eg XOR, XSTUSD, etc);// IS_AMOUNT_IN_TOKENS // optional parameter, if true - the AMOUNT parameter becomes the value of tokens sent.; // USE_SWAPLESS_TRANSFER // an optional parameter. If true, for this transaction, ADAR will use your existing tokens (your TARGET_TOKEN balance) as the input token (regardless of the input token you select in the wizard) and send the specified amount to the recipient without performing a swap operation.
Melanie Wilson (the recipient will get 2000 XOR);5FcNgN7kg1C7sZZpiQ2GB1PZvD5JchNVKK6EqtUqJtmjrKJJ;2000;XOR;TRUE
Charles Scott (the recipient will get $3000 worth of PSWAP tokens);cnWX1RR9W3iZXtrL5W6WjJoDsWWZHLDCDCMkmWyirHAZJyVu8;3000;PSWAP;
Charles Scott (the recipient will get $3000 worth of PSWAP tokens);cnWX1RR9W3iZXtrL5W6WjJoDsWWZHLDCDCMkmWyirHAZJyVu8;3000;PSWAP;
George Tyler (swapless, the recipient will get 2000 XOR);5FcNgN7kg1C7sZZpiQ2GB1PZvD5JchNVKK6EqtUqJtmjrKJJ;2000;XOR;TRUE;TRUE
3 changes: 2 additions & 1 deletion public/env.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"soraCard": true
},
"FAUCET_URL": "https://faucet.dev.sora2.tachi.soramitsu.co.jp/",
"SUBQUERY_ENDPOINT": "https://api.subquery.network/sq/sora-xor/sora-test",
"DEFAULT_NETWORKS": [
{
"chain": "SORA-test",
Expand All @@ -35,6 +34,8 @@
"address": "wss://ws.framenode-3.r0.dev.sora2.soramitsu.co.jp"
}
],
"SUBQUERY_ENDPOINT": "https://api.subquery.network/sq/sora-xor/sora-dev",
"SUBSQUID_ENDPOINT": "https://squid.subsquid.io/sora-dev/v/v1/graphql",
"NETWORK_TYPE": "Dev",
"CHAIN_GENESIS_HASH": "",
"EVM_NETWORKS_IDS": [97, 1001],
Expand Down
13 changes: 5 additions & 8 deletions public/marketing.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
[
{
"title": "JOIN AIRDROP",
"img": "/marketing/synths.png",
"backgroundColor": "var(--s-color-theme-accent)",
"link": "https://gleam.io/zHQmD/polkaswap-34000-xst-airdrop-campaign"
},
{
"title": "GET SORA CARD",
"img": "/marketing/card.png",
"backgroundColor": "#F8087B",
"link": "/#/card"
},
{
"title": "CONNECT WITH GOOGLE",
"img": "/marketing/google.png",
"link": "https://medium.com/polkaswap/how-to-use-connect-with-google-on-polkawap-a4f9ea2cd2f2"
},
{
"title": "LEARN ABOUT SYNTHETICS",
"img": "/marketing/synths.png",
"backgroundColor": "var(--s-color-theme-accent)",
"link": "https://medium.com/polkaswap/unveiling-synthetic-assets-a-game-changer-in-the-financial-landscape-1720e5858422"
}
]
Binary file added public/marketing/google.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/marketing/synths.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 13 additions & 4 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,27 @@

<script lang="ts">
import { Operation, TransactionStatus } from '@sora-substrate/util';
import { api, connection, components, mixins, settingsStorage, AlertsApiService } from '@soramitsu/soraneo-wallet-web';
import {
api,
connection,
components,
mixins,
settingsStorage,
WALLET_CONSTS,
WALLET_TYPES,
AlertsApiService,
} from '@soramitsu/soraneo-wallet-web';
import debounce from 'lodash/debounce';
import { Component, Mixins, Watch } from 'vue-property-decorator';
import axiosInstance, { updateBaseUrl, getFullBaseUrl } from '@/api';
import AppFooter from '@/components/App/Footer/AppFooter.vue';
import AppHeader from '@/components/App/Header/AppHeader.vue';
import AppMenu from '@/components/App/Menu/AppMenu.vue';
import NodeErrorMixin from '@/components/mixins/NodeErrorMixin';
import SoraLogo from '@/components/shared/Logo/Sora.vue';
import { PageNames, Components, Language, BreakpointClass, Breakpoint } from '@/consts';
import { getLocale } from '@/lang';
import AppHeader from '@/modules/ADAR/components/App/Header/AppHeader.vue';
import router, { goTo, lazyComponent } from '@/router';
import { action, getter, mutation, state } from '@/store/decorators';
import { preloadFontFace, updateDocumentTitle } from '@/utils';
Expand All @@ -64,7 +73,6 @@ import type { WhitelistArrayItem } from '@sora-substrate/util/build/assets/types
import type { EvmNetwork } from '@sora-substrate/util/build/bridgeProxy/evm/types';
import type DesignSystem from '@soramitsu/soramitsu-js-ui/lib/types/DesignSystem';
import type Theme from '@soramitsu/soramitsu-js-ui/lib/types/Theme';
import type { WALLET_CONSTS, WALLET_TYPES } from '@soramitsu/soraneo-wallet-web';
@Component({
components: {
Expand Down Expand Up @@ -235,7 +243,6 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin)
// ____________________________________________________________________
await this.setEthBridgeSettings(data.ETH_BRIDGE);
this.setSoraNetwork(data.NETWORK_TYPE);
this.setSubqueryEndpoint(data.SUBQUERY_ENDPOINT);
this.setDefaultNodes(data?.DEFAULT_NETWORKS);
this.setEvmNetworksApp(data.EVM_NETWORKS_IDS);
this.setSubNetworkApps(data.SUB_NETWORKS);
Expand All @@ -244,6 +251,8 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin)
api.bridgeProxy.sub.parachainIds = data.PARACHAIN_IDS;
}
this.setSubqueryEndpoint(data.SUBQUERY_ENDPOINT);
if (data.FAUCET_URL) {
this.setFaucetUrl(data.FAUCET_URL);
}
Expand Down
28 changes: 22 additions & 6 deletions src/components/App/Footer/AppFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@
:panel-text="statisticsConnectionText"
:status="statisticsConnectionClass"
:action-text="t('footer.statistics.action')"
@action="openStatisticsDialog"
@action="openIndexerSelectionDialog"
>
<template #label>
<span>{{ t('footer.statistics.label') }}</span>
<span>{{ statisticsConnectionDesc }}</span>
</template>
</footer-popper>
<select-node-dialog />
<statistics-dialog />
<no-internet-dialog />
<statistics-dialog :visible.sync="showStatisticsDialog" />
</div>
</template>

<script lang="ts">
import { FPNumber } from '@sora-substrate/util';
import { Status } from '@soramitsu/soramitsu-js-ui/lib/types';
import { getExplorerLinks, WALLET_TYPES } from '@soramitsu/soraneo-wallet-web';
import { getExplorerLinks, WALLET_CONSTS, WALLET_TYPES } from '@soramitsu/soraneo-wallet-web';
import { Component, Mixins } from 'vue-property-decorator';
import TranslationMixin from '@/components/mixins/TranslationMixin';
Expand All @@ -75,7 +75,6 @@ import { formatLocation } from './Node/utils';
import NoInternetDialog from './NoInternetDialog.vue';
import type Theme from '@soramitsu/soramitsu-js-ui/lib/types/Theme';
import type { WALLET_CONSTS } from '@soramitsu/soraneo-wallet-web';
/** Max limit provided by navigator.connection.downlink */
const MAX_INTERNET_CONNECTION_LIMIT = 10;
Expand All @@ -85,13 +84,14 @@ const MAX_INTERNET_CONNECTION_LIMIT = 10;
SoraLogo,
FooterPopper,
NoInternetDialog,
StatisticsDialog: lazyComponent(Components.StatisticsDialog),
SelectNodeDialog: lazyComponent(Components.SelectNodeDialog),
StatisticsDialog: lazyComponent(Components.StatisticsDialog),
},
})
export default class AppFooter extends Mixins(TranslationMixin) {
// Block explorer
@state.wallet.settings.soraNetwork private soraNetwork!: Nullable<WALLET_CONSTS.SoraNetwork>;
@state.wallet.settings.indexerType private indexerType!: WALLET_CONSTS.IndexerType;
@state.settings.blockNumber blockNumber!: number;
@getter.libraryTheme libraryTheme!: Theme;
Expand All @@ -112,6 +112,9 @@ export default class AppFooter extends Mixins(TranslationMixin) {
@getter.settings.connectingNode connectingNode!: Nullable<Node>;
@getter.settings.nodeIsConnected isNodeConnected!: boolean;
@mutation.settings.setSelectNodeDialogVisibility private setSelectNodeDialogVisibility!: (flag: boolean) => void;
@mutation.settings.setSelectIndexerDialogVisibility private setSelectIndexerDialogVisibility!: (
flag: boolean
) => void;
private get isNodeConnecting(): boolean {
return !!this.connectingNode;
Expand Down Expand Up @@ -148,6 +151,10 @@ export default class AppFooter extends Mixins(TranslationMixin) {
this.setSelectNodeDialogVisibility(true);
}
openIndexerSelectionDialog(): void {
this.setSelectIndexerDialogVisibility(true);
}
// Internet connection
@mutation.settings.setInternetConnectionEnabled private setEnabled!: VoidFunction;
@mutation.settings.setInternetConnectionDisabled private setDisabled!: VoidFunction;
Expand Down Expand Up @@ -188,11 +195,20 @@ export default class AppFooter extends Mixins(TranslationMixin) {
// Statistics connection
@state.wallet.settings.subqueryStatus private subqueryStatus!: WALLET_TYPES.ConnectionStatus;
@state.wallet.settings.subsquidStatus private subsquidStatus!: WALLET_TYPES.ConnectionStatus;
showStatisticsDialog = false;
get indexerStatus(): WALLET_TYPES.ConnectionStatus {
if (this.indexerType === WALLET_CONSTS.IndexerType.SUBQUERY) {
return this.subqueryStatus;
} else {
return this.subsquidStatus;
}
}
get statisticsConnectionClass(): Status {
switch (this.subqueryStatus) {
switch (this.indexerStatus) {
case WALLET_TYPES.ConnectionStatus.Unavailable:
return Status.ERROR;
case WALLET_TYPES.ConnectionStatus.Loading:
Expand Down
155 changes: 155 additions & 0 deletions src/components/App/Footer/Indexer/SelectIndexer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<template>
<div class="statistics-dialog">
<s-scrollbar class="statistics-dialog__scrollbar">
<div class="statistics-dialog__group">
<span class="statistics-dialog__group-title">{{ t('footer.statistics.dialog.indexer') }}</span>
<s-radio-group v-model="indexerType" class="statistics-dialog__block s-flex">
<s-radio
v-for="indexer in indexers"
:key="indexer.type"
:label="indexer.type"
:value="indexer.type"
:disabled="!indexer.endpoint"
size="medium"
class="statistics-dialog__item s-flex"
>
<div class="service-item s-flex">
<div class="service-item__label s-flex">
<div class="service-item__name">{{ indexer.name }}</div>
<div v-if="indexer.endpoint" class="service-item__endpoint">{{ indexer.endpoint }}</div>
</div>
<div class="service-item__status" :class="indexer.online ? 'success' : 'error'">
{{ indexer.online ? TranslationConsts.online : TranslationConsts.offline }}
</div>
</div>
</s-radio>
</s-radio-group>
<s-divider />
<div class="statistics-dialog__group">
<div class="statistics-dialog__item">
<div class="switcher">
<s-switch disabled :value="false" />
<span>{{ t('footer.statistics.dialog.useCeres') }}</span>
</div>
</div>
</div>
</div>
</s-scrollbar>
</div>
</template>

<script lang="ts">
import { IndexerType } from '@soramitsu/soraneo-wallet-web/lib/consts';
import { Component, Mixins, Prop, ModelSync } from 'vue-property-decorator';
import TranslationMixin from '@/components/mixins/TranslationMixin';
import type { Indexer } from '@/types/indexers';
@Component
export default class SelectIndexer extends Mixins(TranslationMixin) {
@Prop({ default: () => [], type: Array }) indexers!: Array<Indexer>;
@ModelSync('value', 'input', { type: String }) readonly indexerType!: IndexerType;
}
</script>

<style lang="scss">
.statistics-dialog__item {
&.el-radio {
&.s-medium {
height: initial;
}
.el-radio__label {
flex: 1;
}
}
}
</style>

<style lang="scss" scoped>
$statistics-border-radius: 8px;
.statistics-dialog {
&__group {
&-title {
font-weight: 600;
letter-spacing: var(--s-letter-spacing-small);
line-height: var(--s-line-height-small);
font-size: var(--s-font-size-small);
}
}
&__block {
flex-direction: column;
margin-top: $inner-spacing-small;
}
&__item {
margin-right: 0;
align-items: center;
padding: $inner-spacing-small $inner-spacing-big;
white-space: normal;
}
}
.service-item {
align-items: center;
justify-content: space-between;
flex-wrap: nowrap;
letter-spacing: var(--s-letter-spacing-small);
line-height: var(--s-line-height-medium);
&__label {
flex-direction: column;
flex: 1;
margin-right: $inner-spacing-mini;
}
&__name {
color: var(--s-color-base-content-primary);
font-size: var(--s-font-size-medium);
font-weight: 600;
}
&__endpoint {
background: var(--s-color-base-background);
padding: 6px;
margin-top: 6px;
border-radius: $statistics-border-radius;
color: var(--s-color-base-content-secondary);
font-size: var(--s-font-size-mini);
font-weight: 300;
}
&__status {
$status-classes: 'error', 'success';
padding: 2px 6px;
border-radius: $statistics-border-radius;
font-weight: 400;
font-size: var(--s-font-size-mini);
letter-spacing: var(--s-letter-spacing-small);
@each $status in $status-classes {
&.#{$status} {
color: var(--s-color-status-#{$status});
background-color: var(--s-color-status-#{$status}-background);
[design-system-theme='dark'] & {
--s-color-status-#{$status}: var(--s-color-base-on-accent);
}
}
}
}
}
.switcher {
display: flex;
align-items: center;
& > span {
margin-left: $inner-spacing-small;
color: var(--s-color-base-content-primary);
font-size: var(--s-font-size-medium);
font-weight: 600;
}
}
</style>
9 changes: 9 additions & 0 deletions src/components/App/Footer/Indexer/consts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { WALLET_CONSTS } from '@soramitsu/soraneo-wallet-web';

const { IndexerType } = WALLET_CONSTS;

export const IndexerModel = {
name: '',
type: IndexerType.SUBQUERY,
address: '',
};
Loading

0 comments on commit 05062f9

Please sign in to comment.