Quadrata Integration
  • INTRODUCTION
    • Introduction to Quadrata
    • Passport Attributes
  • HOW TO INTEGRATE
    • Quadrata SDK
      • Get Started Quickly
      • Advanced
        • Installation
        • SDK Configuration
        • Onboarding Example
        • Client Libraries
          • Client Configuration
          • Client Lazy Loading
          • Client Eager Loading
          • Client Helper Component
          • Client React Hooks
            • useOnboardStatus
          • Client Examples
            • With Wagmi Connect
            • KYC Only
            • KYB Only
            • All In One
        • API Libraries
          • API Configuration
          • API Service Options
          • API Service Libraries
            • Create Access Token
            • Create Privacy Access Token
            • Fetch Attribute Values
            • Fetch Onboard Status
            • Fetch Passport List
            • Fetch Privacy Data
            • Fetch Privacy Grants
            • Fetch Wallet Screening
            • Revoke Privacy Grants
    • Onboard users
      • Individual Passport Onboarding
        • 1. Installation
        • 2. API Authentication
        • 3. API Onboard Status
        • 4. QuadClient Package
        • 5. Privacy Data Permissions
        • 6. Full Example
      • Business Passport Onboarding
        • 1. Installation
        • 2. API Authentication
        • 3. QuadrataKyb Package
        • 4. Privacy Data Permissions
        • 5. Full Example
      • All-In-One Passport Onboarding
        • 1. Installation
        • 2. API Authentication
        • 3. QuadrataReact Package
        • 4. Full Example
    • Request Privacy Data
      • List of Privacy Data
      • Privacy Data Permissions
      • API Requests
        • How to sign API
          • Full Example
          • Generate ECDSA Key Pair
        • API Get Privacy Permissions
        • API Privacy Access Token
        • API Get Privacy Data
        • API Revoke Permissions
    • Query attributes
      • Via Smart Contract
        • Query a single attribute
        • Query multiple attributes
        • Query Helper
      • Via API
    • On-Chain Wallet Screening
      • How to sign API
        • Full Example
        • Generate ECDSA Key Pair
      • API Get On-Chain AML Score
    • Webhooks
      • Onboarding Webhooks
      • Ongoing Monitoring Webhooks
      • Webhook Request Signature
    • Burn Passports
  • additional information
    • Smart contracts
    • Quadrata Sandbox
    • Passport Issuers
    • Privileged Roles & Ownership
    • Constants
    • Flex Kit Attributes
      • Smart Contract Addresses
Powered by GitBook
On this page
  • Helper Component Props
  • KYB Helper Props
  • KYC Helper Props
  • Multi-Component (All In One) Helper Props
  • Wagmi Connect Helper Props
  • Usage
  • As Child Component
  • As Prop
  1. HOW TO INTEGRATE
  2. Quadrata SDK
  3. Advanced
  4. Client Libraries

Client Helper Component

Quadrata SDK Client Helper Component

The Helper Component provides a way to interact with the state of a Quadrata application from within your app.

It will have access to props that let you know what's happening before, during, and after onboarding.

There are different helper components for both KYB and KYC onboarding applications which contain different props.

The helper component is mapped from the component Helper type at @quadrata/sdk/types/components/helper

Helper Component Props

No matter which application type is being accessed (KYB or KYC), the helper component will always have the following props:

  • isApplicationComplete: A boolean that tells you if the application is complete or not.

  • isApplicationReady: A boolean that tells you if the application is ready to be launched or not.

  • isLoading: A boolean that tells you if the application is loading or not.

  • isOpen: A boolean that tells you if the application is open or not.

  • isPassportInReview: A boolean that tells you if the the passport is in review or not. If the passport is in review, that means all the attributes are claimed and the application is awaiting manual review.

  • launchApplication: A function that launches the application and sets isOpen to true.

  • closeApplication : A function that closes the application and sets isOpen to false.

KYB Helper Props

When the user is going through the KYB application, the following additional props will be passed to your helper component:

  • isConsentGranted: A boolean that tells you if KYB consent has been granted or not.

  • isConsentRequested: A boolean that tells you if the onboarding application is configured to request for KYB privacy consent.

  • isKybApplication: A boolean that tells you if the application is a KYB application or not.

  • walletAddresses: An array containing all of the business wallet addresses inserted into the KYB application during onboarding.

KYC Helper Props

When the user is going through the KYC application, the following additional props will be passed to your helper component:

  • isConsentGranted: A boolean that tells you if the consent passed into privacyScopes is granted or not.

  • isConsentNeeded: A boolean that tells you if the consent passed into privacyScopes have not been granted. That is, should the application prompt the user for consent or not.

  • isConsentRequested: A boolean that tells you if anything has been passed into privacyScopes or not.

  • isKycApplication: A boolean that tells you if the application is a KYC application or not.

  • walletAddress: A string that contains the wallet address passed into component or connected through wallet connect.

When the SDK loads the KYC components, onboard status is abstracted for you. So the props you pass into kycProps are not directly passed into the KYC application. They are first checked against the wallet address to see which attributes or privacy scopes are needed.

This is why you have helper properties for isConsentGranted, isConsentNeeded, isConsentRequested, etc.

Multi-Component (All In One) Helper Props

When both kybProps and kycProps are passed into the Quadrata component, the following additional props will be passed to your helper component:

  • isConsentGranted: A boolean that tells you if the consent passed into privacyScopes is granted or not.

  • isConsentNeeded: A boolean that tells you if the consent passed into privacyScopes have not been granted. That is, should the application prompt the user for consent or not.

  • isConsentRequested: A boolean that tells you if anything has been passed into privacyScopes or not.

  • isKybApplication: A boolean that tells you if the application is a KYB application or not.

  • isKycApplication: A boolean that tells you if the application is a KYC application or not.

  • launchKybApplication: A function that launches only the KYB application and sets isOpen to true.

  • launchKycApplication: A function that launches only the KYC application and sets isOpen to true.

  • walletAddress: A string that contains the wallet address passed into component or connected through wallet connect.

  • walletAddresses: An array containing all of the business wallet addresses inserted into the KYB application during onboarding. This will only be available when isKybApplication is true.

In this context the launchApplication function will launch a modal that gives the user the option to choose between KYB and KYC applications.

If the user's wallet is not connected or passed in, the KYC application will be disabled in this modal.

Wagmi Connect Helper Props

Using this, the event handlers to connect wallets and sign transactions will be abstracted for you, so you do not need to worry about handling the them yourself.

In this context, the helper object will have the following additional props:

  • isWalletConnected: A boolean that tells you if the wallet is connected or not.

Usage

The helper component is required as either a child component or as a prop.

As Child Component

import * as QuadrataTypes from '@quadrata/sdk/types';
import { withWagmiConnect, Quadrata } from '@quadrata/sdk/client';

const quadrataSdkConfig: QuadrataTypes.QuadrataSdkConfiguration = {
    environment: QuadrataTypes.QuadrataEnvironment.SANDBOX
};

// individual onboarding props
const kycProps = {
    attributes: [
        QuadrataTypes.QuadrataAttribute.DID,
        QuadrataTypes.QuadrataAttribute.COUNTRY,
        QuadrataTypes.QuadrataAttribute.AML
    ],
};

export default function MyComponent({ accessToken }) {
    const quadrataProps = withWagmiConnect({
        accessToken: accessToken,
        sdkConfig: quadrataSdkConfig,
        clientConfig: {
            _debug: true,
            protocolName: 'Your Company Name'
        },
        sharedProps: {
            onApplicationEnd: (data: Record<string, any>) => {
                console.log('Application ended', data.status, data.error);
            }
        },
        kycProps: kycProps,
    });
    return (
        <Quadrata {...quadrataProps}>
            {((helper: QuadrataTypes.Client.Component.Helper) => {
                if (!helper.isWalletConnected) {
                    return <p>Wallet is not connected</p>;
                }
                if (helper.isApplicationComplete) {
                    return <p>Application is Complete</p>;
                }
                if (helper.isPassportInReview) {
                    return <p>Your application is in review.</p>;
                }
                return (
                    <button
                        disabled={!helper.isApplicationReady}
                        onClick={helper.launchApplication}
                    >
                        Launch Application
                    </button>
                );
            })}
        </Quadrata>
    );
}

As Prop

import type { JSX } from 'react';

import * as QuadrataTypes from '@quadrata/sdk/types';
import { withWagmiConnect, Quadrata } from '@quadrata/sdk/client';

const quadrataSdkConfig: QuadrataTypes.QuadrataSdkConfiguration = {
    environment: QuadrataTypes.QuadrataEnvironment.SANDBOX
};

// individual onboarding props
const kycProps = {
    attributes: [
        QuadrataTypes.QuadrataAttribute.DID,
        QuadrataTypes.QuadrataAttribute.COUNTRY,
        QuadrataTypes.QuadrataAttribute.AML
    ],
};

function HelperComponent(helper: QuadrataTypes.Client.Component.Helper): JSX.Element {
    if (!helper.isWalletConnected) {
        return <p>Wallet is not connected</p>;
    }
    if (helper.isApplicationComplete) {
        return <p>Application is Complete</p>;
    }
    if (helper.isPassportInReview) {
        return <p>Application is in review.</p>;
    }
    return (
        <button
            disabled={!helper.isApplicationReady}
            onClick={helper.launchApplication}
        >
            Launch Application
        </button>
    );
}

export default function MyComponent({ accessToken }) {
    const quadrataProps = withWagmiConnect({
        accessToken: accessToken,
        sdkConfig: quadrataSdkConfig,
        clientConfig: {
            _debug: true,
            protocolName: 'Your Company Name'
        },
        sharedProps: {
            onApplicationEnd: (data: Record<string, any>) => {
                console.log('Application ended', data.status, data.error);
            }
        },
        kycProps: kycProps,
    });
    return (
        <Quadrata
            {...quadrataProps}
            helperComponent={HelperComponent}
        />
    );
}
PreviousClient Eager LoadingNextClient React Hooks

Last updated 8 months ago

This is done through the hook, which is handled for you.

If you are using the Quadrata SDK with Wagmi, you can use the props initializer.

useOnboardStatus
withWagmiConnect