Skip to content

kin-starters/kin-demo-go-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kin Go SDK Demo

This app demonstrates how to integrate with Kin via the Go SDK

Front End

This Kin BE Demo Server is compatible with our Kin DApp Playground

Prep

  • 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
  • Environment variable for your Private Key. Visit The Kin Laboratory if you want help getting started with Keypairs for testing
  • Environment variable for your Webhook Secret (if using webhooks)

.env

APP_INDEX=Your App App Index
PRIVATE_KEY=Your App Account Secret Key
SERVER_WEBHOOK_SECRET=Your Webhook Secret

Go

Go Version

16.7

Go Installations

go build
go install

Start

./kin-demo-go-sdk

or

go run main.go

Endpoints

Status

GET /status

Response:
200 {
    "appIndex": 360,
    "env": 1,
    "transactions": [],
    "users": [
        {
            "name": "App",
            "publicKey": "BsiFeVHeyYv56rBfmotqbeDU7Q9rs8SYkXRsm3umsYvV"
        }
    ]
}


Setup

POST /setup?env=Test or setup?env=Prod

Response
200 or 400

Create Account

POST /account?name=Test%20User

Response
201 or 400

Balance

GET /balance?user=Test%20User

Response
'999' or 400

Airdrop

POST /airdrop?to=Test%20User&amount=2000

Response
200 or 400

Transfer Kin

POST /send

Request Body
{
   "from": "App",
   "to": "Test User",
   "amount": "2000",
   "type": "Earn"
}

Response
200 or 400

Transfer Kin in Batch of Earn Transactions

POST /earn_batch

Request Body
{
   "from": "App",
   "batch": [
       {to: "User1", amount: "111"}, 
       {to: "User2", amount: "333"}
   ]
}

Response
200 or 400

Transaction Info

GET /transaction?transaction_id=uxMepF4pYrexvFKJEsU2ATzxU1MSJkqx51DCEek5SszAPygRUgsFYT8Ai6yJYLyKBJuqTd4sBnsC9wDWpCFWXi4


Response
200 {
   "payments": [
       {
           "destination": "GTpeCtraqEzkbSChQCmakFqyHpNU3iensTWnX58yQrk6",
           "quarks": 100000000,
           "sender": "89CLzhYJzZKs8mZ3GkwPeJfb3wHVJqGunyryBNjJhiDH",
           "type": 1
       }
   ],
   "txState": 3
} 
or 400

If you're just getting started, you might want to look at this first...

Dev Community

Join us on Discord if you're looking for support with your App or to connect with other active Kin developers.

If you're stuck or have any questions you'd like answering, get in touch on our kin-go channel.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published