Merge branch 'new_back_new'
This commit is contained in:
commit
867e7fdc9e
5 changed files with 202 additions and 112 deletions
0
User/user.go
Executable file → Normal file
0
User/user.go
Executable file → Normal file
0
User/user.yml
Executable file → Normal file
0
User/user.yml
Executable file → Normal file
|
@ -7,23 +7,104 @@ import json
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
def compile_and_deploy_contract(
|
||||||
|
user_path: str,
|
||||||
|
post_path: str,
|
||||||
|
comment_path: str,
|
||||||
|
password: str,
|
||||||
|
node_wallet: str,
|
||||||
|
run_start_funcs: bool=False
|
||||||
|
) -> dict[str, str]:
|
||||||
|
|
||||||
|
user_compile_command = f"sshpass -p {password} neo-go contract compile -i {user_path}/user.go -c {user_path}/user.yml -m {user_path}/user.json"
|
||||||
|
subprocess.run(user_compile_command, shell=True, check=False)
|
||||||
|
user_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {user_path}/user.nef -w {node_wallet} -r http://localhost:30333 -m {user_path}/user.json --force"
|
||||||
|
proc = subprocess.Popen(user_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
user_out_list = []
|
||||||
|
while True:
|
||||||
|
line = proc.stdout.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
user_out_list.append(line.rstrip())
|
||||||
|
|
||||||
|
user_hash = str(user_out_list[-1], encoding='utf-8').replace("Contract: ", "")
|
||||||
|
|
||||||
|
post_compile_command = f"sshpass -p {password} neo-go contract compile -i {post_path}/post_contract.go -c {post_path}/post_contract.yml -m {post_path}/post_contract.json"
|
||||||
|
subprocess.run(post_compile_command, shell=True, check=False)
|
||||||
|
post_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {post_path}/post_contract.nef -w {node_wallet} -r http://localhost:30333 -m {post_path}/post_contract.json --force"
|
||||||
|
proc = subprocess.Popen(post_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
post_out_list = []
|
||||||
|
while True:
|
||||||
|
line = proc.stdout.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
post_out_list.append(line.rstrip())
|
||||||
|
|
||||||
|
post_hash = str(post_out_list[-1], encoding='utf-8').replace("Contract: ", "")
|
||||||
|
|
||||||
|
comment_compile_command = f"sshpass -p {password} neo-go contract compile -i {comment_path}/comment.go -c {comment_path}/comment.yml -m {comment_path}/comment.json"
|
||||||
|
subprocess.run(comment_compile_command, shell=True, check=False)
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {comment_path}/comment.nef -w {node_wallet} -r http://localhost:30333 -m {comment_path}/comment.json --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_out_list = []
|
||||||
|
while True:
|
||||||
|
line = proc.stdout.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
comment_out_list.append(line.rstrip())
|
||||||
|
|
||||||
|
comment_hash = str(comment_out_list[-1], encoding='utf-8').replace("Contract: ", "")
|
||||||
|
|
||||||
|
print(user_hash, post_hash, comment_hash)
|
||||||
|
|
||||||
|
if run_start_funcs:
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w {node_wallet} -r http://localhost:30333 {user_hash} newUser user_test1 user_test1 user_test1 1 Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w {node_wallet} -r http://localhost:30333 {user_hash} newUser user_test2 user_test2 user_test2 1 Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w {node_wallet} -r http://localhost:30333 {post_hash} newPost user_test1 test test --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w {node_wallet} -r http://localhost:30333 {post_hash} newPost user_test2 test test --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w {node_wallet} -r http://localhost:30333 {comment_hash} createNewComment user_test1 post_1 some_text --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w {node_wallet} -r http://localhost:30333 {comment_hash} createNewComment user_test1 post_1 some_text --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w {node_wallet} -r http://localhost:30333 {comment_hash} createNewComment user_test2 post_1 some_text --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
return user_hash, post_hash, comment_hash
|
||||||
|
|
||||||
|
|
||||||
|
user_hash, post_hash, comment_hash = compile_and_deploy_contract(
|
||||||
|
"../User",
|
||||||
|
"../Post",
|
||||||
|
"../Comment",
|
||||||
|
"one",
|
||||||
|
"/home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json",
|
||||||
|
True
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
|
|
||||||
with open("./route.json", "r") as f:
|
with open("./route.json", "r") as f:
|
||||||
route_dict = json.load(f)
|
route_dict = json.load(f)
|
||||||
|
|
||||||
with open("suka_logs.log", "w") as f:
|
with open("logs.log", "w") as f:
|
||||||
f.write("starting...")
|
f.write("starting...")
|
||||||
|
|
||||||
user_hash, post_hash, comment_hash = compile_and_deploy_contract(
|
with open("logs.log", "a") as f:
|
||||||
"../User",
|
|
||||||
"../Post",
|
|
||||||
"../Comment",
|
|
||||||
"one"
|
|
||||||
)
|
|
||||||
|
|
||||||
with open("suka_logs.log", "a") as f:
|
|
||||||
f.write(f"user_hash: {user_hash}\npost_hash: {post_hash}\ncomment_hash: {comment_hash}")
|
f.write(f"user_hash: {user_hash}\npost_hash: {post_hash}\ncomment_hash: {comment_hash}")
|
||||||
|
|
||||||
parsed_path = urlparse(self.path)
|
parsed_path = urlparse(self.path)
|
||||||
|
@ -32,8 +113,9 @@ class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
if "command_type" in query and "command_id" in query:
|
if "command_type" in query and "command_id" in query:
|
||||||
self.send_response(200)
|
self.send_response(200)
|
||||||
self.send_header("Content-type", "text/html")
|
self.send_header("Content-type", "text/html")
|
||||||
|
self.send_header("Access-Control-Allow-Origin", "*")
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
|
|
||||||
params = query.get("args", None)
|
params = query.get("args", None)
|
||||||
parsed_params = " " + ' '.join(params) if params else ""
|
parsed_params = " " + ' '.join(params) if params else ""
|
||||||
|
|
||||||
|
@ -41,7 +123,7 @@ class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
contract_name = query["contract"][0]
|
contract_name = query["contract"][0]
|
||||||
method = query["method"][0]
|
method = query["method"][0]
|
||||||
|
|
||||||
with open("suka_logs.log", "a") as f:
|
with open("logs.log", "a") as f:
|
||||||
f.write("reading params...\n")
|
f.write("reading params...\n")
|
||||||
|
|
||||||
if command_type == "get":
|
if command_type == "get":
|
||||||
|
@ -53,13 +135,15 @@ class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
elif contract_name == "comment":
|
elif contract_name == "comment":
|
||||||
hash_for_req = comment_hash
|
hash_for_req = comment_hash
|
||||||
|
|
||||||
with open("suka_logs.log", "a") as f:
|
with open("logs.log", "a") as f:
|
||||||
f.write(f"params: {[command_type, contract_name, method, parsed_params]}\n")
|
f.write(f"params: {[command_type, contract_name, method, parsed_params]}\n")
|
||||||
|
|
||||||
command = f"neo-go contract testinvokefunction -r http://localhost:30333 {hash_for_req} {method}{parsed_params}"
|
command = f"neo-go contract testinvokefunction -r http://localhost:30333 {hash_for_req} {method}{parsed_params}"
|
||||||
|
|
||||||
|
print(command)
|
||||||
|
|
||||||
proc = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
proc = subprocess.Popen(command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
out_list = []
|
out_list = []
|
||||||
while True:
|
while True:
|
||||||
if proc.stdout is None:
|
if proc.stdout is None:
|
||||||
|
@ -74,37 +158,44 @@ class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
answer = " ".join(map(lambda x: x.decode("utf-8"), out_list))
|
answer = " ".join(map(lambda x: x.decode("utf-8"), out_list))
|
||||||
answer = re.sub(r"[\n\t\s]*", "", answer)
|
answer = re.sub(r"[\n\t\s]*", "", answer)
|
||||||
|
|
||||||
answer_dict = json.loads(answer)["stack"][0]["value"]
|
print(json.loads(answer)["stack"][0])
|
||||||
|
|
||||||
answer_list = []
|
if json.loads(answer)["stack"][0]["type"] == "Struct":
|
||||||
for obj_i in answer_dict:
|
answer_dict = json.loads(answer)["stack"][0]["value"]
|
||||||
obj = obj_i["value"]
|
|
||||||
obj_fiedls = []
|
obj_fiedls = []
|
||||||
for field in obj:
|
for field in answer_dict:
|
||||||
if field["type"] in ["ByteString", "Buffer"]:
|
if field["type"] in ["ByteString", "Buffer"]:
|
||||||
encoded_string = field["value"]
|
encoded_string = field["value"]
|
||||||
result_string = base64.b64decode(encoded_string)
|
result_string = base64.b64decode(encoded_string)
|
||||||
result_string = result_string.decode('utf-8')
|
try:
|
||||||
|
result_string = result_string.decode('utf-8')
|
||||||
|
except:
|
||||||
|
pass
|
||||||
obj_fiedls.append(result_string)
|
obj_fiedls.append(result_string)
|
||||||
elif field["type"] == "Integer":
|
elif field["type"] == "Integer":
|
||||||
encoded_string = field["value"]
|
encoded_string = field["value"]
|
||||||
obj_fiedls.append(encoded_string)
|
obj_fiedls.append(encoded_string)
|
||||||
|
|
||||||
answer_list.append(obj_fiedls)
|
|
||||||
|
|
||||||
self.wfile.write(bytes(f"answer: {obj_fiedls}", "utf-8"))
|
|
||||||
|
|
||||||
|
|
||||||
# elif command_type == "post":
|
|
||||||
# command = commands_route["7"]["command"] + f"-r http://localhost:30333 {contract_name} {method} {' '.join(params[5:])}"
|
|
||||||
|
|
||||||
|
self.wfile.write(bytes(f"{obj_fiedls}", "utf-8"))
|
||||||
# if command_type == "post":
|
else:
|
||||||
# command = commands_route[command_code]
|
answer_dict = json.loads(answer)["stack"][0]["value"]
|
||||||
# else:
|
answer_list = []
|
||||||
|
for obj_i in answer_dict:
|
||||||
|
obj = obj_i["value"]
|
||||||
|
obj_fiedls = []
|
||||||
|
for field in obj:
|
||||||
|
if field["type"] in ["ByteString", "Buffer"]:
|
||||||
|
encoded_string = field["value"]
|
||||||
|
result_string = base64.b64decode(encoded_string)
|
||||||
|
result_string = result_string.decode('utf-8')
|
||||||
|
obj_fiedls.append(result_string)
|
||||||
|
elif field["type"] == "Integer":
|
||||||
|
encoded_string = field["value"]
|
||||||
|
obj_fiedls.append(encoded_string)
|
||||||
|
|
||||||
# user_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {user_path}/user.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m {user_path}/user.json --force"
|
answer_list.append(obj_fiedls)
|
||||||
# proc = subprocess.Popen(user_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
self.wfile.write(bytes(f"{answer_list}", "utf-8"))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.send_response(400)
|
self.send_response(400)
|
||||||
|
@ -113,83 +204,6 @@ class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler):
|
||||||
self.wfile.write(bytes("Bad request", "utf-8"))
|
self.wfile.write(bytes("Bad request", "utf-8"))
|
||||||
|
|
||||||
|
|
||||||
def compile_and_deploy_contract(
|
|
||||||
user_path: str,
|
|
||||||
post_path: str,
|
|
||||||
comment_path: str,
|
|
||||||
password: str,
|
|
||||||
) -> dict[str, str]:
|
|
||||||
|
|
||||||
user_compile_command = f"sshpass -p {password} neo-go contract compile -i {user_path}/user.go -c {user_path}/user.yml -m {user_path}/user.json"
|
|
||||||
subprocess.run(user_compile_command, shell=True, check=False)
|
|
||||||
user_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {user_path}/user.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m {user_path}/user.json --force"
|
|
||||||
proc = subprocess.Popen(user_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
user_out_list = []
|
|
||||||
while True:
|
|
||||||
line = proc.stdout.readline()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
user_out_list.append(line.rstrip())
|
|
||||||
|
|
||||||
user_hash = str(user_out_list[-1], encoding='utf-8').replace("Contract: ", "")
|
|
||||||
|
|
||||||
post_compile_command = f"sshpass -p {password} neo-go contract compile -i {post_path}/post_contract.go -c {post_path}/post_contract.yml -m {post_path}/post_contract.json"
|
|
||||||
subprocess.run(post_compile_command, shell=True, check=False)
|
|
||||||
post_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {post_path}/post_contract.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m {post_path}/post_contract.json --force"
|
|
||||||
proc = subprocess.Popen(post_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
post_out_list = []
|
|
||||||
while True:
|
|
||||||
line = proc.stdout.readline()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
post_out_list.append(line.rstrip())
|
|
||||||
|
|
||||||
post_hash = str(post_out_list[-1], encoding='utf-8').replace("Contract: ", "")
|
|
||||||
|
|
||||||
comment_compile_command = f"sshpass -p {password} neo-go contract compile -i {comment_path}/comment.go -c {comment_path}/comment.yml -m {comment_path}/comment.json"
|
|
||||||
subprocess.run(comment_compile_command, shell=True, check=False)
|
|
||||||
comment_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {comment_path}/comment.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m {comment_path}/comment.json --force"
|
|
||||||
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
comment_out_list = []
|
|
||||||
while True:
|
|
||||||
line = proc.stdout.readline()
|
|
||||||
if not line:
|
|
||||||
break
|
|
||||||
comment_out_list.append(line.rstrip())
|
|
||||||
|
|
||||||
comment_hash = str(comment_out_list[-1], encoding='utf-8').replace("Contract: ", "")
|
|
||||||
|
|
||||||
print(user_hash, post_hash, comment_hash)
|
|
||||||
|
|
||||||
########################################
|
|
||||||
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {user_hash} newUser hui228336 hui228336 hui228336 1 Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn"
|
|
||||||
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {user_hash} newUser hui1488 hui1488 hui1488 1 Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn"
|
|
||||||
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {post_hash} newPost hui228336 hui hui"
|
|
||||||
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {post_hash} newPost hui228336 hui22 hui22"
|
|
||||||
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {comment_hash} createNewComment hui228336 post_1 some_text"
|
|
||||||
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {comment_hash} createNewComment hui1488 post_1 some_text"
|
|
||||||
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
|
|
||||||
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {comment_hash} createNewComment hui1488 post_1 some_text"
|
|
||||||
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
|
||||||
########################################
|
|
||||||
|
|
||||||
return user_hash, post_hash, comment_hash
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
PORT = 2281
|
PORT = 2281
|
||||||
Handler = MyHttpRequestHandler
|
Handler = MyHttpRequestHandler
|
||||||
|
|
|
@ -5,10 +5,10 @@ response = requests.get(
|
||||||
'http://localhost:2281',
|
'http://localhost:2281',
|
||||||
params={
|
params={
|
||||||
"command_type": "get",
|
"command_type": "get",
|
||||||
"method": "getAllPosts",
|
"method": "getPost",
|
||||||
"command_id": "8",
|
"command_id": "8",
|
||||||
"contract": "post",
|
"contract": "post",
|
||||||
"args": []})
|
"args": ["post_1"]})
|
||||||
|
|
||||||
# Выводим ответ от сервера
|
# Выводим ответ от сервера
|
||||||
print('Ответ от сервера:', response.text)
|
print('Ответ от сервера:', response.text)
|
||||||
|
|
76
backend/start.py
Normal file
76
backend/start.py
Normal file
|
@ -0,0 +1,76 @@
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
|
||||||
|
user_path = "../User"
|
||||||
|
post_path = "../Post"
|
||||||
|
comment_path = "../Comment"
|
||||||
|
|
||||||
|
password = "one"
|
||||||
|
|
||||||
|
user_compile_command = f"sshpass -p {password} neo-go contract compile -i {user_path}/user.go -c {user_path}/user.yml -m {user_path}/user.json"
|
||||||
|
subprocess.run(user_compile_command, shell=True, check=False)
|
||||||
|
user_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {user_path}/user.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m {user_path}/user.json --force"
|
||||||
|
proc = subprocess.Popen(user_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
user_out_list = []
|
||||||
|
while True:
|
||||||
|
line = proc.stdout.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
user_out_list.append(line.rstrip())
|
||||||
|
|
||||||
|
user_hash = str(user_out_list[-1], encoding='utf-8').replace("Contract: ", "")
|
||||||
|
|
||||||
|
post_compile_command = f"sshpass -p {password} neo-go contract compile -i {post_path}/post_contract.go -c {post_path}/post_contract.yml -m {post_path}/post_contract.json"
|
||||||
|
subprocess.run(post_compile_command, shell=True, check=False)
|
||||||
|
post_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {post_path}/post_contract.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m {post_path}/post_contract.json --force"
|
||||||
|
proc = subprocess.Popen(post_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
post_out_list = []
|
||||||
|
while True:
|
||||||
|
line = proc.stdout.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
post_out_list.append(line.rstrip())
|
||||||
|
|
||||||
|
post_hash = str(post_out_list[-1], encoding='utf-8').replace("Contract: ", "")
|
||||||
|
|
||||||
|
comment_compile_command = f"sshpass -p {password} neo-go contract compile -i {comment_path}/comment.go -c {comment_path}/comment.yml -m {comment_path}/comment.json"
|
||||||
|
subprocess.run(comment_compile_command, shell=True, check=False)
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract deploy -i {comment_path}/comment.nef -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 -m {comment_path}/comment.json --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_out_list = []
|
||||||
|
while True:
|
||||||
|
line = proc.stdout.readline()
|
||||||
|
if not line:
|
||||||
|
break
|
||||||
|
comment_out_list.append(line.rstrip())
|
||||||
|
|
||||||
|
comment_hash = str(comment_out_list[-1], encoding='utf-8').replace("Contract: ", "")
|
||||||
|
|
||||||
|
print(user_hash, post_hash, comment_hash)
|
||||||
|
|
||||||
|
|
||||||
|
########################################
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {user_hash} newUser hui228336 hui228336 hui228336 1 Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn--force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {user_hash} newUser hui1488 hui1488 hui1488 1 Nhfg3TbpwogLvDGVvAvqyThbsHgoSUKwtn--force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {post_hash} newPost hui228336 hui hui --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {post_hash} newPost hui228336 hui22 hui22 --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {comment_hash} createNewComment hui228336 post_1 some_text --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {comment_hash} createNewComment hui1488 post_1 some_text --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
|
||||||
|
comment_deploy_command = f"sshpass -p {password} neo-go contract invokefunction -w /home/ftmi-krasotka/Desktop/frostfs_test/frostfs-aio/morph/node-wallet.json -r http://localhost:30333 {comment_hash} createNewComment hui1488 post_1 some_text --force"
|
||||||
|
proc = subprocess.Popen(comment_deploy_command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||||
|
########################################
|
Loading…
Reference in a new issue