Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rpc): use the correct RPC endpoint URL #9

Merged
merged 1 commit into from
Aug 31, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 9 additions & 7 deletions src/near_jsonrpc_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use crate::primitives::{
ValidatorsResponse, ViewAccountResponse,
};

const NEAR_RPC_ENDPOINT_URL: &str = "https://rpc.mainnet.near.org";

pub(crate) async fn get_locked_amount(
account_id: String,
block_height: u64,
Expand All @@ -24,7 +26,7 @@ pub(crate) async fn get_locked_amount(

let client = reqwest::Client::new();
let res = client
.post("https://rpc.mainnet.internal.near.org")
.post(NEAR_RPC_ENDPOINT_URL)
.json(&params)
.send()
.await?;
Expand Down Expand Up @@ -53,7 +55,7 @@ pub(crate) async fn get_liquid_owners_balance(

let client = reqwest::Client::new();
let res = client
.post("https://rpc.mainnet.internal.near.org")
.post(NEAR_RPC_ENDPOINT_URL)
.json(&params)
.send()
.await?;
Expand Down Expand Up @@ -83,7 +85,7 @@ pub(crate) async fn get_account_in_pool(

let client = reqwest::Client::new();
let res = client
.post("https://rpc.mainnet.internal.near.org")
.post(NEAR_RPC_ENDPOINT_URL)
.json(&params)
.send()
.await?;
Expand Down Expand Up @@ -113,7 +115,7 @@ pub(crate) async fn get_native_balance(

let client = reqwest::Client::new();
let res = client
.post("https://rpc.mainnet.internal.near.org")
.post(NEAR_RPC_ENDPOINT_URL)
.json(&params)
.send()
.await?;
Expand All @@ -134,7 +136,7 @@ pub(crate) async fn get_validators() -> Result<Validators, reqwest::Error> {
let client = reqwest::Client::new();

let res = client
.post("https://rpc.mainnet.internal.near.org")
.post(NEAR_RPC_ENDPOINT_URL)
.json(&params)
.send()
.await?;
Expand All @@ -155,7 +157,7 @@ pub(crate) async fn get_block(block_height: u64) -> Result<Block, reqwest::Error
let client = reqwest::Client::new();

let res = client
.post("https://rpc.mainnet.internal.near.org")
.post(NEAR_RPC_ENDPOINT_URL)
.json(&params)
.send()
.await?;
Expand All @@ -176,7 +178,7 @@ pub(crate) async fn get_final_block() -> Result<Block, reqwest::Error> {
let client = reqwest::Client::new();

let res = client
.post("https://rpc.mainnet.internal.near.org")
.post(NEAR_RPC_ENDPOINT_URL)
.json(&params)
.send()
.await?;
Expand Down