Commit Graph
5 Commits
Author SHA1 Message Date
jwinterm f13ea7f01f Contracts: make_outputs takes nanogrin amounts (Vec<u64>), not a string
OutputSelectionArgs.make_outputs was a comma-separated grin string parsed inside
libwallet via amount_from_hr_string. Move that parsing to the CLI boundary and
carry explicit nanogrin u64 amounts through the API and Context instead:
- OutputSelectionArgs.make_outputs: Option<String> -> Option<Vec<u64>>;
  output_amounts() becomes a plain accessor, num_custom_outputs() uses len().
- The CLI (wallet_args) parses grin -> nanogrin per amount; ContractNewArgs and
  ContractSetupArgs carry Vec<u64> and copy it through.
- Update the two tests that supplied make_outputs as a string.

Addresses PR #754 review (types.rs, wallet_args.rs).
2026-06-10 14:18:50 -04:00
jwinterm 3fcf3b7816 De-panic output_amounts(): fallible make-outputs parsing
OutputSelectionArgs::output_amounts() unwrap()'d the float parse of each
make-outputs value, panicking on bad input via the API path (the CLI now
validates earlier). Return Result instead; sum_output_amounts() propagates.
num_custom_outputs() now counts CSV entries without parsing, so it stays
infallible and the debug! macros that use it are unaffected.
2026-06-03 13:56:32 -04:00
YeastplumeandGitHub febffd4c68 [Contracts] Add self spend transaction state (#697)
* Add self spend transaction state

* subtle errors with output states and tx lookups - fixes
2023-10-19 11:04:44 +01:00
YeastplumeandGitHub 2c38081f06 contract test fixes (#676) 2023-03-22 09:22:51 +00:00
f0cf8b0a7d Simple contracts restructured v3 (#675)
* Add prototype contract implementation

Lacks:
- Payment proofs (add early payment proofs)
- Tests
- Better structure

* Separate contract utilities

* Simplify the main setup/sign code flow

* Remove commented initial_sec_key assignment

* Simplify sign::compute function

* Add logic for "removal" of secret keys from the context

* Further simplify a bit sign and setup

* No need for mutable context when adding outputs

* Refactor the commented code (lol)

* Refactor a bit

* tmp

---------

Co-authored-by: oryhp <gtrphyro@gmail.com>
2023-03-20 10:09:17 +00:00