fuels-ts icon indicating copy to clipboard operation
fuels-ts copied to clipboard

Chain Configs for the fuels CLI should be extendable off of the default one

Open Dhaiwat10 opened this issue 1 year ago • 6 comments

Currently, if one wants to tweak a certain setting in the default chain config used by the fuels CLI, they would have to provide a whole new chain config file. They cannot just change one single setting.

There should be a way for people to create a custom chain config by extending the default one.

Incoming feedback from https://github.com/FuelLabs/docs-hub/pull/203

Dhaiwat10 avatar Mar 26 '24 20:03 Dhaiwat10

Could we generate a chainConfig.json with the scaffolded app and would that be enough to get the job done?

I haven't thought much about having the file as part of the template, but that could reduce the abstraction around everything. Especially considering it contains required configs, maybe we should consider showing it instead of hiding it.

arboleya avatar Mar 26 '24 20:03 arboleya

Could we generate a chainConfig.json with the scaffolded app and would that be enough to get the job done?

I haven't thought much about having the file as part of the template, but that could reduce the abstraction around everything. Especially considering it contains required configs, maybe we should consider showing it instead of hiding it.

I like this approach.

It would be good to have documentation in the README.md around:

  • Pre-existing wallets (w/ assets) on the chain.
  • Extending the chain with custom wallets.
  • Links for the chainConfig.json documentation.

petertonysmith94 avatar Mar 27 '24 09:03 petertonysmith94

  • Extending the chain with custom wallets.

Would a command for adding a new wallet be helpful?

npm wallet:new
# Pushes new wallet (w/ assets) to the `chainConfig.json`
# Displays the private key for usage in the app. 

(Just a thought of a way to demonstrate the process)

petertonysmith94 avatar Mar 27 '24 09:03 petertonysmith94

Would a command for adding a new wallet be helpful? [...]

Seems to me that this could be a nice extension of forc-wallet, the workflow being similar to what you proposed:

forc wallet account new --chain-config ./chain-config.json 
# Pushes new wallet (w/ assets) to the `chainConfig.json`
# Displays the private key for usage in the app.
# Adds some default coins

nedsalk avatar Mar 28 '24 04:03 nedsalk

I haven't thought much about having the file as part of the template, but that could reduce the abstraction around everything. Especially considering it contains required configs, maybe we should consider showing it instead of hiding it.

Makes sense.

If we decide to go the extension way instead, for reference I already implemented type-safe chain config extending in #1356 (ref 1, ref 2).

nedsalk avatar Mar 28 '24 05:03 nedsalk