Skip to main content
Version: V2

Subscribe

Workflow

Subscribing to a profile can be implemented in just a few easy steps. What subscribing to a profile essentially means is that the user will mint an NFT by calling a couple of APIs.

  1. First, data should be presented to the user in a readable format when signing from the wallet. To do that you’ll need to call the createSubscribeTypedData API that takes care of this.

    If you’re unfamiliar with typed data, you can read more about it here.

caution

This API requires Authorization header with the Bearer token. You can learn more about it here.

  1. Second, once you received data in a readable format, you’ll need to get the user’s signature (eth_signTypedData_v4) for it. Basically, you’ll need to write a function and pass it a message as a param and return the signature that it’s necessary for the next step.

Ethers library is one option that can quickly help you write a function to get the user’s signature for a specific message. In this our case the message represents the typed data from step 1.

  1. Third, you’ll have to call the relay API that will broadcast the transaction and mint the subscribe NFT, you will need to put as params the typedDataID you received from createSubscribeTypedData mutation call and the user's signature.
caution

This API requires Authorization header with the Bearer token. You can learn more about it here.

You can now verify the transaction by looking up the txHash from the response on etherscan.io. That’s it! You’re all done!

Experiment in Sandbox

We’ve created an example that incorporates all the steps for Subscribe to a profile. Feel free to experiment with our code in the sandbox below. This covers a couple of steps

  1. Login with wallet
  2. Subscribe to a profile
Designed by