diff --git a/package.json b/package.json index 71aca0802..77c0c3853 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ }, "dependencies": { "@metamask/detect-provider": "^2.0.0", - "@soramitsu/soraneo-wallet-web": "1.23.1", + "@soramitsu/soraneo-wallet-web": "1.23.3", "@walletconnect/web3-provider": "^1.8.0", "core-js": "^3.26.0", "country-code-emoji": "^2.3.0", diff --git a/src/store/bridge/actions.ts b/src/store/bridge/actions.ts index b8cba4979..b213a2fa6 100644 --- a/src/store/bridge/actions.ts +++ b/src/store/bridge/actions.ts @@ -490,7 +490,9 @@ const actions = defineActions({ const referenceAsset = DAI.address; const sources = [LiquiditySourceTypes.XYKPool, LiquiditySourceTypes.XSTPool]; const limitObservable = api.bridgeProxy.getCurrentTransferLimitObservable(); - const quoteObservable = await api.swap.getSwapQuoteObservable(referenceAsset, limitAsset, sources, DexId.XOR); + const quoteObservable = api.swap.getSwapQuoteObservable(referenceAsset, limitAsset, sources, DexId.XOR); + + if (!quoteObservable) return; let subscription!: Subscription; diff --git a/src/store/swap/mutations.ts b/src/store/swap/mutations.ts index 504c5ff75..348a9c3ac 100644 --- a/src/store/swap/mutations.ts +++ b/src/store/swap/mutations.ts @@ -58,7 +58,8 @@ const mutations = defineMutations()({ setRoute(state, route: string[]): void { state.route = Object.freeze([...route]); }, - setSubscriptionPayload(state, { quote, isAvailable, liquiditySources }: SwapQuoteData): void { + setSubscriptionPayload(state, payload?: SwapQuoteData): void { + const { quote = null, isAvailable = false, liquiditySources = [] } = payload ?? {}; state.swapQuote = quote; state.isAvailable = isAvailable; state.liquiditySources = liquiditySources; diff --git a/src/utils/bridge/eth/classes/history.ts b/src/utils/bridge/eth/classes/history.ts index af6b6a3b7..2036b8f43 100644 --- a/src/utils/bridge/eth/classes/history.ts +++ b/src/utils/bridge/eth/classes/history.ts @@ -1,12 +1,6 @@ import { Operation } from '@sora-substrate/util'; import { BridgeNetworkType, BridgeTxStatus } from '@sora-substrate/util/build/bridgeProxy/consts'; -import { - api, - historyElementsFilter, - SUBQUERY_TYPES, - WALLET_CONSTS, - getCurrentIndexer, -} from '@soramitsu/soraneo-wallet-web'; +import { api, SUBQUERY_TYPES, WALLET_CONSTS, getCurrentIndexer } from '@soramitsu/soraneo-wallet-web'; import { ethers, EtherscanProvider, BlockTag } from 'ethers'; import first from 'lodash/fp/first'; import last from 'lodash/fp/last'; @@ -259,8 +253,9 @@ export class EthBridgeHistory { } public async fetchHistoryElements(address: string, timestamp = 0, ids?: string[]): Promise { + const indexer = getCurrentIndexer(); const operations = [Operation.EthBridgeOutgoing, Operation.EthBridgeIncoming]; - const filter = historyElementsFilter({ address, operations, timestamp, ids }); + const filter = indexer.historyElementsFilter({ address, operations, timestamp, ids }); const history: HistoryElement[] = []; let hasNext = true; @@ -268,7 +263,6 @@ export class EthBridgeHistory { do { const variables = { after, filter, first: 100 }; - const indexer = getCurrentIndexer(); const response = await indexer.services.explorer.account.getHistoryPaged(variables); if (!response) return history; diff --git a/src/views/Swap.vue b/src/views/Swap.vue index 9aac84a3c..360491d00 100644 --- a/src/views/Swap.vue +++ b/src/views/Swap.vue @@ -237,7 +237,7 @@ export default class Swap extends Mixins( @mutation.swap.setRewards private setRewards!: (rewards: Array) => void; @mutation.swap.setRoute private setRoute!: (route: Array) => void; @mutation.swap.selectDexId private selectDexId!: (dexId: DexId) => void; - @mutation.swap.setSubscriptionPayload private setSubscriptionPayload!: (payload: SwapQuoteData) => void; + @mutation.swap.setSubscriptionPayload private setSubscriptionPayload!: (payload?: SwapQuoteData) => void; @action.swap.setTokenFromAddress private setTokenFromAddress!: (address?: string) => Promise; @action.swap.setTokenToAddress private setTokenToAddress!: (address?: string) => Promise; @@ -406,6 +406,8 @@ export default class Swap extends Mixins( await this.setTokenFromAddress(XOR.address); await this.setTokenToAddress(); } + // to update tbc & xst enabled assets + await api.swap.update(); this.enableSwapSubscriptions(); }); @@ -490,16 +492,20 @@ export default class Swap extends Mixins( this.loading = true; - const observableQuote = await api.swap.getDexesSwapQuoteObservable( + const observableQuote = api.swap.getDexesSwapQuoteObservable( (this.tokenFrom as AccountAsset).address, (this.tokenTo as AccountAsset).address ); - this.quoteSubscription = observableQuote.subscribe((quoteData) => { - this.setSubscriptionPayload(quoteData); - this.runRecountSwapValues(); - this.loading = false; - }); + if (observableQuote) { + this.quoteSubscription = observableQuote.subscribe((quoteData) => { + this.setSubscriptionPayload(quoteData); + this.runRecountSwapValues(); + this.loading = false; + }); + } else { + this.setSubscriptionPayload(); + } } handleFocusField(isExchangeB = false): void { diff --git a/yarn.lock b/yarn.lock index ce0d31490..04fadbb5f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2263,68 +2263,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.23.3": - version "1.23.3" - resolved "https://registry.yarnpkg.com/@sora-substrate/api/-/api-1.23.3.tgz#1b2f0ebcde0c48fd81901aadcca59ae5c77158eb" - integrity sha512-yrEVQS+pSnJv0kB17Ex+z7ZhLR2KY7d/jU/7/DrX5da7uJ8YLeXxL3aGmswkNMSBJtBJPcQQJwXwQXGoE17M6g== +"@sora-substrate/api@1.23.9": + version "1.23.9" + resolved "https://registry.yarnpkg.com/@sora-substrate/api/-/api-1.23.9.tgz#8e1bd67c0efddc4b49bf0c7f42aa4b5f394915e3" + integrity sha512-xmD36pc78zbBDY568oCyItzYKokU3sHKnVnVdVO5rGA5KfeY4fKg+KHl5ekUB5HtJN/+IXPIhomLFj89e7J0sQ== dependencies: "@open-web3/orml-api-derive" "1.1.4" "@polkadot/api" "9.14.2" - "@sora-substrate/types" "1.23.3" + "@sora-substrate/types" "1.23.9" -"@sora-substrate/connection@1.23.3": - version "1.23.3" - resolved "https://registry.yarnpkg.com/@sora-substrate/connection/-/connection-1.23.3.tgz#515f6f4e0055df848f630b66f3be33a07a1abcc5" - integrity sha512-nK1znTMy+3jGvylJB+zIt9qBD1Q9aJhrx36K1VOWTHrbiPa1gsOfizXE2s4S7DcdxgRIA0hhJVkNAEuNsO02SA== +"@sora-substrate/connection@1.23.9": + version "1.23.9" + resolved "https://registry.yarnpkg.com/@sora-substrate/connection/-/connection-1.23.9.tgz#724d8101782fe2280e56e39837372c61f10997a3" + integrity sha512-qXKkO5h8RbLdhCw/T0UfwyWpAoAbQE+d5k3sHdymZjhCk6V4xgwIba2jl/v8v5Xw4W+lYqOiNs/3M3IJ0ZvF+A== dependencies: - "@sora-substrate/api" "1.23.3" + "@sora-substrate/api" "1.23.9" -"@sora-substrate/liquidity-proxy@1.23.3": - version "1.23.3" - resolved "https://registry.yarnpkg.com/@sora-substrate/liquidity-proxy/-/liquidity-proxy-1.23.3.tgz#cd87fc3e9ea829174105bb20896f707fffb734ed" - integrity sha512-Wt1N+zH6CyzCK3uiyNZAf6SfjTQTyHRtz2bfJt87bI8AqE/dIf+HI5kvGZ2wjw49LVl35zL9WCmK4d/YNIgsTg== +"@sora-substrate/liquidity-proxy@1.23.9": + version "1.23.9" + resolved "https://registry.yarnpkg.com/@sora-substrate/liquidity-proxy/-/liquidity-proxy-1.23.9.tgz#7a6c2106bef9c6e28c708ca2fb0f8ffd113b1fb6" + integrity sha512-Q7KtncQq/BHmfpeICbUXrfUNf24VLlyXhdWVJKpVEenHUHCkIkepj/OhcG5dMU7aojLAgTYsoHmTqBNGlcvjcQ== dependencies: - "@sora-substrate/math" "1.23.3" + "@sora-substrate/math" "1.23.9" -"@sora-substrate/math@1.23.3": - version "1.23.3" - resolved "https://registry.yarnpkg.com/@sora-substrate/math/-/math-1.23.3.tgz#53eddcf6a5bd71b9679f1899d4d4386892eaec94" - integrity sha512-mhMyyfaGQFbf01J9vbJFavcfZCgXtcduKi/V6VtGUjbgCeWps/GcUBAOdUWDLGJUprVOFXbefgsTeaMbxeiHmA== +"@sora-substrate/math@1.23.9": + version "1.23.9" + resolved "https://registry.yarnpkg.com/@sora-substrate/math/-/math-1.23.9.tgz#55c45b555533c8b608333635c06b29761027925b" + integrity sha512-MODKMFvgSL7vsR9s0k1D6770cEX2kn/6BbEtBpsjGPda17Vw2kWwYxaGdn1vP8Gy2tpGynvbfdeHWS1EzxQzBw== dependencies: "@polkadot/types" "9.14.2" bignumber.js "^9.0.1" lodash "^4.17.15" -"@sora-substrate/type-definitions@1.23.3": - version "1.23.3" - resolved "https://registry.yarnpkg.com/@sora-substrate/type-definitions/-/type-definitions-1.23.3.tgz#ee4cbc272deb5b8af9650e4a1426f954a2406533" - integrity sha512-z1cWllnw8hnB2EbYK/AVWN/rrg9qpl5xoRzg4Hhp4ovia9RA+2w6ibSk1o+rvXX8lW2QaR4roUQdWr82CqpFhg== +"@sora-substrate/type-definitions@1.23.9": + version "1.23.9" + resolved "https://registry.yarnpkg.com/@sora-substrate/type-definitions/-/type-definitions-1.23.9.tgz#d76f417af43fbbfecf777318e629198465610d5e" + integrity sha512-Rnqm0HsKtXfnJTDl/emtNaI1BTdXmjPsZcTGHjfnDXmIWjE6YQ8iegJEuJiGg6AcCyICXoEoEqrLzXZC+jH01g== dependencies: "@open-web3/orml-type-definitions" "1.1.4" -"@sora-substrate/types@1.23.3": - version "1.23.3" - resolved "https://registry.yarnpkg.com/@sora-substrate/types/-/types-1.23.3.tgz#e2f611900cdc6cbc10c7bb8de18b61d53dc2a52e" - integrity sha512-jrbztVx0ZAyD9us5CkZtQtnrXahoL2eZVsEyMM5gn1cxI2j80WIvnkAvD8DwocQx53cID8K60ma4dhCQZBdVDA== +"@sora-substrate/types@1.23.9": + version "1.23.9" + resolved "https://registry.yarnpkg.com/@sora-substrate/types/-/types-1.23.9.tgz#a3a51ab48b501b5c5ac1fcfebff29f8713e8b347" + integrity sha512-P1/1RA4jGzw9r87AUfT05tfMshBPoW4aQoR1oMqf9RmanhPBEVJZq4ZOa3W0HIQAxoTemkC1Cs13lg+CAxiXnQ== 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.23.3" + "@sora-substrate/type-definitions" "1.23.9" -"@sora-substrate/util@1.23.3": - version "1.23.3" - resolved "https://registry.yarnpkg.com/@sora-substrate/util/-/util-1.23.3.tgz#396d44d50c54d430d0a1d1dcb45b37bd6d6da701" - integrity sha512-Sh70+A/qKVSnE8AKSNzV8ATO2V4cjzJS23OI7iPn0fC2LcVl/sexg4jwKxCFZacK8knxAvw1VOSTSlg2VieW1A== +"@sora-substrate/util@1.23.9": + version "1.23.9" + resolved "https://registry.yarnpkg.com/@sora-substrate/util/-/util-1.23.9.tgz#fb2f37e3078874be457609c766d5cd0dfa218d3c" + integrity sha512-yrsn7bClablYI9iYFpAFsDgkhTKCC3R8GsV17NDD0c1vFt60sCF3pHXRWJcmgssu9SZ7Fqbx50Pd1pLD6/Kpmw== dependencies: "@polkadot/ui-keyring" "2.12.1" - "@sora-substrate/api" "1.23.3" - "@sora-substrate/connection" "1.23.3" - "@sora-substrate/liquidity-proxy" "1.23.3" - "@sora-substrate/math" "1.23.3" - "@sora-substrate/types" "1.23.3" + "@sora-substrate/api" "1.23.9" + "@sora-substrate/connection" "1.23.9" + "@sora-substrate/liquidity-proxy" "1.23.9" + "@sora-substrate/math" "1.23.9" + "@sora-substrate/types" "1.23.9" axios "^0.21.1" crypto-js "^4.0.0" lodash "^4.17.15" @@ -2357,13 +2357,13 @@ vue-property-decorator "^9.1.2" vuex "^3.6.2" -"@soramitsu/soraneo-wallet-web@1.23.1": - version "1.23.1" - resolved "https://nexus.iroha.tech/repository/npm-group/@soramitsu/soraneo-wallet-web/-/soraneo-wallet-web-1.23.1.tgz#7be6d0e977e7169ba700f063fc0d2932c2dd970c" - integrity sha512-WEqgvAtMW/ywSUMHyc3UdK5lOw9b4ACoxkqzFVaxfGbeMXLNLLNLitfpw88faKs0x0L4ACWmlt1qpS25Y+TTyg== +"@soramitsu/soraneo-wallet-web@1.23.3": + version "1.23.3" + resolved "https://nexus.iroha.tech/repository/npm-group/@soramitsu/soraneo-wallet-web/-/soraneo-wallet-web-1.23.3.tgz#5236a91badaa266ed42416ed568fc4981c94cd2a" + integrity sha512-TkfqRlbwT2XvzKASTL6RCXTl/OfV3OI0/sB76/5E+AroBM8flxHjtJsHs0aLAu5Hc8OF8l80R/1M92qOn10Geg== dependencies: "@polkadot/vue-identicon" "2.12.1" - "@sora-substrate/util" "1.23.3" + "@sora-substrate/util" "1.23.9" "@sora-test/wallet-connect" "^0.0.9" "@soramitsu/soramitsu-js-ui" "^1.0.46" "@urql/core" "^4.1.2"