Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improved UX and error handling for wallet configuration #2594

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion components/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interface TextInputProps {
ref?: React.Ref<TextInputRN>;
error?: boolean;
onFocus?: any;
onBlur?: any;
}

const TextInput = React.forwardRef<TextInputRN, TextInputProps>(
Expand All @@ -61,7 +62,9 @@ const TextInput = React.forwardRef<TextInputRN, TextInputProps>(
toggleUnits,
onPressIn,
right,
error
error,
onFocus,
onBlur
} = props;
const defaultStyle = numberOfLines
? {
Expand Down Expand Up @@ -168,6 +171,8 @@ const TextInput = React.forwardRef<TextInputRN, TextInputProps>(
secureTextEntry={secureTextEntry}
onPressIn={onPressIn}
ref={ref}
onFocus={onFocus}
onBlur={onBlur}
/>
{suffix ? (
toggleUnits ? (
Expand Down
4 changes: 4 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@
"general.count": "Count",
"general.experimental": "Experimental",
"general.defaultNodeNickname": "My Lightning Node",
"general.pastedInvalidData": "The pasted text contains characters we can't use here. Please check and try again.",
"general.invalidHost": "Invalid host. Please enter a valid host, or host:port.",
"restart.title": "Restart required",
"restart.msg": "ZEUS has to be restarted before the new configuration is applied.",
"restart.msg1": "Would you like to restart now?",
Expand Down Expand Up @@ -251,6 +253,7 @@
"views.Settings.WalletConfiguration.walletActive": "Wallet Active",
"views.Settings.AddEditNode.scanLndconnect": "Scan lndconnect config",
"views.Settings.AddEditNode.scanLnc": "Scan LNC QR from Lightning Terminal",
"views.Settings.AddEditNode.wrongLncPairingPhraseLength": "A Lightning Node Connect pairing phrase must contain exactly 10 words. Please check and try again.",
"views.Settings.AddEditNode.scanCLightningRest": "Scan c-lightning-REST QR",
"views.Settings.AddEditNode.scanBtcpay": "Scan BTCPay config",
"views.Settings.AddEditNode.scanLndhub": "Scan LNDHub QR",
Expand Down Expand Up @@ -1095,6 +1098,7 @@
"error.failureReasonIncorrectPaymentDetails": "Payment failed: Payment details incorrect (unknown payment hash, invalid amount or invalid final CLTV delta).",
"error.failureReasonIncorrectPaymentDetailsKeysend": "The receiving node might not accept keysend payments.",
"error.failureReasonInsufficientBalance": "Insufficient local balance",
"error.invalidMacaroon": "Invalid macaroon. Please check that you've entered the correct macaroon for this node.",
"pos.views.Wallet.PosPane.noOrders": "No orders open at the moment. To send to ZEUS, mark order as 'Other Payment Type' with a note that includes 'Zeus', 'BTC', or 'Bitcoin'",
"pos.views.Wallet.PosPane.noOrdersStandalone": "No orders open at the moment",
"pos.views.Wallet.PosPane.noOrdersPaid": "No orders have been paid yet",
Expand Down
12 changes: 12 additions & 0 deletions utils/ErrorUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,18 @@ describe('ErrorUtils', () => {
).toEqual(
'Error starting up Tor on your phone. Try restarting Zeus. If the problem persists consider using the Orbot app to connect to Tor, or using an alternative connection method like Lightning Node Connect or Tailscale.'
);
expect(
errorToUserFriendly(
Object.assign(new Error(), {
message:
'Error: {"code":2,"message":"verification failed: signature mismatch after caveat verification","details":[]}',
name: 'test'
}),
false
)
).toEqual(
"Invalid macaroon. Please check that you've entered the correct macaroon for this node."
);
});

it('Returns normal error message for unhandled errorContext', () => {
Expand Down
2 changes: 2 additions & 0 deletions utils/ErrorUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ const userFriendlyErrors: any = {
'error.torBootstrap',
'Error: called `Result::unwrap()` on an `Err` value: BootStrapError("Timeout waiting for boostrap")':
'error.torBootstrap',
'Error: {"code":2,"message":"verification failed: signature mismatch after caveat verification","details":[]}':
'error.invalidMacaroon',
FAILURE_REASON_TIMEOUT: 'error.failureReasonTimeout',
FAILURE_REASON_NO_ROUTE: 'error.failureReasonNoRoute',
FAILURE_REASON_ERROR: 'error.failureReasonError',
Expand Down
Loading
Loading