FuelLabs / fuels-ts

Fuel Network Typescript SDK
https://docs.fuel.network/docs/fuels-ts/
Apache License 2.0
44.4k stars 1.32k forks source link

docs: re-introduce testing wallets docs #2635

Open maschad opened 6 days ago

maschad commented 6 days ago
github-actions[bot] commented 6 days ago

Coverage Report:

Lines Branches Functions Statements
80.29%(+0%) 71.8%(+0%) 77.56%(+0%) 80.36%(+0%)
Changed Files: Coverage values did not change👌.
nedsalk commented 5 days ago

I'm concerned that we are sending conflicting messages between this and launchTestNode. Anybody who was using generateTestWallet in tests should switch to launchTestNode, and anybody who was using it in app code (like in #2617) was misusing the utility. For example, the generateTestWallet utility depends on process.env.GENESIS_SECRET, an environment variable created to solve the flakiness around double spending in our tests, etc. - it wasn't designed with app/production code in mind.

If the users have a need for such an utility, we should think about how best to give them access to it. Perhaps it's not a new utility at all, but just some documentation around Wallet.generate and how it can be integrated with a custom-made stateConfig.json - something that can be put in the cookbook.

maschad commented 5 days ago

I'm concerned that we are sending conflicting messages between this and launchTestNode. Anybody who was using generateTestWallet in tests should switch to launchTestNode, and anybody who was using it in app code (like in https://github.com/FuelLabs/fuels-ts/issues/2617) was misusing the utility. For example, the generateTestWallet utility depends on process.env.GENESIS_SECRET, an environment variable created to solve the flakiness around double spending in our tests, etc. - it wasn't designed with app/production code in mind.

I agree with you that launchTestNode is a better utility, when I created this PR I hadn't found any documentation around retrieving the wallet instance, so I still felt that generateTestWallet would be useful until that was better elucidated. Reading this now I think it suffices. Perhaps I should just highlight it here.

If the users have a need for such an utility, we should think about how best to give them access to it. Perhaps it's not a new utility at all, but just some documentation around Wallet.generate and how it can be integrated with a custom-made stateConfig.json - something that can be put in the cookbook.

This documentation around Wallet.generate outlines that so I think it's useful. Perhaps we can give a recommendation to use launchTestNode as the preface on this guide, but also highlight that if a user needs to specifically just generate a wallet that can be done via this snippet.

maschad commented 1 day ago

Whilst refactoring fuel-gauge to use launchTestNode, I've realized there are some relevant use cases that I will document in https://github.com/FuelLabs/fuels-ts/pull/2579 in relation to wallet generation and instantiation which the new test-wallet docs can benefit from. So I will revisit this PR after that.