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

Release/0.6.1 #86

Merged
merged 6 commits into from
Aug 15, 2024
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: 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.6.0"
version = "0.6.1"
edition = "2021"
resolver = "2"

Expand Down
2 changes: 1 addition & 1 deletion core/src/api/graphql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ pub async fn start_graphql_server(
)
})
.collect();

let connection_string = connection_string()?;
let port = settings.port;
let graphql_endpoint = format!("http://localhost:{}/graphql", &port);
Expand Down
8 changes: 4 additions & 4 deletions core/src/database/postgres/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use tracing::{error, info};

use crate::{
abi::{ABIInput, ABIItem, EventInfo, GenerateAbiPropertiesType, ParamTypeError, ReadAbiError},
helpers::{camel_to_snake, to_pascal_case},
helpers::camel_to_snake,
indexer::Indexer,
manifest::contract::Contract,
types::code::Code,
Expand Down Expand Up @@ -41,6 +41,7 @@ pub fn generate_column_names_only_with_base_properties(inputs: &[ABIInput]) -> V

fn generate_event_table_sql_with_comments(
abi_inputs: &[EventInfo],
contract_name: &str,
schema_name: &str,
apply_full_name_comment_for_events: Vec<String>,
) -> String {
Expand Down Expand Up @@ -77,9 +78,7 @@ fn generate_event_table_sql_with_comments(
// smart comments needed to avoid clashing of order by graphql names
let table_comment = format!(
"COMMENT ON TABLE {} IS E'@name {}{}';",
table_name,
to_pascal_case(schema_name).as_str(),
event_info.name
table_name, contract_name, event_info.name
);

format!("{}\n{}", create_table_sql, table_comment)
Expand Down Expand Up @@ -178,6 +177,7 @@ pub fn generate_tables_for_indexer_sql(

sql.push_str(&generate_event_table_sql_with_comments(
&event_names,
&contract.name,
&schema_name,
event_matching_name_on_other,
));
Expand Down
38 changes: 0 additions & 38 deletions core/src/helpers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,24 +112,6 @@ pub fn replace_env_variable_to_raw_name(rpc: &str) -> String {
}
}

pub fn to_pascal_case(s: &str) -> String {
let mut result = String::new();
let mut capitalize_next = true;

for c in s.chars() {
if c == '_' {
capitalize_next = true;
} else if capitalize_next {
result.push(c.to_ascii_uppercase());
capitalize_next = false;
} else {
result.push(c.to_ascii_lowercase());
}
}

result
}

#[cfg(test)]
mod tests {
use super::*;
Expand All @@ -149,24 +131,4 @@ mod tests {
assert_eq!(camel_to_snake_advanced("ERC20", false), "erc_20");
assert_eq!(camel_to_snake_advanced("ERC20", true), "erc20");
}

#[test]
fn test_pascal_case() {
let test_cases = vec![
("hello_world", "HelloWorld"),
("hello", "Hello"),
("hello__world__test", "HelloWorldTest"),
("_hello_world", "HelloWorld"),
("hello_world_", "HelloWorld"),
("", ""),
("HELLO_WORLD", "HelloWorld"),
("hElLo_WoRlD", "HelloWorld"),
("hello_world_123", "HelloWorld123"),
("indexer_cdh", "IndexerCdh"),
];

for (input, expected) in test_cases {
assert_eq!(to_pascal_case(input), expected, "Failed for input: {}", input);
}
}
}
8 changes: 4 additions & 4 deletions documentation/docs/pages/docs/accessing-data/graphql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ in the list results alongside the singular item query.
Important to read if you have 2 events with matching names across contracts.
:::

If you have 2 events which have exactly the same name as another contract this is a conflict of naming for graphql and it will render
full naming, for example `Transfer` would turn into `{indexer_name}{contract_name}Transfer`.info
If you have 2 events which have exactly the same name as another contract this is a conflict of naming for graphql so rindexer will render
it as `{contract_name}{event_name}` in pascal case, for example `Transfer` would turn into `{contract_name}Transfer`

So its is super clear lets say i had a yaml like this:

Expand Down Expand Up @@ -222,8 +222,8 @@ contracts:

My query names for `allTransfers` would be:

- `AllRocketPoolETHIndexerRocketPoolETHTransfers`
- `AllRocketPoolETHIndexerRocketPoolETHForkTransfers`
- `AllRocketPoolETHTransfers`
- `AllRocketPoolETHForkTransfers`

### Ordering

Expand Down
18 changes: 15 additions & 3 deletions documentation/docs/pages/docs/changelog.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@
### Bug fixes
-------------------------------------------------

- fix: resolve issue with conflicting event names on graphql meaning it would not load
- fix: resolve filter table names mapping to graphql meaning it would not expose the graphql queries

### Breaking changes
-------------------------------------------------

Expand All @@ -20,6 +17,21 @@

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

## 0.6.1-beta - 15th August 2024

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

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

### Bug fixes
-------------------------------------------------

- fix: resolve issue with conflicting event names on graphql meaning it would not load
- fix: resolve filter table names mapping to graphql meaning it would not expose the graphql queries

## 0.6.0-beta - 8th August 2024

github branch - https://github.com/joshstevens19/rindexer/tree/release/0.6.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.
Loading