Integration
Call initialiseCreateWallet to set up handlers.
Then provide the user’s email address to createWallet. When this component is rendered, an email is sent to the user prompting them to verify it. Once verified, a NFTgate Wallet address on the specified chain is returned.
The same email address will always resolve to the same wallet address on a given blockchain so it is safe to verify email addresses that already have a NFTgate Wallet.
Code Example
import {
createWallet,
initialiseCreateWallet,
} from '@nftgate/js-client-sdk';
// On page load...
await initialiseCreateWallet({
onSuccess,
onEmailVerificationInitiated,
onError
});
// When you are ready to prompt the user...
await createWallet({
chainName = "Polygon",
emailAddress,
clientId,
redirectUrl,
});
initialiseCreateWallet Props
Props | Type | Description |
---|---|---|
onSuccess * | (user: { emailAddress: string; walletAddress: string; accessCode?: string; }) => void |
A callback called when the email is verified and wallet address is created.
The user’s email address and wallet address are returned. |
onEmailVerificationInitiated | () => void | A callback called after NFTgate sends an email for the user to verify.
If not provided, NFTgate provides a UI to tell the user to check their inbox. |
onError | (error: NFTgateSDKError) => void | A callback called if there is an error sending the email or creating a wallet address. |
createWallet Props
Props | Type | Description |
---|---|---|
chainName * | string Valid values: – Ethereum – Goerli – Polygon – Mumbai |
The wallet will be created on that specified chain. A user will have the same address on all EVM blockchains. |
emailAddress * |
string | The user’s email address that needs to be verified. |
redirectUrl * |
string | A URL to redirect the user once they click the link in their email.
If not provided, the email link prompts the user to close the tab and return to your app. |
clientId * |
string | If provided, an accessCode is provided in the onSuccess callback. This accessCode is used to query the user’s wallet information later. |