Transaction speed
rrelayer will bump gas prices higher on transactions which have not been mined yet based on the gas_bump_blocks_every
.
This will allow you to config how often rrelayer will try to increase and resubmit the transactions this allows you to
do crazy aggressive relaying or less aggressive relaying.
- slow =
TransactionSpeed::SLOW
- medium =
TransactionSpeed::MEDIUM
- fast =
TransactionSpeed::FAST
- superfast =
TransactionSpeed::SUPER
This lives under networks, so you can have different configurations based on the networks:
name: base
signing_provider:
raw:
mnemonic: ${RAW_DANGEROUS_MNEMONIC}
networks:
- name: sepolia_ethereum
chain_id: 11155111
provider_urls:
- https://sepolia.gateway.tenderly.co
block_explorer_url: https://sepolia.etherscan.io
enable_sending_blobs: true
gas_bump_blocks_every:
slow: 10
medium: 6
fast: 4
super_fast: 2
api_config:
port: 8000
authentication_username: ${RRELAYER_AUTH_USERNAME}
authentication_password: ${RRELAYER_AUTH_PASSWORD}
Code examples:
node
// config.ts
import { createClient, TransactionSpeed } from 'rrelayer';
import * as dotenv from "dotenv";
dotenv.config();
const client = createClient({
serverUrl: 'http://localhost:8000',
auth: {
username: process.env.RRELAYER_AUTH_USERNAME!,
password: process.env.RRELAYER_AUTH_PASSWORD!,
},
});
export const relayerClient = await client.getRelayerClient(
// The relayer id you want to connect to
'94afb207-bb47-4392-9229-ba87e4d783cb',
);
...
// send-eth-transaction.ts
import { relayerClient } from './config';
import { TransactionToSend, parseEther } from 'rrelayer';
const txRequest: TransactionToSend = {
to: '0x5FCD072a0BD58B6fa413031582E450FE724dba6D',
value: parseEther('0.0001'),
speed: TransactionSpeed.FAST
};
// Will send this transaction as fast and bump based on the gas_bump_blocks_every
let response = await relayerClient.transaction.send(txRequest);
...