Quicknode integration
You can easily use GasHawk on your Quicknode endpoint by activating the module on the Quicknode Marketplace.
JSON RPC methods
When active for your endpoint, additional RPC methods are provided. The following methods can be used:
gh_sendRawTransaction
Creates new message call transaction or a contract creation for signed transactions. The transaction will be enqueued to the from
account's GasHawk queue and broadcasted when the GasHawk algorithm detects a suitable moment within the deadline (default: 24 h, configurable through the untilDate
parameter. You can also modify the default deadline in the GasHawk dashboard -> Settings).
Parameters
DATA
, The signed transaction data.CONFIG?
, Additional configuration for this particular transaction (stringified JSON, double-quoted property names, escaped, all keys are optional) (optional)
CONFIG: {
untilDate?: Date
};
params: [
"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675",
"{\"untilDate\":\"2023-10-11T21:35:15.393Z\"}",
];
Returns
DATA
, 32 Bytes - the transaction hash.
Example
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"gh_sendRawTransaction","params":[{see above}],"id":67}'
// Result
{
"id":67,
"jsonrpc": "2.0",
"result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}
gh_getTransactionStatusByHash
Responds with the internal status and the deadline of the provided transaction hash.
Parameters
DATA
, 32 Bytes - hash of a transaction
params: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"];
Returns
Object
- A transaction status object:
state
:STRING
, one ofPending
,Submitted
,Mined
,Finalized
,Failed
.untilDate
:DATE_STRING
- ISO-string of the deadline timestamp (UTC).
Example
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"gh_getTransactionStatusByHash","params":["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"],"id":67}'
// Result
{
"id":67,
"jsonrpc": "2.0",
"result": {
"state": "Pending",
"untilDate": "2023-09-30T10:27:46.666Z"
}
}
gh_deleteTransaction
Removes a transaction from the GasHawk queue.
Parameters
DATA
, 32 Bytes - hash of a transaction
params: ["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"];
Returns
Object
- A transaction status object:
status
:STRING
, "success".
Example
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"gh_deleteTransaction","params":["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"],"id":67}'
// Result
{
"id":67,
"jsonrpc": "2.0",
"result": {
"status": "success"
}
}
gh_getNextValidNonce
Responds with the next valid nonce that can be used in a new transaction, aware of the existing transactions in the GasHawk queue of the address (similar to eth_getTransactionCount
).
Parameters
DATA
, 20 Bytes - address.
params: ["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"];
Returns
QUANTITY
- integer of the number of transactions sent from this address, including pending transactions in the GasHawk queue.
Example
// Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"],"id":1}'
// Result
{
"id":1,
"jsonrpc": "2.0",
"result": "0xa7" // 167
}
RPC errors
Whenever an RPC method could not be successfully called, expect the response to be in the form:
{
"id":1,
"jsonrpc": "2.0",
"error": {
code: <ERROR_CODE>
message: <ERROR_MESSAGE>
data?: <ERROR_DETAILS>
}
}
Note:
ERROR_DETAILS
is not always present.- The HTTP status code is one of
400
,404
or500
- depending on the kind of error.
Table of possible errors
ERROR_CODE | ERROR_MESSAGE | Identifier |
-32700 | Parse error | PARSE_ERROR |
-32600 | Invalid request | INVALID_REQUEST |
-32601 | Method not found | METHOD_NOT_FOUND |
-32602 | Invalid params | INVALID_PARAMS |
-32603 | Internal error | INTERNAL_ERROR |
-32001 | Insufficient header information (quicknode_id / endpoint_id) | INSUFFICIENT_HEADERS |
-32002 | Could not find quicknode account | QUICKNODE_ID_NOT_REGISTERED |
-32003 | Could not find quicknode endpoint | ENDPOINT_ID_NOT_REGISTERED |
-32004 | Could not find http_url of endpoint | NO_ENDPOINT_HTTP_URL |
-32004 | Could not execute method | ERROR_EXECUTING_METHOD |
-32005 | Transaction is already broadcasted | TX_ALREADY_BROADCASTED |
-32006 | Transaction not found | TX_NOT_FOUND |