diff --git a/CHANGELOG.md b/CHANGELOG.md
index b02e0b033db..02511459b9a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,7 @@
- added: BitsOfGold and LibertyX ramp plugins.
- added: Added remote ramp plugin filtering from info-server rollup.
+- fixed: Allow for user-error reporting via `ErrorCard` in `SendScene2`.
- fixed: Fixed broken `logEvent` tracking calls by adding the needed `dispatch`.
- fixed: Localized display names for payment types in new buy/sell feature.
- removed: Remove change quote tracking.
diff --git a/eslint.config.mjs b/eslint.config.mjs
index 9db0b0ce7c1..84fabf6a182 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -354,7 +354,7 @@ export default [
'src/components/themed/MenuTabs.tsx',
'src/components/themed/ModalParts.tsx',
'src/components/themed/PinDots.tsx',
- 'src/components/themed/SafeSlider.tsx',
+
'src/components/themed/SceneFooterWrapper.tsx',
'src/components/themed/SceneHeader.tsx',
diff --git a/src/__tests__/scenes/__snapshots__/SendScene2.ui.test.tsx.snap b/src/__tests__/scenes/__snapshots__/SendScene2.ui.test.tsx.snap
index a21e44c0de1..7db6ab144a9 100644
--- a/src/__tests__/scenes/__snapshots__/SendScene2.ui.test.tsx.snap
+++ b/src/__tests__/scenes/__snapshots__/SendScene2.ui.test.tsx.snap
@@ -1,81 +1,146 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`SendScene2 1 spendTarget 1`] = `
-[
-
+
-
+
-
+
+
+
+
-
-
-
-
-
-
-
+
-
+ }
+ propList={
+ [
+ "fill",
+ ]
+ }
+ r={238.7781690140845}
+ />
-
-
-
+
+
+
-
-
+
+
+
+
-
-
-
- Send from Wallet
-
-
- My Bitcoin (BTC)
-
-
-
+
+ My Bitcoin (BTC)
+
+
+
+
-
-
-
-
+
+
-
+
+
+
-
-
+ Send to Address
+
+
- Send to Address
+ some pub address
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+ Amount:
+
+
- some pub address
-
-
+ undefined,
+ ],
+ null,
+ ]
+ }
+ >
+ 0.00001234 BTC
+
+
+ € 0.23
+
-
+
-
+
+
+
+
+
+
+
+
+
-
+
+ Add Another Address
+
+
+
-
-
-
- Amount:
-
-
- 0.00001234 BTC
-
-
- € 0.23
-
-
-
-
-
-
-
-
+
+
-
+
+
+
-
-
-
- Add Another Address
-
-
-
+
-
-
-
-
+ 0 (0)
+
-
-
-
-
-
-
-
-
-
-
- Network Fee:
-
-
- 0 (0)
-
-
-
-
-
-
-
+
+
-
-
-
+
+
+
+
+
-
+
+
-
+
+
+
+
-
-
-
-
-
- Enter an Amount
-
-
+ ],
+ null,
+ ]
+ }
+ >
+ Enter an Amount
+
- ,
-
+
+`;
+
+exports[`SendScene2 1 spendTarget with info tiles 1`] = `
+
+ ,
-]
-`;
-
-exports[`SendScene2 1 spendTarget with info tiles 1`] = `
-[
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
-
+ }
+ propList={
+ [
+ "fill",
+ ]
+ }
+ r={238.7781690140845}
+ />
-
-
-
+
+
+
-
-
+
+
+
+
-
-
-
- Send from Wallet
-
-
- My Bitcoin (BTC)
-
-
-
+
+ My Bitcoin (BTC)
+
+
+
+
-
-
-
-
+
+
-
+
+
+
-
-
-
+
+
- Send to Address
+ some pub address
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
- some pub address
-
-
+ undefined,
+ ],
+ null,
+ ]
+ }
+ >
+ 0.00001234 BTC
+
+
+ € 0.23
+
-
+
-
-
-
-
-
- Amount:
-
-
- 0.00001234 BTC
-
-
- € 0.23
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
- Add Another Address
-
-
-
+
+
+
-
-
-
-
+
+
-
+
+
+
-
-
-
- Network Fee:
-
-
- 0 (0)
-
-
-
+
-
-
-
-
+ 0 (0)
+
-
-
-
-
- info tile label 1
-
-
- info tile value 1
-
-
+
+
-
+
+ "borderBottomColor": "rgba(255, 255, 255, .1)",
+ "borderBottomWidth": 1,
+ "height": 1,
+ },
+ {
+ "margin": 11,
+ },
+ ]
+ }
+ />
+
-
-
- info tile label 2
-
-
- info tile value 2
-
-
+ info tile label 1
+
+
+ info tile value 1
+
-
-
-
+ {
+ "margin": 11,
+ },
+ ]
+ }
+ />
+
+
+
+ info tile label 2
+
+
+ info tile value 2
+
+
+
+
+
-
-
+
+
+
+
+
-
+
-
+
-
-
-
-
-
+
+
- Enter an Amount
-
-
+ {
+ "color": "#888888",
+ },
+ ],
+ null,
+ ]
+ }
+ >
+ Enter an Amount
+
- ,
-
+
+`;
+
+exports[`SendScene2 2 spendTargets 1`] = `
+
+ ,
-]
-`;
-
-exports[`SendScene2 2 spendTargets 1`] = `
-[
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
-
+ }
+ propList={
+ [
+ "fill",
+ ]
+ }
+ r={238.7781690140845}
+ />
-
-
-
+
+
+
-
-
+
+
-
+
+
+
-
+
+
+ Send from Wallet
+
+
+ My Bitcoin (BTC)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
- Send from Wallet
+ Send To some pub address
- My Bitcoin (BTC)
+ Amount: 0.00001234 BTC (€ 0.23)
-
+
-
-
-
-
-
-
-
+
+
-
- Send To some pub address
-
-
- Amount: 0.00001234 BTC (€ 0.23)
-
-
-
-
-
-
-
+ some pub address 2
+
-
+ >
+
+
+
+
+
+
+
- Send to Address 2
+ Amount: 2
-
-
- some pub address 2
-
-
+ undefined,
+ ],
+ null,
+ ]
+ }
+ >
+ 0.00012345 BTC
+
+
+ € 2.26
+
-
+
-
+
+
+
+
+
+
+
+
+
-
+
+ Add Another Address
+
+
+
-
-
-
- Amount: 2
-
-
- 0.00012345 BTC
-
-
- € 2.26
-
-
-
-
-
-
-
-
+
+
-
+
+
+
-
-
-
- Add Another Address
-
-
-
+
-
-
-
-
+ 0 (0)
+
-
-
-
-
-
-
-
-
-
-
- Network Fee:
-
-
- 0 (0)
-
-
-
-
-
-
-
+
+
-
-
-
-
+
+
+
+
+
+
-
+
-
+
-
-
-
-
-
+
+
- Enter an Amount
-
-
+ {
+ "color": "#888888",
+ },
+ ],
+ null,
+ ]
+ }
+ >
+ Enter an Amount
+
- ,
-
+
+`;
+
+exports[`SendScene2 2 spendTargets hide tiles 1`] = `
+
+ ,
-]
-`;
-
-exports[`SendScene2 2 spendTargets hide tiles 1`] = `
-[
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
-
+ }
+ propList={
+ [
+ "fill",
+ ]
+ }
+ r={238.7781690140845}
+ />
-
-
-
+
+
+
-
-
+
+
+
+
-
-
-
- Send from Wallet
-
-
- My Bitcoin (BTC)
-
-
-
+
+ My Bitcoin (BTC)
+
+
+
+
-
-
-
-
+
+
-
+
+
+
-
-
+
-
-
- Send To some pub address
-
-
- Amount: 0.00001234 BTC (€ 0.23)
-
-
-
+
+ Amount: 0.00001234 BTC (€ 0.23)
+
+
+
+
-
-
-
-
+
+
-
+
+
+
-
-
-
- Amount: 2
-
-
+
- 0.00012345 BTC
-
-
- € 2.26
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Network Fee:
+ 0.00012345 BTC
- 0 (0)
+ € 2.26
-
+
-
+
-
-
-
+ nativeID="41"
+ />
+
-
-
-
-
-
-
+ Network Fee:
+
+
+ 0 (0)
+
+
+
- Enter an Amount
-
+ "busy": undefined,
+ "checked": undefined,
+ "disabled": undefined,
+ "expanded": undefined,
+ "selected": undefined,
+ }
+ }
+ accessibilityValue={
+ {
+ "max": undefined,
+ "min": undefined,
+ "now": undefined,
+ "text": undefined,
+ }
+ }
+ accessible={false}
+ collapsable={false}
+ focusable={true}
+ onClick={[Function]}
+ onResponderGrant={[Function]}
+ onResponderMove={[Function]}
+ onResponderRelease={[Function]}
+ onResponderTerminate={[Function]}
+ onResponderTerminationRequest={[Function]}
+ onStartShouldSetResponder={[Function]}
+ style={
+ {
+ "alignItems": "flex-end",
+ "height": "100%",
+ "justifyContent": "center",
+ "opacity": 1,
+ "position": "absolute",
+ "right": 0,
+ "width": "100%",
+ }
+ }
+ >
+
+
+
+
+
+
- ,
+
+ ,
-]
-`;
-
-exports[`SendScene2 2 spendTargets hide tiles 2`] = `
-[
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
- Send from Wallet
-
-
- My Bitcoin (BTC)
-
-
-
-
-
-
-
-
-
+
+
-
-
+ Enter an Amount
+
+
+
+
+
+
+`;
+
+exports[`SendScene2 2 spendTargets hide tiles 2`] = `
+
+
+
+
+
+
+
+
+
-
-
-
+
-
-
-
-
- Send To some pub address
-
-
- Amount: 0.00001234 BTC (€ 0.23)
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+ "marginBottom": 11,
+ "marginLeft": 11,
+ "marginRight": 11,
+ "marginTop": 11,
+ },
+ ]
+ }
+ >
-
-
- Send to Address 2
-
-
+
-
- some pub address 2
-
-
-
-
+ My Bitcoin (BTC)
+
+
+
+
-
-
-
-
+
+
-
+
+ }
+ nativeID="48"
+ >
+
-
- Network Fee:
+ Send To some pub address
- 0 (0)
+ Amount: 0.00001234 BTC (€ 0.23)
+
+
+
+
+
+
+
+
+
+ Send to Address 2
+
+
+
-
+ some pub address 2
+
+
+
+
+
-
+
-
-
-
+ nativeID="51"
+ />
+
-
-
-
-
-
-
+ Network Fee:
+
+
+ 0 (0)
+
+
+
- Enter an Amount
-
+ "busy": undefined,
+ "checked": undefined,
+ "disabled": undefined,
+ "expanded": undefined,
+ "selected": undefined,
+ }
+ }
+ accessibilityValue={
+ {
+ "max": undefined,
+ "min": undefined,
+ "now": undefined,
+ "text": undefined,
+ }
+ }
+ accessible={false}
+ collapsable={false}
+ focusable={true}
+ onClick={[Function]}
+ onResponderGrant={[Function]}
+ onResponderMove={[Function]}
+ onResponderRelease={[Function]}
+ onResponderTerminate={[Function]}
+ onResponderTerminationRequest={[Function]}
+ onStartShouldSetResponder={[Function]}
+ style={
+ {
+ "alignItems": "flex-end",
+ "height": "100%",
+ "justifyContent": "center",
+ "opacity": 1,
+ "position": "absolute",
+ "right": 0,
+ "width": "100%",
+ }
+ }
+ >
+
+
+
+
+
-
- ,
- ,
-]
-`;
-
-exports[`SendScene2 2 spendTargets hide tiles 3`] = `
-[
+ "randomizeDelay": false,
+ "reduceMotionV": "system",
+ }
+ }
+ jestAnimatedProps={
+ {
+ "value": {},
+ }
+ }
+ jestAnimatedStyle={
+ {
+ "value": {},
+ }
+ }
+ layout={
+ LinearTransition {
+ "build": [Function],
+ "durationV": 300,
+ "randomizeDelay": false,
+ "reduceMotionV": "system",
+ }
+ }
+ nativeID="53"
+ />
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Send from Wallet
-
-
- My Bitcoin (BTC)
-
-
-
+
-
-
-
-
-
-
+ "translateX": 240,
+ },
+ ],
+ },
+ }
+ }
+ jestInlineStyle={
+ [
+ {
+ "alignItems": "center",
+ "backgroundColor": "#00f1a2",
+ "borderRadius": 27.5,
+ "height": 55,
+ "justifyContent": "center",
+ "width": 55,
+ "zIndex": 5,
+ },
+ {
+ "backgroundColor": "#888888",
+ },
+ ]
+ }
+ nativeID="56"
+ style={
+ [
+ {
+ "alignItems": "center",
+ "backgroundColor": "#00f1a2",
+ "borderRadius": 27.5,
+ "height": 55,
+ "justifyContent": "center",
+ "width": 55,
+ "zIndex": 5,
+ },
+ {
+ "backgroundColor": "#888888",
+ },
+ {
+ "transform": [
+ {
+ "translateX": 240,
+ },
+ ],
+ },
+ ]
+ }
+ >
+
+
+
-
-
+ Enter an Amount
+
+
+
+
+
+
+`;
+
+exports[`SendScene2 2 spendTargets hide tiles 3`] = `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+ Send from Wallet
+
+
+ My Bitcoin (BTC)
+
+
+
-
-
-
- Send To some pub address
-
-
- Amount: 0.00001234 BTC (€ 0.23)
-
-
-
-
-
-
-
-
+
+
-
+
+ }
+ nativeID="58"
+ >
+
-
- Network Fee:
+ Send To some pub address
- 0 (0)
+ Amount: 0.00001234 BTC (€ 0.23)
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Network Fee:
+
+
+ 0 (0)
+
+
+
+
+
+
-
-
-
+
+
+
+
+
-
+
-
+
-
-
-
-
-
+
+
- Enter an Amount
-
-
+ {
+ "color": "#888888",
+ },
+ ],
+ null,
+ ]
+ }
+ >
+ Enter an Amount
+
- ,
-
+
+`;
+
+exports[`SendScene2 2 spendTargets lock tiles 1`] = `
+
+ ,
-]
-`;
-
-exports[`SendScene2 2 spendTargets lock tiles 1`] = `
-[
-
-
-
+
+
+
+
-
-
-
-
-
+
-
+
+
+
+
+
+
+
+
+
-
+
+
-
-
-
-
-
+
+
+ Send from Wallet
+
+
+ My Bitcoin (BTC)
+
+
+
+
+
+
+
+
+
+
+
+
-
+ layout={
+ LinearTransition {
+ "build": [Function],
+ "durationV": 300,
+ "randomizeDelay": false,
+ "reduceMotionV": "system",
+ }
+ }
+ nativeID="68"
+ >
+
-
- Send from Wallet
+ Send To some pub address
- My Bitcoin (BTC)
+ Amount: 0.00001234 BTC (€ 0.23)
-
+
-
-
-
-
-
-
-
+
-
- Send To some pub address
-
-
- Amount: 0.00001234 BTC (€ 0.23)
-
-
-
+
-
-
-
-
+ some pub address 2
+
-
+
+
+ }
+ nativeID="71"
+ >
- Send to Address 2
+ Amount: 2
-
-
- some pub address 2
-
-
+ undefined,
+ ],
+ null,
+ ]
+ }
+ >
+ 0.00012345 BTC
+
+
+ € 2.26
+
-
-
-
-
-
-
- Amount: 2
-
-
- 0.00012345 BTC
-
-
- € 2.26
-
-
-
-
-
-
-
+
+
-
+
-
+
+
+
-
-
-
- Network Fee:
-
-
- 0 (0)
-
-
-
+
+ 0 (0)
+
+
+
+
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
- Enter an Amount
-
-
+ {
+ "color": "#888888",
+ },
+ ],
+ null,
+ ]
+ }
+ >
+ Enter an Amount
+
- ,
-
+
+`;
+
+exports[`SendScene2 2 spendTargets lock tiles 2`] = `
+
+ ,
-]
-`;
-
-exports[`SendScene2 2 spendTargets lock tiles 2`] = `
-[
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
-
+ }
+ propList={
+ [
+ "fill",
+ ]
+ }
+ r={238.7781690140845}
+ />
-
-
-
+
+
+
+
+
-
+ layout={
+ LinearTransition {
+ "build": [Function],
+ "durationV": 300,
+ "randomizeDelay": false,
+ "reduceMotionV": "system",
+ }
+ }
+ nativeID="78"
+ >
+
-
-
-
- Send from Wallet
-
-
- My Bitcoin (BTC)
-
-
-
+
-
-
-
-
+ My Bitcoin (BTC)
+
+
+
+
+
+
-
+
+
+
-
-
+
-
-
-
- Send To some pub address
-
-
- Amount: 0.00001234 BTC (€ 0.23)
-
-
-
-
-
-
+ Send To some pub address
+
+
- Send to Address 2
+ Amount: 0.00001234 BTC (€ 0.23)
-
+
+
+
+
+
+
+ Send to Address 2
+
+
-
- some pub address 2
-
-
-
-
-
+ some pub address 2
-
-
+
+
+
+
+
+
+
+
-
-
- Amount: 2
-
-
- 0.00012345 BTC
-
-
+
- € 2.26
-
-
+ ],
+ null,
+ ]
+ }
+ >
+ 0.00012345 BTC
+
+
+ € 2.26
+
-
+
-
+
+
+
-
-
-
- Network Fee:
-
-
- 0 (0)
-
-
-
+
+ 0 (0)
+
+
+
+
-
-
-
-
+
+
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
+
+
- Enter an Amount
-
-
+ {
+ "color": "#888888",
+ },
+ ],
+ null,
+ ]
+ }
+ >
+ Enter an Amount
+
- ,
-
+
+`;
+
+exports[`SendScene2 2 spendTargets lock tiles 3`] = `
+
+ ,
-]
-`;
-
-exports[`SendScene2 2 spendTargets lock tiles 3`] = `
-[
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
-
+ }
+ propList={
+ [
+ "fill",
+ ]
+ }
+ r={238.7781690140845}
+ />
-
-
-
+
+
+
+
+
-
+ nativeID="89"
+ >
+
-
-
-
- Send from Wallet
-
-
- My Bitcoin (BTC)
-
-
-
+
+ My Bitcoin (BTC)
+
+
+
+
-
-
-
-
+
+
-
+
+
+
-
-
+
-
-
-
- Send To some pub address
-
-
- Amount: 0.00001234 BTC (€ 0.23)
-
-
-
-
-
-
- Send to Address 2
+ Send To some pub address
-
-
- some pub address 2
-
-
+ Amount: 0.00001234 BTC (€ 0.23)
+
-
+
+
+
-
-
-
+
+
-
- Amount: 2
-
-
- 0.00012345 BTC
-
-
- € 2.26
-
-
+ some pub address 2
+
-
-
-
-
-
-
-
+
- Network Fee:
+ Amount: 2
+ 0.00012345 BTC
+
+
- 0 (0)
+ € 2.26
-
+
+
+
+
+
+
+
+
+
+
+
+
+ Network Fee:
+
+
+ 0 (0)
+
+
+
+
-
-
-
-
+
+
-
-
-
+
+
+
+
+
-
+
-
-
-
-
-
+ ],
+ },
+ ]
+ }
+ >
- Enter an Amount
+
+
+ Enter an Amount
+
- ,
-
+
+`;
+
+exports[`SendScene2 Render SendScene 1`] = `
+
+ ,
-]
-`;
-
-exports[`SendScene2 Render SendScene 1`] = `
-[
-
-
-
+
+
+
+
-
-
-
-
-
-
-
+
-
+ }
+ propList={
+ [
+ "fill",
+ ]
+ }
+ r={238.7781690140845}
+ />
-
-
-
+
+
+
-
-
+
+
+
+
-
-
+ Send from Wallet
+
+
+ My Bitcoin (BTC)
+
+
+
+
-
- Send from Wallet
-
-
- My Bitcoin (BTC)
-
-
-
-
-
-
-
+
+
-
+
+
+
-
-
-
+
- Send to Address
-
-
+
-
+
+
+
-
-
-
-
- Enter
-
-
-
+
+
+
+
+
+
-
-
-
-
- Scan
-
-
-
+
+
+
+
+
+
-
-
-
-
- Paste
-
-
+ Paste
+
-
+
-
+
-
+
+
-
+
+
+
-
+
+
+
+ >
+ Scam Warning
+
+ •
+
+
+ Edge will not give financial advice.
+
+
+
+
-
+ •
- Scam Warning
+ Cryptocurrency transactions are irreversible.
-
-
- •
-
-
- Edge will not give financial advice.
-
-
-
-
- •
-
-
- Cryptocurrency transactions are irreversible.
-
-
-
+
-
- •
-
-
- Do not send money to people or organizations you do not know.
-
-
+ Do not send money to people or organizations you do not know.
+
-
- If you have any questions or concerns regarding this send, please contact support@edge.app
-
+
+ If you have any questions or concerns regarding this send, please contact support@edge.app
+
-
-
- ,
+
+
,
-]
+ />
+
`;
diff --git a/src/components/scenes/SendScene2.tsx b/src/components/scenes/SendScene2.tsx
index 9e1b8dfc2a5..b52d05eeaae 100644
--- a/src/components/scenes/SendScene2.tsx
+++ b/src/components/scenes/SendScene2.tsx
@@ -68,6 +68,7 @@ import {
} from '../../util/utils'
import { AlertCardUi4 } from '../cards/AlertCard'
import { EdgeCard } from '../cards/EdgeCard'
+import { ErrorCard, I18nError } from '../cards/ErrorCard'
import type { AccentColors } from '../common/DotsBackground'
import { EdgeAnim } from '../common/EdgeAnim'
import { SceneWrapper } from '../common/SceneWrapper'
@@ -104,7 +105,6 @@ import {
} from '../tiles/AddressTile2'
import { CountdownTile } from '../tiles/CountdownTile'
import { EditableAmountTile } from '../tiles/EditableAmountTile'
-import { ErrorTile } from '../tiles/ErrorTile'
// TODO: Check contentPadding
@@ -213,7 +213,7 @@ const SendComponent = (props: Props): React.ReactElement => {
initMinNativeAmount
)
const [expireDate, setExpireDate] = useState(initExpireDate)
- const [error, setError] = useState(undefined)
+ const [error, setError] = useState(undefined)
const [edgeTransaction, setEdgeTransaction] =
useState(null)
const [pinValue, setPinValue] = useState(undefined)
@@ -257,6 +257,7 @@ const SendComponent = (props: Props): React.ReactElement => {
async () => {
if (
error != null &&
+ error instanceof Error &&
error.name === 'PendingFundsError' &&
flipInputModalRef.current == null
) {
@@ -664,7 +665,12 @@ const SendComponent = (props: Props): React.ReactElement => {
}
const handleTimeoutDone = useHandler((): void => {
- setError(new Error(lstrings.send_address_expired_error_message))
+ setError(
+ new I18nError(
+ lstrings.transaction_failure,
+ lstrings.send_address_expired_error_message
+ )
+ )
})
const renderTimeout = (): React.ReactElement | null => {
@@ -682,7 +688,7 @@ const SendComponent = (props: Props): React.ReactElement => {
const renderError = (): React.ReactElement | null => {
if (error != null && asMaybeNoAmountSpecifiedError(error) == null) {
- return
+ return
}
return null
}
@@ -1130,6 +1136,10 @@ const SendComponent = (props: Props): React.ReactElement => {
try {
if (beforeTransaction != null) await beforeTransaction()
} catch (e: unknown) {
+ console.error(
+ 'Error from before transaction route param hook: ',
+ String(e)
+ )
return
}
@@ -1286,31 +1296,35 @@ const SendComponent = (props: Props): React.ReactElement => {
/>
)).catch(() => {})
}
- } catch (e: unknown) {
- resetSlider()
- console.log(e)
- const error = e instanceof Error ? e : new Error(String(e))
+ } catch (err: unknown) {
+ console.log(err)
+ const errorCasted = err instanceof Error ? err : new Error(String(err))
+ let error = err
- let message = sprintf(
- lstrings.transaction_failure_message,
- error.message
- )
- error.message = 'broadcastError'
- if (error.name === 'ErrorAlgoRecipientNotActivated') {
- message = sprintf(
+ if (errorCasted.name === 'ErrorAlgoRecipientNotActivated') {
+ error = new I18nError(
lstrings.send_confirmation_algo_recipient_not_activated_s,
currencyCode
)
}
- if (error.name === 'ErrorEosInsufficientCpu') {
- message = lstrings.send_confirmation_eos_error_cpu
- } else if (error.name === 'ErrorEosInsufficientNet') {
- message = lstrings.send_confirmation_eos_error_net
- } else if (error.name === 'ErrorEosInsufficientRam') {
- message = lstrings.send_confirmation_eos_error_ram
+ if (errorCasted.name === 'ErrorEosInsufficientCpu') {
+ error = new I18nError(
+ lstrings.transaction_failure,
+ lstrings.send_confirmation_eos_error_cpu
+ )
+ } else if (errorCasted.name === 'ErrorEosInsufficientNet') {
+ error = new I18nError(
+ lstrings.transaction_failure,
+ lstrings.send_confirmation_eos_error_net
+ )
+ } else if (errorCasted.name === 'ErrorEosInsufficientRam') {
+ error = new I18nError(
+ lstrings.transaction_failure,
+ lstrings.send_confirmation_eos_error_ram
+ )
} else if (
- error instanceof FioError &&
- error.code === FIO_NO_BUNDLED_ERR_CODE &&
+ errorCasted instanceof FioError &&
+ errorCasted.code === FIO_NO_BUNDLED_ERR_CODE &&
currencyCode !== FIO_STR
) {
const answer = await Airship.show<'ok' | 'cancel' | undefined>(
@@ -1332,20 +1346,16 @@ const SendComponent = (props: Props): React.ReactElement => {
await handleSliderComplete(resetSlider)
return
}
- } else if (message.includes('504')) {
- message = lstrings.transaction_failure_504_message
+ } else if (errorCasted.message.includes('504')) {
+ error = new I18nError(
+ lstrings.transaction_failure,
+ lstrings.transaction_failure_504_message
+ )
}
- Airship.show<'ok' | undefined>(bridge => (
-
- )).catch(() => {})
+ setError(error)
+ } finally {
+ resetSlider()
}
}
)
@@ -1429,7 +1439,8 @@ const SendComponent = (props: Props): React.ReactElement => {
const { name } = cryptoDisplayDenomination
setError(
- new Error(
+ new I18nError(
+ lstrings.transaction_failure,
sprintf(
lstrings.error_spend_amount_less_then_min_s,
`${minDisplayAmount} ${name}`
@@ -1462,8 +1473,8 @@ const SendComponent = (props: Props): React.ReactElement => {
flipInputModalRef.current?.setFees({ feeTokenId, feeNativeAmount })
flipInputModalRef.current?.setError(null)
setError(undefined)
- } catch (e: unknown) {
- const error = e instanceof Error ? e : new Error(String(e))
+ } catch (err: unknown) {
+ let error = err
const insufficientFunds = asMaybeInsufficientFundsError(error)
if (insufficientFunds != null) {
const errorCurrencyCode = getCurrencyCode(
@@ -1477,15 +1488,18 @@ const SendComponent = (props: Props): React.ReactElement => {
errorCurrencyCode === 'ETH' &&
coreWallet.currencyInfo.pluginId !== 'ethereum'
) {
- error.message = sprintf(
- lstrings.insufficient_funds_2s,
- errorCurrencyCode,
- coreWallet.currencyInfo.displayName
+ error = new I18nError(
+ lstrings.transaction_failure,
+ sprintf(
+ lstrings.insufficient_funds_2s,
+ errorCurrencyCode,
+ coreWallet.currencyInfo.displayName
+ )
)
} else {
- error.message = sprintf(
- lstrings.stake_error_insufficient_s,
- errorCurrencyCode
+ error = new I18nError(
+ lstrings.transaction_failure,
+ sprintf(lstrings.stake_error_insufficient_s, errorCurrencyCode)
)
}
@@ -1503,13 +1517,21 @@ const SendComponent = (props: Props): React.ReactElement => {
}
}
- if (error.message === 'Unexpected pending transactions') {
- error.message = lstrings.unexpected_pending_transactions_error
+ if (
+ error instanceof Error &&
+ error.message === 'Unexpected pending transactions'
+ ) {
+ error = new I18nError(
+ lstrings.transaction_failure,
+ lstrings.unexpected_pending_transactions_error
+ )
}
setError(error)
setEdgeTransaction(null)
- flipInputModalRef.current?.setError(error.message)
+ const errorMessage =
+ error instanceof Error ? error.message : String(error)
+ flipInputModalRef.current?.setError(errorMessage)
flipInputModalRef.current?.setFees({
feeNativeAmount: '',
feeTokenId: null
@@ -1528,7 +1550,6 @@ const SendComponent = (props: Props): React.ReactElement => {
if (
edgeTransaction == null ||
processingAmountChanged ||
- error != null ||
(zeroString(spendInfo.spendTargets[0].nativeAmount) &&
getSpecialCurrencyInfo(pluginId).allowZeroTx !== true)
) {
@@ -1573,7 +1594,6 @@ const SendComponent = (props: Props): React.ReactElement => {
return (
{
{renderAddressAmountPairs()}
{renderTimeout()}
- {renderError()}
@@ -1625,6 +1644,7 @@ const SendComponent = (props: Props): React.ReactElement => {
{renderScamWarning()}
+ {renderError()}
= props => {
setCompleted(false)
})
const handleComplete = (): void => {
+ setCompleted(true)
triggerHaptic('impactMedium')
onSlidingComplete(() => {
resetSlider()
})?.catch((err: unknown) => {
showError(err)
})
- setCompleted(true)
}
const gesture = Gesture.Pan()
@@ -81,7 +81,7 @@ export const SafeSlider: React.FC = props => {
})
.onEnd(event => {
if (translateX.value < COMPLETE_POINT) {
- runOnJS(handleComplete)()
+ scheduleOnRN(handleComplete)
} else {
translateX.value = withTiming(upperBound, {
duration: 500,