This app demonstrates how to integrate with Kin via the TypeScript SDK
This Kin BE Demo Server is compatible with our Kinetic Playground
- Your App is registered on the Kin Developer Portal so you can take advantage of the Kin Rewards Engine and get your App Index.
- Environment variable for your App Index. Use
APP_INDEX=1
to get started before your own App Index is confirmed. - Environment variable for your Keypair. Can be either
MNEMONIC
orBYTE_ARRAY
. - Don't have a Keypair?
- For mainnet and devnet Keypairs, use a Solana wallet like Phantom or Solflare to create one.
- Use the Kinetic DApp Demo to quickly generate a devnet Keypair and get your mnemonic phrase.
- Log in to the Kinetic Sandbox and create a keypair in your app's 'Toolbox' section.
.env
PORT=3001
APP_INDEX=1
KINETIC_ENDPOINT='https://your_kinetic_endpoint'
BYTE_ARRAY=[24,20,238,188,26,234,120,209,88,63,170,46,66,98,21,113,194,120,143,228,231,37,91,0,242,32,180,99,243,179,57,144,11,233,235,235,203,20,105,33,47,140,152,253,12,148,72,175,141,253,242,110,225,110,21,211,118,87,99,99,99,99,99,99]
MNEMONIC="cat dog elephant lion tiger shark whale diplodocus dragon pokemon transformer turtle"
npm i
or
yarn
npm run start
or
yarn start
GET /status
Response:
200 {
"appIndex": 360,
"env": 'devnet',
"transactions": [],
"users": [
{
"name": "App",
"publicKey": "BsiFeVHeyYv56rBfmotqbeDU7Q9rs8SYkXRsm3umsYvV"
}
]
}
POST /setup?env=Test or setup?env=Prod
Response
200 or 400
POST /account?name=Test%20User
Response
201 or 400
GET /balance?user=Test%20User
Response
'999' or 400
POST /airdrop?to=Test%20User&amount=2000
Response
200 or 400
POST /send
Request Body
{
"from": "App",
"to": "Test User",
"amount": "2000",
"type": "Earn"
}
Response
200 or 400
POST /earn_batch
Request Body
{
"from": "App",
"batch": [
{to: "User1", amount: "111"},
{to: "User2", amount: "333"}
]
}
Response
200 or 400
GET /transaction?transaction_id=uxMepF4pYrexvFKJEsU2ATzxU1MSJkqx51DCEek5SszAPygRUgsFYT8Ai6yJYLyKBJuqTd4sBnsC9wDWpCFWXi4
Response
200 and return string of transaction data
or 400
GET /history?user=Test%20User
Response
200 and return string of transaction data
or 400
I use localtunnel for doing local development: https://theboroer.github.io/localtunnel-www/
lt --port 3001 --subdomain <webhook domain stored in the developer portal for this app>
You could also use ngrok: https://ngrok.com/
If you're just getting started, you might want to look at this first...
Join us on Discord if you're looking for support with your App or to connect with other active Kin developers.