Create / Fetch provider level sponsor account
The Create / Fetch provider level sponsor account API retrieves the public key of the sponsor account. It verifies the existence of the sponsor account and returns the corresponding public key. If the account is not found, the API creates a new account, generates a key pair, and returns the public key.
Method: POST
{{URL}}/jsonrpc
Headers
Name | Value |
---|---|
Content-Type | application/json |
Example
- cURL
- C#
- NodeJs
curl --location '{{url}}/rpc/WalletService/GetSponsorAccount' \
--header 'DiviceID: 8020' \
--header 'Signature: keyId=8020,algorithm=ecdsa-sha256,signature=MEUCIQCNi1vjPf/HpI9R2DXnc0Zt1s6YmWyA4H1x813lJ+tuDgIgB+lrc+iCMyTUGiraG9kGKNDXYiz7RfBBtifr5wUQs54=' \
--header 'Content-Type: application/json' \
--header 'Authorization: Basic e3tFbWFpbH19Ont7UGFzc3dvcmR9fQ==' \
--data '{
}'
var options = new RestClientOptions("{{url}}")
{
MaxTimeout = -1,
};
var client = new RestClient(options);
var request = new RestRequest("/fednowbackend/rpc/WalletService/GetSponsorAccount", Method.Post);
request.AddHeader("DiviceID", "8020");
request.AddHeader("Signature", "keyId=8020,algorithm=ecdsa-sha256,signature=MEUCIQCNi1vjPf/HpI9R2DXnc0Zt1s6YmWyA4H1x813lJ+tuDgIgB+lrc+iCMyTUGiraG9kGKNDXYiz7RfBBtifr5wUQs54=");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Basic e3tFbWFpbH19Ont7UGFzc3dvcmR9fQ==");
var body = @"{" + "\n" +
@"}";
request.AddStringBody(body, DataFormat.Json);
RestResponse response = await client.ExecuteAsync(request);
Console.WriteLine(response.Content);
```go
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "{{url}}/rpc/WalletService/GetSponsorAccount"
method := "POST"
payload := strings.NewReader(`{
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("DiviceID", "8020")
req.Header.Add("Signature", "keyId=8020,algorithm=ecdsa-sha256,signature=MEUCIQCNi1vjPf/HpI9R2DXnc0Zt1s6YmWyA4H1x813lJ+tuDgIgB+lrc+iCMyTUGiraG9kGKNDXYiz7RfBBtifr5wUQs54=")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Basic e3tFbWFpbH19Ont7UGFzc3dvcmR9fQ==")
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))
}
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': '{{url}}',
'path': '/fednowbackend/rpc/WalletService/GetSponsorAccount',
'headers': {
'DiviceID': '8020',
'Signature': 'keyId=8020,algorithm=ecdsa-sha256,signature=MEUCIQCNi1vjPf/HpI9R2DXnc0Zt1s6YmWyA4H1x813lJ+tuDgIgB+lrc+iCMyTUGiraG9kGKNDXYiz7RfBBtifr5wUQs54=',
'Content-Type': 'application/json',
'Authorization': 'Basic e3tFbWFpbH19Ont7UGFzc3dvcmR9fQ=='
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = JSON.stringify({});
req.write(postData);
req.end();
Body
{
"payload": {}
}
Response: 200
Response Parameters
Parameter | Description |
---|---|
ID | String Unique identifier for the entry Ex: "980001" |
Publickey | String Refers to the public key associated with the sponsor account Ex: "GBGOICHSUITWIOUYBR2WBQ6WUHIDVRGMZAT2THI5U7Y5JGE4EQFJKC32" |
currency | String Indicates the currency or digital asset associated with the wallet or account Ex: "XLM" |
{
"ID": "980001",
"Publickey": "GBGOICHSUITWIOUYBR2WBQ6WUHIDVRGMZAT2THI5U7Y5JGE4EQFJKC32",
"currency": "XLM"
}