Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
Adjusted connect function for coin98
Browse files Browse the repository at this point in the history
  • Loading branch information
Carson Aberle committed Nov 17, 2022
1 parent 2184700 commit 4d2e5fa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/wallet/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,20 @@ import { WalletConnect, WalletWindowKey } from './types';
declare global {
interface Window {
keplr: { getOfflineSigner: (string) => Promise<any>; experimentalSuggestChain: (object) => void };
leap: { getOfflineSigner: (string) => Promise<any> };
leap: { getOfflineSigner: (string) => Promise<any>; experimentalSuggestChain: (object) => void };
coin98: { cosmos: (chain) => Promise<any> };
falcon: { getOfflineSigner: (string) => Promise<any>; experimentalSuggestChain: (object) => void };
}
}

export const connect = async (inputWallet: WalletWindowKey, chainId?: string, restUrl?: string, rpcUrl?: string): Promise<WalletConnect | undefined> => {
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 };
Expand Down

0 comments on commit 4d2e5fa

Please sign in to comment.