Skip to content

feat: prompt for start block on rpc url networks in contract import#4

Merged
JonoPrest merged 3 commits into
mainfrom
dp/start-block-prompt
Oct 22, 2024
Merged

feat: prompt for start block on rpc url networks in contract import#4
JonoPrest merged 3 commits into
mainfrom
dp/start-block-prompt

Conversation

@JasoonS

@JasoonS JasoonS commented May 24, 2024

Copy link
Copy Markdown
Contributor

Migrated PR from Float-Capital/indexer#1511

@JasoonS JasoonS closed this May 24, 2024
@JasoonS JasoonS deleted the dp/start-block-prompt branch May 24, 2024 09:48
@JasoonS JasoonS restored the dp/start-block-prompt branch May 24, 2024 10:26
@JasoonS JasoonS reopened this May 24, 2024

@JonoPrest JonoPrest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DenhamPreen just noting I reviewed on the old repo. Perhaps you can check comments there.

@DenhamPreen

DenhamPreen commented Oct 22, 2024

Copy link
Copy Markdown
Contributor

https://github.com/Float-Capital/indexer/pull/1511/files @JonoPrest this addresses all the feedback from your review here. Will fix tests

@DenhamPreen DenhamPreen enabled auto-merge (squash) October 22, 2024 08:57
Comment on lines +276 to +290
fn prompt_for_start_block() -> Result<u64> {
let prompt = Text::new(
"You have entered a network that is unsupported by HyperSync. Please provide a start block for this network \
(this can be edited later in config.yaml):",
)
.prompt();

let start_block: String = prompt.context("Failed during start block prompt")?;
let start_block: u64 = start_block
.trim()
.parse()
.context("Failed to parse start block, start block must be a number")?;

Ok(start_block)
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@DenhamPreen have a look at inquires docs on "CustomType" https://github.com/mikaelmello/inquire?tab=readme-ov-file#customtype

It's not a big one but the parsing then becomes built in and on top of that you get an error message where you can retry rather than a failure during the prompting process.

@JonoPrest JonoPrest disabled auto-merge October 22, 2024 10:38

@JonoPrest JonoPrest left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Den!

I've disabled auto-merge because there's one more comment I made on the actual prompt code. It's non blocking but can be an improvement to stop annoying exits half way through the import process.

@JonoPrest JonoPrest merged commit d5dfea9 into main Oct 22, 2024
@JonoPrest JonoPrest deleted the dp/start-block-prompt branch October 22, 2024 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants