-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9e7432e
commit 27e1822
Showing
13 changed files
with
330 additions
and
395 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 7 additions & 98 deletions
105
packages/uiweb/src/lib/components/chat/ConnectButton/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,100 +1,9 @@ | ||
import { IChatTheme } from '../theme'; | ||
export { ConnectButton } from './ConnectButton'; | ||
|
||
import coinbaseWalletModule from '@web3-onboard/coinbase'; | ||
import { ConnectButtonSub } from './ConnectButton'; | ||
import { BLOCKNATIVE_PROJECT_ID, InfuraAPIKey } from '../../../config'; | ||
import { Web3OnboardProvider } from '@web3-onboard/react'; | ||
import injectedModule, { ProviderLabel } from '@web3-onboard/injected-wallets'; | ||
import walletConnectModule from '@web3-onboard/walletconnect'; | ||
import init from '@web3-onboard/core'; | ||
import PushIcon from '../../../icons/Bell.svg'; | ||
// interface IConnectButtonCompProps { | ||
// autoConnect?: boolean; | ||
// } | ||
|
||
const APP_META_DATA = { | ||
name: 'Push Protocol', | ||
logo: PushIcon, | ||
icon: PushIcon, | ||
description: 'Example showcasing how to connect a wallet.', | ||
|
||
recommendedInjectedWallets: [ | ||
{ name: 'MetaMask', url: 'https://metamask.io' }, | ||
], | ||
}; | ||
|
||
const wcv2InitOptions = { | ||
projectId: BLOCKNATIVE_PROJECT_ID, | ||
requiredChains: [1, 56], | ||
}; | ||
|
||
const walletConnect = walletConnectModule(wcv2InitOptions); | ||
const coinbaseWalletSdk = coinbaseWalletModule({ darkMode: true }); | ||
const CHAINS = [ | ||
{ | ||
id: '0x1', | ||
token: 'ETH', | ||
label: 'Ethereum Mainnet', | ||
rpcUrl: `https://mainnet.infura.io/v3/${InfuraAPIKey}`, | ||
}, | ||
{ | ||
id: '0xAA36A7', | ||
token: 'ETH', | ||
label: 'Sepolia', | ||
rpcUrl: `https://sepolia.infura.io/v3/${InfuraAPIKey}`, | ||
}, | ||
{ | ||
id: '0x13882', | ||
token: 'MATIC', | ||
label: 'Polygon - Amoy', | ||
rpcUrl: 'https://rpc-amoy.polygon.technology', | ||
}, | ||
{ | ||
id: '0x38', | ||
token: 'BNB', | ||
label: 'Binance', | ||
rpcUrl: 'https://bsc-dataseed.binance.org/', | ||
}, | ||
{ | ||
id: '0xA', | ||
token: 'OETH', | ||
label: 'Optimism', | ||
rpcUrl: 'https://mainnet.optimism.io', | ||
}, | ||
{ | ||
id: '0xA4B1', | ||
token: 'ARB-ETH', | ||
label: 'Arbitrum', | ||
rpcUrl: 'https://rpc.ankr.com/arbitrum', | ||
}, | ||
]; | ||
|
||
const wallets = [injectedModule(), walletConnect, coinbaseWalletSdk]; | ||
|
||
const web3OnBoard = init({ | ||
wallets, | ||
chains: CHAINS, | ||
appMetadata: APP_META_DATA, | ||
accountCenter: { | ||
desktop: { | ||
enabled: false, | ||
}, | ||
mobile: { | ||
enabled: false, | ||
}, | ||
}, | ||
connect: { | ||
autoConnectLastWallet: true, | ||
}, | ||
}); | ||
|
||
interface IConnectButtonCompProps { | ||
autoConnect?: boolean; | ||
} | ||
|
||
export const ConnectButtonComp: React.FC<IConnectButtonCompProps> = ({ | ||
autoConnect, | ||
}) => { | ||
return ( | ||
<Web3OnboardProvider web3Onboard={web3OnBoard}> | ||
<ConnectButtonSub autoConnect={autoConnect} /> | ||
</Web3OnboardProvider> | ||
); | ||
}; | ||
// export const ConnectButtonComp: React.FC<IConnectButtonCompProps> = ({ autoConnect }) => { | ||
// return <ConnectButtonSub autoConnect={autoConnect} />; | ||
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.