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.
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!
How do I change the operator at a later stage?
Once the points operator has been set once, only the existing points
operator can update it by calling configurePointsOperatorOnBehalf
.
The first parameter of configurePointsOperatorOnBehalf
is the contract you’d like to change the points operator for.
The second parameter is the new points operator
. The msg.sender
must be the current points operator.
This mechanism allows you to change your points operator at any point after your contract has been created.
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.
Requesting a challenge and message. Message to be signed by the
operator
private key following the
ERC-191 standard
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 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
).
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 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!
How do I cancel one/some of the transfers in the batch?
You cannot cancel an individual transfer, you cancel the entire batch of transfers using this API endpoint and submit a new batch.
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.
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!
How do I change the operator at a later stage?
Once the points operator has been set once, only the existing points
operator can update it by calling configurePointsOperatorOnBehalf
.
The first parameter of configurePointsOperatorOnBehalf
is the contract you’d like to change the points operator for.
The second parameter is the new points operator
. The msg.sender
must be the current points operator.
This mechanism allows you to change your points operator at any point after your contract has been created.
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.
Requesting a challenge and message. Message to be signed by the
operator
private key following the
ERC-191 standard
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 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
).
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 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!
How do I cancel one/some of the transfers in the batch?
You cannot cancel an individual transfer, you cancel the entire batch of transfers using this API endpoint and submit a new batch.