Users
Generating a new token
POST https://www.phoenix.global/sdk/computation/user/genToken
Generate a new token.
Request Body
Name
Type
Description
email*
string
Registered email address of the user
passwd*
string
Password of the registered account
{
"code": 200,
"msg": "success",
"token": "eyJhbGciOiJMUzI1NiIsInP5cCI6IkpXVCJ9.eyJDbWFpbCI6IjExMUBnbWFpbC5jb20iLCJleHAiOjE2NzgyNjYxNjh9.lrJKrtpUokcRXbE1XgZDHk5xuv4k92b4_ppY5rYpgEk"
}The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/user/genToken' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "[email protected]",
"passwd": "xxxxxxxxxxxx"
}'// import sdk package
import (
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/common"
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)
func main() {
reqBody := common.ReqGenToken{
Email: "[email protected]",
Passwd: "xxxxxxxx",
}
result, err := controllers.GenToken(reqBody)
......
}Querying user information
GET https://www.phoenix.global/sdk/computation/user/userInfo
Use the generated token to query wallet address, balance and other information of the user.
Headers
Name
Type
Description
token*
string
The token generated in the previous step
{
"code": 200,
"msg": "success",
"email": "[email protected]",
"address": "0x832b3773C1c0Fff22f5F25f3DeB5849DcbB1F794",
"balancePHB": "1.3",
"balanceCCD": "18.636113"
}The usage of curl and golang sdk is as follows:
curl --location 'https://www.phoenix.global/sdk/computation/user/userInfo' \
--header 'token: xxxxxxxxxxxxxxxxxxxxxxxx'import (
"github.com/PhoenixGlobal/Phoenix-Computation-SDK/controllers"
)
func main() {
token := "xxxxxxxxxxxxxxx"
result, err := controllers.UserInfo(token)
......
}Last updated