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}`)

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,
});

Last updated