format js files
This commit is contained in:
parent
2a86772207
commit
8bb2ab6fa3
|
@ -92,7 +92,7 @@ export const incomingReducer = (state = { ...initial_state }, action) => {
|
|||
wallet.sending_transaction = false;
|
||||
wallet.send_transaction_result = null;
|
||||
return {
|
||||
...state,
|
||||
...state
|
||||
};
|
||||
case "OUTGOING_MESSAGE":
|
||||
if (
|
||||
|
@ -104,7 +104,7 @@ export const incomingReducer = (state = { ...initial_state }, action) => {
|
|||
wallet.sending_transaction = false;
|
||||
wallet.send_transaction_result = null;
|
||||
return {
|
||||
...state,
|
||||
...state
|
||||
};
|
||||
}
|
||||
return state;
|
||||
|
@ -154,7 +154,12 @@ export const incomingReducer = (state = { ...initial_state }, action) => {
|
|||
var wallets_state = [];
|
||||
for (let object of wallets) {
|
||||
var walletid = parseInt(object.id);
|
||||
var wallet_obj = Wallet(walletid, object.name, object.type, object.data);
|
||||
var wallet_obj = Wallet(
|
||||
walletid,
|
||||
object.name,
|
||||
object.type,
|
||||
object.data
|
||||
);
|
||||
wallets_state[walletid] = wallet_obj;
|
||||
}
|
||||
return { ...state, wallets: wallets_state };
|
||||
|
|
|
@ -109,7 +109,7 @@ export const send_transaction = (wallet_id, amount, fee, address) => {
|
|||
wallet_id: wallet_id,
|
||||
amount: amount,
|
||||
fee: fee,
|
||||
address: address,
|
||||
address: address
|
||||
};
|
||||
return action;
|
||||
};
|
||||
|
@ -132,9 +132,8 @@ export const add_key = (mnemonic, type, file_path) => {
|
|||
return action;
|
||||
};
|
||||
|
||||
|
||||
export const add_new_key_action = (mnemonic) => {
|
||||
return (dispatch) => {
|
||||
export const add_new_key_action = mnemonic => {
|
||||
return dispatch => {
|
||||
return async_api(
|
||||
dispatch,
|
||||
add_key(mnemonic, "new_wallet", null),
|
||||
|
@ -389,14 +388,14 @@ export const get_transactions = wallet_id => {
|
|||
return action;
|
||||
};
|
||||
|
||||
export const get_address = (wallet_id) => {
|
||||
export const get_address = wallet_id => {
|
||||
var action = walletMessage();
|
||||
action.message.command = "get_next_address";
|
||||
action.message.data = { wallet_id: wallet_id };
|
||||
return action;
|
||||
};
|
||||
|
||||
export const farm_block = (address) => {
|
||||
export const farm_block = address => {
|
||||
var action = walletMessage();
|
||||
action.message.command = "farm_block";
|
||||
action.message.data = { address: address };
|
||||
|
|
|
@ -429,7 +429,9 @@ const SendCard = props => {
|
|||
const syncing = useSelector(state => state.wallet_state.status.syncing);
|
||||
const result = get_transaction_result(send_transaction_result);
|
||||
let result_message = result.message;
|
||||
let result_class = result.success ? classes.resultSuccess : classes.resultFailure;
|
||||
let result_class = result.success
|
||||
? classes.resultSuccess
|
||||
: classes.resultFailure;
|
||||
|
||||
function farm() {
|
||||
var address = address_input.value;
|
||||
|
@ -464,10 +466,7 @@ const SendCard = props => {
|
|||
const amount = colouredcoin_to_mojo(amount_input.value);
|
||||
const fee = colouredcoin_to_mojo(fee_input.value);
|
||||
|
||||
if (
|
||||
address.includes("chia_addr") ||
|
||||
address.includes("colour_desc")
|
||||
) {
|
||||
if (address.includes("chia_addr") || address.includes("colour_desc")) {
|
||||
dispatch(
|
||||
openDialog(
|
||||
"Error: recipient address is not a coloured wallet address. Please enter a coloured wallet address"
|
||||
|
@ -496,7 +495,11 @@ const SendCard = props => {
|
|||
const fee_value = parseFloat(Number(fee));
|
||||
|
||||
if (fee_value !== 0) {
|
||||
dispatch(openDialog("Please enter 0 fee. Positive fees not supported yet for coloured coins."));
|
||||
dispatch(
|
||||
openDialog(
|
||||
"Please enter 0 fee. Positive fees not supported yet for coloured coins."
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -700,9 +703,7 @@ const TransactionTable = props => {
|
|||
|
||||
const AddressCard = props => {
|
||||
var id = props.wallet_id;
|
||||
const address = useSelector(
|
||||
state => state.wallet_state.wallets[id].address
|
||||
);
|
||||
const address = useSelector(state => state.wallet_state.wallets[id].address);
|
||||
const classes = useStyles();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
|
|
|
@ -653,7 +653,9 @@ const SendCard = props => {
|
|||
|
||||
const result = get_transaction_result(send_transaction_result);
|
||||
let result_message = result.message;
|
||||
let result_class = result.success ? classes.resultSuccess : classes.resultFailure;
|
||||
let result_class = result.success
|
||||
? classes.resultSuccess
|
||||
: classes.resultFailure;
|
||||
|
||||
function send() {
|
||||
if (sending_transaction) {
|
||||
|
@ -687,7 +689,11 @@ const SendCard = props => {
|
|||
const amount_value = parseFloat(Number(amount));
|
||||
const fee_value = parseFloat(Number(fee));
|
||||
if (fee_value !== 0) {
|
||||
dispatch(openDialog("Please enter 0 fee. Positive fees not supported yet for RL."));
|
||||
dispatch(
|
||||
openDialog(
|
||||
"Please enter 0 fee. Positive fees not supported yet for RL."
|
||||
)
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -145,18 +145,14 @@ const SelectKey = () => {
|
|||
<ListItem
|
||||
button
|
||||
onClick={handleClick(fingerprint)}
|
||||
key={
|
||||
fingerprint.toString()
|
||||
}
|
||||
key={fingerprint.toString()}
|
||||
>
|
||||
<ListItemText
|
||||
className={classes.rightPadding}
|
||||
primary={
|
||||
"Private key with public fingerprint " + fingerprint.toString()
|
||||
}
|
||||
secondary={
|
||||
"Can be backed up to mnemonic seed"
|
||||
}
|
||||
secondary={"Can be backed up to mnemonic seed"}
|
||||
/>
|
||||
<ListItemSecondaryAction>
|
||||
<Tooltip title="See private key">
|
||||
|
|
|
@ -333,7 +333,9 @@ const SendCard = props => {
|
|||
|
||||
const result = get_transaction_result(send_transaction_result);
|
||||
let result_message = result.message;
|
||||
let result_class = result.success ? classes.resultSuccess : classes.resultFailure;
|
||||
let result_class = result.success
|
||||
? classes.resultSuccess
|
||||
: classes.resultFailure;
|
||||
|
||||
function farm() {
|
||||
var address = address_input.value;
|
||||
|
@ -594,9 +596,7 @@ const TransactionTable = props => {
|
|||
|
||||
const AddressCard = props => {
|
||||
var id = props.wallet_id;
|
||||
const address = useSelector(
|
||||
state => state.wallet_state.wallets[id].address
|
||||
);
|
||||
const address = useSelector(state => state.wallet_state.wallets[id].address);
|
||||
const classes = useStyles();
|
||||
const dispatch = useDispatch();
|
||||
|
||||
|
|
|
@ -4,22 +4,23 @@ export const mempool_inclusion_status = {
|
|||
FAILED: 3 // Transaction was invalid and dropped
|
||||
};
|
||||
|
||||
export const get_transaction_result = (transaction) => {
|
||||
export const get_transaction_result = transaction => {
|
||||
let success = true;
|
||||
let message = "";
|
||||
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) {
|
||||
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,
|
||||
message:
|
||||
"Transaction has successfully been sent to a full node and included in the mempool.",
|
||||
success: true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -27,15 +28,17 @@ export const get_transaction_result = (transaction) => {
|
|||
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,
|
||||
message:
|
||||
"Transaction has sent to a full node and is pending inclusion into the mempool. " +
|
||||
full_node_response[2],
|
||||
success: true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// No nodes have accepted our transaction, so display the error message of the first
|
||||
return {
|
||||
"message": transaction.transaction.sent_to[0][2],
|
||||
"success": false,
|
||||
message: transaction.transaction.sent_to[0][2],
|
||||
success: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue