Commit Graph
159 Commits
Author SHA1 Message Date
Matt Hauff 47ed91c8ec [LABS-305] Extract signing functionality from wallet RPC to its own library (#20317)
* Extract `verify_signature`

* Extract `sign_message_by_address`

* Extract (most of) `sign_message_by_id`
2025-12-09 11:28:09 -08:00
Matt Hauff 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 Hauff 590be179fc [LABS-161] Add a method for creating outgoing transactions (#20209)
* Add a method for creating outgoing transactions

* Fix some oversights wrt wallet_id
2025-10-31 08:56:15 -07:00
Matt Hauff 657b637544 [LABS-151] Replace NIL with Program.NIL (#20189)
Replace `NIL` with `Program.NIL`
2025-10-24 11:24:28 -07:00
Matt Hauff e8e060b533 [CHIA-3419] Remove TransactionRecord.*_json_dict_convenience (#19860)
* Change `TransactionRecord` to use dict instead of list of tuples for memos

* Update streamable and fix tests

* Update test to accidentally fixed memos generation

* Remove `TransactionRecord.*_json_dict_convenience`

* Fix test

* Use AddressType library in WSM method

* Use AddressType library in transaction_store method
2025-08-05 13:10:52 -07:00
Kyle Altendorf 7a26610e8f less pre-inting for ints (#19853) 2025-07-23 13:18:04 -07:00
Matt Hauff 55165b1163 [CHIA-3418] Change TransactionRecord to use dict instead of list of tuples for memos (#19846)
* Change `TransactionRecord` to use dict instead of list of tuples for memos

* Update streamable and fix tests

* Update test to accidentally fixed memos generation
2025-07-23 13:17:41 -07:00
Matt Hauff 191ccde774 [CHIA-3251] Delete DID recovery endpoints (#19767)
* Port `did_set_wallet_name`

* Port `did_get_wallet_name`

* Port `did_update_recovery_ids`

* Port `did_message_spend`

* Port `did_get_info`

* Port `did_find_lost_did`

* fix test

* Port `did_update_metadata`

* Port `did_get_did`

* Port `did_get_recovery_list`

* Port `did_get_metadata`

* Port `did_get_pubkey`

* Port `did_get_information_needed_for_recovery`

* Port `did_get_current_coin_info`

* Port `did_create_backup_file`

* Port `did_transfer_did`

* Add extra_conditions uniformly in CLI tests

* test coverage

* Delete DID recovery endpoints

* Delete `create_exit_spend` as well

* Missed one
2025-07-18 09:11:15 -07:00
Matt HauffandAmine Khaldi 13d9d62e41 [CHIA-1311] Port DID RPCs to @marshal decorator (#19708)
* Port `did_set_wallet_name`

* Port `did_get_wallet_name`

* Port `did_update_recovery_ids`

* Port `did_message_spend`

* Port `did_get_info`

* Port `did_find_lost_did`

* fix test

* Port `did_update_metadata`

* Port `did_get_did`

* Port `did_get_recovery_list`

* Port `did_get_metadata`

* Port `did_get_pubkey`

* Port `did_get_information_needed_for_recovery`

* Port `did_get_current_coin_info`

* Port `did_create_backup_file`

* Port `did_transfer_did`

* Add extra_conditions uniformly in CLI tests

* test coverage

* Minor changes.

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2025-07-08 11:57:58 -05:00
Earle Lowe a1e695e896 Allow DIDs from other wallets with NIL recovery lists (#19469)
* Somewhat hacky workaounds for DIDs from other wallets

* cannot use set as not hashable

* Add a couple tests

* Change DIDCoinData to use bytes instead of bytes32

* Remove some unused code

* Remove some more unused code

* Make the alternate recovery did spendable I think

* Use Optional[bytes32] for DIDCoinData to show the list should be 32 bytes or nothing (where nothing is the NIL program)

* Replace specific test with parameterization of other tests to get more testing of the Alternate DIDs

* Empty commit for github

* minor formatting change

* No need to cast to bytes since as_atom returns bytes
2025-04-23 09:28:48 -05:00
Kyle Altendorf fcd20ce543 more chia_rs directly (#19520)
* more `chia_rs` directly

* maybe

* undo, kinda
2025-04-21 14:05:05 -05:00
Matt Hauff a6a5a35c7d [CHIA-1251] Add puzzle hash generation to action scopes (#19283)
* (squash) Add puzzle hash generation to action scopes

* Add comment for unused/last_index
2025-04-03 15:34:07 -05:00
Kyle Altendorf d50b6e0883 use chia_rs directly for sized bytes (#19326) 2025-02-28 09:35:25 -08:00
dependabot[bot]andKyle Altendorf bc99c7a283 build(deps): bump mypy from 1.14.1 to 1.15.0 (#19319)
* build(deps): bump mypy from 1.14.1 to 1.15.0

Bumps [mypy](https://github.com/python/mypy) from 1.14.1 to 1.15.0.
- [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python/mypy/compare/v1.14.1...v1.15.0)

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

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

* adjust accordingly

* remove another

* and windows

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kyle Altendorf <sda@fstab.net>
2025-02-28 09:32:34 -08:00
Kyle Altendorf 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
Matt 22b0df5631 Add generate_signed_transaction to WalletProtocol 2025-02-07 15:34:07 -08:00
Matt 7c4b4277a4 Standardize the Wallet API for generate_signed_transaction 2025-01-29 12:42:26 -08:00
Matt Hauff 7c01b87693 [CHIA-2224] Add some extra safety into create_message_spend (#19153)
* Add some extra safety into `create_message_spend`

* Fix a poorly named variable
2025-01-27 09:00:04 -07:00
Matt Hauff c99492cc19 [CHIA-773] Swap out Payment for CreateCoin (#19144)
* Swap out `Payment` for `CreateCoin`

* Fix mypy-exclusions

* tweak
2025-01-27 08:22:29 -07:00
Matt Hauff 0cda424fc2 [CHIA-1934] Remove get_new_* from DIDWallet (#18968)
* remove `get_new_*` from `DIDWallet`

* remove `get_puzzle` entirely
2024-12-04 11:21:14 -07:00
Matt Hauff 9755c46dec [CHIA-1773] Add better reuse_puzhash checking to WalletTestFramework (#18897)
* Add better reuse_puzhash checking to WalletTestFramework

* Do more sophisticated monkeypatching

* Fix `test_did_find_lost_did`

* Add ability to ignore reuse_puzhash enforcement

* Actually fix `test_did_find_lost_did`

* Fix `test_nft_with_did_wallet_creation`

* Fix `test_split_coins`

* Fix `test_did_attest_after_recovery`
2024-11-22 13:05:29 -08:00
Matt Hauff 604fc1feb0 [CHIA-1732] Add Ruff specific linting rules (#18845)
* Add Ruff specific linting rules

* Further tighten ignore list

* Address comments by @altendky

* One more comment @altendky
2024-11-14 15:58:12 -07:00
Kyle Altendorf 3b6f547d45 bytes zeros (#18475)
* `ZERO_32`

* `bytes(\d+)\(\[0\] \* \1\)`

* `bytes(\d+)\(b"\\(x00|0)" \* \1\)`

* `bytes(\d+)\(b"0" \* \1\)`

* Revert "`bytes(\d+)\(b"0" \* \1\)`"

This reverts commit 2d629dcb0a.
2024-10-22 12:07:07 -07:00
Kyle Altendorf 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
matt-o-howandArvid Norberg 5f6c336e75 [CHIA-621] Add a configurable limit to the amount of DIDs that can be automatically added to the users wallet from transfer (#18655)
* add cap to amount of DID wallets that can be automatically created

* add further testing

* add extra tests for recovering discarded DID and making new DIDs above the limit

* lint fix

* add types to test functions

* add log warning when ignoring DID

* typing fixes for tests

* a few more typing fixes

* black

* Update chia/_tests/wallet/did_wallet/test_did.py

Co-authored-by: Arvid Norberg <arvid@libtorrent.org>

* fix wrong wallet node get_wallet() call

* fix rebase

* remove unused typeignore

---------

Co-authored-by: Arvid Norberg <arvid@libtorrent.org>
2024-10-07 11:09:41 -07:00
Geoff Walmsley 4befaf54bc Fix DID balance reporting, and port DID tests to WalletTestFramwork (#18662)
* fix double counting in did balances

* port did_tests to WalletTestFramework

* pylint

* update did tests in test_nft_wallet

* update vc tests
2024-10-03 08:26:33 -07:00
Matt HauffandAmine Khaldi bd021a126b [CHIA-1164] Port test_nft_wallet.py to WalletTestFramework (#18530)
* Port `test_nft_wallet_creation_automatically`

* Port `test_nft_wallet_rpc_creation_and_list`

* Port `test_nft_wallet_rpc_update_metadata`

* Port `test_nft_with_did_wallet_creation`

* Port `test_nft_rpc_mint`

* Port `test_nft_transfer_nft_with_did`

* Port `test_update_metadata_for_nft_did`

* Port `test_update_metadata_for_nft_did`

* Port `test_nft_bulk_set_did`

* Port `test_nft_transfer_nft_with_did`

* Port `test_nft_set_did`

* Port `test_set_nft_status`

* Port `test_nft_sign_message`

* Remove DEFAULT_TX_CONFIG

* Remove unnecessary WalletStateTransitions

* Swap out id variables with aliases

* Whoops

* Remove unused function

* Slightly clearer ResponseFailureError match in test_nft_wallet_rpc_creation_and_list.

* Fix a typo.

* Fix a typo in test_nft_bulk_transfer.

* Clarify the coinbase coins case in get_minter_did.

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2024-09-04 23:45:11 +08:00
Amine Khaldi 8129b41473 CHIA-210 Introduce WalletSpendBundle and use it across code related to wallets (#18264)
Introduce WalletSpendBundle and use it across code related to wallets.
2024-08-30 21:36:26 +08:00
Matt Hauff 64003a63f5 [CHIA-1067] Integrate coin selection with action scopes (#18424)
* Add TXConfig to action scopes

* Fix DID test

* Fix CR-CAT method

* Fix NFT offer test

* Utilize streamable for WalletSideEffects serialization

* Integrate coin selection with action scopes

* Fix action scope test

* Fix DID test

* Fix NFT tests

* Fix NFT tests
2024-08-19 09:02:36 -07:00
Matt Hauff 8bc332f95e [CHIA-1037] Add TXConfig to action scopes (#18406)
* Add TXConfig to action scopes

* Fix DID test

* Fix CR-CAT method

* Fix NFT offer test
2024-08-07 11:27:13 -07:00
Amine Khaldi c4026f93b0 CHIA-907 Augment uncurry_puzzle to accept both types of programs (#18286)
Augment uncurry_puzzle to accept both types of programs.

This allows us to use serialized programs without the need to convert them into programs.
2024-08-01 16:36:28 -07:00
Matt Hauff 055588914e [CHIA-714] Add usage of action scope throughout wallet codebase (#18128)
* Add the concept of 'action scopes'

* Add `WalletActionScope`

* Fix CATWallet pending_change calculation

* Add action_scope: WalletActionScope to all tx endpoints

* Add usage of action scope throughout wallet codebase

* Add the concept of 'action scopes'

* pylint and test coverage

* add try/finally

* add try/except

* Undo giving a variable a name

* Fix CRCAT test

* Fix trade tests

* Fix cat test

* Fix miscellaneous test

* Fix miscellaneous test

* Fix miscellaneous test

* pylint

* Add auto claim test coverage

* Take advantage of extra_spends

* Fix tests

* test fixes

* pylint
2024-07-17 12:17:16 -07:00
Matt Hauff 4ffb6dfa6f [CHIA-713] Add action_scope: WalletActionScope to all tx endpoints (#18127)
* Add the concept of 'action scopes'

* Add `WalletActionScope`

* Fix CATWallet pending_change calculation

* Add action_scope: WalletActionScope to all tx endpoints

* Add the concept of 'action scopes'

* pylint and test coverage

* add try/finally

* add try/except

* Undo giving a variable a name

* Fix CRCAT test

* Fix trade tests

* Fix cat test

* Fix miscellaneous test

* Fix miscellaneous test

* Fix miscellaneous test

* Add auto claim test coverage
2024-07-16 11:06:01 -07:00
a58cc334a4 clvm mypie (#16898)
* clvm mypie

* update exclusions

* wip

* some

* undo for now

* more

* more

* drop the program usage in datalayer tests

* ignore tree hash errors

* ignore enough in _sexp_replace...

* again

* almost

* Fix test_singleton.py

* dl fixup

* did fixup

* touchup

* nft fixup

* fixup tests

* Revert "fixup tests"

This reverts commit 5df1a705ec.

* or this i guess

* blah

* Fix get_owner_did

* tidy

* blah

* `.as_atom()`

* `.as_int()`

* Update chia/wallet/nft_wallet/nft_puzzles.py

* `rrrff`

* stop using `CastableType`

* undo stuff around using `CastableType`

* `announcement_assertions: List[Program]`

* Update chia/types/blockchain_format/program.py

* more

* clvm==0.9.10

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
Co-authored-by: Matt <quexington@gmail.com>
2024-05-22 12:28:07 -05:00
Matt Hauff 1ae00f6644 [CHIA-508] Add tx_config and extra_conditions to DID creation endpoint (#18024)
* Add TXConfig and extra_conditions to DID creation endpoint

* Fix test

* fix test
2024-05-18 11:08:37 -05:00
Arvid Norberg aa576768d6 Puzzle hash optimizations (#17995)
* use the NULL_HASHTREE constant instead of re-computing the hash on the fly

* optimize puzzle hash computations by using shatree_atom() and shatree_pair() directly, rather than constructing a Program to call get_tree_hash() on.

* cache synthetic public keys and private keys

* rename NULL_TREEHASH -> NIL_TREEHASH
2024-05-10 13:45:27 -07:00
Matt Hauff aefe7fdf28 Observer Mode (#17792)
* Observer Mode

* Address comments by @altendky

* Change RPC default and fix test coverage

* Add test coverage for rpc marshaller

* Fix @marshal util to return proper transactions
2024-05-07 13:39:25 -07:00
Geoff Walmsley 11455eef33 Fix DID update metadata bug #17412 (#17527)
* Fix DID update metadata bug #17412

* coverage
2024-02-15 09:40:49 -08:00
Matt Hauff c6f1a57c56 Unify transaction pushing (#17458)
* Don't autopush transactions by default anywhere

* Remove ignore_max_send_amount

* Use TXConfig instead of pending_transactions for coin exclusion in spend_clawback_coins

* Unify transaction pushing into a single method

* Address offline comments by @emlowe

* Rework max send amount to be based on coin quantity rather than amount

* Inadvertent changes

* Test fixes

* Inadvertent change

* Bad import?

* Inadvertent changes?

* readd missing test
2024-02-05 10:34:47 -08:00
Amine Khaldi b846816f26 Don't convert serialized programs to programs before passing them to get_inner_puzzle_from_singleton (#17452)
Don't convert serialized programs to programs before passing them to get_inner_puzzle_from_singleton.
2024-01-31 17:28:01 -08:00
Amine Khaldi 1977c2d7c1 Augment conditions_dict_for_solution and conditions_for_solution to accept both types of programs (#17451)
Augment conditions_dict_for_solution and conditions_for_solution to accept both programs and serialized programs.

This allows us to use serialized programs without the need to convert them into programs.
2024-01-31 17:27:49 -08:00
Matt HauffandAmine Khaldi 9bdc17868d Stop automatic transaction pushing by wallets (#17436)
* Don't autopush transactions by default anywhere

* Remove ignore_max_send_amount

* Use TXConfig instead of pending_transactions for coin exclusion in spend_clawback_coins

* Address offline comments by @emlowe

* Rework max send amount to be based on coin quantity rather than amount

* merge fixes

* Inadvertent diffs

* Inadvertent change

* Inadvertent diff.

---------

Co-authored-by: Amine Khaldi <amine.khaldi@reactos.org>
2024-01-31 12:33:41 -08:00
Matt Hauff aeecaca663 Remove ignore_max_send_amount (#17418)
* Remove ignore_max_send_amount

* Address offline comments by @emlowe

* Rework max send amount to be based on coin quantity rather than amount
2024-01-29 14:31:42 -08:00
Matt 9a44ca926d Merge commit 'f96aaee604072b83c9aae7bcb03a1e3856f4b4cc' into HEAD 2024-01-22 09:59:43 -08:00
Matt Hauff b62d64d572 Subscribe to DIDs that come into wallet (#17299) 2024-01-12 09:40:34 -06:00
Amine Khaldi bb81c0f65b Document the fact that we should be using tx_config and taking a fee in DID's create_attestment (#17212)
Document the fact that we should be using tx_config and taking a fee in DID's create_attestment.
2024-01-09 11:04:12 -06:00
Amine Khaldi d317b47575 Simplify get_new_did_innerpuz (#17148)
Simplify get_new_did_innerpuz.
2024-01-03 12:23:55 -08:00
Amine Khaldi 6d1898ce12 Remove DID wallet's get_frozen_amount (#17151)
Remove DID wallet's get_frozen_amount.

It's not referenced anywhere, and it relies on get_frozen_balance from WSM which doesn't exist.
2024-01-03 12:22:39 -08:00
Amine Khaldi 4a44043638 Bail out earlier if the transaction record has no spend bundle in generate_new_decentralised_id (#17129)
Bail out earlier if the transaction record has no spend bundle in generate_new_decentralised_id.
2023-12-27 09:06:57 -06:00
Amine Khaldi eb445d3a68 Explicitly name fields to improve clarity and avoid mistakes (#17119)
Explicitly name fields to improve clarity and avoid mistakes.
2023-12-21 12:24:53 -06:00