Niftory Docs
  • What is Niftory?
  • Get your API Keys
  • 👩‍💻API
    • Niftory Web3 API
    • SDK QuickStart
      • Using the SDK in React
      • Using the SDK from the Server
    • API Quickstart
      • Create your first Wallet
      • API calls with Sample Content
      • Mint your first NFT
    • API Cheat Sheet
    • Niftory Sample App
      • Explore the Sample App
      • Anatomy of a Niftory App
        • Getting Authenticated
        • GraphQL Client Setup
        • API Usage
        • Transfer an NFT
    • 💡Core Concepts
      • Niftory Data Model
      • Authentication
        • Using Your API Key
        • Configuring Your App
        • Privileged Authentication
      • App and AppUser
      • NFTs
        • Creating NFTs
        • Querying NFTs
        • Transferring NFTs
        • Minting NFTs
      • Wallets
        • Create a Niftory Wallet
        • Register External Wallets
        • Query Wallets
      • Contract
      • User Auth (Client-Side)
    • Your Niftory Account
  • 🧑‍💼Admin Portal
    • Niftory Admin Portal
    • 🚀Guides
      • Setting Up Your Org
      • Create Your First NFT
    • 🗺️Explore
      • Org and Apps
      • NFT Collection
        • Sets
        • Collectibles
        • NFTs
    • 💼Use Cases
      • For Engineers
      • For Designers
      • For Business Users
  • 📖Reference
    • GraphQL & Auth Endpoints
    • API Reference
    • SDK API Reference
Powered by GitBook
On this page

Was this helpful?

  1. API
  2. Core Concepts
  3. Wallets

Register External Wallets

PreviousCreate a Niftory WalletNextQuery Wallets

Last updated 1 year ago

Was this helpful?

Check out to see how these constructs are used in practice.

A is the representation of a user's blockchain wallet scoped to your application.

Wallet Registration and Verification

Wallet setup is a 3-step process. This is done to ensure trust and security at every stage.

We understand that this process is toilsome, and are working on ways to handle it for you during the authentication flow.

1. Register the Wallet with Niftory.

registers the given wallet address to the currently logged-in user.

You should prompt your user to sign into their wallet, and then call this API with the address you get back. Check out for how to do this on the Flow blockchain.

registerWallet is required before any of the Wallet start returning any data. This is because Niftory APIs don't query the blockchain directly, and need the user-wallet association explicitly defined.

mutation RegisterWalletMutation($address: String!) {
  registerWallet(address: $address) {
    id
    address
    state
    verificationCode
  }
}
Sample Response
{
  "data": {
    "wallet": {
      "id": "14",
      "address": "0xf253fc2cb42c078436d07fb77e5a76a649892172",
      "state": "UNVERIFIED"
    }
  }
}

2. Verify the Wallet belongs to the AppUser

The verification code to sign is part of the Wallet object, and can be returned by the registerWallet mutation.

mutation VerifyWalletMutation(
  $address: String!,
  $signedVerificationCode: JSON!
) {
  verifyWallet(
    address: $address,
    signedVerificationCode: $signedVerificationCode
  ) {
    id
    address
    state
  }
}
Sample Response
{
  "data": {
    "wallet": {
      "id": "14",
      "address": "0xf253fc2cb42c078436d07fb77e5a76a649892172",
      "state": "VERIFIED"
    }
  }
}

3. Mark the Wallet as ready for your App

On the flow blockchain, wallets usually need to run a transaction before being able to receive NFTs, and this transaction must be signed by the owner of the wallet. Therefore, your app needs to prompt the user to authorize this transaction and let us know this has been done by calling the readyWallet API.

mutation ReadyWalletMutation($address: String!) {
  readyWallet(address: $address) {
    id
    address
    state
  }
}
Sample Response
{
  "data": {
    "wallet": {
      "id": "14",
      "address": "0xf253fc2cb42c078436d07fb77e5a76a649892172",
      "state": "READY"
    }
  }
}

The Wallet's state is updated after each phase of wallet setup, as follows:

State
Description
API Call

UNVERIFIED

The wallet has been registered, but not yet verified to belong to the signed-in user.

This is the state after the registerClient call.

VERIFIED

The wallet is verified to belong to the signed-in user, but not yet ready to receive NFTs from this app's contract.

This is the state after the verifyWallet call.

READY

The wallet is ready to receive NFTs from this app's contract.

This is the state after the readyWallet call.

After the Wallet is marked as ready, it is fully operational in your application, and can send & receive NFTs!

verifies that the user actually owns the wallet.

Once you have the verification code, you should prompt your user to sign it. On Flow, this is done by calling . Once you receive the signature back, include it as the signedVerificationCode parameter to the verifyWallet API:

- marks a Wallet as ready to receive NFTs. The wallet must be verified.

See the sample app for .

👩‍💻
💡
verifyWallet
fcl.currentUser.signUserMessage
readyWallet
an example on how to do this
WalletState
Wallet
registerWallet
Flow's documentation
queries
Anatomy of a Niftory App