Skip to content

Commit 69fcdb7

Browse files
authored
Remove canonical logic and ui (#863)
* Remove canonical logic and ui * feat: changeset
1 parent 1ed92a5 commit 69fcdb7

File tree

14 files changed

+124
-700
lines changed

14 files changed

+124
-700
lines changed

.changeset/great-pears-call.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@relayprotocol/relay-kit-ui': patch
3+
---
4+
5+
Remove canonical logic and ui

packages/ui/src/components/common/TransactionModal/DepositAddressModal.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ const InnerDepositAddressModal: FC<InnerDepositAddressModalProps> = ({
226226
seconds={seconds ?? 0}
227227
onOpenChange={onOpenChange}
228228
timeEstimate={timeEstimate?.formattedTime}
229-
isCanonical={false}
230229
details={details}
231230
isLoadingTransaction={isLoadingTransaction}
232231
requestId={requestId}

packages/ui/src/components/common/TransactionModal/TransactionModal.tsx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ type TransactionModalProps = {
2828
fromToken?: Token
2929
toToken?: Token
3030
address?: Address | string
31-
isCanonical?: boolean
32-
useExternalLiquidity: boolean
3331
slippageTolerance?: string
3432
wallet?: AdaptedWallet
3533
linkedWallets?: LinkedWallet[]
@@ -59,9 +57,7 @@ export const TransactionModal: FC<TransactionModalProps> = (
5957
address,
6058
fromToken,
6159
toToken,
62-
useExternalLiquidity,
6360
slippageTolerance,
64-
isCanonical,
6561
wallet,
6662
onOpenChange,
6763
onAnalyticEvent,
@@ -131,7 +127,6 @@ export const TransactionModal: FC<TransactionModalProps> = (
131127
currency_out_address: details?.currencyOut?.currency?.address,
132128
currency_out_decimals: toToken?.decimals,
133129
currency_out_usd: details?.currencyOut?.amountUsd,
134-
is_canonical: useExternalLiquidity,
135130
quote_id: quoteId,
136131
txHashes: steps
137132
?.map((step) => {
@@ -165,7 +160,6 @@ export const TransactionModal: FC<TransactionModalProps> = (
165160
<InnerTransactionModal
166161
address={address}
167162
onAnalyticEvent={onAnalyticEvent}
168-
isCanonical={isCanonical}
169163
{...transactionModalProps}
170164
{...rendererProps}
171165
/>
@@ -200,7 +194,6 @@ const InnerTransactionModal: FC<InnerTransactionModalProps> = ({
200194
seconds,
201195
onAnalyticEvent,
202196
timeEstimate,
203-
isCanonical,
204197
fromChain,
205198
toChain,
206199
isLoadingTransaction,
@@ -302,7 +295,6 @@ const InnerTransactionModal: FC<InnerTransactionModalProps> = ({
302295
seconds={seconds ?? 0}
303296
onOpenChange={onOpenChange}
304297
timeEstimate={timeEstimate?.formattedTime}
305-
isCanonical={isCanonical}
306298
details={details}
307299
isLoadingTransaction={isLoadingTransaction}
308300
requestId={requestId}

packages/ui/src/components/common/TransactionModal/steps/SwapSuccessStep.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ type SwapSuccessStepProps = {
4040
seconds: number
4141
fillTime: string
4242
timeEstimate?: string
43-
isCanonical?: boolean
4443
details?: Execute['details'] | null
4544
isLoadingTransaction?: boolean
4645
onOpenChange: (open: boolean) => void
@@ -59,7 +58,6 @@ export const SwapSuccessStep: FC<SwapSuccessStepProps> = ({
5958
fillTime,
6059
seconds,
6160
timeEstimate,
62-
isCanonical,
6361
details,
6462
isLoadingTransaction,
6563
onOpenChange,
@@ -122,16 +120,11 @@ export const SwapSuccessStep: FC<SwapSuccessStepProps> = ({
122120
// Show delayed screen when:
123121
// 1. Bitcoin as origin: Immediately (no status check needed, tx takes 10+ mins)
124122
// 2. Bitcoin as destination: When status reaches 'submitted'
125-
// 3. Canonical routes: When time estimate exceeds polling timeout
123+
126124
const isDelayedTx =
127125
isBitcoinOrigin ||
128126
(isBitcoinDestination &&
129-
(currentCheckStatus === 'submitted' ||
130-
currentCheckStatus === 'success')) ||
131-
(isCanonical &&
132-
timeEstimateMs >
133-
(relayClient?.maxPollingAttemptsBeforeTimeout ?? 30) *
134-
(relayClient?.pollingInterval ?? 5000))
127+
(currentCheckStatus === 'submitted' || currentCheckStatus === 'success'))
135128

136129
// Bitcoin transactions typically take 10+ minutes for confirmation
137130
const estimatedMinutes =

packages/ui/src/components/widgets/FeeBreakdown.tsx

Lines changed: 3 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,18 @@
11
import { useState, type FC } from 'react'
2-
import { Box, Button, Flex, Pill, Text } from '../primitives/index.js'
2+
import { Box, Button, Flex, Text } from '../primitives/index.js'
33
import type { ChildrenProps } from './SwapWidgetRenderer.js'
44
import { formatBN, formatDollar } from '../../utils/numbers.js'
55
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
66
import { faGasPump } from '@fortawesome/free-solid-svg-icons/faGasPump'
77
import { faChevronDown } from '@fortawesome/free-solid-svg-icons/faChevronDown'
88
import FetchingQuoteLoader from '../widgets/FetchingQuoteLoader.js'
9-
import SwapRouteSelector from '../widgets/SwapRouteSelector.js'
109
import type { RelayChain } from '@relayprotocol/relay-sdk'
1110
import {
1211
CollapsibleContent,
1312
CollapsibleRoot,
1413
CollapsibleTrigger
1514
} from '../primitives/Collapsible.js'
16-
import {
17-
faChevronRight,
18-
faClock,
19-
faInfoCircle
20-
} from '@fortawesome/free-solid-svg-icons'
15+
import { faClock, faInfoCircle } from '@fortawesome/free-solid-svg-icons'
2116
import { PriceImpactTooltip } from './PriceImpactTooltip.js'
2217
import { getSlippageRating, ratingToColor } from '../../utils/slippage.js'
2318
import Tooltip from '../primitives/Tooltip.js'
@@ -31,10 +26,6 @@ type Props = Pick<
3126
| 'toToken'
3227
| 'fromToken'
3328
| 'timeEstimate'
34-
| 'supportsExternalLiquidity'
35-
| 'useExternalLiquidity'
36-
| 'setUseExternalLiquidity'
37-
| 'canonicalTimeEstimate'
3829
> & {
3930
toChain?: RelayChain
4031
isSingleChainLocked?: boolean
@@ -56,11 +47,7 @@ const FeeBreakdown: FC<Props> = ({
5647
toToken,
5748
fromToken,
5849
toChain,
59-
supportsExternalLiquidity,
60-
useExternalLiquidity,
61-
setUseExternalLiquidity,
6250
timeEstimate,
63-
canonicalTimeEstimate,
6451
isSingleChainLocked,
6552
fromChainWalletVMSupported,
6653
isAutoSlippage,
@@ -176,38 +163,6 @@ const FeeBreakdown: FC<Props> = ({
176163
}
177164
]
178165

179-
if (!isSingleChainLocked && fromChainWalletVMSupported) {
180-
breakdown.unshift({
181-
title: 'Route',
182-
value: (
183-
<SwapRouteSelector
184-
chain={toChain}
185-
supportsExternalLiquidity={supportsExternalLiquidity}
186-
externalLiquidtySelected={useExternalLiquidity}
187-
onExternalLiquidityChange={(selected) => {
188-
setUseExternalLiquidity(selected)
189-
}}
190-
canonicalTimeEstimate={canonicalTimeEstimate?.formattedTime}
191-
error={error}
192-
trigger={
193-
<Button color="ghost" size="none">
194-
<Flex css={{ gap: '2', alignItems: 'center' }}>
195-
<Text style="subtitle2">
196-
{useExternalLiquidity ? 'Native' : 'Relay'}
197-
</Text>
198-
{supportsExternalLiquidity || useExternalLiquidity ? (
199-
<Box css={{ color: 'gray11', width: 14, flexShrink: 0 }}>
200-
<FontAwesomeIcon icon={faChevronRight} width={14} />
201-
</Box>
202-
) : null}
203-
</Flex>
204-
</Button>
205-
}
206-
/>
207-
)
208-
})
209-
}
210-
211166
if (!feeBreakdown) {
212167
if (isFetchingQuote) {
213168
return (
@@ -403,11 +358,6 @@ const FeeBreakdown: FC<Props> = ({
403358
}}
404359
>
405360
{breakdown.map((item) => {
406-
const showNativeBridgeWarning =
407-
item.title === 'Estimated time' &&
408-
useExternalLiquidity &&
409-
timeEstimate?.time &&
410-
timeEstimate?.time > 86400
411361
return (
412362
<React.Fragment key={item.title}>
413363
<Flex
@@ -417,33 +367,13 @@ const FeeBreakdown: FC<Props> = ({
417367
>
418368
<Text
419369
style="subtitle2"
420-
color={
421-
showNativeBridgeWarning ? 'warningSecondary' : 'subtle'
422-
}
370+
color={'subtle'}
423371
css={{ alignSelf: 'flex-start' }}
424372
>
425373
{item.title}
426374
</Text>
427375
{item.value}
428376
</Flex>
429-
{showNativeBridgeWarning ? (
430-
<Flex
431-
align="center"
432-
css={{
433-
gap: '2',
434-
py: '2',
435-
px: '3',
436-
backgroundColor: 'amber2',
437-
borderRadius: 12
438-
}}
439-
>
440-
<Text style="subtitle3" css={{ color: 'amber12' }}>
441-
Native bridge routes are expected to take{' '}
442-
{timeEstimate.formattedTime} but could be longer due to
443-
unexpected delays
444-
</Text>
445-
</Flex>
446-
) : null}
447377
</React.Fragment>
448378
)
449379
})}

0 commit comments

Comments
 (0)