close
Skip to content

Commit 48a3853

Browse files
committed
Initial commit
0 parents  commit 48a3853

707 files changed

Lines changed: 90743 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.replit‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
run = "node server.js"
2+
3+
# [nix]
4+
# channel = "stable-21_11"

‎README.md‎

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
# Casper NFT API
2+
3+
This is a simple API for minting, transferring, and burning non-fungible tokens (NFTs) on the Casper blockchain using the CEP-78 Enhanced NFT Standard. It also includes endpoints for minting and transferring fungible tokens.
4+
5+
## Requirements
6+
7+
To use this API, you will need:
8+
9+
- A Casper account with funds for paying transaction fees
10+
- A private key for your Casper account
11+
- Node.js installed on your system
12+
- The `casper-js-sdk`, `casper-cep78-js-client`, `express`, and `body-parser` Node.js packages installed
13+
14+
## Usage
15+
16+
1. Clone this repository to your local system.
17+
2. Install the required dependencies by running the `npm install` command in the project directory.
18+
3. Start the API server by running the `node index.js` command in the project directory.
19+
4. Send POST requests to the appropriate endpoints to mint, transfer, or burn NFTs, or mint or transfer fungible tokens.
20+
21+
### API Endpoints
22+
23+
#### Mint a Non-Fungible Token
24+
POST /mint-nft
25+
26+
27+
Request body:
28+
```json
29+
{
30+
"collectionName": "My Collection",
31+
"collectionSymbol": "MYC",
32+
"totalTokenSupply": "100",
33+
"ownershipMode": 1,
34+
"nftKind": 1,
35+
"jsonSchema": {
36+
"properties": {
37+
"name": {
38+
"name": "Name",
39+
"description": "The name of the NFT",
40+
"required": true
41+
},
42+
"description": {
43+
"name": "Description",
44+
"description": "A description of the NFT",
45+
"required": false
46+
}
47+
}
48+
},
49+
"nftMetadataKind": 1,
50+
"tokenId": "01",
51+
"toAddress": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
52+
"privateKey": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
53+
"fee": "1000000000",
54+
"sender": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
55+
"rpcUrl": "http://localhost:11101/rpc"
56+
}
57+
58+
## Transfer a Non-Fungible Token
59+
60+
POST /transfer-nft
61+
62+
{
63+
"tokenId": "01",
64+
"toAddress": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
65+
"privateKey": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
66+
"rpcUrl": "http://localhost:11101/rpc"
67+
}
68+
69+
## Burn a Non-Fungible Token
70+
71+
POST /burn-nft
72+
73+
request body
74+
75+
{
76+
"tokenId": "01",
77+
"privateKey": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
78+
"rpcUrl": "http://localhost:11101/rpc"
79+
}
80+
81+
## Mint a Fungible Token
82+
POST /mint-ft
83+
84+
Request body:
85+
{
86+
"amount": "1000",
87+
"recipient": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
88+
"privateKey": "0123456789abcdef012
89+
3456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
90+
"rpcUrl": "http://localhost:11101/rpc"
91+
}
92+
93+
## Transfer a Fungible Token
94+
95+
POST /transfer-ft
96+
97+
Request body:
98+
99+
{
100+
"amount": "100",
101+
"recipient": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
102+
"privateKey": "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
103+
"rpcUrl": "http://localhost:11101/rpc"
104+
}
105+
106+
## Response Format
107+
All responses will be in JSON format, with the following fields:
108+
109+
{
110+
"status": "success",
111+
"message": "The request was successful.",
112+
"data": { ... }
113+
}
114+
115+
If an error occurs, the status field will be set to "error", and the message field will contain an error message.
116+
117+
# License
118+
119+
This project is licensed under the MIT License. See the LICENSE file for details.

‎node_modules/.bin/mime‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/.bin/nodemon‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/.bin/nodetouch‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/.bin/nopt‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎node_modules/.bin/semver‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)