@shapeshiftoss/swap-widget 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +233 -0
- package/dist/index.js +63612 -0
- package/dist/style.css +1 -0
- package/package.json +69 -18
- package/Dockerfile +0 -87
- package/dist/assets/PhArrowCircleDown-B305t-Sh.js +0 -14
- package/dist/assets/PhArrowClockwise-CJPxQhr_.js +0 -14
- package/dist/assets/PhArrowDown-C4hT9BVu.js +0 -14
- package/dist/assets/PhArrowLeft-Way4Cu-r.js +0 -14
- package/dist/assets/PhArrowRight-Cp5ZME0F.js +0 -14
- package/dist/assets/PhArrowSquareOut-NnrK69c5.js +0 -14
- package/dist/assets/PhArrowUp-Dph6j8rm.js +0 -14
- package/dist/assets/PhArrowUpRight-BpJjRRRh.js +0 -14
- package/dist/assets/PhArrowsClockwise-CFUT8X7R.js +0 -14
- package/dist/assets/PhArrowsDownUp-BjBI4ckC.js +0 -14
- package/dist/assets/PhArrowsLeftRight-CuLpbKRk.js +0 -14
- package/dist/assets/PhBank-Dchr4XQJ.js +0 -14
- package/dist/assets/PhBrowser-dUu2TrC1.js +0 -14
- package/dist/assets/PhCaretDown-78IuKU3V.js +0 -14
- package/dist/assets/PhCaretLeft-_aiyH7n1.js +0 -14
- package/dist/assets/PhCaretRight-8zJQEuDX.js +0 -14
- package/dist/assets/PhCaretUp-CiCxKWwN.js +0 -14
- package/dist/assets/PhCheck-CcADx8br.js +0 -14
- package/dist/assets/PhCircleHalf-BYzSzd2h.js +0 -14
- package/dist/assets/PhClock-UItiXeJq.js +0 -14
- package/dist/assets/PhCompass-CUy3uA7t.js +0 -14
- package/dist/assets/PhCopy-C-PDgSlZ.js +0 -14
- package/dist/assets/PhCreditCard-CWRaUT6F.js +0 -14
- package/dist/assets/PhCurrencyDollar-Cqla3AXT.js +0 -14
- package/dist/assets/PhDesktop-BBIPrYLl.js +0 -14
- package/dist/assets/PhDeviceMobile-BdsPaATg.js +0 -14
- package/dist/assets/PhDotsThree-BMXCQl-0.js +0 -14
- package/dist/assets/PhEnvelope-yUsis6yU.js +0 -14
- package/dist/assets/PhFunnelSimple-Ba7BbWTp.js +0 -14
- package/dist/assets/PhGlobe-DgLxBk5U.js +0 -14
- package/dist/assets/PhIdentificationCard-Czjmq9Z3.js +0 -14
- package/dist/assets/PhImage-BAJ_erz6.js +0 -14
- package/dist/assets/PhInfo-Cr4DhVUE.js +0 -14
- package/dist/assets/PhLightbulb-BX_7duTr.js +0 -14
- package/dist/assets/PhMagnifyingGlass-Mygfryvz.js +0 -14
- package/dist/assets/PhPaperPlaneRight-BeuCA660.js +0 -14
- package/dist/assets/PhPlus-BMjcHjsT.js +0 -14
- package/dist/assets/PhPower-CGffGmdb.js +0 -14
- package/dist/assets/PhPuzzlePiece-wm_GpVSi.js +0 -14
- package/dist/assets/PhQrCode-DRwRzXCH.js +0 -14
- package/dist/assets/PhQuestion-M09j2U0T.js +0 -14
- package/dist/assets/PhQuestionMark-BP9EMB6h.js +0 -14
- package/dist/assets/PhSealCheck-BfG80yKn.js +0 -14
- package/dist/assets/PhSignOut-C5YOWlPT.js +0 -14
- package/dist/assets/PhSpinner-BXooDYzU.js +0 -14
- package/dist/assets/PhTrash-Biq6rmmL.js +0 -14
- package/dist/assets/PhUser-CAgZSpGe.js +0 -14
- package/dist/assets/PhVault-l2PHF38a.js +0 -14
- package/dist/assets/PhWallet-w25D16It.js +0 -14
- package/dist/assets/PhWarning-DPEydIPw.js +0 -14
- package/dist/assets/PhWarningCircle-BqjT745H.js +0 -14
- package/dist/assets/PhX-s-SmVExa.js +0 -14
- package/dist/assets/SwapController-If0bFrNc.js +0 -1
- package/dist/assets/ccip-BBB7uCdL.js +0 -1
- package/dist/assets/ccip-CkkdfKKI.js +0 -1
- package/dist/assets/data-capture-D4gAy-Yc.js +0 -242
- package/dist/assets/email-B1AJehis.js +0 -90
- package/dist/assets/embedded-wallet-Q6DQopDk.js +0 -410
- package/dist/assets/features-B6JAPAFb.js +0 -5
- package/dist/assets/index-5jd8RPN9.js +0 -7428
- package/dist/assets/index-B4kNtSTk.js +0 -1080
- package/dist/assets/index-B753eAob.js +0 -1
- package/dist/assets/index-BZoLTv77.js +0 -3
- package/dist/assets/index-Bcw9UURX.js +0 -3
- package/dist/assets/index-BkrV-ahK.js +0 -2
- package/dist/assets/index-CRQzQ_up.js +0 -9
- package/dist/assets/index-CSW0Gt5y.js +0 -132
- package/dist/assets/index-CZ4jTIsk.js +0 -138
- package/dist/assets/index-Cwa8SB3h.js +0 -61
- package/dist/assets/index-DEwQgT4r.js +0 -78
- package/dist/assets/index-DVfQiQ1d.js +0 -1
- package/dist/assets/index-cV3UdaMs.css +0 -1
- package/dist/assets/index-hAmu622O.js +0 -43
- package/dist/assets/onramp-XcPNCLRU.js +0 -422
- package/dist/assets/pay-with-exchange-BeHt4OF4.js +0 -280
- package/dist/assets/property-C9JG5tag.js +0 -27
- package/dist/assets/receive-7ff4he2S.js +0 -131
- package/dist/assets/send-CkMBIRXT.js +0 -554
- package/dist/assets/socials-DmmxuLrP.js +0 -250
- package/dist/assets/swaps-IHAYRQ0x.js +0 -1050
- package/dist/assets/transactions-9Cxdk7o9.js +0 -16
- package/dist/assets/v4-BOvFkHkt.js +0 -1
- package/dist/assets/w3m-modal-kJzFnBfB.js +0 -891
- package/dist/assets/wallet-standard-Dv8LMoUB.js +0 -1
- package/dist/favicon.png +0 -0
- package/dist/favicon.svg +0 -11
- package/dist/icon-192x192.png +0 -0
- package/dist/icon-512x512.png +0 -0
- package/dist/index.html +0 -33
- package/index.html +0 -32
- package/public/favicon.png +0 -0
- package/public/favicon.svg +0 -11
- package/public/icon-192x192.png +0 -0
- package/public/icon-512x512.png +0 -0
- package/railway.toml +0 -10
- package/src/api/client.ts +0 -95
- package/src/components/AddressInputModal.css +0 -173
- package/src/components/AddressInputModal.tsx +0 -250
- package/src/components/ApprovalStep.tsx +0 -92
- package/src/components/ExecutionStep.tsx +0 -27
- package/src/components/InputStep.tsx +0 -431
- package/src/components/QuoteSelector.css +0 -146
- package/src/components/QuoteSelector.tsx +0 -137
- package/src/components/QuotesModal.css +0 -250
- package/src/components/QuotesModal.tsx +0 -182
- package/src/components/SettingsModal.css +0 -145
- package/src/components/SettingsModal.tsx +0 -180
- package/src/components/StatusStep.tsx +0 -139
- package/src/components/SwapWidget.css +0 -713
- package/src/components/SwapWidget.tsx +0 -607
- package/src/components/TokenSelectModal.css +0 -438
- package/src/components/TokenSelectModal.tsx +0 -487
- package/src/components/WalletProvider.tsx +0 -92
- package/src/config/appkit.ts +0 -104
- package/src/config/wagmi.ts +0 -27
- package/src/constants/chains.ts +0 -72
- package/src/constants/defaults.ts +0 -28
- package/src/constants/swappers.ts +0 -48
- package/src/constants/viemChains.ts +0 -69
- package/src/contexts/SwapWalletContext.tsx +0 -25
- package/src/demo/App.css +0 -458
- package/src/demo/App.tsx +0 -481
- package/src/demo/main.tsx +0 -25
- package/src/hooks/useAssets.ts +0 -180
- package/src/hooks/useBalances.ts +0 -822
- package/src/hooks/useBitcoinSigning.ts +0 -276
- package/src/hooks/useMarketData.ts +0 -169
- package/src/hooks/useSolanaSigning.ts +0 -275
- package/src/hooks/useStatusPolling.ts +0 -137
- package/src/hooks/useSwapApproval.ts +0 -106
- package/src/hooks/useSwapDisplayValues.ts +0 -157
- package/src/hooks/useSwapExecution.ts +0 -199
- package/src/hooks/useSwapHandlers.ts +0 -119
- package/src/hooks/useSwapQuote.ts +0 -71
- package/src/hooks/useSwapQuoting.ts +0 -102
- package/src/hooks/useSwapRates.ts +0 -61
- package/src/index.ts +0 -43
- package/src/machines/SwapMachineContext.ts +0 -5
- package/src/machines/__tests__/guards.test.ts +0 -228
- package/src/machines/__tests__/setup.test.ts +0 -7
- package/src/machines/__tests__/swapMachine.test.ts +0 -544
- package/src/machines/__tests__/types.test.ts +0 -124
- package/src/machines/guards.ts +0 -33
- package/src/machines/swapMachine.ts +0 -288
- package/src/machines/types.ts +0 -54
- package/src/services/transactionStatus.ts +0 -322
- package/src/types/index.ts +0 -361
- package/src/utils/addressValidation.ts +0 -201
- package/src/utils/redirect.ts +0 -45
- package/src/vite-env.d.ts +0 -10
- package/tsconfig.json +0 -23
- package/tsconfig.node.json +0 -10
- package/vite.config.ts +0 -101
- package/vitest.config.ts +0 -18
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import './SettingsModal.css'
|
|
2
|
-
|
|
3
|
-
import { useCallback, useEffect, useState } from 'react'
|
|
4
|
-
|
|
5
|
-
const SLIPPAGE_PRESETS = ['0.1', '0.5', '1.0']
|
|
6
|
-
|
|
7
|
-
const useLockBodyScroll = (isLocked: boolean) => {
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
if (!isLocked) return
|
|
10
|
-
const originalOverflow = document.body.style.overflow
|
|
11
|
-
document.body.style.overflow = 'hidden'
|
|
12
|
-
return () => {
|
|
13
|
-
document.body.style.overflow = originalOverflow
|
|
14
|
-
}
|
|
15
|
-
}, [isLocked])
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
type SettingsModalProps = {
|
|
19
|
-
isOpen: boolean
|
|
20
|
-
onClose: () => void
|
|
21
|
-
slippage: string
|
|
22
|
-
onSlippageChange: (slippage: string) => void
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const SettingsModal = ({
|
|
26
|
-
isOpen,
|
|
27
|
-
onClose,
|
|
28
|
-
slippage,
|
|
29
|
-
onSlippageChange,
|
|
30
|
-
}: SettingsModalProps) => {
|
|
31
|
-
useLockBodyScroll(isOpen)
|
|
32
|
-
const [customSlippage, setCustomSlippage] = useState('')
|
|
33
|
-
const [isCustom, setIsCustom] = useState(!SLIPPAGE_PRESETS.includes(slippage))
|
|
34
|
-
|
|
35
|
-
const handlePresetClick = useCallback(
|
|
36
|
-
(preset: string) => {
|
|
37
|
-
setIsCustom(false)
|
|
38
|
-
setCustomSlippage('')
|
|
39
|
-
onSlippageChange(preset)
|
|
40
|
-
},
|
|
41
|
-
[onSlippageChange],
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
const handleCustomChange = useCallback(
|
|
45
|
-
(value: string) => {
|
|
46
|
-
const sanitized = value.replace(/[^0-9.]/g, '')
|
|
47
|
-
const parts = sanitized.split('.')
|
|
48
|
-
const formatted = parts.length > 2 ? `${parts[0]}.${parts.slice(1).join('')}` : sanitized
|
|
49
|
-
|
|
50
|
-
setCustomSlippage(formatted)
|
|
51
|
-
setIsCustom(true)
|
|
52
|
-
|
|
53
|
-
const numValue = parseFloat(formatted)
|
|
54
|
-
if (!isNaN(numValue) && numValue > 0 && numValue <= 50) {
|
|
55
|
-
onSlippageChange(formatted)
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
[onSlippageChange],
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
const handleBackdropClick = useCallback(
|
|
62
|
-
(e: React.MouseEvent) => {
|
|
63
|
-
if (e.target === e.currentTarget) {
|
|
64
|
-
onClose()
|
|
65
|
-
}
|
|
66
|
-
},
|
|
67
|
-
[onClose],
|
|
68
|
-
)
|
|
69
|
-
|
|
70
|
-
if (!isOpen) return null
|
|
71
|
-
|
|
72
|
-
const currentSlippageNum = parseFloat(slippage)
|
|
73
|
-
const isHighSlippage = currentSlippageNum > 1
|
|
74
|
-
const isVeryHighSlippage = currentSlippageNum > 5
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
// eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
|
|
78
|
-
<div
|
|
79
|
-
className='ssw-modal-backdrop'
|
|
80
|
-
onClick={handleBackdropClick}
|
|
81
|
-
onKeyDown={e => e.key === 'Escape' && onClose()}
|
|
82
|
-
role='dialog'
|
|
83
|
-
aria-modal='true'
|
|
84
|
-
aria-labelledby='settings-modal-title'
|
|
85
|
-
>
|
|
86
|
-
<div className='ssw-settings-modal'>
|
|
87
|
-
<div className='ssw-modal-header'>
|
|
88
|
-
<h2 id='settings-modal-title' className='ssw-modal-title'>
|
|
89
|
-
Settings
|
|
90
|
-
</h2>
|
|
91
|
-
<button className='ssw-modal-close' onClick={onClose} type='button'>
|
|
92
|
-
<svg
|
|
93
|
-
width='20'
|
|
94
|
-
height='20'
|
|
95
|
-
viewBox='0 0 24 24'
|
|
96
|
-
fill='none'
|
|
97
|
-
stroke='currentColor'
|
|
98
|
-
strokeWidth='2'
|
|
99
|
-
>
|
|
100
|
-
<path d='M18 6L6 18M6 6l12 12' />
|
|
101
|
-
</svg>
|
|
102
|
-
</button>
|
|
103
|
-
</div>
|
|
104
|
-
|
|
105
|
-
<div className='ssw-settings-content'>
|
|
106
|
-
<div className='ssw-settings-section'>
|
|
107
|
-
<div className='ssw-settings-label'>
|
|
108
|
-
<span>Slippage Tolerance</span>
|
|
109
|
-
<button
|
|
110
|
-
className='ssw-info-btn'
|
|
111
|
-
type='button'
|
|
112
|
-
title="Maximum price difference you're willing to accept"
|
|
113
|
-
>
|
|
114
|
-
<svg
|
|
115
|
-
width='14'
|
|
116
|
-
height='14'
|
|
117
|
-
viewBox='0 0 24 24'
|
|
118
|
-
fill='none'
|
|
119
|
-
stroke='currentColor'
|
|
120
|
-
strokeWidth='2'
|
|
121
|
-
>
|
|
122
|
-
<circle cx='12' cy='12' r='10' />
|
|
123
|
-
<path d='M12 16v-4M12 8h.01' />
|
|
124
|
-
</svg>
|
|
125
|
-
</button>
|
|
126
|
-
</div>
|
|
127
|
-
|
|
128
|
-
<div className='ssw-slippage-options'>
|
|
129
|
-
{SLIPPAGE_PRESETS.map(preset => (
|
|
130
|
-
<button
|
|
131
|
-
key={preset}
|
|
132
|
-
className={`ssw-slippage-btn ${
|
|
133
|
-
!isCustom && slippage === preset ? 'ssw-selected' : ''
|
|
134
|
-
}`}
|
|
135
|
-
onClick={() => handlePresetClick(preset)}
|
|
136
|
-
type='button'
|
|
137
|
-
>
|
|
138
|
-
{preset}%
|
|
139
|
-
</button>
|
|
140
|
-
))}
|
|
141
|
-
<div className={`ssw-slippage-custom ${isCustom ? 'ssw-selected' : ''}`}>
|
|
142
|
-
<input
|
|
143
|
-
type='text'
|
|
144
|
-
placeholder='Custom'
|
|
145
|
-
value={isCustom ? customSlippage || slippage : ''}
|
|
146
|
-
onChange={e => handleCustomChange(e.target.value)}
|
|
147
|
-
onFocus={() => {
|
|
148
|
-
setIsCustom(true)
|
|
149
|
-
if (!customSlippage) setCustomSlippage(slippage)
|
|
150
|
-
}}
|
|
151
|
-
/>
|
|
152
|
-
<span className='ssw-slippage-suffix'>%</span>
|
|
153
|
-
</div>
|
|
154
|
-
</div>
|
|
155
|
-
|
|
156
|
-
{isHighSlippage && (
|
|
157
|
-
<div className={`ssw-slippage-warning ${isVeryHighSlippage ? 'ssw-error' : ''}`}>
|
|
158
|
-
<svg
|
|
159
|
-
width='16'
|
|
160
|
-
height='16'
|
|
161
|
-
viewBox='0 0 24 24'
|
|
162
|
-
fill='none'
|
|
163
|
-
stroke='currentColor'
|
|
164
|
-
strokeWidth='2'
|
|
165
|
-
>
|
|
166
|
-
<path d='M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01' />
|
|
167
|
-
</svg>
|
|
168
|
-
<span>
|
|
169
|
-
{isVeryHighSlippage
|
|
170
|
-
? 'Very high slippage. Your transaction may be frontrun.'
|
|
171
|
-
: 'High slippage may result in unfavorable rates.'}
|
|
172
|
-
</span>
|
|
173
|
-
</div>
|
|
174
|
-
)}
|
|
175
|
-
</div>
|
|
176
|
-
</div>
|
|
177
|
-
</div>
|
|
178
|
-
</div>
|
|
179
|
-
)
|
|
180
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
|
-
|
|
3
|
-
import type { SwapMachineContext, SwapMachineEvent } from '../machines/types'
|
|
4
|
-
|
|
5
|
-
type StatusStepProps = {
|
|
6
|
-
context: SwapMachineContext
|
|
7
|
-
send: (event: SwapMachineEvent) => void
|
|
8
|
-
isPolling: boolean
|
|
9
|
-
isComplete: boolean
|
|
10
|
-
isError: boolean
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const ExplorerLink = ({ url }: { url: string }) => (
|
|
14
|
-
<a href={url} target='_blank' rel='noopener noreferrer' className='ssw-step-explorer-link'>
|
|
15
|
-
View on Explorer
|
|
16
|
-
<svg
|
|
17
|
-
width='12'
|
|
18
|
-
height='12'
|
|
19
|
-
viewBox='0 0 24 24'
|
|
20
|
-
fill='none'
|
|
21
|
-
stroke='currentColor'
|
|
22
|
-
strokeWidth='2'
|
|
23
|
-
>
|
|
24
|
-
<path d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14L21 3' />
|
|
25
|
-
</svg>
|
|
26
|
-
</a>
|
|
27
|
-
)
|
|
28
|
-
|
|
29
|
-
export const StatusStep = ({ context, send, isPolling, isComplete, isError }: StatusStepProps) => {
|
|
30
|
-
const { sellAsset, buyAsset, txHash, error, retryCount, isSellAssetUtxo, isSellAssetSolana } =
|
|
31
|
-
context
|
|
32
|
-
|
|
33
|
-
const explorerUrl = useMemo(() => {
|
|
34
|
-
if (!txHash) return undefined
|
|
35
|
-
if (isSellAssetUtxo) return `https://mempool.space/tx/${txHash}`
|
|
36
|
-
if (isSellAssetSolana) return `https://solscan.io/tx/${txHash}`
|
|
37
|
-
return `${sellAsset.explorerTxLink ?? 'https://etherscan.io/tx/'}${txHash}`
|
|
38
|
-
}, [txHash, isSellAssetUtxo, isSellAssetSolana, sellAsset.explorerTxLink])
|
|
39
|
-
|
|
40
|
-
const truncatedError = useMemo(
|
|
41
|
-
() => (error && error.length > 100 ? `${error.slice(0, 100)}…` : error),
|
|
42
|
-
[error],
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<div className='ssw-step-screen'>
|
|
47
|
-
{isPolling && (
|
|
48
|
-
<>
|
|
49
|
-
<div className='ssw-step-icon-circle ssw-ic-accent'>
|
|
50
|
-
<svg
|
|
51
|
-
className='ssw-spinner'
|
|
52
|
-
width='32'
|
|
53
|
-
height='32'
|
|
54
|
-
viewBox='0 0 24 24'
|
|
55
|
-
fill='none'
|
|
56
|
-
stroke='currentColor'
|
|
57
|
-
strokeWidth='2'
|
|
58
|
-
>
|
|
59
|
-
<circle cx='12' cy='12' r='10' opacity='0.25' />
|
|
60
|
-
<path d='M12 2a10 10 0 0 1 10 10' />
|
|
61
|
-
</svg>
|
|
62
|
-
</div>
|
|
63
|
-
<div className='ssw-step-title'>Confirming Transaction</div>
|
|
64
|
-
<div className='ssw-step-subtitle'>Your swap is being processed…</div>
|
|
65
|
-
{explorerUrl && <ExplorerLink url={explorerUrl} />}
|
|
66
|
-
</>
|
|
67
|
-
)}
|
|
68
|
-
|
|
69
|
-
{isComplete && (
|
|
70
|
-
<>
|
|
71
|
-
<div className='ssw-step-icon-circle ssw-ic-success'>
|
|
72
|
-
<svg
|
|
73
|
-
width='32'
|
|
74
|
-
height='32'
|
|
75
|
-
viewBox='0 0 24 24'
|
|
76
|
-
fill='none'
|
|
77
|
-
stroke='currentColor'
|
|
78
|
-
strokeWidth='2.5'
|
|
79
|
-
>
|
|
80
|
-
<path d='M20 6L9 17l-5-5' />
|
|
81
|
-
</svg>
|
|
82
|
-
</div>
|
|
83
|
-
<div className='ssw-step-title'>Swap Complete!</div>
|
|
84
|
-
<div className='ssw-step-subtitle'>
|
|
85
|
-
Swapped {sellAsset.symbol} for {buyAsset.symbol}
|
|
86
|
-
</div>
|
|
87
|
-
{explorerUrl && <ExplorerLink url={explorerUrl} />}
|
|
88
|
-
<div className='ssw-step-actions'>
|
|
89
|
-
<button
|
|
90
|
-
className='ssw-action-btn'
|
|
91
|
-
onClick={() => send({ type: 'RESET' })}
|
|
92
|
-
type='button'
|
|
93
|
-
>
|
|
94
|
-
New Swap
|
|
95
|
-
</button>
|
|
96
|
-
</div>
|
|
97
|
-
</>
|
|
98
|
-
)}
|
|
99
|
-
|
|
100
|
-
{isError && (
|
|
101
|
-
<>
|
|
102
|
-
<div className='ssw-step-icon-circle ssw-ic-error'>
|
|
103
|
-
<svg
|
|
104
|
-
width='32'
|
|
105
|
-
height='32'
|
|
106
|
-
viewBox='0 0 24 24'
|
|
107
|
-
fill='none'
|
|
108
|
-
stroke='currentColor'
|
|
109
|
-
strokeWidth='2'
|
|
110
|
-
>
|
|
111
|
-
<circle cx='12' cy='12' r='10' />
|
|
112
|
-
<path d='M15 9l-6 6M9 9l6 6' />
|
|
113
|
-
</svg>
|
|
114
|
-
</div>
|
|
115
|
-
<div className='ssw-step-title'>Transaction Failed</div>
|
|
116
|
-
<div className='ssw-step-subtitle'>{truncatedError ?? 'Something went wrong'}</div>
|
|
117
|
-
<div className='ssw-step-actions'>
|
|
118
|
-
{retryCount < 3 && (
|
|
119
|
-
<button
|
|
120
|
-
className='ssw-action-btn'
|
|
121
|
-
onClick={() => send({ type: 'RETRY' })}
|
|
122
|
-
type='button'
|
|
123
|
-
>
|
|
124
|
-
Retry
|
|
125
|
-
</button>
|
|
126
|
-
)}
|
|
127
|
-
<button
|
|
128
|
-
className='ssw-action-btn ssw-secondary'
|
|
129
|
-
onClick={() => send({ type: 'RESET' })}
|
|
130
|
-
type='button'
|
|
131
|
-
>
|
|
132
|
-
Start Over
|
|
133
|
-
</button>
|
|
134
|
-
</div>
|
|
135
|
-
</>
|
|
136
|
-
)}
|
|
137
|
-
</div>
|
|
138
|
-
)
|
|
139
|
-
}
|