Developers
DevelopersGuides
  • Introducing Bond
    • Introduction
    • Why we build Bond?
    • Roles In Bond Ecosystem
    • Decentralised Relations/Social Graph
    • Architecture
    • Bond Reward Model
      • Leech Principle
      • Barrel Principle
  • Main Concepts
    • Bond Profile
      • Identity
      • Relationships
      • Content
      • Creator Economy
    • Connection
      • Connection NFTs
    • Bond Social Graph
    • Centralities
      • In/Out Degree Centrality
      • Betweenness Centrality
      • Closeness Centrality
      • PageRank Centrality
    • Reward Models
    • Reward Contracts
    • Off-chain Oracles
    • Gasless Mode
    • Cross Chain Messaging and Pay Gas with Bond Token
  • Bond API
    • Introduction
    • API Urls
    • Getting started with GraphQL
    • Authentication
      • Login
      • Refresh JWT
    • Profile
      • Create Profile
      • SetProfileMetadata
    • Connect
      • Connect a profile
      • Disconnect
  • Smart Contracts
    • BondHub
    • MerkelDistributor
    • TokenDeployer
    • SingleStakePoolDeployer
    • LzTokenDeployer
    • LzSingleStakePoolDeployer
  • Bond SDK
    • Bond JS SDK
      • Authenticate
      • Create Profile
      • Connect
  • Bond Nodes
    • Hardware Requirements
    • Set up and Deploy
    • Node Config (TOML)
    • Secrets Config (TOML)
    • Role-Based Access Control (RBAC)
  • References
    • Deployed Contracts
    • Github
Powered by GitBook
On this page
  1. Bond SDK
  2. Bond JS SDK

Connect

You can use Bond JS SDK to connect with a profile.

// bondHub is an authenticated

const profileId = '1';

const referralResult = await bondHub.referredBy(profileId) 

console.log(`referralResult transaction is relayed by proxy id: {referralResult.txHash}`)
// bondHub is an authenticated

const handle = 'yourHandleName';

const followResult = await bondHub.follow(profileId) 

console.log(`followResult transaction is relayed by proxy id: {followResult.txHash}`)

You can aslo connect with a profile in seperate steps:

import { ConnectType } from '@bondlab/client'
// bondHub is an authenticated

const profileId = '1';
const connectionType = ConnectType.REFERRAL;

const connectTypedData = await bondHub.createConnectTypedData({
  profileId,
  type: connectionType 
}) 

// sign with the wallet
const signedTypedData = await wallet._signTypedData(
  connectTypedData.typedData.domain,
  connectTypedData.typedData.types,
  connectTypedData.typedData.value
);

const connectResult = await bondHub.connect({
  id: connectTypedData.id,
  type: connectionType,
  signature: signedTypedData,
});
PreviousCreate ProfileNextHardware Requirements

Last updated 1 year ago