đŸŽ¯Objective

Objective transaction for FIXED amount

This endpoint will send a number of Tokens or NFTs determined by the objective that you've created on your Okapi dashboard.

In this example, a we have created a Signup objective. When a user sign up to the app, we want to send him a 100 Okapi coins . To do so, we need to use the objective endpoint. You can think of the objective endpoint as an endpoint that sends Tokens or NFTs to a user when he completes an objective.

To see how to create an objective on Okapi, see the Create an objective section.

Note: You don't have to create a user wallet before sending him tokens. We will create a new one if the user did not exists.

This endpoint takes an id (objective ID) and a user (unique identifier).

const data = await okApiClient.objective({ id: "OBJECTIVE_ID", user: "john@doe.com" })
{
    "txSignature": "5oMDLE2uLfFJVXSB3mqa4m9wwSquENEjzpGDUWeC55VsCcekex6hsAAsQdVE4z2PUSkQCS8EXjMjFUFieJDs1fQX",
    "success": true
}

If the objective ID exists and the transaction is successful, your user (john@doe.com) will now have 100 Okapi coin in it's wallet. You will get a success boolean and a txSignature .

You can take a look at the transaction here https://explorer.solana.com/tx/5oMDLE2uLfFJVXSB3mqa4m9wwSquENEjzpGDUWeC55VsCcekex6hsAAsQdVE4z2PUSkQCS8EXjMjFUFieJDs1fQX to see that the user has received the 100 Okapi coins and that your account has been debited of the same amount.

Cost: 10 compute units

Note: The documentation for objective transaction for DYNAMIC amount is coming soon.

Last updated