How to use the Points API
The distribution of both Blast Points and Blast Gold can be done using the offchain Points API.
The integration of the Points API is divided into 2 parts:
Onchain: Configuring the operator address for the contract during deployment.
Offchain: Interacting with the Points API to fetch points balances and transferring points to users.
Configuring the points operator address for the contract
Any contracts that expect to accumulate Blast points or gold should call
configurePointsOperator
to be compatible with the points API.
We recommend calling it on construction/proxy initialization.
Contracts can earn points by holding ETH, WETH, or USDB, or by being designated recipients in another contract’s interactions with the points API.
That’s it, the operator
is now configured and we can move onto the offchain steps!
Interacting with the Points API
The points API is authenticated and requires the bearerToken
to be present in headers as Authorization: Bearer ${bearerToken}
.
We will get the bearerToken
from the authentication flow.
Obtaining a challenge
Requesting a challenge and message. Message to be signed by the
operator
private key following the
ERC-191 standard
Obtaining a bearer token
Using the message signed by the operator
private key we can now obtain a bearerToken
which then can be used to access authenticated routes on the Points API.
Get contract's points balance
Get the contract’s points balance to see how many points can be distributed.
The response will contain the points balances for both Blast Points
(PHASE2_POINTS
) and Blast Gold
(PHASE2_GOLD
).
Submitting a batch of point transfers
Submit a batch with details indicating which and how many points to transfer to a user.
Operators cannot submit a batch to transfer PHASE2_POINTS
and PHASE2_GOLD
points simultaneously.
secondsToFinalize
should be greater than equal to 3600
for mainnet. If not provided the default is 86400
.
Check Points API Parameters for the respective network for more information.
If you need idempotency you can generate your own batchId
s and use this API endpoint.
Fetching a single batch
Fetching the submitted batch to check the status of the point transfers.
Alternatively, you can fetch all batches associated with your contractAddress
using this API endpoint.
That’s all you need to successfully transfer points to the users of your smart contract!