This commit is contained in:
almog 2021-10-01 16:42:19 +03:00
parent 7bbed0f44c
commit 14a8b36207
No known key found for this signature in database
GPG Key ID: CB2C7BBD0071DFDC
2 changed files with 7 additions and 7 deletions

View File

@ -101,13 +101,13 @@ def get_row_cmd(
@create_row_data_option()
@create_table_option()
@create_rpc_port_option()
def insert_row_cmd(
row_data_string: str,
def update_table(
changelist: str,
table_string: str,
data_rpc_port: int,
) -> None:
import asyncio
from chia.cmds.data_funcs import insert_row
from chia.cmds.data_funcs import update
asyncio.run(insert_row(rpc_port=data_rpc_port, table_string=table_string, row_data_string=row_data_string))
asyncio.run(update(rpc_port=data_rpc_port, table_string=table_string, changelist=changelist))

View File

@ -5,7 +5,7 @@ from chia.types.blockchain_format.sized_bytes import bytes32
class DataLayerRpcClient(RpcClient):
async def create_table(self, table: bytes32, name: str) -> Dict:
async def create_table(self, table: bytes32, name: str):
response = await self.fetch("create_table", {"table": table.hex(), "name": name})
return response
@ -13,9 +13,9 @@ class DataLayerRpcClient(RpcClient):
response = await self.fetch("get_row", {"table": table.hex(), "row_hash": row_hash.hex()})
return response
async def insert_row(self, table: bytes32, row_data: bytes) -> Dict:
async def update(self, table: bytes32, changelist: bytes) -> Dict:
response = await self.fetch(
"update",
{"table": table.hex(), "changelist": [{"action": "insert", "row_data": row_data.hex()}]},
{"table": table.hex(), "changelist": changelist},
)
return response