The "Sign And Submit Gasless Txn Using (kms wallet)" API endpoint allows users to sign and submit a gasless transaction using a Key Management Service (KMS) wallet in a local development environment.
Sign And Submit Gasless Txn
Sign And Submit Gasless Txn under the given instance.
200: OK SUCCESS 401: Unauthorized Failure in authentication
Copy {
"Status": "SUCCESS",
"Message": "Transaction Complete",
"Data": {
"message": "Tx submitted to network successfully",
"txHash": "0x50c7f0b20a758de6759cfadd895d268886043dd52ecaac1ca98axxxxxxxxxxx"
}
}
Copy {
"message": "Invalid API key in request"
}
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 --location 'http://localhost:8888/wallet/signAndSubmitGaslessTxn' \
--header 'Authorization: 03374415-xxxx-xxxx-xxxx-1277d243034e' \
--header 'Content-Type: application/json' \
--data '{
"walletId": "42d0a078-2a9f-45eb-988e-c35d62xxxxxx",
"dAppId": "DEV_DEMO_PACE_46_xxxxxxxx",
"chainId": 80001,
"to": "0x362149525adee7A0B20212D76Fad073Cxxxxxxxxx",
"contractAbi": "Base64 of abi",
"method": "transfer",
"params": []
}'
Copy var myHeaders = new Headers();
myHeaders.append("Authorization", "03374415-xxxx-xxxx-xxxx-1277d243034e");
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"walletId": "42d0a078-2a9f-45eb-988e-c35d62xxxxxx",
"dAppId": "DEV_DEMO_PACE_46_xxxxxxxx",
"chainId": 80001,
"to": "0x362149525adee7A0B20212D76Fad073Cxxxxxxxxx",
"contractAbi": "Base64 of abi",
"method": "transfer",
"params": []
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("http://localhost:8888/wallet/signAndSubmitGaslessTxn", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Copy import requests
import json
url = "http://localhost:8888/wallet/signAndSubmitGaslessTxn"
payload = json.dumps({
"walletId": "42d0a078-2a9f-45eb-988e-c35d62xxxxxx",
"dAppId": "DEV_DEMO_PACE_46_xxxxxxxx",
"chainId": 80001,
"to": "0x362149525adee7A0B20212D76Fad073Cxxxxxxxxx",
"contractAbi": "Base64 of abi",
"method": "transfer",
"params": []
})
headers = {
'Authorization': '03374415-xxxx-xxxx-xxxx-1277d243034e',
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Copy package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://localhost:8888/wallet/signAndSubmitGaslessTxn"
method := "POST"
payload := strings.NewReader(`{`+"
"+`
"walletId": "42d0a078-2a9f-45eb-988e-c35d62xxxxxx",`+"
"+`
"dAppId": "DEV_DEMO_PACE_46_xxxxxxxx",`+"
"+`
"chainId": 80001,`+"
"+`
"to": "0x362149525adee7A0B20212D76Fad073Cxxxxxxxxx",`+"
"+`
"contractAbi": "Base64 of abi",`+"
"+`
"method": "transfer",`+"
"+`
"params": []`+"
"+`
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "03374415-xxxx-xxxx-xxxx-1277d243034e")
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))
}