Skip to content

Commit cf793e9

Browse files
committed
docs: another pass over on it
1 parent a285e17 commit cf793e9

File tree

18 files changed

+885
-163
lines changed

18 files changed

+885
-163
lines changed

crates/sdk/README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,17 @@ Using the basic authentication which uses the username and password in your [api
6464
```rs [Basic Auth - config.rs]
6565
use std::str::FromStr;
6666
use rrelayer::{CreateClientAuth, CreateClientConfig, RelayerId, TransactionSpeed, create_client, AdminRelayerClient};
67+
use dotenvy::dotenv;
68+
use std::env;
6769

6870
// Client also exposes some admin methods in which API keys cannot do
6971
let client = create_client(CreateClientConfig {
7072
server_url: "http://localhost:8000".to_string(),
7173
auth: CreateClientAuth {
72-
username: "your_username".to_string(),
73-
password: "your_password".to_string(),
74+
username: env::var("RRELAYER_AUTH_USERNAME")
75+
.expect("RRELAYER_AUTH_USERNAME must be set"),
76+
password: env::var("RRELAYER_AUTH_PASSWORD")
77+
.expect("RRELAYER_AUTH_PASSWORD must be set"),
7478
},
7579
});
7680

documentation/rrelayer/docs/pages/config/networks/transaction-speed.mdx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,14 @@ Code examples:
4141
```ts [node]
4242
// config.ts
4343
import { createClient, TransactionSpeed } from 'rrelayer';
44+
import * as dotenv from "dotenv";
45+
dotenv.config();
4446

4547
const client = createClient({
4648
serverUrl: 'http://localhost:8000',
4749
auth: {
48-
username: 'your_username',
49-
password: 'your_password',
50+
username: process.env.RRELAYER_AUTH_USERNAME!,
51+
password: process.env.RRELAYER_AUTH_PASSWORD!,
5052
},
5153
});
5254

@@ -72,21 +74,31 @@ let response = await relayerClient.transaction.send(txRequest); // [!code focus]
7274
...
7375
```
7476

75-
```rs [rust]
77+
```rust [rust]
7678
use anyhow::Result;
7779
use rrelayer::{
7880
AdminRelayerClient, CreateClientAuth, CreateClientConfig, EvmAddress, RelayTransactionRequest,
7981
RelayerId, SendTransactionResult, TransactionData, TransactionSpeed, TransactionValue,
8082
create_client,
8183
};
8284
use std::str::FromStr;
85+
use dotenvy::dotenv;
86+
use std::env;
8387

8488
async fn get_relayer_client() -> Result<AdminRelayerClient> {
89+
dotenv().ok();
90+
91+
let username = env::var("RRELAYER_AUTH_USERNAME")
92+
.expect("RRELAYER_AUTH_USERNAME must be set");
93+
94+
let password = env::var("RRELAYER_AUTH_PASSWORD")
95+
.expect("RRELAYER_AUTH_PASSWORD must be set");
96+
8597
let client = create_client(CreateClientConfig {
8698
server_url: "http://localhost:8000".to_string(),
8799
auth: CreateClientAuth {
88-
username: "your_username".to_string(),
89-
password: "your_password".to_string(),
100+
username,
101+
password,
90102
},
91103
});
92104

0 commit comments

Comments
 (0)