@@ -169,11 +169,15 @@ USAGE:
169169 genlayer deploy [options]
170170 genlayer call < contractAddress> < method> [options]
171171 genlayer write < contractAddress> < method> [options]
172+ genlayer estimate-fees [contractAddress] [method] [options]
172173 genlayer schema < contractAddress> [options]
173174
174175OPTIONS (deploy):
175176 --contract < contractPath> (Optional) Path to the intelligent contract to deploy
176177 --rpc < rpcUrl> RPC URL for the network
178+ --fees < json> Transaction fee options JSON passed to genlayer-js
179+ --fee-value < wei> Explicit fee deposit value
180+ --valid-until < timestamp> Unix timestamp after which the transaction is invalid
177181 --args < args...> Contract arguments (see Argument Types below)
178182
179183OPTIONS (call):
@@ -182,23 +186,69 @@ OPTIONS (call):
182186
183187OPTIONS (write):
184188 --rpc < rpcUrl> RPC URL for the network
189+ --fees < json> Transaction fee options JSON passed to genlayer-js
190+ --fee-value < wei> Explicit fee deposit value
191+ --valid-until < timestamp> Unix timestamp after which the transaction is invalid
185192 --args < args...> Method arguments (see Argument Types below)
186193
194+ OPTIONS (estimate-fees):
195+ --rpc < rpcUrl> RPC URL for the network
196+ --fees < json> Fee estimate options JSON, or a transaction fee object
197+ --include-report Include simulation fee accounting/report in the generated estimate output
198+ --args < args...> Method arguments for simulation-derived estimates
199+
187200OPTIONS (schema):
188201 --rpc < rpcUrl> RPC URL for the network
189202
190203EXAMPLES:
191204 genlayer deploy
192205 genlayer deploy --contract ./my_contract.gpy
193206 genlayer deploy --contract ./my_contract.gpy --args " arg1" " arg2" 123
207+ genlayer deploy --contract ./my_contract.gpy --fees ' {"distribution":{"leaderTimeunitsAllocation":"100","validatorTimeunitsAllocation":"200","rotations":["0"]}}'
194208 genlayer call 0x123456789abcdef greet --args " Hello World!"
195209 genlayer write 0x123456789abcdef updateValue --args 42
210+ genlayer write 0x123456789abcdef updateValue --fees ' {"distribution":{"leaderTimeunitsAllocation":"100","validatorTimeunitsAllocation":"200","rotations":["0"]}}' --args 42
211+ genlayer estimate-fees
212+ genlayer estimate-fees 0x123456789abcdef updateValue --args 42
196213 genlayer write 0x123456789abcdef sendReward --args 0x6857Ed54CbafaA74Fc0357145eC0ee1536ca45A0
197214 genlayer write 0x123456789abcdef setScores --args ' [1, 2, 3]'
198215 genlayer write 0x123456789abcdef setConfig --args ' {"timeout": 30, "retries": 5}'
199216 genlayer schema 0x123456789abcdef
200217` ` `
201218
219+ # #### Transaction Fee Options
220+
221+ ` --fees` accepts the same transaction fee object as ` genlayer-js` . Quote large
222+ integer values as strings to preserve precision. ` messageAllocations[].messageType`
223+ may be ` " internal" ` , ` " external" ` , ` 0` , or ` 1` .
224+
225+ For targeted message budgets, the CLI can derive GenVM call keys before passing
226+ the JSON to ` genlayer-js` :
227+
228+ ` ` ` bash
229+ genlayer estimate-fees 0x123456789abcdef settle \
230+ --fees ' {"messageAllocations":[{"messageType":"internal","recipient":"0x0000000000000000000000000000000000000001","callKeyMethod":"settle_campaign","budget":"700000"}]}'
231+
232+ genlayer write 0x123456789abcdef sendReward \
233+ --fees ' {"messageAllocations":[{"messageType":"external","recipient":"0x0000000000000000000000000000000000000002","callKeySelector":"0xa9059cbb","budget":"210000"}]}'
234+ ` ` `
235+
236+ Use ` callKeyMethod` for internal GenVM messages, ` callKeySelector` for a 4-byte
237+ EVM selector, or ` callKeyCalldata` for full external calldata. Explicit
238+ ` callKey` is still accepted for advanced cases.
239+
240+ If ` --fees` includes a ` distribution` and ` --fee-value` is omitted, the SDK
241+ derives the fee deposit from FeeManager on network backends, or from
242+ ` sim_getFeeConfig` on Studio. Use ` --fee-value` only when you need to force an
243+ explicit deposit value.
244+
245+ ` estimate-fees` prints the SDK fee preset. Without a contract/method it calls
246+ ` estimateTransactionFees` . With a contract/method it uses the SDK target-write
247+ estimation helper so the preset reflects the observed Studio fee accounting
248+ report. Add ` --include-report` to use the explicit simulate-and-derive path and
249+ include the simulation fee accounting and execution fee report next to the
250+ preset for reproducible gas-unit debugging.
251+
202252# #### Argument Types
203253
204254The ` --args` option automatically detects and converts values to the correct type:
@@ -522,4 +572,3 @@ We welcome contributions to GenLayerJS SDK! Whether it's new features, improved
522572# # License
523573
524574This project is licensed under the ... License - see the [LICENSE](LICENSE) file for details.
525-
0 commit comments