@lifi/widget 1.13.5 → 1.14.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.
Files changed (61) hide show
  1. package/cjs/config/lifi.js +3 -1
  2. package/cjs/config/theme.js +4 -3
  3. package/cjs/config/version.d.ts +1 -1
  4. package/cjs/config/version.js +1 -1
  5. package/cjs/fonts/Inter-Black.woff +0 -0
  6. package/cjs/fonts/Inter-Black.woff2 +0 -0
  7. package/cjs/fonts/Inter-BlackItalic.woff +0 -0
  8. package/cjs/fonts/Inter-BlackItalic.woff2 +0 -0
  9. package/cjs/fonts/Inter-Bold.woff +0 -0
  10. package/cjs/fonts/Inter-Bold.woff2 +0 -0
  11. package/cjs/fonts/Inter-BoldItalic.woff +0 -0
  12. package/cjs/fonts/Inter-BoldItalic.woff2 +0 -0
  13. package/cjs/fonts/Inter-ExtraBold.woff +0 -0
  14. package/cjs/fonts/Inter-ExtraBold.woff2 +0 -0
  15. package/cjs/fonts/Inter-ExtraBoldItalic.woff +0 -0
  16. package/cjs/fonts/Inter-ExtraBoldItalic.woff2 +0 -0
  17. package/cjs/fonts/Inter-ExtraLight.woff +0 -0
  18. package/cjs/fonts/Inter-ExtraLight.woff2 +0 -0
  19. package/cjs/fonts/Inter-ExtraLightItalic.woff +0 -0
  20. package/cjs/fonts/Inter-ExtraLightItalic.woff2 +0 -0
  21. package/cjs/fonts/Inter-Italic.woff +0 -0
  22. package/cjs/fonts/Inter-Italic.woff2 +0 -0
  23. package/cjs/fonts/Inter-Light.woff +0 -0
  24. package/cjs/fonts/Inter-Light.woff2 +0 -0
  25. package/cjs/fonts/Inter-LightItalic.woff +0 -0
  26. package/cjs/fonts/Inter-LightItalic.woff2 +0 -0
  27. package/cjs/fonts/Inter-Medium.woff +0 -0
  28. package/cjs/fonts/Inter-Medium.woff2 +0 -0
  29. package/cjs/fonts/Inter-MediumItalic.woff +0 -0
  30. package/cjs/fonts/Inter-MediumItalic.woff2 +0 -0
  31. package/cjs/fonts/Inter-Regular.woff +0 -0
  32. package/cjs/fonts/Inter-Regular.woff2 +0 -0
  33. package/cjs/fonts/Inter-SemiBold.woff +0 -0
  34. package/cjs/fonts/Inter-SemiBold.woff2 +0 -0
  35. package/cjs/fonts/Inter-SemiBoldItalic.woff +0 -0
  36. package/cjs/fonts/Inter-SemiBoldItalic.woff2 +0 -0
  37. package/cjs/fonts/Inter-Thin.woff +0 -0
  38. package/cjs/fonts/Inter-Thin.woff2 +0 -0
  39. package/cjs/fonts/Inter-ThinItalic.woff +0 -0
  40. package/cjs/fonts/Inter-ThinItalic.woff2 +0 -0
  41. package/cjs/fonts/Inter-italic.var.woff2 +0 -0
  42. package/cjs/fonts/Inter-roman.var.woff2 +0 -0
  43. package/cjs/fonts/Inter.var.woff2 +0 -0
  44. package/cjs/fonts/inter.css +200 -0
  45. package/cjs/i18n/en/translation.json +167 -167
  46. package/cjs/providers/WalletProvider/WalletProvider.js +2 -2
  47. package/cjs/providers/WidgetProvider/WidgetProvider.js +4 -0
  48. package/cjs/stores/route/useRouteStore.js +36 -0
  49. package/cjs/utils/colors.d.ts +1 -1
  50. package/cjs/utils/colors.js +4 -4
  51. package/config/lifi.js +3 -1
  52. package/config/theme.js +4 -3
  53. package/config/version.d.ts +1 -1
  54. package/config/version.js +1 -1
  55. package/package.json +6 -6
  56. package/providers/WalletProvider/WalletProvider.js +2 -2
  57. package/providers/WidgetProvider/WidgetProvider.js +5 -1
  58. package/stores/route/useRouteStore.js +36 -0
  59. package/tsconfig.cjs.tsbuildinfo +1 -1
  60. package/utils/colors.d.ts +1 -1
  61. package/utils/colors.js +4 -4
@@ -1,175 +1,175 @@
1
1
  {
2
- "header": {
3
- "walletConnected": "Wallet connected",
4
- "connectWallet": "Connect wallet",
5
- "selectWallet": "Select your wallet",
6
- "swap": "Swap",
7
- "from": "Swap from",
8
- "to": "Swap to",
9
- "settings": "Settings",
10
- "routes": "You get",
11
- "swapHistory": "Swap history",
12
- "swapDetails": "Swap details"
2
+ "header": {
3
+ "walletConnected": "Wallet connected",
4
+ "connectWallet": "Connect wallet",
5
+ "selectWallet": "Select your wallet",
6
+ "swap": "Swap",
7
+ "from": "Swap from",
8
+ "to": "Swap to",
9
+ "settings": "Settings",
10
+ "routes": "You get",
11
+ "swapHistory": "Swap history",
12
+ "swapDetails": "Swap details"
13
+ },
14
+ "button": {
15
+ "connectWallet": "Connect wallet",
16
+ "switchChain": "Switch chain",
17
+ "swap": "Swap",
18
+ "reviewSwap": "Review swap",
19
+ "startSwap": "Start swap",
20
+ "restartSwap": "Restart swap",
21
+ "removeSwap": "Remove swap",
22
+ "done": "Done",
23
+ "okay": "Okay",
24
+ "seeDetails": "See details",
25
+ "tryAgain": "Try again",
26
+ "light": "Light",
27
+ "dark": "Dark",
28
+ "auto": "Auto",
29
+ "ok": "Ok",
30
+ "cancel": "Cancel",
31
+ "delete": "Delete",
32
+ "hide": "Hide",
33
+ "max": "max",
34
+ "contactSupport": "Contact support",
35
+ "lifiSwap": "LI.FI Swap"
36
+ },
37
+ "swap": {
38
+ "from": "From",
39
+ "to": "To",
40
+ "amount": "You pay",
41
+ "maxAmount": "/ {{amount}}",
42
+ "routes": "You get",
43
+ "approximateCurrency": "\u2248 {{value, currency(currency: USD)}}",
44
+ "currency": "{{value, currency(currency: USD)}}",
45
+ "sendToRecipient": "Send to recipient",
46
+ "addressConfirmation": "I confirm that the address above is correct",
47
+ "gas": "gas fee",
48
+ "minutes": "minutes",
49
+ "tokenSearch": "Search your token",
50
+ "selectChain": "Chain",
51
+ "selectToken": "Token",
52
+ "selectChainAndToken": "Select chain and token",
53
+ "featuredTokens": "Featured tokens",
54
+ "otherTokens": "Other tokens",
55
+ "inProgress": "In progress",
56
+ "couldntFindTokens": "We couldn't find tokens on this chain or you don't have any.",
57
+ "stepSwap": "Swap",
58
+ "stepBridge": "Bridge",
59
+ "stepSwapAndBridge": "Swap and bridge",
60
+ "estimatedTime": "~{{value}} min.",
61
+ "networkIsBusy": "Network is busy...",
62
+ "crossStepDetails": "Bridge from {{from}} to {{to}} via {{tool}}",
63
+ "swapStepDetails": "Swap on {{chain}} via {{tool}}",
64
+ "tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
65
+ "tokenOnChainAmount": "{{amount}} {{tokenSymbol}} on {{chainName}}",
66
+ "routeId": "Route ID",
67
+ "tags": {
68
+ "recommended": "Recommended",
69
+ "fastest": "Fast",
70
+ "cheapest": "Cheap",
71
+ "safest": "Safe",
72
+ "general": "General"
13
73
  },
14
- "button": {
15
- "connectWallet": "Connect wallet",
16
- "switchChain": "Switch chain",
17
- "swap": "Swap",
18
- "reviewSwap": "Review swap",
19
- "startSwap": "Start swap",
20
- "restartSwap": "Restart swap",
21
- "removeSwap": "Remove swap",
22
- "done": "Done",
23
- "okay": "Okay",
24
- "seeDetails": "See details",
25
- "tryAgain": "Try again",
26
- "light": "Light",
27
- "dark": "Dark",
28
- "auto": "Auto",
29
- "ok": "Ok",
30
- "cancel": "Cancel",
31
- "delete": "Delete",
32
- "hide": "Hide",
33
- "max": "max",
34
- "contactSupport": "Contact support",
35
- "lifiSwap": "LI.FI Swap"
74
+ "success": {
75
+ "title": {
76
+ "fundsReceived": "Funds received"
77
+ },
78
+ "message": {
79
+ "fundsReceived": "You now have {{amount}} {{tokenSymbol}} in your wallet on {{chainName}} chain."
80
+ }
36
81
  },
37
- "swap": {
38
- "from": "From",
39
- "to": "To",
40
- "amount": "You pay",
41
- "maxAmount": "/ {{amount}}",
42
- "routes": "You get",
43
- "approximateCurrency": "\u2248 {{value, currency(currency: USD)}}",
44
- "currency": "{{value, currency(currency: USD)}}",
45
- "sendToRecipient": "Send to recipient",
46
- "addressConfirmation": "I confirm that the address above is correct",
47
- "gas": "gas fee",
48
- "minutes": "minutes",
49
- "tokenSearch": "Search your token",
50
- "selectChain": "Chain",
51
- "selectToken": "Token",
52
- "selectChainAndToken": "Select chain and token",
53
- "featuredTokens": "Featured tokens",
54
- "otherTokens": "Other tokens",
55
- "inProgress": "In progress",
56
- "couldntFindTokens": "We couldn't find tokens on this chain or you don't have any.",
57
- "stepSwap": "Swap",
58
- "stepBridge": "Bridge",
59
- "stepSwapAndBridge": "Swap and bridge",
60
- "estimatedTime": "~{{value}} min.",
61
- "networkIsBusy": "Network is busy...",
62
- "crossStepDetails": "Bridge from {{from}} to {{to}} via {{tool}}",
63
- "swapStepDetails": "Swap on {{chain}} via {{tool}}",
64
- "tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
65
- "tokenOnChainAmount": "{{amount}} {{tokenSymbol}} on {{chainName}}",
66
- "routeId": "Route ID",
67
- "tags": {
68
- "recommended": "Recommended",
69
- "fastest": "Fast",
70
- "cheapest": "Cheap",
71
- "safest": "Safe",
72
- "general": "General"
73
- },
74
- "success": {
75
- "title": {
76
- "fundsReceived": "Funds received"
77
- },
78
- "message": {
79
- "fundsReceived": "You now have {{amount}} {{tokenSymbol}} in your wallet on {{chainName}} chain."
80
- }
81
- },
82
- "info": {
83
- "title": {
84
- "routeNotFound": "No routes available",
85
- "emptySwapHistory": "No recent swaps"
86
- },
87
- "message": {
88
- "routeNotFound": "Try another token combination.",
89
- "emptySwapHistory": "Swap history is only stored locally and will be deleted if you clear your browser data."
90
- }
91
- },
92
- "warning": {
93
- "title": {
94
- "insufficientGas": "Insufficient gas",
95
- "deleteSwap": "Delete this swap?",
96
- "deleteSwapHistory": "Delete swap history?"
97
- },
98
- "message": {
99
- "insufficientFunds": "You don't have enough funds to execute the swap.",
100
- "insufficientGas": "You need to add at least:",
101
- "deleteSwap": "Swap history is only stored locally and can't be recovered if you delete it."
102
- }
103
- },
104
- "error": {
105
- "title": {
106
- "chainSwitch": "Chain switch required.",
107
- "transactionFailed": "Transaction has failed.",
108
- "transactionUnderpriced": "Transaction is underpriced.",
109
- "transactionUnprepared": "Unable to prepare transaction.",
110
- "unknown": "Something went wrong.",
111
- "userRejectedSignatureRequest": "Signature required.",
112
- "slippageTooLarge": "Slippage too large."
113
- },
114
- "message": {
115
- "signatureRequired": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
116
- "transactionFailed": "Please check the block explorer for more information.",
117
- "transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}}).",
118
- "slippageTooLarge": "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote."
119
- }
120
- },
121
- "process": {
122
- "tokenAllowance": {
123
- "started": "Setting token allowance.",
124
- "pending": "Waiting for token allowance.",
125
- "done": "Token allowance approved."
126
- },
127
- "switchChain": {
128
- "pending": "Chain switch required.",
129
- "done": "Chain switched successfully."
130
- },
131
- "swap": {
132
- "started": "Preparing swap.",
133
- "actionRequired": "Please sign the transaction.",
134
- "pending": "Swapping.",
135
- "done": "Swap completed."
136
- },
137
- "crossChain": {
138
- "started": "Preparing transaction.",
139
- "actionRequired": "Please sign the transaction.",
140
- "pending": "Waiting for transaction.",
141
- "done": "Transaction approved."
142
- },
143
- "receivingChain": {
144
- "pending": "Waiting for receiving chain.",
145
- "done": "Funds received."
146
- }
147
- }
82
+ "info": {
83
+ "title": {
84
+ "routeNotFound": "No routes available",
85
+ "emptySwapHistory": "No recent swaps"
86
+ },
87
+ "message": {
88
+ "routeNotFound": "Try another token combination.",
89
+ "emptySwapHistory": "Swap history is only stored locally and will be deleted if you clear your browser data."
90
+ }
148
91
  },
149
- "settings": {
150
- "routePriority": "Route priority",
151
- "slippage": "Slippage",
152
- "gasPrice": {
153
- "title": "Gas price",
154
- "slow": "Slow",
155
- "normal": "Normal",
156
- "fast": "Fast"
157
- },
158
- "advancedPreferences": "Advanced preferences",
159
- "enabledBridges": "Enabled bridges",
160
- "selectEnabledBridges": "Select enabled bridges",
161
- "enabledExchanges": "Enabled exchanges",
162
- "selectEnabledExchanges": "Select enabled exchanges",
163
- "resetToDefault": "Reset to default"
92
+ "warning": {
93
+ "title": {
94
+ "insufficientGas": "Insufficient gas",
95
+ "deleteSwap": "Delete this swap?",
96
+ "deleteSwapHistory": "Delete swap history?"
97
+ },
98
+ "message": {
99
+ "insufficientFunds": "You don't have enough funds to execute the swap.",
100
+ "insufficientGas": "You need to add at least:",
101
+ "deleteSwap": "Swap history is only stored locally and can't be recovered if you delete it."
102
+ }
164
103
  },
165
- "wallet": {
166
- "extensionNotFound": "Please make sure that only the {{name}} browser extension is active before choosing this wallet."
104
+ "error": {
105
+ "title": {
106
+ "chainSwitch": "Chain switch required.",
107
+ "transactionFailed": "Transaction has failed.",
108
+ "transactionUnderpriced": "Transaction is underpriced.",
109
+ "transactionUnprepared": "Unable to prepare transaction.",
110
+ "unknown": "Something went wrong.",
111
+ "userRejectedSignatureRequest": "Signature required.",
112
+ "slippageTooLarge": "Slippage too large."
113
+ },
114
+ "message": {
115
+ "signatureRequired": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
116
+ "transactionFailed": "Please check the block explorer for more information.",
117
+ "transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}}).",
118
+ "slippageTooLarge": "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote."
119
+ }
167
120
  },
168
- "tooltip": {
169
- "notFound": {
170
- "title": "404",
171
- "text": "We couldn't find this page."
172
- },
173
- "progressToNextUpdate": "Displayed data will auto-refresh after {{value}} seconds. Click this circle to update manually."
121
+ "process": {
122
+ "tokenAllowance": {
123
+ "started": "Setting token allowance.",
124
+ "pending": "Waiting for token allowance.",
125
+ "done": "Token allowance approved."
126
+ },
127
+ "switchChain": {
128
+ "pending": "Chain switch required.",
129
+ "done": "Chain switched successfully."
130
+ },
131
+ "swap": {
132
+ "started": "Preparing swap.",
133
+ "actionRequired": "Please sign the transaction.",
134
+ "pending": "Swapping.",
135
+ "done": "Swap completed."
136
+ },
137
+ "crossChain": {
138
+ "started": "Preparing transaction.",
139
+ "actionRequired": "Please sign the transaction.",
140
+ "pending": "Waiting for transaction.",
141
+ "done": "Transaction approved."
142
+ },
143
+ "receivingChain": {
144
+ "pending": "Waiting for receiving chain.",
145
+ "done": "Funds received."
146
+ }
174
147
  }
148
+ },
149
+ "settings": {
150
+ "routePriority": "Route priority",
151
+ "slippage": "Slippage",
152
+ "gasPrice": {
153
+ "title": "Gas price",
154
+ "slow": "Slow",
155
+ "normal": "Normal",
156
+ "fast": "Fast"
157
+ },
158
+ "advancedPreferences": "Advanced preferences",
159
+ "enabledBridges": "Enabled bridges",
160
+ "selectEnabledBridges": "Select enabled bridges",
161
+ "enabledExchanges": "Enabled exchanges",
162
+ "selectEnabledExchanges": "Select enabled exchanges",
163
+ "resetToDefault": "Reset to default"
164
+ },
165
+ "wallet": {
166
+ "extensionNotFound": "Please make sure that only the {{name}} browser extension is active before choosing this wallet."
167
+ },
168
+ "tooltip": {
169
+ "notFound": {
170
+ "title": "404",
171
+ "text": "We couldn't find this page."
172
+ },
173
+ "progressToNextUpdate": "Displayed data will auto-refresh after {{value}} seconds. Click this circle to update manually."
174
+ }
175
175
  }
@@ -92,10 +92,10 @@ exports.WalletProvider = WalletProvider;
92
92
  const extractAccountFromSigner = (signer) => __awaiter(void 0, void 0, void 0, function* () {
93
93
  try {
94
94
  return {
95
- address: (yield (signer === null || signer === void 0 ? void 0 : signer.getAddress())) || undefined,
95
+ address: yield (signer === null || signer === void 0 ? void 0 : signer.getAddress()),
96
96
  isActive: (signer && !!(yield signer.getAddress()) === null) || !!signer,
97
97
  signer,
98
- chainId: (yield (signer === null || signer === void 0 ? void 0 : signer.getChainId())) || undefined,
98
+ chainId: yield (signer === null || signer === void 0 ? void 0 : signer.getChainId()),
99
99
  };
100
100
  }
101
101
  catch (error) {
@@ -16,6 +16,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
16
16
  const sdk_1 = require("@lifi/sdk");
17
17
  const react_1 = require("react");
18
18
  const lifi_1 = require("../../config/lifi");
19
+ const version_1 = require("../../config/version");
19
20
  const stub = () => {
20
21
  throw new Error('You forgot to wrap your component in <WidgetProvider>.');
21
22
  };
@@ -63,6 +64,9 @@ const WidgetProvider = (_a) => {
63
64
  },
64
65
  });
65
66
  }, [integrator]);
67
+ (0, react_1.useEffect)(() => {
68
+ (0, sdk_1.checkPackageUpdates)(version_1.name, version_1.version);
69
+ }, []);
66
70
  return ((0, jsx_runtime_1.jsx)(WidgetContext.Provider, Object.assign({ value: value }, { children: children })));
67
71
  };
68
72
  exports.WidgetProvider = WidgetProvider;
@@ -54,4 +54,40 @@ exports.useRouteStore = (0, zustand_1.default)()((0, middleware_1.persist)((0, i
54
54
  })), {
55
55
  name: 'li.fi-widget-routes',
56
56
  partialize: (state) => ({ routes: state.routes }),
57
+ merge: (persistedState, currentState) => {
58
+ const state = Object.assign(Object.assign({}, currentState), persistedState);
59
+ try {
60
+ const routeString = localStorage.getItem('routes');
61
+ if (routeString) {
62
+ const routes = JSON.parse(routeString);
63
+ routes.forEach((route) => {
64
+ if (state.routes[route.id]) {
65
+ return;
66
+ }
67
+ state.routes[route.id] = {
68
+ route,
69
+ status: 'idle',
70
+ };
71
+ const isFailed = route.steps.some((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
72
+ if (isFailed) {
73
+ state.routes[route.id].status = 'error';
74
+ return;
75
+ }
76
+ const isDone = route.steps.every((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE'; });
77
+ if (isDone) {
78
+ state.routes[route.id].status = 'success';
79
+ return;
80
+ }
81
+ const isLoading = route.steps.some((step) => step.execution);
82
+ if (isLoading) {
83
+ state.routes[route.id].status = 'loading';
84
+ }
85
+ });
86
+ }
87
+ }
88
+ catch (error) {
89
+ console.log(error);
90
+ }
91
+ return state;
92
+ },
57
93
  }));
@@ -1,3 +1,3 @@
1
1
  import type { Theme } from '@mui/material';
2
2
  export declare const getContrastAlphaColor: (theme: Theme, alpha: string | number) => string;
3
- export declare const getContrastTextColor: (theme: Theme, background?: string) => "rgb(0, 0, 0)" | "rgb(255, 255, 255)";
3
+ export declare const getContrastTextColor: (theme: Theme, background?: string) => "#fff" | "#000";
@@ -1,13 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getContrastTextColor = exports.getContrastAlphaColor = void 0;
4
+ const colors_1 = require("@mui/material/colors");
4
5
  const styles_1 = require("@mui/material/styles");
5
6
  const getContrastAlphaColor = (theme, alpha) => theme.palette.mode === 'light'
6
7
  ? `rgb(0 0 0 / ${alpha})`
7
8
  : `rgb(255 255 255 / ${alpha})`;
8
9
  exports.getContrastAlphaColor = getContrastAlphaColor;
9
- const getContrastTextColor = (theme, background) => (0, styles_1.getContrastRatio)('rgb(0, 0, 0)', background !== null && background !== void 0 ? background : theme.palette.primary.main) >=
10
- 3
11
- ? 'rgb(0, 0, 0)'
12
- : 'rgb(255, 255, 255)';
10
+ const getContrastTextColor = (theme, background) => (0, styles_1.getContrastRatio)(colors_1.common.white, background !== null && background !== void 0 ? background : theme.palette.primary.main) >= 3
11
+ ? colors_1.common.white
12
+ : colors_1.common.black;
13
13
  exports.getContrastTextColor = getContrastTextColor;
package/config/lifi.js CHANGED
@@ -1,5 +1,7 @@
1
1
  import LIFI from '@lifi/sdk';
2
- export const LiFi = new LIFI();
2
+ export const LiFi = new LIFI({
3
+ disableVersionCheck: true,
4
+ });
3
5
  export const updateLiFiConfig = (configUpdate) => {
4
6
  LiFi.setConfig(configUpdate);
5
7
  };
package/config/theme.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { common } from '@mui/material/colors';
1
2
  import { dialogActionsClasses } from '@mui/material/DialogActions';
2
3
  import { alpha, createTheme as createMuiTheme, darken, getContrastRatio, lighten, } from '@mui/material/styles';
3
4
  const palette = {
@@ -119,9 +120,9 @@ export const createTheme = (mode, theme = {}) => {
119
120
  },
120
121
  }, contained: {
121
122
  '&:hover': {
122
- color: getContrastRatio('rgb(0, 0, 0)', primaryMainColor) >= 3
123
- ? 'rgb(0, 0, 0)'
124
- : 'rgb(255, 255, 255)',
123
+ color: getContrastRatio(common.white, primaryMainColor) >= 3
124
+ ? common.white
125
+ : common.black,
125
126
  },
126
127
  } }),
127
128
  },
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.13.5";
2
+ export declare const version = "1.14.0";
package/config/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  export const name = '@lifi/widget';
2
- export const version = '1.13.5';
2
+ export const version = '1.14.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "1.13.5",
3
+ "version": "1.14.0",
4
4
  "description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -38,10 +38,10 @@
38
38
  "dependencies": {
39
39
  "@emotion/react": "^11.10.0",
40
40
  "@emotion/styled": "^11.10.0",
41
- "@ethersproject/experimental": "^5.6.3",
42
- "@ethersproject/providers": "^5.6.8",
43
- "@lifi/sdk": "^1.1.6",
44
- "@lifi/wallet-management": "^1.1.6",
41
+ "@ethersproject/experimental": "^5.7.0",
42
+ "@ethersproject/providers": "^5.7.0",
43
+ "@lifi/sdk": "^1.2.1",
44
+ "@lifi/wallet-management": "^1.1.7",
45
45
  "@mui/icons-material": "^5.8.4",
46
46
  "@mui/lab": "^5.0.0-alpha.95",
47
47
  "@mui/material": "^5.10.1",
@@ -59,7 +59,7 @@
59
59
  "react-i18next": "^11.18.4",
60
60
  "react-router-dom": "^6.3.0",
61
61
  "react-timer-hook": "^3.0.5",
62
- "zustand": "^4.1.0"
62
+ "zustand": "^4.1.1"
63
63
  },
64
64
  "peerDependencies": {
65
65
  "@types/react": "^18.0.0",
@@ -87,10 +87,10 @@ export const WalletProvider = ({ children, walletManagement }) => {
87
87
  export const extractAccountFromSigner = (signer) => __awaiter(void 0, void 0, void 0, function* () {
88
88
  try {
89
89
  return {
90
- address: (yield (signer === null || signer === void 0 ? void 0 : signer.getAddress())) || undefined,
90
+ address: yield (signer === null || signer === void 0 ? void 0 : signer.getAddress()),
91
91
  isActive: (signer && !!(yield signer.getAddress()) === null) || !!signer,
92
92
  signer,
93
- chainId: (yield (signer === null || signer === void 0 ? void 0 : signer.getChainId())) || undefined,
93
+ chainId: yield (signer === null || signer === void 0 ? void 0 : signer.getChainId()),
94
94
  };
95
95
  }
96
96
  catch (error) {
@@ -10,9 +10,10 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
- import { getChainByKey } from '@lifi/sdk';
13
+ import { checkPackageUpdates, getChainByKey } from '@lifi/sdk';
14
14
  import { createContext, useContext, useEffect, useMemo } from 'react';
15
15
  import { updateLiFiConfig } from '../../config/lifi';
16
+ import { name, version } from '../../config/version';
16
17
  const stub = () => {
17
18
  throw new Error('You forgot to wrap your component in <WidgetProvider>.');
18
19
  };
@@ -59,5 +60,8 @@ export const WidgetProvider = (_a) => {
59
60
  },
60
61
  });
61
62
  }, [integrator]);
63
+ useEffect(() => {
64
+ checkPackageUpdates(name, version);
65
+ }, []);
62
66
  return (_jsx(WidgetContext.Provider, Object.assign({ value: value }, { children: children })));
63
67
  };
@@ -48,4 +48,40 @@ export const useRouteStore = create()(persist(immer((set) => ({
48
48
  })), {
49
49
  name: 'li.fi-widget-routes',
50
50
  partialize: (state) => ({ routes: state.routes }),
51
+ merge: (persistedState, currentState) => {
52
+ const state = Object.assign(Object.assign({}, currentState), persistedState);
53
+ try {
54
+ const routeString = localStorage.getItem('routes');
55
+ if (routeString) {
56
+ const routes = JSON.parse(routeString);
57
+ routes.forEach((route) => {
58
+ if (state.routes[route.id]) {
59
+ return;
60
+ }
61
+ state.routes[route.id] = {
62
+ route,
63
+ status: 'idle',
64
+ };
65
+ const isFailed = route.steps.some((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
66
+ if (isFailed) {
67
+ state.routes[route.id].status = 'error';
68
+ return;
69
+ }
70
+ const isDone = route.steps.every((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE'; });
71
+ if (isDone) {
72
+ state.routes[route.id].status = 'success';
73
+ return;
74
+ }
75
+ const isLoading = route.steps.some((step) => step.execution);
76
+ if (isLoading) {
77
+ state.routes[route.id].status = 'loading';
78
+ }
79
+ });
80
+ }
81
+ }
82
+ catch (error) {
83
+ console.log(error);
84
+ }
85
+ return state;
86
+ },
51
87
  }));