useOnboardStatus

Quadrata SDK Client Hook: useOnboardStatus

useOnboardStatus is a hook that you can take advantage of throughout your application if you need to check the status of a wallet's onboarding application.

This hook is already used and handled for you when you use the Quadrata or QuadrataEager client components with kycProps specified.

You are not required to use this hook, but if you want to or find a need for it, it is exposed for you.

This hook takes advantage of the API Service Library, Fetch Onboard Status.

The results are parsed for you in a format that allows you to pass them directly to the Quadrata client library as partial props.

import * as QuadrataTypes from '@quadrata/sdk/client';
import { useOnboardStatus } from '@quadrata/sdk/client';

const {
    error,
    parsed,
    clientProps,
    refreshOnboardStatus,
    isLoading,
} = useOnboardStatus({
    chainId: QuadrataTypes.QuadrataNetwork.SEPOLIA,
    walletAddress: '0x123',
    attributes: [
        QuadrataTypes.QuadrataAttribute.DID,
        QuadrataTypes.QuadrataAttribute.COUNTRY,
        QuadrataTypes.QuadrataAttribute.AML
    ],
    offeringId: 'optional-unique-offering-id',
    isBypassMint: false,
    apiAccessToken: accessToken,
    privacyScopes: [
        QuadrataTypes.QuadrataPrivacyConsent.DATE_OF_BIRTH,
        QuadrataTypes.QuadrataPrivacyConsent.EMAIL
    ]
}, quadrataSdkConfig);

If you just need to get onboard status or see if a passport is minted, you can use the API Service Library, Fetch Onboard Status. It will return a similar response.

Response

  • error - If an error occurs, this will be an error object instance of QuadrataSdkApiError

  • parsed - The onboard status API endpoint returns a response payload that needs to evaluated. This evaluation is done for you and returned as an object:

    • attributesToClaim - Array of attributes that need to be claimed by the application (based on the attributes you passed in)

    • isConsentNeeded - Boolean representing whether or not the privacyScopes (if any) that you passed in require consent from the user.

    • isInReview - Boolean representing whether or not the application is completed (based on the attributes you passed in) but is still in review.

  • clientProps - An object containing the necessary props that you need to pass into the KYC onboarding application, already formatted for you.

    • accessToken - The access token required for onboarding applications.

    • attributes - Array of attributes that need to be claimed.

    • privacyScopes - Array of privacyScopes that need to be consented to.

  • refreshOnboardStatus - A function that allows you to refresh the onboard status response by calling the API again, on demand.

  • isLoading - A boolean indicating whether the onboarding status API call is processing or not.

Last updated