Commit Graph
58 Commits
Author SHA1 Message Date
Matt HauffandGitHub 4ace81ae17 [LABS-294] Add kw_only to all wallet RPC types (#20324)
Add `kw_only` to all wallet RPC types
2026-01-21 09:48:44 -08:00
Matt HauffandGitHub a05a0c57d2 [CHIA-3707] Port create_new_wallet to @marshal (#20087)
* Add the request types

* Add the request types

* some test fixes

* Add the client ports

* Fix tests

* Add cmd support and fix a test

* Missed a couple

* Add test for `CreateNewWallet.__post_init__()`
2025-12-08 09:31:51 -08:00
Matt HauffandGitHub 40db4635a8 [LABS-245] Enable PEP604 Ruff rules (#20269)
* Enable PEP604 Ruff rules

* Fix harcoded signature in test

* Hack CLVMStreamable test with note to fast follow
2025-11-18 12:34:00 -08:00
Matt HauffandGitHub a803dc0fa6 [CHIA-3633] August 2025 pass of Ruff linting rules (#19929)
* Enable Ruff `PLR1704` (`redefined-argument-from-local`)

* Enable Ruff `PLR5501` (`collapsible-else-if`)

* Enable Ruff `PLW2901` (`redefined-loop-name`)

* bad change

* Enable Ruff `RUF043` (`pytest-raises-ambiguous-pattern`)

* Enable Ruff `RUF046` (`unnecessary-cast-to-int`)

* Enable Ruff `RUF052` (`used-dummy-variable`)

* Remove unused ignore `UP006`

* One mis-signaled regex

* Comments by @altendky

* bad change, my bad
2025-08-11 14:39:12 -07:00
0a0293f81a [CHIA-3297] Port get_transaction(s) to @marshal (#19775)
* Port `get_transaction(s)`

* simplify class

* undo simplification

* Delete __eq__ and add test coverage

* Less dunder access

* small change

Co-authored-by: Kyle Altendorf <sda@fstab.net>

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2025-08-11 12:34:37 -07:00
Matt HauffandGitHub 42da90e105 [CHIA-3294] Port get_wallet_balance(s) to @marshal (#19774)
* Port `get_wallet_balance(s)`

* Use Streamable dict functionality
2025-08-05 13:11:24 -07:00
Matt HauffandGitHub 018c3fe46e [CHIA-3293] Port get_wallets to @marshal decorator (#19770)
* Port `get_wallets`

* Suggestion by @altendky
2025-07-16 09:07:56 -07:00
60e4f85515 [CHIA-1314] Port pooling RPC endpoints to @marshal decorator (#19683)
* Port `pw_join_pool`

* fix tests

* fix moar tests

* Port `pw_self_pool`

* Fix test

* Port `pw_absorb_rewards`

* Port `pw_status`

* Simplifications.

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2025-06-25 09:47:03 -07:00
Kyle AltendorfandGitHub f5fe748c19 less response failure error consumption (#19282) 2025-06-24 11:04:56 -07:00
Kyle AltendorfandGitHub 32ca9c0804 by service not layer (#19715)
* by service not layer

* monkey patch fixup
2025-06-16 14:31:51 -07:00
Earle LoweandGitHub 7f20df6214 Add some checks when trying to join the same pool already joined (#18822)
* Add some checks when trying to join the same pool already joined

* Add test to test the specific cli case

* Remove line added during debugging

* Add test

* misc updates

* remove cli test

* final tests for joining same pool again

* Update check from code review

* update test framework

* Use click.ClickException for error

* Add check for wallet synced up front as the first thing checked for joining a pool

* Add test for unsynced RPC call
2025-04-28 12:22:51 -07:00
Kyle AltendorfandGitHub d50b6e0883 use chia_rs directly for sized bytes (#19326) 2025-02-28 09:35:25 -08:00
Kyle AltendorfandGitHub e446d6b726 use chia_rs directly for sized ints (#19303)
* use chia_rs directly for sized ints

* Update data_layer_rpc_api.py
2025-02-24 14:33:09 -08:00
Kyle AltendorfandGitHub 45465b4865 move some non-framework items out of chia.cmds.cmd_classes (#19047)
* move some non-framework items out of `chia.cmds.cmd_classes`

* move the other new stuff too
2024-12-17 14:14:13 -07:00
Kyle AltendorfandGitHub 9c60a48de3 less DEFAULT_ROOT_PATH for get_any_service_client() (#19049) 2024-12-17 10:27:41 -07:00
Earle LoweandGitHub 7c01e3c483 CHIA-1730: port chia plotnft to @chia_commands framework (#18833)
* chia plotnft CLI improvements

* use CliRpcConnectionError

* add check to show

* fix typo

* Update plotnft CLI to newer framework

* Fix help cut-paste error

* add test using new framework

* some minor fixes

* use click.Choice for pool/local option

* some click options

* Some more plotnft cli tests

* drop test_pool_cmdline from mypy-exclusions

* mypy fixes

* several fixes

* Add leave test

* join tests

* more join tests

* missing await

* Try setting config

* use root_path from NeedsWalletRPC

* linting

* Some cleanup

* Add claim tests

* Improved tests

* refactor some test code

* Add inspect tests

* Skip bad test for now

* Add in change payout tests

* quoting error

* Add test for get_login_link

* Add in a few negative tests for join

* Few more tests

* Experment with clirunner env overrides

* put back chia_root into context dict

* Some cleanup and one more test

* maybe final test

* some updates

* some dedup and reorg of test code

* run trusted and untrusted paramertization

* make reuse puzhash stuff work

* Add in required mock object for test_update_pool_config_new_config

* rearrange code per review comment - limit use of NeedsWalletRPC to chia_command

* Add in plotnft click parsing tests

* added ability to pass in obj to runner invoke

* Add in some more test cases

* fix up create issues with config

* Add in couple more test cases for error conditions

* Minor code cleanup

* Use long options for readability, minor code cleanup

* Use config file for farmer rpc port

* simplify code

* Add testing for prompt cases

* Add mocking for default_root_path

* context cleanup

* temp debugging output

* patch the proper object

* move some wallet fixtures into top level conftest and remove conftest import

* merge to origin/main
2024-12-03 12:33:52 -07:00
Matt HauffandGitHub 73e4a5bbea [CHIA-1680] Finish replacing flake8 with Ruff (#18802)
* Apply ruff unsafe fixes

* Manually fix tuples with `as`

* Remove all references to flake8
2024-11-04 08:59:57 -07:00
Kyle AltendorfandGitHub 9c8557a1f8 Remove Python 3.8 support and update source to 3.9 standards (#18687)
* manual python 3.8 removals

* poetry

* pyupgrade

* black

* isort

* manually tidy imports

* work around shadowed type

* catch up build network protocol files for pyupgrade changes

* placate pylint

* re-enable 20.04

* placate flake8
2024-10-16 14:21:15 -07:00
81824c9b34 [CHIA-1308] Port wallet node RPC endpoints to @marshal decorator (#18651)
* Port `set_wallet_resync_on_startup`

* Port `get_sync_status`

* Port `get_height_info`

* Port `push_tx`

* Port `push_transactions`

* Delete `farm_block`

* Port `get_timestamp_for_height`

* Port `get_auto_claim` and set_auto_claim`

* pylint

* fix test

* pylint again

* typo

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* clearer comment

Co-authored-by: Kyle Altendorf <sda@fstab.net>

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2024-10-03 08:28:58 -07:00
Kyle AltendorfandGitHub 7d88089e8f more bytes32.from_hexstr() (#18446) 2024-08-14 15:05:41 -07:00
dependabot[bot]GitHubdependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>Earle Lowe
495593089b build(deps): bump mypy from 1.10.0 to 1.11.1 (#18412)
* build(deps): bump mypy from 1.10.0 to 1.11.1

Bumps [mypy](https://github.com/python/mypy) from 1.10.0 to 1.11.1.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.10.0...v1.11.1)

---
updated-dependencies:
- dependency-name: mypy
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Updates for new mypy

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Earle Lowe <e.lowe@chia.net>
2024-08-11 23:20:56 -07:00
Adam KellyandGitHub 3200e6b7eb Make 'chia plotnft -f fingerprint -i wallet_id' output JSON (#18387) 2024-08-07 11:26:53 -07:00
Jack NelsonandGitHub a447734728 Refactor CLI by adding add new click types for fees, amounts, addresses and bytes32 (#15718) 2024-06-24 16:52:40 -07:00
Arvid NorbergandGitHub 1661ce2e8a fix confusion between prompt and don't prompt in the plotnft CLI (#17951)
* fix confusion between prompt and don't prompt in the plotnft CLI

* use cli_confirm in plotnft CLI
2024-05-04 08:21:05 -07:00
cc5a5a9308 Remove unused parameter (#17598)
* Remove unused parameter

* Unroll some test cruft

* ('preserve tuple',)

* isort

* update test

* Update the Wallet RPC Api call in is_transaction_confirmed, and remove the no longer used user_wallet_id param.

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2024-02-23 09:55:38 -08:00
d1m1trusandGitHub 95826c53f4 Added wallet id showing when using the 'chia plotnft show'. (#16078) 2023-08-17 12:51:39 -05:00
Izumi HoshinoandGitHub d13538d025 Fixed chia plotnft show command (#15918) 2023-08-03 05:03:40 -05:00
Jack NelsonandGitHub 3eb23f60da Cleanup CLI RPC connection error handling (#15704)
* remove none from async generator and add a custom error type

* remove client check from data funcs

* remove client check from farm funcs

* remove client check from peer, show and netspace funcs

* remove none check from sim funcs

* change the wallet code in cmds util to use the new error type

* update plotnft_funcs with new error

* remove none checks from coin and wallet funcs

* cleanup logic a tad
2023-07-10 15:41:51 -05:00
ca1a53e42f Convert All CLI Commands to using async generators (#15628)
* add new get_wallet_client generator

* switch plotnft code to new generator

* change coin commands over to new generator

* remove extra imports

* change to 100% new async generator

* remove execute_with_wallet func

* Enable mypy on almost every cli file.

* Rename variables from yes

* switch to kwargs on really long functions & fix default list

* fix missing None & Fix syntax for unrelated change

* make more functions kwarg only

* Apply suggestions from code review

Co-authored-by: Kyle Altendorf <sda@fstab.net>

* final review changes

* oops fix backwards compatibility

* drop default, hint sequence

* List (for now...)

---------

Co-authored-by: Kyle Altendorf <sda@fstab.net>
2023-07-07 12:26:45 -05:00
Kyle AltendorfandGitHub 2e9647e32a extract wallet specific behavior from get any service client (#15086)
* extract wallet behavior from get_any_service_client()

* another

* style
2023-04-24 12:50:40 -06:00
Kyle AltendorfandGitHub 542522e39d hint chia.cmds.plotnft, plotnft_funcs (#14737) 2023-03-06 11:42:29 -06:00
Kyle AltendorfandGitHub 91a717b5f3 add hinting around get_any_service_client() (#14681) 2023-02-27 23:49:47 -06:00
Kyle AltendorfandGitHub ccfaca8060 make wallet rpc client wallet id parameters accept int, not str (#14200)
* make wallet rpc client wallet id parameters accept int, not str

* Update chia/cmds/wallet_funcs.py
2022-12-22 00:12:33 -06:00
dustinfaceandGitHub 977d2e97cd isort: Remove all chia.cmds exceptions and sort the related files (#13940) 2022-11-17 15:32:03 -06:00
Jack Nelson ef271368f8 other refactor changes: one main cmd function 2022-08-03 16:26:00 -04:00
dustinfaceandGitHub f5255498f6 cmds: Fix change_payout_instructions for invalid addresses (#11912)
`decode_puzzle_hash` raises
2022-06-16 19:56:41 +01:00
xdustinface da574e4081 cmds: Only access existing pool states in pprint_pool_wallet_state 2022-06-15 00:57:19 +02:00
dustinfaceandGitHub 629c303077 cmds: Use the new plot_count of get_pool_state in plotnft cmds (#11414) 2022-05-05 08:16:10 -07:00
Adam KellyandGitHub b224e1dda6 Print MempoolInclusionStatus as string when reporting mempool inclusion status (#11133) 2022-04-20 11:39:38 -07:00
dustinfaceandGitHub 7a8cae2936 pools: Fix plotnft claim command's output (#10609)
If you currently claim rewards `claim_cmd` fails to print the txhash 
with the lookup hint in `submit_tx_with_confirmation`

```
Error performing operation on Plot NFT -f 172057028 wallet id: 12: 
'dict' object has no attribute 'name'
```

Because `submit_tx_with_confirmation` expects a `TransactionRecord` as 
result from its callable parameter `func` but `pw_absorb_rewards` 
returns a dict which includes the `TransactionRecord` as value for the 
key `transaction`. This PR makes sure all other methods used as `func` 
callable have the same return behaviour as `pw_absorb_rewards`. We could 
have adjusted it the other way around (only return `TransactionRecord` 
in `pw_absorb_rewards`) but then we would drop information in the RPC 
client.  


With this PR you get:

```
Do chia wallet get_transaction -f 172057028 -tx 
0x34f74a1ffd9da9a493b78463e635996fd03d4f805ade583acb9764df73355f9c to 
get status
```
2022-03-10 11:10:03 -08:00
41717337e6 This patch enables fees for the plotnft commands - create, claim, joi… (#9968)
* This patch enables fees for the plotnft commands - create, claim, join, and leave.

It also corrects a mismatch in the wallet code that appeared to expect Announcement objects, but actually required bytes.

* Update to using Announcement class. Publish both claim tx and fee tx for correct wallet accounting.

* Update keysearch for new wallet

* Update test for fee, and update wallet_id invariant

* Rename variable tracking coin in absorb SpendBundle

* Update RPC failure cmdline diagnostic

* Remove fee parameter in sign method. Add publish transaction method. Add  entry in RPC API replies.

* Fix fee tx in absorb. Update absorb tests to test for fees

* conflict

* lint

Co-authored-by: William Blanke <wjb98672@gmail.com>
2022-02-14 20:07:06 -08:00
Mariano SorgenteandGitHub 34edf6e35e pool_wallet: Deterministic derivation of auth key, and only count poo… (#9922)
* pool_wallet: Deterministic derivation of auth key, and only count poolWallets for indeces

* cli: Use the same limit for cli creation

* farmer: no more auth keys in config

* farmer: handle case of no authentication sk

* farmer: remove async, and fix test

* lint

* test: Add a test for many pool wallets, and user store

* test: Wait for wallet to be synced in test

* wallet: fix startup (no dns servers) and change to server checking of plotnfts

* cli: change to server checking

* tests: fix user store test

* Improve caching

* PR comments

* Remove useless class

* Try to fix test again
2022-01-30 12:31:55 -05:00
Jack NelsonandGitHub 467478ef75 add limit to creation of plotNFT's from the CLI (#9857)
* add limit to creation.

limit is 20 and can be overridden with --override_limit

* Fix english lint

* Update plotnft_funcs.py

* Update plotnft_funcs.py
2022-01-20 09:21:16 -05:00
c1166584a7 Add ability to change payout address using cli. (#9835)
* Add change payout address

Tested and working on testnet10

* correct small mistake

* Update plotnft_funcs.py

* Update plotnft_funcs.py

* Make code look better

Thanks for the idea Quex.

Co-Authored-By: Matt Hauff <quexington@gmail.com>

* add auto switching from central server

* Revert "add auto switching from central server"

This reverts commit 93f10a35c8.

* Update plotnft_funcs.py

Co-authored-by: Matt Hauff <quexington@gmail.com>
2022-01-19 11:39:21 -08:00
Kyle AltendorfandGitHub 5eeec865e9 stub and use SizedBytes.fromhex() until upstream is released (#9458)
* stub SizedBytes.fromhex() until upstream is released

https://github.com/python/typeshed/pull/6201

* black

* more

* more

* more

* more

* more

* import TYPE_CHECKING via from

* more

* more

* catch up
2021-12-10 14:59:49 -08:00
Kyle AltendorfandGitHub b998193c7e create and use SizedBytes.from_hexstr() (bytes32) (#9467)
* create and use SizedBytes.from_hexstr() (bytes32)

* another

* more

* more
2021-12-07 07:54:26 -08:00
Kyle AltendorfandGitHub 8291f0221a Make the sized bytes types hint compatible (#9369)
* Rework sized bytes for type hinting compatibility

* add a bunch of type: ignores

* this will be handled elsewhere

* noqa E501 instead of changing code

* normalize comment plurality

* @classmethod

* Revert "@classmethod"

This reverts commit 95db80e339.

* add ignore in benchmarks

* just E501 again...

* add some new type: ignores
2021-12-02 09:43:39 -08:00
Adam KellyandGitHub 869f39893c Plotnft fees cmdline fix (#9129)
* Add fees to plotnft commandline and RPCs

* Return calculated fee based on number of transactions

* Extend tests to support fees. Default fee to 0 if not present in RPC call.

* Make plotnft cmdline fees use XCH, like

* fix validator

* cmdline tests

* Remove duplicate option
2021-11-04 15:29:11 -07:00
Adam KellyandGitHub 996f518810 Plotnft fees (#9116)
* Add fees to plotnft commandline and RPCs

* Return calculated fee based on number of transactions

* Extend tests to support fees. Default fee to 0 if not present in RPC call.
2021-11-04 10:44:36 -07:00
Kyle AltendorfandGitHub 597068f400 Add points found 24h to CLI reporting (#7905)
* Add points found 24h to CLI reporting

The points_found_24h seems to include more data than that so first it
gets filtered down to the past 24 hours.  This additionally affects the
existing percent successful points 24 hours number.  Which is actually
the percent of partials successful, not points.  This could differ a bit
if the difficulty is changed during the relevant period.

* remove 24 hour data truncation

To be handled by #7906 or similar.

https://github.com/Chia-Network/chia-blockchain/pull/7906

* cleanup

* shorten lines for linting

* success_pct = 0.0 for mypy
2021-10-04 10:49:26 -07:00