lunalib 1.1.0__py3-none-any.whl → 1.5.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lunalib/gtx/genesis.py CHANGED
@@ -90,7 +90,7 @@ class GTXGenesis:
90
90
  if signature == expected_signature:
91
91
  signature_valid = True
92
92
  verification_method = "metadata_hash_signature"
93
- print(f"Verified: hash(public_key + metadata_hash)")
93
+ print(f"Verified: hash(public_key + metadata_hash)")
94
94
 
95
95
  # METHOD 3: Check DigitalBill calculated hash
96
96
  elif signature_valid is None:
@@ -122,23 +122,23 @@ class GTXGenesis:
122
122
  if signature == calculated_hash:
123
123
  signature_valid = True
124
124
  verification_method = "digital_bill_calculate_hash"
125
- print(f"Verified: DigitalBill.calculate_hash()")
125
+ print(f"Verified: DigitalBill.calculate_hash()")
126
126
  print(f" Calculated hash: {calculated_hash}")
127
127
 
128
128
  # Approach 2: Use the verify() method (checks all signature types)
129
129
  elif digital_bill.verify():
130
130
  signature_valid = True
131
131
  verification_method = "digital_bill_verify_method"
132
- print(f"Verified: DigitalBill.verify()")
132
+ print(f"Verified: DigitalBill.verify()")
133
133
 
134
134
  # Approach 3: Check if signature matches metadata_hash generation
135
135
  elif signature == digital_bill._generate_metadata_hash():
136
136
  signature_valid = True
137
137
  verification_method = "digital_bill_metadata_hash"
138
- print(f"Verified: matches generated metadata_hash")
138
+ print(f"Verified: matches generated metadata_hash")
139
139
 
140
140
  else:
141
- print(f"DigitalBill verification failed:")
141
+ print(f"DigitalBill verification failed:")
142
142
  print(f" Calculated hash: {calculated_hash}")
143
143
  print(f" Signature: {signature}")
144
144
  print(f" Metadata hash: {metadata_hash}")
@@ -173,19 +173,19 @@ class GTXGenesis:
173
173
  if signature == bill_json_hash:
174
174
  signature_valid = True
175
175
  verification_method = "bill_json_hash"
176
- print(f"Verified: hash(bill_data_json)")
176
+ print(f"Verified: hash(bill_data_json)")
177
177
 
178
178
  # Final fallback: accept any non-empty signature temporarily
179
179
  if signature_valid is None and signature and len(signature) > 10:
180
180
  signature_valid = True
181
181
  verification_method = "fallback_accept"
182
- print(f"⚠️ Using fallback acceptance for signature")
182
+ print(f"Using fallback acceptance for signature")
183
183
 
184
184
  # If all methods failed
185
185
  if signature_valid is None:
186
186
  signature_valid = False
187
187
  verification_method = "all_failed"
188
- print(f"All verification methods failed")
188
+ print(f"All verification methods failed")
189
189
 
190
190
  # Return result in same format as endpoint
191
191
  if signature_valid:
lunalib/luna_lib.py CHANGED
@@ -8,6 +8,7 @@ from mining.miner import GenesisMiner
8
8
  from gtx.genesis import GTXGenesis
9
9
  from transactions.transactions import TransactionManager
10
10
  from core.blockchain import BlockchainManager
11
+ from core.mempool import MempoolManager
11
12
 
12
13
 
13
14
  class LunaLib:
@@ -19,6 +20,7 @@ class LunaLib:
19
20
  GTX = GTXGenesis
20
21
  Transaction = TransactionManager
21
22
  Blockchain = BlockchainManager
23
+ Mempool = MempoolManager
22
24
 
23
25
  @staticmethod
24
26
  def get_version():
@@ -33,7 +35,8 @@ class LunaLib:
33
35
  'Miner': 'GenesisMiner - Mining operations',
34
36
  'GTX': 'GTXGenesis - GTX token operations',
35
37
  'Transaction': 'TransactionManager - Transaction handling',
36
- 'Blockchain': 'BlockchainManager - Blockchain operations with endpoint support'
38
+ 'Blockchain': 'BlockchainManager - Blockchain operations with endpoint support',
39
+ 'Mempool': 'MempoolManager - Memory Pool management and endpoint'
37
40
  }
38
41
 
39
42
 
@@ -50,6 +53,10 @@ def create_blockchain_manager(endpoint_url="https://bank.linglin.art"):
50
53
  """Create a blockchain manager with optional endpoint URL"""
51
54
  return BlockchainManager(endpoint_url)
52
55
 
56
+ def create_mempool_manager(endpoint_url="https://bank.linglin.art"):
57
+ """Create a blockchain manager with optional endpoint URL"""
58
+ return MempoolManager(network_endpoints=[endpoint_url])
59
+
53
60
  def get_transaction_manager():
54
61
  """Get transaction manager instance"""
55
62
  return TransactionManager()
@@ -63,9 +70,11 @@ __all__ = [
63
70
  'GTXGenesis',
64
71
  'TransactionManager',
65
72
  'BlockchainManager',
73
+ 'MempoolManager',
66
74
  'create_wallet',
67
75
  'create_miner',
68
76
  'create_blockchain_manager',
77
+ 'create_mempool_manager',
69
78
  'get_transaction_manager'
70
79
  ]
71
80
 
@@ -74,4 +83,5 @@ LunaWallet = LunaWallet
74
83
  GenesisMiner = GenesisMiner
75
84
  GTXGenesis = GTXGenesis
76
85
  TransactionManager = TransactionManager
77
- BlockchainManager = BlockchainManager
86
+ BlockchainManager = BlockchainManager
87
+ MempoolManager = MempoolManager