From efc364b0652cdb998ce638974ec81b694519a02e Mon Sep 17 00:00:00 2001 From: tolgahan-arikan Date: Tue, 25 Jul 2023 16:22:52 +0300 Subject: [PATCH] Use default walletAppURL if not passed with urlParams --- src/App.tsx | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index babd3c9..dca9839 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -59,7 +59,7 @@ if (walletAppURL && walletAppURL.length > 0) { // Init the sequence wallet library at the top-level of your project with // your designed default chain id - sequence.initWallet(defaultChainId) + sequence.initWallet(defaultChainId, { walletAppURL }) } // App component @@ -241,7 +241,7 @@ const App = () => { resetConsole() appendConsoleLine(`selected chainId: ${chainId}`) - + const topChainId = await wallet.getChainId() appendConsoleLine(`top chainId: ${topChainId}`) @@ -333,7 +333,7 @@ const App = () => { const signMessage = async () => { try { resetConsole() - + const wallet = sequence.getWallet() appendConsoleLine('signing message...') @@ -740,13 +740,19 @@ And that has made all the difference. // networks list, filtered and sorted const omitNetworks = [ - ChainId.RINKEBY, ChainId.HARDHAT, ChainId.HARDHAT_2, ChainId.KOVAN, - ChainId.FANTOM, ChainId.FANTOM_TESTNET, ChainId.ROPSTEN, - ChainId.AURORA, ChainId.AURORA_TESTNET + ChainId.RINKEBY, + ChainId.HARDHAT, + ChainId.HARDHAT_2, + ChainId.KOVAN, + ChainId.FANTOM, + ChainId.FANTOM_TESTNET, + ChainId.ROPSTEN, + ChainId.AURORA, + ChainId.AURORA_TESTNET ] const networks = Object.values(sequence.network.networks) - .filter(val => (omitNetworks.indexOf(val.chainId) < 0)) - .sort((a, b) => a.title > b.title ? 1 : -1) + .filter(val => omitNetworks.indexOf(val.chainId) < 0) + .sort((a, b) => (a.title > b.title ? 1 : -1)) return ( @@ -799,7 +805,7 @@ And that has made all the difference. name="chainId" label={'Network'} labelLocation="top" - onValueChange={value => setChainId(Number(value)) } + onValueChange={value => setChainId(Number(value))} defaultValue={String(defaultChainId)} options={[ ...Object.values(networks).map(network => ({ @@ -858,7 +864,7 @@ And that has made all the difference. -