@openocean.finance/widget 1.0.2 → 1.0.4

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.
Files changed (92) hide show
  1. package/package.json +4 -5
  2. package/src/components/AmountInput/AmountInput.tsx +2 -10
  3. package/src/components/AmountInput/AmountInputEndAdornment.tsx +82 -46
  4. package/src/components/AmountInput/PriceFormHelperText.tsx +13 -13
  5. package/src/components/Avatar/TokenAvatar.tsx +1 -1
  6. package/src/components/ChainSelect/ChainSelect.tsx +1 -1
  7. package/src/components/ChainSelect/useChainSelect.ts +1 -1
  8. package/src/components/ContractComponent/ItemPrice.tsx +1 -1
  9. package/src/components/ContractComponent/NFT/types.ts +1 -1
  10. package/src/components/Messages/WarningMessages.tsx +5 -5
  11. package/src/components/Messages/useMessageQueue.ts +1 -1
  12. package/src/components/RouteCard/RouteCard.tsx +2 -2
  13. package/src/components/RouteCard/RouteCardEssentials.tsx +1 -1
  14. package/src/components/RouteCard/getMatchingLabels.ts +1 -1
  15. package/src/components/RouteCard/types.ts +1 -1
  16. package/src/components/Routes/RoutesExpanded.tsx +1 -1
  17. package/src/components/Step/CircularProgress.style.tsx +1 -1
  18. package/src/components/Step/CircularProgress.tsx +1 -1
  19. package/src/components/Step/DestinationWalletAddress.tsx +2 -2
  20. package/src/components/Step/Step.tsx +6 -3
  21. package/src/components/Step/StepList.tsx +1 -1
  22. package/src/components/Step/StepProcess.tsx +2 -2
  23. package/src/components/StepActions/StepActions.tsx +5 -5
  24. package/src/components/StepActions/StepFees.tsx +2 -2
  25. package/src/components/StepActions/types.ts +3 -3
  26. package/src/components/Timer/RouteTimer.tsx +1 -1
  27. package/src/components/Timer/StepTimer.tsx +5 -5
  28. package/src/components/Token/Token.tsx +9 -7
  29. package/src/components/TokenList/TokenListItem.tsx +1 -1
  30. package/src/components/TokenList/types.ts +1 -1
  31. package/src/components/TokenRate/TokenRate.tsx +1 -1
  32. package/src/components/TransactionDetails.tsx +1 -1
  33. package/src/config/coinbase.ts +1 -1
  34. package/src/config/metaMask.ts +1 -1
  35. package/src/hooks/useAddressValidation.ts +2 -2
  36. package/src/hooks/useAvailableChains.ts +2 -2
  37. package/src/hooks/useChains.ts +1 -1
  38. package/src/hooks/useExplorer.ts +4 -2
  39. package/src/hooks/useFromTokenSufficiency.ts +1 -1
  40. package/src/hooks/useGasRecommendation.ts +4 -1
  41. package/src/hooks/useGasSufficiency.ts +7 -3
  42. package/src/hooks/useInitializer.ts +1 -1
  43. package/src/hooks/useIsBatchingSupported.ts +2 -2
  44. package/src/hooks/useIsCompatibleDestinationAccount.ts +1 -1
  45. package/src/hooks/useIsContractAddress.ts +1 -1
  46. package/src/hooks/useProcessMessage.ts +23 -23
  47. package/src/hooks/useRouteExecution.ts +5 -2
  48. package/src/hooks/useRoutes.ts +4 -4
  49. package/src/hooks/useToAddressRequirements.ts +1 -1
  50. package/src/hooks/useToAddressReset.ts +1 -1
  51. package/src/hooks/useTokenBalance.ts +5 -1
  52. package/src/hooks/useTokenBalances.ts +1 -1
  53. package/src/hooks/useTokenSearch.ts +5 -2
  54. package/src/hooks/useTokens.ts +6 -5
  55. package/src/hooks/useTools.ts +1 -1
  56. package/src/hooks/useTransactionDetails.ts +2 -2
  57. package/src/hooks/useTransactionHistory.ts +8 -2
  58. package/src/index.ts +2 -2
  59. package/src/pages/MainPage/MainWarningMessages.tsx +1 -1
  60. package/src/pages/RoutesPage/RoutesPage.tsx +1 -1
  61. package/src/pages/SelectChainPage/SelectChainPage.tsx +1 -1
  62. package/src/pages/SelectEnabledToolsPage.tsx +1 -1
  63. package/src/pages/SettingsPage/RoutePrioritySettings.tsx +1 -1
  64. package/src/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +7 -4
  65. package/src/pages/TransactionDetailsPage/TransferIdCard.tsx +3 -2
  66. package/src/pages/TransactionHistoryPage/TransactionHistoryItem.tsx +2 -2
  67. package/src/pages/TransactionHistoryPage/TransactionHistoryPage.tsx +1 -1
  68. package/src/pages/TransactionPage/ExchangeRateBottomSheet.tsx +1 -1
  69. package/src/pages/TransactionPage/TokenValueBottomSheet.tsx +2 -2
  70. package/src/pages/TransactionPage/TransactionPage.tsx +1 -1
  71. package/src/pages/TransactionPage/types.ts +1 -1
  72. package/src/providers/WalletProvider/EVMProvider.tsx +1 -1
  73. package/src/providers/WalletProvider/SDKProviders.tsx +8 -2
  74. package/src/providers/WalletProvider/SVMProvider.tsx +1 -1
  75. package/src/providers/WalletProvider/UTXOProvider.tsx +1 -1
  76. package/src/providers/WalletProvider/useExternalWalletProvider.ts +1 -1
  77. package/src/providers/WidgetProvider/WidgetProvider.tsx +2 -2
  78. package/src/services/DebridgeService.ts +26 -107
  79. package/src/services/ExecuteRoute.ts +55 -26
  80. package/src/stores/form/types.ts +1 -1
  81. package/src/stores/routes/createRouteExecutionStore.ts +1 -1
  82. package/src/stores/routes/types.ts +1 -1
  83. package/src/stores/routes/utils.ts +1 -1
  84. package/src/stores/settings/types.ts +1 -1
  85. package/src/types/events.ts +6 -1
  86. package/src/types/token.ts +1 -1
  87. package/src/types/widget.ts +10 -10
  88. package/src/utils/chainType.ts +1 -1
  89. package/src/utils/converters.ts +2 -2
  90. package/src/utils/fees.ts +6 -1
  91. package/src/utils/getPriceImpact.ts +1 -1
  92. /package/src/icons/{lifi.ts → openocean.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openocean.finance/widget",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Openocean Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -25,9 +25,8 @@
25
25
  "unlink:sdk": "pnpm unlink --global @openocean.finance/sdk",
26
26
  "test": "vitest run"
27
27
  },
28
- "author": "Eugene Chybisov <@openocean.finance>",
29
-
30
- "license": "Apache-1.0",
28
+ "author": "openocean",
29
+ "license": "ISC",
31
30
  "keywords": [
32
31
  "widget",
33
32
  "openocean-widget",
@@ -45,7 +44,7 @@
45
44
  "@bigmi/core": "^0.1.1",
46
45
  "@emotion/react": "^11.14.0",
47
46
  "@emotion/styled": "^11.14.0",
48
- "@lifi/sdk": "3.6.2",
47
+ "@openocean.finance/widget-sdk": "^1.0.0",
49
48
  "@openocean.finance/wallet-management": "^1.0.2",
50
49
  "@mui/icons-material": "6.0.2",
51
50
  "@mui/material": "^6.4.8",
@@ -1,5 +1,5 @@
1
- import type { Token } from '@lifi/sdk'
2
1
  import type { CardProps } from '@mui/material'
2
+ import type { Token } from '@openocean.finance/widget-sdk'
3
3
  import type { ChangeEvent, ReactNode } from 'react'
4
4
  import { useLayoutEffect, useRef } from 'react'
5
5
  import { useTranslation } from 'react-i18next'
@@ -81,15 +81,7 @@ export const AmountInputBase: React.FC<
81
81
  const { onChange, onBlur, value } = useFieldController({ name: amountKey })
82
82
  inputValue = value || ''
83
83
  if (formType === 'to') {
84
- const {
85
- routes,
86
- isLoading,
87
- isFetching,
88
- isFetched,
89
- dataUpdatedAt,
90
- refetchTime,
91
- refetch,
92
- } = useRoutes()
84
+ const { routes } = useRoutes()
93
85
  if (routes) {
94
86
  const router = routes[0] || { toAmount: 0, toToken: { decimals: 18 } }
95
87
  inputValue = formatTokenAmount(
@@ -1,8 +1,11 @@
1
1
  import { InputAdornment } from '@mui/material'
2
+ import { CircularProgress } from '@mui/material'
3
+ import { useState } from 'react'
2
4
  import { useTranslation } from 'react-i18next'
3
5
  import { formatUnits } from 'viem'
4
6
  import { useAvailableChains } from '../../hooks/useAvailableChains.js'
5
7
  import { useGasRecommendation } from '../../hooks/useGasRecommendation.js'
8
+ import { useRoutes } from '../../hooks/useRoutes.js'
6
9
  import { useTokenAddressBalance } from '../../hooks/useTokenAddressBalance.js'
7
10
  import { DebridgeService } from '../../services/DebridgeService.js'
8
11
  import type { FormTypeProps } from '../../stores/form/types.js'
@@ -16,6 +19,7 @@ export const AmountInputEndAdornment = ({ formType }: FormTypeProps) => {
16
19
  const { t } = useTranslation()
17
20
  const { getChainById } = useAvailableChains()
18
21
  const { setFieldValue } = useFieldActions()
22
+ const [isMaxLoading, setIsMaxLoading] = useState(false)
19
23
 
20
24
  const [fromChainId, fromTokenAddress] = useFieldValues(
21
25
  FormKeyHelper.getChainKey(formType),
@@ -35,6 +39,16 @@ export const AmountInputEndAdornment = ({ formType }: FormTypeProps) => {
35
39
  const { data } = useGasRecommendation(fromChainId)
36
40
 
37
41
  const [state] = useSplitSubvariantStore((storeState) => [storeState.state])
42
+
43
+ const { routes } = useRoutes()
44
+ let prependedOperatingExpenseCost = 0n
45
+ if (routes) {
46
+ const router = routes[0] || { toAmount: 0, toToken: { decimals: 18 } }
47
+ if (router.data && router.data.prependedOperatingExpenseCost) {
48
+ prependedOperatingExpenseCost = router.data.prependedOperatingExpenseCost
49
+ }
50
+ }
51
+
38
52
  const handleMax = async () => {
39
53
  if (!token?.amount) {
40
54
  return
@@ -44,59 +58,73 @@ export const AmountInputEndAdornment = ({ formType }: FormTypeProps) => {
44
58
  let maxAmount = token.amount
45
59
 
46
60
  let gas = 0n
61
+ try {
62
+ if (
63
+ state === 'bridge' &&
64
+ fromChainId !== toChainId &&
65
+ fromTokenAddress &&
66
+ toTokenAddress
67
+ ) {
68
+ if (!prependedOperatingExpenseCost) {
69
+ setIsMaxLoading(true)
70
+ prependedOperatingExpenseCost = await getCost({
71
+ srcChainId:
72
+ fromChainId === 1151111081099710 ? 7565164 : fromChainId,
73
+ srcChainTokenIn: fromTokenAddress,
74
+ srcChainTokenInAmount: maxAmount,
75
+ dstChainTokenOutAmount: 'auto',
76
+ dstChainId: toChainId === 1151111081099710 ? 7565164 : toChainId,
77
+ dstChainTokenOut: toTokenAddress,
78
+ prependOperatingExpenses: true,
79
+ additionalTakerRewardBps: 0,
80
+ tab: new Date().getTime(),
81
+ })
82
+ }
47
83
 
48
- if (state === 'bridge') {
49
- const prependedOperatingExpenseCost = await getCost({
50
- srcChainId: fromChainId === 1151111081099710 ? 7565164 : fromChainId,
51
- srcChainTokenIn: fromTokenAddress,
52
- srcChainTokenInAmount: maxAmount,
53
- dstChainTokenOutAmount: 'auto',
54
- dstChainId: toChainId === 1151111081099710 ? 7565164 : toChainId,
55
- dstChainTokenOut: toTokenAddress,
56
- prependOperatingExpenses: true,
57
- additionalTakerRewardBps: 0,
58
- tab: new Date().getTime(),
59
- })
60
-
61
- gas = BigInt(
62
- Number.parseInt((1.15 * prependedOperatingExpenseCost).toString())
63
- )
64
- if (chain?.nativeToken.address === fromTokenAddress) {
65
- if (fromChainId === 1151111081099710) {
66
- gas += 15000000n + (8157120n + 4000000n + 890880n)
67
- } else if (fromChainId === 8453) {
68
- gas += 1000000000000000n + 1000000000000n
84
+ gas = BigInt(
85
+ Number.parseInt((1.15 * prependedOperatingExpenseCost).toString())
86
+ )
87
+ if (chain?.nativeToken.address === fromTokenAddress) {
88
+ if (fromChainId === 1151111081099710) {
89
+ gas += 15000000n + (8157120n + 4000000n + 890880n)
90
+ } else if (fromChainId === 8453) {
91
+ gas += 1000000000000000n + 1000000000000n
92
+ }
69
93
  }
70
94
  }
71
- }
72
95
 
73
- if (state === 'swap') {
74
- if (
75
- chain?.nativeToken.address === fromTokenAddress &&
76
- data?.recommended
77
- ) {
78
- gas = BigInt(data.recommended.amount) / 2n
96
+ if (state === 'swap' || fromChainId === toChainId) {
97
+ if (
98
+ chain?.nativeToken.address === fromTokenAddress &&
99
+ data?.recommended
100
+ ) {
101
+ gas = BigInt(data.recommended.amount) / 2n
102
+ }
79
103
  }
80
- }
81
104
 
82
- if (token.amount > gas) {
83
- maxAmount = maxAmount - gas
84
- } else {
85
- maxAmount = 0n
86
- }
105
+ if (token.amount > gas) {
106
+ maxAmount = maxAmount - gas
107
+ } else {
108
+ maxAmount = 0n
109
+ }
87
110
 
88
- if (maxAmount) {
89
- setFieldValue(
90
- FormKeyHelper.getAmountKey(formType),
91
- formatUnits(maxAmount, token.decimals),
92
- {
111
+ if (maxAmount) {
112
+ setFieldValue(
113
+ FormKeyHelper.getAmountKey(formType),
114
+ formatUnits(maxAmount, token.decimals),
115
+ {
116
+ isTouched: true,
117
+ }
118
+ )
119
+ } else {
120
+ setFieldValue(FormKeyHelper.getAmountKey(formType), '', {
93
121
  isTouched: true,
94
- }
95
- )
96
- } else {
97
- setFieldValue(FormKeyHelper.getAmountKey(formType), '', {
98
- isTouched: true,
99
- })
122
+ })
123
+ }
124
+ } catch (error) {
125
+ console.error('handleMax error', error)
126
+ } finally {
127
+ setIsMaxLoading(false)
100
128
  }
101
129
  }
102
130
 
@@ -105,7 +133,15 @@ export const AmountInputEndAdornment = ({ formType }: FormTypeProps) => {
105
133
  {isLoading && fromTokenAddress ? (
106
134
  <MaxButtonSkeleton variant="rectangular" />
107
135
  ) : formType === 'from' && token?.amount ? (
108
- <MaxButton onClick={handleMax}>{t('button.max')}</MaxButton>
136
+ <MaxButton
137
+ onClick={handleMax}
138
+ disabled={isMaxLoading}
139
+ startIcon={
140
+ isMaxLoading ? <CircularProgress size={14} color="inherit" /> : null
141
+ }
142
+ >
143
+ {t('button.max')}
144
+ </MaxButton>
109
145
  ) : null}
110
146
  </InputAdornment>
111
147
  )
@@ -1,12 +1,12 @@
1
- import type { TokenAmount } from '@lifi/sdk'
2
1
  import { FormHelperText, Skeleton, Typography } from '@mui/material'
2
+ import type { TokenAmount } from '@openocean.finance/widget-sdk'
3
3
  import { useTranslation } from 'react-i18next'
4
+ import { useRoutes } from '../../hooks/useRoutes.js'
4
5
  import { useTokenAddressBalance } from '../../hooks/useTokenAddressBalance.js'
5
6
  import type { FormTypeProps } from '../../stores/form/types.js'
6
7
  import { FormKeyHelper } from '../../stores/form/types.js'
7
8
  import { useFieldValues } from '../../stores/form/useFieldValues.js'
8
9
  import { formatTokenAmount, formatTokenPrice } from '../../utils/format.js'
9
- import { useRoutes } from '../../hooks/useRoutes.js'
10
10
 
11
11
  export const PriceFormHelperText: React.FC<FormTypeProps> = ({ formType }) => {
12
12
  const [chainId, tokenAddress] = useFieldValues(
@@ -35,21 +35,21 @@ export const PriceFormHelperTextBase: React.FC<
35
35
  const { t } = useTranslation()
36
36
  const [amount] = useFieldValues(FormKeyHelper.getAmountKey(formType))
37
37
  const tokenAmount = token
38
- ? formatTokenAmount(token.amount, token.decimals)
39
- : '0'
38
+ ? formatTokenAmount(token.amount, token.decimals)
39
+ : '0'
40
40
  const tokenPrice = formatTokenPrice(amount, token?.priceUSD)
41
- let toTokenPrice;
42
- if(formType === 'to'){
43
- const {
44
- routes
45
- } = useRoutes()
46
- if(routes){
47
- const router = routes[0] || { toAmount: 0, toToken: { decimals:18 } };
48
- const toAmount = formatTokenAmount(BigInt(router.toAmount), router.toToken.decimals)
41
+ let toTokenPrice
42
+ if (formType === 'to') {
43
+ const { routes } = useRoutes()
44
+ if (routes) {
45
+ const router = routes[0] || { toAmount: 0, toToken: { decimals: 18 } }
46
+ const toAmount = formatTokenAmount(
47
+ BigInt(router.toAmount),
48
+ router.toToken.decimals
49
+ )
49
50
  toTokenPrice = formatTokenPrice(toAmount, router.toToken.priceUSD)
50
51
  }
51
52
  } else {
52
-
53
53
  }
54
54
 
55
55
  return (
@@ -1,6 +1,6 @@
1
- import type { Chain, StaticToken } from '@lifi/sdk'
2
1
  import type { SxProps, Theme } from '@mui/material'
3
2
  import { Badge } from '@mui/material'
3
+ import type { Chain, StaticToken } from '@openocean.finance/widget-sdk'
4
4
  import { useChain } from '../../hooks/useChain.js'
5
5
  import { useToken } from '../../hooks/useToken.js'
6
6
  import { AvatarBadgedSkeleton } from './Avatar.js'
@@ -1,5 +1,5 @@
1
- import type { EVMChain } from '@lifi/sdk'
2
1
  import { Avatar, Box, Skeleton, Tooltip, Typography } from '@mui/material'
2
+ import type { EVMChain } from '@openocean.finance/widget-sdk'
3
3
  import { useEffect } from 'react'
4
4
  import { useNavigate } from 'react-router-dom'
5
5
  import {
@@ -1,4 +1,4 @@
1
- import type { EVMChain } from '@lifi/sdk'
1
+ import type { EVMChain } from '@openocean.finance/widget-sdk'
2
2
  import { useChains } from '../../hooks/useChains.js'
3
3
  import { useSwapOnly } from '../../hooks/useSwapOnly.js'
4
4
  import { useToAddressReset } from '../../hooks/useToAddressReset.js'
@@ -1,4 +1,4 @@
1
- import type { ContractCall } from '@lifi/sdk'
1
+ import type { ContractCall } from '@openocean.finance/widget-sdk'
2
2
  import { useEffect } from 'react'
3
3
  import { formatUnits } from 'viem'
4
4
  import { useFieldActions } from '../../stores/form/useFieldActions.js'
@@ -1,4 +1,4 @@
1
- import type { ContractCall, TokenAmount } from '@lifi/sdk'
1
+ import type { ContractCall, TokenAmount } from '@openocean.finance/widget-sdk'
2
2
 
3
3
  export interface NFTBaseProps {
4
4
  imageUrl?: string
@@ -1,6 +1,6 @@
1
- import type { Route } from '@lifi/sdk'
2
1
  import type { BoxProps } from '@mui/material'
3
2
  import { Collapse } from '@mui/material'
3
+ import type { Route } from '@openocean.finance/widget-sdk'
4
4
  import { AccountNotDeployedMessage } from './AccountNotDeployedMessage.js'
5
5
  import { FundsSufficiencyMessage } from './FundsSufficiencyMessage.js'
6
6
  import { GasSufficiencyMessage } from './GasSufficiencyMessage.js'
@@ -33,12 +33,12 @@ export const WarningMessages: React.FC<WarningMessagesProps> = ({
33
33
  case 'ACCOUNT_NOT_DEPLOYED':
34
34
  return <AccountNotDeployedMessage {...props} />
35
35
  case 'TO_ADDRESS_REQUIRED':
36
- const fromChainId = route?.fromChainId;
37
- const toChainId = route?.toChainId;
36
+ const fromChainId = route?.fromChainId
37
+ const toChainId = route?.toChainId
38
38
  if (fromChainId && toChainId && fromChainId !== toChainId) {
39
- return <ToAddressRequiredMessage {...props} />;
39
+ return <ToAddressRequiredMessage {...props} />
40
40
  }
41
- return null;
41
+ return null
42
42
  default:
43
43
  return null
44
44
  }
@@ -1,4 +1,4 @@
1
- import type { Route } from '@lifi/sdk'
1
+ import type { Route } from '@openocean.finance/widget-sdk'
2
2
  import { useMemo } from 'react'
3
3
  import { useFromTokenSufficiency } from '../../hooks/useFromTokenSufficiency.js'
4
4
  import { useGasSufficiency } from '../../hooks/useGasSufficiency.js'
@@ -1,7 +1,7 @@
1
- import type { TokenAmount } from '@lifi/sdk'
2
- import { isGaslessStep } from '@lifi/sdk'
3
1
  import { ExpandLess, ExpandMore } from '@mui/icons-material'
4
2
  import { Box, Collapse } from '@mui/material'
3
+ import type { TokenAmount } from '@openocean.finance/widget-sdk'
4
+ import { isGaslessStep } from '@openocean.finance/widget-sdk'
5
5
  import type { MouseEventHandler } from 'react'
6
6
  import { useState } from 'react'
7
7
  import { useTranslation } from 'react-i18next'
@@ -1,6 +1,6 @@
1
- import { isGaslessStep } from '@lifi/sdk'
2
1
  import { AccessTimeFilled, LocalGasStationRounded } from '@mui/icons-material'
3
2
  import { Box, Tooltip, Typography } from '@mui/material'
3
+ import { isGaslessStep } from '@openocean.finance/widget-sdk'
4
4
  import { useTranslation } from 'react-i18next'
5
5
  import { getAccumulatedFeeCostsBreakdown } from '../../utils/fees.js'
6
6
  import { FeeBreakdownTooltip } from '../FeeBreakdownTooltip.js'
@@ -1,4 +1,4 @@
1
- import type { Route } from '@lifi/sdk'
1
+ import type { Route } from '@openocean.finance/widget-sdk'
2
2
  import type { RouteLabel, RouteLabelRule } from '../../types/widget.js'
3
3
  import { isItemAllowed } from '../../utils/item.js'
4
4
 
@@ -1,4 +1,4 @@
1
- import type { Route } from '@lifi/sdk'
1
+ import type { Route } from '@openocean.finance/widget-sdk'
2
2
 
3
3
  export interface RouteCardProps {
4
4
  route: Route
@@ -1,6 +1,6 @@
1
- import type { Route } from '@lifi/sdk'
2
1
  import { Collapse, Grow, Stack, Typography } from '@mui/material'
3
2
  import { useAccount } from '@openocean.finance/wallet-management'
3
+ import type { Route } from '@openocean.finance/widget-sdk'
4
4
  import { type PropsWithChildren, useEffect, useRef } from 'react'
5
5
  import { useTranslation } from 'react-i18next'
6
6
  import type { RouteObject } from 'react-router-dom'
@@ -1,4 +1,3 @@
1
- import type { ProcessStatus, Substatus } from '@lifi/sdk'
2
1
  import type { Theme } from '@mui/material'
3
2
  import {
4
3
  Box,
@@ -8,6 +7,7 @@ import {
8
7
  keyframes,
9
8
  styled,
10
9
  } from '@mui/material'
10
+ import type { ProcessStatus, Substatus } from '@openocean.finance/widget-sdk'
11
11
 
12
12
  const getStatusColor = (
13
13
  theme: Theme,
@@ -1,4 +1,3 @@
1
- import type { Process } from '@lifi/sdk'
2
1
  import {
3
2
  Done,
4
3
  ErrorRounded,
@@ -6,6 +5,7 @@ import {
6
5
  WarningRounded,
7
6
  } from '@mui/icons-material'
8
7
  import { darken } from '@mui/material'
8
+ import type { Process } from '@openocean.finance/widget-sdk'
9
9
  import {
10
10
  CircularIcon,
11
11
  CircularProgressPending,
@@ -1,12 +1,12 @@
1
- import type { LiFiStepExtended } from '@lifi/sdk'
2
1
  import { LinkRounded, Wallet } from '@mui/icons-material'
3
2
  import { Box, Link, Typography } from '@mui/material'
3
+ import type { OpenOceanStepExtended } from '@openocean.finance/widget-sdk'
4
4
  import { useTranslation } from 'react-i18next'
5
5
  import { CardIconButton } from '../Card/CardIconButton.js'
6
6
  import { CircularIcon } from './CircularProgress.style.js'
7
7
 
8
8
  export const DestinationWalletAddress: React.FC<{
9
- step: LiFiStepExtended
9
+ step: OpenOceanStepExtended
10
10
  toAddress: string
11
11
  toAddressLink: string
12
12
  }> = ({ step, toAddress, toAddressLink }) => {
@@ -1,5 +1,8 @@
1
- import type { LiFiStepExtended, TokenAmount } from '@lifi/sdk'
2
1
  import { Box } from '@mui/material'
2
+ import type {
3
+ OpenOceanStepExtended,
4
+ TokenAmount,
5
+ } from '@openocean.finance/widget-sdk'
3
6
  import { useTranslation } from 'react-i18next'
4
7
  import { Card } from '../../components/Card/Card.js'
5
8
  import { CardTitle } from '../../components/Card/CardTitle.js'
@@ -12,7 +15,7 @@ import { DestinationWalletAddress } from './DestinationWalletAddress.js'
12
15
  import { StepProcess } from './StepProcess.js'
13
16
 
14
17
  export const Step: React.FC<{
15
- step: LiFiStepExtended
18
+ step: OpenOceanStepExtended
16
19
  fromToken?: TokenAmount
17
20
  toToken?: TokenAmount
18
21
  impactToken?: TokenAmount
@@ -37,7 +40,7 @@ export const Step: React.FC<{
37
40
  const isCustomVariant = hasCustomStep && subvariant === 'custom'
38
41
 
39
42
  switch (step.type) {
40
- case 'lifi': {
43
+ case 'openocean': {
41
44
  if (hasBridgeStep && hasSwapStep) {
42
45
  return isCustomVariant
43
46
  ? subvariantOptions?.custom === 'deposit'
@@ -1,4 +1,4 @@
1
- import type { RouteExtended, TokenAmount } from '@lifi/sdk'
1
+ import type { RouteExtended, TokenAmount } from '@openocean.finance/widget-sdk'
2
2
  import { Fragment } from 'react'
3
3
  import { StepDivider } from '../../components/StepDivider/StepDivider.js'
4
4
  import type { WidgetSubvariant } from '../../types/widget.js'
@@ -1,13 +1,13 @@
1
- import type { LiFiStep, Process } from '@lifi/sdk'
2
1
  import { OpenInNewRounded } from '@mui/icons-material'
3
2
  import { Box, Link, Typography } from '@mui/material'
3
+ import type { OpenOceanStep, Process } from '@openocean.finance/widget-sdk'
4
4
  import { useExplorer } from '../../hooks/useExplorer.js'
5
5
  import { useProcessMessage } from '../../hooks/useProcessMessage.js'
6
6
  import { CardIconButton } from '../Card/CardIconButton.js'
7
7
  import { CircularProgress } from './CircularProgress.js'
8
8
 
9
9
  export const StepProcess: React.FC<{
10
- step: LiFiStep
10
+ step: OpenOceanStep
11
11
  process: Process
12
12
  }> = ({ step, process }) => {
13
13
  const { title, message } = useProcessMessage(step, process)
@@ -1,5 +1,3 @@
1
- import type { LiFiStep, StepExtended } from '@lifi/sdk'
2
- import { isGaslessStep } from '@lifi/sdk'
3
1
  import { ArrowForward, ExpandLess, ExpandMore } from '@mui/icons-material'
4
2
  import type { StepIconProps } from '@mui/material'
5
3
  import {
@@ -10,11 +8,13 @@ import {
10
8
  Stepper,
11
9
  Typography,
12
10
  } from '@mui/material'
11
+ import type { OpenOceanStep, StepExtended } from '@openocean.finance/widget-sdk'
12
+ import { isGaslessStep } from '@openocean.finance/widget-sdk'
13
13
  import type { MouseEventHandler } from 'react'
14
14
  import { useState } from 'react'
15
15
  import { useTranslation } from 'react-i18next'
16
16
  import { useAvailableChains } from '../../hooks/useAvailableChains.js'
17
- import { OOToolLogo } from '../../icons/lifi.js'
17
+ import { OOToolLogo } from '../../icons/openocean.js'
18
18
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
19
19
  import { HiddenUI } from '../../types/widget.js'
20
20
  import { formatTokenAmount, formatTokenPrice } from '../../utils/format.js'
@@ -304,8 +304,8 @@ export const CustomStepDetailsLabel: React.FC<StepDetailsLabelProps> = ({
304
304
  // FIXME: step transaction request overrides step tool details, but not included step tool details
305
305
  const toolDetails =
306
306
  subvariant === 'custom' &&
307
- (step as unknown as LiFiStep).includedSteps?.length > 0
308
- ? (step as unknown as LiFiStep).includedSteps.find(
307
+ (step as unknown as OpenOceanStep).includedSteps?.length > 0
308
+ ? (step as unknown as OpenOceanStep).includedSteps.find(
309
309
  (step) => step.tool === 'custom' && step.toolDetails.key !== 'custom'
310
310
  )?.toolDetails || step.toolDetails
311
311
  : step.toolDetails
@@ -1,12 +1,12 @@
1
- import type { LiFiStepExtended } from '@lifi/sdk'
2
1
  import type { TypographyProps } from '@mui/material'
3
2
  import { Typography } from '@mui/material'
3
+ import type { OpenOceanStepExtended } from '@openocean.finance/widget-sdk'
4
4
  import { useTranslation } from 'react-i18next'
5
5
  import { getStepFeeCostsBreakdown } from '../../utils/fees.js'
6
6
 
7
7
  export const StepFees: React.FC<
8
8
  TypographyProps & {
9
- step: LiFiStepExtended
9
+ step: OpenOceanStepExtended
10
10
  }
11
11
  > = ({ step, ...other }) => {
12
12
  const { t } = useTranslation()
@@ -1,5 +1,5 @@
1
- import type { LiFiStep, Step } from '@lifi/sdk'
2
1
  import type { BoxProps } from '@mui/material'
2
+ import type { OpenOceanStep, Step } from '@openocean.finance/widget-sdk'
3
3
  import type {
4
4
  SubvariantOptions,
5
5
  WidgetFeeConfig,
@@ -7,7 +7,7 @@ import type {
7
7
  } from '../../types/widget.js'
8
8
 
9
9
  export interface StepActionsProps extends BoxProps {
10
- step: LiFiStep
10
+ step: OpenOceanStep
11
11
  dense?: boolean
12
12
  }
13
13
 
@@ -20,5 +20,5 @@ export interface StepDetailsLabelProps {
20
20
  }
21
21
 
22
22
  export interface IncludedStepsProps {
23
- step: LiFiStep
23
+ step: OpenOceanStep
24
24
  }
@@ -1,4 +1,4 @@
1
- import type { RouteExtended } from '@lifi/sdk'
1
+ import type { RouteExtended } from '@openocean.finance/widget-sdk'
2
2
 
3
3
  import { useStopwatch } from '../../hooks/timer/useStopwatch.js'
4
4
  import { useSettings } from '../../stores/settings/useSettings.js'
@@ -1,4 +1,4 @@
1
- import type { LiFiStepExtended } from '@lifi/sdk'
1
+ import type { OpenOceanStepExtended } from '@openocean.finance/widget-sdk'
2
2
  import { useEffect, useState } from 'react'
3
3
  import { useTranslation } from 'react-i18next'
4
4
  import { useStopwatch } from '../../hooks/timer/useStopwatch.js'
@@ -6,17 +6,17 @@ import { useSettings } from '../../stores/settings/useSettings.js'
6
6
  import { formatTimer } from '../../utils/timer.js'
7
7
  import { TimerContent } from './TimerContent.js'
8
8
 
9
- const getFirstExecutionProcess = (step: LiFiStepExtended) =>
9
+ const getFirstExecutionProcess = (step: OpenOceanStepExtended) =>
10
10
  step.execution?.process.at(0)
11
11
 
12
- const getExecutionProcess = (step: LiFiStepExtended) =>
12
+ const getExecutionProcess = (step: OpenOceanStepExtended) =>
13
13
  step.execution?.process.at(-1)
14
14
 
15
- const getStartTimestamp = (step: LiFiStepExtended) =>
15
+ const getStartTimestamp = (step: OpenOceanStepExtended) =>
16
16
  new Date(getFirstExecutionProcess(step)?.startedAt ?? Date.now())
17
17
 
18
18
  export const StepTimer: React.FC<{
19
- step: LiFiStepExtended
19
+ step: OpenOceanStepExtended
20
20
  hideInProgress?: boolean
21
21
  }> = ({ step }) => {
22
22
  const { i18n } = useTranslation()
@@ -1,6 +1,6 @@
1
- import type { LiFiStep, TokenAmount } from '@lifi/sdk'
2
1
  import type { BoxProps } from '@mui/material'
3
2
  import { Box, Grow, Skeleton, Tooltip } from '@mui/material'
3
+ import type { OpenOceanStep, TokenAmount } from '@openocean.finance/widget-sdk'
4
4
  import type { FC, PropsWithChildren, ReactElement } from 'react'
5
5
  import { useTranslation } from 'react-i18next'
6
6
  import { useChain } from '../../hooks/useChain.js'
@@ -17,7 +17,7 @@ interface TokenProps {
17
17
  token: TokenAmount
18
18
  impactToken?: TokenAmount
19
19
  enableImpactTokenTooltip?: boolean
20
- step?: LiFiStep
20
+ step?: OpenOceanStep
21
21
  stepVisible?: boolean
22
22
  disableDescription?: boolean
23
23
  isLoading?: boolean
@@ -41,11 +41,13 @@ export const TokenFallback: FC<TokenProps & BoxProps> = ({
41
41
  )
42
42
  return (
43
43
  <TokenBase
44
- token={{
45
- ...token,
46
- priceUSD: token.priceUSD || chainToken?.priceUSD,
47
- logoURI: token.logoURI || chainToken?.logoURI,
48
- } as TokenAmount}
44
+ token={
45
+ {
46
+ ...token,
47
+ priceUSD: token.priceUSD || chainToken?.priceUSD,
48
+ logoURI: token.logoURI || chainToken?.logoURI,
49
+ } as TokenAmount
50
+ }
49
51
  isLoading={isLoading || isLoadingToken}
50
52
  {...other}
51
53
  />
@@ -1,4 +1,3 @@
1
- import { ChainType } from '@lifi/sdk'
2
1
  import { OpenInNewRounded } from '@mui/icons-material'
3
2
  import {
4
3
  Avatar,
@@ -10,6 +9,7 @@ import {
10
9
  Slide,
11
10
  Typography,
12
11
  } from '@mui/material'
12
+ import { ChainType } from '@openocean.finance/widget-sdk'
13
13
  import type { MouseEventHandler } from 'react'
14
14
  import { useRef, useState } from 'react'
15
15
  import { useTranslation } from 'react-i18next'
@@ -1,5 +1,5 @@
1
- import type { ExtendedChain } from '@lifi/sdk'
2
1
  import type { Account } from '@openocean.finance/wallet-management'
2
+ import type { ExtendedChain } from '@openocean.finance/widget-sdk'
3
3
  import type { MouseEventHandler, MutableRefObject } from 'react'
4
4
  import type { FormType } from '../../stores/form/types.js'
5
5
  import type { TokenAmount } from '../../types/token.js'