Skip to content

Commit

Permalink
Release/0.10.0 (#112)
Browse files Browse the repository at this point in the history
* release/0.10.0

* Add release binaries for

* fix: resolve topic_id packing issues

* fix: invalid parsing for hex string

* Add release binaries for

* windows

---------

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
joshstevens19 and github-actions authored Oct 15, 2024
1 parent 74bd478 commit 3b99ffe
Show file tree
Hide file tree
Showing 12 changed files with 57 additions and 20 deletions.
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rindexer_cli"
version = "0.9.0"
version = "0.10.0"
edition = "2021"
resolver = "2"

Expand Down
41 changes: 31 additions & 10 deletions core/src/abi.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{collections::HashSet, fs, iter::Map, path::Path};
use std::{collections::HashSet, fs, path::Path};

use ethers::{
types::{ValueOrArray, H256},
Expand Down Expand Up @@ -178,12 +178,33 @@ pub enum ReadAbiError {

impl ABIItem {
pub fn format_event_signature(&self) -> Result<String, ParamTypeError> {
let formatted_inputs = self
.inputs
.iter()
.map(|component| component.format_param_type())
.collect::<Result<Vec<_>, _>>()?;
Ok(formatted_inputs.join(","))
let name = &self.name;
let params = self.inputs.iter()
.map(Self::format_param_type)
.collect::<Result<Vec<_>, _>>()?
.join(",");

Ok(format!("{}({})", name, params))
}

fn format_param_type(input: &ABIInput) -> Result<String, ParamTypeError> {
let base_type = input.type_.split('[').next().unwrap_or(&input.type_);
let array_suffix = input.type_.strip_prefix(base_type).unwrap_or("");

let type_str = match base_type {
"tuple" => {
let inner = input.components.as_ref()
.ok_or(ParamTypeError::MissingComponents)?
.iter()
.map(Self::format_param_type)
.collect::<Result<Vec<_>, _>>()?
.join(",");
format!("({})", inner)
},
_ => base_type.to_string(),
};

Ok(format!("{}{}", type_str, array_suffix))
}

pub fn extract_event_names_and_signatures_from_abi(
Expand All @@ -193,6 +214,7 @@ impl ABIItem {
for item in abi_json.into_iter() {
if item.type_ == "event" {
let signature = item.format_event_signature()?;
// println!("signature {}", signature);
events.push(EventInfo::new(item, signature));
}
}
Expand Down Expand Up @@ -275,13 +297,12 @@ impl EventInfo {
}

pub fn topic_id(&self) -> H256 {
let event_signature = format!("{}({})", self.name, self.signature);
let event_signature = self.signature.clone();
H256::from_slice(&keccak256(event_signature))
}

pub fn topic_id_as_hex_string(&self) -> String {
let event_signature = format!("{}({})", self.name, self.signature);
Map::collect(keccak256(event_signature).iter().map(|byte| format!("{:02x}", byte)))
format!("{:x}", self.topic_id())
}

pub fn struct_result(&self) -> &str {
Expand Down
2 changes: 1 addition & 1 deletion core/src/generator/events_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ fn build_pub_contract_fn(
}
Some(value) => match value {
ValueOrArray::Value(address) => {
let address = format!("{}", address);
let address = format!("{:?}", address);
Code::new(format!(
r#"pub fn {contract_name}_contract(network: &str) -> {abi_gen_name}<Arc<Provider<RetryClient<Http>>>> {{
let address: Address = "{address}".parse().expect("Invalid address");
Expand Down
32 changes: 24 additions & 8 deletions documentation/docs/pages/docs/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@

### Features
-------------------------------------------------
- feat: expose an insert_bulk new postgres function to make inserting bulk data easier
- feat: expose new ethereum sql type wrappers for bytes types#
- feat: expose postgres ToSql trait
- feat: support with_transaction in postgres client
- feat: get the block timestamp from the RPC call (its an option as not all providers expose it)
- feat: allow you to override environment file path

### Bug fixes
-------------------------------------------------
- fix: dependency events not being applied to the correct contract
- fix: resolve defining environment variables in contract address fields in the yaml

### Breaking changes
-------------------------------------------------
Expand All @@ -25,6 +17,30 @@

all release branches are deployed through `release/VERSION_NUMBER` branches

## 0.10.0-beta - 15th October 2024

github branch - https://github.com/joshstevens19/rindexer/tree/release/0.10.0

- linux binary - https://rindexer.xyz/releases/linux-amd64/0.10.0/rindexer_linux-amd64.tar.gz
- mac apple silicon binary - https://rindexer.xyz/releases/darwin-arm64/0.10.0/rindexer_darwin-arm64.tar.gz
- mac apple intel binary - https://rindexer.xyz/releases/darwin-amd64/0.10.0/rindexer_darwin-amd64.tar.gz
- windows binary - https://rindexer/releases.xyz/win32-amd64/0.10.0/rindexer_win32-amd64.zip

### Features
-------------------------------------------------
- feat: expose an insert_bulk new postgres function to make inserting bulk data easier
- feat: expose new ethereum sql type wrappers for bytes types#
- feat: expose postgres ToSql trait
- feat: support with_transaction in postgres client
- feat: get the block timestamp from the RPC call (its an option as not all providers expose it)
- feat: allow you to override environment file path

### Bug fixes
-------------------------------------------------
- fix: dependency events not being applied to the correct contract
- fix: resolve defining environment variables in contract address fields in the yaml
- fix: resolve topic_id packing issues

## 0.9.0-beta - 19th September 2024

github branch - https://github.com/joshstevens19/rindexer/tree/release/0.9.0
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 3b99ffe

Please sign in to comment.