Skip to content

Commit

Permalink
ruff fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-o-how committed Dec 23, 2024
1 parent 1dbb15f commit ca142da
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 33 deletions.
2 changes: 1 addition & 1 deletion chia/_tests/wallet/nft_wallet/test_nft_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
from chia.types.mempool_inclusion_status import MempoolInclusionStatus
from chia.util.errors import Err
from chia.wallet.conditions import AssertPuzzleAnnouncement
from chia.wallet.nft_wallet.nft_puzzles import NFT_METADATA_UPDATER, NFT_TRANSFER_PROGRAM_DEFAULT,
from chia.wallet.nft_wallet.nft_puzzle_utils import (
construct_ownership_layer,
create_nft_layer_puzzle_with_curry_params,
metadata_to_program,
)
from chia.wallet.nft_wallet.nft_puzzles import NFT_METADATA_UPDATER, NFT_TRANSFER_PROGRAM_DEFAULT
from chia.wallet.wallet_spend_bundle import WalletSpendBundle

ACS = Program.to(1)
Expand Down
14 changes: 7 additions & 7 deletions chia/_tests/wallet/nft_wallet/test_nft_puzzles.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@
from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.wallet.nft_wallet import uncurry_nft
from chia.wallet.nft_wallet.nft_puzzles import (
NFT_METADATA_UPDATER_HASH,
NFT_OWNERSHIP_LAYER,
NFT_STATE_LAYER_MOD,
NFT_STATE_LAYER_MOD_HASH,
NFT_TRANSFER_PROGRAM_DEFAULT
)
from chia.wallet.nft_wallet.nft_puzzle_utils import (
construct_ownership_layer,
create_full_puzzle,
create_nft_layer_puzzle_with_curry_params,
recurry_nft_puzzle,
)
from chia.wallet.nft_wallet.nft_puzzles import (
NFT_METADATA_UPDATER_HASH,
NFT_OWNERSHIP_LAYER,
NFT_STATE_LAYER_MOD,
NFT_STATE_LAYER_MOD_HASH,
NFT_TRANSFER_PROGRAM_DEFAULT,
)
from chia.wallet.outer_puzzles import match_puzzle
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import puzzle_for_pk, solution_for_conditions
from chia.wallet.singleton import (
Expand Down
7 changes: 2 additions & 5 deletions chia/pools/pool_puzzles.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
from typing import Optional

from chia_puzzles_py.programs import P2_SINGLETON_OR_DELAYED_PUZHASH, POOL_MEMBER_INNERPUZ, POOL_WAITINGROOM_INNERPUZ
from chia_rs import G1Element
from clvm.casts import int_to_bytes

Expand All @@ -15,13 +16,9 @@
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.coin_spend import CoinSpend, compute_additions
from chia.util.ints import uint32, uint64
from chia.wallet.puzzles.singleton_top_layer import puzzle_for_singleton
from chia.wallet.puzzles.singleton_top_layer import SINGLETON_LAUNCHER, SINGLETON_MOD, puzzle_for_singleton
from chia.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash, shatree_atom

from chia_puzzles_py.programs import POOL_MEMBER_INNERPUZ, POOL_WAITINGROOM_INNERPUZ, P2_SINGLETON_OR_DELAYED_PUZHASH

from chia.wallet.puzzles.singleton_top_layer import SINGLETON_MOD, SINGLETON_LAUNCHER

log = logging.getLogger(__name__)
# "Full" is the outer singleton, with the inner puzzle filled in
POOL_WAITING_ROOM_MOD = Program.from_bytes(POOL_WAITINGROOM_INNERPUZ)
Expand Down
2 changes: 1 addition & 1 deletion chia/wallet/db_wallet/db_wallet_puzzles.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.types.condition_opcodes import ConditionOpcode
from chia.util.ints import uint64
from chia.wallet.nft_wallet.nft_puzzles import NFT_STATE_LAYER_MOD
from chia.wallet.nft_wallet.nft_puzzle_utils import create_nft_layer_puzzle_with_curry_params
from chia.wallet.nft_wallet.nft_puzzles import NFT_STATE_LAYER_MOD
from chia.wallet.singleton import (
SINGLETON_LAUNCHER_PUZZLE_HASH,
SINGLETON_TOP_LAYER_MOD,
Expand Down
8 changes: 3 additions & 5 deletions chia/wallet/nft_wallet/nft_puzzle_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import logging
from typing import Any, Literal, Optional, Union


from clvm_tools.binutils import disassemble

from chia.types.blockchain_format.program import Program
Expand All @@ -12,14 +11,14 @@
from chia.util.bech32m import encode_puzzle_hash
from chia.util.ints import uint16, uint64
from chia.wallet.nft_wallet.nft_info import NFTCoinInfo, NFTInfo
from chia.wallet.nft_wallet.uncurry_nft import UncurriedNFT
from chia.wallet.nft_wallet.nft_puzzles import (
NFT_STATE_LAYER_MOD,
NFT_STATE_LAYER_MOD_HASH,
NFT_OWNERSHIP_LAYER,
NFT_OWNERSHIP_LAYER_HASH,
NFT_STATE_LAYER_MOD,
NFT_STATE_LAYER_MOD_HASH,
NFT_TRANSFER_PROGRAM_DEFAULT,
)
from chia.wallet.nft_wallet.uncurry_nft import UncurriedNFT
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import solution_for_conditions
from chia.wallet.singleton import (
SINGLETON_LAUNCHER_PUZZLE_HASH,
Expand All @@ -31,7 +30,6 @@
log = logging.getLogger(__name__)



def create_nft_layer_puzzle_with_curry_params(
metadata: Program, metadata_updater_hash: bytes32, inner_puzzle: Program
) -> Program:
Expand Down
4 changes: 3 additions & 1 deletion chia/wallet/nft_wallet/nft_puzzles.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

from chia_puzzles_py.programs import (
NFT_INTERMEDIATE_LAUNCHER,
NFT_METADATA_UPDATER_DEFAULT,
Expand All @@ -17,4 +19,4 @@
NFT_OWNERSHIP_LAYER = Program.from_bytes(NFT_OWNERSHIP_LAYER_BYTES)
NFT_OWNERSHIP_LAYER_HASH = NFT_OWNERSHIP_LAYER.get_tree_hash()
NFT_TRANSFER_PROGRAM_DEFAULT = Program.from_bytes(NFT_OWNERSHIP_TRANSFER_PROGRAM_ONE_WAY_CLAIM_WITH_ROYALTIES)
INTERMEDIATE_LAUNCHER_MOD = Program.from_bytes(NFT_INTERMEDIATE_LAUNCHER)
INTERMEDIATE_LAUNCHER_MOD = Program.from_bytes(NFT_INTERMEDIATE_LAUNCHER)
1 change: 1 addition & 0 deletions chia/wallet/nft_wallet/nft_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
from chia.wallet.nft_wallet import nft_puzzle_utils
from chia.wallet.nft_wallet.nft_info import NFTCoinInfo, NFTWalletInfo
from chia.wallet.nft_wallet.nft_puzzle_utils import create_ownership_layer_puzzle, get_metadata_and_phs
from chia.wallet.nft_wallet.nft_puzzles import NFT_METADATA_UPDATER
from chia.wallet.nft_wallet.uncurry_nft import NFTCoinData, UncurriedNFT
from chia.wallet.outer_puzzles import AssetType, construct_puzzle, match_puzzle, solve_puzzle
from chia.wallet.payment import Payment
Expand Down
3 changes: 1 addition & 2 deletions chia/wallet/nft_wallet/uncurry_nft.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
from chia.types.coin_spend import CoinSpend
from chia.util.ints import uint16
from chia.util.streamable import Streamable, streamable

from chia.wallet.nft_wallet.nft_puzzles import NFT_STATE_LAYER_MOD as NFT_MOD
from chia.wallet.nft_wallet.nft_puzzles import NFT_OWNERSHIP_LAYER
from chia.wallet.nft_wallet.nft_puzzles import NFT_STATE_LAYER_MOD as NFT_MOD
from chia.wallet.singleton import SINGLETON_TOP_LAYER_MOD

log = logging.getLogger(__name__)
Expand Down
23 changes: 14 additions & 9 deletions chia/wallet/puzzles/clawback/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,20 @@
import logging
from typing import Any, Optional, Union

from chia_puzzles_py.programs import (
AUGMENTED_CONDITION as AUGMENTED_CONDITION_BYTES,
)
from chia_puzzles_py.programs import (
AUGMENTED_CONDITION_HASH as AUGMENTED_CONDITION_HASH_BYTES,
)
from chia_puzzles_py.programs import (
P2_1_OF_N as P2_1_OF_N_BYTES,
)
from chia_puzzles_py.programs import (
P2_PUZZLE_HASH,
P2_PUZZLE_HASH_HASH,
)

from chia.consensus.default_constants import DEFAULT_CONSTANTS
from chia.types.blockchain_format.coin import Coin
from chia.types.blockchain_format.program import Program
Expand All @@ -14,21 +28,12 @@
from chia.util.ints import uint64
from chia.util.streamable import VersionedBlob
from chia.wallet.puzzles.clawback.metadata import ClawbackMetadata
from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile
from chia.wallet.puzzles.p2_delegated_puzzle_or_hidden_puzzle import MOD
from chia.wallet.uncurried_puzzle import UncurriedPuzzle
from chia.wallet.util.curry_and_treehash import calculate_hash_of_quoted_mod_hash, curry_and_treehash
from chia.wallet.util.merkle_tree import MerkleTree
from chia.wallet.util.wallet_types import RemarkDataType

from chia_puzzles_py.programs import (
AUGMENTED_CONDITION as AUGMENTED_CONDITION_BYTES,
AUGMENTED_CONDITION_HASH as AUGMENTED_CONDITION_HASH_BYTES,
P2_1_OF_N as P2_1_OF_N_BYTES,
P2_PUZZLE_HASH,
P2_PUZZLE_HASH_HASH,
)

P2_1_OF_N = Program.from_bytes(P2_1_OF_N_BYTES)
P2_CURRIED_PUZZLE_MOD = Program.from_bytes(P2_PUZZLE_HASH)
P2_CURRIED_PUZZLE_MOD_HASH_QUOTED = calculate_hash_of_quoted_mod_hash(P2_PUZZLE_HASH_HASH)
Expand Down
1 change: 0 additions & 1 deletion chia/wallet/trade_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from chia.wallet.outer_puzzles import AssetType
from chia.wallet.payment import Payment
from chia.wallet.puzzle_drivers import PuzzleInfo, Solver
from chia.wallet.puzzles.load_clvm import load_clvm_maybe_recompile
from chia.wallet.trade_record import TradeRecord
from chia.wallet.trading.offer import NotarizedPayment, Offer
from chia.wallet.trading.trade_status import TradeStatus
Expand Down
3 changes: 2 additions & 1 deletion chia/wallet/util/notifications.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
from __future__ import annotations

from chia_puzzles_py.programs import NOTIFICATION

from chia.types.blockchain_format.program import Program
from chia.types.blockchain_format.sized_bytes import bytes32
from chia.util.ints import uint64
from chia_puzzles_py.programs import NOTIFICATION

NOTIFICATION_MOD = Program.from_bytes(NOTIFICATION)

Expand Down

0 comments on commit ca142da

Please sign in to comment.