This Submit Transaction using this method.
Submit Transaction under the given instance.
{
"Status": "SUCCESS",
"Message": "Signed and executed txn successfully",
"Data": {
"txHash": "0x6b9771a48a5536e891cc50f3b830911d7902f430412dc48fad2b3c72515f99bd"
}
}
{
"Status": "FAILURE",
"Message": "error sending txn to contract : no contract code at given address",
"Data": null
}
{
"Status": "FAILURE",
"Message": "Key not found",
"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/submitTransaction \
-H "Content-Type: application/json" \
-H "ChainId: xxxx" \
-d '{
"walletId": "effae2b6-3ee3-xxxxxxxxxxxxxxxxxx",
"to": "0xc2de797fab7d2d2bxxxxxxxxxxxxxxxxxxxxx",
"chainId": "xxxx",
"method": "store",
"params": [
{
"type": "uint256",
"value": "35"
}
],
"isContractTxn": true,
"contractABI": "[]"
}'
const axios = require('axios');
const apiUrl = 'http://localhost:8889/wallet/submitTransaction';
const headers = {
'Content-Type': 'application/json',
'ChainId': 'xxxx',
};
const requestData = {
walletId: 'effae2b6-3ee3-xxxxxxxxxxxxxxxxxx',
to: '0xc2de797fab7d2d2bxxxxxxxxxxxxxxxxxxxxx',
chainId: "xxxx",
method: 'store',
params: [
{
type: 'uint256',
value: '35',
},
],
isContractTxn: true,
contractABI: '[]',
};
axios.post(apiUrl, requestData, { headers })
.then((response) => {
console.log('Response:', response.data);
})
.catch((error) => {
console.error('Error:', error);
});
import requests
import json
url = 'http://localhost:8889/wallet/submitTransaction'
headers = {
'Content-Type': 'application/json',
'ChainId': 'xxxx',
}
data = {
"walletId": "effae2b6-3ee3-xxxxxxxxxxxxxxxxxx",
"to": "0xc2de797fab7d2d2bxxxxxxxxxxxxxxxxxxxxx",
"chainId": "xxxx",
"method": "store",
"params": [
{
"type": "uint256",
"value": "35"
}
],
"isContractTxn": True,
"contractABI": "[]"
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(f"Response: {response.json()}")
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "http://localhost:8889/wallet/submitTransaction"
method := "GET"
payload := strings.NewReader(`{
"walletId": "effae2b6-3ee3-xxxxxxxxxxxxxxxxxx",
"to": "0xc2de797fab7d2d2bxxxxxxxxxxxxxxxxxxxxx",
"chainId": "xxxx",
"method": "store",
"params": [
{
"type": "uint256",
"value": "35"
}
],
"isContractTxn": true,
"contractABI": "[]"
}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("ChainId", "xxxxxx")
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))
}