This will allow to Sign message.
This will help Sign Message under the given instance.
200: OK Signed message successfully
Copy {
"Status" : "SUCCESS" ,
"Message" : "Signed message successfully" ,
"Data": "0x911deaf5473405b8fe2e8c3f37f90d111655b47b79e7c10dea89104f5efa84b12e1c762e453209d031e5010ca1c26002c1d0faaaf770066ebdb4d126e899c8b701"
}
Take a look at how you might call this method using our official libraries, or via curl
:
curl Node.js (Fetch) Python Golang
Copy curl -X POST http://localhost:8889/wallet/signMessage \
-H "Content-Type: application/json" \
-d '{
"walletId": "xxxxxxxxx",
"message": "Hello"
}'
Copy const axios = require ( 'axios' );
const apiUrl = 'http://localhost:8889/wallet/signMessage' ;
const headers = {
'Content-Type' : 'application/json' ,
};
const requestData = {
walletId : 'xxxxxxxxxxxx' ,
message : 'Hello'
};
axios .post (apiUrl , requestData , { headers })
.then ((response) => {
console .log ( 'Response:' , response .data);
})
.catch ((error) => {
console .error ( 'Error:' , error);
});
Copy import requests
url = 'http://localhost:8889/wallet/signMessage'
headers = {
'Content-Type' : 'application/json' ,
}
data = {
"walletId" : "xxxxxxxxxxxx" ,
"message" : "Hello"
}
try :
response = requests . post (url, json = data, headers = headers)
response . raise_for_status () # Raise an exception for 4xx or 5xx status codes
print ( 'Response:' , response. json ())
except requests . exceptions . RequestException as error :
print ( 'Error:' , error)
Copy package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main () {
url := "http://localhost:8889/wallet/signMessage"
method := "POST"
payload := strings.NewReader( `{
"walletId": "xxxxxxx-xxx-xxx-xxx-xxxxxxx",
"message": "Hello"
}` )
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))
}