Overview
Welcome to the ThunderGene API documentation. We offer complete REST, Websocket, to suit your Web2 experience when integrate with blockchain technology.
Note that in ThunderGene, project user is an address that created from Create User API, and project address is the address that shows in project info page of ThunderGene console.
For more details, you can check gitbook, or visit example to get more examples.
Authentication
Signature Computing
const CryptoJS = require("crypto-js");
const projectId = 'YOUR-PROJECT-ID';
const projectSecret = 'YOUR-PROJECT-SECRET';
const timestamp = Date.now().toString();
const body = { /* depends on your API */ };
// if body is empty, message should be `${projectId}:${timestamp}:`
const signature = CryptoJS.HmacSHA256(`${projectId}:${timestamp}:${JSON.stringify(body)}`, projectSecret);
header['X-PROJECT-ID'] = projectId;
header['X-TIMESTAMP'] = timestamp;
header['X-SIGNATURE'] = signature.toString();
- For authenticated requests, the following headers should be sent with the request:
- X-PROJECT-ID: Your project id
- X-TIMESTAMP: Number of seconds since Unix epoch in string
- X-SIGNATURE: SHA256 HMAC of the concation of the following strings, divide by
:
- X-PROJECT-ID
- X-TIMESTAMP
- Request body(POST only, JSON-encoded, if it has no body, the last colon is also needed)
REST API
Mint Asset
Code samples
const fetch = require('node-fetch');
const inputBody = {
"asset_id": "0dbd5e71-c553-499d-bde4-d01b4bedd044",
"to": "0xc9e6945E0fAfa7DfaCf3bF8564849F7984879c62",
"value": 1.5
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/asset/mint',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/asset/mint
Mint asset of asset_id
to
with value
. Minimum value
is 0.01, Due to floating-point precision, value
will automatically round down to three decimal places.
Body parameter
{
"asset_id": "0dbd5e71-c553-499d-bde4-d01b4bedd044",
"to": "0xc9e6945E0fAfa7DfaCf3bF8564849F7984879c62",
"value": 1.5
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.ClientMintAssetRequest | true | mint asset parameters |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | task id to query result | route.JSONID |
401 | Unauthorized | Unauthorized | route.JSONError |
404 | Not Found | Not found:(8194,asset not found) | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Transfer Asset
Code samples
const fetch = require('node-fetch');
const inputBody = {
"asset_id": "0dbd5e71-c553-499d-bde4-d01b4bedd044",
"from": "0xc9e6945E0fAfa7DfaCf3bF8564849F7984879c62",
"symbol": "TT",
"to": "0x1ac24c858Cd7432364587b251098A2dc297Ec47c",
"value": 1.5
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/asset/transfer',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/asset/transfer
Transfer asset of asset_id
or symbol
from from
to to
with value
, if from
is project address, you can transfer to any address. But you can only transfer to project address or project user when from
is a project user. Due to floating-point precision, value
will automatically round down to three decimal places. For supported symbol, please check ClientListSupportedTokens
API.
Body parameter
{
"asset_id": "0dbd5e71-c553-499d-bde4-d01b4bedd044",
"from": "0xc9e6945E0fAfa7DfaCf3bF8564849F7984879c62",
"symbol": "TT",
"to": "0x1ac24c858Cd7432364587b251098A2dc297Ec47c",
"value": 1.5
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.ClientTransferAssetRequest | true | transfer asset parameters |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | task id to query result | route.JSONID |
401 | Unauthorized | Unauthorized | route.JSONError |
404 | Not Found | Not found:(8194,asset not found) | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Claim Token
Code samples
const fetch = require('node-fetch');
const inputBody = {
"asset_id": "0dbd5e71-c553-499d-bde4-d01b4bedd044",
"to": "0xc9e6945E0fAfa7DfaCf3bF8564849F7984879c62",
"value": 1.5
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/claim',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/claim
Claim token let the to
to claim token from project address, there should be enough balance in project address of given asset
Body parameter
{
"asset_id": "0dbd5e71-c553-499d-bde4-d01b4bedd044",
"to": "0xc9e6945E0fAfa7DfaCf3bF8564849F7984879c62",
"value": 1.5
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.ClaimTokenRequest | true | params to claim token |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | task id to query result | route.JSONID |
400 | Bad Request | error with error code and message | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Burn NFT
Code samples
const fetch = require('node-fetch');
const inputBody = {
"amount": "string",
"asset_id": "string",
"from": "string",
"token_id": "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/nft/burn',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/nft/burn
Burn NFT from from
address, token_id
and amount
should be string type
Body parameter
{
"amount": "string",
"asset_id": "string",
"from": "string",
"token_id": "string"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.ClientBurnNFTRequest | true | burn asset parameters |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | task id to query result | route.JSONID |
400 | Bad Request | Bad request | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
404 | Not Found | Not found:(8194,asset not found) | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Mint NFT
Code samples
const fetch = require('node-fetch');
const inputBody = {
"amount": "string",
"asset_id": "string",
"to": "string",
"token_id": "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/nft/mint',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/nft/mint
Mint NFT to to
address, amount
and token_id
should be string type
Body parameter
{
"amount": "string",
"asset_id": "string",
"to": "string",
"token_id": "string"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.ClientMintNFTRequest | true | mint asset parameters |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | task id to query result | route.JSONID |
400 | Bad Request | Bad request | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
404 | Not Found | Not found:(8194,asset not found) | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Transfer NFT
Code samples
const fetch = require('node-fetch');
const inputBody = {
"amount": "string",
"asset_id": "string",
"from": "string",
"to": "string",
"token_id": "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/nft/transfer',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/nft/transfer
Transfer NFT from from
address to to
address, amount
and token_id
should be string type, if from
is a project user, than to
can only be project user too. You can transfer to any address when from
is project address
Body parameter
{
"amount": "string",
"asset_id": "string",
"from": "string",
"to": "string",
"token_id": "string"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.ClientTransferNFTRequest | true | transfer asset parameters |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | task id to query result | route.JSONID |
400 | Bad Request | Bad request | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
404 | Not Found | Not found:(8194,asset not found) | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Get asset of redeem code
Code samples
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/redeem?code=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /client/redeem
Get underlying asset of redeem code
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
code | query | string | true | redeem code to query |
Example responses
200 Response
[
{
"address": "string",
"name": "string",
"symbol": "string",
"value": 0
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | assets of redeem code | Inline |
400 | Bad Request | error with error code and message | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [route.GetRedeemResponse] | false | none | none |
» address | string | false | none | Address of the token |
» name | string | false | none | Name of the token |
» symbol | string | false | none | Symbol of the token |
» value | number | false | none | Deposited value |
Claim redeem code
Code samples
const fetch = require('node-fetch');
const inputBody = {
"code": "07bf8b45-fd7f-491f-9435-4dddc1abea9c",
"to": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/redeem',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/redeem
Claim redeem code asset to to
with code
Body parameter
{
"code": "07bf8b45-fd7f-491f-9435-4dddc1abea9c",
"to": "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.ClaimRedeemRequest | true | params to claim redeem code |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | redeem task id | route.JSONID |
400 | Bad Request | error with error code and message | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Create redeem code
Code samples
const fetch = require('node-fetch');
const inputBody = {
"from": "string",
"redeem_assets": [
{
"asset_id": "string",
"value": 0
}
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/redeem/create',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/redeem/create
Create redeem code and lock asset util redeemed. from
should be project user.
Body parameter
{
"from": "string",
"redeem_assets": [
{
"asset_id": "string",
"value": 0
}
]
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.CreateRedeemRequest | true | params to create redeem code |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | redeem task id to query result | route.JSONID |
400 | Bad Request | error with error code and message | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Create NFT redeem code
Code samples
const fetch = require('node-fetch');
const inputBody = {
"from": "string",
"redeem_assets": [
{
"asset_id": "string",
"balance": [
{
"amount": 0,
"token_id": "string"
}
]
}
]
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/redeem/create/nft',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/redeem/create/nft
Create NFT redeem code and lock asset util redeemed. from
should be project user. RedeemAssets
should not exceed 10 asset, and Balance
of RedeemAssets
should not exceed 10 token ids.
Body parameter
{
"from": "string",
"redeem_assets": [
{
"asset_id": "string",
"balance": [
{
"amount": 0,
"token_id": "string"
}
]
}
]
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.CreateNFTRedeemRequest | true | params to create redeem code |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | redeem task id to query result | route.JSONID |
400 | Bad Request | error with error code and message | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Get NFT asset of redeem code
Code samples
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/redeem/nft?code=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /client/redeem/nft
Get underlying NFT asset of redeem code
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
code | query | string | true | redeem code to query |
Example responses
200 Response
[
{
"address": "string",
"balance": [
{
"amount": 0,
"token_id": "string"
}
],
"name": "string",
"symbol": "string"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | assets of redeem code | Inline |
400 | Bad Request | error with error code and message | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [route.GetRedeemNFTResponse] | false | none | none |
» address | string | false | none | Address of the NFT |
» balance | [route.NFTBalance] | false | none | Deposited NFT balance |
»» amount | integer | false | none | Amount, if ERC721, amount should be 1 |
»» token_id | string | false | none | Token id in string type |
» name | string | false | none | Name of the NFT |
» symbol | string | false | none | Symbol of the NFT |
Get redeem status
Code samples
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/redeem/status?redeem_id=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /client/redeem/status
Get redeem task status, can be use to check if the redeem code is ready. status
should be one of the following (RedeemStatusPending = 0, RedeemStatusFailed = 1, RedeemStatusOK = 2, RedeemStatusLocked = 3, RedeemStatusRedeemed = 4, RedeemStatusRedeemFailed = 5, RedeemStatusFailedInsufficientFunds = 6). Once status
is RedeemStatusLocked=3
, the redeem_code
is available to redeem.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
redeem_id | query | string | true | redeem task id to query |
Example responses
200 Response
{
"redeem_code": "4170b967-7db9-43aa-a409-dec9315d8d80",
"status": 3
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | redeem status | route.RedeemStatusResponse |
400 | Bad Request | error with error code and message | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Sign message
Code samples
const fetch = require('node-fetch');
const inputBody = {
"from": "string",
"message": "string"
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/sign',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/sign
Sign message with address, address should be project user for the API key of project that provided.
Body parameter
{
"from": "string",
"message": "string"
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.ClientSignMessageRequest | true | mint asset parameters |
Example responses
200 Response
{
"signed": "string"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | signed message | route.ClientSignMessageResponse |
400 | Bad Request | Bad request | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
404 | Not Found | Not found:(8194,asset not found) | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Get supported token list
Code samples
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/tokens',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /client/tokens
Get supported token list
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
Example responses
200 Response
[
{
"address": "string",
"decimals": 0,
"symbol": "string"
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | supported token list | Inline |
400 | Bad Request | Bad request | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [route.SupportedToken] | false | none | none |
» address | string | false | none | none |
» decimals | integer | false | none | none |
» symbol | string | false | none | none |
Send transaction
Code samples
const fetch = require('node-fetch');
const inputBody = {
"data": [
0
],
"from": "string",
"gas_limit": 0,
"gas_price": 0,
"to": "string",
"value": 0
};
const headers = {
'Content-Type':'application/json',
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/tx',
{
method: 'POST',
body: JSON.stringify(inputBody),
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/tx
Send transaction, value
should at most less than 1.5 TT of address balance, and gas_price
is in gwei
Body parameter
{
"data": [
0
],
"from": "string",
"gas_limit": 0,
"gas_price": 0,
"to": "string",
"value": 0
}
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
body | body | route.ClientSendTransactionRequest | true | mint asset parameters |
Example responses
202 Response
{
"id": "27e845ef-4c56-4570-9103-daf49b2e7706"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
202 | Accepted | signed message | route.JSONID |
400 | Bad Request | Bad request | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
404 | Not Found | Not found:(8194,asset not found) | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Create User
Code samples
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/user',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
POST /client/user
Create a project user and returns the user address.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
Example responses
200 Response
{
"address": "0x1ac24c858Cd7432364587b251098A2dc297Ec47c"
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | user address that created | route.CreateUserResponse |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Get User Balance
Code samples
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/user/asset?address=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /client/user/asset
Get user balance of asset of asset_id
, address
should be the project user or project address. Due to floating-point precision, balance
will automatically round down to three decimal places.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
asset_id | query | string | false | asset id to query, should not be empty if symbol is empty |
symbol | query | string | false | symbol to query, should not be empty if asset_id is empty |
address | query | string | true | user address |
Example responses
200 Response
[
{
"balance": 1.5
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | user assets | Inline |
400 | Bad Request | Bad request | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [route.UserAssetResponse] | false | none | none |
» balance | number | false | none | User asset balance |
Get User NFT Balance
Code samples
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json',
'X-SIGNATURE':'string',
'X-PROJECT-ID':'string',
'X-TIMESTAMP':'string'
};
fetch('https://api.thundergene.com/api/v1/client/user/nft?asset_id=string&address=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /client/user/nft
Get user NFT balance of asset of asset_id
, address
should be the project user or project address
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
X-SIGNATURE | header | string | true | hmac(X-PROJECT-ID:X-TIMESTAMP:BODY, api_key) |
X-PROJECT-ID | header | string | true | project id |
X-TIMESTAMP | header | string | true | timestamp of request |
asset_id | query | string | true | asset id |
address | query | string | true | user address |
Example responses
200 Response
[
{
"amount": 10,
"token_id": 15
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | user assets | Inline |
400 | Bad Request | Bad request | route.JSONError |
401 | Unauthorized | Unauthorized | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error), (61441,db error) | route.JSONError |
Response Schema
Status Code 200
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [route.UserNFTResponse] | false | none | none |
» amount | integer | false | none | Amount, if ERC721, amount should be 1 |
» token_id | integer | false | none | Token id in string type |
Get Task Result
Code samples
const fetch = require('node-fetch');
const headers = {
'Accept':'application/json'
};
fetch('https://api.thundergene.com/api/v1/task?task_id=string',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
GET /task
Get task result of task_id
which is the returned value of other client API
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
task_id | query | string | true | Task id to query |
Example responses
200 Response
{
"failed_reason": 2,
"id_created": "",
"status": 1
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | Status with id created if it's create project or create asset, Status: (done=0,failed=1,pending=2,processing=3) | route.TaskStatus |
202 | Accepted | task not ready yet | None |
400 | Bad Request | Bad request | route.JSONError |
404 | Not Found | Task not found | route.JSONError |
500 | Internal Server Error | Internal server error: (61440,unexpected error) | route.JSONError |
Schemas
route.ClaimRedeemRequest
code: 07bf8b45-fd7f-491f-9435-4dddc1abea9c
to: "0x14dC79964da2C08b23698B3D3cc7Ca32193d9955"
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | string | true | none | Redeem code to redeem |
to | string | true | none | Address to receive assets |
route.ClaimTokenRequest
asset_id: 0dbd5e71-c553-499d-bde4-d01b4bedd044
to: "0xc9e6945E0fAfa7DfaCf3bF8564849F7984879c62"
value: 1.5
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
asset_id | string | true | none | Asset id to claim |
to | string | true | none | Address to claim token |
value | number | true | none | Value to claim |
route.ClientBurnNFTRequest
amount: string
asset_id: string
from: string
token_id: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
amount | string | false | none | Amount to burn, if asset is ERC721, amount is ignored |
asset_id | string | true | none | Asset id to burn |
from | string | true | none | Address to burn token |
token_id | string | true | none | Token id to burn |
route.ClientMintAssetRequest
asset_id: 0dbd5e71-c553-499d-bde4-d01b4bedd044
to: "0xc9e6945E0fAfa7DfaCf3bF8564849F7984879c62"
value: 1.5
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
asset_id | string | true | none | Asset id to mint |
to | string | true | none | Address that mint token to |
value | number | true | none | Value to mint |
route.ClientMintNFTRequest
amount: string
asset_id: string
to: string
token_id: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
amount | string | false | none | Amount to mint, if asset is ERC721, amount is ignored |
asset_id | string | true | none | Asset id to mint |
to | string | true | none | Address that receives token |
token_id | string | true | none | Token id to mint |
route.ClientSendTransactionRequest
data:
- 0
from: string
gas_limit: 0
gas_price: 0
to: string
value: 0
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
data | [integer] | false | none | Data to send |
from | string | false | none | Sender address |
gas_limit | integer | false | none | Gas limit |
gas_price | integer | false | none | Gas price, in unit gwei |
to | string | false | none | Receiver address |
value | number | false | none | TT to send, in unit TT |
route.ClientSignMessageRequest
from: string
message: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
from | string | false | none | Signer address |
message | string | false | none | Message to sign |
route.ClientSignMessageResponse
signed: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
signed | string | false | none | Signed message |
route.ClientTransferAssetRequest
asset_id: 0dbd5e71-c553-499d-bde4-d01b4bedd044
from: "0xc9e6945E0fAfa7DfaCf3bF8564849F7984879c62"
symbol: TT
to: "0x1ac24c858Cd7432364587b251098A2dc297Ec47c"
value: 1.5
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
asset_id | string | false | none | Asset id to transfer |
from | string | true | none | Address to transfer token from |
symbol | string | false | none | Asset symbol to transfer, one of AssetID or Symbol is required |
to | string | true | none | Address to transfer token to |
value | number | true | none | Value to transfer |
route.ClientTransferNFTRequest
amount: string
asset_id: string
from: string
to: string
token_id: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
amount | string | false | none | Amount to transfer, if asset is ERC721, amount is ignored |
asset_id | string | true | none | Asset id to transfer |
from | string | true | none | Address that sends token |
to | string | true | none | Address that receives token |
token_id | string | true | none | Token id to transfer |
route.CreateNFTRedeemAsset
asset_id: string
balance:
- amount: 0
token_id: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
asset_id | string | true | none | Asset id to deposit |
balance | [route.CreateNFTRedeemAssetBalance] | true | none | Balance of each token id |
route.CreateNFTRedeemAssetBalance
amount: 0
token_id: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
amount | integer | false | none | Amount to redeem, if asset is ERC721, amount is ignored |
token_id | string | true | none | Token id to redeem |
route.CreateNFTRedeemRequest
from: string
redeem_assets:
- asset_id: string
balance:
- amount: 0
token_id: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
from | string | true | none | Address to create redeem |
redeem_assets | [route.CreateNFTRedeemAsset] | true | none | List of deposit assets |
route.CreateRedeemAsset
asset_id: string
value: 0
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
asset_id | string | true | none | Asset id to deposit |
value | number | true | none | Value to deposit |
route.CreateRedeemRequest
from: string
redeem_assets:
- asset_id: string
value: 0
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
from | string | true | none | Address to create redeem |
redeem_assets | [route.CreateRedeemAsset] | true | none | List of deposit assets |
route.CreateUserResponse
address: "0x1ac24c858Cd7432364587b251098A2dc297Ec47c"
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
address | string | false | none | Created user address |
route.GetRedeemNFTResponse
address: string
balance:
- amount: 0
token_id: string
name: string
symbol: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
address | string | false | none | Address of the NFT |
balance | [route.NFTBalance] | false | none | Deposited NFT balance |
name | string | false | none | Name of the NFT |
symbol | string | false | none | Symbol of the NFT |
route.GetRedeemResponse
address: string
name: string
symbol: string
value: 0
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
address | string | false | none | Address of the token |
name | string | false | none | Name of the token |
symbol | string | false | none | Symbol of the token |
value | number | false | none | Deposited value |
route.JSONError
code: 8192
message: resource not found
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
code | integer | false | none | none |
message | string | false | none | none |
route.JSONID
id: 27e845ef-4c56-4570-9103-daf49b2e7706
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | string | true | none | Task id that async API created |
route.NFTBalance
amount: 0
token_id: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
amount | integer | false | none | Amount, if ERC721, amount should be 1 |
token_id | string | false | none | Token id in string type |
route.RedeemStatusResponse
redeem_code: 4170b967-7db9-43aa-a409-dec9315d8d80
status: 3
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
redeem_code | string | false | none | redeem code when ready |
status | integer | false | none | RedeemStatusPending = 0, RedeemStatusFailed = 1, RedeemStatusOK = 2, RedeemStatusLocked = 3, RedeemStatusRedeemed = 4, RedeemStatusRedeemFailed = 5, RedeemStatusFailedInsufficientFunds = 6 |
route.SupportedToken
address: string
decimals: 0
symbol: string
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
address | string | false | none | none |
decimals | integer | false | none | none |
symbol | string | false | none | none |
route.TaskStatus
failed_reason: 2
id_created: ""
status: 1
TaskStatus for async API calls, status should one of (TaskDone=0, TaskFailed=1, TaskPending=2, TaskProcessing=3). And failed_reason should be one of (FailedReasonNone=0,FailedReasonInsufficientFunds=1, FailedReasonRevert=2,FailedReasonUnknown=3,FailedReasonTxDropped=4) if status is TaskFailed.
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
failed_reason | integer | false | none | Failed reason if status is TaskFailed |
id_created | string | false | none | ID created if there are some resources to create |
status | integer | false | none | Current status of the submitted task |
route.UserAssetResponse
balance: 1.5
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
balance | number | false | none | User asset balance |
route.UserNFTResponse
amount: 10
token_id: 15
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
amount | integer | false | none | Amount, if ERC721, amount should be 1 |
token_id | integer | false | none | Token id in string type |