Other NFT Operations Quickstart

Walkthrough for other NFT management capabilities

You're all set in terms of basic setup! There are tons of other capabilities that Blockus enables, covering all aspects of on-chain usage and wallet management in-game.

Let's look at a few other common NFT operations and how they're achieved.

Signing transactions

One of the key capabilities that Blockus provides is the ability to abstract away transaction signing for users. With Blockus custodial wallets, you can trigger a transaction signing request behind the scenes. You have the flexibility to create the best player-side experience without taking the user out of the game to interact with their wallet.

Sign and broadcast

Here's an example of a request that constructs a transaction and broadcasts it:

curl --request POST \
     --url https://blockus.net/v1/players/wallets/sendTransactionAndWait \
     --header 'X-PROJECT-ID: <yourProjectId>' \
     --header 'X-PROJECT-KEY: <yourProjectKey>' \
     --header 'X-ACCESS-TOKEN: <userAccessToken>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     -d '{ "to": "<destination address>", "chain": "<chain>", "value": "<amount in wei>", "nonce": 1, "data": "<tx data DataHexString>", "gasLimit": "<value in wei>", "gasPrice": "<value in wei>"}

The response will be returned after the transaction is finalized on the blockchain.

πŸ“˜

Note

The latency on this request can be long on certain chains since this action waits for the transaction to finalize on the blockchain. Blockus also provides webhooks to support asynchronous calls.

Sign only

If you'd like the flexibility to control how your transaction is broadcasted and post-broadcast handling, you can use /players/wallets/signTransaction. This endpoint will return a signed transaction string that you can directly broadcast.

NFT Gating

Some games want to check NFT ownership before using it, such as NFT as tournament ticket etc. Blockus provides a useful helper endpoint to streamline NFT gating. You can check an NFT ownership by using the isOwner check:

curl --request POST \
     --url https://blockus.net/v1/players/wallets/collections/<collectionId>/nfts/<nftId>/isOwner \
     --header 'X-PROJECT-ID: <yourProjectId>' \
     --header 'X-PROJECT-KEY: <yourProjectKey>' \
     --header 'X-ACCESS-TOKEN: <userAccessToken>' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \

Adding Externally Created NFTs

You can also add externally created NFTs to Blockus! This comes in handy in cases such as feature gate via an existing NFT collection that you've already launched. You can do this in a few simple steps:

  1. In your project, click the "Import Existing Collections" button.
  2. From there, select your marketplace, network, and drop in the contract address of your existing collection.

That's it! You'll now see it in your project collection list, and can reference it in API calls for actions like checking ownership.