mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2024-09-21 00:24:37 +03:00
fixes
This commit is contained in:
parent
ccf16cb223
commit
2e0fae33c3
@ -218,7 +218,9 @@ def create_ownership_layer_puzzle(
|
||||
)
|
||||
nft_inner_puzzle = p2_puzzle
|
||||
|
||||
nft_ownership_layer_puzzle = construct_ownership_layer(bytes32(did_id), transfer_program, nft_inner_puzzle)
|
||||
nft_ownership_layer_puzzle = construct_ownership_layer(
|
||||
bytes32(did_id) if did_id else None, transfer_program, nft_inner_puzzle
|
||||
)
|
||||
return nft_ownership_layer_puzzle
|
||||
|
||||
|
||||
|
@ -589,18 +589,18 @@ class NFTWallet:
|
||||
) -> Optional[SpendBundle]:
|
||||
self.log.info("Attempt to transfer a new NFT")
|
||||
coin = nft_coin_info.coin
|
||||
self.log.error("Transferring NFT coin %r to puzhash: %s", nft_coin_info.coin, puzzle_hash)
|
||||
self.log.debug("Transferring NFT coin %r to puzhash: %s", nft_coin_info.coin, puzzle_hash)
|
||||
|
||||
amount = coin.amount
|
||||
unft = UncurriedNFT.uncurry(nft_coin_info.full_puzzle)
|
||||
puzzle_hash_to_sign = unft.p2_puzzle.get_tree_hash()
|
||||
if unft.supports_did:
|
||||
self.log.error("Transferring NFT with ownership layer")
|
||||
self.log.debug("Transferring NFT with ownership layer")
|
||||
inner_solution = create_ownership_layer_transfer_solution(int_to_bytes(0), int_to_bytes(0), [], puzzle_hash)
|
||||
else:
|
||||
condition_list = [make_create_coin_condition(puzzle_hash, amount, [puzzle_hash])]
|
||||
inner_solution = Program.to([solution_for_conditions(condition_list), amount])
|
||||
self.log.error("Solution for new coin: %r", disassemble(inner_solution))
|
||||
self.log.debug("Solution for new coin: %r", disassemble(inner_solution))
|
||||
nft_tx_record = await self._make_nft_transaction(
|
||||
nft_coin_info,
|
||||
inner_solution,
|
||||
|
@ -1,7 +1,6 @@
|
||||
from typing import Tuple
|
||||
|
||||
from clvm.casts import int_from_bytes
|
||||
from clvm_tools.binutils import disassemble
|
||||
|
||||
from chia.types.blockchain_format.program import Program
|
||||
from chia.types.blockchain_format.sized_bytes import bytes32
|
||||
@ -37,7 +36,6 @@ def make_a_new_solution() -> Tuple[Program, Program]:
|
||||
p2_puzzle = puzzle_for_pk(destination)
|
||||
puzhash = p2_puzzle.get_tree_hash()
|
||||
new_did = Program.to("test").get_tree_hash()
|
||||
print(f"NEW DID: {new_did.hex()} {puzhash.hex()}")
|
||||
new_did_inner_hash = Program.to("fake").get_tree_hash()
|
||||
trade_prices_list = [[200]]
|
||||
|
||||
@ -86,12 +84,10 @@ def make_a_new_nft_puzzle(curried_ownership_layer: Program, metadata: Program) -
|
||||
def get_updated_nft_puzzle(puzzle: Program, solution: Program) -> bytes32:
|
||||
result = puzzle.run(solution)
|
||||
for condition in result.as_iter():
|
||||
print("Condition: %s" % disassemble(condition))
|
||||
code = int_from_bytes(condition.first().atom)
|
||||
if code == 51:
|
||||
if int_from_bytes(condition.rest().rest().first().atom) == 1:
|
||||
# this is our new puzzle hash
|
||||
print("Found new coin: %s" % disassemble(condition))
|
||||
return bytes32(condition.rest().first().atom)
|
||||
raise ValueError("No create coin condition found")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user