diff --git a/env.json b/env.json index f0cef4b2f..26670a577 100644 --- a/env.json +++ b/env.json @@ -52,7 +52,9 @@ "CHAIN_GENESIS_HASH": "0x7e4e32d0feafd4f9c9414b0be86373f9a1efa904809b683453a9af6856d38ad5", "SUB_NETWORKS": { "Kusama": "wss://kusama-rpc.polkadot.io", - "KusamaSora": "wss://ws.parachain-collator-1.c1.sora2.soramitsu.co.jp" + "KusamaSora": "wss://ws.parachain-collator-2.c2.sora2.soramitsu.co.jp", + "Polkadot": "wss://rpc.polkadot.io", + "PolkadotSora": "wss://ws.parachain-collator-3.pc3.sora2.soramitsu.co.jp" }, "EVM_NETWORKS_IDS": [56, 8217], "ETH_BRIDGE": { diff --git a/package.json b/package.json index 5ac1d4275..4917ec348 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "polkaswap-exchange-web", - "version": "1.27.3", + "version": "1.28.0", "repository": { "type": "git", "url": "https://github.com/sora-xor/polkaswap-exchange-web.git" @@ -24,7 +24,7 @@ }, "dependencies": { "@metamask/detect-provider": "^2.0.0", - "@soramitsu/soraneo-wallet-web": "1.27.3", + "@soramitsu/soraneo-wallet-web": "1.28.0", "@walletconnect/ethereum-provider": "^2.11.0", "@walletconnect/modal": "^2.6.2", "core-js": "^3.33.2", diff --git a/src/components/mixins/NetworkFormatterMixin.ts b/src/components/mixins/NetworkFormatterMixin.ts index dec08db37..9d5fbdfef 100644 --- a/src/components/mixins/NetworkFormatterMixin.ts +++ b/src/components/mixins/NetworkFormatterMixin.ts @@ -73,6 +73,8 @@ export default class NetworkFormatterMixin extends Mixins(TranslationMixin) { // sub case SubNetworkId.Polkadot: return 'polkadot'; + case SubNetworkId.PolkadotSora: + return 'sora-polkadot'; case SubNetworkId.Kusama: return 'kusama'; case SubNetworkId.Rococo: diff --git a/src/components/pages/Bridge/SelectNetwork.vue b/src/components/pages/Bridge/SelectNetwork.vue index 44998b63e..84c66ee74 100644 --- a/src/components/pages/Bridge/SelectNetwork.vue +++ b/src/components/pages/Bridge/SelectNetwork.vue @@ -84,12 +84,8 @@ export default class BridgeSelectNetwork extends Mixins(NetworkFormatterMixin) { return networks.reduce((buffer, { disabled, data: { id, name } }) => { let content = ''; - let link = false; - if (id === SubNetworkId.Polkadot) { - content = 'https://parachains.info/details/sora_polkadot'; - link = true; - } else if (disabled) { + if (disabled) { content = this.t('comingSoonText'); } @@ -100,7 +96,7 @@ export default class BridgeSelectNetwork extends Mixins(NetworkFormatterMixin) { disabled, info: { content, - link, + link: false, // if content should be a link }, }); diff --git a/src/consts/sub.ts b/src/consts/sub.ts index 395282712..09b7338fa 100644 --- a/src/consts/sub.ts +++ b/src/consts/sub.ts @@ -67,6 +67,18 @@ export const SUB_NETWORKS: Partial> = { blockExplorerUrls: [], shortName: 'SORA KSM', }, + [SubNetworkId.PolkadotSora]: { + id: SubNetworkId.PolkadotSora, + name: 'SORA Polkadot Parachain', + nativeCurrency: { + name: 'XOR', + symbol: 'XOR', + decimals: 18, + }, + endpointUrls: [], + blockExplorerUrls: [], + shortName: 'SORA DOT', + }, }; export const SUB_TRANSFER_FEES: SubNetworksFees = { @@ -82,4 +94,10 @@ export const SUB_TRANSFER_FEES: SubNetworksFees = { [BridgeTxDirection.Incoming]: '0', }, }, + [SubNetworkId.Polkadot]: { + DOT: { + [BridgeTxDirection.Outgoing]: '21062795', + [BridgeTxDirection.Incoming]: '0', + }, + }, }; diff --git a/src/indexer/queries/assets.ts b/src/indexer/queries/assets.ts index 2efb31b16..3ce1095d2 100644 --- a/src/indexer/queries/assets.ts +++ b/src/indexer/queries/assets.ts @@ -40,7 +40,7 @@ const SubqueryAssetsQuery = gql => { + const priceUSD = new FPNumber(item.priceUSD ?? 0); + const liquidityPools = FPNumber.fromCodecValue(item.liquidity ?? 0); + const liquidity = liquidityPools; + const tvlUSD = liquidity.mul(priceUSD); + return { [item.id]: { - priceUSD: new FPNumber(item.priceUSD ?? 0), + priceUSD, priceChangeDay: new FPNumber(item.priceChangeDay ?? 0), priceChangeWeek: new FPNumber(item.priceChangeWeek ?? 0), volumeDayUSD: new FPNumber(item.volumeDayUSD ?? 0), volumeWeekUSD: new FPNumber(item.volumeWeekUSD ?? 0), - tvlUSD: new FPNumber(item.liquidityUSD ?? 0), + tvlUSD, velocity: new FPNumber(item.velocity ?? 0), }, }; diff --git a/src/store/web3/actions.ts b/src/store/web3/actions.ts index 591955fe7..6d6967aa7 100644 --- a/src/store/web3/actions.ts +++ b/src/store/web3/actions.ts @@ -195,6 +195,10 @@ const actions = defineActions({ }); }, + /** + * Only for assets, created in SORA network! + * "Thischain" for SORA, "Sidechain" for EVM + */ async getEvmTokenAddressByAssetId(context, soraAssetId: string): Promise { const { getters } = web3ActionContext(context); try { @@ -210,6 +214,10 @@ const actions = defineActions({ const contractInstance = new ethers.Contract(contractAddress, contractAbi, signer); const methodArgs = [soraAssetId]; const externalAddress = await contractInstance._sidechainTokens(...methodArgs); + // Not (wrong) registered Sora asset on bridge contract return '0' address (like native token) + if (ethersUtil.isNativeEvmTokenAddress(externalAddress)) { + throw new Error('Asset is not registered'); + } return externalAddress; } catch (error) { console.error(soraAssetId, error); diff --git a/src/styles/common.scss b/src/styles/common.scss index 8abf97e12..49de5ddac 100644 --- a/src/styles/common.scss +++ b/src/styles/common.scss @@ -19,7 +19,7 @@ $country-emoji-font: 'Twemoji Country Flags'; } $networks: 'sora', 'ethereum', 'ethereum-classic', 'avalanche', 'klaytn', 'polygon', 'binance-smart-chain', 'rococo', 'karura', 'polkadot', 'kusama'; -$sora-parachains: 'sora' 'rococo', 'sora' 'kusama'; +$sora-parachains: 'sora' 'rococo', 'sora' 'kusama', 'sora' 'polkadot'; /* Networks Icons */ .network-icon { display: inline-block; diff --git a/src/utils/bridge/sub/classes/adapter.ts b/src/utils/bridge/sub/classes/adapter.ts index ddd703145..01c6fe43a 100644 --- a/src/utils/bridge/sub/classes/adapter.ts +++ b/src/utils/bridge/sub/classes/adapter.ts @@ -147,7 +147,7 @@ class SoraParachainAdapter extends SubAdapter { } } -class KusamaAdapter extends SubAdapter { +class RelaychainAdapter extends SubAdapter { protected getTransferExtrinsic(asset: RegisteredAsset, recipient: string, amount: number | string) { const value = new FPNumber(amount, asset.externalDecimals).toCodecString(); @@ -202,12 +202,19 @@ class KusamaAdapter extends SubAdapter { try { return await super.getNetworkFee(asset, sender, recipient); } catch { - // Hardcoded value for Rococo - 0.000125 ROC - if (this.subNetwork === SubNetworkId.Rococo) { - return '125810197'; + switch (this.subNetwork) { + case SubNetworkId.Rococo: + // Hardcoded value for Rococo - 0.000125 ROC + return '125810197'; + case SubNetworkId.Kusama: + // Hardcoded value for Kusama - 0.0007 KSM + return '700000000'; + case SubNetworkId.Polkadot: + // Hardcoded value for Polkadot - 0.01836 DOT + return '183600000'; + default: + return '0'; } - // Hardcoded value for Kusama - 0.0007 KSM - return '700000000'; } } } @@ -228,10 +235,12 @@ export class SubNetworksConnector { public static endpoints: SubNetworkApps = {}; public readonly adapters = { - [SubNetworkId.Rococo]: () => new KusamaAdapter(SubNetworkId.Rococo), - [SubNetworkId.Kusama]: () => new KusamaAdapter(SubNetworkId.Kusama), + [SubNetworkId.Rococo]: () => new RelaychainAdapter(SubNetworkId.Rococo), + [SubNetworkId.Kusama]: () => new RelaychainAdapter(SubNetworkId.Kusama), + [SubNetworkId.Polkadot]: () => new RelaychainAdapter(SubNetworkId.Polkadot), [SubNetworkId.RococoSora]: () => new SoraParachainAdapter(SubNetworkId.RococoSora), [SubNetworkId.KusamaSora]: () => new SoraParachainAdapter(SubNetworkId.KusamaSora), + [SubNetworkId.PolkadotSora]: () => new SoraParachainAdapter(SubNetworkId.PolkadotSora), }; get uniqueConnections(): SubNetworkConnection[] { diff --git a/src/views/BridgeTransaction.vue b/src/views/BridgeTransaction.vue index 214077109..ef7e5779a 100644 --- a/src/views/BridgeTransaction.vue +++ b/src/views/BridgeTransaction.vue @@ -374,6 +374,8 @@ export default class BridgeTransaction extends Mixins( } get txInternalHash(): string { + if (!this.isOutgoing) return this.txSoraHash; + return this.txSoraHash || this.txSoraBlockId || this.txSoraId; } diff --git a/yarn.lock b/yarn.lock index 9c04399b5..a5dee1806 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2349,68 +2349,68 @@ resolved "https://registry.yarnpkg.com/@soda/get-current-script/-/get-current-script-1.0.2.tgz#a53515db25d8038374381b73af20bb4f2e508d87" integrity sha512-T7VNNlYVM1SgQ+VsMYhnDkcGmWhQdL0bDyGm5TlQ3GBXnJscEClUUOKduWTmm2zCnvNLC1hc3JpuXjs/nFOc5w== -"@sora-substrate/api@1.27.9": - version "1.27.9" - resolved "https://registry.yarnpkg.com/@sora-substrate/api/-/api-1.27.9.tgz#7a6ff8ddde286eccdd8e3dba123c1ee53eaee2d9" - integrity sha512-OS0fOKcNAGd5dsYi46lXJof9+ekNefimeaDPQ56tQ96mEQC1374Xjwsp3VbymTLy/Mf6gq+YZCZccIktcMOIsw== +"@sora-substrate/api@1.28.0": + version "1.28.0" + resolved "https://registry.yarnpkg.com/@sora-substrate/api/-/api-1.28.0.tgz#9534b4621db69d457e758de8d2d8477f5743d04d" + integrity sha512-2OlJE4AVKw22QLJWMQOLRmAnPOY2IdRpo15Vb410dQZ//whAWeCdb+z2gso/xzBbBAKkJMTDN18TdCSHLhwEnQ== dependencies: "@open-web3/orml-api-derive" "1.1.4" "@polkadot/api" "9.14.2" - "@sora-substrate/types" "1.27.9" + "@sora-substrate/types" "1.28.0" -"@sora-substrate/connection@1.27.9": - version "1.27.9" - resolved "https://registry.yarnpkg.com/@sora-substrate/connection/-/connection-1.27.9.tgz#985fb485bf94b904c4aa92485c0673a0b844a1cd" - integrity sha512-SSEzQOLvrhYyXZbVTvRfShf+9YJcA84jSsOtl81WaRSNd9AGv/v8LxoGfMS7PrJHzAPzziM+0Gd1wK0kqMI4qQ== +"@sora-substrate/connection@1.28.0": + version "1.28.0" + resolved "https://registry.yarnpkg.com/@sora-substrate/connection/-/connection-1.28.0.tgz#9ca8790b561ee417e67f3fcd91001593f522807e" + integrity sha512-11HEICfy3JwtdRGJwJMB4/Z4SINUf4kcn5PcsCKwZMC5DZDQADylp7pcy6UwGcr/Eq4hwvl6iI6R5XH9lXLuqQ== dependencies: - "@sora-substrate/api" "1.27.9" + "@sora-substrate/api" "1.28.0" -"@sora-substrate/liquidity-proxy@1.27.9": - version "1.27.9" - resolved "https://registry.yarnpkg.com/@sora-substrate/liquidity-proxy/-/liquidity-proxy-1.27.9.tgz#86877b25e28c1730c45aaf0d171b37a2ccdf8246" - integrity sha512-gSZlo9976G6WXewpEeX8GB30T8UPMpvrTWen71jEEYl4T+EYVSG5HGEpbN5Ijbe+wd5lhZENs+23CnBYTIlmXg== +"@sora-substrate/liquidity-proxy@1.28.0": + version "1.28.0" + resolved "https://registry.yarnpkg.com/@sora-substrate/liquidity-proxy/-/liquidity-proxy-1.28.0.tgz#c036dc55219116aaffb3ba78efb849241d492f32" + integrity sha512-IwF4rJtq/6GzkeyRgP9/gIPZ6McxxKjLonQXMqGFKdZVy/1rnZXWXhZQLJ+V3btRdSNszsgM6Mzoi26Civ7vsw== dependencies: - "@sora-substrate/math" "1.27.9" + "@sora-substrate/math" "1.28.0" -"@sora-substrate/math@1.27.9": - version "1.27.9" - resolved "https://registry.yarnpkg.com/@sora-substrate/math/-/math-1.27.9.tgz#c8b3803f35f6d767c01c61c20066ab1445fb786c" - integrity sha512-xiFBE3XBNtnLhPJrknO5eSGXVdZ2ligqnuO3Sh9IbZAobteqOm9chRxDr3qFDV1+wrT6w6pdXYYz5Ohm+/vSTw== +"@sora-substrate/math@1.28.0": + version "1.28.0" + resolved "https://registry.yarnpkg.com/@sora-substrate/math/-/math-1.28.0.tgz#289681ad1b9d23b52a5158c5eadfa8a94391504e" + integrity sha512-ouTCvQPAyiIAT2hqkGIXqPVVbK3Q7tHQC6PUhTPVIjljL+64ybI9+z1LZz08oK2KHu1kHU3x3Txz9yHMMr+U/w== dependencies: "@polkadot/types" "9.14.2" bignumber.js "^9.0.1" lodash "^4.17.15" -"@sora-substrate/type-definitions@1.27.9": - version "1.27.9" - resolved "https://registry.yarnpkg.com/@sora-substrate/type-definitions/-/type-definitions-1.27.9.tgz#b564c6cf4b0d6abb5b4aabbf388d105cf78ea140" - integrity sha512-G/coyt9QOf4XeqMzMfu4fPJaa75EOhH7ys1y3ESDfMK7pCsrzzDmClfJ3cTRDb1cO/HHsUBAMcVlyXPTM/vHgQ== +"@sora-substrate/type-definitions@1.28.0": + version "1.28.0" + resolved "https://registry.yarnpkg.com/@sora-substrate/type-definitions/-/type-definitions-1.28.0.tgz#64b99491622ad4923c70c652db28e39ef17c5403" + integrity sha512-BYfv5ZXl8fGnXoUgQkB55UaF5jM2k1aCjVz0l6o19dlXJeXDRNAeLzr2GRcvuEyb57AifqceTPEchcghDqe1Pw== dependencies: "@open-web3/orml-type-definitions" "1.1.4" -"@sora-substrate/types@1.27.9": - version "1.27.9" - resolved "https://registry.yarnpkg.com/@sora-substrate/types/-/types-1.27.9.tgz#a8f3ebacb0aaaeb598ffcf7bc16a2a8bf284fcd3" - integrity sha512-Q4vP0Lq6Xi9r/75If/12HSUiFVQEKa/vH/eF1sdvWFYSUikOuyWeJKOhuE+YYwzq2utUNF+W9peAveWXPkShxg== +"@sora-substrate/types@1.28.0": + version "1.28.0" + resolved "https://registry.yarnpkg.com/@sora-substrate/types/-/types-1.28.0.tgz#332e0af02496436ccf9f4ea26b90fb3686c20872" + integrity sha512-ce2OhFr5BWKUCY4ot6OGOllt1EwHvC7WBZ/ORWmSMVtYr5qVbl13gwBnU94MVUD9T//gw9/Y28fb0CVQ4674fA== dependencies: "@open-web3/api-mobx" "0.9.4-26" "@open-web3/orml-types" "1.1.4" "@polkadot/api" "9.14.2" "@polkadot/typegen" "9.14.2" "@polkadot/types" "9.14.2" - "@sora-substrate/type-definitions" "1.27.9" + "@sora-substrate/type-definitions" "1.28.0" -"@sora-substrate/util@1.27.9": - version "1.27.9" - resolved "https://registry.yarnpkg.com/@sora-substrate/util/-/util-1.27.9.tgz#8d1862278496e21f9aa40e3967149b86bba27ea0" - integrity sha512-aaVnLAAY8gAvCm4vQJjP/cibsisZv2EkDhuuL1UFlaCKBKFfU+CJTBy/CmxR7lIExEYzQBQfNIVMaqc8K76ASQ== +"@sora-substrate/util@1.28.0": + version "1.28.0" + resolved "https://registry.yarnpkg.com/@sora-substrate/util/-/util-1.28.0.tgz#2fa20c0252f03da8d9ffd170b478b2d97168f941" + integrity sha512-FoN6dyEIgqUbYjBPKKBJwKCK4MIRpHcs0rLRqqqB0GCcp1hfCwihYmru/mhZOs5qFmq9WqMFzK0k0FgPYlCRdw== dependencies: "@polkadot/ui-keyring" "2.12.1" - "@sora-substrate/api" "1.27.9" - "@sora-substrate/connection" "1.27.9" - "@sora-substrate/liquidity-proxy" "1.27.9" - "@sora-substrate/math" "1.27.9" - "@sora-substrate/types" "1.27.9" + "@sora-substrate/api" "1.28.0" + "@sora-substrate/connection" "1.28.0" + "@sora-substrate/liquidity-proxy" "1.28.0" + "@sora-substrate/math" "1.28.0" + "@sora-substrate/types" "1.28.0" axios "^0.21.1" crypto-js "^4.0.0" lodash "^4.17.15" @@ -2443,13 +2443,13 @@ vue-property-decorator "^9.1.2" vuex "^3.6.2" -"@soramitsu/soraneo-wallet-web@1.27.3": - version "1.27.3" - resolved "https://nexus.iroha.tech/repository/npm-group/@soramitsu/soraneo-wallet-web/-/soraneo-wallet-web-1.27.3.tgz#b2439ec0d44fc07a3bce0f010a38d2bb6353bd19" - integrity sha512-ufr2Ll/bYFLPw5897uR02bK7YlGUg90fNEtaLN/gg1ZMys5hyVUt//dCoy+SRzAapqPHnhNJx+JbmnyyEPuSAg== +"@soramitsu/soraneo-wallet-web@1.28.0": + version "1.28.0" + resolved "https://nexus.iroha.tech/repository/npm-group/@soramitsu/soraneo-wallet-web/-/soraneo-wallet-web-1.28.0.tgz#a0bbc34aecd369aba3259e322eb9e0b23734d726" + integrity sha512-+n8Y3FpeG511FaszYpqeIziSTtFKOfYg7WjAvZ1TxtKCk14zuRijcYnR8awd4aJA2v5+SOBvg2h/Tw2s6VF9TQ== dependencies: "@polkadot/vue-identicon" "2.12.1" - "@sora-substrate/util" "1.27.9" + "@sora-substrate/util" "1.28.0" "@sora-test/wallet-connect" "^0.0.9" "@soramitsu/soramitsu-js-ui" "^1.0.46" "@urql/core" "^4.1.2"