Skip to content

Commit 4b2bc84

Browse files
committed
Fix zilpay connection issue
1 parent 3067d41 commit 4b2bc84

File tree

2 files changed

+13
-25
lines changed

2 files changed

+13
-25
lines changed

src/app/saga/app/blockchainSaga.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,18 @@ function* initialize(
296296

297297
const { network, wallet } = action.payload
298298
const sdkState = (yield select((state: RootState) => state.carbonSDK.sdkCache)) as SimpleMap<CarbonSDK>
299-
if (!sdkState[network]) {
300-
const carbonNetwork = netZilToCarbon(network)
301-
const carbonSDK: CarbonSDK = yield call(CarbonSDK.instance, {
302-
network: carbonNetwork,
303-
})
304-
yield put(actions.CarbonSDK.updateCarbonSDK({ sdk: carbonSDK, network: network }))
299+
try {
300+
if (!sdkState[network]) {
301+
const carbonNetwork = netZilToCarbon(network)
302+
const carbonSDK: CarbonSDK = yield call(CarbonSDK.instance, {
303+
network: carbonNetwork,
304+
skipInit: true, // skip initialization while carbon chain undergoes upgrade.
305+
})
306+
yield put(actions.CarbonSDK.updateCarbonSDK({ sdk: carbonSDK, network: network }))
307+
}
308+
} catch (error) {
309+
console.warn("failed to initialize Carbon SDK");
310+
console.error(error);
305311
}
306312
const providerOrKey = getProviderOrKeyFromWallet(wallet)
307313
const { observingTxs } = getTransactions(yield select())

src/app/utils/bridge.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Blockchain, CarbonSDK, ConnectedCarbonSDK } from 'carbon-js-sdk'
2-
import { Token } from 'carbon-js-sdk/lib/codec'
32
import { SimpleMap } from 'carbon-js-sdk/lib/util/type'
43
import { Network } from "zilswap-sdk/lib/constants"
54
import { BridgeableChains, BridgeableEvmChains } from 'app/store/types'
@@ -54,23 +53,6 @@ export const getTokenDenoms = (network: CarbonSDK.Network, chain: Blockchain) =>
5453
return getTokenDenomList(network)[chain]
5554
}
5655

57-
/**
58-
* Returns a mapping of chains to their respective SWTH token info
59-
* @param {CarbonSDK.Network} network
60-
* @returns {SimpleMap<Token>}
61-
*/
62-
export const getSwthBridgeTokens = async (network: CarbonSDK.Network) => {
63-
var ret: SimpleMap<Token> = {}
64-
const carbonSdk: CarbonSDK = await CarbonSDK.instance({ network })
65-
const carbonTokens: Token[] = Object.values(carbonSdk.token.tokens)
66-
const swthBridgeDenoms = getTokenDenomList(network)
67-
Object.entries(swthBridgeDenoms).forEach(([chain, denom]) => {
68-
const swthToken = carbonTokens.find(d => d.denom === denom)!
69-
ret[chain] = swthToken
70-
})
71-
return ret
72-
}
73-
7456
/**
7557
* Returns a readonly map of EVM Blockchains to their respective chain IDs
7658
* @param {Network} network The selected Zilliqa network based on wallet (mainnet/ testnet)
@@ -288,4 +270,4 @@ export const getChainParams = (network: Network) => {
288270
},
289271
}
290272
}
291-
}
273+
}

0 commit comments

Comments
 (0)