Skip to content

Instantly share code, notes, and snippets.

@elraphty
Created March 23, 2022 00:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elraphty/a2fa428876fa981693ecadc1cbad3d9d to your computer and use it in GitHub Desktop.
Save elraphty/a2fa428876fa981693ecadc1cbad3d9d to your computer and use it in GitHub Desktop.
import {channels} from '@epnsproject/frontend-sdk-staging';
import {ethers} from 'ethers';
import Web3Modal from 'web3modal';
const web3Modal = new Web3Modal();
const connection = await web3Modal.connect();
const provider = new ethers.providers.Web3Provider(connection);
const signer = provider.getSigner();
const epnsSubscribe = async () => {
await channels.optIn(
signer,
channelAddress,
chainId,
userAddress,
{
onSuccess: () => // do something after success
}
);
};
const epnsUnSubscribe = async () => {
await channels.optOut(
signer,
channelAddress,
chainId,
userAddress,
{
onSuccess: () => // do something after success
}
)
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment