Login
The following sample will show you how to make a simple connection handler. First, we will generate a QR Code that will be the entry point by which users can interact with your dApp. Once scanned, the account details are forwarded to you.
Prerequisites:
Getting startedGenerate a QR Code
In order to generate a QR Code you need to pass a Webhook to the generateQRCode method. This Webhook will be called every time a new user scan the QR Code.
/* Define the scope */
$scope = ['profile', 'nft'];
/* Define a Webhook */
$webhookUrl = '';
/* Define a uniq Id that identify the browser */
$uniqId = '';
/* Generate the QR Code */
$qrCode = $client->generateQRCode($scope, $uniqId, $webhookUrl);
Find more details on the Webhook implementation here
On each user's connection, you will receive a JSON like this :
Fields
Type
Description
accountId
string
Account Id of the User
balance
number
Account's balance in HBAR
environment
'mainnet' or 'testnet'
Environment identified from the SDK API Key
profile
Profile
Profile of the user if it exist and if defined in scope
nft
NFT[]
NFTs of the user if defined in scope
uniqId
string
Custom Uniq Id
The Profile will be defined as below :
Fields
Type
string
first_name
string
last_name
string
profile_image
string
country
string
The NFT will be defined as below :
Fields
Type
tokenId
string
name
string
description
string
category
string
creator
string
cid
string
url
string
supply
number
nftIds
string[]
Last updated