Skip to content

Commit

Permalink
feat: switch to jsonrpc v0.7.1
Browse files Browse the repository at this point in the history
  • Loading branch information
xJonathanLEI committed May 20, 2024
1 parent d951283 commit 2c890ae
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ serde = { version = "1.0.164", features = ["derive"] }
serde_json = { version = "1.0.99", features = ["preserve_order"] }
serde_with = "2.3.3"
shellexpand = "3.1.0"
starknet = { git = "https://github.com/xJonathanLEI/starknet-rs", rev = "35a7843d58ba3c93e1a7691bc7022080b28c9ade" }
starknet-crypto = { git = "https://github.com/xJonathanLEI/starknet-rs", rev = "35a7843d58ba3c93e1a7691bc7022080b28c9ade" }
starknet = { git = "https://github.com/xJonathanLEI/starknet-rs", rev = "82bac8b196a59c340519249b92db410d0084d74d" }
starknet-crypto = { git = "https://github.com/xJonathanLEI/starknet-rs", rev = "82bac8b196a59c340519249b92db410d0084d74d" }
tempfile = "3.8.0"
thiserror = "1.0.40"
tokio = { version = "1.28.2", default-features = false, features = ["macros", "rt-multi-thread"] }
Expand Down
12 changes: 1 addition & 11 deletions src/address_book.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use crate::chain_id::ChainIdSource;

const CHAIN_ID_KATANA: FieldElement = felt!("0x4b4154414e41");

pub const HARDCODED_ADDRESS_BOOK: [AddressBookEntry; 10] = [
pub const HARDCODED_ADDRESS_BOOK: [AddressBookEntry; 8] = [
AddressBookEntry {
chain_id: chain_id::MAINNET,
name: "eth",
Expand All @@ -23,16 +23,6 @@ pub const HARDCODED_ADDRESS_BOOK: [AddressBookEntry; 10] = [
name: "strk",
address: felt!("0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"),
},
AddressBookEntry {
chain_id: chain_id::TESTNET,
name: "eth",
address: felt!("0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7"),
},
AddressBookEntry {
chain_id: chain_id::TESTNET,
name: "strk",
address: felt!("0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d"),
},
AddressBookEntry {
chain_id: short_string!("SN_SEPOLIA"),
name: "eth",
Expand Down
4 changes: 2 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ mod subcommands;
mod utils;
mod verbosity;

pub(crate) const JSON_RPC_VERSION: &str = "0.6.0";
pub(crate) const JSON_RPC_VERSION: &str = "0.7.1";

const VERSION_STRING: &str = concat!(env!("CARGO_PKG_VERSION"), " (", env!("VERGEN_GIT_SHA"), ")");
const VERSION_STRING_VERBOSE: &str = concat!(
env!("CARGO_PKG_VERSION"),
" (",
env!("VERGEN_GIT_SHA"),
")\n",
"JSON-RPC version: 0.6.0"
"JSON-RPC version: 0.7.1"
);

#[derive(Debug, Parser)]
Expand Down
20 changes: 15 additions & 5 deletions src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,18 @@ impl ProviderArgs {
let url = match vendor {
FreeProviderVendor::Blast => {
if matched_network.chain_id == CHAIN_ID_MAINNET {
Some("https://starknet-mainnet.public.blastapi.io/rpc/v0_6")
Some("https://starknet-mainnet.public.blastapi.io/rpc/v0_7")
} else if matched_network.chain_id == CHAIN_ID_SEPOLIA {
Some("https://starknet-sepolia.public.blastapi.io/rpc/v0_6")
Some("https://starknet-sepolia.public.blastapi.io/rpc/v0_7")
} else {
None
}
}
FreeProviderVendor::Nethermind => {
if matched_network.chain_id == CHAIN_ID_MAINNET {
Some("https://free-rpc.nethermind.io/mainnet-juno/rpc/v0_6")
Some("https://free-rpc.nethermind.io/mainnet-juno/rpc/v0_7")
} else if matched_network.chain_id == CHAIN_ID_SEPOLIA {
Some("https://free-rpc.nethermind.io/sepolia-juno/rpc/v0_6")
Some("https://free-rpc.nethermind.io/sepolia-juno/rpc/v0_7")
} else {
None
}
Expand Down Expand Up @@ -304,6 +304,16 @@ impl Provider for ExtendedProvider {
<AnyProvider as Provider>::get_block_with_txs(&self.provider, block_id).await
}

async fn get_block_with_receipts<B>(
&self,
block_id: B,
) -> Result<MaybePendingBlockWithReceipts, ProviderError>
where
B: AsRef<BlockId> + Send + Sync,
{
<AnyProvider as Provider>::get_block_with_receipts(&self.provider, block_id).await
}

async fn get_state_update<B>(
&self,
block_id: B,
Expand Down Expand Up @@ -368,7 +378,7 @@ impl Provider for ExtendedProvider {
async fn get_transaction_receipt<H>(
&self,
transaction_hash: H,
) -> Result<MaybePendingTransactionReceipt, ProviderError>
) -> Result<TransactionReceiptWithBlockInfo, ProviderError>
where
H: AsRef<FieldElement> + Send + Sync,
{
Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ where
{
loop {
match provider.get_transaction_receipt(transaction_hash).await {
Ok(receipt) => match receipt.execution_result() {
Ok(receipt) => match receipt.receipt.execution_result() {
ExecutionResult::Succeeded => {
eprintln!(
"Transaction {} confirmed",
Expand Down

0 comments on commit 2c890ae

Please sign in to comment.