Skip to content

Commit

Permalink
Merge branch 'master' of github.com:lucky2077/atomicals-electrumx
Browse files Browse the repository at this point in the history
  • Loading branch information
lucky2077 committed Jun 17, 2024
2 parents 495ee1d + 07fddcb commit 63aa451
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
5 changes: 1 addition & 4 deletions electrumx/server/block_processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3897,10 +3897,7 @@ def create_or_delete_subname_payment_output_if_valid(
f"create_or_delete_subname_payment_output_if_valid: valid pattern failed. DeveloperError request_subname={request_subname}, regex={regex}"
)

if not blueprint_builder.are_payments_satisfied(
matched_price_point["matched_rule"].get("o"),
atomicals_spent_at_inputs,
):
if not blueprint_builder.are_payments_satisfied(matched_price_point["matched_rule"].get("o")):
self.logger.warning(
f"create_or_delete_subname_payment_output_if_valid: payments not satisfied. request_subname={request_subname}, regex={regex} atomical_id_for_payment={location_id_bytes_to_compact(atomical_id_for_payment)}"
)
Expand Down
44 changes: 22 additions & 22 deletions electrumx/server/session/session_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,13 +807,13 @@ def validate_raw_tx_blueprint(self, raw_tx, raise_if_burned=True) -> AtomicalsVa
True,
self.bp.is_custom_coloring_activated(self.bp.height),
)
encoded_atomicals_spent_at_inputs = encode_atomical_ids_hex(atomicals_spent_at_inputs)
ft_output_blueprint = blueprint_builder.get_ft_output_blueprint()
nft_output_blueprint = blueprint_builder.get_nft_output_blueprint()
encoded_ft_output_blueprint = auto_encode_bytes_items(encode_atomical_ids_hex(dict(ft_output_blueprint)))
encoded_nft_output_blueprint = auto_encode_bytes_items(encode_atomical_ids_hex(dict(nft_output_blueprint)))
# Log that there were tokens burned due to not being cleanly assigned
if blueprint_builder.get_are_fts_burned() and raise_if_burned:
encoded_atomicals_spent_at_inputs = encode_atomical_ids_hex(atomicals_spent_at_inputs)
encoded_ft_output_blueprint = auto_encode_bytes_items(encode_atomical_ids_hex(ft_output_blueprint))
encoded_nft_output_blueprint = auto_encode_bytes_items(encode_atomical_ids_hex(nft_output_blueprint))
ft_outputs = encoded_ft_output_blueprint["outputs"]
fts_burned = encoded_ft_output_blueprint["fts_burned"]
nft_outputs = encoded_nft_output_blueprint["outputs"]
Expand All @@ -831,9 +831,9 @@ def validate_raw_tx_blueprint(self, raw_tx, raise_if_burned=True) -> AtomicalsVa
return AtomicalsValidation(
tx_hash,
operations_found_at_inputs,
encode_atomical_ids_hex(atomicals_spent_at_inputs),
auto_encode_bytes_items(encode_atomical_ids_hex(ft_output_blueprint)),
auto_encode_bytes_items(encode_atomical_ids_hex(nft_output_blueprint)),
encoded_atomicals_spent_at_inputs,
encoded_ft_output_blueprint,
encoded_nft_output_blueprint,
)

# Helper method to decode the transaction and returns formatted structure.
Expand Down Expand Up @@ -875,13 +875,15 @@ async def transaction_decode_raw_tx_blueprint(
nft_output_blueprint = blueprint_builder.get_nft_output_blueprint()
# Log that there were tokens burned due to not being cleanly assigned
encoded_spent_at_inputs = encode_atomical_ids_hex(atomicals_spent_at_inputs)
encoded_ft_output_blueprint: Dict[str, Dict] = dict(encode_atomical_ids_hex(ft_output_blueprint))
encoded_nft_output_blueprint: Dict[str, Dict] = dict(encode_atomical_ids_hex(nft_output_blueprint))
encoded_ft_output_blueprint: Dict[str, Dict] = encode_atomical_ids_hex(dict(ft_output_blueprint))
encoded_nft_output_blueprint: Dict[str, Dict] = encode_atomical_ids_hex(dict(nft_output_blueprint))
op = found_operations.get("op") or "transfer"
burned = {
**auto_encode_bytes_items(encoded_ft_output_blueprint["fts_burned"]),
**auto_encode_bytes_items(encoded_nft_output_blueprint["nfts_burned"]),
}
burned = auto_encode_bytes_items(
{
**encoded_ft_output_blueprint["fts_burned"],
**encoded_nft_output_blueprint["nfts_burned"],
}
)
ret = {
"op": [op],
"burned": dict(sorted(burned.items())),
Expand All @@ -894,25 +896,23 @@ async def transaction_decode_raw_tx_blueprint(
outputs = {}
for k1, v1 in encoded_spent_at_inputs.items():
for item1 in v1:
atomical_id = item1["atomical_id"]
if atomical_id not in atomicals:
atomicals.append(atomical_id)
id1 = item1["atomical_id"]
if id1 not in atomicals:
atomicals.append(id1)
if not inputs.get(k1):
inputs[k1] = {}
inputs[k1][atomical_id] = item1["data_value"]["atomical_value"]
inputs[k1][id1] = item1["data_value"]["atomical_value"]
ft_outputs: dict = encoded_ft_output_blueprint["outputs"]
for k2, v2 in ft_outputs.items():
for location_bytes, item2 in v2["atomicals"].items():
atomical_id = location_id_bytes_to_compact(location_bytes)
for id2, item2 in v2["atomicals"].items():
if not outputs.get(k2):
outputs[k2] = {}
outputs[k2][atomical_id] = item2.atomical_value
outputs[k2][id2] = item2.atomical_value
for k3, v3 in encoded_nft_output_blueprint["outputs"].items():
for location_bytes, item3 in v3["atomicals"].items():
atomical_id = location_id_bytes_to_compact(location_bytes)
for id3, item3 in v3["atomicals"].items():
if not outputs.get(k3):
outputs[k3] = {}
outputs[k3][atomical_id] = item3.atomical_value
outputs[k3][id3] = item3.atomical_value
mint_info: Optional[Dict] = None
if blueprint_builder.is_mint:
if op in ["dmt", "ft"]:
Expand Down
2 changes: 1 addition & 1 deletion electrumx/version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "1.5.0.0"
__version__ = "1.5.0.2"
electrumx_version = f"ElectrumX {__version__}"
electrumx_version_short = __version__

Expand Down

0 comments on commit 63aa451

Please sign in to comment.