Closed plotchy closed 1 month ago
Is this using no-code or rust project?
rust project
to be precise, i did rust project. then i didnt need the rETH things so i reworked the yaml, fixed the chainid u32 thing, and then regenerated typings and indexers for my new contract and event
Please give me exact steps to recreate and il take a look , please also share your rindexer.yaml
❯ rindexer new rust
Initializing new rindexer project...
Project Name: kami
Project Description (skip by pressing Enter):
Repository (skip by pressing Enter):
What Storages To Enable? (graphql can only be supported if postgres is enabled) [postgres, csv, both, none]: postgres
Postgres Docker Support Out The Box? [yes, no]: yes
Successfully generated rindexer rust project.
rindexer rust project created with a rETH transfer events YAML template.
cd ./kami
- use rindexer codegen commands to regenerate the code
- run `rindexer start all` to start rindexer
- run `rindexer add contract` to add new contracts to your project
cd kami
add in World.abi.json to /abis replace rindexer.yaml with provided one delete RocketTokenRETH.abi.json
https://gist.github.com/plotchy/1b9e03bd2c8bc478b38ce1e471baa486
then i changed Network to take u64 for chain
pub struct Network {
pub name: String,
pub chain_id: u64,
pub rpc: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub compute_units_per_second: Option<u64>,
}
//handle_add_contract_command
let networks: Vec<(&str, u64)> =
manifest.networks.iter().map(|network| (network.name.as_str(), network.chain_id)).collect();
rebuilt this with make prod_build
and started using new binary
then ran into the issue above, and used this fix
// retry_with_block_range
let error_data_binding = error.data.as_ref().map(|data| data.to_string());
let empty_string = String::from("");
let error_data = match &error_data_binding {
Some(data) => data,
None => &empty_string,
};
changed Cargo.toml to point to the local patch in core
rindexer = { path = "../../../packages/rindexer/core" }
Then deleted /typings
and /indexers
from kami project.
ran rindexer codegen typings
and rindexer codegen indexer
run rindexer start all
now have an issue with event arg bindings being different. looks like an underscore is added somewhere
❯ rindexer2 start all
Compiling kami v0.1.0 (/Users/plotchy/code/projects/kami-rs/kami)
error[E0609]: no field `arg0` on type `ComponentValueSetFilter`
--> src/rindexer_lib/indexers/kami/world.rs:27:151
|
27 | ... let data = vec![EthereumSqlTypeWrapper::Address(result.tx_information.address),EthereumSqlTypeWrapper::U256(result.event_data.arg0),EthereumSqlTypeWrapper::Address(result.event_data.arg1),Eth...
| ^^^^ unknown field
|
help: a field with a similar name exists
|
27 | let data = vec![EthereumSqlTypeWrapper::Address(result.tx_information.address),EthereumSqlTypeWrapper::U256(result.event_data.arg_0),EthereumSqlTypeWrapper::Address(result.event_data.arg1),EthereumSqlTypeWrapper::U256(result.event_data.arg2),EthereumSqlTypeWrapper::Bytes(result.event_data.arg3),EthereumSqlTypeWrapper::H256(result.tx_information.transaction_hash),EthereumSqlTypeWrapper::U64(result.tx_information.block_number),EthereumSqlTypeWrapper::H256(result.tx_information.block_hash),EthereumSqlTypeWrapper::String(result.tx_information.network.to_string()),EthereumSqlTypeWrapper::U64(result.tx_information.transaction_index),EthereumSqlTypeWrapper::U256(result.tx_information.log_index)];;
| ~~~~~
I have the same issue when I try to build the project.
cargo build
Compiling postgres-native-tls v0.5.0 Compiling rindexer v0.1.0 (/Users/anymac/projects/web3j/rindexer/core) error[E0716]: temporary value dropped while borrowed --> core/src/indexer/fetch_logs.rs:491:24 | 490 | let error_data = match &error.data { | ---------- borrow later stored here 491 | Some(data) => &data.to_string(), | ^^^^^^^^^^^^^^^- |
---|---|---|---|---|---|
temporary value is freed at the end of this statement | |||||
creates a temporary value which is freed while still in use | |||||
help: consider using a let binding to create a longer lived value |
490 ~ let binding = data.to_string(); 491 ~ let error_data = match &error.data { 492 ~ Some(data) => &binding, |
---|
error[E0716]: temporary value dropped while borrowed --> core/src/indexer/fetch_logs.rs:492:18 | 490 | let error_data = match &error.data { | ---------- borrow later stored here 491 | Some(data) => &data.to_string(), 492 | None => &String::from(""), | ^^^^^^^^^^^^^^^- |
---|---|---|---|---|---|---|
temporary value is freed at the end of this statement | ||||||
creates a temporary value which is freed while still in use | ||||||
help: consider using a let binding to create a longer lived value |
490 ~ let binding = String::from(""); 491 ~ let error_data = match &error.data { 492 | Some(data) => &data.to_string(), 493 ~ None => &binding, |
---|
For more information about this error, try rustc --explain E0716
.
error: could not compile rindexer
(lib) due to 2 previous errors
https://github.com/joshstevens19/rindexer/commit/9d2475fed3f982b1024fcb638c48b5eb3d255787 will deploy these fixes 3 different ones in here
https://github.com/joshstevens19/rindexer/pull/58 - rindexerup will get the latest one
Nice! 😊👍