Skip to content

Commit 0881892

Browse files
committed
docs: fix some bad docs
1 parent 08b7559 commit 0881892

File tree

10 files changed

+217
-186
lines changed

10 files changed

+217
-186
lines changed

crates/core/src/relayer/types/relayer.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub struct Relayer {
2020
pub address: EvmAddress,
2121

2222
/// The relayer wallet index
23+
#[serde(rename = "walletIndex")]
2324
pub wallet_index: u32,
2425

2526
/// The max gas price

crates/core/src/transaction/api/send_transaction.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@ pub struct RelayTransactionRequest {
3131
pub data: TransactionData,
3232
pub speed: Option<TransactionSpeed>,
3333
/// This allows an app to pass their own custom external id in perfect for webhooks
34+
#[serde(rename = "externalId", skip_serializing_if = "Option::is_none", default)]
3435
pub external_id: Option<String>,
35-
#[serde(default)]
36+
#[serde(skip_serializing_if = "Option::is_none", default)]
3637
pub blobs: Option<Vec<String>>, // will overflow the stack if you use the Blob type directly
3738
}
3839

crates/core/src/transaction/types/transaction.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ pub struct Transaction {
102102

103103
pub is_noop: bool,
104104

105-
#[serde(skip_serializing_if = "Option::is_none", default)]
105+
#[serde(rename = "externalId", skip_serializing_if = "Option::is_none", default)]
106106
pub external_id: Option<String>,
107107

108108
#[serde(rename = "cancelledByTransactionId", skip_serializing_if = "Option::is_none", default)]

documentation/rrelayer/docs/pages/config/webhooks.mdx

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ webhooks:
110110
111111
- **`endpoint`**: The URL where webhook requests will be sent
112112
- **`shared_secret`**: Secret used for webhook authentication and payload verification
113-
- **`networks`**: Array of network names that should trigger this webhook
113+
- **`networks`**: Network filter - can be "*" for all networks, or an array of network names
114114

115115
### Optional Fields
116116

@@ -140,7 +140,6 @@ All transaction webhooks send a JSON payload with this structure:
140140
"txHash": "0xabcdef123456789abcdef123456789abcdef123456789abcdef123456789abcdef",
141141
"queuedAt": "2025-09-26T10:29:30Z",
142142
"sentAt": "2025-09-26T10:30:00Z",
143-
"confirmedAt": null,
144143
"expiresAt": "2025-09-26T11:30:00Z",
145144
"externalId": "order_12345",
146145
"nonce": 42,
@@ -325,36 +324,25 @@ Balance checks run every 10 minutes and both log warnings and send webhooks when
325324

326325
## Webhook Authentication
327326

328-
All webhook requests include authentication headers for security:
329-
330-
### Headers Sent
327+
Webhook authentication is configured through the `shared_secret` field in your webhook configuration. This secret is used for webhook authentication and payload verification.
331328

332-
- **`X-rrelayer-Signature`**: HMAC-SHA256 signature of the request body using your shared secret
333-
- **`X-rrelayer-Event-Type`**: The event type that triggered the webhook
334-
- **`X-rrelayer-Timestamp`**: Unix timestamp when the webhook was sent
335-
- **`Content-Type`**: `application/json`
329+
### Security Configuration
336330

337-
### Verifying Webhooks
331+
Each webhook endpoint requires a shared secret for authentication:
338332

339-
To verify webhook authenticity, compute the HMAC-SHA256 signature of the request body using your shared secret and compare it with the `X-rrelayer-Signature` header.
333+
```yaml
334+
webhooks:
335+
- endpoint: "https://api.yourapp.com/webhooks/rrelayer"
336+
shared_secret: "${WEBHOOK_SECRET}" # Strong secret for authentication
337+
networks: "*"
338+
```
340339

341-
Example verification in Node.js:
340+
### Best Practices
342341

343-
```javascript
344-
const crypto = require('crypto');
345-
346-
function verifyWebhook(body, signature, secret) {
347-
const expectedSignature = crypto
348-
.createHmac('sha256', secret)
349-
.update(body, 'utf8')
350-
.digest('hex');
351-
352-
return crypto.timingSafeEqual(
353-
Buffer.from(signature, 'hex'),
354-
Buffer.from(expectedSignature, 'hex')
355-
);
356-
}
357-
```
342+
1. **Use strong secrets** - Generate cryptographically secure random strings
343+
2. **Keep secrets secure** - Store in environment variables, not in configuration files
344+
3. **Rotate secrets regularly** - Update webhook secrets periodically
345+
4. **Use HTTPS endpoints** - Always use encrypted connections for webhook delivery
358346

359347
## Delivery and Retry Logic
360348

documentation/rrelayer/docs/pages/integration/api/allowlist.mdx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,11 @@ GET /api/relayers/{relayer_id}/allowlists
2828
### Response
2929

3030
```json
31-
{
32-
"relayer_id": "0x742d35cc6466c4b0de3e3e8c7b8e8f9e8a8d8c8b",
33-
"addresses": [
34-
"0x1234567890abcdef1234567890abcdef12345678",
35-
"0x9876543210fedcba9876543210fedcba98765432",
36-
"0xabcdef1234567890abcdef1234567890abcdef12"
37-
],
38-
"total": 3,
39-
"updated_at": "2025-09-26T10:30:00Z"
40-
}
31+
[
32+
"0x1234567890abcdef1234567890abcdef12345678",
33+
"0x9876543210fedcba9876543210fedcba98765432",
34+
"0xabcdef1234567890abcdef1234567890abcdef12"
35+
]
4136
```
4237

4338
### Example

documentation/rrelayer/docs/pages/integration/api/authentication.mdx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,30 @@ curl https://your-rrelayer.com/api/auth/status \
114114

115115
Will throw a 401 http error if none or valid.
116116

117+
## Health Check
118+
119+
Check if the API server is running.
120+
121+
### Endpoint
122+
123+
```
124+
GET /health
125+
```
126+
127+
### Response
128+
129+
```json
130+
"healthy"
131+
```
132+
133+
### Example
134+
135+
```bash
136+
curl https://your-rrelayer.com/health
137+
```
138+
139+
This endpoint does not require authentication and returns a simple "healthy" string when the server is operational.
140+
117141
## Rate Limiting Headers
118142

119143
When using rate limiting, include the rate limit key header:

documentation/rrelayer/docs/pages/integration/api/networks.mdx

Lines changed: 74 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -18,44 +18,55 @@ GET /api/networks
1818

1919
### Response
2020

21+
```json
22+
[
23+
{
24+
"name": "ethereum_mainnet",
25+
"chainId": 1,
26+
"providerUrls": [
27+
"https://eth.gateway.tenderly.co",
28+
"https://eth-mainnet.g.alchemy.com/v2/..."
29+
]
30+
},
31+
{
32+
"name": "sepolia_ethereum",
33+
"chainId": 11155111,
34+
"providerUrls": ["https://sepolia.gateway.tenderly.co"]
35+
}
36+
]
37+
```
38+
39+
### Example
40+
41+
```bash
42+
curl https://your-rrelayer.com/api/networks \
43+
-u "username:password"
44+
```
45+
46+
## Get Network
47+
48+
Get details for a specific network.
49+
50+
### Endpoint
51+
52+
```
53+
GET /api/networks/{chain_id}
54+
```
55+
56+
### Response
57+
2158
```json
2259
{
23-
"networks": [
24-
{
25-
"chain_id": 1,
26-
"name": "ethereum_mainnet",
27-
"display_name": "Ethereum Mainnet",
28-
"rpc_urls": [
29-
"https://eth.gateway.tenderly.co",
30-
"https://eth-mainnet.g.alchemy.com/v2/..."
31-
],
32-
"block_explorer_url": "https://etherscan.io",
33-
"native_currency": {
34-
"name": "Ether",
35-
"symbol": "ETH",
36-
"decimals": 18
37-
}
38-
},
39-
{
40-
"chain_id": 11155111,
41-
"name": "sepolia_ethereum",
42-
"display_name": "Sepolia Testnet",
43-
"rpc_urls": ["https://sepolia.gateway.tenderly.co"],
44-
"block_explorer_url": "https://sepolia.etherscan.io",
45-
"native_currency": {
46-
"name": "Sepolia Ether",
47-
"symbol": "ETH",
48-
"decimals": 18
49-
}
50-
}
51-
]
60+
"name": "sepolia_ethereum",
61+
"chainId": 11155111,
62+
"providerUrls": ["https://sepolia.gateway.tenderly.co"]
5263
}
5364
```
5465

5566
### Example
5667

5768
```bash
58-
curl https://your-rrelayer.com/api/networks \
69+
curl https://your-rrelayer.com/api/networks/11155111 \
5970
-u "username:password"
6071
```
6172

@@ -73,47 +84,41 @@ GET /api/networks/gas/price/{chain_id}
7384

7485
```json
7586
{
76-
"chain_id": 11155111,
77-
"gas_prices": {
78-
"slow": {
79-
"max_priority_fee": "0.1",
80-
"max_fee": "2.5",
81-
"min_wait_time_estimate": 180,
82-
"max_wait_time_estimate": 300
83-
},
84-
"medium": {
85-
"max_priority_fee": "0.5",
86-
"max_fee": "4.0",
87-
"min_wait_time_estimate": 60,
88-
"max_wait_time_estimate": 120
89-
},
90-
"fast": {
91-
"max_priority_fee": "1.0",
92-
"max_fee": "6.0",
93-
"min_wait_time_estimate": 15,
94-
"max_wait_time_estimate": 60
95-
},
96-
"super_fast": {
97-
"max_priority_fee": "2.0",
98-
"max_fee": "10.0",
99-
"min_wait_time_estimate": 5,
100-
"max_wait_time_estimate": 15
101-
}
87+
"slow": {
88+
"maxPriorityFee": "0.1",
89+
"maxFee": "2.5",
90+
"minWaitTimeEstimate": 180,
91+
"maxWaitTimeEstimate": 300
92+
},
93+
"medium": {
94+
"maxPriorityFee": "0.5",
95+
"maxFee": "4.0",
96+
"minWaitTimeEstimate": 60,
97+
"maxWaitTimeEstimate": 120
10298
},
103-
"base_fee": "1.2",
104-
"timestamp": "2025-09-26T10:30:00Z",
105-
"provider": "TENDERLY"
99+
"fast": {
100+
"maxPriorityFee": "1.0",
101+
"maxFee": "6.0",
102+
"minWaitTimeEstimate": 15,
103+
"maxWaitTimeEstimate": 60
104+
},
105+
"super_fast": {
106+
"maxPriorityFee": "2.0",
107+
"maxFee": "10.0",
108+
"minWaitTimeEstimate": 5,
109+
"maxWaitTimeEstimate": 15
110+
}
106111
}
107112
```
108113

109114
### Gas Price Fields
110115

111116
| Field | Type | Description |
112117
| ------------------------ | -------- | ---------------------------- |
113-
| `max_priority_fee` | `string` | Priority fee in Gwei |
114-
| `max_fee` | `string` | Maximum fee in Gwei |
115-
| `min_wait_time_estimate` | `number` | Minimum wait time in seconds |
116-
| `max_wait_time_estimate` | `number` | Maximum wait time in seconds |
118+
| `maxPriorityFee` | `string` | Priority fee in Gwei |
119+
| `maxFee` | `string` | Maximum fee in Gwei |
120+
| `minWaitTimeEstimate` | `number` | Minimum wait time in seconds |
121+
| `maxWaitTimeEstimate` | `number` | Maximum wait time in seconds |
117122

118123
### Example
119124

@@ -145,20 +150,14 @@ curl https://your-rrelayer.com/api/networks/gas/price/11155111 \
145150

146151
## Gas Price Providers
147152

148-
rrelayer supports multiple gas price providers:
149-
150-
### Supported Providers
151-
152-
| Provider | Description |
153-
| ---------- | ----------------------- |
154-
| `TENDERLY` | Tenderly Gas Station |
155-
| `INFURA` | Infura Gas API |
156-
| `CUSTOM` | Custom gas provider |
157-
| `FALLBACK` | Fallback gas estimation |
153+
rrelayer supports multiple gas price providers configured per network in the rrelayer configuration:
158154

159-
### Provider Selection
155+
- **TENDERLY** - Tenderly Gas Station
156+
- **INFURA** - Infura Gas API
157+
- **CUSTOM** - Custom gas provider
158+
- **FALLBACK** - Fallback gas estimation
160159

161-
Gas price providers are configured per network in the rrelayer configuration. The API will return gas prices from the configured provider for each network.
160+
The API returns gas prices from the configured provider for the requested network.
162161

163162
## Use Cases
164163

0 commit comments

Comments
 (0)