mirror of
https://github.com/planetmint/planetmint.git
synced 2025-11-24 14:35:45 +00:00
commit
This commit is contained in:
parent
5356cb8ac2
commit
9daed07bd0
@ -64,7 +64,6 @@ def store_transactions(connection, signed_transactions: list):
|
||||
for transaction in signed_transactions:
|
||||
txprepare = TransactionDecompose(transaction)
|
||||
txtuples = txprepare.convert_to_tuple()
|
||||
|
||||
txspace.insert(txtuples["transactions"])
|
||||
|
||||
for _in in txtuples["inputs"]:
|
||||
@ -80,14 +79,12 @@ def store_transactions(connection, signed_transactions: list):
|
||||
metadatasxspace.insert(txtuples["metadata"])
|
||||
|
||||
if txtuples["asset"] is not None:
|
||||
# print(f" ASSET : {txtuples['asset']}")
|
||||
assetsxspace.insert(txtuples["asset"])
|
||||
|
||||
|
||||
@register_query(TarantoolDB)
|
||||
def get_transaction(connection, transaction_id: str):
|
||||
_transactions = _group_transaction_by_ids(txids=[transaction_id], connection=connection)
|
||||
print(f" \n\nGET TRANSACTION : {_transactions} ")
|
||||
return next(iter(_transactions), None)
|
||||
|
||||
|
||||
@ -101,7 +98,7 @@ def get_transactions(connection, transactions_ids: list):
|
||||
def store_metadatas(connection, metadata: list):
|
||||
space = connection.space("meta_data")
|
||||
for meta in metadata:
|
||||
# print(f"METADATA : {meta}")
|
||||
|
||||
data = meta["data"] if not "metadata" in meta else meta["metadata"]
|
||||
if data:
|
||||
space.insert((meta["id"], meta["data"] if not "metadata" in meta else meta["metadata"]))
|
||||
@ -139,10 +136,9 @@ def store_assets(connection, assets: list):
|
||||
space = connection.space("assets")
|
||||
for asset in assets:
|
||||
try:
|
||||
# print(f"DATA store assets: {asset}")
|
||||
space.insert( asset )
|
||||
except : # TODO Raise ERROR for Duplicate
|
||||
print( f"EXCEPTION : ")
|
||||
except Exception as ex: # TODO Raise ERROR for Duplicate
|
||||
print( f"EXCEPTION : {ex} ")
|
||||
|
||||
|
||||
@register_query(TarantoolDB)
|
||||
|
||||
@ -134,7 +134,6 @@ class Planetmint(object):
|
||||
txn_metadatas = []
|
||||
for t in transactions:
|
||||
transaction = t.tx_dict if t.tx_dict else rapidjson.loads(rapidjson.dumps(t.to_dict()))
|
||||
# print(f"transaction {transaction}")
|
||||
|
||||
asset = transaction.pop('asset')
|
||||
asset_id = transaction['id']
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
|
||||
|
||||
import subprocess
|
||||
import os
|
||||
|
||||
|
||||
def test_build_root_docs():
|
||||
|
||||
@ -16,7 +16,6 @@ def txlist(b, user_pk, user2_pk, user_sk, user2_sk):
|
||||
|
||||
# Create two CREATE transactions
|
||||
create1 = Transaction.create([user_pk], [([user2_pk], 6)])
|
||||
print(f"tx1: {create1}")
|
||||
create1 = create1.sign([user_sk])
|
||||
|
||||
create2 = Transaction.create([user2_pk],
|
||||
@ -28,9 +27,6 @@ def txlist(b, user_pk, user2_pk, user_sk, user2_sk):
|
||||
[([user_pk], 8)],
|
||||
create1.id).sign([user2_sk])
|
||||
|
||||
print(f"tx1: {create1}")
|
||||
print(f"tx2: {create2}")
|
||||
print(f"tx3: {transfer1}")
|
||||
b.store_bulk_transactions([create1, create2, transfer1])
|
||||
|
||||
return type('', (), {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user