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

Add StandardAccount.create() #501

Merged
merged 23 commits into from
Jul 26, 2024

Conversation

franciszekjob
Copy link
Collaborator

@franciszekjob franciszekjob commented Jul 24, 2024

Describe your changes

  • Restore StandardAccount constructor with cairoVersion param
  • Change default cairoVersion to CairoVersion.ONE
  • Introduce static method StandardAccount.create(), which allows to create a StandardAccount instance with automatic determination of Cairo version

Linked issues

Closes

Breaking changes

  • This issue contains breaking changes

@franciszekjob franciszekjob changed the title Add multiple constructors for StandardAccount Move automatic determination of Cairo version StandardAccount to static method Jul 24, 2024
@franciszekjob franciszekjob changed the title Move automatic determination of Cairo version StandardAccount to static method Move StandardAccount creation with automatic determination of Cairo version to static method Jul 24, 2024
Comment on lines 89 to 98
@Test
fun `creating account with automatic Cairo version determination`() {
StandardAccount.create(
address = accountAddress,
privateKey = Felt(1234),
provider = provider,
chainId = chainId,
)
}

Copy link
Collaborator Author

@franciszekjob franciszekjob Jul 24, 2024

Choose a reason for hiding this comment

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

note: It would be ideal if we could check resolved cairoVersion and compare it with expected value. However, cairoVersion is a private field, so we cannot do this. Wdyt @ddoktorski ?

Choose a reason for hiding this comment

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

Perhaps we can add a test similar to cairo1 account calldata? Would it be possible to use Cairo 0 account?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I've added test both for Cairo 0 and 1.

@franciszekjob franciszekjob changed the title Move StandardAccount creation with automatic determination of Cairo version to static method Add StandardAccount.create() Jul 24, 2024
Comment on lines 89 to 98
@Test
fun `creating account with automatic Cairo version determination`() {
StandardAccount.create(
address = accountAddress,
privateKey = Felt(1234),
provider = provider,
chainId = chainId,
)
}

Choose a reason for hiding this comment

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

Perhaps we can add a test similar to cairo1 account calldata? Would it be possible to use Cairo 0 account?

@franciszekjob franciszekjob merged commit e1b8b10 into main Jul 26, 2024
2 checks passed
@franciszekjob franciszekjob deleted the feat/383-2-automatically-determine-cairo-version branch July 26, 2024 08:19
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