Skip to content

Commit d1c29c2

Browse files
committed
fix: add magic tuples, update alloy versions
1 parent 567ba78 commit d1c29c2

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

Cargo.lock

Lines changed: 28 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ homepage = "https://kinode.org"
88
repository = "https://github.com/kinode-dao/process_lib"
99

1010
[dependencies]
11-
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "098ad56" }
12-
alloy-primitives = "0.6.2"
13-
alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "098ad56" }
14-
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy.git", rev = "098ad56" }
11+
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
12+
alloy-primitives = "0.6.3"
13+
alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "6f8ebb4" }
14+
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy.git", rev = "6f8ebb4" }
1515
anyhow = "1.0"
1616
bincode = "1.3.3"
1717
http = "1.0.0"

src/eth.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ impl Provider {
235235
/// # Returns
236236
/// A `Result<Vec<Log>, EthError>` containing the logs that match the filter.
237237
pub fn get_logs(&self, filter: &Filter) -> Result<Vec<Log>, EthError> {
238-
let Ok(params) = serde_json::to_value(filter) else {
238+
// NOTE: filter must be encased by a tuple to be serialized correctly
239+
let Ok(params) = serde_json::to_value((filter,)) else {
239240
return Err(EthError::InvalidParams);
240241
};
241242
let action = EthAction::Request {
@@ -391,7 +392,8 @@ impl Provider {
391392
/// # Returns
392393
/// A `Result<Option<Transaction>, EthError>` representing the transaction, if found.
393394
pub fn get_transaction_by_hash(&self, hash: TxHash) -> Result<Option<Transaction>, EthError> {
394-
let Ok(params) = serde_json::to_value(hash) else {
395+
// NOTE: hash must be encased by a tuple to be serialized correctly
396+
let Ok(params) = serde_json::to_value((hash,)) else {
395397
return Err(EthError::InvalidParams);
396398
};
397399
let action = EthAction::Request {
@@ -414,7 +416,8 @@ impl Provider {
414416
&self,
415417
hash: TxHash,
416418
) -> Result<Option<TransactionReceipt>, EthError> {
417-
let Ok(params) = serde_json::to_value(hash) else {
419+
// NOTE: hash must be encased by a tuple to be serialized correctly
420+
let Ok(params) = serde_json::to_value((hash,)) else {
418421
return Err(EthError::InvalidParams);
419422
};
420423
let action = EthAction::Request {
@@ -525,7 +528,8 @@ impl Provider {
525528
let action = EthAction::Request {
526529
chain_id: self.chain_id,
527530
method: "eth_sendRawTransaction".to_string(),
528-
params: serde_json::to_value(tx).unwrap(),
531+
// NOTE: tx must be encased by a tuple to be serialized correctly
532+
params: serde_json::to_value((tx,)).unwrap(),
529533
};
530534

531535
self.send_request_and_parse_response::<TxHash>(action)

0 commit comments

Comments
 (0)