diff --git a/env.json b/env.json index fda3aa336..e9abdc75e 100644 --- a/env.json +++ b/env.json @@ -52,10 +52,11 @@ "NETWORK_TYPE": "Prod", "CHAIN_GENESIS_HASH": "0x7e4e32d0feafd4f9c9414b0be86373f9a1efa904809b683453a9af6856d38ad5", "SUB_NETWORKS": { - "Kusama": "wss://kusama-rpc.dwellir.com", - "KusamaSora": "wss://ws.parachain-collator-2.c2.sora2.soramitsu.co.jp", - "Polkadot": "wss://polkadot-rpc.dwellir.com", - "PolkadotSora": "wss://ws.parachain-collator-3.pc3.sora2.soramitsu.co.jp" + "Kusama": true, + "KusamaSora": true, + "Polkadot": true, + "PolkadotSora": true, + "Liberland": true }, "EVM_NETWORKS_IDS": [56, 8217], "ETH_BRIDGE": { diff --git a/package.json b/package.json index b4763b1e6..5d927e55e 100644 --- a/package.json +++ b/package.json @@ -27,7 +27,7 @@ }, "dependencies": { "@metamask/detect-provider": "^2.0.0", - "@soramitsu/soraneo-wallet-web": "1.32.5", + "@soramitsu/soraneo-wallet-web": "1.32.6", "@walletconnect/ethereum-provider": "^2.11.2", "@walletconnect/modal": "^2.6.2", "core-js": "^3.36.0", diff --git a/public/env.json b/public/env.json index 7386257fd..18c8d7755 100644 --- a/public/env.json +++ b/public/env.json @@ -33,6 +33,11 @@ "chain": "SORA-dev Testnet #3", "name": "SORA", "address": "wss://ws.framenode-3.r0.dev.sora2.soramitsu.co.jp" + }, + { + "chain": "SORA-dev Liberland", + "name": "SORA", + "address": "wss://ws.framenode-1.lib1.dev.sora2.soramitsu.co.jp" } ], "SUBQUERY_ENDPOINT": "https://api.subquery.network/sq/sora-xor/sora-dev", @@ -41,11 +46,27 @@ "CHAIN_GENESIS_HASH": "", "EVM_NETWORKS_IDS": [97, 1001], "SUB_NETWORKS": { - "Rococo": "wss://ws.relaychain-node-1.r1.dev.sora2.soramitsu.co.jp", - "RococoSora": "wss://ws.parachain-collator-1.c1.dev.sora2.soramitsu.co.jp", - "Kusama": "wss://kusama-rpc.polkadot.io", - "KusamaSora": "wss://ws.parachain-collator-1.c1.sora2.soramitsu.co.jp", - "Polkadot": "wss://rpc.polkadot.io" + "Rococo": [ + { + "chain": "Rococo Dev Testnet", + "name": "Soramitsu", + "address": "wss://ws.relaychain-node-1.r1.dev.sora2.soramitsu.co.jp" + } + ], + "RococoSora": [ + { + "chain": "SORA Rococo Parachain Dev Testnet", + "name": "Soramitsu", + "address": "wss://ws.parachain-collator-1.c1.dev.sora2.soramitsu.co.jp" + } + ], + "Liberland": [ + { + "chain": "Liberland Dev Testnet", + "name": "Soramitsu", + "address": "wss://rpc.liberland-1.lib1.dev.sora2.soramitsu.co.jp" + } + ] }, "ETH_BRIDGE": { "evmNetwork": 11155111, @@ -55,4 +76,4 @@ "OTHER": "0x401c6A23a44f72151D90878DF0aa86E77fBde0e2" } } -} +} \ No newline at end of file diff --git a/public/marketing.json b/public/marketing.json index 95504f8fa..45c0eee3c 100644 --- a/public/marketing.json +++ b/public/marketing.json @@ -1,8 +1,13 @@ [ + { + "title": "ORDERBOOK SURVEY", + "img": "/marketing/orderbook.png", + "link": "https://form.typeform.com/to/DMieGaJI" + }, { "title": "GET SORA CARD", "img": "/marketing/card.png", - "link": "/#/card" + "link": "https://soracard.com" }, { "title": "CONNECT WITH GOOGLE", diff --git a/public/marketing/card.png b/public/marketing/card.png index 79e7fbb20..3b02b599f 100644 Binary files a/public/marketing/card.png and b/public/marketing/card.png differ diff --git a/public/marketing/google.png b/public/marketing/google.png index dc4f7122a..7c78b116e 100644 Binary files a/public/marketing/google.png and b/public/marketing/google.png differ diff --git a/public/marketing/orderbook.png b/public/marketing/orderbook.png new file mode 100644 index 000000000..894e237c2 Binary files /dev/null and b/public/marketing/orderbook.png differ diff --git a/public/marketing/synths.png b/public/marketing/synths.png index 9a111343d..379efde84 100644 Binary files a/public/marketing/synths.png and b/public/marketing/synths.png differ diff --git a/src/App.vue b/src/App.vue index 81c282ffe..607d49cac 100644 --- a/src/App.vue +++ b/src/App.vue @@ -44,6 +44,8 @@ import { WALLET_CONSTS, WALLET_TYPES, AlertsApiService, + initWallet, + waitForCore, } from '@soramitsu/soraneo-wallet-web'; import debounce from 'lodash/debounce'; import { Component, Mixins, Watch } from 'vue-property-decorator'; @@ -54,15 +56,15 @@ 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 { PageNames, Components, Language, BreakpointClass, Breakpoint, WalletPermissions } from '@/consts'; import { getLocale } from '@/lang'; import router, { goTo, lazyComponent } from '@/router'; import { action, getter, mutation, state } from '@/store/decorators'; import { getMobileCssClasses, preloadFontFace, updateDocumentTitle } from '@/utils'; +import type { NodesConnection } from '@/utils/connection'; import type { FeatureFlags } from './store/settings/types'; import type { EthBridgeSettings, SubNetworkApps } from './store/web3/types'; -import type { ConnectToNodeOptions, Node } from './types/nodes'; import type { History, HistoryItem } from '@sora-substrate/util'; import type { WhitelistArrayItem } from '@sora-substrate/util/build/assets/types'; import type { EvmNetwork } from '@sora-substrate/util/build/bridgeProxy/evm/types'; @@ -95,6 +97,7 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) showNotifsDarkPage = false; responsiveClass = BreakpointClass.LargeDesktop; + @state.settings.appConnection appConnection!: NodesConnection; @state.settings.browserNotifPopupVisibility private browserNotifPopup!: boolean; @state.settings.browserNotifPopupBlockedVisibility private browserNotifPopupBlocked!: boolean; @state.wallet.account.assetsToNotifyQueue assetsToNotifyQueue!: Array; @@ -102,6 +105,7 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) @state.settings.disclaimerVisibility disclaimerVisibility!: boolean; @state.router.loading pageLoading!: boolean; + @getter.settings.nodeIsConnected nodeIsConnected!: boolean; @getter.settings.chartsEnabled private chartsEnabled!: boolean; @getter.wallet.transactions.firstReadyTx firstReadyTransaction!: Nullable; @getter.wallet.account.isLoggedIn isSoraAccountConnected!: boolean; @@ -114,8 +118,6 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) endpoint: string; }) => void; - @mutation.settings.setDefaultNodes private setDefaultNodes!: (nodes: Array) => void; - @mutation.settings.setNetworkChainGenesisHash private setNetworkChainGenesisHash!: (hash?: string) => void; @mutation.settings.setFaucetUrl private setFaucetUrl!: (url: string) => void; @mutation.settings.setFeatureFlags private setFeatureFlags!: (data: FeatureFlags) => void; @mutation.settings.setBrowserNotifsPopupEnabled private setBrowserNotifsPopup!: (flag: boolean) => void; @@ -125,15 +127,14 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) @mutation.settings.setScreenBreakpointClass private setScreenBreakpointClass!: (cssClass: string) => void; @mutation.referrals.unsubscribeFromInvitedUsers private unsubscribeFromInvitedUsers!: FnWithoutArgs; @mutation.web3.setEvmNetworksApp private setEvmNetworksApp!: (data: EvmNetwork[]) => void; + @mutation.web3.setSubNetworkApps private setSubNetworkApps!: (data: SubNetworkApps) => void; @mutation.web3.setEthBridgeSettings private setEthBridgeSettings!: (settings: EthBridgeSettings) => Promise; @mutation.referrals.resetStorageReferrer private resetStorageReferrer!: FnWithoutArgs; - @action.web3.setSubNetworkApps private setSubNetworkApps!: (data: SubNetworkApps) => void; @action.wallet.settings.setApiKeys private setApiKeys!: (apiKeys: WALLET_TYPES.ApiKeysObject) => Promise; @action.wallet.subscriptions.resetNetworkSubscriptions private resetNetworkSubscriptions!: AsyncFnWithoutArgs; @action.wallet.subscriptions.resetInternalSubscriptions private resetInternalSubscriptions!: AsyncFnWithoutArgs; @action.wallet.subscriptions.activateNetwokSubscriptions private activateNetwokSubscriptions!: AsyncFnWithoutArgs; - @action.settings.connectToNode private connectToNode!: (options: ConnectToNodeOptions) => Promise; @action.settings.setLanguage private setLanguage!: (lang: Language) => Promise; @action.settings.setBlockNumber private setBlockNumber!: AsyncFnWithoutArgs; @action.settings.fetchAdsArray private fetchAdsArray!: AsyncFnWithoutArgs; @@ -239,7 +240,6 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) await this.setEthBridgeSettings(data.ETH_BRIDGE); this.setFeatureFlags(data?.FEATURE_FLAGS); this.setSoraNetwork(data.NETWORK_TYPE); - this.setDefaultNodes(data?.DEFAULT_NETWORKS); this.setEvmNetworksApp(data.EVM_NETWORKS_IDS); this.setSubNetworkApps(data.SUB_NETWORKS); @@ -253,9 +253,9 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) if (data.FAUCET_URL) { this.setFaucetUrl(data.FAUCET_URL); } - if (data.CHAIN_GENESIS_HASH) { - this.setNetworkChainGenesisHash(data.CHAIN_GENESIS_HASH); - } + + this.appConnection.setDefaultNodes(data?.DEFAULT_NETWORKS); + this.appConnection.setNetworkChainGenesisHash(data?.CHAIN_GENESIS_HASH); // connection to node await this.runAppConnectionToNode(); @@ -269,10 +269,6 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) window.addEventListener('resize', this.setResponsiveClassDebounced); } - private get isSwapPageWithCharts(): boolean { - return this.$route.name === PageNames.Swap && this.chartsEnabled; - } - private get mobileCssClasses(): string[] | undefined { return getMobileCssClasses(); } @@ -281,10 +277,6 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) return this.$route.name === PageNames.About; } - get isCurrentPageTooWide(): boolean { - return this.isAboutPage || this.isSwapPageWithCharts || this.$route.name === PageNames.Tokens; - } - get dsProviderClasses(): string[] | BreakpointClass { return this.mobileCssClasses?.length ? [...this.mobileCssClasses, this.responsiveClass] : this.responsiveClass; } @@ -295,9 +287,6 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) if (this.$route.name) { cssClasses.push(`${baseClass}--${this.$route.name.toLowerCase()}`); } - if (this.isSwapPageWithCharts) { - cssClasses.push(`${baseClass}--has-charts`); - } return cssClasses; } @@ -373,12 +362,28 @@ export default class App extends Mixins(mixins.TransactionMixin, NodeErrorMixin) } private async runAppConnectionToNode() { + const walletOptions = { + permissions: WalletPermissions, + appName: WALLET_CONSTS.TranslationConsts.Polkaswap, + }; + try { - await this.connectToNode({ - onError: (error) => this.handleNodeError(error, true), // prefer notification on connection success - onDisconnect: this.handleNodeDisconnect, - onReconnect: this.handleNodeReconnect, - }); + // Run in parallel + // 1) Wallet core initialization (node connection independent) + // 2) Connection to node + await Promise.all([ + waitForCore(walletOptions), + this.appConnection.connect({ + onError: this.handleNodeError, + onDisconnect: this.handleNodeDisconnect, + onReconnect: this.handleNodeConnect, + }), + ]); + + // Wallet node connection dependent logic + if (!this.isWalletLoaded) { + await initWallet(walletOptions); + } } catch (error) { // we handled error using callback, do nothing } @@ -568,13 +573,12 @@ i.icon-divider { } @include desktop { - .app-main { - &.app-main--swap.app-main--has-charts { + .app-main--swap { + &.app-main { .app-menu { &:not(.collapsed) { position: relative; } - &.collapsed { & + .app-body { margin-left: 74px; diff --git a/src/assets/img/networks/binance-smart-chain.svg b/src/assets/img/networks/binance-smart-chain.svg index f39dba1be..6013da5c7 100644 --- a/src/assets/img/networks/binance-smart-chain.svg +++ b/src/assets/img/networks/binance-smart-chain.svg @@ -1,20 +1,7 @@ - - - - - - - - - - + + + + + + diff --git a/src/assets/img/networks/ethereum.svg b/src/assets/img/networks/ethereum.svg index 684e96873..ccf8091ee 100644 --- a/src/assets/img/networks/ethereum.svg +++ b/src/assets/img/networks/ethereum.svg @@ -1,21 +1,10 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + diff --git a/src/assets/img/networks/klaytn.svg b/src/assets/img/networks/klaytn.svg index aa5e9f664..f24aa6c01 100644 --- a/src/assets/img/networks/klaytn.svg +++ b/src/assets/img/networks/klaytn.svg @@ -1,17 +1,31 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/assets/img/networks/kusama.svg b/src/assets/img/networks/kusama.svg index b7b9da8de..7c5d10ccd 100644 --- a/src/assets/img/networks/kusama.svg +++ b/src/assets/img/networks/kusama.svg @@ -1 +1,4 @@ -kusama-ksm-logo \ No newline at end of file + + + + diff --git a/src/assets/img/networks/liberland.svg b/src/assets/img/networks/liberland.svg new file mode 100644 index 000000000..9fa8aa6a8 --- /dev/null +++ b/src/assets/img/networks/liberland.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/assets/img/networks/polkadot.svg b/src/assets/img/networks/polkadot.svg index dc99ea877..a698aaa42 100644 --- a/src/assets/img/networks/polkadot.svg +++ b/src/assets/img/networks/polkadot.svg @@ -1,9 +1,9 @@ - - - - - - - - + + + + + + + + diff --git a/src/assets/img/networks/sora-kusama.svg b/src/assets/img/networks/sora-kusama.svg new file mode 100644 index 000000000..0fb4484ca --- /dev/null +++ b/src/assets/img/networks/sora-kusama.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/assets/img/networks/sora-polkadot.svg b/src/assets/img/networks/sora-polkadot.svg new file mode 100644 index 000000000..d531d5832 --- /dev/null +++ b/src/assets/img/networks/sora-polkadot.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/components/App/Footer/AppFooter.vue b/src/components/App/Footer/AppFooter.vue index 830b779bb..23047c975 100644 --- a/src/components/App/Footer/AppFooter.vue +++ b/src/components/App/Footer/AppFooter.vue @@ -13,10 +13,10 @@ > {{ t('selectNodeConnected') }} - {{ node.name }} + {{ node.chain || node.name }}