@ensofinance/checkout-widget 0.0.1
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/checkout-widget.es.js +52889 -0
- package/dist/checkout-widget.es.js.map +1 -0
- package/dist/checkout-widget.umd.js +203 -0
- package/dist/checkout-widget.umd.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/enso-api.yaml +1982 -0
- package/orval.config.ts +25 -0
- package/package.json +79 -0
- package/src/assets/BinanceBadge.svg +4 -0
- package/src/assets/CoinbaseIcon.svg +4 -0
- package/src/assets/USD Coin (USDC).svg +5 -0
- package/src/assets/avecIcon.svg +5 -0
- package/src/assets/base.webp +0 -0
- package/src/assets/depositIcon.svg +6 -0
- package/src/assets/eth.webp +0 -0
- package/src/assets/ethMainnetIcon.svg +10 -0
- package/src/assets/fail.svg +5 -0
- package/src/assets/kraken.png +0 -0
- package/src/assets/logo.svg +10 -0
- package/src/assets/mastercard.png +0 -0
- package/src/assets/metamask.png +0 -0
- package/src/assets/rabby.png +0 -0
- package/src/assets/success.svg +4 -0
- package/src/assets/usdc.webp +0 -0
- package/src/assets/usdt.webp +0 -0
- package/src/assets/visa.png +0 -0
- package/src/assets/visa.webp +0 -0
- package/src/components/BridgeFee.tsx +58 -0
- package/src/components/ChakraProvider.tsx +372 -0
- package/src/components/Checkout.tsx +127 -0
- package/src/components/CheckoutModal.tsx +22 -0
- package/src/components/CircleTimer.tsx +66 -0
- package/src/components/CurrencySwapDisplay.tsx +153 -0
- package/src/components/DepositProcessing.tsx +116 -0
- package/src/components/ExchangeConfirmSecurity.tsx +110 -0
- package/src/components/QuoteParameters.tsx +341 -0
- package/src/components/TransactionDetailRow.tsx +124 -0
- package/src/components/cards/AssetCard.tsx +167 -0
- package/src/components/cards/ExchangeCard.tsx +53 -0
- package/src/components/cards/OptionCard.tsx +59 -0
- package/src/components/cards/WalletCard.tsx +99 -0
- package/src/components/cards/index.ts +6 -0
- package/src/components/modal.tsx +83 -0
- package/src/components/steps/ExchangeFlow.tsx +1402 -0
- package/src/components/steps/InitialStep.tsx +169 -0
- package/src/components/steps/QuoteStep.tsx +121 -0
- package/src/components/steps/WalletAmountStep.tsx +258 -0
- package/src/components/steps/WalletConfirmStep.tsx +404 -0
- package/src/components/steps/WalletTokenStep.tsx +128 -0
- package/src/components/ui/index.tsx +394 -0
- package/src/components/ui/styled.tsx +85 -0
- package/src/components/ui/toaster.tsx +43 -0
- package/src/components/ui/tooltip.tsx +46 -0
- package/src/enso-api/api.ts +173 -0
- package/src/enso-api/custom-instance.ts +35 -0
- package/src/enso-api/index.ts +5119 -0
- package/src/enso-api/model/action.ts +17 -0
- package/src/enso-api/model/actionAction.ts +52 -0
- package/src/enso-api/model/actionInputs.ts +12 -0
- package/src/enso-api/model/actionToBundle.ts +19 -0
- package/src/enso-api/model/actionToBundleAction.ts +53 -0
- package/src/enso-api/model/actionToBundleArgs.ts +12 -0
- package/src/enso-api/model/bundleControllerBundleShortcutTransactionParams.ts +53 -0
- package/src/enso-api/model/bundleControllerBundleShortcutTransactionRoutingStrategy.ts +23 -0
- package/src/enso-api/model/bundleShortcutTransaction.ts +35 -0
- package/src/enso-api/model/bundleShortcutTransactionAmountsOut.ts +15 -0
- package/src/enso-api/model/bundleShortcutTransactionFeeAmount.ts +12 -0
- package/src/enso-api/model/connectedNetwork.ts +16 -0
- package/src/enso-api/model/hop.ts +24 -0
- package/src/enso-api/model/hopArgs.ts +12 -0
- package/src/enso-api/model/index.ts +70 -0
- package/src/enso-api/model/iporControllerIporShortcutTransactionParams.ts +21 -0
- package/src/enso-api/model/iporShortcutInput.ts +33 -0
- package/src/enso-api/model/iporShortcutTransaction.ts +22 -0
- package/src/enso-api/model/lZDestinationTokenData.ts +19 -0
- package/src/enso-api/model/lZPoolLookupResponse.ts +26 -0
- package/src/enso-api/model/layerZeroControllerGetPoolAddressParams.ts +29 -0
- package/src/enso-api/model/network.ts +15 -0
- package/src/enso-api/model/networksControllerNetworksParams.ts +21 -0
- package/src/enso-api/model/nonTokenizedControllerTokens200.ts +15 -0
- package/src/enso-api/model/nonTokenizedControllerTokens200AllOf.ts +16 -0
- package/src/enso-api/model/nonTokenizedControllerTokensParams.ts +41 -0
- package/src/enso-api/model/nonTokenizedModel.ts +27 -0
- package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionParams.ts +64 -0
- package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionRoutingStrategy.ts +22 -0
- package/src/enso-api/model/paginatedResult.ts +16 -0
- package/src/enso-api/model/paginationMeta.ts +27 -0
- package/src/enso-api/model/positionModel.ts +77 -0
- package/src/enso-api/model/price.ts +20 -0
- package/src/enso-api/model/pricesControllerGetPricesParams.ts +17 -0
- package/src/enso-api/model/project.ts +15 -0
- package/src/enso-api/model/protocol.ts +15 -0
- package/src/enso-api/model/protocolModel.ts +26 -0
- package/src/enso-api/model/protocolsControllerFindAllParams.ts +21 -0
- package/src/enso-api/model/routeShortcutTransaction.ts +33 -0
- package/src/enso-api/model/routeShortcutVariableInputs.ts +68 -0
- package/src/enso-api/model/routeShortcutVariableInputsRoutingStrategy.ts +27 -0
- package/src/enso-api/model/routeShortcutVariableInputsVariableEstimates.ts +14 -0
- package/src/enso-api/model/routerControllerRouteShortcutTransactionParams.ts +91 -0
- package/src/enso-api/model/routerControllerRouteShortcutTransactionRoutingStrategy.ts +23 -0
- package/src/enso-api/model/standard.ts +18 -0
- package/src/enso-api/model/standardAction.ts +20 -0
- package/src/enso-api/model/standardActionAction.ts +53 -0
- package/src/enso-api/model/tokenModel.ts +36 -0
- package/src/enso-api/model/tokensControllerTokens200.ts +15 -0
- package/src/enso-api/model/tokensControllerTokens200AllOf.ts +16 -0
- package/src/enso-api/model/tokensControllerTokensParams.ts +91 -0
- package/src/enso-api/model/tokensControllerTokensType.ts +19 -0
- package/src/enso-api/model/transaction.ts +17 -0
- package/src/enso-api/model/userOperation.ts +28 -0
- package/src/enso-api/model/walletApproveTransaction.ts +24 -0
- package/src/enso-api/model/walletApproveTransactionTx.ts +15 -0
- package/src/enso-api/model/walletBalance.ts +29 -0
- package/src/enso-api/model/walletControllerCreateApproveTransactionParams.ts +35 -0
- package/src/enso-api/model/walletControllerCreateApproveTransactionRoutingStrategy.ts +23 -0
- package/src/enso-api/model/walletControllerWalletBalancesParams.ts +25 -0
- package/src/index.ts +17 -0
- package/src/store.ts +68 -0
- package/src/types/assets.d.ts +29 -0
- package/src/types/index.ts +21 -0
- package/src/util/common.tsx +324 -0
- package/src/util/constants.tsx +213 -0
- package/src/util/enso-hooks.tsx +203 -0
- package/src/util/index.tsx +68 -0
- package/src/util/tx-tracker.tsx +301 -0
- package/src/util/wallet.tsx +258 -0
- package/tsconfig.json +13 -0
- package/vite.config.ts +51 -0
package/orval.config.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
enso: {
|
|
3
|
+
output: {
|
|
4
|
+
baseUrl: "https://api.enso.finance",
|
|
5
|
+
mode: "single",
|
|
6
|
+
prettier: true,
|
|
7
|
+
target: "src/enso-api/index.ts",
|
|
8
|
+
schemas: "src/enso-api/model",
|
|
9
|
+
client: "react-query",
|
|
10
|
+
override: {
|
|
11
|
+
query: {
|
|
12
|
+
options: {
|
|
13
|
+
refetchInterval: 30_000,
|
|
14
|
+
retry: 2,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
mutator: {
|
|
18
|
+
path: "./src/enso-api/custom-instance.ts",
|
|
19
|
+
name: "useCustomClient",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
input: "https://api.enso.finance/api-yaml",
|
|
24
|
+
},
|
|
25
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ensofinance/checkout-widget",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"homepage": "https://www.enso.build/",
|
|
6
|
+
"repository": {
|
|
7
|
+
"url": "https://github.com/EnsoFinance/checkout-widget",
|
|
8
|
+
"type": "git",
|
|
9
|
+
"directory": "widget"
|
|
10
|
+
},
|
|
11
|
+
"author": "Enso finance",
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"description": "Multi-purpose widget utilizing Enso API",
|
|
14
|
+
"pnpm": {
|
|
15
|
+
"overrides": {
|
|
16
|
+
"viem": "2.32.0"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"bump": "npm version patch",
|
|
21
|
+
"generate-api": "orval",
|
|
22
|
+
"publish": "npm publish --access public",
|
|
23
|
+
"dev": "vite build --watch --mode=dev --minify=false --sourcemap=false --emptyOutDir=false",
|
|
24
|
+
"build": "vite build",
|
|
25
|
+
"preview": "vite preview"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@chakra-ui/react": "^3.19.1",
|
|
29
|
+
"@emotion/cache": "^11.14.0",
|
|
30
|
+
"@emotion/react": "^11.14.0",
|
|
31
|
+
"@ensofinance/checkout-ui-library": "^0.0.2",
|
|
32
|
+
"@ensofinance/sdk": "^1.0.18",
|
|
33
|
+
"@meshconnect/web-link-sdk": "^3.2.14",
|
|
34
|
+
"@uidotdev/usehooks": "^2.4.1",
|
|
35
|
+
"axios": "^1.11.0",
|
|
36
|
+
"lucide-react": "^0.469.0",
|
|
37
|
+
"next-themes": "^0.4.4",
|
|
38
|
+
"posthog-js": "^1.223.3",
|
|
39
|
+
"react-icons": "^5.4.0",
|
|
40
|
+
"react-shadow": "^20.6.0",
|
|
41
|
+
"react-window": "^1.8.11",
|
|
42
|
+
"url": "^0.11.4",
|
|
43
|
+
"viem": "^2.33.2",
|
|
44
|
+
"zustand": "^5.0.3"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"@tanstack/react-query": "^5.62.10",
|
|
48
|
+
"react": "^18.2.0 || ^19.0.0",
|
|
49
|
+
"react-dom": "^18.2.0 || ^19.0.0",
|
|
50
|
+
"wagmi": "^2.14.12"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@eslint/js": "^9.17.0",
|
|
54
|
+
"@types/react": "^18.3.18",
|
|
55
|
+
"@types/react-dom": "^18.3.5",
|
|
56
|
+
"@vitejs/plugin-react": "^4.3.4",
|
|
57
|
+
"eslint": "^9.17.0",
|
|
58
|
+
"eslint-plugin-react-hooks": "^5.0.0",
|
|
59
|
+
"eslint-plugin-react-refresh": "^0.4.16",
|
|
60
|
+
"globals": "^15.14.0",
|
|
61
|
+
"orval": "^7.10.0",
|
|
62
|
+
"prettier": "^3.4.2",
|
|
63
|
+
"typescript": "~5.8.2",
|
|
64
|
+
"typescript-eslint": "^8.18.2",
|
|
65
|
+
"vite": "^6.0.5",
|
|
66
|
+
"vite-plugin-dts": "^4.4.0",
|
|
67
|
+
"vite-plugin-lib-inject-css": "^2.2.1",
|
|
68
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
69
|
+
},
|
|
70
|
+
"main": "./dist/checkout-widget.umd.js",
|
|
71
|
+
"module": "./dist/checkout-widget.es.js",
|
|
72
|
+
"exports": {
|
|
73
|
+
".": {
|
|
74
|
+
"types": "./dist/index.d.ts",
|
|
75
|
+
"import": "./dist/checkout-widget.es.js",
|
|
76
|
+
"require": "./dist/checkout-widget.umd.js"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="32" height="33" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect y="0.5" width="32" height="32" rx="16" fill="#2F2B32"/>
|
|
3
|
+
<path d="M22.5582 20.6133L16.0006 27.1709L9.4469 20.6172L9.44397 20.6133L11.858 18.2061L16.0006 22.3496L20.1481 18.2021L22.5582 20.6133ZM18.4469 16.502L16.0006 18.9521L13.5543 16.5059V16.498L13.984 16.0693L14.194 15.8633L16.0006 14.0557L18.4469 16.502ZM26.6666 16.5029L24.2565 18.9131L21.8473 16.5029L24.2565 14.0928L26.6666 16.5029ZM10.153 16.501L7.7428 18.9111L5.33264 16.501L7.7428 14.0908L10.153 16.501ZM22.5582 12.3906L20.1481 14.8018L16.0006 10.6543L11.858 14.7979L9.4469 12.3867L16.0006 5.83301L22.5582 12.3906Z" fill="#F3BA2F"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="32" height="33" viewBox="0 0 32 33" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect y="0.5" width="32" height="32" rx="16" fill="#0052FF"/>
|
|
3
|
+
<path d="M16.0064 21.85C13.0504 21.85 10.6561 19.4558 10.6561 16.4998C10.6561 13.5438 13.0504 11.1495 16.0064 11.1495C18.6548 11.1495 20.8528 13.0801 21.2764 15.6081H26.6667C26.212 10.1152 21.6152 5.79932 16.0064 5.79932C10.0988 5.79932 5.30591 10.5922 5.30591 16.4998C5.30591 22.4073 10.0988 27.2002 16.0064 27.2002C21.6152 27.2002 26.212 22.8844 26.6667 17.3915H21.2719C20.8484 19.9195 18.6548 21.85 16.0064 21.85Z" fill="white"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M11.1667 21.3333C17.0778 21.3333 21.8333 16.5778 21.8333 10.6667C21.8333 4.75552 17.0778 0 11.1667 0C5.25552 0 0.5 4.75552 0.5 10.6667C0.5 16.5778 5.25552 21.3333 11.1667 21.3333Z" fill="#2775CA"/>
|
|
3
|
+
<path d="M14.1001 12.3555C14.1001 10.7999 13.1667 10.2666 11.3001 10.0444C9.96672 9.8666 9.70005 9.51108 9.70005 8.88879C9.70005 8.26649 10.1445 7.8666 11.0334 7.8666C11.8334 7.8666 12.2779 8.13327 12.5001 8.79993C12.5445 8.93327 12.6779 9.02212 12.8112 9.02212H13.5222C13.7001 9.02212 13.8334 8.88879 13.8334 8.71108V8.6666C13.6556 7.68879 12.8556 6.93327 11.8334 6.84441V5.77775C11.8334 5.59993 11.7001 5.4666 11.4779 5.42212H10.8112C10.6334 5.42212 10.5001 5.55545 10.4556 5.77775V6.79993C9.12224 6.97775 8.27786 7.8666 8.27786 8.97775C8.27786 10.4444 9.16672 11.0221 11.0334 11.2444C12.2779 11.4666 12.6779 11.7333 12.6779 12.4444C12.6779 13.1556 12.0556 13.6444 11.2112 13.6444C10.0556 13.6444 9.65557 13.1555 9.52224 12.4888C9.47786 12.3111 9.34453 12.2221 9.2112 12.2221H8.45557C8.27786 12.2221 8.14453 12.3555 8.14453 12.5333V12.5777C8.32224 13.6888 9.03338 14.4888 10.5001 14.7111V15.7777C10.5001 15.9555 10.6334 16.0888 10.8556 16.1333H11.5222C11.7001 16.1333 11.8334 15.9999 11.8779 15.7777V14.7111C13.2112 14.4888 14.1001 13.5555 14.1001 12.3555Z" fill="white"/>
|
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M4.94453 8.48879C3.65557 11.9111 5.43339 15.7778 8.90005 17.0221C9.03339 17.1111 9.16672 17.2888 9.16672 17.4221V18.0444C9.16672 18.1333 9.16672 18.1778 9.12224 18.2221C9.07786 18.3999 8.90005 18.4888 8.72224 18.3999C6.23339 17.5999 4.32224 15.6888 3.52224 13.1999C2.18891 8.97775 4.50005 4.48879 8.72224 3.15546C8.76672 3.11108 8.85557 3.11108 8.90005 3.11108C9.07786 3.15546 9.16672 3.28879 9.16672 3.4666V4.08879C9.16672 4.31108 9.07786 4.44442 8.90005 4.53327C7.07786 5.19994 5.6112 6.62212 4.94453 8.48879ZM13.2112 3.33327C13.2556 3.15546 13.4334 3.0666 13.6112 3.15546C16.0556 3.95546 18.0112 5.8666 18.8112 8.39994C20.1445 12.6221 17.8334 17.1111 13.6112 18.4444C13.5667 18.4888 13.4779 18.4888 13.4334 18.4888C13.2556 18.4444 13.1667 18.3111 13.1667 18.1333V17.5111C13.1667 17.2888 13.2556 17.1555 13.4334 17.0666C15.2556 16.3999 16.7222 14.9778 17.3889 13.1111C18.6779 9.68879 16.9001 5.82212 13.4334 4.57775C13.3001 4.48879 13.1667 4.31108 13.1667 4.13327V3.51108C13.1667 3.42212 13.1667 3.37775 13.2112 3.33327Z" fill="white"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="1.3335" y="0.833496" width="11.6667" height="11.6667" rx="5.83333" stroke="white"/>
|
|
3
|
+
<circle cx="7.16683" cy="6.66683" r="5.33333" fill="#E84142"/>
|
|
4
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.48594 2.91662C7.30117 2.59746 7.0072 2.59746 6.82243 2.91662L3.46704 8.82528C3.28227 9.14864 3.43345 9.40481 3.803 9.40481H5.48699C5.82715 9.38381 6.13371 9.20323 6.31849 8.91767L8.34684 5.40271C8.49382 5.10034 8.49382 4.74339 8.34684 4.44103L7.74211 3.37856L7.48594 2.91662ZM9.71586 6.80533C9.53109 6.48617 9.23293 6.48617 9.04815 6.80533L7.8765 8.82528C7.69592 9.14444 7.8471 9.4048 8.21245 9.4048H10.5306C10.9001 9.4048 11.0513 9.14444 10.8665 8.82528L9.71586 6.80533Z" fill="white"/>
|
|
5
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="1" y="1" width="18" height="18" rx="9" stroke="white" stroke-width="2"/>
|
|
3
|
+
<path d="M17.7589 11.9352C16.6904 16.221 12.3496 18.8292 8.06336 17.7605C3.77889 16.692 1.17066 12.351 2.23959 8.06558C3.30758 3.77935 7.64835 1.17093 11.9333 2.23939C16.2192 3.30785 18.8273 7.64936 17.7587 11.9353L17.7588 11.9352H17.7589Z" fill="#14AE5C"/>
|
|
4
|
+
<path d="M11.9997 4.66675C12.3679 4.66675 12.6663 4.96522 12.6663 5.33341C12.6663 5.7016 12.3679 6.00008 11.9997 6.00008H7.99967C7.63148 6.00008 7.33301 5.7016 7.33301 5.33341C7.33301 4.96522 7.63148 4.66675 7.99967 4.66675H11.9997Z" fill="white"/>
|
|
5
|
+
<path d="M12.0003 7.33325C12.3685 7.33325 12.667 7.63173 12.667 7.99992V9.33325H14.667C14.9366 9.33325 15.1797 9.49564 15.2829 9.74471C15.386 9.99383 15.329 10.2806 15.1383 10.4713L10.4717 15.1379C10.2113 15.3983 9.7893 15.3983 9.52895 15.1379L4.86229 10.4713C4.67162 10.2806 4.61457 9.99383 4.71775 9.74471C4.82096 9.49564 5.06403 9.33325 5.33364 9.33325H7.33364V7.99992C7.33364 7.63173 7.63212 7.33325 8.00031 7.33325H12.0003ZM8.66697 9.99992C8.66697 10.3681 8.3685 10.6666 8.00031 10.6666H6.94301L10.0003 13.7239L13.0576 10.6666H12.0003C11.6321 10.6666 11.3336 10.3681 11.3336 9.99992V8.66659H8.66697V9.99992Z" fill="white"/>
|
|
6
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg width="14" height="13" viewBox="0 0 14 13" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect x="1.3335" y="0.833496" width="11.6667" height="11.6667" rx="5.83333" stroke="white"/>
|
|
3
|
+
<circle cx="7.16683" cy="6.66683" r="5.33333" fill="#EDF0F4"/>
|
|
4
|
+
<path d="M7.15229 3.4668L7.10986 3.61091V7.7924L7.15229 7.83472L9.09325 6.68741L7.15229 3.4668Z" fill="#343434"/>
|
|
5
|
+
<path d="M7.15243 3.4668L5.21143 6.68741L7.15243 7.83472V5.80515V3.4668Z" fill="#8C8C8C"/>
|
|
6
|
+
<path d="M7.15233 8.20214L7.12842 8.2313V9.72081L7.15233 9.79062L9.09448 7.05542L7.15233 8.20214Z" fill="#3C3C3B"/>
|
|
7
|
+
<path d="M7.15243 9.79062V8.20214L5.21143 7.05542L7.15243 9.79062Z" fill="#8C8C8C"/>
|
|
8
|
+
<path d="M7.15234 7.83475L9.0933 6.68743L7.15234 5.80518V7.83475Z" fill="#1E171F"/>
|
|
9
|
+
<path d="M5.21143 6.68743L7.15243 7.83475V5.80518L5.21143 6.68743Z" fill="#393939"/>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="58" height="58" viewBox="0 0 58 58" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="29" cy="29" r="29" fill="#E84142"/>
|
|
3
|
+
<path d="M34.2929 22.2929C34.6834 21.9024 35.3164 21.9024 35.707 22.2929C36.0975 22.6834 36.0975 23.3164 35.707 23.707L23.707 35.707C23.3164 36.0975 22.6834 36.0975 22.2929 35.707C21.9024 35.3164 21.9024 34.6834 22.2929 34.2929L34.2929 22.2929Z" fill="white"/>
|
|
4
|
+
<path d="M22.2929 22.2929C22.6834 21.9024 23.3164 21.9024 23.707 22.2929L35.707 34.2929L35.7753 34.3691C36.0957 34.7618 36.0731 35.3408 35.707 35.707C35.3408 36.0731 34.7618 36.0957 34.3691 35.7753L34.2929 35.707L22.2929 23.707C21.9024 23.3164 21.9024 22.6834 22.2929 22.2929Z" fill="white"/>
|
|
5
|
+
</svg>
|
|
Binary file
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_126_8587)">
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.3686 10.6232C16.3715 10.6146 16.359 10.6097 16.355 10.6179C14.975 13.5085 12.2144 15.5112 8.66017 15.5112C4.88611 15.5112 1.35008 12.688 1.35008 8.37011C1.35008 4.65011 4.30812 1.56104 7.74213 1.56104C10.6321 1.56104 12.6382 3.28819 12.6382 4.51714C12.6382 5.08189 12.2642 5.48041 11.6862 5.48041C10.3602 5.48041 9.85022 3.15536 7.33413 3.15536C4.78406 3.15536 2.6081 5.54683 2.6081 8.37011C2.6081 12.0238 5.56614 14.4153 8.52417 14.4153C9.68043 14.4153 10.322 14.1182 10.5073 14.0169C10.515 14.0126 10.51 14.0012 10.5017 14.0037C10.3174 14.0604 9.73839 14.2159 8.93211 14.2159C5.29405 14.2159 3.83206 11.4591 3.83206 9.66544C3.83206 8.30367 4.71606 7.73906 5.43016 7.73906C7.33413 7.73906 7.06219 11.7248 11.7542 11.7248C14.2023 11.7248 16.4803 10.0972 16.4803 6.87544C16.4803 3.22178 12.9442 0 8.66017 0C4.17214 0 0.5 3.554 0.5 7.97156C0.5 12.4223 4.30812 15.9763 8.66017 15.9763C12.4804 15.9763 15.3429 13.5242 16.3686 10.6232Z" fill="#1E171F"/>
|
|
4
|
+
</g>
|
|
5
|
+
<defs>
|
|
6
|
+
<clipPath id="clip0_126_8587">
|
|
7
|
+
<rect width="16" height="16" fill="white" transform="translate(0.5)"/>
|
|
8
|
+
</clipPath>
|
|
9
|
+
</defs>
|
|
10
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg width="58" height="58" viewBox="0 0 58 58" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="29" cy="29" r="29" fill="#14AE5C"/>
|
|
3
|
+
<path d="M36.2929 22.2929C36.6834 21.9024 37.3164 21.9024 37.707 22.2929C38.0975 22.6834 38.0975 23.3164 37.707 23.707L26.707 34.707C26.3164 35.0975 25.6834 35.0975 25.2929 34.707L20.2929 29.707C19.9024 29.3164 19.9024 28.6834 20.2929 28.2929C20.659 27.9268 21.238 27.9042 21.6308 28.2245L21.707 28.2929L25.9999 32.5859L36.2929 22.2929Z" fill="white"/>
|
|
4
|
+
</svg>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useEnsoPrice, useEnsoToken } from "@/enso-api/api";
|
|
2
|
+
import {
|
|
3
|
+
compareCaseInsensitive,
|
|
4
|
+
formatNumber,
|
|
5
|
+
formatUSD,
|
|
6
|
+
normalizeValue,
|
|
7
|
+
} from "@/util";
|
|
8
|
+
import { ETH_ADDRESS } from "@/util/constants";
|
|
9
|
+
import { useAppDetails, useRouteData } from "@/util/enso-hooks";
|
|
10
|
+
import { useMemo } from "react";
|
|
11
|
+
import { Text } from "@chakra-ui/react";
|
|
12
|
+
import { Fuel } from "lucide-react";
|
|
13
|
+
import { Tooltip } from "./ui/tooltip";
|
|
14
|
+
|
|
15
|
+
const BridgingFee = () => {
|
|
16
|
+
const { routerData } = useRouteData();
|
|
17
|
+
const { tokenIn, chainIdIn, amountIn } = useAppDetails();
|
|
18
|
+
const { data: nativeTokenPriceData } = useEnsoPrice(chainIdIn, ETH_ADDRESS);
|
|
19
|
+
const {
|
|
20
|
+
data: [nativeTokenInfo],
|
|
21
|
+
} = useEnsoToken(ETH_ADDRESS, chainIdIn);
|
|
22
|
+
|
|
23
|
+
const gasValue = useMemo(() => {
|
|
24
|
+
let txCost = +(routerData?.tx?.value ?? 0);
|
|
25
|
+
|
|
26
|
+
if (compareCaseInsensitive(tokenIn, ETH_ADDRESS)) {
|
|
27
|
+
txCost -= +amountIn;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return normalizeValue(Math.max(0, txCost).toString(), 18);
|
|
31
|
+
}, [routerData?.tx?.value, tokenIn, amountIn]);
|
|
32
|
+
|
|
33
|
+
const gasCostUSD = +gasValue * +(nativeTokenPriceData ?? 0);
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<Text
|
|
37
|
+
title={"Bridging fee"}
|
|
38
|
+
cursor={"default"}
|
|
39
|
+
display={"flex"}
|
|
40
|
+
alignItems={"center"}
|
|
41
|
+
gap={1}
|
|
42
|
+
color="fg.subtle"
|
|
43
|
+
fontSize={"xs"}
|
|
44
|
+
>
|
|
45
|
+
<Fuel size={12} />
|
|
46
|
+
{/* {formatNumber(gasValue, true)} {nativeTokenInfo?.symbol},{" "} */}
|
|
47
|
+
<Tooltip
|
|
48
|
+
content={`${formatNumber(gasValue, true)} ${nativeTokenInfo?.symbol}`}
|
|
49
|
+
>
|
|
50
|
+
<Text fontSize={"xs"} color="fg.subtle">
|
|
51
|
+
{formatUSD(gasCostUSD)}
|
|
52
|
+
</Text>
|
|
53
|
+
</Tooltip>
|
|
54
|
+
</Text>
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export default BridgingFee;
|
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChakraProvider as ChakraProviderWrapper,
|
|
3
|
+
EnvironmentProvider,
|
|
4
|
+
SystemConfig,
|
|
5
|
+
createSystem,
|
|
6
|
+
defaultConfig,
|
|
7
|
+
defineConfig,
|
|
8
|
+
defineRecipe,
|
|
9
|
+
defineSlotRecipe,
|
|
10
|
+
} from "@chakra-ui/react";
|
|
11
|
+
import { tableAnatomy, selectAnatomy } from "@chakra-ui/react/anatomy";
|
|
12
|
+
import { CacheProvider } from "@emotion/react";
|
|
13
|
+
import { useEffect, useMemo, useState } from "react";
|
|
14
|
+
import createCache from "@emotion/cache";
|
|
15
|
+
import root from "react-shadow/emotion";
|
|
16
|
+
|
|
17
|
+
const varRoot = ":host";
|
|
18
|
+
|
|
19
|
+
export const buttonRecipe = defineRecipe({
|
|
20
|
+
base: {
|
|
21
|
+
display: "flex",
|
|
22
|
+
width: "100%",
|
|
23
|
+
justifyContent: "center",
|
|
24
|
+
alignItems: "center",
|
|
25
|
+
borderRadius: "md",
|
|
26
|
+
},
|
|
27
|
+
variants: {
|
|
28
|
+
variant: {
|
|
29
|
+
primary: { bg: "primary", color: "bg" },
|
|
30
|
+
secondary: { bg: "bg.emphasized", color: "fg" },
|
|
31
|
+
lightGray: { bg: "bg.subtle", color: "fg" },
|
|
32
|
+
},
|
|
33
|
+
size: {
|
|
34
|
+
mdPlus: {
|
|
35
|
+
padding: "8px 16px",
|
|
36
|
+
fontSize: "14px",
|
|
37
|
+
fontWeight: "medium",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const inputRecipe = defineRecipe({
|
|
44
|
+
variants: {
|
|
45
|
+
variant: {
|
|
46
|
+
text: {
|
|
47
|
+
border: "none",
|
|
48
|
+
outline: "none",
|
|
49
|
+
bg: "transparent",
|
|
50
|
+
color: "fg",
|
|
51
|
+
textAlign: "center",
|
|
52
|
+
fontSize: "48px",
|
|
53
|
+
fontWeight: 600,
|
|
54
|
+
lineHeight: "120%",
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const selectSlotRecipe = defineSlotRecipe({
|
|
61
|
+
slots: selectAnatomy.keys(),
|
|
62
|
+
base: {
|
|
63
|
+
trigger: {
|
|
64
|
+
borderRadius: "6px",
|
|
65
|
+
boxShadow: "none",
|
|
66
|
+
},
|
|
67
|
+
content: {
|
|
68
|
+
borderRadius: "6px",
|
|
69
|
+
boxShadow: "none",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
variants: {
|
|
73
|
+
variant: {
|
|
74
|
+
filled: {
|
|
75
|
+
trigger: {
|
|
76
|
+
bg: "bg.subtle",
|
|
77
|
+
color: "fg.muted",
|
|
78
|
+
fontWeight: 500,
|
|
79
|
+
},
|
|
80
|
+
content: {
|
|
81
|
+
bg: "bg.subtle",
|
|
82
|
+
color: "fg.muted",
|
|
83
|
+
fontWeight: 400,
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
customOutline: {
|
|
87
|
+
trigger: {
|
|
88
|
+
bg: "bg",
|
|
89
|
+
color: "fg.muted",
|
|
90
|
+
fontWeight: 400,
|
|
91
|
+
border: "1px solid",
|
|
92
|
+
borderColor: "border",
|
|
93
|
+
},
|
|
94
|
+
content: {
|
|
95
|
+
bg: "bg",
|
|
96
|
+
color: "fg.muted",
|
|
97
|
+
fontWeight: 400,
|
|
98
|
+
border: "1px solid",
|
|
99
|
+
borderColor: "border",
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
export const tableSlotRecipe = defineSlotRecipe({
|
|
107
|
+
className: "chakra-table",
|
|
108
|
+
slots: tableAnatomy.keys(),
|
|
109
|
+
base: {
|
|
110
|
+
root: {
|
|
111
|
+
fontVariantNumeric: "lining-nums tabular-nums",
|
|
112
|
+
borderCollapse: "collapse",
|
|
113
|
+
borderRadius: 6,
|
|
114
|
+
width: "full",
|
|
115
|
+
textAlign: "start",
|
|
116
|
+
verticalAlign: "top",
|
|
117
|
+
},
|
|
118
|
+
row: {
|
|
119
|
+
_selected: {
|
|
120
|
+
bg: "colorPalette.subtle",
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
cell: {
|
|
124
|
+
textAlign: "start",
|
|
125
|
+
alignItems: "center",
|
|
126
|
+
},
|
|
127
|
+
columnHeader: {
|
|
128
|
+
fontWeight: "medium",
|
|
129
|
+
textAlign: "start",
|
|
130
|
+
color: "fg",
|
|
131
|
+
},
|
|
132
|
+
caption: {
|
|
133
|
+
fontWeight: "medium",
|
|
134
|
+
textStyle: "xs",
|
|
135
|
+
},
|
|
136
|
+
footer: {
|
|
137
|
+
fontWeight: "medium",
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
|
|
141
|
+
variants: {
|
|
142
|
+
interactive: {
|
|
143
|
+
true: {
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
body: {
|
|
146
|
+
"& tr": {
|
|
147
|
+
_hover: {
|
|
148
|
+
bg: "colorPalette.subtle",
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
|
|
155
|
+
stickyHeader: {
|
|
156
|
+
true: {
|
|
157
|
+
header: {
|
|
158
|
+
"& :where(tr)": {
|
|
159
|
+
top: "var(--table-sticky-offset, 0)",
|
|
160
|
+
position: "sticky",
|
|
161
|
+
zIndex: 1,
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
striped: {
|
|
168
|
+
true: {
|
|
169
|
+
row: {
|
|
170
|
+
"&:nth-of-type(odd) td": {
|
|
171
|
+
bg: "bg.muted",
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
showColumnBorder: {
|
|
178
|
+
true: {
|
|
179
|
+
columnHeader: {
|
|
180
|
+
"&:not(:last-of-type)": {
|
|
181
|
+
borderInlineEndWidth: "1px",
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
cell: {
|
|
185
|
+
"&:not(:last-of-type)": {
|
|
186
|
+
borderInlineEndWidth: "1px",
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
},
|
|
190
|
+
},
|
|
191
|
+
|
|
192
|
+
variant: {
|
|
193
|
+
line: {
|
|
194
|
+
columnHeader: {
|
|
195
|
+
borderBottomWidth: "1px",
|
|
196
|
+
},
|
|
197
|
+
cell: {
|
|
198
|
+
borderBottomWidth: "1px",
|
|
199
|
+
},
|
|
200
|
+
row: {
|
|
201
|
+
bg: "bg",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
outline: {
|
|
206
|
+
root: {
|
|
207
|
+
boxShadow: "0 0 0 1px {colors.border}",
|
|
208
|
+
overflow: "hidden",
|
|
209
|
+
},
|
|
210
|
+
columnHeader: {
|
|
211
|
+
borderBottomWidth: "1px",
|
|
212
|
+
},
|
|
213
|
+
header: {
|
|
214
|
+
bg: "bg.muted",
|
|
215
|
+
},
|
|
216
|
+
row: {
|
|
217
|
+
"&:not(:last-of-type)": {
|
|
218
|
+
borderBottomWidth: "1px",
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
footer: {
|
|
222
|
+
borderTopWidth: "1px",
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
size: {
|
|
228
|
+
sm: {
|
|
229
|
+
root: {
|
|
230
|
+
textStyle: "sm",
|
|
231
|
+
},
|
|
232
|
+
columnHeader: {
|
|
233
|
+
px: "2",
|
|
234
|
+
py: "2",
|
|
235
|
+
},
|
|
236
|
+
cell: {
|
|
237
|
+
px: "2",
|
|
238
|
+
py: "2",
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
|
|
242
|
+
md: {
|
|
243
|
+
root: {
|
|
244
|
+
textStyle: "sm",
|
|
245
|
+
},
|
|
246
|
+
columnHeader: {
|
|
247
|
+
px: "3",
|
|
248
|
+
py: "3",
|
|
249
|
+
},
|
|
250
|
+
cell: {
|
|
251
|
+
px: "3",
|
|
252
|
+
py: "3",
|
|
253
|
+
},
|
|
254
|
+
},
|
|
255
|
+
|
|
256
|
+
lg: {
|
|
257
|
+
root: {
|
|
258
|
+
textStyle: "md",
|
|
259
|
+
},
|
|
260
|
+
columnHeader: {
|
|
261
|
+
px: "4",
|
|
262
|
+
py: "3",
|
|
263
|
+
},
|
|
264
|
+
cell: {
|
|
265
|
+
px: "4",
|
|
266
|
+
py: "3",
|
|
267
|
+
},
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
},
|
|
271
|
+
|
|
272
|
+
defaultVariants: {
|
|
273
|
+
// @ts-ignore
|
|
274
|
+
variant: "line",
|
|
275
|
+
size: "md",
|
|
276
|
+
},
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
export const config = defineConfig({
|
|
280
|
+
theme: {
|
|
281
|
+
semanticTokens: {
|
|
282
|
+
colors: {
|
|
283
|
+
border: {
|
|
284
|
+
value: "#E4E4E7",
|
|
285
|
+
},
|
|
286
|
+
"border.emphasized": {
|
|
287
|
+
value: "#1e171f4d",
|
|
288
|
+
},
|
|
289
|
+
primary: { value: "black" },
|
|
290
|
+
customBlack: { value: "#1E171F" },
|
|
291
|
+
customWhite: { value: "#FAFAFA" },
|
|
292
|
+
gray: {
|
|
293
|
+
50: { value: "#F4F4F5" },
|
|
294
|
+
100: { value: "#707070" },
|
|
295
|
+
200: { value: "#F4F4F5" },
|
|
296
|
+
300: { value: "#E4E4E7" },
|
|
297
|
+
400: { value: "#433E44" },
|
|
298
|
+
},
|
|
299
|
+
pink: { value: "#FF21FF" },
|
|
300
|
+
green: { value: "#52C86E" },
|
|
301
|
+
},
|
|
302
|
+
},
|
|
303
|
+
recipes: {
|
|
304
|
+
input: inputRecipe,
|
|
305
|
+
button: buttonRecipe,
|
|
306
|
+
},
|
|
307
|
+
slotRecipes: {
|
|
308
|
+
select: selectSlotRecipe,
|
|
309
|
+
table: tableSlotRecipe,
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
const ChakraProvider = ({
|
|
315
|
+
children,
|
|
316
|
+
themeConfig,
|
|
317
|
+
}: {
|
|
318
|
+
children: React.ReactNode;
|
|
319
|
+
themeConfig?: SystemConfig;
|
|
320
|
+
}) => {
|
|
321
|
+
const [shadow, setShadow] = useState<HTMLElement | null>(null);
|
|
322
|
+
const [cache, setCache] = useState<ReturnType<typeof createCache> | null>(
|
|
323
|
+
null,
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
useEffect(() => {
|
|
327
|
+
if (!shadow?.shadowRoot || cache) return;
|
|
328
|
+
const emotionCache = createCache({
|
|
329
|
+
key: "root",
|
|
330
|
+
container: shadow.shadowRoot,
|
|
331
|
+
});
|
|
332
|
+
setCache(emotionCache);
|
|
333
|
+
}, [shadow, cache]);
|
|
334
|
+
|
|
335
|
+
const system = useMemo(
|
|
336
|
+
() =>
|
|
337
|
+
createSystem(defaultConfig, config, themeConfig, {
|
|
338
|
+
cssVarsRoot: varRoot,
|
|
339
|
+
preflight: { scope: varRoot },
|
|
340
|
+
conditions: {
|
|
341
|
+
light: `${varRoot} &, .light &`,
|
|
342
|
+
},
|
|
343
|
+
globalCss: {
|
|
344
|
+
[varRoot]: {
|
|
345
|
+
...defaultConfig.globalCss?.html,
|
|
346
|
+
borderRadius: "xl",
|
|
347
|
+
shadow: "sm",
|
|
348
|
+
border: "none",
|
|
349
|
+
},
|
|
350
|
+
},
|
|
351
|
+
}),
|
|
352
|
+
[themeConfig],
|
|
353
|
+
);
|
|
354
|
+
|
|
355
|
+
return (
|
|
356
|
+
<root.div ref={setShadow}>
|
|
357
|
+
{shadow && cache && (
|
|
358
|
+
<EnvironmentProvider
|
|
359
|
+
value={() => shadow.shadowRoot ?? document}
|
|
360
|
+
>
|
|
361
|
+
<CacheProvider value={cache}>
|
|
362
|
+
<ChakraProviderWrapper value={system}>
|
|
363
|
+
{children}
|
|
364
|
+
</ChakraProviderWrapper>
|
|
365
|
+
</CacheProvider>
|
|
366
|
+
</EnvironmentProvider>
|
|
367
|
+
)}
|
|
368
|
+
</root.div>
|
|
369
|
+
);
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
export default ChakraProvider;
|