Skip to main content

Achievo Back-End Integration Documentation

Overview

This document provides guidelines for back-end developers to integrate with the Achievo service. The process is streamlined as it only requires the use of an API key provided by Achievo.

Warning: Security of Private Keys

DANGER: Never expose your private key to the front-end. It is crucial to keep the private key secure and only use it in the back-end to maintain the integrity and security of your application.

Integration Process

Integrating with Achievo in the back-end is straightforward and does not require a login process. Use the API key provided by Achievo directly for authentication.

Example: Fetching NFT-Gating Data

The following JavaScript example demonstrates how to fetch nft gating data using Axios:

const checkNFTGating = async () => {
const {
data: { results },
} = await axios.post(
`${ACHIEVO_BASE_URL}/v1/crosschain/nftGating`,
{
smartContract: "0xD07180c423F9B8CF84012aA28cC174F3c433EE29",
chainId: 324, // only EVMs supported
erc: "721", // 1155, 20, 6551
checks: [
{
args: ["0xa0FDB2F6cf2Bf189db73B294A60088feF751bfCD"],
functionName: "balanceOf",
matchResult: 1,
matchOperation: "GREATER_THAN_OR_EQUAL", // EQUAL | GREATHER_THAN | LESS_THAN | GREATHER_THAN_OR_EQUAL | LESS_THAN_OR_EQUAL | NOT_EQUAL
},
{
args: [25],
functionName: "tokenURI",
matchResult: "x/ipfs/Qmc7c9tNVaaAbTM5RMgdPY7MjPoLDFfPw8BAv3WuBUrebe",
matchOperation: "EQUAL",
},
],
},
{
headers: { Authorization: ACHIEVO_API_KEY },
}
);
return { results };
};

Summary

To use Achievo's services in the back-end:

  1. Utilize the API key provided by Achievo for authentication.
  2. Ensure that any private keys or sensitive information are never exposed or sent to the front-end.
  3. The provided example demonstrates how to make an API call to retrieve nft gating data securely.
  4. This documentation provides the essential steps for back-end developers to securely integrate with Achievo's services.

Request schema

This is the Zod schema to use as request:

  z.object({
body: z.object({
smartContract: z.string(),
chainId: z.number(),
erc: z.enum([ERCS.ERC20, ERCS.ERC721, ERCS.ERC1155, ERCS.ERC6551]),
checks: z.array(
z.object({
args: z.array(z.any()).optional(),
userAddress: z.string().optional(),
index: z.number().optional(),
functionName: z.enum([
DEFAULT_FUNCTIONS.balanceOf,
DEFAULT_FUNCTIONS.uri,
DEFAULT_FUNCTIONS.tokenURI,
]),
matchResult: z.string().or(z.number()),
matchOperation: z.enum([
OPERATIONS.EQUAL,
OPERATIONS.GREATER_THAN,
OPERATIONS.LESS_THAN,
OPERATIONS.GREATER_THAN_OR_EQUAL,
OPERATIONS.LESS_THAN_OR_EQUAL,
OPERATIONS.NOT_EQUAL,
]),
})
),
}),
})
headers: HeaderJWT,

Supported operations:

export enum OPERATIONS {
EQUAL = 'EQUAL',
GREATER_THAN = 'GREATER_THAN',
LESS_THAN = 'LESS_THAN',
GREATER_THAN_OR_EQUAL = 'GREATER_THAN_OR_EQUAL',
LESS_THAN_OR_EQUAL = 'LESS_THAN_OR_EQUAL',
NOT_EQUAL = 'NOT_EQUAL',
}

supported functions:

export enum DEFAULT_FUNCTIONS {
balanceOf = 'balanceOf',
uri = 'uri',
tokenURI = 'tokenURI',
}

supported ERCS:

export enum ERCS {
ERC20 = '20',
ERC721 = '721',
ERC1155 = '1155',
ERC6551 = '6551',
}