Skip to content

Commit 3f9163e

Browse files
authored
Merge pull request #14 from gaze-network/develop
Release 1.0.0
2 parents 82a20e2 + 0b1cde8 commit 3f9163e

18 files changed

Lines changed: 1618 additions & 471 deletions

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ WORKDIR /usr/src/app
66

77
# Install the libs needed by leveldb
88
RUN apt-get update \
9-
&& apt-get -y install \
9+
&& apt-get -y install \
1010
build-essential libc6-dev libncurses5-dev libncursesw5-dev libreadline-dev libleveldb-dev
1111

1212
RUN python -m venv venv \

electrumx/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
__version__ = "0.1.2"
2-
version = f'gaze-electrumx-v{__version__}'
3-
version_short = __version__
4-
gaze_db_version = 1
1+
__version__ = "1.0.0"
2+
gaze_version = f"gaze-electrumx-v{__version__}"
3+
gaze_version_short = __version__
4+
gaze_db_version = 2
55
gaze_event_hash_version = 1

electrumx/lib/atomicals_blueprint_builder.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ def calculate_outputs_to_color_for_ft_atomical_ids(
7575
# )
7676
atomical_list = order_ft_inputs(ft_atomicals, sort_by_fifo)
7777
next_start_out_idx = 0
78-
potential_atomical_ids_to_output_idxs_map: 'dict[bytes, ExpectedOutputSet]' = {}
78+
potential_atomical_ids_to_output_idxs_map: "dict[bytes, ExpectedOutputSet]" = {}
7979
non_clean_output_slots = False
8080
utxo_cleanly_assigned = True
81-
fts_burned: 'dict[bytes, float]' = {}
81+
fts_burned: "dict[bytes, float]" = {}
8282
for item in atomical_list:
8383
atomical_id = item.atomical_id
8484
# If a target exponent was provided, then use that instead
@@ -176,7 +176,7 @@ def __init__(self, atomical_id: bytes, atomical_type: str, mint_info):
176176
self.type = atomical_type
177177
self.sat_value = 0
178178
self.atomical_value = 0
179-
self.input_indexes: 'list[AtomicalInputItem]' = []
179+
self.input_indexes: "list[AtomicalInputItem]" = []
180180
self.mint_info = mint_info
181181

182182
def __iter__(self):
@@ -413,7 +413,9 @@ def build_nft_input_idx_to_atomical_map(cls, get_atomicals_id_mint_info, atomica
413413
return input_idx_to_atomical_ids_map
414414

415415
@classmethod
416-
def calculate_nft_atomicals_regular(cls, nft_map, nft_atomicals: 'dict[bytes, AtomicalInputSummary]', tx, operations_found_at_inputs, sort_fifo):
416+
def calculate_nft_atomicals_regular(
417+
cls, nft_map, nft_atomicals: "dict[bytes, AtomicalInputSummary]", tx, operations_found_at_inputs, sort_fifo
418+
):
417419
# Use a simplified mapping of NFTs using FIFO to the outputs
418420
if sort_fifo:
419421
next_output_idx = 0
@@ -458,7 +460,7 @@ def calculate_nft_atomicals_regular(cls, nft_map, nft_atomicals: 'dict[bytes, At
458460
return AtomicalNftOutputBlueprintAssignmentSummary(map_output_idxs_for_atomicals)
459461

460462
@classmethod
461-
def calculate_nft_atomicals_splat(cls, nft_atomicals: 'dict[bytes, AtomicalInputSummary]', tx):
463+
def calculate_nft_atomicals_splat(cls, nft_atomicals: "dict[bytes, AtomicalInputSummary]", tx):
462464
# Splat takes all the NFT atomicals across all inputs (including multiple atomicals at the same utxo) and then
463465
# separates them into their own distinctive output such that the result of the operation is no two atomicals
464466
# will share a resulting output. This operation requires that there are at least as many outputs
@@ -801,7 +803,7 @@ def calculate_output_blueprint(
801803
def build_atomical_input_summaries(
802804
cls,
803805
get_atomicals_id_mint_info,
804-
map_atomical_ids_to_summaries: 'dict[bytes, AtomicalInputSummary]',
806+
map_atomical_ids_to_summaries: "dict[bytes, AtomicalInputSummary]",
805807
atomicals_entry_list,
806808
txin_index,
807809
):
@@ -836,7 +838,7 @@ def build_atomical_input_summaries(
836838

837839
@classmethod
838840
def build_atomical_input_summaries_by_type(cls, get_atomicals_id_mint_info, atomicals_spent_at_inputs):
839-
map_atomical_ids_to_summaries: 'dict[bytes, AtomicalInputSummary]' = {}
841+
map_atomical_ids_to_summaries: "dict[bytes, AtomicalInputSummary]" = {}
840842
for txin_index, atomicals_entry_list in atomicals_spent_at_inputs.items():
841843
# Accumulate the total input value by atomical_id
842844
# The value will be used below to determine the amount of input we can allocate for FT's
@@ -847,8 +849,8 @@ def build_atomical_input_summaries_by_type(cls, get_atomicals_id_mint_info, atom
847849
txin_index,
848850
)
849851
# Group the atomicals by NFT and FT for easier handling
850-
nft_atomicals: 'dict[bytes, AtomicalInputSummary]' = {}
851-
ft_atomicals: 'dict[bytes, AtomicalInputSummary]' = {}
852+
nft_atomicals: "dict[bytes, AtomicalInputSummary]" = {}
853+
ft_atomicals: "dict[bytes, AtomicalInputSummary]" = {}
852854
for atomical_id, mint_info in map_atomical_ids_to_summaries.items():
853855
if mint_info.type == "NFT":
854856
nft_atomicals[atomical_id] = mint_info

electrumx/lib/coins.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,11 @@ def header_prevhash(cls, header):
247247
"""Given a header return previous hash"""
248248
return header[4:36]
249249

250+
@classmethod
251+
def header_timestamp(cls, header):
252+
"""Given a header return timestamp"""
253+
return struct.unpack("<I", header[68:72])[0]
254+
250255
@classmethod
251256
def static_header_offset(cls, height):
252257
"""Given a header height return its offset in the headers file.
@@ -464,7 +469,7 @@ def _read_data_placeholders_count(cls, opcodes):
464469
data_placeholders = 0
465470

466471
for opcode in opcodes:
467-
if type(opcode) == tuple:
472+
if type(opcode) is tuple:
468473
data_placeholders += 1
469474
else:
470475
break

electrumx/lib/script2addr.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,17 @@ def get_address_from_output_script(_bytes: bytes) -> Optional[str]:
300300

301301
return None
302302

303+
303304
def get_script_from_address(address: str) -> Optional[bytes]:
304305
# segwit/taproot
305-
if address.startswith(SEGWIT_HRP):
306-
witver, witprog = segwit_addr.decode(SEGWIT_HRP, address)
306+
if address.startswith(get_segwit_hrp()):
307+
witver, witprog = segwit_addr.decode(get_segwit_hrp(), address)
307308
script = segwit_addr.segwit_scriptpubkey(witver, witprog)
308309
return script
309310

310311
# pay-to-public-key
311-
# Serialized public keys are either 65 bytes (130 hex chars) if
312-
# uncompressed/hybrid or 33 bytes (66 hex chars) if compressed.
312+
# Serialized public keys are either 65 bytes (130 hex chars) if
313+
# uncompressed/hybrid or 33 bytes (66 hex chars) if compressed.
313314
if len(address) == 130 or len(address) == 66:
314315
# TODO: not supporting P2PK for now, since get_address_from_output_script() does not support it
315316
return None

electrumx/lib/util_atomicals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2143,4 +2143,4 @@ def safe_int_conversion(x, default=0):
21432143
try:
21442144
return int(x)
21452145
except (ValueError, TypeError):
2146-
return default
2146+
return default

0 commit comments

Comments
 (0)