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

Testnet: error handling and add .testnet to dev_generate #362

Closed
wants to merge 5 commits into from
Closed

Testnet: error handling and add .testnet to dev_generate #362

wants to merge 5 commits into from

Conversation

AlexKushnir1
Copy link
Contributor

@AlexKushnir1 AlexKushnir1 commented Jul 1, 2024

Add error handling to url_create_account #353
Response from url_create_account method return next error: A top-level account ID AccountId("dev-20240701184705-27025377514474") can't be created by AccountId("testnet"), short top-level account IDs can only be created by AccountId("registrar")

@AlexKushnir1 AlexKushnir1 marked this pull request as draft July 1, 2024 18:49
@AlexKushnir1 AlexKushnir1 marked this pull request as ready for review July 3, 2024 11:00
Comment on lines 80 to 84
if self.info().name.eq("testnet") {
let id: AccountId = AccountId::from_str(format!("{}.testnet", id.as_str()).as_str())
.expect("could not convert string account id into AccountId");
return (id, sk);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not a maintainable way of addressing it. I cannot approve this PR with a workaround. Consider putting this code somewhere in the testnet dev_create_account/url_create_account implementation.


let worker: Worker<Testnet> = near_workspaces::testnet().await?;
let (id, sk) = worker.dev_generate().await;
worker.create_tla(id, sk).await?.into_result()?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should not pass. TLA stands for top-level account (account name without ., e.g. near, testnet). create_tla on testnet cannot succeed.

@AlexKushnir1 AlexKushnir1 marked this pull request as draft July 26, 2024 11:56
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.

2 participants