From 4d2e5fa0ebf7871b77fb036f54a026c17a036754 Mon Sep 17 00:00:00 2001 From: Carson Aberle Date: Thu, 17 Nov 2022 13:23:44 -0700 Subject: [PATCH] Adjusted connect function for coin98 --- src/wallet/connection.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/wallet/connection.ts b/src/wallet/connection.ts index 49af094..607eecd 100644 --- a/src/wallet/connection.ts +++ b/src/wallet/connection.ts @@ -4,16 +4,20 @@ import { WalletConnect, WalletWindowKey } from './types'; declare global { interface Window { keplr: { getOfflineSigner: (string) => Promise; experimentalSuggestChain: (object) => void }; - leap: { getOfflineSigner: (string) => Promise }; + leap: { getOfflineSigner: (string) => Promise; experimentalSuggestChain: (object) => void }; + coin98: { cosmos: (chain) => Promise }; + falcon: { getOfflineSigner: (string) => Promise; experimentalSuggestChain: (object) => void }; } } export const connect = async (inputWallet: WalletWindowKey, chainId?: string, restUrl?: string, rpcUrl?: string): Promise => { - await window[inputWallet].experimentalSuggestChain(getChainSuggest(chainId, restUrl, rpcUrl)); + const windowKey = inputWallet === 'coin98' ? 'keplr' : inputWallet; + + await window[windowKey].experimentalSuggestChain(getChainSuggest(chainId, restUrl, rpcUrl)); if (typeof window === 'undefined' || !window) return; - const offlineSigner = await window[inputWallet].getOfflineSigner(chainId); + const offlineSigner = await window[windowKey].getOfflineSigner(chainId); const accounts = await offlineSigner.getAccounts(); return { offlineSigner, accounts };