Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mojito-inc/connect-wallet

Package Overview
Dependencies
Maintainers
3
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mojito-inc/connect-wallet

Connecting wallet via metamask, wallet connect, email

  • 1.0.1-beta.17
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
181
decreased by-33.21%
Maintainers
3
Weekly downloads
 
Created
Source

☁️ Mojito Modules - Connect Wallet - Token Gating



👨‍💻 React components for the Mojito Platform, Reference App and third-party projects, including Connect Wallet and Token Gating.

Version: 1.0.1


Using this library in your project

You can install this project with one of these commands:

npm install @mojito-inc/connect-wallet

yarn add @mojito-inc/connect-wallet


  import { ConnectWalletProvider } from '@mojitoinc/mojito-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 }
        onAuthenticated={ setToken }
        clientOptions={ client }>
        { children }
      </ConnectWalletProvider>
    );
  };

  export default WalletProvider;

After setup ConnectWallet Provider

Following step:

  1. Connect Wallet Container

ConnectWalletContainer

  import { ConnectWalletContainer } from '@mojitoinc/mojito-connect-wallet';

  const ConnectWalletPage = () => {

    const config = {
      ORG_ID: Configuration.ORG_ID ?? '',
      paperClientId: Configuration.PAPER_CLIENT_ID ?? '',
      paperNetworkName: Configuration.PAPER_NETWORK_NAME ?? '',
      projectId: Configuration.PROJECT_ID ?? '',
    }

    const walletOptions = {
      enableMetamask: true,
      enableWalletConnect: true,
      enableEmail: true,
    }

    const image = {
      logo: 'https://res.cloudinary.com/duwztsuxj/image/upload/v1683870261/Frame_238173_cpwne5.png',
      metamask: Images.METAMASK.src,
      walletConnect: Images.WALLET_CONNECT.src,
      error: 'https://res.cloudinary.com/duwztsuxj/image/upload/v1683870261/Frame_238173_cpwne5.png',
    }

    return (
        <ConnectWalletContainer
          open={ openModal }
          config={ config }
          walletOptions={ walletOptions }
          image={ image }
          isDisConnect={ disconnect }
          walletAddress={ walletDetails.walletAddress }
          onChangeWalletAddress={ onChangeWalletAddress }
          onCloseModal={ onClickCloseModal } />
    );
  };

  export default ConnectWalletPage;

ParamtypeRequiredDescription
openboolean
walletAddressstring
isDisConnectboolean
configObjectconfig
walletOptionsObjectwalletOptions
imageObjectimage
contentObjectContentData
isRefetchBalanceboolean
onCloseModalfunctionTo close the Modal

interface

config
ParamtypeRequiredDescription
ORG_IDstring
paperClientIdstring
projectIdstring
paperNetworkNameany
walletOptions
ParamtypeRequiredDescription
enableMetamaskboolean
enableWalletConnectboolean
enableEmailboolean
image
ParamtypeRequiredDescription
logostring
metamaskstring
walletConnectstring
errorstring
ContentData
ParamtypeRequiredDescription
titlestring
descriptionstring

Token Gating Container

import { TokenGatingContainer } from '@mojitoinc/mojito-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 ?? '',
          chainId: 5,
          projectId: Configuration.PROJECT_ID ?? '',
          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 } />
  )
}
ParamtypeRequiredDescription
openBoolean
configObjectConfiguration
walletConnectScreenDetailsObjectwalletConnectScreenDetails
errorScreenDetailsObjecterrorScreenDetails
screenConfigObjectscreenConfig
claimTokenScreenDetailsObjectclaimTokenScreenDetails
gatingLoaderDetailsObject
gatingErrorDetailsObject
invoiceIDstring
onCloseModalfunction
onChangeWalletAddressfunction
setInvoicefunction
getInvoiceDetailsfunction

interface

Configuration
ParamtypeRequiredDescription
orgIdstringorganization id
chainIdNumber
paperClientIdstringpaper client id to connect with email
paperNetworkNameany
projectIdstring
groupIdstringfor Checking Token Gating based on GroupId
ruleIdstringfor Checking Token Gating based on ruleId
isClaimTokenbooleanif true, call mojito claim api
collectionItemIdstring
invoiceIdstring
walletConnectScreenDetails
ParamtypeRequiredDescription
titlestring
subTitlestring
walletOptionswalletOptionswalletOptions
imageWalletImagesWalletImages
errorScreenDetails
ParamtypeRequiredDescription
titlestring
primaryButtonTitlestring
secondaryButtonTitlestring
tertiaryButtonTitlestring
onClickTertiaryButtonfunction
onClickSecondaryButtonfunction
onClickPrimaryButtonfunction
screenConfig
ParamtypeRequiredDescription
titlestring
subTitlestring
claimTokenScreenDetails
ParamtypeRequiredDescription
tokenDetailObjecttokenDetail
redirectionPageURLstring
onSuccessfunction
tokenDetail
ParamtypeRequiredDescription
tokenImagestring
tokenNamestring
tokenSubtitlestring
tokenButtonTextstring
WalletImages
ParamtypeRequiredDescription
errorstringerror icon in svg, png, jpeg or gif format
metamaskstringmetamask icon in svg, png, jpeg or gif format
walletConnectstringwallet connect icon in svg, png, jpeg or gif format
logostringlogo icon in svg, png, jpeg or gif format
walletOptions
ParamtypeRequiredDescription
enableMetamaskbooleanto enable or disable metamask
enableWalletConnectbooleanto enable or disable wallet connect
enableEmailbooleanto enable or disable email connect

Keywords

FAQs

Package last updated on 05 Sep 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc