-
-
Save elraphty/a2fa428876fa981693ecadc1cbad3d9d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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