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 }; return { ...state };
} }
if (command === "state_changed" && data.state === "tx_update") { if (command === "state_changed" && data.state === "tx_update") {
console.log("Got tx update!", data);
const id = data.wallet_id; const id = data.wallet_id;
wallets = state.wallets; wallets = state.wallets;
wallet = wallets[parseInt(id)]; wallet = wallets[parseInt(id)];

View File

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

View File

@ -75,7 +75,7 @@ async def wallet_loop(wallet_client):
print(f"{i+1}) {fp}") print(f"{i+1}) {fp}")
val = None val = None
while val is 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": if val == "q":
return return
if not val.isdigit(): if not val.isdigit():

View File

@ -324,7 +324,7 @@ class WalletStateManager:
break break
puzzlehash: bytes32 = puzzle.get_tree_hash() puzzlehash: bytes32 = puzzle.get_tree_hash()
self.log.info( 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( derivation_paths.append(
DerivationRecord( DerivationRecord(