Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
@mojito-inc/connect-wallet
Advanced tools
Connecting wallet via metamask, wallet connect, email
👨💻 React components for the Mojito Platform, Reference App and third-party projects, including Connect Wallet and Token Gating.
Version: 1.0.3-beta.4
You can install this project with one of these commands:
npm install @mojito-inc/connect-wallet
yarn add @mojito-inc/connect-wallet
yarn add @mui/material@5.11.11 @mui/icons-material@5.11.11 @apollo/client graphql
To config custom theme please follow below steps:
Create a new file and place the following code and replace the colors with your custom colors. export the theme and add into the provider.
import { createTheme } from '@mui/material';
export const theme = createTheme({
typography: {
fontFamily: 'Slate',
},
components: {
MuiTextField: {
styleOverrides: {
root: {
'& input::-webkit-outer-spin-button, & input::-webkit-inner-spin-button':
{
display: 'none',
},
'& input[type=number]': {
MozAppearance: 'textfield',
},
},
},
},
MuiCssBaseline: {
styleOverrides: `
@font-face {
font-family: "Slate";
font-style: normal;
font-display: swap;
font-weight: 400;
text-transform: none;
font-size: 16px;
}
`,
},
MuiButton: {
styleOverrides: {
root: {
fontFamily: 'Slate',
textTransform: 'none',
borderRadius: '4px',
fontWeight: 700,
fontSize: '16px',
backgroundColor: '#FDCC35',
color: '#000',
'&:hover': {
backgroundColor: '#FDCC35',
color: '#000',
opacity: 0.5,
},
},
},
},
MuiDialog: {
styleOverrides: {
paper: {
border: '1px solid #D7D8DB',
boxShadow: '0px 8px 16px rgba(0, 0, 0, 0.08)',
borderRadius: '4px',
},
},
},
MuiDivider: {
variants: [
{
props: { orientation: 'horizontal' },
style: {
':before': {
borderTop: 'thin solid #D7D8DB',
},
':after': {
borderTop: 'thin solid #D7D8DB',
},
},
},
],
},
},
palette: {
primary: {
main: '#FDCC35',
},
secondary: {
main: '#356045',
},
backgroundColor: {
primary: '#ffffff',
secondary: '#000000',
},
grey: {
100: '#868b93',
500: '#A1A5AB',
},
toastError: {
500: '#CE2818',
},
},
});
import { ConnectWalletProvider } from '@mojito-inc/connect-wallet';
const WalletProvider = ({ children }: WalletProviderProps) => {
const [token, setToken] = useState<string>();
const client = useMemo(
() => ({
uri: Configuration.API_HOSTNAME,
token: token ? `Bearer ${ token }` : undefined,
}),
[token],
);
return (
<ConnectWalletProvider
theme={ theme }
walletConnectProjectId={ Configuration.PROJECT_ID }
onAuthenticated={ setToken }
clientOptions={ client }>
{ children }
</ConnectWalletProvider>
);
};
export default WalletProvider;
After setup ConnectWallet Provider
Following step:
import { ConnectWalletContainer } from '@mojito-inc/connect-wallet';
const ConnectWalletPage = () => {
return (
<ConnectWalletContainer
open={ openModal }
config={{
orgId: Configuration.ORG_ID ?? '',
paperClientId: Configuration.PAPER_CLIENT_ID ?? '',
paperNetworkName: Configuration.PAPER_NETWORK_NAME ?? '',
}}
walletOptions={{
enableMetamask: true,
enableEmail: true,
enableWalletConnect: true,
}}
image={{
logo: YOUR_LOGO, // pass URL or path, if you are importing an image from local please add ".src" at end
metamask: Images.METAMASK.src,
error: Images.METAMASK.src,
walletConnect: Images.METAMASK.src,
}}
isDisConnect={ disconnect }
isRefetchBalance={ isRefetchBalance }
onCloseModal={ onClickCloseModal } />
);
};
export default ConnectWalletPage;
Param | type | Required | Description |
---|---|---|---|
open | boolean | ✅ | if true it will open modal if false modal will close |
config | Object | ✅ | config |
walletOptions | Object | ✅ | walletOptions |
image | Object | ✅ | image To customize the image |
isDisConnect | boolean | ✅ | if true it will disconnect the wallet |
isRefetchBalance | boolean | if true it will refetch the wallet balance | |
onCloseModal | function | ✅ | To close the Modal |
content | Object | ContentData to customize the title, description in modal |
Param | type | Required | Description |
---|---|---|---|
orgId | string | ✅ | |
paperClientId | string | ||
paperNetworkName | enum | paper Network Name |
Param | type | Required | Description |
---|---|---|---|
enableMetamask | boolean | ✅ | |
enableEmail | boolean | ✅ | |
enableWalletConnect | boolean | ✅ |
Param | type | Required | Description |
---|---|---|---|
logo | string | ✅ | |
metamask | string | ✅ | |
error | string | ✅ | |
walletConnect | string | ✅ |
Enum |
---|
Ethereum |
Sepolia |
Goerli |
Polygon |
Mumbai |
Param | type | Required | Description |
---|---|---|---|
title | string | ||
description | string |
To get the connected wallet details use these following hooks:
import { useWallet } from '@mojitoinc/mojito-connect-wallet';
const { address, balance } = useWallet();
import { useNetwork } from '@mojitoinc/mojito-connect-wallet';
const { chainID, id, isTestnet, name } = useNetwork();
import { useProvider } from '@mojitoinc/mojito-connect-wallet';
const { provider, providerType } = useProvider();
import { TokenGatingContainer } from '@mojito-inc/connect-wallet';
const TokenGatingPage = () => {
return (
<TokenGatingContainer
onCloseModal={ onCloseModal }
open={ openModal }
config={{
orgId: Configuration.ORG_ID ?? '',
paperClientId: Configuration.PAPER_CLIENT_ID ?? '',
paperNetworkName: Configuration.PAPER_NETWORK_NAME ?? '',
groupId: tokenGatingDetails?.groupId,
ruleId: tokenGatingDetails?.ruleId,
isClaimToken: false,
collectionItemId: tokenGatingDetails?.collectionItemId,
invoiceId,
}}
screenConfig={{
title: ,
subTitle: 'Holders of the Myers Manx collection can now get 50%. Connect your wallet to proceed.',
}}
gatingErrorDetails={ gatingErrorDetails }
walletConnectScreenDetails={ walletConnectScreenDetails }
errorScreenDetails={ errorScreenDetails }
claimTokenScreenDetails={ claimTokenScreenDetails }
setInvoice={ setInvoice } />
)
}
Param | type | Required | Description |
---|---|---|---|
open | Boolean | ✅ | |
config | Object | ✅ | Configuration |
walletConnectScreenDetails | Object | ✅ | walletConnectScreenDetails |
errorScreenDetails | Object | ✅ | errorScreenDetails |
screenConfig | Object | ✅ | screenConfig |
claimTokenScreenDetails | Object | ✅ | claimTokenScreenDetails |
gatingLoaderDetails | Object | ||
gatingErrorDetails | Object | ||
invoiceID | string | ||
onCloseModal | function | ✅ | |
onChangeWalletAddress | function | ||
setInvoice | function | ||
getInvoiceDetails | function |
Param | type | Required | Description |
---|---|---|---|
orgId | string | ✅ | organization id |
chainId | Number | ✅ | |
paperClientId | string | paper client id to connect with email | |
paperNetworkName | any | ||
groupId | string | for Checking Token Gating based on GroupId | |
ruleId | string | for Checking Token Gating based on ruleId | |
isClaimToken | boolean | if true, call mojito claim api | |
collectionItemId | string | ||
invoiceId | string |
Param | type | Required | Description |
---|---|---|---|
title | string | ||
subTitle | string | ||
walletOptions | walletOptions | ✅ | walletOptions |
image | WalletImages | ✅ | WalletImages |
Param | type | Required | Description |
---|---|---|---|
title | string | ||
primaryButtonTitle | string | ||
secondaryButtonTitle | string | ||
tertiaryButtonTitle | string | ||
onClickTertiaryButton | function | ||
onClickSecondaryButton | function | ||
onClickPrimaryButton | function |
Param | type | Required | Description |
---|---|---|---|
title | string | ||
subTitle | string |
Param | type | Required | Description |
---|---|---|---|
tokenDetail | Object | tokenDetail | |
redirectionPageURL | string | ||
onSuccess | function |
Param | type | Required | Description |
---|---|---|---|
tokenImage | string | ||
tokenName | string | ||
tokenSubtitle | string | ||
tokenButtonText | string |
Param | type | Required | Description |
---|---|---|---|
error | string | error icon in svg, png, jpeg or gif format | |
metamask | string | metamask icon in svg, png, jpeg or gif format | |
logo | string | logo icon in svg, png, jpeg or gif format |
Param | type | Required | Description |
---|---|---|---|
enableMetamask | boolean | ✅ | to enable or disable metamask |
enableEmail | boolean | ✅ | to enable or disable email connect |
FAQs
Connecting wallet via metamask, wallet connect, email
The npm package @mojito-inc/connect-wallet receives a total of 191 weekly downloads. As such, @mojito-inc/connect-wallet popularity was classified as not popular.
We found that @mojito-inc/connect-wallet demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.