Welcome to Wulet’s documentation!¶
Common token¶
Tables¶
Get balance¶
curl --request POST \
--url https://api-wulet.unblocking.io/v1/chain/get_table_rows \
--data '{"code": "TOKEN_ACCOUNT", "scope": "USER_ACCOUNT", "table": "accounts", "json": true}'
- Where:
TOKEN_ACCOUNT
— token accountUSER_ACCOUNT
— user whose balance should be received
You will get response like:
{
"rows": [{
"balance": "100.000000 TEST",
"blocked": 20000000
},{
"balance": "10.0000 FOO",
"blocked": 25000
},{
"balance": "1.00 BAR",
"blocked": 75
}
],
"more": false
}
balance
field contains tokens that user have with symbol and precisionblocked
field contains blocked tokens without symbol and precision
To get available tokens that user can spend, blocked
should be subtracted from balance
. In the example above available user balances are 80.000000 TEST
, 7.5000 FOO
and 0.25 BAR
.
Get token info¶
curl --request POST \
--url https://api-wulet.unblocking.io/v1/chain/get_table_rows \
--data '{"code": "TOKEN_ACCOUNT", "scope": "TOKEN_SYMBOL", "table": "stat", "json": true}'
- Where:
TOKEN_ACCOUNT
— token accountTOKEN_SYMBOL
— symbol for which to get info
You will get response like:
{
"rows": [{
"supply": "30000.00 TEST",
"max_supply": "100000.00 TEST",
"issuer": "testowner",
"info": {
"name": "Symbol for API demonstration",
"url": "https://wulet.readthedocs.io/en/develop/",
"logo_url": "https://www.lenta.com/public/2015/img/icons/lenta_logo.png"
}
}
],
"more": false
}
supply
field contains tokens that are already distributedmax_supply
field contains maximum number of tokens that can be distributedissuer
field contains token owner that can distribute undistributed tokensinfo
field contains token informationname
is a full token nameurl
is a link to the store that distributes this tokenlogo_url
is a link to the token logo
Get tokens list¶
curl --request POST \
--url https://api-wulet.unblocking.io/v1/chain/get_table_rows \
--data '{"code": "TOKEN_ACCOUNT", "scope": "TOKEN_ACCOUNT", "table": "symbols", "json": true}'
- Where:
TOKEN_ACCOUNT
— token account
You will get response like:
{
"rows": [{
"symbol": "6,TEST"
},{
"symbol": "4,FOO"
},{
"symbol": "2,BAR"
}
],
"more": false
}
symbol
field contains token name and its precision
WU token¶
Actions¶
Transfer¶
Transfer tokens from one account to another
{
"code": "TOKEN_ACCOUNT",
"action": "transfer",
"args": {
"from": "FROM_ACC",
"to": "TO_ACC",
"quantity": "100.0000 WU"
}
}
- Where:
code
- account where token code is deployedfrom
- from accountto
- to accountquantity
- how many tokens to transfer
Loyalty token¶
Exchange¶
Tables¶
Pairs¶
To get a list of exchangeable pairs on the exchange, you need to get table:
POST /v1/chain/get_table_rows HTTP/1.0
Host: api-wulet.unblocking.io
{
"code": "exch.account",
"scope": "exch.account",
"table": "pairs",
"lower_bound": "",
"upper_bound": "",
"limit": 10,
"json": true
}
- where:
code
— account of exchange,scope
— should be same as exchange account,table
— name of requested table, should bepairs
,lower_bound
— JSON representation of lower bound value of key, defaults to first,upper_bound
— JSON representation of upper bound value value of key, defaults to last,limit
— the maximum number of rows to return,json
— returns JSON iftrue
and binary iffalse
,
You will get response like:
{
"rows": [
{
"id": 0,
"base_symbol": "4,WU",
"quote_symbol": "4,A"
},
{
"id": 1,
"base_symbol": "4,A",
"quote_symbol": "4,WU"
}
],
"more": false
}
- where:
rows
— an array of pairs exchanged on the exchange,id
— id of pair,base_symbol
— precision and symbol name of base currency,quote_symbol
— precision and symbol name of quote currency.
Markets¶
To get a list of offers on the exchange, filtered by pair, you need to:
POST /v1/chain/get_table_rows HTTP/1.0
Host: api-wulet.unblocking.io
{
"code": "exch.account",
"scope": 123,
"table": "markets",
"index_position": "2",
"key_type": "float64",
"lower_bound": "",
"upper_bound": "",
"limit": 10,
"json": true
}
- where:
code
— account of exchange,scope
— id of exchanged pair from Pairs table,table
— name of requested table, should bemarkets
,index_position
— index number to sort rows:1
to sort by id,2
to sort by price,key_type
— key type of index:i64
for1
index,float64
for2
index,lower_bound
— JSON representation of lower bound value of key, defaults to first,upper_bound
— JSON representation of upper bound value value of key, defaults to last,limit
— the maximum number of rows to return,json
— returns JSON iftrue
and binary iffalse
,
You will get response like:
{
"rows": [
{
"id": 0,
"manager": "buyer1",
"base": "2.0000 WU",
"quote_symbol": "4,A",
"price": "5.00000000000000000"
},
{
"id": 1,
"manager": "buyer1",
"base": "3.0000 WU",
"quote_symbol": "4,A",
"price": "6.33333333333333333"
},
{
"id": 2,
"manager": "buyer1",
"base": "1.0000 WU",
"quote_symbol": "4,A",
"price": "8.00000000000000000"
}
],
"more": false
}
- where:
rows
— an array of trades on the exchange,id
— id of trade,manager
— account name of user who created the trade offer,base
— base currency,quote_symbol
— symbol of quote currency,price
— price of the base currency against the quote,
Actions¶
Add trade¶
To add new trade to exchange you need to push action:
{
"code": "exch.account",
"action": "createx",
"args": {
"creator": "buyeraccount",
"base_deposit": "10.1000 WU",
"quote_deposit": "50.3000 AIR"
}
}
- where:
code
— account of exchange contract,action
— performed action. should becreatex
,creator
— your account,base_deposit
— base currency in special format (as in example),quote_deposit
— quote currency in same format,
Accept specified trade¶
To accept specified trade you need to push action:
{
"code": "exch.account",
"action": "spec.trade",
"args": {
"id": 123,
"seller": "buyeraccount",
"sell_symbol": "4,AIR",
"receive": "10.1000 WU"
}
}
- where:
code
— account of exchange contract,action
— performed action. should bespec.trade
,id
— id of trade,seller
— your account,sell_symbol
— precision and symbol name of quote currency in special format (as in example),receive
— base currency in special format (as in example).
Market order trade¶
To get specified amount of tokens (market order) you need to push action:
{
"code": "exch.account",
"action": "market.trade",
"args": {
"seller": "buyeraccount",
"sell_symbol": "4,AIR",
"receive": "10.1000 WU"
}
}
- where:
code
— account of exchange contract,action
— performed action. should bemarket.trade
,seller
— your account,sell_symbol
— precision and symbol name of quote currency in special format (as in example),receive
— base currency you want to receive in special format (as in example).
Limit order trade¶
To get tokens for specified amount of another tokens (limit order) you need to push action:
{
"code": "exch.account",
"action": "limit.trade",
"args": {
"seller": "buyeraccount",
"sell": "50.3000 AIR",
"receive_symbol": "4,WU"
}
}
- where:
code
— account of exchange contract,action
— performed action. should belimit.trade
,seller
— your account,sell
— quote currency you want to receive in special format (as in example),receive_symbol
— precision and symbol name of base currency in special format (as in example).
Cancel trade¶
To cancel your trade you need to push action:
{
"code": "exch.account",
"action": "cancelx",
"args": {
"id": 123,
"base_symbol": "4,WU",
"quote_symbol": "4,AIR"
}
}
- where:
code
— account of exchange contract,action
— performed action. should becancelx
,id
— id of the canceled trade,base_symbol
— precision and symbol name of base currency in special format (as in example),quote_symbol
— precision and symbol name of quote currency in special format (as in example).
PUSH API¶
Add APNS token device¶
POST /api/v1/user-devices HTTP/1.0
Host: api-wulet.unblocking.io
{
"account": "iostestddg11",
"token": "c6a0cef6e29d7b38040c843d2296b7ecdf3d66f5d1b62e3cffb64a2edadd6d05"
}
- where:
account
- EOS account of user used at Wulet Platform,token
- APNS device token of user.
Delete APNS token device¶
DELETE /api/v1/user-devices/TOKEN?account=ACCOUNT HTTP/1.0
Host: api-wulet.unblocking.io
X-Signature: SIGNATURE
- where:
TOKEN
- EOS account of user used at Wulet Platform,ACCOUNT
- APNS device token of user,SIGNATURE
- APNS device token of user.