This creates a wallet using this method.
Creates a new wallet under the given instance.
{
"Status": "SUCCESS",
"Message": "wallet created successfully",
"Data": {
"WalletId": "20775f3e-8be1-4e4c-8c80-xxxxxxxxxxx",
"Address": "0x688c17c7FF9Def682b04699C31Dxxxxxxxxxxxxx"
}
}
{
"Status": "FAILURE",
"Message": "key exist with specified name",
"Data": null
}
Take a look at how you might call this method using our official libraries, or via curl
:
curl -X POST http://localhost:8889/wallet/createWallet \
-H "Content-Type: application/json" \
-d '{
"name": "wallet2",
"algorithm": "secp256k1"
}'
var axios = require('axios');
var data = JSON.stringify({
"name": "sep",
"algorithm": "secp256k1"
});
var config = {
method: 'post',
url: 'http://localhost:8889/wallet/createWallet',
headers: {
'Content-Type': 'application/json'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
import requests
import json
url = "http://localhost:8889/wallet/createWallet"
payload = json.dumps({
"name": "sep",
"algorithm": "secp256k1"
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://localhost:8889/wallet/createWallet"
method := "POST"
payload := strings.NewReader(`{
"name": "sep",
"algorithm": "secp256k1"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}