Getting Started
Welcome to the CyberConnect.js documentation!
The interactive course will guide you through everything you need to know to use CyberConnect.js.
If you have questions about anything related to Next.js, you're always welcome to ask our community on GitHub Discussions.

Installation

To install and save in your package.json dependencies, run:
1
npm i @cyberlab/cyberconnect
Copied!

Quick Start

1
const cyberConnect = new CyberConnect({
2
ethProvider: ethProvider, // provider from web3js or ethers.js or other
3
namesÏpace: 'CyberConnect', // or what you want
4
env:'PRODUCTION', // or 'STAGING' in dev environment
5
});
Copied!

Follow & Unfollow Somebody

Now the package is providing 2 method for follow & unfollow
1
const addressToFollow = '0xxxxxxxxxx';
2
3
// Follow
4
try{
5
cyberConnect.connect(addressToFollow);
6
}catch(e){
7
console.log(e)
8
}
9
10
// Unfollow
11
try{
12
cyberConnect.disconnect(addressToFollow);
13
}catch(e){
14
console.log(e)
15
}
16
Copied!

Examples

Using ethers.js and web3Modal.js
1
import Web3Modal from 'web3modal';
2
import { Web3Provider, JsonRpcSigner } from '@ethersproject/providers';
3
import CyberConnect, { Env } from '@cyberlab/cyberconnect';
4
5
let web3Modal = new Web3Modal({
6
network: 'mainnet',
7
cacheProvider: true,
8
});
9
10
const modalProvider = await web3Modal.connect();
11
const ethersProvider = new Web3Provider(modalProvider);
12
13
const cyberConnect = new CyberConnect({
14
ethProvider: ethersProvider.provider,
15
namespace: 'CyberConnect',
16
env: Env.STAGING
17
});
18
19
const addressToFollow = '0x000000000...';
20
// Follow
21
try{
22
cyberConnect.connect(addressToFollow);
23
}catch(e){
24
console.log(e)
25
}
26
27
// Unfollow
28
try{
29
cyberConnect.disconnect(addressToFollow);
30
}catch(e){
31
console.log(e)
32
}
Copied!
Last modified 16d ago