Get UI working

This commit is contained in:
Mariano Sorgente 2020-09-15 01:49:24 +09:00 committed by Gene Hoffman
parent 4159272684
commit fec5aeb010
4 changed files with 25 additions and 23 deletions

View File

@ -245,7 +245,6 @@ export const incomingReducer = (state = { ...initial_state }, action) => {
return { ...state };
}
if (command === "state_changed" && data.state === "tx_update") {
console.log("Got tx update!", data);
const id = data.wallet_id;
wallets = state.wallets;
wallet = wallets[parseInt(id)];

View File

@ -7,32 +7,35 @@ export const mempool_inclusion_status = {
export const get_transaction_result = (transaction) => {
let success = true;
let message = "";
if (!transaction) {
if (!transaction || transaction.transaction.sent_to.length === 0) {
return {
message,
success
}
}
// At least one node has accepted our transaction
for (let full_node_response of transaction.transaction.sent_to) {
console.log("full node response", full_node_response);
if (full_node_response[1] === mempool_inclusion_status["SUCCESS"]) {
return {
"message": "Transaction has successfully been sent to a full node and included in the mempool.",
success: true,
};
}
}
// At least one node has accepted our transaction as pending
for (let full_node_response of transaction.transaction.sent_to) {
if (full_node_response[1] === mempool_inclusion_status["PENDING"]) {
return {
"message": ("Transaction has sent to a full node and is pending inclusion into the mempool. " + full_node_response[2]),
success: true,
};
}
}
// if (send_transaction_result) {
// if (send_transaction_result.status === "SUCCESS") {
// result_message =
// "Transaction has successfully been sent to a full node and included in the mempool.";
// } else if (send_transaction_result.status === "PENDING") {
// result_message =
// "Transaction has sent to a full node and is pending inclusion into the mempool. " +
// send_transaction_result.reason;
// } else {
// result_message = "Transaction failed. " + send_transaction_result.reason;
// result_class = classes.resultFailure;
// }
// }
// No nodes have accepted our transaction, so display the error message of the first
return {
message,
success
}
"message": transaction.transaction.sent_to[0][2],
"success": false,
};
}

View File

@ -75,7 +75,7 @@ async def wallet_loop(wallet_client):
print(f"{i+1}) {fp}")
val = None
while val is None:
val = input("Enter number to pick press q to quite: ")
val = input("Enter a number to pick or q to quit: ")
if val == "q":
return
if not val.isdigit():

View File

@ -324,7 +324,7 @@ class WalletStateManager:
break
puzzlehash: bytes32 = puzzle.get_tree_hash()
self.log.info(
f"Puzzle at index {index} with {wallet_id} puzzle hash {puzzlehash.hex()}"
f"Puzzle at index {index} wallet ID {wallet_id} puzzle hash {puzzlehash.hex()}"
)
derivation_paths.append(
DerivationRecord(