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

[Test] Expose service account to the testing framework #121

Closed
m-Peter opened this issue May 23, 2023 · 2 comments · Fixed by #122
Closed

[Test] Expose service account to the testing framework #121

m-Peter opened this issue May 23, 2023 · 2 comments · Fixed by #122

Comments

@m-Peter
Copy link
Contributor

m-Peter commented May 23, 2023

Issue To Be Solved

Currently, when writing integration tests with the Cadence testing framework, there is no way to send some amount of FLOW tokens to any newly-created account. Since FLOW is the native token of the blockchain, it is a must-have feature to be able to send such tokens to any account, and test relevant scenarios that require usage of FLOW tokens.

Suggest A Solution

Since the emulator is used under the hood for integration tests, one possible solution is to expose the service account to the testing framework. The service account contains a large amount of FLOW tokens, and developers will be able to write transactions and send any desired amount to newly-created accounts. The service account is necessary for signing such transactions. Helper methods might be defined as well, to avoid boilerplate code, and create new accounts with a predefined number of FLOW tokens.

Context

onflow/developer-grants#148

@devbugging
Copy link
Contributor

Makes sense to use the service account for that. Would you be able to use this method? https://github.com/onflow/flow-emulator/blob/master/blockchain.go#L182

@m-Peter
Copy link
Contributor Author

m-Peter commented May 23, 2023

@sideninja Yes, I am using the service key from the Blockchain type, because the account has to be exposed through a custom Test.Account cadence struct. I have already opened a PR that tackles this: #122

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants