-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added ability to specify backup rpc for connecting to the netwo…
…rk (#28) * feat: added ability to specify backup rpc for connecting to the network * fmt
- Loading branch information
Showing
7 changed files
with
185 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use near_api::{prelude::*, types::reference::Reference}; | ||
|
||
#[tokio::main] | ||
async fn main() { | ||
let mut network = NetworkConfig::mainnet(); | ||
network.rpc_endpoints.push( | ||
RPCEndpoint::new("https://rpc.mainnet.pagoda.co/".parse().unwrap()) | ||
.with_api_key("potential api key".parse().unwrap()) | ||
.with_retries(5), | ||
); | ||
// Query latest block | ||
let _block = Chain::block() | ||
.at(Reference::Optimistic) | ||
.fetch_from_mainnet() | ||
.await | ||
.unwrap(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.