diff --git a/packages/bridge/public/blockchains/walletconnect.svg b/packages/bridge/public/blockchains/walletconnect.svg new file mode 100644 index 0000000..a2243de --- /dev/null +++ b/packages/bridge/public/blockchains/walletconnect.svg @@ -0,0 +1,12 @@ + + + + WalletConnect + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/packages/bridge/src/assets/walletconnect.svg b/packages/bridge/src/assets/walletconnect.svg new file mode 100644 index 0000000..a2243de --- /dev/null +++ b/packages/bridge/src/assets/walletconnect.svg @@ -0,0 +1,12 @@ + + + + WalletConnect + Created with Sketch. + + + + + + + \ No newline at end of file diff --git a/packages/bridge/src/components/EthereumConnect/index.tsx b/packages/bridge/src/components/EthereumConnect/index.tsx index a744915..0c52d6f 100644 --- a/packages/bridge/src/components/EthereumConnect/index.tsx +++ b/packages/bridge/src/components/EthereumConnect/index.tsx @@ -2,12 +2,11 @@ import React from 'react'; import { Button } from 'antd'; import { useCorrectNetwork } from '../../hooks/useCorrectNetwork'; -import metamaskIcon from '../../assets/metamask.svg'; import { shortenAddress } from '@oyster/common'; import { useEthereum } from '../../contexts'; export const EthereumConnect = () => { - const { accounts, onConnectEthereum, connected } = useEthereum(); + const { accounts, onConnectEthereum, connected, walletProvider } = useEthereum(); const { hasCorrespondingNetworks } = useCorrectNetwork(); return ( @@ -16,11 +15,11 @@ export const EthereumConnect = () => { hasCorrespondingNetworks ? ( <> {'metamask-icon'} {shortenAddress(accounts[0], 4)} @@ -31,14 +30,7 @@ export const EthereumConnect = () => { ) ) : ( )} diff --git a/packages/bridge/src/components/TokenSelectModal/index.tsx b/packages/bridge/src/components/TokenSelectModal/index.tsx index a232dbd..e6406e4 100644 --- a/packages/bridge/src/components/TokenSelectModal/index.tsx +++ b/packages/bridge/src/components/TokenSelectModal/index.tsx @@ -119,6 +119,7 @@ export const TokenSelectModal = (props: { visible={isModalVisible} onCancel={() => hideModal()} footer={null} + className={"token-select-modal"} > { }); } else { console.log('Asset: ', asset); - debugger; + //debugger; // get user address from asset // diff --git a/packages/bridge/src/contexts/ethereum.tsx b/packages/bridge/src/contexts/ethereum.tsx index a6e0ccd..e69685b 100644 --- a/packages/bridge/src/contexts/ethereum.tsx +++ b/packages/bridge/src/contexts/ethereum.tsx @@ -14,7 +14,8 @@ import { useWallet as useEthereumWallet } from 'use-wallet'; import WalletConnectProvider from '@walletconnect/web3-provider'; // @ts-ignore import Fortmatic from 'fortmatic'; -import { useWallet, useLocalStorageState, WalletAdapter } from '@oyster/common'; +import { useWallet, useLocalStorageState} from '@oyster/common'; +import { WalletAdapter } from '@solana/wallet-base' import { TokenList, TokenInfo } from '@uniswap/token-lists'; import { ethers } from 'ethers'; import { MetamaskWalletAdapter } from '../wallet-adapters/metamask'; @@ -31,9 +32,9 @@ export const ETH_WALLET_PROVIDERS = [ adapter: MetamaskWalletAdapter, }, { - name: 'Wallect Connect', - url: 'https://walletconnect.org/', - icon: `${ASSETS_URL}walletconnect.svg`, + name: 'Wallet Connect', + url: 'https://walletconnect.org', + icon: `/blockchains/walletconnect.svg`, adapter: WalletConnectWalletAdapter, }, ]; @@ -46,6 +47,7 @@ export interface EthereumContextState { accounts: string[]; connected: boolean; chainId: number; + walletProvider: any; onConnectEthereum?: () => void; } @@ -55,6 +57,7 @@ export const EthereumContext = createContext({ accounts: [''], chainId: 0, connected: false, + walletProvider: null, }); export const EthereumProvider: FunctionComponent = ({ children }) => { @@ -184,7 +187,7 @@ export const EthereumProvider: FunctionComponent = ({ children }) => { if (walletConnected && !connected) { onConnectEthereum(); } - }, [walletConnected, connected]); + }, [walletConnected, connected, providerUrl]); return ( { provider, connected, chainId, + walletProvider, onConnectEthereum: () => onConnectEthereum(), }} > diff --git a/packages/bridge/src/wallet-adapters/metamask.tsx b/packages/bridge/src/wallet-adapters/metamask.tsx index 143584e..44843fa 100644 --- a/packages/bridge/src/wallet-adapters/metamask.tsx +++ b/packages/bridge/src/wallet-adapters/metamask.tsx @@ -1,6 +1,7 @@ import EventEmitter from 'eventemitter3'; import { PublicKey, Transaction } from '@solana/web3.js'; -import { notify, WalletAdapter } from '@oyster/common'; +import { notify } from '@oyster/common'; +import { WalletAdapter } from '@solana/wallet-base' import { ethers } from 'ethers'; export class MetamaskWalletAdapter @@ -37,6 +38,9 @@ export class MetamaskWalletAdapter async signTransaction(transaction: Transaction) { return (window as any).ethereum.signTransaction(transaction); } + async signMultipleTransaction(transactions: Transaction[]) { + return transactions; + } connect() { if (this._onProcess) { diff --git a/packages/bridge/src/wallet-adapters/wallet-connect.tsx b/packages/bridge/src/wallet-adapters/wallet-connect.tsx index 86cdd14..b13751e 100644 --- a/packages/bridge/src/wallet-adapters/wallet-connect.tsx +++ b/packages/bridge/src/wallet-adapters/wallet-connect.tsx @@ -1,6 +1,7 @@ import EventEmitter from 'eventemitter3'; import { PublicKey, Transaction } from '@solana/web3.js'; -import { notify, WalletAdapter } from '@oyster/common'; +import { notify } from '@oyster/common'; +import { WalletAdapter } from '@solana/wallet-base' import { ethers } from 'ethers'; import WalletConnectProvider from "@walletconnect/web3-provider"; @@ -39,6 +40,9 @@ export class WalletConnectWalletAdapter async signTransaction(transaction: Transaction) { return this._provider.signTransaction(transaction); } + async signMultipleTransaction(transactions: Transaction[]) { + return transactions; + } connect() { if (this._onProcess) {