Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
@lens-protocol/react-native
Advanced tools
Readme
The official Lens Protocol React bindings for React Native.
This package enables you to build mobile applications on top of the Lens Protocol using React Native.
Install the Lens React Native SDK package using your package manager of choice:
Package Manager | Command |
---|---|
npm | npm install @lens-protocol/react-native@latest |
yarn | yarn add @lens-protocol/react-native@latest |
pnpm | pnpm add @lens-protocol/react-native@latest |
First we need to create so-called bindings. Bindings are just an object implementing the IBindings
interface. This is used by the Lens SDK to access the Signer and the Provider.
In this example we will limit ourselves to the bare minimum and we will use the ethers.js
library to create the bindings.
// wallet.ts
import { IBindings } from '@lens-protocol/react-native';
import { providers, Wallet } from 'ethers';
const provider = new providers.InfuraProvider('maticmum');
const wallet = new Wallet('<your-private-key>', provider);
export const bindings: IBindings = {
getProvider: async () => provider,
getSigner: async () => wallet,
};
Create the LensConfig
. In this example we will use react-native-mmkk
as underlying storage. You can use any storage you want as long as it implements the IStorageProvider
interface.
First install the react-native-mmkv
package:
Package Manager | Command |
---|---|
npm | npm install react-native-mmkv |
yarn | yarn add react-native-mmkv |
pnpm | pnpm add react-native-mmkv |
Create the LensConfig
object:
import { LensConfig, development } from '@lens-protocol/react-web';
import { storage } from '@lens-protocol/react-web/storage/mmkv';
import { bindings } from './wallet.ts';
const lensConfig: LensConfig = {
bindings,
environment: development,
storage: storage(),
};
Wrap your app with the <LensProvider>
and pass the LensConfig
as a prop.
import { LensProvider } from '@lens-protocol/react-web';
function App() {
return (
<LensProvider config={lensConfig}>
<YourApp />
</LensProvider>
);
}
FAQs
Lens Protocol SDK for React Native
The npm package @lens-protocol/react-native receives a total of 204 weekly downloads. As such, @lens-protocol/react-native popularity was classified as not popular.
We found that @lens-protocol/react-native demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 9 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.