This repository houses the rest api for Just NFTs.
This is a simple rest api that uses the Aptos SDK and Express to interact with the Just NFTs smart contract.
server.js
- API server fileabi.js
- Contains the ABI of the smart contract
Endpoint | Method | Description |
---|---|---|
/token/<TOKEN ID> |
GET | Get the data of an NFT |
/mint/<PRIVATE KEY> |
POST | Mint an NFT to the caller's account |
/transfer/<TOKEN ID>/<PRIVATE KEY>/<RECIPIENT ADDRESS> |
POST | Transfer an NFT to the recipient |
/burn/<TOKEN ID>/<PRIVATE KEY> |
POST | Burn an NFT |
/optin/<PRIVATE KEY> |
POST | Opt into transfers |
/register/<PRIVATE KEY> |
POST | Register the token store |
Before calling any endpoints make sure you send POST requests to /optin/<PRIVATE KEY>
and /register/<PRIVATE KEY>
to opt-in to the transfer and register the token store.
GET request to
/token/<TOKEN ID>
The /token/<TOKEN ID>
endpoint can be called to get the data of an NFT.
It takes a token id
as an argument.
This endpoint will fail if the token does not exist or the token id is out of range.
POST request to
/mint/<PRIVATE KEY>
The /mint/<PRIVATE KEY>
endpoint can be called to mint and NFT to the caller's account.
It takes a private key
as an argument.
This endpoint will fail if the caller has not opted into the transfer and token store.
POST request to
/transfer/<TOKEN ID>/<PRIVATE KEY>/<RECIPIENT ADDRESS>
The /transfer/<TOKEN ID>/<PRIVATE KEY>/<RECIPIENT ADDRESS>
endpoint can be called to transfer an NFT to the recipient.
It takes a token id
, private key
, and recipient address
as arguments.
This endpoint will fail if the receiver has not opted into the transfer and token store or if the caller is not the owner of the set token. The endpoint would also fail if the token does not exist or the token id is out of range.
POST request to
/burn/<TOKEN ID>/<PRIVATE KEY>
The /burn/<TOKEN ID>/<PRIVATE KEY>
endpoint can be called to burn an NFT.
It takes a token id
and private key
as arguments.
This endpoint will fail if the caller is not the owner of the set token. The endpoint would also fail if the token does not exist or the token id is out of range.
POST request to
/optin/<PRIVATE KEY>
The /optin/<PRIVATE KEY>
endpoint can be called to opt into transfers. This allows the account to receive NFTs.
It takes a private key
as an argument.
POST request to
/register/<PRIVATE KEY>
The /register/<PRIVATE KEY>
endpoint can be called to register the token store.
It takes a private key
as an argument.
Clone the repository and run pnpm install
to install the dependencies.
Run the following command to start the api server:
node src/server.js