refactor!: change chainId to enum#31
Conversation
…thorized" This reverts commit 74a4f40.
| rpcUrls: { | ||
| default: { | ||
| http: [ | ||
| 'https://rpc.ankr.com/btc_signet/c58ee1c627c5ad7cd69197c352aa51bdcebd87b86e0363c1e5133d5735cb3c69', |
There was a problem hiding this comment.
@chybisov Couldn't find a public testnet rpc, does thorswap have a public rpc for signet or testnet?
There was a problem hiding this comment.
Good question, maybe some of these could work https://dev.thorchain.org/concepts/connecting-to-thorchain.html#quick-reference
There was a problem hiding this comment.
I couldn't find an rpc for testnet here, only comsos, and tendermint
|
@tomiiide you might want to remove empty file |
| // debounced because xverse wallet calls the event handler twice in rapid succession | ||
| chainChange = debounce( | ||
| (event: XverseNetworkChangeEventParams) => | ||
| this.onChainChanged(XverseBitcoinChainIdMap[event.bitcoin.name]), | ||
| 300 | ||
| ) | ||
| provider.addListener('networkChange', chainChange) |
There was a problem hiding this comment.
What issues can it cause if used without debounce?
There was a problem hiding this comment.
If a user is connected to his xverse wallet, and he changes network on the wallet, the connect dialog to the new network would pop up twice
There was a problem hiding this comment.
Are we sure 300ms is consistently enough?
There was a problem hiding this comment.
Yeah, I'm sure, but I'll test again
|
|
||
| export const bitcoin = /*#__PURE__*/ defineChain({ | ||
| id: 20000000000001, | ||
| id: ChainId.BITCOIN_MAINNET, |
There was a problem hiding this comment.
Are we sure this won't cause any trouble for LI.FI integration? 20000000000001 is used as an internal ID for the Bitcoin chain there.
There was a problem hiding this comment.
Need a small change required during the creation of the UXTO client.
lifinance/sdk#296
I've tested, and it didn't cause any trouble. Everything works fine.
There was a problem hiding this comment.
@tomiiide do we still need to pass chainIds here after we merge this https://github.com/lifinance/widget/blob/main/packages/wallet-management/src/createDefaultBigmiConfig.ts ? I guess not 🤔
There was a problem hiding this comment.
Thanks for confirming! Please make a PR to the widget to remove that once this is merged 🙏
this was removed in this already. |
| const { forward: OneKeyBitcoinNetworkChainIdMap, reverse: ChainIdToOneKeyMap } = | ||
| createBidirectionalMap<OneKeyBitcoinNetwork, ChainId>([ | ||
| ['livenet', ChainId.BITCOIN_MAINNET], | ||
| ['testnet', ChainId.BITCOIN_TESTNET], | ||
| ] as const) |
There was a problem hiding this comment.
Since we don't export this, can we move it to the connector creation function (line 74 here)? The same can be applied to other connectors.
| // debounced because xverse wallet calls the event handler twice in rapid succession | ||
| chainChange = debounce( | ||
| (event: XverseNetworkChangeEventParams) => | ||
| this.onChainChanged(XverseBitcoinChainIdMap[event.bitcoin.name]), | ||
| 300 | ||
| ) | ||
| provider.addListener('networkChange', chainChange) |
There was a problem hiding this comment.
Are we sure 300ms is consistently enough?
This PR:
switchChain()andonChainChangedevent handlers to supported wallets