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