npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@infinitywallet/infinity-connector

v1.0.6

Published

Infinity Wallet connection SDK for DApp web3 connect integration

Downloads

3,492

Readme

Infinity Wallet Connector SDK for DApps & Web3 platforms

Infinity Wallet provides users with the ability to access DApps & Web3 platforms directly within the Infinity Wallet, through a feature we call “Browser-less DApps”. This feature provides users, DApps and chains with a wide range of benefits, while enhancing the overall user experience and allowing for more fluid and uninterrupted use.

Free Promotion

If you integrate the Infinity Connector and make a tweet tagging @infinitywallet on Twitter regarding your support for Infinity Wallet connecting, we may retweet your tweet.

How to add Infinity Wallet connecting to a DApp?

To integrate Infinity Wallet connecting to your DApp please follow this Integration Guide.

You will need to add to your interface an option to connect with the Infinity Wallet, either with the Infinity Wallet logo or Infinity Wallet logo + text. As an example:

Connect Wallet UI Example

Media Assets

  • Logo SVG: https://drive.google.com/file/d/1fAl8inVUGeoZiwPD4gA3WKfUW6p7mVza/view?usp=sharing
  • Logo PNG: https://drive.google.com/file/d/1RKqsMWC8SvJEPNdRB-hl2_VIjM3inQNl/view?usp=sharing
  • Logo + Title (Use for media announcements): https://drive.google.com/file/d/1bgfR0N-xCAonF9MwppUAk-tQz3oEPIGw/view?usp=sharing
  • Infinity Wallet Banner: https://drive.google.com/file/d/1dGdocAv4V_RyXZ6MIXjerdzukzHqcLQc/view?usp=sharing

Integration Guide:

To integrate Infinity Wallet Connector for a DApp on a supported EVM Chain please use the following guide. If you already support the web3 standards within your DApp the integration of Infinity Wallet connecting should take no longer than 5 minutes.

Requirement:

To support Infinity Wallet connecting your DApp should be EIP1193 compatible. This is the same protocol that is used to interact with other EVM compatible wallets such as Metamask. Meaning if your DApp supports Metamask connecting you will be able to support Infinity Wallet connecting with a few lines of code.

Package Installation

To use the SDK you can install the package in your project by:

Using yarn

yarn add @infinitywallet/infinity-connector

Using npm

npm install @infinitywallet/infinity-connector

Usage

Detect Infinity Wallet

The first thing you are going to need to do is detect whether your DApp is being accessed via the Infinity Wallet and if the Infinity Wallet is installed. To do this please use:

window.ethereum && window.ethereum?.isInfinityWallet

If returns TRUE then the DApp is currently running within the Infinity Wallet, you can initialize the wallet connection with Initiate Connector followed by calling the web3 method Activate

If returns FALSE then it means the Infinity Wallet needs to be opened using Open Infinity Wallet function;

Initiate Connector

This function should be called when Detect Infinity Wallet returns TRUE.

import { InfinityWalletConnector } from '@infinitywallet/infinity-connector';

const infinitywalletConnector = new InfinityWalletConnector({
  supportedChainIds: [CHAIN_ID]
});

Activate Connection

This function should be called when Detect Infinity Wallet returns TRUE and after initiating InfinityWalletConnector as shown in Initiate Connector. Pass the initialized connector into the useWeb3ReactCore method (activate) to activate the wallet connection.

const { activate, active } = useWeb3ReactCore()

activate(infinitywalletConnector)

Open Infinity Wallet

This function should be called when Detect Infinity Wallet Wallet returns FALSE.

By calling this function and passing your DApp url (replace "YOUR_DAPP_URL") and Chain ID (replace "CHAIN_ID") it will open your DApp in the Infinity Wallet if the user has the Infinity Wallet installed. If the user does not have Infinity Wallet installed it will redirect them to download the Infinity Wallet.

import { openInfinityWallet } from '@infinitywallet/infinity-connector';

openInfinityWallet(YOUR_DAPP_URL, CHAIN_ID);

Example

The following is an example on how to use the SDK to detect, connect and open the Infinity Wallet to connect with a DApp.

Using this example make sure to replace the following:

  • CHAIN_ID replace with the ID of the chain you are using. As an example if your DApp is using Ethereum then the CHAIN_ID would be 1 or if using Binance Smart Chain it would set CHAIN_ID to 56;
  • YOUR_DAPP_URL replace this with the URL of your DApp;
import { InfinityWalletConnector, openInfinityWallet } from '@infinitywallet/infinity-connector';

const { activate, active } = useWeb3ReactCore();

const infinitywalletConnector = new InfinityWalletConnector({
  supportedChainIds: [CHAIN_ID]
});

if(window.ethereum && window.ethereum?.isInfinityWallet){
     activate(infinitywalletConnector);
     console.log('Infinity Wallet is connected and can be used with the DApp');
} else {
     openInfinityWallet(YOUR_DAPP_URL, CHAIN_ID);
     console.log('Open DApp on a specific chain in Infinity Wallet if installed, or if not installed it will redirect to download Infinity Wallet');
}