const endpoint = "https://casper.nownodes.io/rpc";
const apiKey = "YOUR_API_KEY";
async function nownodesRequest(payload) {
const response = await fetch(endpoint, {
method: "POST",
headers: {
"Content-Type": "application/json",
"api-key": apiKey,
},
body: JSON.stringify(payload),
});
return response.json();
}
const result = await nownodesRequest({ jsonrpc: "2.0", method: "speculative_exec_txn", params: {
"transaction": {
"Version1": {
"header": {
"chain_name": "casper",
"timestamp": "2025-12-10T12:00:00.000Z",
"ttl": "1h",
"body_hash": "PLACEHOLDER_BODY_HASH",
"pricing_mode": {
"Fixed": {
"gas_price_tolerance": 1
}
}
},
"payload": {
"fields": {
"initiator_addr": {
"PublicKey": "01abcdef...123456"
},
"args": [
[
{}
]
],
"target": "Native",
"entry_point": "Transfer",
"transaction_category": 0,
"scheduling": "Standard"
}
},
"approvals": [
{
"signer": "string",
"signature": "string"
}
]
}
}
}, id: 1 });
console.log(result);