Register Essence
Workflow
1. Generate Typed Data
All typedData mutations require an Authorization
header with the Bearer
token. You can learn how to get a bearer token in the User Login section.
Registering an essence can be implemented in just a few easy steps. What registering an essence essentially means is that the user will deploy an NFT contract by calling a couple of APIs.
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 createRegisterEssenceTypedData
API that takes care of this.
If you’re unfamiliar with typed data, you can read more about it here.
2. Get User Signature ✍️
- 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 amessage
as a param and return thesignature
that is necessary for the next step.
3. Call relay
and get relayActionID
In order to call the relay
mutation, you must include your X-API-KEY
in the header.
You can learn more about how to get one here.
- Third, you’ll have to call the
relay
API that will broadcast the transaction and mint the essence NFT, you will need to put as params thetypedDataID
you received fromcreateRegisterEssenceTypedData
mutation call and the user'ssignature
.
4. Call relayActionStatus
to receive txHash
Finally you poll the relayActionStatus
API using the relayActionId
returned from the previous step to get the status of the related transaction. There are three possible response types:
RelayActionStatusResult
RelayActionQueued
RelayActionError
You can now verify the transaction by looking up the txHash
from the response on bscscan. That’s it! You’re all done!