mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-25 06:55:45 +00:00
asset format modified
This commit is contained in:
parent
ec074553fd
commit
f98eb7d463
@ -34,12 +34,12 @@ class TransactionDecompose:
|
|||||||
"metadata": (),
|
"metadata": (),
|
||||||
"asset": "",
|
"asset": "",
|
||||||
"asset_data": (),
|
"asset_data": (),
|
||||||
"is_data": False
|
|
||||||
}
|
}
|
||||||
print(f"Transaction ::::: { self._transaction}")
|
print(f"Transaction ::::: {self._transaction}")
|
||||||
self.if_key = lambda dct, key: False if not key in dct.keys() else dct[key]
|
self.if_key = lambda dct, key: False if not key in dct.keys() else dct[key]
|
||||||
|
|
||||||
def get_map(self, dictionary: dict = None):
|
def get_map(self, dictionary: dict = None):
|
||||||
|
|
||||||
return _save_keys_order(dictionary=dictionary) if dictionary is not None else _save_keys_order(
|
return _save_keys_order(dictionary=dictionary) if dictionary is not None else _save_keys_order(
|
||||||
dictionary=self._transaction)
|
dictionary=self._transaction)
|
||||||
|
|
||||||
@ -51,23 +51,20 @@ class TransactionDecompose:
|
|||||||
self._tuple_transaction["metadata"] = (self._transaction["id"], metadata) if metadata is not None else ()
|
self._tuple_transaction["metadata"] = (self._transaction["id"], metadata) if metadata is not None else ()
|
||||||
|
|
||||||
def __asset_check(self): # ASSET CAN BE VERIFIED BY OPERATION TYPE CREATE OR TRANSFER
|
def __asset_check(self): # ASSET CAN BE VERIFIED BY OPERATION TYPE CREATE OR TRANSFER
|
||||||
|
_operation = self._transaction["operation"]
|
||||||
_asset = self._transaction.get("asset")
|
_asset = self._transaction.get("asset")
|
||||||
print( f"decompose asset : {_asset }")
|
|
||||||
if _asset is None:
|
if _asset is None:
|
||||||
self._tuple_transaction["asset"] = ""
|
self._tuple_transaction["asset"] = ""
|
||||||
print( f"decompose asset :1 {_asset}")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
_id = self.if_key(dct=_asset, key="id")
|
if _operation == "CREATE":
|
||||||
if _id is not False:
|
self._tuple_transaction["asset_data"] = (self._transaction["id"], _asset, self._transaction["id"])
|
||||||
print( f"decompose asset :2 {_asset}")
|
self._tuple_transaction["asset"] = self._transaction["id"]
|
||||||
self._tuple_transaction["asset"] = _id
|
return
|
||||||
|
elif _operation == "TRANSFER":
|
||||||
|
self._tuple_transaction["asset"] = _asset["id"]
|
||||||
return
|
return
|
||||||
|
|
||||||
self._tuple_transaction["is_data"] = True
|
|
||||||
self._tuple_transaction["asset_data"] = (self._transaction["id"], _asset)
|
|
||||||
self._tuple_transaction["asset"] = ""
|
|
||||||
print( f"decompose asset :3 {_asset}")
|
|
||||||
|
|
||||||
def __prepare_inputs(self):
|
def __prepare_inputs(self):
|
||||||
_inputs = []
|
_inputs = []
|
||||||
@ -151,8 +148,8 @@ class TransactionCompose:
|
|||||||
return self.db_results["transaction"][0]
|
return self.db_results["transaction"][0]
|
||||||
|
|
||||||
def _get_asset(self):
|
def _get_asset(self):
|
||||||
# if self._get_transaction_operation() == 'CREATE':
|
# if self._get_transaction_operation() == 'CREATE':
|
||||||
# return None
|
# return None
|
||||||
if len(self.db_results["transaction"][3]) > 0:
|
if len(self.db_results["transaction"][3]) > 0:
|
||||||
print("get_asse 1")
|
print("get_asse 1")
|
||||||
return {
|
return {
|
||||||
@ -206,5 +203,5 @@ class TransactionCompose:
|
|||||||
transaction["inputs"] = self._get_inputs()
|
transaction["inputs"] = self._get_inputs()
|
||||||
transaction["outputs"] = self._get_outputs()
|
transaction["outputs"] = self._get_outputs()
|
||||||
test = transaction["asset"]
|
test = transaction["asset"]
|
||||||
print( f"compose asset : { test }")
|
print(f"compose asset : {test}")
|
||||||
return transaction
|
return transaction
|
||||||
|
|||||||
@ -24,7 +24,9 @@ def test_get_txids_filtered(signed_create_tx, signed_transfer_tx, db_conn):
|
|||||||
# transfer transaction
|
# transfer transaction
|
||||||
create_tx_dict = signed_create_tx.to_dict()
|
create_tx_dict = signed_create_tx.to_dict()
|
||||||
transfer_tx_dict = signed_transfer_tx.to_dict()
|
transfer_tx_dict = signed_transfer_tx.to_dict()
|
||||||
|
print(create_tx_dict)
|
||||||
|
print(" ")
|
||||||
|
print(transfer_tx_dict)
|
||||||
query.store_transactions(signed_transactions=[create_tx_dict], connection=conn)
|
query.store_transactions(signed_transactions=[create_tx_dict], connection=conn)
|
||||||
query.store_transactions(signed_transactions=[transfer_tx_dict], connection=conn)
|
query.store_transactions(signed_transactions=[transfer_tx_dict], connection=conn)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user