@imtbl/sdk 1.16.0-alpha → 1.18.0-alpha
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/blockchain_data.js +2 -2
- package/dist/browser/checkout/BridgeWidget-a1f36890.js +1 -0
- package/dist/browser/checkout/{HorizontalMenu-actual-23a2719d.js → HorizontalMenu-actual-bfedfe04.js} +1 -1
- package/dist/browser/checkout/{OnRampWidget-180655fd.js → OnRampWidget-535d60f6.js} +2 -2
- package/dist/browser/checkout/SaleWidget-d68f5d96.js +2 -0
- package/dist/browser/checkout/{SpendingCapHero-4c7ade0a.js → SpendingCapHero-723b22e5.js} +1 -1
- package/dist/browser/checkout/{SwapWidget-45648bea.js → SwapWidget-01bee5c0.js} +1 -1
- package/dist/browser/checkout/{TopUpView-356013a4.js → TopUpView-194b0094.js} +1 -1
- package/dist/browser/checkout/{WalletWidget-5b299930.js → WalletWidget-8553c142.js} +1 -1
- package/dist/browser/checkout/{auto-track-b4ca2a6f.js → auto-track-b28d4bb9.js} +1 -1
- package/dist/browser/checkout/balance-1832cb3b.js +1 -0
- package/dist/browser/checkout/{index-b9473737.js → index-3ccbcf2e.js} +1 -1
- package/dist/browser/checkout/{index-942188f0.js → index-81d38420.js} +13 -13
- package/dist/browser/checkout/{index-8059cdf1.js → index-af788142.js} +1 -1
- package/dist/browser/checkout/index-b6a4c6a6.js +1 -0
- package/dist/browser/checkout/{index-f2c0eade.js → index-d7f4eebb.js} +1 -1
- package/dist/browser/checkout/{index-d3e89127.js → index-dd1ebaa0.js} +1 -1
- package/dist/browser/checkout/{index-7749dbd8.js → index-f1a24937.js} +1 -1
- package/dist/browser/checkout/{index-b3c6140b.js → index-f1dd3f58.js} +1 -1
- package/dist/browser/checkout/{index.umd-f4f93c8b.js → index.umd-3d2ceb84.js} +1 -1
- package/dist/browser/checkout/{retry-3f674dd7.js → retry-656d939c.js} +1 -1
- package/dist/browser/checkout/sdk.js +5 -5
- package/dist/browser/checkout/widgets-esm.js +1 -1
- package/dist/browser/checkout/widgets.js +64 -64
- package/dist/checkout.d.ts +2 -1
- package/dist/checkout.js +6 -5
- package/dist/config.js +1 -1
- package/dist/index.browser.js +4 -4
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +9 -8
- package/dist/index.d.ts +2 -1
- package/dist/index.js +9 -8
- package/dist/orderbook.js +1 -1
- package/dist/passport.js +4 -4
- package/dist/x.js +3 -3
- package/package.json +1 -1
- package/dist/browser/checkout/BridgeWidget-2b7e6b49.js +0 -1
- package/dist/browser/checkout/SaleWidget-23dc22ff.js +0 -2
- package/dist/browser/checkout/balance-459e2092.js +0 -1
- package/dist/browser/checkout/index-68e02f44.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as o,P as e,B as t,Q as n,R as r,j as i}from"./index-942188f0.js";function C(){return o(t,{sx:{...e,background:"base.color.translucent.emphasis.100"},children:o(t,{sx:{...n,...r},children:i("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o("path",{d:"M94.0614 105.632L93.6321 104L92 104.429L92.4292 106.061L94.0614 105.632Z",fill:"white"}),o("path",{d:"M63.6531 193.101L63.1006 191L60.9996 191.553L61.5521 193.654L63.6531 193.101Z",fill:"white"}),o("path",{d:"M344.489 224.345L342.345 224L342 226.145L344.144 226.49L344.489 224.345Z",fill:"white"}),o("path",{d:"M372.286 139.905L372.905 138.619L371.619 138L371 139.286L372.286 139.905Z",fill:"white"}),o("path",{d:"M341.653 78.101L341.101 76L339 76.5525L339.552 78.6535L341.653 78.101Z",fill:"white"}),o("path",{d:"M359.286 242.905L359.905 241.619L358.619 241L358 242.286L359.286 242.905Z",fill:"white"}),o("path",{d:"M87.0123 112.087L86.0869 111L85.0002 111.925L85.9256 113.012L87.0123 112.087Z",fill:"white"}),o("path",{d:"M84.2862 248.905L84.9053 247.619L83.6192 247L83.0001 248.286L84.2862 248.905Z",fill:"white"}),o("path",{d:"M215.496 262.992C268.237 262.992 310.993 220.237 310.993 167.496C310.993 114.755 268.237 72 215.496 72C162.755 72 120 114.755 120 167.496C120 220.237 162.755 262.992 215.496 262.992Z",fill:"white",fillOpacity:"0.24",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M159.82 95.1695C179.975 79.6536 204.651 73.1506 227.89 77.0665C261.089 82.6606 253.281 101.028 199.197 121.314C151.934 139.037 123.49 136.348 143.823 110.95C148.422 105.208 153.721 99.8623 159.82 95.1695Z",fill:"white",fillOpacity:"0.08"}),o("path",{d:"M215.497 227.183C171.451 227.183 135.159 219.871 130.194 210.462H130.187C145.912 241.626 178.21 263.001 215.497 263.001C252.705 263.001 284.942 241.719 300.706 210.664C295.33 219.98 259.232 227.183 215.505 227.183H215.497Z",fill:"#36E0F8",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M284.219 219.607L283.978 219.84C281.275 222.482 256.583 215.986 253.172 218.418C222.389 240.36 182.779 269.061 146.099 219.397C146.099 219.397 140.761 217.641 138.609 216.686C139.425 217.96 140.279 219.226 141.165 220.469C170.425 261.516 227.423 271.073 268.47 241.813C276.97 235.752 284.118 228.503 289.852 220.454L292.424 216.841L288.252 218.302C287.086 218.713 285.851 219.11 284.553 219.498L284.227 219.599L284.219 219.607Z",fill:"black"}),o("path",{d:"M215.496 241.4C262.183 241.4 300.03 226.557 300.03 208.248C300.03 189.938 262.183 175.095 215.496 175.095C168.81 175.095 130.963 189.938 130.963 208.248C130.963 226.557 168.81 241.4 215.496 241.4Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M300.705 210.659C300.705 210.659 300.705 210.65 300.705 210.641C300.705 210.641 300.705 210.65 300.705 210.659Z",fill:"#EBE9E9",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 204.511C208.952 204.511 221.377 199.638 221.377 193.626C221.377 187.614 208.952 182.741 193.624 182.741C178.297 182.741 165.871 187.614 165.871 193.626C165.871 199.638 178.297 204.511 193.624 204.511Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M197.33 204.41C199.49 204.294 201.573 204.084 203.546 203.789V211.512C201.573 211.807 199.49 212.017 197.33 212.133V204.41Z",fill:"#D0F500"}),o("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901V206.624C215.255 208.497 211.246 210.027 206.398 211.014V203.291Z",fill:"black"}),o("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M206.398 211.015C211.246 210.028 215.255 208.497 217.905 206.625",stroke:"#A66CFF",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 196.788C208.952 196.788 221.377 191.914 221.377 185.903C221.377 179.891 208.952 175.017 193.624 175.017C178.297 175.017 165.871 179.891 165.871 185.903C165.871 191.914 178.297 196.788 193.624 196.788Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M197.33 196.687C199.49 196.57 201.573 196.361 203.546 196.065V203.788C201.573 204.084 199.49 204.293 197.33 204.41V196.687Z",fill:"#36E0F8"}),o("path",{d:"M206.398 195.568C211.246 194.581 215.255 193.051 217.905 191.178V198.901C215.255 200.774 211.246 202.304 206.398 203.291V195.568Z",fill:"black"}),o("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 189.065C208.952 189.065 221.377 184.192 221.377 178.18C221.377 172.168 208.952 167.294 193.624 167.294C178.297 167.294 165.871 172.168 165.871 178.18C165.871 184.192 178.297 189.065 193.624 189.065Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M197.33 188.965C199.49 188.849 201.573 188.639 203.546 188.343V196.067C201.573 196.362 199.49 196.571 197.33 196.688V188.965Z",fill:"#F191FA"}),o("path",{d:"M206.398 187.845C211.246 186.858 215.255 185.327 217.905 183.455V191.178C215.255 193.05 211.246 194.581 206.398 195.568V187.845Z",fill:"black"}),o("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M206.398 195.569C211.246 194.582 215.255 193.052 217.905 191.179",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 212.934C253.929 212.934 266.354 208.06 266.354 202.049C266.354 196.037 253.929 191.164 238.601 191.164C223.274 191.164 210.848 196.037 210.848 202.049C210.848 208.06 223.274 212.934 238.601 212.934Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M242.307 212.833C244.467 212.717 246.55 212.507 248.523 212.212V219.935C246.55 220.23 244.467 220.44 242.307 220.556V212.833Z",fill:"#F191FA"}),o("path",{d:"M251.375 211.713C256.223 210.727 260.232 209.196 262.882 207.324V215.047C260.232 216.919 256.223 218.45 251.375 219.436V211.713Z",fill:"black"}),o("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M251.375 219.437C256.223 218.45 260.232 216.919 262.882 215.047",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 205.21C253.929 205.21 266.354 200.336 266.354 194.324C266.354 188.313 253.929 183.439 238.601 183.439C223.274 183.439 210.848 188.313 210.848 194.324C210.848 200.336 223.274 205.21 238.601 205.21Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M242.307 205.109C244.467 204.993 246.55 204.783 248.523 204.488V212.211C246.55 212.506 244.467 212.716 242.307 212.832V205.109Z",fill:"#36E0F8"}),o("path",{d:"M251.375 203.989C256.223 203.003 260.232 201.472 262.882 199.6V207.323C260.232 209.195 256.223 210.726 251.375 211.712V203.989Z",fill:"black"}),o("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M251.375 211.713C256.223 210.726 260.232 209.195 262.882 207.323",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 197.487C253.929 197.487 266.354 192.613 266.354 186.602C266.354 180.59 253.929 175.716 238.601 175.716C223.274 175.716 210.848 180.59 210.848 186.602C210.848 192.613 223.274 197.487 238.601 197.487Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M242.307 197.386C244.467 197.27 246.55 197.06 248.523 196.765V204.488C246.55 204.783 244.467 204.992 242.307 205.109V197.386Z",fill:"#F191FA"}),o("path",{d:"M251.375 196.267C256.223 195.28 260.232 193.75 262.882 191.877V199.6C260.232 201.473 256.223 203.003 251.375 203.99V196.267Z",fill:"#9AEFFB"}),o("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M251.375 203.99C256.223 203.004 260.232 201.473 262.882 199.601",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M232.652 189.678C247.979 189.678 260.405 184.804 260.405 178.793C260.405 172.781 247.979 167.908 232.652 167.908C217.324 167.908 204.899 172.781 204.899 178.793C204.899 184.804 217.324 189.678 232.652 189.678Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M236.358 189.578C238.518 189.461 240.6 189.251 242.574 188.956V196.679C240.6 196.974 238.518 197.184 236.358 197.301V189.578Z",fill:"#F191FA"}),o("path",{d:"M245.426 188.458C250.274 187.471 254.283 185.94 256.932 184.067V191.791C254.283 193.663 250.274 195.194 245.426 196.18V188.458Z",fill:"black"}),o("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M245.426 196.182C250.274 195.195 254.283 193.664 256.932 191.792",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M240.99 180.021C256.317 180.021 268.743 175.148 268.743 169.136C268.743 163.124 256.317 158.25 240.99 158.25C225.662 158.25 213.237 163.124 213.237 169.136C213.237 175.148 225.662 180.021 240.99 180.021Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M244.696 179.92C246.856 179.804 248.938 179.594 250.911 179.299V187.022C248.938 187.317 246.856 187.527 244.696 187.643V179.92Z",fill:"#9AEFFB"}),o("path",{d:"M253.763 178.801C258.612 177.815 262.621 176.284 265.27 174.412V182.135C262.621 184.007 258.612 185.538 253.763 186.524V178.801Z",fill:"black"}),o("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M253.763 186.525C258.612 185.538 262.621 184.007 265.27 182.135",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M189.911 223.803C205.238 223.803 217.664 218.929 217.664 212.918C217.664 206.906 205.238 202.032 189.911 202.032C174.583 202.032 162.158 206.906 162.158 212.918C162.158 218.929 174.583 223.803 189.911 223.803Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.625 223.71C195.785 223.593 197.867 223.384 199.84 223.088V230.811C197.867 231.107 195.785 231.316 193.625 231.433V223.71Z",fill:"#F191FA"}),o("path",{d:"M202.685 222.583C207.533 221.596 211.542 220.066 214.191 218.193V225.916C211.542 227.789 207.533 229.319 202.685 230.306V222.583Z",fill:"#9AEFFB"}),o("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M202.685 230.306C207.533 229.32 211.542 227.789 214.191 225.917",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M300.705 210.658C300.705 210.658 300.705 210.649 300.705 210.641C300.705 210.641 300.705 210.649 300.705 210.658Z",fill:"#A66CFF",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}export{C as S};
|
|
1
|
+
import{a as o,P as e,B as t,Q as n,R as r,j as i}from"./index-81d38420.js";function C(){return o(t,{sx:{...e,background:"base.color.translucent.emphasis.100"},children:o(t,{sx:{...n,...r},children:i("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o("path",{d:"M94.0614 105.632L93.6321 104L92 104.429L92.4292 106.061L94.0614 105.632Z",fill:"white"}),o("path",{d:"M63.6531 193.101L63.1006 191L60.9996 191.553L61.5521 193.654L63.6531 193.101Z",fill:"white"}),o("path",{d:"M344.489 224.345L342.345 224L342 226.145L344.144 226.49L344.489 224.345Z",fill:"white"}),o("path",{d:"M372.286 139.905L372.905 138.619L371.619 138L371 139.286L372.286 139.905Z",fill:"white"}),o("path",{d:"M341.653 78.101L341.101 76L339 76.5525L339.552 78.6535L341.653 78.101Z",fill:"white"}),o("path",{d:"M359.286 242.905L359.905 241.619L358.619 241L358 242.286L359.286 242.905Z",fill:"white"}),o("path",{d:"M87.0123 112.087L86.0869 111L85.0002 111.925L85.9256 113.012L87.0123 112.087Z",fill:"white"}),o("path",{d:"M84.2862 248.905L84.9053 247.619L83.6192 247L83.0001 248.286L84.2862 248.905Z",fill:"white"}),o("path",{d:"M215.496 262.992C268.237 262.992 310.993 220.237 310.993 167.496C310.993 114.755 268.237 72 215.496 72C162.755 72 120 114.755 120 167.496C120 220.237 162.755 262.992 215.496 262.992Z",fill:"white",fillOpacity:"0.24",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M159.82 95.1695C179.975 79.6536 204.651 73.1506 227.89 77.0665C261.089 82.6606 253.281 101.028 199.197 121.314C151.934 139.037 123.49 136.348 143.823 110.95C148.422 105.208 153.721 99.8623 159.82 95.1695Z",fill:"white",fillOpacity:"0.08"}),o("path",{d:"M215.497 227.183C171.451 227.183 135.159 219.871 130.194 210.462H130.187C145.912 241.626 178.21 263.001 215.497 263.001C252.705 263.001 284.942 241.719 300.706 210.664C295.33 219.98 259.232 227.183 215.505 227.183H215.497Z",fill:"#36E0F8",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M284.219 219.607L283.978 219.84C281.275 222.482 256.583 215.986 253.172 218.418C222.389 240.36 182.779 269.061 146.099 219.397C146.099 219.397 140.761 217.641 138.609 216.686C139.425 217.96 140.279 219.226 141.165 220.469C170.425 261.516 227.423 271.073 268.47 241.813C276.97 235.752 284.118 228.503 289.852 220.454L292.424 216.841L288.252 218.302C287.086 218.713 285.851 219.11 284.553 219.498L284.227 219.599L284.219 219.607Z",fill:"black"}),o("path",{d:"M215.496 241.4C262.183 241.4 300.03 226.557 300.03 208.248C300.03 189.938 262.183 175.095 215.496 175.095C168.81 175.095 130.963 189.938 130.963 208.248C130.963 226.557 168.81 241.4 215.496 241.4Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M300.705 210.659C300.705 210.659 300.705 210.65 300.705 210.641C300.705 210.641 300.705 210.65 300.705 210.659Z",fill:"#EBE9E9",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 204.511C208.952 204.511 221.377 199.638 221.377 193.626C221.377 187.614 208.952 182.741 193.624 182.741C178.297 182.741 165.871 187.614 165.871 193.626C165.871 199.638 178.297 204.511 193.624 204.511Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M197.33 204.41C199.49 204.294 201.573 204.084 203.546 203.789V211.512C201.573 211.807 199.49 212.017 197.33 212.133V204.41Z",fill:"#D0F500"}),o("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901V206.624C215.255 208.497 211.246 210.027 206.398 211.014V203.291Z",fill:"black"}),o("path",{d:"M193.624 204.511C208.954 204.511 221.377 199.64 221.377 193.626V201.349C221.377 207.363 208.954 212.234 193.624 212.234C178.295 212.234 165.871 207.363 165.871 201.349V193.626C165.871 199.64 178.295 204.511 193.624 204.511Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M206.398 211.015C211.246 210.028 215.255 208.497 217.905 206.625",stroke:"#A66CFF",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 196.788C208.952 196.788 221.377 191.914 221.377 185.903C221.377 179.891 208.952 175.017 193.624 175.017C178.297 175.017 165.871 179.891 165.871 185.903C165.871 191.914 178.297 196.788 193.624 196.788Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M197.33 196.687C199.49 196.57 201.573 196.361 203.546 196.065V203.788C201.573 204.084 199.49 204.293 197.33 204.41V196.687Z",fill:"#36E0F8"}),o("path",{d:"M206.398 195.568C211.246 194.581 215.255 193.051 217.905 191.178V198.901C215.255 200.774 211.246 202.304 206.398 203.291V195.568Z",fill:"black"}),o("path",{d:"M193.624 196.788C208.954 196.788 221.377 191.917 221.377 185.903V193.626C221.377 199.639 208.954 204.511 193.624 204.511C178.295 204.511 165.871 199.639 165.871 193.626V185.903C165.871 191.917 178.295 196.788 193.624 196.788Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M206.398 203.291C211.246 202.304 215.255 200.774 217.905 198.901",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 189.065C208.952 189.065 221.377 184.192 221.377 178.18C221.377 172.168 208.952 167.294 193.624 167.294C178.297 167.294 165.871 172.168 165.871 178.18C165.871 184.192 178.297 189.065 193.624 189.065Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M197.33 188.965C199.49 188.849 201.573 188.639 203.546 188.343V196.067C201.573 196.362 199.49 196.571 197.33 196.688V188.965Z",fill:"#F191FA"}),o("path",{d:"M206.398 187.845C211.246 186.858 215.255 185.327 217.905 183.455V191.178C215.255 193.05 211.246 194.581 206.398 195.568V187.845Z",fill:"black"}),o("path",{d:"M193.624 189.065C208.954 189.065 221.377 184.194 221.377 178.18V185.903C221.377 191.917 208.954 196.788 193.624 196.788C178.295 196.788 165.871 191.917 165.871 185.903V178.18C165.871 184.194 178.295 189.065 193.624 189.065Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M206.398 195.569C211.246 194.582 215.255 193.052 217.905 191.179",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 212.934C253.929 212.934 266.354 208.06 266.354 202.049C266.354 196.037 253.929 191.164 238.601 191.164C223.274 191.164 210.848 196.037 210.848 202.049C210.848 208.06 223.274 212.934 238.601 212.934Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M242.307 212.833C244.467 212.717 246.55 212.507 248.523 212.212V219.935C246.55 220.23 244.467 220.44 242.307 220.556V212.833Z",fill:"#F191FA"}),o("path",{d:"M251.375 211.713C256.223 210.727 260.232 209.196 262.882 207.324V215.047C260.232 216.919 256.223 218.45 251.375 219.436V211.713Z",fill:"black"}),o("path",{d:"M238.601 212.935C253.931 212.935 266.354 208.063 266.354 202.049V209.772C266.354 215.786 253.931 220.658 238.601 220.658C223.272 220.658 210.848 215.786 210.848 209.772V202.049C210.848 208.063 223.272 212.935 238.601 212.935Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M251.375 219.437C256.223 218.45 260.232 216.919 262.882 215.047",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 205.21C253.929 205.21 266.354 200.336 266.354 194.324C266.354 188.313 253.929 183.439 238.601 183.439C223.274 183.439 210.848 188.313 210.848 194.324C210.848 200.336 223.274 205.21 238.601 205.21Z",fill:"#D0F500",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M242.307 205.109C244.467 204.993 246.55 204.783 248.523 204.488V212.211C246.55 212.506 244.467 212.716 242.307 212.832V205.109Z",fill:"#36E0F8"}),o("path",{d:"M251.375 203.989C256.223 203.003 260.232 201.472 262.882 199.6V207.323C260.232 209.195 256.223 210.726 251.375 211.712V203.989Z",fill:"black"}),o("path",{d:"M238.601 205.21C253.931 205.21 266.354 200.339 266.354 194.325V202.048C266.354 208.062 253.931 212.934 238.601 212.934C223.272 212.934 210.848 208.062 210.848 202.048V194.325C210.848 200.339 223.272 205.21 238.601 205.21Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M251.375 211.713C256.223 210.726 260.232 209.195 262.882 207.323",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 197.487C253.929 197.487 266.354 192.613 266.354 186.602C266.354 180.59 253.929 175.716 238.601 175.716C223.274 175.716 210.848 180.59 210.848 186.602C210.848 192.613 223.274 197.487 238.601 197.487Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M242.307 197.386C244.467 197.27 246.55 197.06 248.523 196.765V204.488C246.55 204.783 244.467 204.992 242.307 205.109V197.386Z",fill:"#F191FA"}),o("path",{d:"M251.375 196.267C256.223 195.28 260.232 193.75 262.882 191.877V199.6C260.232 201.473 256.223 203.003 251.375 203.99V196.267Z",fill:"#9AEFFB"}),o("path",{d:"M238.601 197.487C253.931 197.487 266.354 192.616 266.354 186.602V194.325C266.354 200.339 253.931 205.21 238.601 205.21C223.272 205.21 210.848 200.339 210.848 194.325V186.602C210.848 192.616 223.272 197.487 238.601 197.487Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M251.375 203.99C256.223 203.004 260.232 201.473 262.882 199.601",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M232.652 189.678C247.979 189.678 260.405 184.804 260.405 178.793C260.405 172.781 247.979 167.908 232.652 167.908C217.324 167.908 204.899 172.781 204.899 178.793C204.899 184.804 217.324 189.678 232.652 189.678Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M236.358 189.578C238.518 189.461 240.6 189.251 242.574 188.956V196.679C240.6 196.974 238.518 197.184 236.358 197.301V189.578Z",fill:"#F191FA"}),o("path",{d:"M245.426 188.458C250.274 187.471 254.283 185.94 256.932 184.067V191.791C254.283 193.663 250.274 195.194 245.426 196.18V188.458Z",fill:"black"}),o("path",{d:"M232.652 189.678C247.981 189.678 260.405 184.807 260.405 178.793V186.516C260.405 192.53 247.981 197.401 232.652 197.401C217.323 197.401 204.899 192.53 204.899 186.516V178.793C204.899 184.807 217.323 189.678 232.652 189.678Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M245.426 196.182C250.274 195.195 254.283 193.664 256.932 191.792",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M240.99 180.021C256.317 180.021 268.743 175.148 268.743 169.136C268.743 163.124 256.317 158.25 240.99 158.25C225.662 158.25 213.237 163.124 213.237 169.136C213.237 175.148 225.662 180.021 240.99 180.021Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M244.696 179.92C246.856 179.804 248.938 179.594 250.911 179.299V187.022C248.938 187.317 246.856 187.527 244.696 187.643V179.92Z",fill:"#9AEFFB"}),o("path",{d:"M253.763 178.801C258.612 177.815 262.621 176.284 265.27 174.412V182.135C262.621 184.007 258.612 185.538 253.763 186.524V178.801Z",fill:"black"}),o("path",{d:"M240.99 180.021C256.319 180.021 268.743 175.15 268.743 169.136V176.859C268.743 182.873 256.319 187.744 240.99 187.744C225.66 187.744 213.237 182.873 213.237 176.859V169.136C213.237 175.15 225.66 180.021 240.99 180.021Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M253.763 186.525C258.612 185.538 262.621 184.007 265.27 182.135",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M189.911 223.803C205.238 223.803 217.664 218.929 217.664 212.918C217.664 206.906 205.238 202.032 189.911 202.032C174.583 202.032 162.158 206.906 162.158 212.918C162.158 218.929 174.583 223.803 189.911 223.803Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",fill:"#E4F4F7",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M193.625 223.71C195.785 223.593 197.867 223.384 199.84 223.088V230.811C197.867 231.107 195.785 231.316 193.625 231.433V223.71Z",fill:"#F191FA"}),o("path",{d:"M202.685 222.583C207.533 221.596 211.542 220.066 214.191 218.193V225.916C211.542 227.789 207.533 229.319 202.685 230.306V222.583Z",fill:"#9AEFFB"}),o("path",{d:"M189.911 223.803C205.24 223.803 217.664 218.932 217.664 212.918V220.641C217.664 226.655 205.24 231.526 189.911 231.526C174.581 231.526 162.158 226.655 162.158 220.641V212.918C162.158 218.932 174.581 223.803 189.911 223.803Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M202.685 230.306C207.533 229.32 211.542 227.789 214.191 225.917",stroke:"white",strokeLinecap:"round",strokeLinejoin:"round"}),o("path",{d:"M300.705 210.658C300.705 210.658 300.705 210.649 300.705 210.641C300.705 210.641 300.705 210.649 300.705 210.658Z",fill:"#A66CFF",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}export{C as S};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as e,aO as t,aP as o,j as a,aQ as n,B as s,aR as r,a as i,b as d,aS as c,r as l,aj as p,aT as u,V as m,C as w,e as f,p as T,U as y,g as A,d as E,m as S,S as g,aU as v,aB as x,aV as h,H as I,aW as b,ad as C,k,l as P,al as R,t as _,f as F,y as O,aX as W,aY as D,aZ as L,ae as N,aJ as V,a_ as B,a$ as U,b0 as M,b1 as j,E as G,z as $,b2 as z,J as H,b3 as J,a0 as q,i as K,W as X,b4 as Q,_ as Z,$ as Y,T as ee,D as te,b5 as oe,b6 as ae,aL as ne,b7 as se,aK as re,b8 as ie,b9 as de,a1 as ce,I as le}from"./index-942188f0.js";import{S as pe,T as ue,a as me,F as we,N as fe,W as Te,g as ye}from"./balance-459e2092.js";import{S as Ae,C as Ee,a as Se,T as ge,b as ve}from"./TopUpView-356013a4.js";import{u as xe}from"./retry-3f674dd7.js";import{S as he}from"./SpendingCapHero-4c7ade0a.js";function Ie({theme:l,environment:p}){const{t:u}=e(),m=l===t.DARK?o(p,"/quickswapdark.webp"):o(p,"/quickswaplight.webp");return a(s,{testId:"quickswap-footer-container",sx:n,children:[a(s,{testId:"quickswap-logo",sx:r,children:[i(d,{size:"xSmall",sx:{paddingRight:"base.spacing.x1"},children:"By"}),i("img",{style:{height:"26px"},alt:"Quickswap logo",src:m})]}),i(d,{testId:"quickswap-footer-disclaimer-text",size:"xSmall",sx:c,children:u("footers.quickswapFooter.disclaimerText")})]})}const be={exchange:null,walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,allowedTokens:[]};var Ce;!function(e){e.SET_EXCHANGE="SET_EXCHANGE",e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_SUPPORTED_TOP_UPS="SET_SUPPORTED_TOP_UPS",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_ALLOWED_TOKENS="SET_ALLOWED_TOKENS"}(Ce||(Ce={}));const ke=l.createContext({swapState:be,swapDispatch:()=>{}});ke.displayName="SwapContext";const Pe=(e,t)=>{switch(t.payload.type){case Ce.SET_EXCHANGE:return{...e,exchange:t.payload.exchange};case Ce.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case Ce.SET_NETWORK:return{...e,network:t.payload.network};case Ce.SET_SUPPORTED_TOP_UPS:return{...e,supportedTopUps:{isSwapEnabled:t.payload.supportedTopUps.isSwapEnabled??!0,isOnRampEnabled:t.payload.supportedTopUps.isOnRampEnabled??!0,isBridgeEnabled:t.payload.supportedTopUps.isBridgeEnabled??!0}};case Ce.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case Ce.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};default:return e}},Re={fromAmountIn:async(e,t,o,a,n)=>{const s=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountIn(s,o.address,n.address,p.from(u(a,o.decimals)))},fromAmountOut:async(e,t,o,a,n)=>{const s=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountOut(s,n.address,o.address,p.from(u(a,o.decimals)))}},_e={display:"flex",flexDirection:"row",justifyContent:"space-between",columnGap:"base.spacing.x1"},Fe={flex:1},Oe={flex:2};function We({testId:e,options:t,textInputValue:o,textInputPlaceholder:n,textInputValidator:r,textInputType:d,onTextInputChange:c,onTextInputBlur:l,onTextInputFocus:p,textInputTextAlign:u,textInputSubtext:m,textInputErrorMessage:w,selectTextAlign:f,selectSubtext:T,selectErrorMessage:y,textInputMaxButtonClick:A,onSelectChange:E,textInputDisabled:S,selectInputDisabled:g,selectedOption:v,coinSelectorHeading:x,defaultTokenImage:h}){return a(s,{sx:_e,children:[i(s,{sx:Fe,children:i(pe,{testId:`${e}-select-form`,options:t,subtext:T,textAlign:f,errorMessage:y,onSelectChange:E,disabled:g,selectedOption:v,coinSelectorHeading:x,defaultTokenImage:h})}),i(s,{sx:Oe,children:i(ue,{type:d,testId:`${e}-text-form`,value:o,placeholder:n,subtext:m,textAlign:u,errorMessage:w,validator:r,onTextInputChange:c,onTextInputBlur:l,onTextInputFocus:p,maxButtonClick:A,disabled:S})})]})}const De={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"},Le={width:"base.icon.size.400"};function Ne({loading:t,updateLoading:o,validator:n,transaction:r,data:d,insufficientFundsForGas:c,openNotEnoughImxDrawer:p,openNetworkSwitchDrawer:u}){const{t:v}=e(),[x,h]=l.useState(!1),{viewDispatch:I}=l.useContext(m),{connectLoaderState:b}=l.useContext(w),{checkout:C,provider:k}=b,{track:P}=f(),R=async()=>{const e=n();if(P({userJourney:y.SWAP,screen:"SwapCoins",control:"Swap",controlType:"Button",extras:{swapFromAddress:d?.fromTokenAddress,swapFromAmount:d?.fromAmount,swapFromTokenSymbol:d?.fromTokenSymbol,swapToAddress:d?.toTokenAddress,swapToAmount:d?.toAmount,swapToTokenSymbol:d?.toTokenSymbol,isSwapFormValid:e,hasFundsForGas:!c}}),e&&C&&k&&r)if(c)p();else{try{const e=await k.provider.request({method:"eth_chainId",params:[]});if(parseInt(e.toString())!==A(C.config))return void u()}catch(e){console.error("Current network check failed",e)}if(r)try{o(!0);const e={fromAmount:d?.fromAmount||"",fromTokenAddress:d?.fromTokenAddress||"",toTokenAddress:d?.toTokenAddress||"",toAmount:d?.toAmount||""};if(r.approval)return void I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.APPROVE_ERC20,data:{approveTransaction:r.approval.transaction,transaction:r.swap.transaction,info:r.quote,swapFormInfo:e}}}});const t=await C.sendTransaction({provider:k,transaction:r.swap.transaction});I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.IN_PROGRESS,data:{transactionResponse:t.transactionResponse,swapForm:e}}}})}catch(e){if(console.error(e),o(!1),e.type===S.USER_REJECTED_REQUEST_ERROR)return void h(!0);if(e.type===S.UNPREDICTABLE_GAS_LIMIT)return void I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.PRICE_SURGE,data:d}}});if(e.type===S.TRANSACTION_FAILED||e.type===S.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status)return void I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,reason:"Transaction failed",data:d}}});I({payload:{type:E.UPDATE_VIEW,view:{type:g.ERROR_VIEW,error:e}}})}}};return a(s,{sx:De,children:[i(T,{testId:"swap-button",disabled:t,variant:"primary",onClick:R,size:"large",children:t?i(T.Icon,{icon:"Loading",sx:Le}):v("views.SWAP.swapForm.buttonText")}),i(me,{visible:x,showHeaderBar:!1,onCloseDrawer:()=>h(!1),onRetry:()=>{R(),h(!1)}})]})}const Ve={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},Be={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},Ue={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},Me={width:"100%",height:"base.spacing.x16"},je={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"};function Ge({environment:t,visible:o,showAdjustAmount:n,hasZeroImx:r,onCloseDrawer:c,onAddCoinsClick:l}){const{t:p}=e(),u=v(t);return i(x,{size:"full",onCloseDrawer:c,visible:o,showHeaderBar:!1,children:i(x.Content,{children:a(s,{testId:"not-enough-gas-bottom-sheet",sx:Ve,children:[i(h,{imageUrl:u,sx:{w:"base.icon.size.600",h:"base.icon.size.600"}}),i(I,{size:"small",sx:Be,testId:"not-enough-gas-heading",children:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)}),i(d,{sx:Be,children:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.body`)}),a(s,{sx:Ue,children:[n&&i(T,{testId:"not-enough-gas-adjust-amount-button",sx:Me,variant:"tertiary",onClick:c,children:p("drawers.notEnoughImx.buttons.adjustAmount")}),i(T,{testId:"not-enough-gas-add-imx-button",sx:Me,variant:"tertiary",onClick:l,children:p("drawers.notEnoughImx.buttons.addMoreImx")}),i(T,{sx:Me,variant:"tertiary",onClick:c,testId:"not-enough-gas-cancel-button",children:p("drawers.notEnoughImx.buttons.cancel")})]}),i(s,{sx:je,children:i(b,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const $e={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x4",paddingX:"base.spacing.x4",height:"100%"},ze={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},He={display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},Je={width:"100%",height:"base.spacing.x16",marginBottom:"base.spacing.x16"},qe={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},Ke={width:"base.icon.size.600",fill:"base.color.status.fatal.bright"};function Xe({visible:t,onCloseDrawer:o}){const{t:n}=e();return i(x,{size:"full",onCloseDrawer:o,visible:t,showHeaderBar:!1,children:i(x.Content,{children:a(s,{testId:"unable-to-swap-bottom-sheet",sx:$e,children:[i(C,{icon:"Alert",testId:"unable-to-swap-icon",variant:"bold",sx:Ke}),i(I,{size:"small",sx:ze,testId:"unable-to-swap-heading",children:n("drawers.unableToSwap.heading")}),i(d,{sx:ze,children:n("drawers.unableToSwap.body")}),i(s,{sx:He,children:i(T,{sx:Je,variant:"tertiary",onClick:o,testId:"unable-to-swap-cancel-button",children:n("drawers.unableToSwap.buttons.cancel")})}),i(s,{sx:qe,children:i(b,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const Qe=(e,t=500)=>{const[o,a]=l.useState(e);return l.useEffect((()=>{const o=setTimeout((()=>{a(e)}),t);return()=>{clearTimeout(o)}}),[e,t]),o};class Ze{static id=0;promiseId=0;promise;isCancelled=!1;onCancel=null;rejectPromise=()=>{};constructor(e){Ze.id+=1,this.promiseId=Ze.id,this.promise=new Promise(((t,o)=>{this.rejectPromise=o,e((e=>{this.isCancelled?o({cancelled:!0}):t(e)}),(e=>{this.isCancelled?o({cancelled:!0}):o(e)}))}))}static all(e){return new Ze(((t,o)=>{Promise.all(e.map((e=>e instanceof Ze?e.promise:e))).then(t,o)}))}then(e,t){return new Ze(((o,a)=>{this.promise.then((t=>o(e?e(t):t)),(e=>t?o(t(e)):a(e)))}))}catch(e){return this.then(void 0,e)}finally(e){return new Ze(((t,o)=>{this.promise.then(t,o).finally((()=>{e&&e()}))}))}cancel(){this.isCancelled||(this.isCancelled=!0,this.onCancel&&this.onCancel(),this.rejectPromise({cancelled:!0}))}onCancelled(e){this.onCancel=e}get cancelled(){return this.isCancelled}}var Ye;!function(e){e.FROM="FROM",e.TO="TO"}(Ye||(Ye={}));const et=({swapFromToken:e,swapToToken:t,swapFromAmount:o,swapToAmount:a,conversion:n})=>{const s={fromToConversion:"",swapToAmount:""};if(!a)return s;if(s.swapToAmount=_(a),o&&e&&t){const o=F(_(B(n,t.decimals)),!0);s.fromToConversion=`1 ${e.symbol} ≈ ${o} ${t.symbol}`}return s},tt=(e,t)=>void 0!==e&&(""!==e&&t!==e);let ot;function at({data:t,theme:o}){const{t:n}=e(),{swapState:{allowedTokens:r,exchange:c,tokenBalances:T,network:S}}=l.useContext(ke),{connectLoaderState:v}=l.useContext(w),{checkout:x,provider:h}=v,b=k(x?.config.environment,o),C=l.useCallback(((e,t)=>P(t)?`${e.toLowerCase()}-${R}`:`${e.toLowerCase()}-${t.toLowerCase()}`),[]),{cryptoFiatState:G,cryptoFiatDispatch:$}=l.useContext(Ee),{viewDispatch:z}=l.useContext(m),[H,J]=l.useState(Ye.FROM),[q,K]=l.useState(!1),[X,Q]=l.useState(p.from(0)),[Z,Y]=l.useState(""),ee=l.useRef(!1),{track:te}=f(),[oe,ae]=l.useState(t?.fromAmount||""),[ne,se]=l.useState(""),re=Qe(oe,U),[ie,de]=l.useState(),[ce,le]=l.useState(""),[pe,ue]=l.useState(""),[me,Te]=l.useState(t?.toAmount||""),[ye,Ae]=l.useState(""),ge=Qe(me,U),[ve,he]=l.useState(),[Ie,be]=l.useState(""),[Ce,Pe]=l.useState(""),[_e,Fe]=l.useState(null),[Oe,De]=l.useState(""),[Le,Ve]=l.useState(void 0),[Be,Ue]=l.useState(""),[Me,je]=l.useState([]),[$e,ze]=l.useState(!1),[He,Je]=l.useState(!1),[qe,Ke]=l.useState(!1);l.useEffect((()=>{if(0===T.length)return;if(!S)return;const e=T.filter((e=>e.balance.gt(0))).map((e=>({id:C(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedAmount:_(e.formattedBalance),formattedFiatAmount:0===G.conversions.size?F(""):O(e.formattedBalance,e.token.symbol||"",G.conversions)}})));je(e),ee.current||(ee.current=!0,t?.fromTokenAddress&&(de(r.find((e=>P(e.address)&&t?.fromTokenAddress?.toLowerCase()===R||e.address?.toLowerCase()===t?.fromTokenAddress?.toLowerCase()))),le(T.find((e=>P(e.token.address)&&t?.fromTokenAddress?.toLowerCase()===R||e.token.address?.toLowerCase()===t?.fromTokenAddress?.toLowerCase()))?.formattedBalance??"")),tt(t?.toTokenAddress,t?.fromTokenAddress)&&he(r.find((e=>P(e.address)&&t?.toTokenAddress?.toLowerCase()===R||e.address?.toLowerCase()===t?.toTokenAddress?.toLowerCase()))))}),[T,r,G.conversions,t?.fromTokenAddress,t?.toTokenAddress,ee.current,de,le,he,je,C,F,S]);const at=l.useMemo((()=>r.map((e=>({id:C(e.symbol,e.address),name:e.name,symbol:e.symbol,icon:e.icon})))),[r,ie]);l.useEffect((()=>{$({payload:{type:Se.SET_TOKEN_SYMBOLS,tokenSymbols:r.map((e=>e.symbol))}})}),[$,r]);const nt=()=>{se(""),ue(""),Ae(""),be("")},st=()=>{ot&&ot.cancel(),Y(""),Ue(""),Fe(null)},rt=e=>!Number.isNaN(parseFloat(oe))&&(!(parseFloat(oe)<=0)&&(!!ie&&(!!ve&&(!e||!q)))),it=async(e=!1)=>{rt(e)&&(ot&&ot.cancel(),e||K(!0),await(async(e=!1)=>{if(h&&c&&ie&&ve){try{e||Y("");const t=Re.fromAmountIn(c,h,ie,oe,ve),o=Re.fromAmountIn(c,h,ie,"1",ve),a=Ze.all([t,o]);ot=a;const n=await a,s=n[0],i=n[1];Q(i.quote.amount.value);const d=s.swap.gasFeeEstimate;let l=p.from(d?.value||0);s.approval?.gasFeeEstimate&&(l=l.add(s.approval.gasFeeEstimate.value));const u=B(l,j),m=d?.token,w=r.find((e=>e.address?.toLocaleLowerCase()===m?.address?.toLocaleLowerCase()));Fe(s),De(u),Ve({name:w?.name||"",symbol:w?.symbol||"",decimals:w?.decimals||0,address:w?.address,icon:w?.icon}),Ue(O(u,w?.symbol||"",G.conversions)),Te(F(_(B(s.quote.amount.value,s.quote.amount.token.decimals),s.quote.amount.token.decimals))),nt()}catch(e){e.cancelled||(st(),ze(!1),Je(!0))}e||K(!1)}})(e))},dt=e=>!Number.isNaN(parseFloat(me))&&(!(parseFloat(me)<=0)&&(!!ie&&(!!ve&&(!e||!q)))),ct=async(e=!1)=>{dt(e)&&(ot&&ot.cancel(),e||K(!0),await(async(e=!1)=>{if(h&&c&&ie&&ve){try{e||Y("");const t=Re.fromAmountOut(c,h,ve,me,ie),o=Re.fromAmountIn(c,h,ie,"1",ve),a=Ze.all([t,o]);ot=a;const n=await a,s=n[0],i=n[1];Q(i.quote.amount.value);const d=s.swap.gasFeeEstimate;let l=p.from(d?.value||0);s.approval?.gasFeeEstimate&&(l=l.add(s.approval.gasFeeEstimate.value));const u=B(l,j),m=d?.token,w=r.find((e=>e.symbol===m?.symbol));Fe(s),De(u),Ve({name:w?.name||"",symbol:w?.symbol||"",decimals:w?.decimals||0,address:w?.address,icon:w?.icon}),Ue(O(u,w?.symbol||"",G.conversions)),ae(F(_(B(s.quote.amount.value,s.quote.amount.token.decimals)))),nt()}catch(e){e.cancelled||(st(),ze(!1),Je(!0))}e||K(!1)}})(e))},lt=async(e=!1)=>{H===Ye.FROM?await it(e):await ct(e)};xe((()=>lt(!0)),W),l.useEffect((()=>{if(H===Ye.FROM){if(re<=0)return K(!1),void st();(async()=>{await lt()})()}}),[re,ie,ve]),l.useEffect((()=>{if(H===Ye.TO){if(ge<=0)return K(!1),void st();(async()=>{await lt()})()}}),[ge,ve,ie]);const pt=l.useMemo((()=>{const e=T.find((e=>e.token.address?.toLowerCase()===R));if(!e)return!0;const t=ie?.address?.toLowerCase()===R,o=D(0!==Oe.length?Oe:"0"),a=t&&!Number.isNaN(parseFloat(oe))?u(oe,ie?.decimals||18):p.from("0");return o.add(a).gt(e.balance)}),[Oe,T,ie,oe]);l.useEffect((()=>{oe&&ie&&Pe(O(oe,ie.symbol,G.conversions))}),[oe,ie]);const ut=l.useCallback((e=>{const t=T.find((t=>e===C(t.token.symbol,t.token.address)));t&&(ve&&e===C(ve.symbol,ve?.address)&&he(void 0),de(t.token),le(t.formattedBalance),ue(""))}),[ve]),mt=l.useCallback((e=>{const t=r.find((t=>e===C(t.symbol,t.address)));t&&(ie&&e===C(ie.symbol,ie?.address)&&de(void 0),he(t),be(""))}),[ie]);return l.useEffect((()=>{_e&&X&&Y(et({swapFromToken:ie,swapFromAmount:oe,swapToToken:ve,swapToAmount:me,conversion:X}).fromToConversion)}),[_e,X]),a(V,{children:[a(s,{sx:{paddingX:"base.spacing.x4",marginBottom:"base.spacing.x2"},children:[i(I,{size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:n("views.SWAP.content.title")}),a(s,{sx:{display:"flex",flexDirection:"column",rowGap:"base.spacing.x6",paddingBottom:"base.spacing.x2"},children:[a(s,{children:[i(I,{size:"xSmall",sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:n("views.SWAP.swapForm.from.label")}),i(We,{testId:"fromTokenInputs",options:Me,selectSubtext:ie?`${n("views.SWAP.content.availableBalancePrefix")} ${_(ce)}`:"",selectTextAlign:"left",textInputType:"number",textInputValue:oe,textInputPlaceholder:n("views.SWAP.swapForm.from.inputPlaceholder"),textInputSubtext:`${n("views.SWAP.content.fiatPricePrefix")} \n $${F(Ce,!0)}`,textInputTextAlign:"right",textInputValidator:L,onTextInputChange:e=>{return t=e,nt(),st(),Te(""),rt(!1)&&K(!0),void ae(t);var t},onTextInputFocus:()=>{J(Ye.FROM)},textInputMaxButtonClick:()=>{if(!ce)return;const e=ce.slice(0,ce.indexOf(".")+M+1);nt(),st(),Te(""),J(Ye.FROM),ae(e),te({userJourney:y.SWAP,screen:"SwapCoins",control:"MaxFrom",controlType:"Button",extras:{fromBalance:ce,fromBalanceTruncated:e}})},onSelectChange:ut,textInputErrorMessage:n(ne),selectErrorMessage:n(pe),selectedOption:ie?C(ie.symbol,ie.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.from.selectorTitle"),defaultTokenImage:b})]}),a(s,{children:[a(s,{sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:[i(I,{size:"xSmall",children:n("views.SWAP.swapForm.to.label")}),i(d,{sx:{color:"base.color.brand.4"},size:"small",children:Z})]}),i(We,{testId:"toTokenInputs",options:at,selectTextAlign:"left",textInputType:"number",textInputValue:me,textInputPlaceholder:n("views.SWAP.swapForm.to.inputPlaceholder"),textInputTextAlign:"right",textInputValidator:L,onTextInputChange:e=>{return t=e,nt(),st(),Pe(""),ae(""),dt(!1)&&K(!0),void Te(t);var t},onTextInputFocus:()=>{J(Ye.TO)},onSelectChange:mt,textInputErrorMessage:n(ye),selectErrorMessage:n(Ie),selectedOption:ve?C(ve.symbol,ve.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.to.selectorTitle"),defaultTokenImage:b})]})]}),i(we,{gasFeeFiatValue:Be,gasFeeToken:Le,gasFeeValue:Oe,fees:[{label:n("drawers.feesBreakdown.fees.gasFeeSwap.label"),fiatAmount:`~ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${Be}`,amount:_(Oe),prefix:"~"}],onFeesClick:()=>{te({userJourney:y.SWAP,screen:"SwapCoins",control:"ViewFees",controlType:"Button"})},sx:{paddingBottom:"0"},loading:q})]}),i(Ne,{validator:()=>{const e=function(e){return e?"":"views.SWAP.validation.noFromTokenSelected"}(ie),t=(a=ce,(o=oe)&&0!==parseFloat(o)?a&&Number(o)>Number(a)?"views.SWAP.validation.insufficientBalance":"":"views.SWAP.validation.noAmountInputted");var o,a;const n=function(e){return e?"":"views.SWAP.validation.noToTokenSelected"}(ve),s=function(e){return e&&0!==parseFloat(e)?"":"views.SWAP.validation.noAmountInputted"}(me);H===Ye.FROM?(Ae(""),t&&se(t)):H===Ye.TO&&(se(""),s&&Ae(s)),e&&ue(e),n&&be(n);let r=!0;return(e||n||t&&H===Ye.FROM||s&&H===Ye.TO)&&(r=!1),te({userJourney:y.SWAP,screen:"SwapCoins",control:"FormValid",controlType:"Button",extras:{isSwapFormValid:r,swapFromAddress:ie?.address,swapFromAmount:oe,swapFromTokenSymbol:ie?.symbol,swapToAddress:ve?.address,swapToAmount:me,swapToTokenSymbol:ve?.symbol}}),r},updateLoading:e=>{K(e)},loading:q,transaction:_e,data:{fromAmount:oe,toAmount:me,fromTokenSymbol:ie?.symbol,fromTokenAddress:ie?.address,toTokenSymbol:ve?.symbol,toTokenAddress:ve?.address},insufficientFundsForGas:pt,openNotEnoughImxDrawer:()=>{Je(!1),ze(!0)},openNetworkSwitchDrawer:()=>Ke(!0)}),i(Ge,{environment:x?.config.environment??N.PRODUCTION,visible:$e,showAdjustAmount:ie?.address===R,hasZeroImx:!1,onAddCoinsClick:()=>{z({payload:{type:E.UPDATE_VIEW,view:{type:g.TOP_UP_VIEW},currentViewData:{fromTokenAddress:ie?.address??"",fromAmount:oe,toTokenAddress:ve?.address??""}}})},onCloseDrawer:()=>ze(!1)}),i(Xe,{visible:He,onCloseDrawer:()=>{Je(!1),de(void 0),ae(""),he(void 0),Te("")}}),i(fe,{visible:qe,targetChainId:A(x?.config),provider:h,checkout:x,onCloseDrawer:()=>Ke(!1)})]})}const nt=(e,t)=>{if(0===e.length)return!0;let o=!1;return e.forEach((e=>{e.token.symbol===t&&e.balance.eq(0)&&(o=!0)})),o};function st({theme:t,fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d}){const{t:c}=e(),{viewDispatch:p}=l.useContext(m),{eventTargetState:{eventTarget:u}}=l.useContext(G),{swapState:{tokenBalances:T}}=l.useContext(ke),{connectLoaderState:{checkout:A}}=l.useContext(w),[S,v]=l.useState(!1),{page:x}=f();return l.useEffect((()=>{x({userJourney:y.SWAP,screen:"SwapCoins",extras:{fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d}})}),[]),l.useEffect((()=>{nt(T,J)&&v(!0)}),[T]),i(H,{header:i($,{title:c("views.SWAP.header.title"),onCloseButtonClick:()=>z(u)}),footer:i(Ie,{environment:A?.config.environment,theme:t}),children:a(s,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[i(at,{data:{fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d},theme:t}),i(Ge,{environment:A?.config.environment??N.PRODUCTION,visible:S,showAdjustAmount:!1,hasZeroImx:!0,onAddCoinsClick:()=>{p({payload:{type:E.UPDATE_VIEW,view:{type:g.TOP_UP_VIEW}}})},onCloseDrawer:()=>{v(!1)}})]})})}function rt({transactionResponse:t,swapForm:o}){const{t:a}=e(),{viewDispatch:n}=l.useContext(m),{page:s}=f();return l.useEffect((()=>{s({userJourney:y.SWAP,screen:"SwapInProgress",extras:{swapFormInfo:o}})}),[]),l.useEffect((()=>{(async()=>{try{const e=await t.wait();if(1===e.status)return void n({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SUCCESS,data:{fromTokenAddress:o.fromTokenAddress,fromAmount:o.fromAmount,toTokenAddress:o.toTokenAddress,toAmount:o.toAmount||"",transactionHash:e.transactionHash}}}});n({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,data:o,reason:"Transaction failed"}}})}catch{n({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,data:o,reason:"Transaction failed"}}})}})()}),[t]),i(q,{loadingText:a("views.SWAP.IN_PROGRESS.loading.text"),showFooterLogo:!0})}function it({data:t}){const{t:o}=e(),{swapState:{allowedTokens:n}}=l.useContext(ke),{connectLoaderState:r}=l.useContext(w),{checkout:d,provider:c}=r,{viewDispatch:p}=l.useContext(m),{eventTargetState:{eventTarget:u}}=l.useContext(G),T=K(c),[A,v]=l.useState(!1),[x,h]=l.useState(!1),[I,b]=l.useState(!1),[C,k]=l.useState(!1),[P,R]=l.useState(!1),[_,F]=l.useState(!1),{page:O,track:W}=f();l.useEffect((()=>{O({userJourney:y.SWAP,screen:"ApproveERC20",extras:{swapFormInfo:t.swapFormInfo}})}),[]);const D=l.useMemo((()=>n.find((e=>e.address===t.swapFormInfo.fromTokenAddress))),[n,t.swapFormInfo.fromTokenAddress]),L=l.useCallback((()=>{p({payload:{type:E.UPDATE_VIEW,view:{type:g.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[p]),N=l.useCallback((()=>{p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SWAP,data:t.swapFormInfo}}})}),[p]),B=(e,t)=>{e.type!==S.UNPREDICTABLE_GAS_LIMIT?e.type===S.TRANSACTION_FAILED||e.type===S.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,reason:"Transaction failed",data:t}}}):p({payload:{type:E.UPDATE_VIEW,view:{type:g.ERROR_VIEW,error:e}}}):p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.PRICE_SURGE,data:t}}})},U=l.useCallback((async()=>{if(!C)if(W({userJourney:y.SWAP,screen:"ApproveERC20",control:"ApproveSpending",controlType:"Button"}),k(!0),d&&c){if(!A){v(!0);try{const e=await d.sendTransaction({provider:c,transaction:t.approveTransaction});h(!0);if(1!==(await e.transactionResponse.wait()).status)return void p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,data:t.swapFormInfo}}});h(!1),v(!1),b(!0)}catch(e){if(h(!1),v(!1),e.type===S.USER_REJECTED_REQUEST_ERROR)return void R(!0);B(e,t.swapFormInfo)}finally{k(!1)}}}else L()}),[d,c,L,p,F,t.approveTransaction,t.swapFormInfo,A,v,h]),M=l.useMemo((()=>a(X,{heading:o(`views.APPROVE_ERC20.approveSpending.content.${T?"passport":"metamask"}.heading`),children:[T&&i(s,{children:o("views.APPROVE_ERC20.approveSpending.content.passport.body")}),!T&&i(s,{children:o("views.APPROVE_ERC20.approveSpending.content.metamask.body",{amount:`${t.swapFormInfo.fromAmount} ${D?.symbol||""}`})})]})),[t.swapFormInfo,D,T]),j=l.useMemo((()=>i(Q,{loading:C,actionText:o(P?"views.APPROVE_ERC20.approveSpending.footer.retryText":"views.APPROVE_ERC20.approveSpending.footer.buttonText"),onActionClick:U})),[P,U,C]),J=l.useCallback((async()=>{if(!C)if(W({userJourney:y.SWAP,screen:"ApproveERC20",control:"ApproveSwap",controlType:"Button"}),k(!0),d&&c){if(!A){v(!0);try{const e=await d.sendTransaction({provider:c,transaction:t.transaction});v(!1),p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.IN_PROGRESS,data:{transactionResponse:e.transactionResponse,swapForm:t.swapFormInfo}}}})}catch(e){if(v(!1),e.type===S.USER_REJECTED_REQUEST_ERROR)return void F(!0);B(e,t.swapFormInfo)}finally{k(!1)}}}else L()}),[d,c,L,p,F,t.transaction,t.swapFormInfo,A,v]),Z=i(X,{heading:o("views.APPROVE_ERC20.approveSwap.content.heading"),children:i(s,{children:o("views.APPROVE_ERC20.approveSwap.content.body")})}),Y=l.useMemo((()=>i(Q,{loading:C,actionText:o(_?"views.APPROVE_ERC20.approveSwap.footer.retryText":"views.APPROVE_ERC20.approveSwap.footer.buttonText"),onActionClick:J})),[_,J,C]);return a(V,{children:[x&&i(q,{loadingText:o("views.APPROVE_ERC20.approveSpending.loading.text"),showFooterLogo:!0}),!x&&i(H,{header:i($,{transparent:!0,showBack:!0,onCloseButtonClick:()=>z(u),onBackButtonClick:N}),floatHeader:!0,heroContent:i(I?Te:he,{}),footer:I?Y:j,children:I?Z:M})]})}function dt({amount:t,fromTokenAddress:o,toTokenAddress:n,config:s}){const{t:r}=e(),{eventTargetState:{eventTarget:d}}=l.useContext(G),{environment:c,theme:p,isOnRampEnabled:u,isSwapEnabled:T,isBridgeEnabled:S}=s,{connectLoaderState:{checkout:v,provider:x}}=l.useContext(w),[h,I]=l.useReducer(Z,{...Y,history:[]}),[b,C]=l.useReducer(Pe,be),{page:k}=f(),[P,R]=l.useState(!1),_=l.useMemo((()=>({swapState:b,swapDispatch:C})),[b,C]),F=l.useMemo((()=>({viewState:h,viewDispatch:I})),[h,I]),O=l.useCallback(((e,t)=>{I({payload:{type:E.UPDATE_VIEW,view:{type:g.ERROR_VIEW,tryAgain:t,error:e}}})}),[I]),W=l.useCallback((()=>{I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SWAP}}})}),[I]),D=l.useCallback((async()=>{if(!v)throw new Error("loadBalances: missing checkout");if(!x)throw new Error("loadBalances: missing provider");try{const e=await ye({checkout:v,provider:x,allowTokenListType:ee.SWAP});if(void 0===e)return!1;C({payload:{type:Ce.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}}),C({payload:{type:Ce.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}})}catch(e){if(te.nonRetryable(e))return O(e,D),!1}return!0}),[v,x]);return l.useEffect((()=>{(async()=>{if(!v||!x)return;const e=await v.getNetworkInfo({provider:x});if(e.chainId!==A(v.config))return;let t;try{t=await v.config.remote.getConfig("dex")}catch(e){return void O(e)}const o=new oe({chainId:e.chainId,baseConfig:new ae({environment:c}),secondaryFees:t.secondaryFees,overrides:t.overrides});C({payload:{type:Ce.SET_EXCHANGE,exchange:o}}),C({payload:{type:Ce.SET_NETWORK,network:e}}),await D()&&h.view.type===g.LOADING_VIEW&&W()})()}),[v,x]),i(m.Provider,{value:F,children:i(ke.Provider,{value:_,children:a(ve,{environment:c,children:[h.view.type===g.LOADING_VIEW&&i(q,{loadingText:r("views.LOADING_VIEW.text")}),h.view.type===Ae.SWAP&&i(st,{theme:p,fromAmount:h.view.data?.fromAmount??t,fromTokenAddress:h.view.data?.fromTokenAddress??o,toTokenAddress:h.view.data?.toTokenAddress??n}),h.view.type===Ae.IN_PROGRESS&&i(rt,{transactionResponse:h.view.data.transactionResponse,swapForm:h.view.data.swapForm}),h.view.type===Ae.APPROVE_ERC20&&i(it,{data:h.view.data}),h.view.type===Ae.SUCCESS&&i(ne,{statusText:r("views.SWAP.success.text"),actionText:r("views.SWAP.success.actionText"),onRenderEvent:()=>{k({userJourney:y.SWAP,screen:"SwapSuccess",extras:{fromTokenAddress:h.view.data?.fromTokenAddress,fromAmount:h.view.data?.fromAmount,toTokenAddress:h.view.data?.toTokenAddress,toAmount:h.view.data?.toAmount}}),se(d,h.view.data.transactionHash)},onActionClick:()=>z(d),statusType:re.SUCCESS,testId:"success-view"}),h.view.type===Ae.FAIL&&i(ne,{statusText:r("views.SWAP.failed.text"),actionText:r("views.SWAP.failed.actionText"),onRenderEvent:()=>{k({userJourney:y.SWAP,screen:"SwapFailed"}),ie(d,"Transaction failed")},onActionClick:()=>{h.view.type===Ae.FAIL&&I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SWAP,data:h.view.data}}})},statusType:re.FAILURE,onCloseClick:()=>z(d),testId:"fail-view"}),h.view.type===Ae.PRICE_SURGE&&i(ne,{statusText:r("views.SWAP.rejected.text"),actionText:r("views.SWAP.rejected.actionText"),onRenderEvent:()=>{k({userJourney:y.SWAP,screen:"PriceSurge"}),de(d,"Price surge")},onActionClick:()=>{h.view.type===Ae.PRICE_SURGE&&I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SWAP,data:h.view.data}}})},statusType:re.WARNING,onCloseClick:()=>z(d),testId:"price-surge-view"}),h.view.type===g.ERROR_VIEW&&i(ce,{actionText:r("views.ERROR_VIEW.actionText"),onActionClick:async()=>{R(!0);const e=h.view;if(!e.tryAgain)return W(),void R(!1);await e.tryAgain()&&W(),R(!1)},onCloseClick:()=>z(d),errorEventActionLoading:P}),h.view.type===g.TOP_UP_VIEW&&i(ge,{analytics:{userJourney:y.SWAP},checkout:v,provider:x,widgetEvent:le.IMTBL_SWAP_WIDGET_EVENT,showOnrampOption:u,showSwapOption:T,showBridgeOption:S,onCloseButtonClick:()=>z(d)})]})})})}export{dt as default};
|
|
1
|
+
import{u as e,aN as t,aO as o,j as a,aP as n,B as s,aQ as r,a as i,b as d,aR as c,r as l,aj as p,aS as u,V as m,C as w,e as f,p as T,U as y,g as A,d as E,m as S,S as v,aT as g,aB as x,aU as h,H as I,aV as b,ad as C,k,l as P,al as R,t as _,f as F,y as O,aW as W,aX as D,aY as N,ae as L,aI as V,aZ as B,a_ as U,a$ as M,b0 as j,E as G,z as $,b1 as z,J as H,b2 as J,a0 as q,i as K,W as X,b3 as Q,_ as Z,$ as Y,T as ee,D as te,b4 as oe,b5 as ae,aK as ne,b6 as se,aJ as re,b7 as ie,b8 as de,a1 as ce,I as le}from"./index-81d38420.js";import{S as pe,T as ue,a as me,F as we,N as fe,W as Te,g as ye}from"./balance-1832cb3b.js";import{S as Ae,C as Ee,a as Se,T as ve,b as ge}from"./TopUpView-194b0094.js";import{u as xe}from"./retry-656d939c.js";import{S as he}from"./SpendingCapHero-723b22e5.js";function Ie({theme:l,environment:p}){const{t:u}=e(),m=l===t.DARK?o(p,"/quickswapdark.webp"):o(p,"/quickswaplight.webp");return a(s,{testId:"quickswap-footer-container",sx:n,children:[a(s,{testId:"quickswap-logo",sx:r,children:[i(d,{size:"xSmall",sx:{paddingRight:"base.spacing.x1"},children:"By"}),i("img",{style:{height:"26px"},alt:"Quickswap logo",src:m})]}),i(d,{testId:"quickswap-footer-disclaimer-text",size:"xSmall",sx:c,children:u("footers.quickswapFooter.disclaimerText")})]})}const be={exchange:null,walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,allowedTokens:[]};var Ce;!function(e){e.SET_EXCHANGE="SET_EXCHANGE",e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_SUPPORTED_TOP_UPS="SET_SUPPORTED_TOP_UPS",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_ALLOWED_TOKENS="SET_ALLOWED_TOKENS"}(Ce||(Ce={}));const ke=l.createContext({swapState:be,swapDispatch:()=>{}});ke.displayName="SwapContext";const Pe=(e,t)=>{switch(t.payload.type){case Ce.SET_EXCHANGE:return{...e,exchange:t.payload.exchange};case Ce.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case Ce.SET_NETWORK:return{...e,network:t.payload.network};case Ce.SET_SUPPORTED_TOP_UPS:return{...e,supportedTopUps:{isSwapEnabled:t.payload.supportedTopUps.isSwapEnabled??!0,isOnRampEnabled:t.payload.supportedTopUps.isOnRampEnabled??!0,isBridgeEnabled:t.payload.supportedTopUps.isBridgeEnabled??!0}};case Ce.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case Ce.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};default:return e}},Re={fromAmountIn:async(e,t,o,a,n)=>{const s=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountIn(s,o.address,n.address,p.from(u(a,o.decimals)))},fromAmountOut:async(e,t,o,a,n)=>{const s=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountOut(s,n.address,o.address,p.from(u(a,o.decimals)))}},_e={display:"flex",flexDirection:"row",justifyContent:"space-between",columnGap:"base.spacing.x1"},Fe={flex:1},Oe={flex:2};function We({testId:e,options:t,textInputValue:o,textInputPlaceholder:n,textInputValidator:r,textInputType:d,onTextInputChange:c,onTextInputBlur:l,onTextInputFocus:p,textInputTextAlign:u,textInputSubtext:m,textInputErrorMessage:w,selectTextAlign:f,selectSubtext:T,selectErrorMessage:y,textInputMaxButtonClick:A,onSelectChange:E,textInputDisabled:S,selectInputDisabled:v,selectedOption:g,coinSelectorHeading:x,defaultTokenImage:h}){return a(s,{sx:_e,children:[i(s,{sx:Fe,children:i(pe,{testId:`${e}-select-form`,options:t,subtext:T,textAlign:f,errorMessage:y,onSelectChange:E,disabled:v,selectedOption:g,coinSelectorHeading:x,defaultTokenImage:h})}),i(s,{sx:Oe,children:i(ue,{type:d,testId:`${e}-text-form`,value:o,placeholder:n,subtext:m,textAlign:u,errorMessage:w,validator:r,onTextInputChange:c,onTextInputBlur:l,onTextInputFocus:p,maxButtonClick:A,disabled:S})})]})}const De={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"},Ne={width:"base.icon.size.400"};function Le({loading:t,updateLoading:o,validator:n,transaction:r,data:d,insufficientFundsForGas:c,openNotEnoughImxDrawer:p,openNetworkSwitchDrawer:u}){const{t:g}=e(),[x,h]=l.useState(!1),{viewDispatch:I}=l.useContext(m),{connectLoaderState:b}=l.useContext(w),{checkout:C,provider:k}=b,{track:P}=f(),R=async()=>{const e=n();if(P({userJourney:y.SWAP,screen:"SwapCoins",control:"Swap",controlType:"Button",extras:{swapFromAddress:d?.fromTokenAddress,swapFromAmount:d?.fromAmount,swapFromTokenSymbol:d?.fromTokenSymbol,swapToAddress:d?.toTokenAddress,swapToAmount:d?.toAmount,swapToTokenSymbol:d?.toTokenSymbol,isSwapFormValid:e,hasFundsForGas:!c}}),e&&C&&k&&r)if(c)p();else{try{const e=await k.provider.request({method:"eth_chainId",params:[]});if(parseInt(e.toString())!==A(C.config))return void u()}catch(e){console.error("Current network check failed",e)}if(r)try{o(!0);const e={fromAmount:d?.fromAmount||"",fromTokenAddress:d?.fromTokenAddress||"",toTokenAddress:d?.toTokenAddress||"",toAmount:d?.toAmount||""};if(r.approval)return void I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.APPROVE_ERC20,data:{approveTransaction:r.approval.transaction,transaction:r.swap.transaction,info:r.quote,swapFormInfo:e}}}});const t=await C.sendTransaction({provider:k,transaction:r.swap.transaction});I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.IN_PROGRESS,data:{transactionResponse:t.transactionResponse,swapForm:e}}}})}catch(e){if(console.error(e),o(!1),e.type===S.USER_REJECTED_REQUEST_ERROR)return void h(!0);if(e.type===S.UNPREDICTABLE_GAS_LIMIT)return void I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.PRICE_SURGE,data:d}}});if(e.type===S.TRANSACTION_FAILED||e.type===S.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status)return void I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,reason:"Transaction failed",data:d}}});I({payload:{type:E.UPDATE_VIEW,view:{type:v.ERROR_VIEW,error:e}}})}}};return a(s,{sx:De,children:[i(T,{testId:"swap-button",disabled:t,variant:"primary",onClick:R,size:"large",children:t?i(T.Icon,{icon:"Loading",sx:Ne}):g("views.SWAP.swapForm.buttonText")}),i(me,{visible:x,showHeaderBar:!1,onCloseDrawer:()=>h(!1),onRetry:()=>{R(),h(!1)}})]})}const Ve={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},Be={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},Ue={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},Me={width:"100%",height:"base.spacing.x16"},je={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"};function Ge({environment:t,visible:o,showAdjustAmount:n,hasZeroImx:r,onCloseDrawer:c,onAddCoinsClick:l}){const{t:p}=e(),u=g(t);return i(x,{size:"full",onCloseDrawer:c,visible:o,showHeaderBar:!1,children:i(x.Content,{children:a(s,{testId:"not-enough-gas-bottom-sheet",sx:Ve,children:[i(h,{imageUrl:u,sx:{w:"base.icon.size.600",h:"base.icon.size.600"}}),i(I,{size:"small",sx:Be,testId:"not-enough-gas-heading",children:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)}),i(d,{sx:Be,children:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.body`)}),a(s,{sx:Ue,children:[n&&i(T,{testId:"not-enough-gas-adjust-amount-button",sx:Me,variant:"tertiary",onClick:c,children:p("drawers.notEnoughImx.buttons.adjustAmount")}),i(T,{testId:"not-enough-gas-add-imx-button",sx:Me,variant:"tertiary",onClick:l,children:p("drawers.notEnoughImx.buttons.addMoreImx")}),i(T,{sx:Me,variant:"tertiary",onClick:c,testId:"not-enough-gas-cancel-button",children:p("drawers.notEnoughImx.buttons.cancel")})]}),i(s,{sx:je,children:i(b,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const $e={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x4",paddingX:"base.spacing.x4",height:"100%"},ze={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},He={display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},Je={width:"100%",height:"base.spacing.x16",marginBottom:"base.spacing.x16"},qe={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},Ke={width:"base.icon.size.600",fill:"base.color.status.fatal.bright"};function Xe({visible:t,onCloseDrawer:o}){const{t:n}=e();return i(x,{size:"full",onCloseDrawer:o,visible:t,showHeaderBar:!1,children:i(x.Content,{children:a(s,{testId:"unable-to-swap-bottom-sheet",sx:$e,children:[i(C,{icon:"Alert",testId:"unable-to-swap-icon",variant:"bold",sx:Ke}),i(I,{size:"small",sx:ze,testId:"unable-to-swap-heading",children:n("drawers.unableToSwap.heading")}),i(d,{sx:ze,children:n("drawers.unableToSwap.body")}),i(s,{sx:He,children:i(T,{sx:Je,variant:"tertiary",onClick:o,testId:"unable-to-swap-cancel-button",children:n("drawers.unableToSwap.buttons.cancel")})}),i(s,{sx:qe,children:i(b,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const Qe=(e,t=500)=>{const[o,a]=l.useState(e);return l.useEffect((()=>{const o=setTimeout((()=>{a(e)}),t);return()=>{clearTimeout(o)}}),[e,t]),o};class Ze{static id=0;promiseId=0;promise;isCancelled=!1;onCancel=null;rejectPromise=()=>{};constructor(e){Ze.id+=1,this.promiseId=Ze.id,this.promise=new Promise(((t,o)=>{this.rejectPromise=o,e((e=>{this.isCancelled?o({cancelled:!0}):t(e)}),(e=>{this.isCancelled?o({cancelled:!0}):o(e)}))}))}static all(e){return new Ze(((t,o)=>{Promise.all(e.map((e=>e instanceof Ze?e.promise:e))).then(t,o)}))}then(e,t){return new Ze(((o,a)=>{this.promise.then((t=>o(e?e(t):t)),(e=>t?o(t(e)):a(e)))}))}catch(e){return this.then(void 0,e)}finally(e){return new Ze(((t,o)=>{this.promise.then(t,o).finally((()=>{e&&e()}))}))}cancel(){this.isCancelled||(this.isCancelled=!0,this.onCancel&&this.onCancel(),this.rejectPromise({cancelled:!0}))}onCancelled(e){this.onCancel=e}get cancelled(){return this.isCancelled}}var Ye;!function(e){e.FROM="FROM",e.TO="TO"}(Ye||(Ye={}));const et=({swapFromToken:e,swapToToken:t,swapFromAmount:o,swapToAmount:a,conversion:n})=>{const s={fromToConversion:"",swapToAmount:""};if(!a)return s;if(s.swapToAmount=_(a),o&&e&&t){const o=F(_(B(n,t.decimals)),!0);s.fromToConversion=`1 ${e.symbol} ≈ ${o} ${t.symbol}`}return s},tt=(e,t)=>void 0!==e&&(""!==e&&t!==e);let ot;function at({data:t,theme:o}){const{t:n}=e(),{swapState:{allowedTokens:r,exchange:c,tokenBalances:T,network:S}}=l.useContext(ke),{connectLoaderState:g}=l.useContext(w),{checkout:x,provider:h}=g,b=k(x?.config.environment,o),C=l.useCallback(((e,t)=>P(t)?`${e.toLowerCase()}-${R}`:`${e.toLowerCase()}-${t.toLowerCase()}`),[]),{cryptoFiatState:G,cryptoFiatDispatch:$}=l.useContext(Ee),{viewDispatch:z}=l.useContext(m),[H,J]=l.useState(Ye.FROM),[q,K]=l.useState(!1),[X,Q]=l.useState(p.from(0)),[Z,Y]=l.useState(""),ee=l.useRef(!1),{track:te}=f(),[oe,ae]=l.useState(t?.fromAmount||""),[ne,se]=l.useState(""),re=Qe(oe,U),[ie,de]=l.useState(),[ce,le]=l.useState(""),[pe,ue]=l.useState(""),[me,Te]=l.useState(t?.toAmount||""),[ye,Ae]=l.useState(""),ve=Qe(me,U),[ge,he]=l.useState(),[Ie,be]=l.useState(""),[Ce,Pe]=l.useState(""),[_e,Fe]=l.useState(null),[Oe,De]=l.useState(""),[Ne,Ve]=l.useState(void 0),[Be,Ue]=l.useState(""),[Me,je]=l.useState([]),[$e,ze]=l.useState(!1),[He,Je]=l.useState(!1),[qe,Ke]=l.useState(!1);l.useEffect((()=>{if(0===T.length)return;if(!S)return;const e=T.filter((e=>e.balance.gt(0))).map((e=>({id:C(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedAmount:_(e.formattedBalance),formattedFiatAmount:0===G.conversions.size?F(""):O(e.formattedBalance,e.token.symbol||"",G.conversions)}})));je(e),ee.current||(ee.current=!0,t?.fromTokenAddress&&(de(r.find((e=>P(e.address)&&t?.fromTokenAddress?.toLowerCase()===R||e.address?.toLowerCase()===t?.fromTokenAddress?.toLowerCase()))),le(T.find((e=>P(e.token.address)&&t?.fromTokenAddress?.toLowerCase()===R||e.token.address?.toLowerCase()===t?.fromTokenAddress?.toLowerCase()))?.formattedBalance??"")),tt(t?.toTokenAddress,t?.fromTokenAddress)&&he(r.find((e=>P(e.address)&&t?.toTokenAddress?.toLowerCase()===R||e.address?.toLowerCase()===t?.toTokenAddress?.toLowerCase()))))}),[T,r,G.conversions,t?.fromTokenAddress,t?.toTokenAddress,ee.current,de,le,he,je,C,F,S]);const at=l.useMemo((()=>r.map((e=>({id:C(e.symbol,e.address),name:e.name,symbol:e.symbol,icon:e.icon})))),[r,ie]);l.useEffect((()=>{$({payload:{type:Se.SET_TOKEN_SYMBOLS,tokenSymbols:r.map((e=>e.symbol))}})}),[$,r]);const nt=()=>{se(""),ue(""),Ae(""),be("")},st=()=>{ot&&ot.cancel(),Y(""),Ue(""),Fe(null)},rt=e=>!Number.isNaN(parseFloat(oe))&&(!(parseFloat(oe)<=0)&&(!!ie&&(!!ge&&(!e||!q)))),it=async(e=!1)=>{rt(e)&&(ot&&ot.cancel(),e||K(!0),await(async(e=!1)=>{if(h&&c&&ie&&ge){try{e||Y("");const t=Re.fromAmountIn(c,h,ie,oe,ge),o=Re.fromAmountIn(c,h,ie,"1",ge),a=Ze.all([t,o]);ot=a;const n=await a,s=n[0],i=n[1];Q(i.quote.amount.value);const d=s.swap.gasFeeEstimate;let l=p.from(d?.value||0);s.approval?.gasFeeEstimate&&(l=l.add(s.approval.gasFeeEstimate.value));const u=B(l,j),m=d?.token,w=r.find((e=>e.address?.toLocaleLowerCase()===m?.address?.toLocaleLowerCase()));Fe(s),De(u),Ve({name:w?.name||"",symbol:w?.symbol||"",decimals:w?.decimals||0,address:w?.address,icon:w?.icon}),Ue(O(u,w?.symbol||"",G.conversions)),Te(F(_(B(s.quote.amount.value,s.quote.amount.token.decimals),s.quote.amount.token.decimals))),nt()}catch(e){e.cancelled||(st(),ze(!1),Je(!0))}e||K(!1)}})(e))},dt=e=>!Number.isNaN(parseFloat(me))&&(!(parseFloat(me)<=0)&&(!!ie&&(!!ge&&(!e||!q)))),ct=async(e=!1)=>{dt(e)&&(ot&&ot.cancel(),e||K(!0),await(async(e=!1)=>{if(h&&c&&ie&&ge){try{e||Y("");const t=Re.fromAmountOut(c,h,ge,me,ie),o=Re.fromAmountIn(c,h,ie,"1",ge),a=Ze.all([t,o]);ot=a;const n=await a,s=n[0],i=n[1];Q(i.quote.amount.value);const d=s.swap.gasFeeEstimate;let l=p.from(d?.value||0);s.approval?.gasFeeEstimate&&(l=l.add(s.approval.gasFeeEstimate.value));const u=B(l,j),m=d?.token,w=r.find((e=>e.symbol===m?.symbol));Fe(s),De(u),Ve({name:w?.name||"",symbol:w?.symbol||"",decimals:w?.decimals||0,address:w?.address,icon:w?.icon}),Ue(O(u,w?.symbol||"",G.conversions)),ae(F(_(B(s.quote.amount.value,s.quote.amount.token.decimals)))),nt()}catch(e){e.cancelled||(st(),ze(!1),Je(!0))}e||K(!1)}})(e))},lt=async(e=!1)=>{H===Ye.FROM?await it(e):await ct(e)};xe((()=>lt(!0)),W),l.useEffect((()=>{if(H===Ye.FROM){if(re<=0)return K(!1),void st();(async()=>{await lt()})()}}),[re,ie,ge]),l.useEffect((()=>{if(H===Ye.TO){if(ve<=0)return K(!1),void st();(async()=>{await lt()})()}}),[ve,ge,ie]);const pt=l.useMemo((()=>{const e=T.find((e=>e.token.address?.toLowerCase()===R));if(!e)return!0;const t=ie?.address?.toLowerCase()===R,o=D(0!==Oe.length?Oe:"0"),a=t&&!Number.isNaN(parseFloat(oe))?u(oe,ie?.decimals||18):p.from("0");return o.add(a).gt(e.balance)}),[Oe,T,ie,oe]);l.useEffect((()=>{oe&&ie&&Pe(O(oe,ie.symbol,G.conversions))}),[oe,ie]);const ut=l.useCallback((e=>{const t=T.find((t=>e===C(t.token.symbol,t.token.address)));t&&(ge&&e===C(ge.symbol,ge?.address)&&he(void 0),de(t.token),le(t.formattedBalance),ue(""))}),[ge]),mt=l.useCallback((e=>{const t=r.find((t=>e===C(t.symbol,t.address)));t&&(ie&&e===C(ie.symbol,ie?.address)&&de(void 0),he(t),be(""))}),[ie]);return l.useEffect((()=>{_e&&X&&Y(et({swapFromToken:ie,swapFromAmount:oe,swapToToken:ge,swapToAmount:me,conversion:X}).fromToConversion)}),[_e,X]),a(V,{children:[a(s,{sx:{paddingX:"base.spacing.x4",marginBottom:"base.spacing.x2"},children:[i(I,{size:"small",weight:"regular",sx:{paddingBottom:"base.spacing.x4"},children:n("views.SWAP.content.title")}),a(s,{sx:{display:"flex",flexDirection:"column",rowGap:"base.spacing.x6",paddingBottom:"base.spacing.x2"},children:[a(s,{children:[i(I,{size:"xSmall",sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:n("views.SWAP.swapForm.from.label")}),i(We,{testId:"fromTokenInputs",options:Me,selectSubtext:ie?`${n("views.SWAP.content.availableBalancePrefix")} ${_(ce)}`:"",selectTextAlign:"left",textInputType:"number",textInputValue:oe,textInputPlaceholder:n("views.SWAP.swapForm.from.inputPlaceholder"),textInputSubtext:`${n("views.SWAP.content.fiatPricePrefix")} \n $${F(Ce,!0)}`,textInputTextAlign:"right",textInputValidator:N,onTextInputChange:e=>{return t=e,nt(),st(),Te(""),rt(!1)&&K(!0),void ae(t);var t},onTextInputFocus:()=>{J(Ye.FROM)},textInputMaxButtonClick:()=>{if(!ce)return;const e=ce.slice(0,ce.indexOf(".")+M+1);nt(),st(),Te(""),J(Ye.FROM),ae(e),te({userJourney:y.SWAP,screen:"SwapCoins",control:"MaxFrom",controlType:"Button",extras:{fromBalance:ce,fromBalanceTruncated:e}})},onSelectChange:ut,textInputErrorMessage:n(ne),selectErrorMessage:n(pe),selectedOption:ie?C(ie.symbol,ie.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.from.selectorTitle"),defaultTokenImage:b})]}),a(s,{children:[a(s,{sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:[i(I,{size:"xSmall",children:n("views.SWAP.swapForm.to.label")}),i(d,{sx:{color:"base.color.brand.4"},size:"small",children:Z})]}),i(We,{testId:"toTokenInputs",options:at,selectTextAlign:"left",textInputType:"number",textInputValue:me,textInputPlaceholder:n("views.SWAP.swapForm.to.inputPlaceholder"),textInputTextAlign:"right",textInputValidator:N,onTextInputChange:e=>{return t=e,nt(),st(),Pe(""),ae(""),dt(!1)&&K(!0),void Te(t);var t},onTextInputFocus:()=>{J(Ye.TO)},onSelectChange:mt,textInputErrorMessage:n(ye),selectErrorMessage:n(Ie),selectedOption:ge?C(ge.symbol,ge.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.to.selectorTitle"),defaultTokenImage:b})]})]}),i(we,{gasFeeFiatValue:Be,gasFeeToken:Ne,gasFeeValue:Oe,fees:[{label:n("drawers.feesBreakdown.fees.gasFeeSwap.label"),fiatAmount:`~ ${n("drawers.feesBreakdown.fees.fiatPricePrefix")}${Be}`,amount:_(Oe),prefix:"~"}],onFeesClick:()=>{te({userJourney:y.SWAP,screen:"SwapCoins",control:"ViewFees",controlType:"Button"})},sx:{paddingBottom:"0"},loading:q})]}),i(Le,{validator:()=>{const e=function(e){return e?"":"views.SWAP.validation.noFromTokenSelected"}(ie),t=(a=ce,(o=oe)&&0!==parseFloat(o)?a&&Number(o)>Number(a)?"views.SWAP.validation.insufficientBalance":"":"views.SWAP.validation.noAmountInputted");var o,a;const n=function(e){return e?"":"views.SWAP.validation.noToTokenSelected"}(ge),s=function(e){return e&&0!==parseFloat(e)?"":"views.SWAP.validation.noAmountInputted"}(me);H===Ye.FROM?(Ae(""),t&&se(t)):H===Ye.TO&&(se(""),s&&Ae(s)),e&&ue(e),n&&be(n);let r=!0;return(e||n||t&&H===Ye.FROM||s&&H===Ye.TO)&&(r=!1),te({userJourney:y.SWAP,screen:"SwapCoins",control:"FormValid",controlType:"Button",extras:{isSwapFormValid:r,swapFromAddress:ie?.address,swapFromAmount:oe,swapFromTokenSymbol:ie?.symbol,swapToAddress:ge?.address,swapToAmount:me,swapToTokenSymbol:ge?.symbol}}),r},updateLoading:e=>{K(e)},loading:q,transaction:_e,data:{fromAmount:oe,toAmount:me,fromTokenSymbol:ie?.symbol,fromTokenAddress:ie?.address,toTokenSymbol:ge?.symbol,toTokenAddress:ge?.address},insufficientFundsForGas:pt,openNotEnoughImxDrawer:()=>{Je(!1),ze(!0)},openNetworkSwitchDrawer:()=>Ke(!0)}),i(Ge,{environment:x?.config.environment??L.PRODUCTION,visible:$e,showAdjustAmount:ie?.address===R,hasZeroImx:!1,onAddCoinsClick:()=>{z({payload:{type:E.UPDATE_VIEW,view:{type:v.TOP_UP_VIEW},currentViewData:{fromTokenAddress:ie?.address??"",fromAmount:oe,toTokenAddress:ge?.address??""}}})},onCloseDrawer:()=>ze(!1)}),i(Xe,{visible:He,onCloseDrawer:()=>{Je(!1),de(void 0),ae(""),he(void 0),Te("")}}),i(fe,{visible:qe,targetChainId:A(x?.config),provider:h,checkout:x,onCloseDrawer:()=>Ke(!1)})]})}const nt=(e,t)=>{if(0===e.length)return!0;let o=!1;return e.forEach((e=>{e.token.symbol===t&&e.balance.eq(0)&&(o=!0)})),o};function st({theme:t,fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d}){const{t:c}=e(),{viewDispatch:p}=l.useContext(m),{eventTargetState:{eventTarget:u}}=l.useContext(G),{swapState:{tokenBalances:T}}=l.useContext(ke),{connectLoaderState:{checkout:A}}=l.useContext(w),[S,g]=l.useState(!1),{page:x}=f();return l.useEffect((()=>{x({userJourney:y.SWAP,screen:"SwapCoins",extras:{fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d}})}),[]),l.useEffect((()=>{nt(T,J)&&g(!0)}),[T]),i(H,{header:i($,{title:c("views.SWAP.header.title"),onCloseButtonClick:()=>z(u)}),footer:i(Ie,{environment:A?.config.environment,theme:t}),children:a(s,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[i(at,{data:{fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d},theme:t}),i(Ge,{environment:A?.config.environment??L.PRODUCTION,visible:S,showAdjustAmount:!1,hasZeroImx:!0,onAddCoinsClick:()=>{p({payload:{type:E.UPDATE_VIEW,view:{type:v.TOP_UP_VIEW}}})},onCloseDrawer:()=>{g(!1)}})]})})}function rt({transactionResponse:t,swapForm:o}){const{t:a}=e(),{viewDispatch:n}=l.useContext(m),{page:s}=f();return l.useEffect((()=>{s({userJourney:y.SWAP,screen:"SwapInProgress",extras:{swapFormInfo:o}})}),[]),l.useEffect((()=>{(async()=>{try{const e=await t.wait();if(1===e.status)return void n({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SUCCESS,data:{fromTokenAddress:o.fromTokenAddress,fromAmount:o.fromAmount,toTokenAddress:o.toTokenAddress,toAmount:o.toAmount||"",transactionHash:e.transactionHash}}}});n({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,data:o,reason:"Transaction failed"}}})}catch{n({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,data:o,reason:"Transaction failed"}}})}})()}),[t]),i(q,{loadingText:a("views.SWAP.IN_PROGRESS.loading.text")})}function it({data:t}){const{t:o}=e(),{swapState:{allowedTokens:n}}=l.useContext(ke),{connectLoaderState:r}=l.useContext(w),{checkout:d,provider:c}=r,{viewDispatch:p}=l.useContext(m),{eventTargetState:{eventTarget:u}}=l.useContext(G),T=K(c),[A,g]=l.useState(!1),[x,h]=l.useState(!1),[I,b]=l.useState(!1),[C,k]=l.useState(!1),[P,R]=l.useState(!1),[_,F]=l.useState(!1),{page:O,track:W}=f();l.useEffect((()=>{O({userJourney:y.SWAP,screen:"ApproveERC20",extras:{swapFormInfo:t.swapFormInfo}})}),[]);const D=l.useMemo((()=>n.find((e=>e.address===t.swapFormInfo.fromTokenAddress))),[n,t.swapFormInfo.fromTokenAddress]),N=l.useCallback((()=>{p({payload:{type:E.UPDATE_VIEW,view:{type:v.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[p]),L=l.useCallback((()=>{p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SWAP,data:t.swapFormInfo}}})}),[p]),B=(e,t)=>{e.type!==S.UNPREDICTABLE_GAS_LIMIT?e.type===S.TRANSACTION_FAILED||e.type===S.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,reason:"Transaction failed",data:t}}}):p({payload:{type:E.UPDATE_VIEW,view:{type:v.ERROR_VIEW,error:e}}}):p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.PRICE_SURGE,data:t}}})},U=l.useCallback((async()=>{if(!C)if(W({userJourney:y.SWAP,screen:"ApproveERC20",control:"ApproveSpending",controlType:"Button"}),k(!0),d&&c){if(!A){g(!0);try{const e=await d.sendTransaction({provider:c,transaction:t.approveTransaction});h(!0);if(1!==(await e.transactionResponse.wait()).status)return void p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.FAIL,data:t.swapFormInfo}}});h(!1),g(!1),b(!0)}catch(e){if(h(!1),g(!1),e.type===S.USER_REJECTED_REQUEST_ERROR)return void R(!0);B(e,t.swapFormInfo)}finally{k(!1)}}}else N()}),[d,c,N,p,F,t.approveTransaction,t.swapFormInfo,A,g,h]),M=l.useMemo((()=>a(X,{heading:o(`views.APPROVE_ERC20.approveSpending.content.${T?"passport":"metamask"}.heading`),children:[T&&i(s,{children:o("views.APPROVE_ERC20.approveSpending.content.passport.body")}),!T&&i(s,{children:o("views.APPROVE_ERC20.approveSpending.content.metamask.body",{amount:`${t.swapFormInfo.fromAmount} ${D?.symbol||""}`})})]})),[t.swapFormInfo,D,T]),j=l.useMemo((()=>i(Q,{loading:C,actionText:o(P?"views.APPROVE_ERC20.approveSpending.footer.retryText":"views.APPROVE_ERC20.approveSpending.footer.buttonText"),onActionClick:U})),[P,U,C]),J=l.useCallback((async()=>{if(!C)if(W({userJourney:y.SWAP,screen:"ApproveERC20",control:"ApproveSwap",controlType:"Button"}),k(!0),d&&c){if(!A){g(!0);try{const e=await d.sendTransaction({provider:c,transaction:t.transaction});g(!1),p({payload:{type:E.UPDATE_VIEW,view:{type:Ae.IN_PROGRESS,data:{transactionResponse:e.transactionResponse,swapForm:t.swapFormInfo}}}})}catch(e){if(g(!1),e.type===S.USER_REJECTED_REQUEST_ERROR)return void F(!0);B(e,t.swapFormInfo)}finally{k(!1)}}}else N()}),[d,c,N,p,F,t.transaction,t.swapFormInfo,A,g]),Z=i(X,{heading:o("views.APPROVE_ERC20.approveSwap.content.heading"),children:i(s,{children:o("views.APPROVE_ERC20.approveSwap.content.body")})}),Y=l.useMemo((()=>i(Q,{loading:C,actionText:o(_?"views.APPROVE_ERC20.approveSwap.footer.retryText":"views.APPROVE_ERC20.approveSwap.footer.buttonText"),onActionClick:J})),[_,J,C]);return a(V,{children:[x&&i(q,{loadingText:o("views.APPROVE_ERC20.approveSpending.loading.text")}),!x&&i(H,{header:i($,{transparent:!0,showBack:!0,onCloseButtonClick:()=>z(u),onBackButtonClick:L}),floatHeader:!0,heroContent:i(I?Te:he,{}),footer:I?Y:j,children:I?Z:M})]})}function dt({amount:t,fromTokenAddress:o,toTokenAddress:n,config:s}){const{t:r}=e(),{eventTargetState:{eventTarget:d}}=l.useContext(G),{environment:c,theme:p,isOnRampEnabled:u,isSwapEnabled:T,isBridgeEnabled:S}=s,{connectLoaderState:{checkout:g,provider:x}}=l.useContext(w),[h,I]=l.useReducer(Z,{...Y,history:[]}),[b,C]=l.useReducer(Pe,be),{page:k}=f(),[P,R]=l.useState(!1),_=l.useMemo((()=>({swapState:b,swapDispatch:C})),[b,C]),F=l.useMemo((()=>({viewState:h,viewDispatch:I})),[h,I]),O=l.useCallback(((e,t)=>{I({payload:{type:E.UPDATE_VIEW,view:{type:v.ERROR_VIEW,tryAgain:t,error:e}}})}),[I]),W=l.useCallback((()=>{I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SWAP}}})}),[I]),D=l.useCallback((async()=>{if(!g)throw new Error("loadBalances: missing checkout");if(!x)throw new Error("loadBalances: missing provider");try{const e=await ye({checkout:g,provider:x,allowTokenListType:ee.SWAP});if(void 0===e)return!1;C({payload:{type:Ce.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}}),C({payload:{type:Ce.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}})}catch(e){if(te.nonRetryable(e))return O(e,D),!1}return!0}),[g,x]);return l.useEffect((()=>{(async()=>{if(!g||!x)return;const e=await g.getNetworkInfo({provider:x});if(e.chainId!==A(g.config))return;let t;try{t=await g.config.remote.getConfig("dex")}catch(e){return void O(e)}const o=new oe({chainId:e.chainId,baseConfig:new ae({environment:c}),secondaryFees:t.secondaryFees,overrides:t.overrides});C({payload:{type:Ce.SET_EXCHANGE,exchange:o}}),C({payload:{type:Ce.SET_NETWORK,network:e}}),await D()&&h.view.type===v.LOADING_VIEW&&W()})()}),[g,x]),i(m.Provider,{value:F,children:i(ke.Provider,{value:_,children:a(ge,{environment:c,children:[h.view.type===v.LOADING_VIEW&&i(q,{loadingText:r("views.LOADING_VIEW.text")}),h.view.type===Ae.SWAP&&i(st,{theme:p,fromAmount:h.view.data?.fromAmount??t,fromTokenAddress:h.view.data?.fromTokenAddress??o,toTokenAddress:h.view.data?.toTokenAddress??n}),h.view.type===Ae.IN_PROGRESS&&i(rt,{transactionResponse:h.view.data.transactionResponse,swapForm:h.view.data.swapForm}),h.view.type===Ae.APPROVE_ERC20&&i(it,{data:h.view.data}),h.view.type===Ae.SUCCESS&&i(ne,{statusText:r("views.SWAP.success.text"),actionText:r("views.SWAP.success.actionText"),onRenderEvent:()=>{k({userJourney:y.SWAP,screen:"SwapSuccess",extras:{fromTokenAddress:h.view.data?.fromTokenAddress,fromAmount:h.view.data?.fromAmount,toTokenAddress:h.view.data?.toTokenAddress,toAmount:h.view.data?.toAmount}}),se(d,h.view.data.transactionHash)},onActionClick:()=>z(d),statusType:re.SUCCESS,testId:"success-view"}),h.view.type===Ae.FAIL&&i(ne,{statusText:r("views.SWAP.failed.text"),actionText:r("views.SWAP.failed.actionText"),onRenderEvent:()=>{k({userJourney:y.SWAP,screen:"SwapFailed"}),ie(d,"Transaction failed")},onActionClick:()=>{h.view.type===Ae.FAIL&&I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SWAP,data:h.view.data}}})},statusType:re.FAILURE,onCloseClick:()=>z(d),testId:"fail-view"}),h.view.type===Ae.PRICE_SURGE&&i(ne,{statusText:r("views.SWAP.rejected.text"),actionText:r("views.SWAP.rejected.actionText"),onRenderEvent:()=>{k({userJourney:y.SWAP,screen:"PriceSurge"}),de(d,"Price surge")},onActionClick:()=>{h.view.type===Ae.PRICE_SURGE&&I({payload:{type:E.UPDATE_VIEW,view:{type:Ae.SWAP,data:h.view.data}}})},statusType:re.WARNING,onCloseClick:()=>z(d),testId:"price-surge-view"}),h.view.type===v.ERROR_VIEW&&i(ce,{actionText:r("views.ERROR_VIEW.actionText"),onActionClick:async()=>{R(!0);const e=h.view;if(!e.tryAgain)return W(),void R(!1);await e.tryAgain()&&W(),R(!1)},onCloseClick:()=>z(d),errorEventActionLoading:P}),h.view.type===v.TOP_UP_VIEW&&i(ve,{analytics:{userJourney:y.SWAP},checkout:g,provider:x,widgetEvent:le.IMTBL_SWAP_WIDGET_EVENT,showOnrampOption:u,showSwapOption:T,showBridgeOption:S,onCloseButtonClick:()=>z(d)})]})})})}export{dt as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,ae as e,
|
|
1
|
+
import{r as t,ae as e,bt as n,a as o,aZ as s,j as i,M as a,B as r,u as c,V as d,E,e as l,bT as p,z as u,G as S,H as _,J as f,I as C,d as I,o as T}from"./index-81d38420.js";var h;!function(t){t.USD="usd"}(h||(h={}));const A={cryptoFiat:null,fiatSymbol:h.USD,tokenSymbols:[],conversions:new Map};var O;!function(t){t.SET_CRYPTO_FIAT="SET_CRYPTO_FIAT",t.SET_FIAT_SYMBOL="SET_FIAT_SYMBOL",t.SET_TOKEN_SYMBOLS="SET_TOKEN_SYMBOLS",t.SET_CONVERSIONS="SET_CONVERSIONS"}(O||(O={}));const v=t.createContext({cryptoFiatState:A,cryptoFiatDispatch:()=>{}}),R=(t,e)=>{switch(e.payload.type){case O.SET_CRYPTO_FIAT:return{...t,cryptoFiat:e.payload.cryptoFiat};case O.SET_FIAT_SYMBOL:return{...t,fiatSymbol:e.payload.fiatSymbol};case O.SET_TOKEN_SYMBOLS:return{...t,tokenSymbols:e.payload.tokenSymbols};case O.SET_CONVERSIONS:return{...t,conversions:e.payload.conversions};default:return t}};var y;!function(t){t.SWAP="SWAP",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL",t.PRICE_SURGE="PRICE_SURGE",t.APPROVE_ERC20="APPROVE_ERC20_SWAP"}(y||(y={}));class m{baseConfig;constructor({baseConfig:t}){this.baseConfig=t}}const w={[e.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[e.PRODUCTION]:"https://checkout-api.immutable.com"};class g{coinsCache;overridesCache;config;constructor(t){this.coinsCache=null,this.overridesCache=null,this.config=t.baseConfig}urlWithPath(t){return w[this.config.environment]+t}async fetchOverrides(){if(null!==this.overridesCache)return;const t=this.urlWithPath("/v1/fiat/coins/overrides"),e=await n.get(t);if(200!==e.status)throw new Error(`Error fetching coins overrides: ${e.status} ${e.statusText}`);this.overridesCache=new Map(Object.entries(e.data))}async fetchCoins(){if(null!==this.coinsCache)return;await this.fetchOverrides();const t=this.urlWithPath("/v1/fiat/coins/all"),e=await n.get(t);if(200!==e.status)throw new Error(`Error fetching coins list: ${e.status} ${e.statusText}`);const{data:o}=e;this.coinsCache=new Map;for(const t of o){const e=this.overridesCache.get(t.symbol.toLowerCase());this.coinsCache.set(t.symbol.toLowerCase(),e||t.id.toLowerCase())}}async convert({tokenSymbols:t,fiatSymbols:e=[]}){if(!t||0===t.length)throw new Error("Error missing token symbols to convert");const o=e.filter((t=>""!==t));0===o.length&&o.push("usd"),await this.fetchCoins();const s=t.map((t=>this.coinsCache.get(t.toLowerCase()))).filter((t=>""!==t&&void 0!==t)).join(","),i=o.join(",").toLowerCase(),a=this.urlWithPath(`/v1/fiat/conversion?ids=${s}¤cies=${i}`),r=await n.get(a);if(200!==r.status)throw new Error(`Error fetching prices: ${r.status} ${r.statusText}`);const{data:c}=r,d={};for(const e of t){const t=e.toLowerCase(),n=this.coinsCache.get(t);d[t]={},n&&(d[t]=c[n]||{})}return d}}const b=async(t,e,n)=>{try{if(0===n.length)return new Map;return((t,e)=>{const n=new Map;for(const o in t){const s=t[o][e];void 0!==s&&n.set(o,s)}return n})(await t.convert({tokenSymbols:n,fiatSymbol:e}),e)}catch(t){return new Map}},P=["ETH","IMX"];function L({environment:e,children:n}){const[s,i]=t.useReducer(R,A),{cryptoFiat:a,fiatSymbol:r,tokenSymbols:c}=s;return t.useEffect((()=>{i({payload:{type:O.SET_CRYPTO_FIAT,cryptoFiat:new g(new m({baseConfig:{environment:e}}))}})}),[]),t.useEffect((()=>{a&&r&&(async()=>{const t=await b(a,r,[...new Set([...c,...P])]);i({payload:{type:O.SET_CONVERSIONS,conversions:t}})})()}),[a,c,r]),o(v.Provider,{value:{cryptoFiatState:s,cryptoFiatDispatch:i},children:n})}var N;!function(t){t.WALLET_NETWORK_SELECTION="WALLET_NETWORK_SELECTION",t.BRIDGE_FORM="BRIDGE_FORM",t.BRIDGE_REVIEW="BRIDGE_REVIEW",t.IN_PROGRESS="IN_PROGRESS",t.BRIDGE_FAILURE="BRIDGE_FAILURE",t.APPROVE_TRANSACTION="APPROVE_TRANSACTION",t.TRANSACTIONS="TRANSACTIONS",t.CLAIM_WITHDRAWAL="CLAIM_WITHDRAWAL",t.CLAIM_WITHDRAWAL_IN_PROGRESS="CLAIM_WITHDRAWAL_IN_PROGRESS",t.CLAIM_WITHDRAWAL_SUCCESS="CLAIM_WITHDRAWAL_SUCCESS",t.CLAIM_WITHDRAWAL_FAILURE="CLAIM_WITHDRAWAL_FAILURE"}(N||(N={}));const W=(t,e)=>{const{fees:n,token:o}=t;if(void 0===n.totalFees)return"-.--";if(void 0===o)return"-.--";const i=((t,e,n)=>{let o=-1;if(t&&e){const i=s(t,e.decimals),a=n.get(e.symbol.toLocaleLowerCase());if(a){const t=parseFloat(i);if(Number.isNaN(t))return o;o=t*a}}return o})(n.totalFees,o,e);return i<0?"-.--":function(t){if(t<0)return"-.--";const e=t.toString();if(e.includes("e")||0===t)return"0.00";if(t<.01)for(let n=0;n<e.length;n++)if("0"!==e[n]&&"."!==e[n])return t.toFixed(n-1);return t.toFixed(2)}(i)};var F;function k({testId:t,icon:e,heading:n,caption:s,onClick:c,renderFeeFunction:d,isDisabled:E}){return o(r,{testId:"top-up-view",sx:{paddingY:"1px"},children:i(a,{testId:`menu-item-${t}`,size:"medium",emphasized:!0,onClick:E?void 0:c,sx:E?{opacity:"0.5",cursor:"not-allowed"}:{},children:[o(a.Icon,{icon:e}),o(a.Label,{size:"medium",children:n}),o(a.IntentIcon,{}),i(a.Caption,{testId:`menu-item-caption-${t}`,children:[s,o("br",{}),E?"":d("-.--",!1)]})]})})}function U({widgetEvent:e,checkout:n,provider:s,showOnrampOption:a,showSwapOption:h,showBridgeOption:A,tokenAddress:R,amount:m,analytics:w,onCloseButtonClick:g,onBackButtonClick:b}){const{t:L}=c(),{userJourney:U}=w,{viewDispatch:B}=t.useContext(d),{cryptoFiatState:D,cryptoFiatDispatch:M}=t.useContext(v),{conversions:x,fiatSymbol:G}=D,{eventTargetState:{eventTarget:$}}=t.useContext(E),[V,K]=t.useState("-.--"),[Y,H]=t.useState("-.--"),[z,j]=t.useState(!0),{page:J,track:q}=l();t.useEffect((()=>{J({userJourney:U,screen:"TopUp"})}),[]),t.useEffect((()=>{M&&M({payload:{type:O.SET_TOKEN_SYMBOLS,tokenSymbols:P}})}),[M]),t.useEffect((()=>{n&&(async()=>{const t=await n.gasEstimate({gasEstimateType:p.BRIDGE_TO_L2}),e=await W(t,x);H(e)})()}),[void 0!==n]),t.useEffect((()=>{n&&(async()=>{const t=(t=>{const{minPercentage:e,maxPercentage:n}=t;return void 0===e||void 0===n?"-.--":`${e}% to ${n}`})(await n.getExchangeFeeEstimate());K(t)})()}),[void 0!==n]),t.useEffect((()=>{n&&(async()=>{j(await n.isSwapAvailable())})()}),[void 0!==n]);const X=(t,e,n="Button")=>{q({userJourney:U,screen:"TopUp",control:t,controlType:n,extras:e})},Z=t=>o(r,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:t}),Q=[{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.onramp",onClickEvent:()=>{if(e===C.IMTBL_ONRAMP_WIDGET_EVENT){const t={tokenAddress:"",amount:""};return B({payload:{type:I.UPDATE_VIEW,view:{type:F.ONRAMP,data:t}}}),void X("OnRamp",{...t,widgetEvent:e})}const t={tokenAddress:R??"",amount:m??""};T.sendRequestOnrampEvent($,e,t),X("OnRamp",{...t,widgetEvent:e})},fee:()=>Z(`${L("views.TOP_UP_VIEW.topUpOptions.onramp.subcaption")} ≈ ${V}%`),isAvailable:!0,isEnabled:a},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(e===C.IMTBL_SWAP_WIDGET_EVENT){const t={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return B({payload:{type:I.UPDATE_VIEW,view:{type:y.SWAP,data:t}}}),void X("Swap",{...t,widgetEvent:e})}const t={fromTokenAddress:"",toTokenAddress:R??"",amount:""};T.sendRequestSwapEvent($,e,t),X("Swap",{...t,widgetEvent:e})},fee:()=>Z(`${L("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${G.toUpperCase()}`),isAvailable:z,isEnabled:h},{testId:"bridge",icon:"Minting",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(e===C.IMTBL_BRIDGE_WIDGET_EVENT){const t={fromTokenAddress:"",fromAmount:""};return B({payload:{type:I.UPDATE_VIEW,view:{type:N.WALLET_NETWORK_SELECTION,data:t}}}),void X("Bridge",{...t,widgetEvent:e})}const t={tokenAddress:"",amount:""};T.sendRequestBridgeEvent($,e,t),X("Bridge",{...t,widgetEvent:e})},fee:()=>Z(`${L("views.TOP_UP_VIEW.topUpOptions.bridge.subcaption")} ≈ $${Y} ${G.toUpperCase()}`),isAvailable:!0,isEnabled:A}];return o(f,{header:o(u,{onBackButtonClick:b,onCloseButtonClick:g,showBack:!0}),footer:o(S,{}),children:i(r,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[o(_,{size:"small",children:L("views.TOP_UP_VIEW.header.title")}),o(r,{sx:{paddingY:"base.spacing.x4"},children:Q.sort(((t,e)=>Number(e.isAvailable)-Number(t.isAvailable))).map((t=>t.isEnabled&&o(k,{testId:t.testId,icon:t.icon,heading:L(`${t.textConfigKey}.heading`),caption:t.isAvailable?L(`${t.textConfigKey}.caption`):L(`${t.textConfigKey}.disabledCaption`),onClick:t.onClickEvent,renderFeeFunction:t.fee,isDisabled:!t.isAvailable},L(`${t.textConfigKey}.heading`).toLowerCase())))})]})})}!function(t){t.ONRAMP="ONRAMP",t.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL"}(F||(F={}));export{N as B,v as C,F as O,y as S,U as T,O as a,L as b};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,T as t,u as n,V as a,j as o,B as s,a as i,b as r,c as l,d as c,C as d,e as p,f as u,E as h,i as L,g as C,h as k,k as f,M as w,H as b,t as E,U as m,o as T,I as g,Z as y,l as S,s as x,m as I,S as A,N as v,n as _,p as N,q as B,v as O,D as W,w as M,x as D,y as F,z as R,A as P,F as Z,G as U,J as V,K as j,L as z,O as G,P as $,Q as J,R as K,W as H,X,Y,_ as q,$ as Q,a0 as ee,a1 as te}from"./index-942188f0.js";import{C as ne,a as ae,b as oe,T as se}from"./TopUpView-356013a4.js";import{H as ie}from"./HorizontalMenu-actual-23a2719d.js";import{r as re,u as le}from"./retry-3f674dd7.js";const ce={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var de;!function(e){e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_SUPPORTED_TOP_UPS="SUPPORTED_TOP_UPS"}(de||(de={}));const pe=e.createContext({walletState:ce,walletDispatch:()=>{}});pe.displayName="WalletContext";const ue=(e,t)=>{switch(t.payload.type){case de.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case de.SET_NETWORK:return{...e,network:t.payload.network};case de.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case de.SET_SUPPORTED_TOP_UPS:return{...e,supportedTopUps:{isSwapEnabled:t.payload.supportedTopUps.isSwapEnabled??!0,isOnRampEnabled:t.payload.supportedTopUps.isOnRampEnabled??!0,isBridgeEnabled:t.payload.supportedTopUps.isBridgeEnabled??!0,isSwapAvailable:t.payload.supportedTopUps.isSwapAvailable??!0}};default:return e}},he=async(e,n)=>{const a=await e.getTokenAllowList({type:t.ALL,chainId:n}),o=new Set;return a.tokens.forEach((e=>{o.add(e.symbol)})),Array.from(o)},Le={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},Ce={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},ke={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var fe;function we(t){const{t:d}=n(),{viewDispatch:p}=e.useContext(a),{totalBalance:u,loading:h}=t;return o(s,{sx:Le,children:[o(s,{sx:Ce,children:[i(r,{size:"medium",children:d("views.WALLET_BALANCES.totalTokenBalance.heading")}),i(s,{sx:{pl:"base.spacing.x1"},children:i(l,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:ke,onClick:()=>p({payload:{type:c.UPDATE_VIEW,view:{type:fe.COIN_INFO}}})})})]}),o(s,{sx:Ce,children:[i(r,{testId:"total-token-balance-value",weight:"bold",shimmer:h?1:0,shimmerSx:{minw:"100px"},children:d("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!h&&o(r,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",u.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(fe||(fe={}));const be=e=>({display:e?"":"none"});function Ee({balanceInfo:n,theme:a,bridgeToL2OnClick:s}){const{connectLoaderState:r}=e.useContext(d),{track:l}=p(),{checkout:c,provider:y}=r,S=`≈ USD $${u(n.fiatAmount)}`,{walletState:x}=e.useContext(pe),{supportedTopUps:I,network:A}=x,[v,_]=e.useState(),[N,B]=e.useState(),[O,W]=e.useState(),{eventTargetState:{eventTarget:M}}=e.useContext(h),[D,F]=e.useState([]),R=L(y);e.useEffect((()=>{(async()=>{if(!c)return;const e=await c.getTokenAllowList({type:t.ONRAMP,chainId:C(c.config)});F(e.tokens)})()}),[c]),e.useEffect((()=>{if(!A||!I||!c)return;const e=A.chainId===C(c.config)&&(I?.isOnRampEnabled??!0);_(e);const t=(A.chainId===k(c.config)||A.chainId===C(c.config))&&(I?.isBridgeEnabled??!0);B(t);const n=A.chainId===C(c.config)&&(I?.isSwapEnabled??!0)&&(I?.isSwapAvailable??!0);W(n)}),[A,I,c,R]);const P=e.useMemo((()=>Boolean(v&&D.length>0&&D.find((e=>e.address?.toLowerCase()===n.address?.toLowerCase())))),[v,D]);return o(w,{testId:`balance-item-${n.symbol}`,emphasized:!0,children:[i(w.FramedImage,{imageUrl:n.icon,defaultImageUrl:f(c?.config.environment,a),circularFrame:!0}),i(w.Label,{children:n.symbol}),i(w.Caption,{children:n.description}),i(w.PriceDisplay,{testId:`balance-item-${n.symbol}`,use:i(b,{size:"xSmall"}),price:E(n.balance),fiatAmount:S}),(v||O||N)&&o(w.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}})},children:[o(w,{testId:"balance-item-add-option",sx:be(P),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),T.sendRequestOnrampEvent(M,g.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:n.address??"",amount:""})},children:[i(w.Icon,{icon:"Add"}),i(w.Label,{children:`Add ${n.symbol}`})]}),o(w,{testId:"balance-item-swap-option",sx:be(O),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),T.sendRequestSwapEvent(M,g.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:n.address??"",toTokenAddress:"",amount:""})},children:[i(w.Icon,{icon:"Exchange"}),i(w.Label,{children:`Swap ${n.symbol}`})]}),o(w,{testId:"balance-item-move-option",sx:be(N),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),s(n.address)},children:[i(w.Icon,{icon:"Minting"}),i(w.Label,{children:`Move ${n.symbol}`})]})]})]})}const me={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},Te={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},ge=e=>e.filter((e=>e.balance!==y||S(e.address)));function ye({balanceInfoItems:e,theme:t,bridgeToL2OnClick:a}){const{t:l}=n(),c=ge(e);return o(s,{sx:me,children:[0===c.length&&i(s,{sx:Te,children:i(r,{testId:"no-tokens-found",children:l("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),c.map((e=>i(Ee,{balanceInfo:e,bridgeToL2OnClick:a,theme:t},e.id)))]})}const Se={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},xe={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},Ie={fontWeight:"base.text.caption.small.bold.fontWeight"},Ae=(e,t)=>({paddingRight:"base.spacing.x1",width:"22px",fill:t?e:"base.color.brand.4"}),ve={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function _e(){const{t:t}=n(),{connectLoaderState:l}=e.useContext(d),{eventTargetState:{eventTarget:u}}=e.useContext(h),{checkout:L,provider:C}=l,{viewDispatch:k}=e.useContext(a),{walletState:f,walletDispatch:w}=e.useContext(pe),{network:b}=f,[E,T]=e.useState([]),{track:g}=p(),y=e.useCallback((async e=>{if(L&&C&&b&&b.chainId!==e){g({userJourney:m.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await L.switchNetwork({provider:C,chainId:e});x(u,t.provider,t.network)}catch(e){e.type===I.USER_REJECTED_REQUEST_ERROR||k({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}}}),[L,C,b,w,k]);return e.useEffect((()=>{(async()=>{if(L){const e=await L.getNetworkAllowList({type:v.ALL});T(e?.networks??[])}else T([])})()}),[L]),o(s,{testId:"network-menu",sx:Se,children:[i(r,{testId:"network-heading",size:"medium",sx:ve,children:t("views.WALLET_BALANCES.networkStatus.heading")}),i(ie,{children:L&&E?.sort(((e,t)=>_(e,t,L.config))).map((e=>o(ie.Button,{testId:`${e.name}-network-button`,sx:e.chainId===b?.chainId?xe:Ie,size:"small",onClick:()=>y(e.chainId),children:[i(N.Icon,{icon:B[e.chainId],iconVariant:"bold",sx:Ae(O[e.chainId],e.chainId===b?.chainId)}),e.name]},e.chainId)))})]})}const Ne={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},Be={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},Oe={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},We=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},Me=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,De=(e,t,n)=>t.map((t=>({id:Me(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:F(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function Fe({balancesLoading:t,theme:r,showNetworkMenu:u}){const{t:k}=n(),{connectLoaderState:f}=e.useContext(d),{checkout:b,provider:E}=f,{cryptoFiatState:y,cryptoFiatDispatch:S}=e.useContext(ne),{walletState:x}=e.useContext(pe),{eventTargetState:{eventTarget:I}}=e.useContext(h),{viewDispatch:v}=e.useContext(a),[_,N]=e.useState(0),{network:B,supportedTopUps:O,tokenBalances:W}=x,{conversions:M}=y,D=!L(E)&&u,{track:F,page:j}=p(),z=e.useMemo((()=>De(B?.chainId,W,M)),[W,M,B?.chainId]);e.useEffect((()=>{j({userJourney:m.WALLET,screen:"WalletBalances"})}),[]),e.useEffect((()=>{(async()=>{if(!b)return;if(!S)return;if(!B)return;const e=await he(b,B.chainId);S({payload:{type:ae.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[b,S,B?.chainId]),e.useEffect((()=>{let e=0;z.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),N(e)}),[z]);const G=e.useMemo((()=>!(!b||!B)&&(B.chainId===C(b.config)&&Boolean(O?.isBridgeEnabled||O?.isSwapEnabled||O?.isOnRampEnabled))),[b,B,O]);return i(V,{testId:"wallet-balances",header:i(R,{title:k("views.WALLET_BALANCES.header.title"),rightActions:i(l,{icon:"SettingsCog",sx:P(),iconVariant:"bold",onClick:()=>{F({userJourney:m.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),v({payload:{type:c.UPDATE_VIEW,view:{type:fe.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>Z(I)}),footer:i(U,{}),children:o(s,{sx:Ne,children:[o(s,{sx:Be,children:[D&&i(_e,{}),i(we,{totalBalance:_,loading:t}),o(s,{sx:We(D,G),children:[t&&o(s,{sx:Oe,children:[i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!t&&i(ye,{balanceInfoItems:z,bridgeToL2OnClick:e=>{T.sendRequestBridgeEvent(I,g.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:r})]})]}),G&&o(w,{testId:"add-coins",emphasized:!0,onClick:()=>{F({userJourney:m.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),v({payload:{type:c.UPDATE_VIEW,view:{type:A.TOP_UP_VIEW}}})},children:[i(w.FramedIcon,{icon:"Add"}),i(w.Label,{children:k("views.WALLET_BALANCES.addCoins")})]})]})})}const Re={width:"100%",height:"88px",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"24px 11px 24px 32px",backgroundColor:"base.color.translucent.emphasis.400",borderRadius:"base.borderRadius.x6"},Pe={width:"100%",display:"flex"},Ze={width:"318px",display:"flex",flexDirection:"column"},Ue={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Ve={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"};function je({textToCopy:t}){const[n,a]=e.useState(!1),{track:o}=p();return i(s,{children:t&&i(s,{sx:{cursor:"pointer"},children:i(l,{sx:n?Ve:{},onClick:()=>{null!=t&&(o({userJourney:m.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(t)),a(!0),setTimeout((()=>{a(!1)}),3e3)},size:"small",icon:n?"Tick":"CopyText"})})})}function ze({provider:t}){const[n,a]=e.useState("");return e.useEffect((()=>{t&&(async()=>{const e=await t.getSigner().getAddress();a(e)})()}),[t]),i(s,{sx:Re,children:o(s,{sx:Pe,children:[o(s,{sx:Ze,children:[i(b,{size:"xSmall",children:"Wallet address"}),i(r,{testId:"wallet-address",size:"xSmall",sx:Ue,children:n})]}),i(je,{textToCopy:n})]})})}const Ge={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},$e={marginTop:"32px"};function Je({showDisconnectButton:t}){const{t:a}=n(),{connectLoaderState:r}=e.useContext(d),{provider:l}=r,{eventTargetState:{eventTarget:c}}=e.useContext(h),{ethereumProvider:u}=j(),{page:L}=p();e.useEffect((()=>{L({userJourney:m.WALLET,screen:"Settings"})}),[]);return i(V,{testId:"wallet-balances",header:i(R,{showBack:!0,title:a("views.SETTINGS.header.title"),onCloseButtonClick:()=>Z(c)}),footer:i(U,{}),children:o(s,{sx:Ge,children:[i(ze,{provider:l}),t&&i(N,{testId:"disconnect-button",variant:"secondary",sx:$e,onClick:()=>{(async()=>{if(G(l))try{if(l.provider?.session){const e=l.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>u?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await l.provider.disconnect()}if(u){const e=u?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>u?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await u.disconnect()}}catch(e){console.error(e)}})(),z(c)},children:a("views.SETTINGS.disconnectButton.label")})]})})}function Ke(){return i(s,{sx:{...$,background:"base.color.translucent.emphasis.100"},children:i(s,{sx:{...J,...K},children:o("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i("path",{d:"M213 120C132.857 120 65.7181 139.009 1 175.641V211H431V178.515C365.165 140.107 295.216 120 213 120Z",fill:"url(#paint0_linear_4525_125520)"}),i("path",{d:"M428.5 210.5H383C383 123 114 113.5 236 120.5C333.6 126.1 405 163.833 428.5 182V210.5Z",fill:"#2D0034",fillOpacity:"0.2"}),i("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),i("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),i("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),i("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),i("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),i("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),i("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),i("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),i("path",{d:"M2.97844e-07 176.149C62.5366 139.802 135.143 119 212.584 119C292.029 119 366.384 140.892 430 179",stroke:"black"}),i("path",{d:"M70.97 142.773C76.3142 146.15 87.6289 137.839 96.242 124.208C104.855 110.578 107.505 96.7911 102.161 93.414C96.8167 90.037 85.5021 98.3487 76.889 111.979C68.2758 125.609 65.6258 139.396 70.97 142.773Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M76.8602 112.001C79.353 108.055 82.0686 104.564 84.8088 101.664L94.3989 126.977C86.0698 138.949 75.925 145.933 70.9515 142.793C65.6033 139.413 68.2536 125.631 76.8692 111.994L76.8602 112.001Z",fill:"black"}),i("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M98.2141 120.884C99.3274 118.901 100.309 116.925 101.153 115.003L108.025 119.342C107.181 121.264 106.2 123.233 105.085 125.224L98.2141 120.884Z",fill:"#F191FA"}),i("path",{d:"M102.311 112.191C104.156 107.325 105.052 102.898 104.877 99.4899L111.748 103.829C111.923 107.238 111.035 111.665 109.182 116.531L102.311 112.191Z",fill:"black"}),i("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M341.833 142.899C353.278 131.542 356.039 115.768 348 107.668C339.962 99.5669 324.167 102.207 312.723 113.564C301.278 124.921 298.517 140.695 306.555 148.795C314.594 156.896 330.388 154.256 341.833 142.899Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M344.451 139.969C345.913 138.216 347.189 136.39 348.264 134.524L352.416 138.709C351.341 140.575 350.065 142.4 348.603 144.153L344.451 139.969Z",fill:"#D8EFF4"}),i("path",{d:"M349.72 131.746C352.022 126.818 352.967 121.785 352.442 117.302L356.594 121.486C357.119 125.97 356.174 131.002 353.872 135.93L349.72 131.746Z",fill:"black"}),i("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M155.769 157.057C169.703 165.169 185.654 163.751 191.396 153.888C197.138 144.026 190.497 129.454 176.563 121.342C162.629 113.229 146.679 114.648 140.937 124.51C135.195 134.373 141.836 148.944 155.769 157.057Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M159.278 158.826C161.349 159.785 163.443 160.544 165.524 161.099L162.558 166.193C160.477 165.639 158.383 164.879 156.311 163.921L159.278 158.826Z",fill:"#D8EFF4"}),i("path",{d:"M168.585 161.786C173.941 162.733 179.047 162.342 183.241 160.674L180.275 165.768C176.08 167.436 170.975 167.827 165.619 166.88L168.585 161.786Z",fill:"black"}),i("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M234.03 133.525C249.631 129.452 260.983 121.192 259.386 115.075C257.79 108.959 243.848 107.301 228.248 111.374C212.647 115.446 201.294 123.706 202.891 129.823C204.488 135.94 218.429 137.597 234.03 133.525Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M237.663 132.44C239.836 131.754 241.896 130.986 243.826 130.154L245.878 138.014C243.948 138.838 241.888 139.606 239.715 140.3L237.663 132.44Z",fill:"#F191FA"}),i("path",{d:"M246.588 128.896C251.257 126.601 254.941 123.976 257.13 121.367L259.182 129.227C256.985 131.836 253.309 134.461 248.64 136.756L246.588 128.896Z",fill:"black"}),i("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M189.995 60.1335C175.063 54.0502 161.025 53.8648 158.64 59.7194C156.255 65.5739 166.426 75.2515 181.358 81.3348C196.29 87.418 210.328 87.6034 212.713 81.7488C215.098 75.8943 204.927 66.2167 189.995 60.1335Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M185.032 82.6694C187.186 83.4191 189.294 84.0389 191.339 84.5366L188.275 92.0629C186.23 91.5652 184.122 90.9454 181.968 90.1957L185.032 82.6694Z",fill:"#96DAF4"}),i("path",{d:"M194.301 85.1776C199.418 86.1391 203.932 86.2438 207.256 85.4671L204.192 92.9934C200.868 93.762 196.353 93.6654 191.237 92.7038L194.301 85.1776Z",fill:"black"}),i("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M331.022 121.427C326.722 126.062 313.654 120.93 301.833 109.965C290.012 99 283.915 86.3538 288.214 81.719C292.513 77.0841 305.581 82.2158 317.402 93.1808C329.223 104.146 335.321 116.792 331.022 121.427Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M317.436 93.1948C314.014 90.0206 310.494 87.3431 307.102 85.2426L304.325 112.168C315.446 121.604 327.043 125.752 331.044 121.441C335.347 116.803 329.25 104.162 317.425 93.1905L317.436 93.1948Z",fill:"black"}),i("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M299.075 107.258C297.49 105.627 296.034 103.969 294.725 102.327L289.197 108.284C290.506 109.926 291.959 111.577 293.546 113.215L299.075 107.258Z",fill:"#F191FA"}),i("path",{d:"M292.885 99.9066C289.854 95.6761 287.853 91.6272 287.147 88.2883L281.619 94.2451C282.324 97.584 284.318 101.636 287.357 105.863L292.885 99.9066Z",fill:"black"}),i("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("defs",{children:o("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[i("stop",{stopColor:"#AD48BA"}),i("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function He(){const{t:t}=n(),{connectLoaderState:{provider:a}}=e.useContext(d),s=L(a),{page:r}=p();return e.useEffect((()=>{r({userJourney:m.WALLET,screen:"CoinInfo"})}),[]),o(V,{testId:"coin-info",header:i(R,{showBack:!0,transparent:!0}),footer:i(U,{}),heroContent:i(Ke,{}),floatHeader:!0,children:[!s&&i(H,{heading:t("views.COIN_INFO.metamask.heading"),children:t("views.COIN_INFO.metamask.body")}),s&&o(H,{heading:t("views.COIN_INFO.passport.heading"),children:[t("views.COIN_INFO.passport.body1"),i(Y,{onClick:()=>window.open(X),children:t("views.COIN_INFO.passport.linkText")}),t("views.COIN_INFO.passport.body2")]})]})}const Xe=({checkout:t,provider:n,refreshCallback:a,errorCallback:o})=>{const[s,i]=e.useState(!0),r=e.useCallback((async(e=!1)=>{if(t&&n)try{const o=await t.getNetworkInfo({provider:n});if(!o.isSupported)return;e||i(!0);const s=await(async(e,t,n)=>{if(!e||!t||!n)return[];const a=await t.getSigner().getAddress(),o=await re((()=>e.getAllBalances({provider:t,walletAddress:a,chainId:n})),W);return o?M(e.config,o.balances,n).map((t=>({...t,token:{...t.token,icon:D(e.config.environment,S(t.token.address)?t.token.symbol:t.token.address??"")}}))):[]})(t,n,o.chainId);e||i(!1),a(s)}catch(t){W.nonRetryable(t)&&o(t),e||i(!1)}}),[t,n]);return le((()=>r(!0)),3e4),{balancesLoading:s,refreshBalances:r}};function Ye(t){const{t:s}=n(),r=s("views.ERROR_VIEW.actionText"),l=s("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:p}}=e.useContext(h),{config:{environment:u,isOnRampEnabled:L,isSwapEnabled:C,isBridgeEnabled:k,theme:f},walletConfig:{showDisconnectButton:w,showNetworkMenu:b}}=t,{connectLoaderState:{checkout:E,provider:T}}=e.useContext(d),[y,S]=e.useReducer(q,{...Q,history:[]}),[x,I]=e.useReducer(ue,{...ce,walletConfig:{showDisconnectButton:w,showNetworkMenu:b}}),v=e.useMemo((()=>({walletState:x,walletDispatch:I})),[x,I]),_=e.useMemo((()=>({viewState:y,viewDispatch:S})),[y,S]),{balancesLoading:N,refreshBalances:B}=Xe({checkout:E,provider:T,refreshCallback:e=>{I({payload:{type:de.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),S({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});e.useEffect((()=>{(async()=>{if(!E)return;let e;try{e=await E.isSwapAvailable()}catch(t){e=!1}I({payload:{type:de.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:k,isSwapEnabled:C,isOnRampEnabled:L,isSwapAvailable:e}}})})()}),[k,C,L,u]);const O=async()=>{if(E&&T)try{const e=await E.getNetworkInfo({provider:T});if(!e.isSupported)return;B(),S({payload:{type:c.UPDATE_VIEW,view:{type:fe.WALLET_BALANCES}}}),I({payload:{type:de.SET_NETWORK,network:e}})}catch(e){console.error(e),S({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}};e.useEffect((()=>{E&&T&&O()}),[E,T]);return i(a.Provider,{value:_,children:i(oe,{environment:u,children:o(pe.Provider,{value:v,children:[y.view.type===A.LOADING_VIEW&&i(ee,{loadingText:l}),y.view.type===fe.WALLET_BALANCES&&i(Fe,{balancesLoading:N,theme:f,showNetworkMenu:b}),y.view.type===fe.SETTINGS&&i(Je,{showDisconnectButton:w}),y.view.type===fe.COIN_INFO&&i(He,{}),y.view.type===A.ERROR_VIEW&&i(te,{actionText:r,onActionClick:async()=>{S({payload:{type:c.UPDATE_VIEW,view:{type:fe.WALLET_BALANCES}}}),await O()},onCloseClick:()=>Z(p)}),y.view.type===A.TOP_UP_VIEW&&i(se,{analytics:{userJourney:m.WALLET},widgetEvent:g.IMTBL_WALLET_WIDGET_EVENT,checkout:E,provider:T,showOnrampOption:L,showSwapOption:C,showBridgeOption:k,onCloseButtonClick:()=>Z(p)})]})})})}export{Ye as default};
|
|
1
|
+
import{r as e,T as t,u as n,V as a,j as o,B as s,a as i,b as r,c as l,d as c,C as d,e as p,f as u,E as h,i as L,g as C,h as k,k as f,M as w,H as b,t as E,U as m,o as T,I as g,Z as y,l as S,s as x,m as I,S as A,N as v,n as _,p as N,q as B,v as O,D as W,w as M,x as D,y as F,z as R,A as P,F as Z,G as U,J as V,K as j,L as z,O as G,P as $,Q as J,R as K,W as H,X,Y,_ as q,$ as Q,a0 as ee,a1 as te}from"./index-81d38420.js";import{C as ne,a as ae,b as oe,T as se}from"./TopUpView-194b0094.js";import{H as ie}from"./HorizontalMenu-actual-bfedfe04.js";import{r as re,u as le}from"./retry-656d939c.js";const ce={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var de;!function(e){e.SET_WALLET_PROVIDER_NAME="SET_WALLET_PROVIDER_NAME",e.SET_NETWORK="SET_NETWORK",e.SET_TOKEN_BALANCES="SET_TOKEN_BALANCES",e.SET_SUPPORTED_TOP_UPS="SUPPORTED_TOP_UPS"}(de||(de={}));const pe=e.createContext({walletState:ce,walletDispatch:()=>{}});pe.displayName="WalletContext";const ue=(e,t)=>{switch(t.payload.type){case de.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case de.SET_NETWORK:return{...e,network:t.payload.network};case de.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case de.SET_SUPPORTED_TOP_UPS:return{...e,supportedTopUps:{isSwapEnabled:t.payload.supportedTopUps.isSwapEnabled??!0,isOnRampEnabled:t.payload.supportedTopUps.isOnRampEnabled??!0,isBridgeEnabled:t.payload.supportedTopUps.isBridgeEnabled??!0,isSwapAvailable:t.payload.supportedTopUps.isSwapAvailable??!0}};default:return e}},he=async(e,n)=>{const a=await e.getTokenAllowList({type:t.ALL,chainId:n}),o=new Set;return a.tokens.forEach((e=>{o.add(e.symbol)})),Array.from(o)},Le={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},Ce={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},ke={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var fe;function we(t){const{t:d}=n(),{viewDispatch:p}=e.useContext(a),{totalBalance:u,loading:h}=t;return o(s,{sx:Le,children:[o(s,{sx:Ce,children:[i(r,{size:"medium",children:d("views.WALLET_BALANCES.totalTokenBalance.heading")}),i(s,{sx:{pl:"base.spacing.x1"},children:i(l,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:ke,onClick:()=>p({payload:{type:c.UPDATE_VIEW,view:{type:fe.COIN_INFO}}})})})]}),o(s,{sx:Ce,children:[i(r,{testId:"total-token-balance-value",weight:"bold",shimmer:h?1:0,shimmerSx:{minw:"100px"},children:d("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!h&&o(r,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",u.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(fe||(fe={}));const be=e=>({display:e?"":"none"});function Ee({balanceInfo:n,theme:a,bridgeToL2OnClick:s}){const{connectLoaderState:r}=e.useContext(d),{track:l}=p(),{checkout:c,provider:y}=r,S=`≈ USD $${u(n.fiatAmount)}`,{walletState:x}=e.useContext(pe),{supportedTopUps:I,network:A}=x,[v,_]=e.useState(),[N,B]=e.useState(),[O,W]=e.useState(),{eventTargetState:{eventTarget:M}}=e.useContext(h),[D,F]=e.useState([]),R=L(y);e.useEffect((()=>{(async()=>{if(!c)return;const e=await c.getTokenAllowList({type:t.ONRAMP,chainId:C(c.config)});F(e.tokens)})()}),[c]),e.useEffect((()=>{if(!A||!I||!c)return;const e=A.chainId===C(c.config)&&(I?.isOnRampEnabled??!0);_(e);const t=(A.chainId===k(c.config)||A.chainId===C(c.config))&&(I?.isBridgeEnabled??!0);B(t);const n=A.chainId===C(c.config)&&(I?.isSwapEnabled??!0)&&(I?.isSwapAvailable??!0);W(n)}),[A,I,c,R]);const P=e.useMemo((()=>Boolean(v&&D.length>0&&D.find((e=>e.address?.toLowerCase()===n.address?.toLowerCase())))),[v,D]);return o(w,{testId:`balance-item-${n.symbol}`,emphasized:!0,children:[i(w.FramedImage,{imageUrl:n.icon,defaultImageUrl:f(c?.config.environment,a),circularFrame:!0}),i(w.Label,{children:n.symbol}),i(w.Caption,{children:n.description}),i(w.PriceDisplay,{testId:`balance-item-${n.symbol}`,use:i(b,{size:"xSmall"}),price:E(n.balance),fiatAmount:S}),(v||O||N)&&o(w.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}})},children:[o(w,{testId:"balance-item-add-option",sx:be(P),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),T.sendRequestOnrampEvent(M,g.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:n.address??"",amount:""})},children:[i(w.Icon,{icon:"Add"}),i(w.Label,{children:`Add ${n.symbol}`})]}),o(w,{testId:"balance-item-swap-option",sx:be(O),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),T.sendRequestSwapEvent(M,g.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:n.address??"",toTokenAddress:"",amount:""})},children:[i(w.Icon,{icon:"Exchange"}),i(w.Label,{children:`Swap ${n.symbol}`})]}),o(w,{testId:"balance-item-move-option",sx:be(N),onClick:()=>{l({userJourney:m.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:n.symbol,tokenAddress:n.address}}),s(n.address)},children:[i(w.Icon,{icon:"Minting"}),i(w.Label,{children:`Move ${n.symbol}`})]})]})]})}const me={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},Te={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},ge=e=>e.filter((e=>e.balance!==y||S(e.address)));function ye({balanceInfoItems:e,theme:t,bridgeToL2OnClick:a}){const{t:l}=n(),c=ge(e);return o(s,{sx:me,children:[0===c.length&&i(s,{sx:Te,children:i(r,{testId:"no-tokens-found",children:l("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),c.map((e=>i(Ee,{balanceInfo:e,bridgeToL2OnClick:a,theme:t},e.id)))]})}const Se={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},xe={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},Ie={fontWeight:"base.text.caption.small.bold.fontWeight"},Ae=(e,t)=>({paddingRight:"base.spacing.x1",width:"22px",fill:t?e:"base.color.brand.4"}),ve={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function _e(){const{t:t}=n(),{connectLoaderState:l}=e.useContext(d),{eventTargetState:{eventTarget:u}}=e.useContext(h),{checkout:L,provider:C}=l,{viewDispatch:k}=e.useContext(a),{walletState:f,walletDispatch:w}=e.useContext(pe),{network:b}=f,[E,T]=e.useState([]),{track:g}=p(),y=e.useCallback((async e=>{if(L&&C&&b&&b.chainId!==e){g({userJourney:m.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await L.switchNetwork({provider:C,chainId:e});x(u,t.provider,t.network)}catch(e){e.type===I.USER_REJECTED_REQUEST_ERROR||k({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}}}),[L,C,b,w,k]);return e.useEffect((()=>{(async()=>{if(L){const e=await L.getNetworkAllowList({type:v.ALL});T(e?.networks??[])}else T([])})()}),[L]),o(s,{testId:"network-menu",sx:Se,children:[i(r,{testId:"network-heading",size:"medium",sx:ve,children:t("views.WALLET_BALANCES.networkStatus.heading")}),i(ie,{children:L&&E?.sort(((e,t)=>_(e,t,L.config))).map((e=>o(ie.Button,{testId:`${e.name}-network-button`,sx:e.chainId===b?.chainId?xe:Ie,size:"small",onClick:()=>y(e.chainId),children:[i(N.Icon,{icon:B[e.chainId],iconVariant:"bold",sx:Ae(O[e.chainId],e.chainId===b?.chainId)}),e.name]},e.chainId)))})]})}const Ne={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},Be={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},Oe={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},We=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},Me=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,De=(e,t,n)=>t.map((t=>({id:Me(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:F(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function Fe({balancesLoading:t,theme:r,showNetworkMenu:u}){const{t:k}=n(),{connectLoaderState:f}=e.useContext(d),{checkout:b,provider:E}=f,{cryptoFiatState:y,cryptoFiatDispatch:S}=e.useContext(ne),{walletState:x}=e.useContext(pe),{eventTargetState:{eventTarget:I}}=e.useContext(h),{viewDispatch:v}=e.useContext(a),[_,N]=e.useState(0),{network:B,supportedTopUps:O,tokenBalances:W}=x,{conversions:M}=y,D=!L(E)&&u,{track:F,page:j}=p(),z=e.useMemo((()=>De(B?.chainId,W,M)),[W,M,B?.chainId]);e.useEffect((()=>{j({userJourney:m.WALLET,screen:"WalletBalances"})}),[]),e.useEffect((()=>{(async()=>{if(!b)return;if(!S)return;if(!B)return;const e=await he(b,B.chainId);S({payload:{type:ae.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[b,S,B?.chainId]),e.useEffect((()=>{let e=0;z.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),N(e)}),[z]);const G=e.useMemo((()=>!(!b||!B)&&(B.chainId===C(b.config)&&Boolean(O?.isBridgeEnabled||O?.isSwapEnabled||O?.isOnRampEnabled))),[b,B,O]);return i(V,{testId:"wallet-balances",header:i(R,{title:k("views.WALLET_BALANCES.header.title"),rightActions:i(l,{icon:"SettingsCog",sx:P(),iconVariant:"bold",onClick:()=>{F({userJourney:m.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),v({payload:{type:c.UPDATE_VIEW,view:{type:fe.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>Z(I)}),footer:i(U,{}),children:o(s,{sx:Ne,children:[o(s,{sx:Be,children:[D&&i(_e,{}),i(we,{totalBalance:_,loading:t}),o(s,{sx:We(D,G),children:[t&&o(s,{sx:Oe,children:[i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),i(w,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!t&&i(ye,{balanceInfoItems:z,bridgeToL2OnClick:e=>{T.sendRequestBridgeEvent(I,g.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:r})]})]}),G&&o(w,{testId:"add-coins",emphasized:!0,onClick:()=>{F({userJourney:m.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),v({payload:{type:c.UPDATE_VIEW,view:{type:A.TOP_UP_VIEW}}})},children:[i(w.FramedIcon,{icon:"Add"}),i(w.Label,{children:k("views.WALLET_BALANCES.addCoins")})]})]})})}const Re={width:"100%",height:"88px",display:"flex",flexDirection:"row",justifyContent:"space-between",padding:"24px 11px 24px 32px",backgroundColor:"base.color.translucent.emphasis.400",borderRadius:"base.borderRadius.x6"},Pe={width:"100%",display:"flex"},Ze={width:"318px",display:"flex",flexDirection:"column"},Ue={overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},Ve={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"};function je({textToCopy:t}){const[n,a]=e.useState(!1),{track:o}=p();return i(s,{children:t&&i(s,{sx:{cursor:"pointer"},children:i(l,{sx:n?Ve:{},onClick:()=>{null!=t&&(o({userJourney:m.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(t)),a(!0),setTimeout((()=>{a(!1)}),3e3)},size:"small",icon:n?"Tick":"CopyText"})})})}function ze({provider:t}){const[n,a]=e.useState("");return e.useEffect((()=>{t&&(async()=>{const e=await t.getSigner().getAddress();a(e)})()}),[t]),i(s,{sx:Re,children:o(s,{sx:Pe,children:[o(s,{sx:Ze,children:[i(b,{size:"xSmall",children:"Wallet address"}),i(r,{testId:"wallet-address",size:"xSmall",sx:Ue,children:n})]}),i(je,{textToCopy:n})]})})}const Ge={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},$e={marginTop:"32px"};function Je({showDisconnectButton:t}){const{t:a}=n(),{connectLoaderState:r}=e.useContext(d),{provider:l}=r,{eventTargetState:{eventTarget:c}}=e.useContext(h),{ethereumProvider:u}=j(),{page:L}=p();e.useEffect((()=>{L({userJourney:m.WALLET,screen:"Settings"})}),[]);return i(V,{testId:"wallet-balances",header:i(R,{showBack:!0,title:a("views.SETTINGS.header.title"),onCloseButtonClick:()=>Z(c)}),footer:i(U,{}),children:o(s,{sx:Ge,children:[i(ze,{provider:l}),t&&i(N,{testId:"disconnect-button",variant:"secondary",sx:$e,onClick:()=>{(async()=>{if(G(l))try{if(l.provider?.session){const e=l.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>u?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await l.provider.disconnect()}if(u){const e=u?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>u?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await u.disconnect()}}catch(e){console.error(e)}})(),z(c)},children:a("views.SETTINGS.disconnectButton.label")})]})})}function Ke(){return i(s,{sx:{...$,background:"base.color.translucent.emphasis.100"},children:i(s,{sx:{...J,...K},children:o("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[i("path",{d:"M213 120C132.857 120 65.7181 139.009 1 175.641V211H431V178.515C365.165 140.107 295.216 120 213 120Z",fill:"url(#paint0_linear_4525_125520)"}),i("path",{d:"M428.5 210.5H383C383 123 114 113.5 236 120.5C333.6 126.1 405 163.833 428.5 182V210.5Z",fill:"#2D0034",fillOpacity:"0.2"}),i("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),i("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),i("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),i("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),i("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),i("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),i("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),i("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),i("path",{d:"M2.97844e-07 176.149C62.5366 139.802 135.143 119 212.584 119C292.029 119 366.384 140.892 430 179",stroke:"black"}),i("path",{d:"M70.97 142.773C76.3142 146.15 87.6289 137.839 96.242 124.208C104.855 110.578 107.505 96.7911 102.161 93.414C96.8167 90.037 85.5021 98.3487 76.889 111.979C68.2758 125.609 65.6258 139.396 70.97 142.773Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M76.8602 112.001C79.353 108.055 82.0686 104.564 84.8088 101.664L94.3989 126.977C86.0698 138.949 75.925 145.933 70.9515 142.793C65.6033 139.413 68.2536 125.631 76.8692 111.994L76.8602 112.001Z",fill:"black"}),i("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M98.2141 120.884C99.3274 118.901 100.309 116.925 101.153 115.003L108.025 119.342C107.181 121.264 106.2 123.233 105.085 125.224L98.2141 120.884Z",fill:"#F191FA"}),i("path",{d:"M102.311 112.191C104.156 107.325 105.052 102.898 104.877 99.4899L111.748 103.829C111.923 107.238 111.035 111.665 109.182 116.531L102.311 112.191Z",fill:"black"}),i("path",{d:"M96.2211 124.237C104.836 110.608 107.486 96.8249 102.138 93.4455L109.009 97.785C114.357 101.164 111.707 114.947 103.092 128.576C94.4778 142.205 83.1639 150.512 77.8146 147.141L70.9434 142.801C76.2916 146.181 87.6066 137.866 96.2211 124.237Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M341.833 142.899C353.278 131.542 356.039 115.768 348 107.668C339.962 99.5669 324.167 102.207 312.723 113.564C301.278 124.921 298.517 140.695 306.555 148.795C314.594 156.896 330.388 154.256 341.833 142.899Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M344.451 139.969C345.913 138.216 347.189 136.39 348.264 134.524L352.416 138.709C351.341 140.575 350.065 142.4 348.603 144.153L344.451 139.969Z",fill:"#D8EFF4"}),i("path",{d:"M349.72 131.746C352.022 126.818 352.967 121.785 352.442 117.302L356.594 121.486C357.119 125.97 356.174 131.002 353.872 135.93L349.72 131.746Z",fill:"black"}),i("path",{d:"M341.813 142.853C353.26 131.495 356.014 115.719 347.977 107.616L352.129 111.801C360.166 119.903 357.412 135.68 345.965 147.037C334.519 158.395 318.726 161.037 310.688 152.934L306.536 148.75C314.574 156.852 330.375 154.211 341.813 142.853Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M155.769 157.057C169.703 165.169 185.654 163.751 191.396 153.888C197.138 144.026 190.497 129.454 176.563 121.342C162.629 113.229 146.679 114.648 140.937 124.51C135.195 134.373 141.836 148.944 155.769 157.057Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",fill:"#96DAF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M159.278 158.826C161.349 159.785 163.443 160.544 165.524 161.099L162.558 166.193C160.477 165.639 158.383 164.879 156.311 163.921L159.278 158.826Z",fill:"#D8EFF4"}),i("path",{d:"M168.585 161.786C173.941 162.733 179.047 162.342 183.241 160.674L180.275 165.768C176.08 167.436 170.975 167.827 165.619 166.88L168.585 161.786Z",fill:"black"}),i("path",{d:"M155.809 157.026C169.744 165.14 185.695 163.714 191.439 153.852L188.473 158.946C182.729 168.808 166.778 170.234 152.843 162.12C138.908 154.006 132.266 139.436 138.01 129.574L140.976 124.48C135.232 134.342 141.876 148.919 155.809 157.026Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M234.03 133.525C249.631 129.452 260.983 121.192 259.386 115.075C257.79 108.959 243.848 107.301 228.248 111.374C212.647 115.446 201.294 123.706 202.891 129.823C204.488 135.94 218.429 137.597 234.03 133.525Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M237.663 132.44C239.836 131.754 241.896 130.986 243.826 130.154L245.878 138.014C243.948 138.838 241.888 139.606 239.715 140.3L237.663 132.44Z",fill:"#F191FA"}),i("path",{d:"M246.588 128.896C251.257 126.601 254.941 123.976 257.13 121.367L259.182 129.227C256.985 131.836 253.309 134.461 248.64 136.756L246.588 128.896Z",fill:"black"}),i("path",{d:"M234.031 133.533C249.63 129.462 260.98 121.198 259.388 115.083L261.44 122.943C263.04 129.058 251.682 137.322 236.083 141.393C220.484 145.464 206.542 143.808 204.942 137.685L202.89 129.825C204.49 135.94 218.433 137.604 234.031 133.533Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M189.995 60.1335C175.063 54.0502 161.025 53.8648 158.64 59.7194C156.255 65.5739 166.426 75.2515 181.358 81.3348C196.29 87.418 210.328 87.6034 212.713 81.7488C215.098 75.8943 204.927 66.2167 189.995 60.1335Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M185.032 82.6694C187.186 83.4191 189.294 84.0389 191.339 84.5366L188.275 92.0629C186.23 91.5652 184.122 90.9454 181.968 90.1957L185.032 82.6694Z",fill:"#96DAF4"}),i("path",{d:"M194.301 85.1776C199.418 86.1391 203.932 86.2438 207.256 85.4671L204.192 92.9934C200.868 93.762 196.353 93.6654 191.237 92.7038L194.301 85.1776Z",fill:"black"}),i("path",{d:"M181.375 81.3031C196.307 87.3891 210.345 87.5729 212.731 81.7174L209.667 89.2437C207.281 95.0992 193.243 94.9154 178.311 88.8293C163.379 82.7433 153.208 73.0653 155.594 67.2098L158.658 59.6835C156.272 65.5391 166.443 75.217 181.375 81.3031Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M331.022 121.427C326.722 126.062 313.654 120.93 301.833 109.965C290.012 99 283.915 86.3538 288.214 81.719C292.513 77.0841 305.581 82.2158 317.402 93.1808C329.223 104.146 335.321 116.792 331.022 121.427Z",fill:"#F191FA",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M317.436 93.1948C314.014 90.0206 310.494 87.3431 307.102 85.2426L304.325 112.168C315.446 121.604 327.043 125.752 331.044 121.441C335.347 116.803 329.25 104.162 317.425 93.1905L317.436 93.1948Z",fill:"black"}),i("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",fill:"#D8EFF4",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("path",{d:"M299.075 107.258C297.49 105.627 296.034 103.969 294.725 102.327L289.197 108.284C290.506 109.926 291.959 111.577 293.546 113.215L299.075 107.258Z",fill:"#F191FA"}),i("path",{d:"M292.885 99.9066C289.854 95.6761 287.853 91.6272 287.147 88.2883L281.619 94.2451C282.324 97.584 284.318 101.636 287.357 105.863L292.885 99.9066Z",fill:"black"}),i("path",{d:"M301.861 109.987C290.039 99.0235 283.942 86.3817 288.244 81.7437L282.716 87.7004C278.413 92.3385 284.51 104.98 296.332 115.944C308.154 126.907 321.22 132.035 325.526 127.404L331.054 121.447C326.752 126.085 313.683 120.951 301.861 109.987Z",stroke:"black",strokeLinecap:"round",strokeLinejoin:"round"}),i("defs",{children:o("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[i("stop",{stopColor:"#AD48BA"}),i("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function He(){const{t:t}=n(),{connectLoaderState:{provider:a}}=e.useContext(d),s=L(a),{page:r}=p();return e.useEffect((()=>{r({userJourney:m.WALLET,screen:"CoinInfo"})}),[]),o(V,{testId:"coin-info",header:i(R,{showBack:!0,transparent:!0}),footer:i(U,{}),heroContent:i(Ke,{}),floatHeader:!0,children:[!s&&i(H,{heading:t("views.COIN_INFO.metamask.heading"),children:t("views.COIN_INFO.metamask.body")}),s&&o(H,{heading:t("views.COIN_INFO.passport.heading"),children:[t("views.COIN_INFO.passport.body1"),i(Y,{onClick:()=>window.open(X),children:t("views.COIN_INFO.passport.linkText")}),t("views.COIN_INFO.passport.body2")]})]})}const Xe=({checkout:t,provider:n,refreshCallback:a,errorCallback:o})=>{const[s,i]=e.useState(!0),r=e.useCallback((async(e=!1)=>{if(t&&n)try{const o=await t.getNetworkInfo({provider:n});if(!o.isSupported)return;e||i(!0);const s=await(async(e,t,n)=>{if(!e||!t||!n)return[];const a=await t.getSigner().getAddress(),o=await re((()=>e.getAllBalances({provider:t,walletAddress:a,chainId:n})),W);return o?M(e.config,o.balances,n).map((t=>({...t,token:{...t.token,icon:D(e.config.environment,S(t.token.address)?t.token.symbol:t.token.address??"")}}))):[]})(t,n,o.chainId);e||i(!1),a(s)}catch(t){W.nonRetryable(t)&&o(t),e||i(!1)}}),[t,n]);return le((()=>r(!0)),3e4),{balancesLoading:s,refreshBalances:r}};function Ye(t){const{t:s}=n(),r=s("views.ERROR_VIEW.actionText"),l=s("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:p}}=e.useContext(h),{config:{environment:u,isOnRampEnabled:L,isSwapEnabled:C,isBridgeEnabled:k,theme:f},walletConfig:{showDisconnectButton:w,showNetworkMenu:b}}=t,{connectLoaderState:{checkout:E,provider:T}}=e.useContext(d),[y,S]=e.useReducer(q,{...Q,history:[]}),[x,I]=e.useReducer(ue,{...ce,walletConfig:{showDisconnectButton:w,showNetworkMenu:b}}),v=e.useMemo((()=>({walletState:x,walletDispatch:I})),[x,I]),_=e.useMemo((()=>({viewState:y,viewDispatch:S})),[y,S]),{balancesLoading:N,refreshBalances:B}=Xe({checkout:E,provider:T,refreshCallback:e=>{I({payload:{type:de.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),S({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});e.useEffect((()=>{(async()=>{if(!E)return;let e;try{e=await E.isSwapAvailable()}catch(t){e=!1}I({payload:{type:de.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:k,isSwapEnabled:C,isOnRampEnabled:L,isSwapAvailable:e}}})})()}),[k,C,L,u]);const O=async()=>{if(E&&T)try{const e=await E.getNetworkInfo({provider:T});if(!e.isSupported)return;B(),S({payload:{type:c.UPDATE_VIEW,view:{type:fe.WALLET_BALANCES}}}),I({payload:{type:de.SET_NETWORK,network:e}})}catch(e){console.error(e),S({payload:{type:c.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}};e.useEffect((()=>{E&&T&&O()}),[E,T]);return i(a.Provider,{value:_,children:i(oe,{environment:u,children:o(pe.Provider,{value:v,children:[y.view.type===A.LOADING_VIEW&&i(ee,{loadingText:l}),y.view.type===fe.WALLET_BALANCES&&i(Fe,{balancesLoading:N,theme:f,showNetworkMenu:b}),y.view.type===fe.SETTINGS&&i(Je,{showDisconnectButton:w}),y.view.type===fe.COIN_INFO&&i(He,{}),y.view.type===A.ERROR_VIEW&&i(te,{actionText:r,onActionClick:async()=>{S({payload:{type:c.UPDATE_VIEW,view:{type:fe.WALLET_BALANCES}}}),await O()},onCloseClick:()=>Z(p)}),y.view.type===A.TOP_UP_VIEW&&i(se,{analytics:{userJourney:m.WALLET},widgetEvent:g.IMTBL_WALLET_WIDGET_EVENT,checkout:E,provider:T,showOnrampOption:L,showSwapOption:C,showBridgeOption:k,onCloseButtonClick:()=>Z(p)})]})})})}export{Ye as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{dn as t}from"./index-81d38420.js";function n(n,e,r,o){var i=this;return n?((n instanceof Element?[n]:"toArray"in n?n.toArray():n).forEach((function(n){n.addEventListener("click",(function(u){var a,c,s=e instanceof Function?e(n):e,f=r instanceof Function?r(n):r,l=n.getAttribute("href")||n.getAttributeNS("http://www.w3.org/1999/xlink","href")||n.getAttribute("xlink:href")||(null===(a=n.getElementsByTagName("a")[0])||void 0===a?void 0:a.getAttribute("href")),h=t(i.track(s,f,null!=o?o:{}),null!==(c=i.settings.timeout)&&void 0!==c?c:500);(function(t,n){return!("_blank"!==t.target||!n)})(n,l)||function(t){var n=t;return!!(n.ctrlKey||n.shiftKey||n.metaKey||n.button&&1==n.button)}(u)||l&&(u.preventDefault?u.preventDefault():u.returnValue=!1,h.catch(console.error).then((function(){window.location.href=l})).catch(console.error))}),!1)})),this):this}function e(n,e,r,o){var i=this;return n?(n instanceof HTMLFormElement&&(n=[n]),n.forEach((function(n){if(!(n instanceof Element))throw new TypeError("Must pass HTMLElement to trackForm/trackSubmit.");var u=function(u){var a;u.preventDefault?u.preventDefault():u.returnValue=!1;var c=e instanceof Function?e(n):e,s=r instanceof Function?r(n):r;t(i.track(c,s,null!=o?o:{}),null!==(a=i.settings.timeout)&&void 0!==a?a:500).catch(console.error).then((function(){n.submit()})).catch(console.error)},a=window.jQuery||window.Zepto;a?a(n).submit(u):n.addEventListener("submit",u,!1)})),this):this}export{e as form,n as link};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a9 as e,c4 as t,a as n,by as a,a2 as i,a3 as o,r,c5 as s,a5 as l,a7 as c,j as d,c6 as u,c as h,aa as p,c7 as m,B as f,bB as x,bq as g,c8 as v,bk as b,ab as C,bF as L,c9 as k,ad as w,p as I,ca as y,a4 as A,a6 as S,a8 as M,bi as z,cb as B,cc as E,cd as V,ce as H,cf as _,cg as N,ch as T,ci as F,cj as R,ck as D,cl as j,cm as W,cn as Z,b as $,co as P,bG as O,cp as Q,cq as q,cr as U,cs as X,ct as G,cu as K,cv as Y,cw as J,cx as ee,cy as te,cz as ne,M as ae,cA as ie,cB as oe,cC as re,cD as se,cE as le,cF as ce,cG as de,cH as ue,cI as he,cJ as pe,cK as me,cL as fe,cM as xe,bx as ge,aI as ve,cN as be,cO as Ce,cP as Le,u as ke,aO as we,ae as Ie,aA as ye,h as Ae,O as Se,bQ as Me,cQ as ze,H as Be,G as Ee,aB as Ve,cR as He,cS as _e,t as Ne,f as Te,bA as Fe,P as Re,Q as De,R as je,al as We,x as Ze,l as $e,D as Pe}from"./index-81d38420.js";import{r as Oe}from"./retry-656d939c.js";var Qe=function(t){var n=v("small",t,!1);return{brad:"base.borderRadius.x4",overflow:"hidden",transitionProperty:"background-color",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","&.emphasized":{bgc:"base.color.translucent.emphasis.100"},"&.expanded":{bgc:"base.color.translucent.emphasis.100"},"&.emphasized.expanded":{bgc:"base.color.translucent.emphasis.200"},"&:hover":{bgc:"base.color.translucent.emphasis.200"},"&.emphasized:hover":{bgc:"base.color.translucent.emphasis.300"},"&:hover .ButtCon":e({},n["&:hover:not([disabled])"])}},qe=e(e({},t),{},{alignItems:"flex-start",justifyContent:"space-between",gap:"base.spacing.x4",position:"relative",px:"base.spacing.x3",py:"base.spacing.x4",minh:"base.spacing.x16"}),Ue={position:"absolute",top:"base.spacing.x4"},Xe={overflow:"visible",bg:"transparent",maxh:"unset",boxShadow:"unset",brad:"unset",p:"0"},Ge={mb:"base.spacing.x10",px:"base.spacing.x3","& .Divider:first-of-type":{mb:"base.spacing.x4"}},Ke=["children","className","sx","chevronSide"];function Ye(t){var a=t.children,o=t.className,s=t.sx,l=void 0===s?{}:s,d=t.chevronSide,u=void 0===d?"left":d,h=i(t,Ke),m=r.useMemo((function(){return b(a)}),[a]);return n(x,e(e({},h),{},{className:"".concat(null!=o?o:""," AccordionExpandedContent"),sx:c(Ge,e({},"left"===u?{pl:"base.spacing.x15"}:{pr:"base.spacing.x15"}),l),children:r.Children.map(m,(function(e){return r.isValidElement(e)&&C(e,L)?n(p,{size:"xSmall",children:e}):e}))}))}Ye.displayName="Accordion.ExpandedContent";var Je=["children","direction","gap","rc"],et=["sx","alignItems","className"],tt=["alignItems","className","sx"];function nt(t){var a=t.children,o=t.direction,r=void 0===o?"column":o,s=t.gap,l=void 0===s?"0px":s,c=t.rc,d=void 0===c?n("span",{}):c,u=i(t,Je);return n(x,e(e({},u),{},{direction:r,gap:l,rc:d,children:a}))}function at(t){var a=t.sx,o=void 0===a?{}:a,r=t.alignItems,s=void 0===r?"flex-start":r,l=t.className,d=i(t,et);return n(nt,e(e({},d),{},{alignItems:s,sx:c({flex:1,textAlign:"left"},o),className:"".concat(null!=l?l:""," AccordionTargetLeftSlot")}))}function it(t){var a=t.alignItems,o=void 0===a?"flex-end":a,r=t.className,s=t.sx,l=void 0===s?{}:s,d=i(t,tt);return n(nt,e(e({},d),{},{alignItems:o,sx:c({textAlign:"right"},l),className:"".concat(null!=r?r:""," AccordionTargetRightSlot")}))}at.displayName="Accordion.TargetLeftSlot",it.displayName="Accordion.TargetRightSlot";var ot=["emphasized","expanded","defaultExpanded","children","gap","alignItems","className","onExpandChange","chevronSide","sx","rc","targetClickOveride","testId"];function rt(t){var v=e(e({},t),{},"expanded"in t?{defaultExpanded:void 0}:{expanded:void 0}),b=v.emphasized,C=v.expanded,L=v.defaultExpanded,k=v.children,w=v.gap,I=void 0===w?"0":w,y=v.alignItems,A=void 0===y?"stretch":y,S=v.className,M=v.onExpandChange,z=v.chevronSide,B=void 0===z?"left":z,E=v.sx,V=void 0===E?{}:E,H=v.rc,_=void 0===H?n(a.div,{}):H,N=v.targetClickOveride,T=v.testId,F=void 0===T?"Accordion":T,R=i(v,ot),D=o(),j=D.base,W=r.useState(L),Z=s(W,2),$=Z[0],P=Z[1],O=null!=C?C:$,Q=l(k,at),q=l(k,it),U=l(k,Ye),X=r.useCallback((function(){void 0===C?P((function(e){return null==M||M(!e),!e})):null==M||M(!C)}),[C,M]),G=r.useMemo((function(){var e,t;return c(Qe(D),null!==(e=null===(t=D.components)||void 0===t||null===(t=t.Accordion)||void 0===t?void 0:t.sxOverride)&&void 0!==e?e:{},V)}),[V,D]);return n(g,{children:function(t){var i=t.cx;return d(x,e(e({},R),{},{className:"".concat(null!=S?S:""," Accordion ").concat(i({emphasized:b,expanded:O})),gap:I,alignItems:A,rc:_,sx:G,testId:F,children:[d(u,{sx:c(qe,e({},"left"===B?{pl:"base.spacing.x15"}:{pr:"base.spacing.x15"})),onClick:N||X,testId:"".concat(F,"__clickableArea"),children:[n(h,{rc:n("span",{}),icon:O?"ChevronCollapse":"ChevronExpand",variant:"tertiary",size:"small",testId:"".concat(F,"__clickableArea__chevron"),sx:c(Ue,e({},"left"===B?{left:"base.spacing.x3"}:{right:"base.spacing.x3"}))}),n(p,{testId:"".concat(F,"__clickableArea__targetLeft"),children:Q}),q&&n(p,{testId:"".concat(F,"__clickableArea__targetRight"),children:q})]}),n(m,{children:Boolean(U)&&O?n(f,{sx:Xe,rc:n(a.div,{initial:{opacity:0,height:0,overflow:"hidden",y:-16},animate:{height:"auto",opacity:1,y:0,transitionEnd:{overflow:"visible"}},exit:{height:0,opacity:0,overflow:"hidden",y:-16},transition:{duration:j.motion.normal.fast.jsDuration,ease:j.motion.normal.fast.jsEase}}),children:n(p,{chevronSide:B,testId:"".concat(F,"__expandedContent"),children:U})}):null})]}))}})}rt.displayName="Accordion",rt.TargetLeftSlot=at,rt.TargetRightSlot=it,rt.ExpandedContent=Ye;var st=["sx","className","rc"];function lt(t){var r=t.sx,s=void 0===r?{}:r,l=t.className,d=void 0===l?"clearValueButton":l,h=t.rc,p=i(t,st),m=o().base;return n(u,e(e({},p),{},{rc:h||n(a.button,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{ease:m.motion.normal.fast.jsEase,duration:m.motion.normal.fast.jsDuration}}),className:d,sx:c(k,s),children:n(w,{icon:"CloseWithCircle",variant:"bold",sx:{width:"base.icon.size.200"}})}))}lt.displayName="ClearValueButton";var ct=["children","sx"];function dt(t){var a=t.children,o=t.sx,r=void 0===o?{}:o,s=i(t,ct),l=c(Z,r);return n($,e(e({},s),{},{sx:l,children:a}))}dt.displayName="TextInput.Adornment";var ut=["children","currentInputValue","sx"];function ht(t){var a=t.children;t.currentInputValue;var o=t.sx,r=void 0===o?{}:o,s=i(t,ut);return n(I,e(e({},s),{},{variant:"tertiary",size:"small",sx:r,children:a}))}ht.displayName="TextInput.Button",ht.Icon=I.Icon,ht.Logo=I.Logo;var pt=["sx"];function mt(t){var a=t.sx,o=void 0===a?{}:a,r=i(t,pt),s=c(P,o);return n(O,e(e({},r),{},{sx:s}))}mt.displayName="TextInput.FramedImage";var ft=["sx","variant"];function xt(t){var a=t.sx,o=void 0===a?{}:a,r=t.variant,s=i(t,ft),l=c(Q,o);return n(w,e(e({},s),{},{variant:r,sx:l}))}xt.displayName="TextInput.Icon";var gt=["children","currentInputValue","sx"];function vt(t){var a=t.children;t.currentInputValue;var o=t.sx,r=void 0===o?{}:o,s=i(t,gt);return n(y,e(e({},s),{},{size:"small",sx:r,children:a}))}vt.displayName="TextInput.StatefulButtCon",vt.SvgIcon=y.SvgIcon;var bt=["domRef","inputRef","rc","placeholder","sx","testId","name","id","children","className","validationStatus","onChange","onClearValue","value","hideClearValueButton","textAlign","defaultValue","sizeVariant","disabled"];function Ct(t){var a=t.domRef,u=t.inputRef,h=void 0===u?{current:null}:u,v=t.rc,b=t.placeholder,C=t.sx,L=void 0===C?{}:C,k=t.testId,w=void 0===k?"TextInput":k,I=t.name,y=t.id,Z=void 0===y?I:y,$=t.children,P=t.className,O=t.validationStatus,Q=t.onChange,U=t.onClearValue,X=t.value,G=t.hideClearValueButton,K=t.textAlign,Y=void 0===K?q:K,J=t.defaultValue,ee=void 0===J?"":J,te=t.sizeVariant,ne=void 0===te?E:te,ae=t.disabled,ie=i(t,bt),oe=A(h),re=r.useState("number"==typeof X?X.toString():"string"==typeof X?X:ee),se=s(re,2),le=se[0],ce=se[1],de=l($,ht),ue=l($,vt),he=l($,xt),pe=l($,mt),me=l($,dt),fe=S($,[ht,vt,xt,mt,dt]).otherChildren,xe=r.useRef(null),ge=r.useRef(null),ve=M(xe,30).width,be=M(ge,30).width,Ce=r.useCallback((function(){return void 0!==X?null==U?void 0:U():(oe.current&&(oe.current.value="",oe.current.focus()),null==Q||Q({type:"change",target:null==oe?void 0:oe.current}),ce(""),null==U||U(),!1)}),[oe,Q,X,U,ce]),Le=r.useCallback((function(e){void 0===X&&ce(e.target.value),null==Q||Q(e)}),[ce,Q,X]),ke=o(),we=z(ne,E,B),Ie=r.useMemo((function(){return c(_,H({size:we,theme:ke}),V({size:ne,theme:ke}),L)}),[we,ne,L,ke]),ye=null!=X?X:le,Ae=r.useMemo((function(){return c(F,T({theme:ke,validationStatus:O,leftHandButtonsWidth:be,rightHandButtonsWidth:ve,textAlign:Y,hasValue:Boolean(ye)}),N({theme:ke,validationStatus:O,size:ne,leftHandButtonsWidth:be,rightHandButtonsWidth:ve,textAlign:Y,hasValue:Boolean(ye)}))}),[be,ve,ne,Y,ke,O,ye]),Se=R(Ae),Me=pe||he||"left"===Y&&Boolean(me);return n(g,{children:function(t){var i,o,r,s,l=t.cx;return d(f,{rc:v,domRef:a,className:l("".concat(null!=P?P:""," TextInput"),{disabled:ae}),testId:w,sx:Ie,"data-validation-status":O,children:[n("input",e(e({},ie),{},{disabled:ae,name:I,ref:oe,"data-testid":"".concat(w,"__input"),onChange:Le,value:ye,id:Z,placeholder:b,css:Se})),Me&&d(x,{direction:"row",alignItems:"center",sx:c(j,D),domRef:ge,children:[pe||he||null,"left"===Y&&me?n(p,{testId:(null==me||null===(i=me.props)||void 0===i?void 0:i.testId)||"".concat(w,"__adornment"),children:me}):null]}),d(x,{alignItems:"center",direction:"row",sx:c(W,D),testId:"".concat(w,"__rightButtonsContainer"),domRef:xe,className:"rightButtonsContainer",children:["right"===Y&&Boolean(me)?n(p,{testId:(null==me||null===(o=me.props)||void 0===o?void 0:o.testId)||"".concat(w,"__adornment"),children:me}):null,n(m,{children:ye&&!G&&n(lt,{disabled:ae,onClick:Ce,testId:"".concat(w,"__rightButtonsContainer__clearValueButton")})}),de&&n(p,{disabled:ae,currentInputValue:ye,testId:null!==(r=de.props.testId)&&void 0!==r?r:"".concat(w,"__rightButtonsContainer__rightButton"),children:de}),ue&&n(p,{disabled:ae,currentInputValue:ye,testId:null!==(s=ue.props.testId)&&void 0!==s?s:"".concat(w,"__rightButtonsContainer__rightButtCon"),children:ue})]}),fe]})}})}Ct.displayName="TextInput",Ct.Button=ht,Ct.Icon=xt,Ct.FramedImage=mt,Ct.StatefulButtCon=vt,Ct.Adornment=dt;var Lt=["children","options","onClearValue","name","sizeVariant","textAlign","domRef","inputRef","defaultValue","value","inputValue","onChange","onInputChange","placeholder","validationStatus","testId","className","sx"];function kt(t){var u,h,p=t.children,m=t.options,x=t.onClearValue,g=t.name,v=t.sizeVariant,b=void 0===v?E:v,C=t.textAlign,L=t.domRef,k=void 0===L?{current:null}:L,w=t.inputRef,I=void 0===w?{current:null}:w,y=t.defaultValue,S=void 0===y?"":y,z=t.value,V=t.inputValue,H=t.onChange,_=t.onInputChange,N=t.placeholder,T=t.validationStatus,F=t.testId,R=void 0===F?"Autocomplete":F,D=t.className,j=t.sx,W=void 0===j?{}:j,Z=i(t,Lt),$=o(),P=U((function(e){return e})).state,O=r.useRef([]),Q=A(k),q=M(Q),ie=A(I),oe=l(p,xt),re=r.useState(!1),se=s(re,2),le=se[0],ce=se[1],de=r.useState(m),ue=s(de,2),he=ue[0],pe=ue[1],me=r.useState(null),fe=s(me,2),xe=fe[0],ge=fe[1],ve=r.useCallback((function(){var e;ce(!1),null===(e=ie.current)||void 0===e||e.blur()}),[ie]),be=r.useState("string"==typeof V?V:S),Ce=s(be,2),Le=Ce[0],ke=Ce[1],we=r.useCallback((function(){var e,t=xe;t=null===xe||xe===he.length-1?0:xe+1,ge(t),null===(e=O.current[t])||void 0===e||e.scrollIntoView({block:"end",inline:"nearest",behavior:"auto"})}),[xe,he.length]),Ie=r.useCallback((function(){var e,t=xe;t=null===xe?0:0===xe?he.length-1:xe-1,ge(t),null===(e=O.current[t])||void 0===e||e.scrollIntoView({block:"end",inline:"nearest",behavior:"auto"})}),[xe,he.length]),ye=r.useCallback((function(){if(null!==xe){var e=he[xe];null==H||H(e),ke(e),ve()}else{var t=he[0];null==H||H(t),ke(t),ve()}}),[xe,ve,H,he]),Ae=r.useCallback((function(e){switch(e.key){case"Escape":ve();break;case"Enter":ye();break;case"ArrowUp":e.preventDefault(),Ie();break;case"ArrowDown":e.preventDefault(),we()}}),[ve,we,ye,Ie]),Se="string"==typeof z?z:"string"==typeof V?V:Le;X((function(){pe(""!==Se?m.filter((function(e){return e.toLowerCase().includes(Se.toLowerCase())})):m)}),[Se,m]),X((function(){return ce(!1)}),[P]),G([Q],(function(){return ce(!1)}));var Me=r.useCallback((function(e){e.stopPropagation(),e.preventDefault(),ce(!le)}),[le]),ze=r.useCallback((function(e){ge(null),null==H||H(null),null==_||_(e),ke(e.target.value)}),[H,_]),Be=r.useCallback((function(){return void 0!==z?(null==H||H(null),null==x?void 0:x()):ke("")}),[H,x,z]),Ee=r.useMemo((function(){return c(K,{position:"absolute",right:"14px",top:"50%",translate:"0 -50%",pointerEvents:"none",userSelect:"none"})}),[]),Ve=Y(b,E,B),He=c(null!==(u=null===(h=$.components)||void 0===h||null===(h=h.Autocomplete)||void 0===h?void 0:h.sxOverride)&&void 0!==u?u:{},W);return n(f,e(e({},Z),{},{domRef:Q,testId:R,sx:He,className:"".concat(null!=D?D:""," Autocomplete AutoComplete--").concat(Ve),children:d(J,{visible:le,position:{y:"below",x:"left"},children:[n(J.Target,{children:d(Ct,{name:g,value:Se,inputMode:"text",textAlign:C,testId:"".concat(R,"__textInput"),validationStatus:T,sizeVariant:b,inputRef:ie,placeholder:N,onKeyDown:Ae,onClick:Me,onChange:ze,onClearValue:Be,autoComplete:"off",sx:{"& .rightButtonsContainer":{pointerEvents:"none",userSelect:"none"}},children:[oe,n(Ct.StatefulButtCon,{icon:"Add",sx:{opacity:"0",minw:"24px",w:"24px"}}),n(ee,{className:"chevron",sx:Ee,rc:n(a.svg,{}),children:n(a.path,{initial:"down",variants:{down:{d:"M5 9L12 16L19 9"},up:{d:"M5 16L12 9L19 16"}},animate:le?"up":"down",transition:{ease:te.motion.normal.fast.jsEase,duration:te.motion.normal.fast.jsDuration}})})]})}),n(J.Content,{sx:{w:"".concat(q.width,"px"),boxShadow:"base.shadow.500"},children:n(ne,{testId:"".concat(R,"__verticalMenu"),textAlign:C,children:0===he.length?n(ae,{children:n(ae.Label,{children:"No results found"})}):he.map((function(e,t){return n(ae,{domRef:function(e){e&&(O.current[t]=e)},onClick:function(){null==H||H(e),ke(e)},controlledHover:xe===t,onMouseEnter:function(){return ge(t)},children:n(ae.Label,{children:e})},e)}))})})]})}))}kt.displayName="Autocomplete",kt.Icon=xt;var wt=["icon","variant","iconVariant","colorVariant","outerShape","testId","sx"];function It(t){var a=t.icon,s=t.variant,l=void 0===s?"regular":s,u=t.iconVariant,h=void 0===u?"regular":u,p=t.colorVariant,m=void 0===p?"guidance":p,x=t.outerShape,g=void 0===x?"circle":x,v=t.testId,b=t.sx,C=void 0===b?{}:b,L=i(t,wt),k=o(),I=r.useMemo((function(){return function(e,t,n){return"regular"===n?"base.color.fixed.black.1000":"base.color.status.".concat(t,".bright")}(k.base.colorMode,m,l)}),[k,m,l]),y=r.useMemo((function(){return function(e,t,n){return"regular"===n?"base.color.text.status.".concat(t,".primary"):"base.color.fixed.black.1000"}(k.base.colorMode,m,l)}),[k,m,l]),A=r.useMemo((function(){return c({w:"base.icon.size.600",d:"flex",alignItems:"center",justifyContent:"center",position:"relative","&::before":{content:'""',w:"100%",pb:"100%"}},C)}),[C]),S=r.useMemo((function(){return{position:"absolute",top:"0",left:"0",w:"100%",fill:I}}),[I]),M=r.useMemo((function(){return{w:"58.33%",position:"absolute",top:"50%",left:"50%",translate:"-50% -50%",fill:y}}),[y]);return d(f,e(e({},L),{},{sx:A,testId:v,children:[n(ee,{sx:S,"data-outer-shape":g,testId:"".concat(v,"__outerShape"),viewBox:"0 0 24 24",children:"circle"===g?n("circle",{cx:"12",cy:"12",r:"11"}):n("path",{d:"M7.65076 1.5L16.3492 1.5L22.5 7.65076V16.3492L16.3492 22.5H7.65076L1.5 16.3492L1.5 7.65076L7.65076 1.5Z"})}),n(w,{icon:a,sx:M,variant:h,testId:"".concat(v,"__icon")})]}))}It.displayName="DuoCon";var yt={position:"relative",minWidth:re,flexShrink:0,borderRadius:"base.borderRadius.x4",transitionProperty:"box-shadow, background",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase"},At={appearance:"none",width:"100%",minWidth:"100%",maxWidth:"100%",border:"none",borderRadius:"base.borderRadius.x4",fontFamily:"base.font.family.body.primary",fontSize:"base.text.body.medium.regular.fontSize",lineHeight:"base.text.body.medium.regular.lineHeight",fontWeight:"base.text.body.medium.regular.fontWeight",background:"transparent",padding:"0",color:"base.color.text.body.primary","&::-webkit-outer-spin-button, &::-webkit-inner-spin-button":{display:"none"},"&::placeholder":{color:"base.color.text.body.secondary"},"&:not(:disabled):focus":{outline:"none"}};function St(e){return{textAlign:e.textAlign}}var Mt=function(t){return se(e(e({},t),{},{renderSxAtSize:St}))},zt={padding:"0",display:"flex",alignItems:"center",justifyContent:"center",position:"absolute",right:"base.spacing.x3"};function Bt(e){var t=e.validationStatus,n=e.theme,a=e.hasValue,i=e.size,o=n.base.spacing.x3,r="large"===i?n.base.spacing.x5:n.base.spacing.x3,s=o,l="calc(".concat(o," + (").concat(o," * 2))"),c=n.base.shadow[300],d="0 0 0 rgba(0,0,0,0)";return{paddingY:r,paddingLeft:s,paddingRight:l,background:a?n.base.color.translucent.emphasis[200]:n.base.color.translucent.emphasis[100],boxShadow:"error"===t?"".concat(d,", inset 0 0 0 ").concat(n.base.border.size[100]," ").concat(n.base.color.status.fatal.bright):a?"".concat(d,", inset 0 0 0 ").concat(n.base.border.size[100]," ").concat(n.base.color.translucent.standard[800]):"".concat(d,", inset 0 0 0 ").concat(n.base.border.size[100]," ").concat(n.base.color.translucent.standard[500]),"&:not(.disabled):hover":{background:a?n.base.color.translucent.emphasis[300]:n.base.color.translucent.emphasis[200],boxShadow:"error"===t?"".concat(c,", inset 0 0 0 ").concat(n.base.border.size[100]," ").concat(n.base.color.status.fatal.bright):"".concat(c,", inset 0 0 0 ").concat(n.base.border.size[100]," ").concat(n.base.color.translucent.standard[800])},"&:not(.disabled).focused":{outline:"none",background:n.base.color.translucent.emphasis[300],boxShadow:"error"===t?"".concat(c,", inset 0 0 0 ").concat(n.base.border.size[200]," ").concat(n.base.color.status.fatal.bright):"".concat(c,", inset 0 0 0 ").concat(n.base.border.size[200]," ").concat(n.base.color.brand[1])}}}var Et=function(t){return se(e(e({},t),{},{renderSxAtSize:Bt}))};function Vt(e){var t=e.size,n=e.theme;return{top:"large"===t?n.base.spacing.x6:n.base.spacing.x4}}var Ht=function(t){return se(e(e({},t),{},{renderSxAtSize:Vt}))},_t=["onClick","domRef","textAreaRef","placeholder","testId","name","id","children","className","validationStatus","onChange","onClearValue","value","hideClearValueButton","rc","defaultValue","disabled","rows","sizeVariant","textAlign","sx"];function Nt(t){var a=t.onClick,l=t.domRef,u=t.textAreaRef,h=void 0===u?{current:null}:u,p=t.placeholder,x=t.testId,v=void 0===x?"TextArea":x,b=t.name,C=t.id,L=void 0===C?b:C;t.children;var k=t.className,w=t.validationStatus,I=t.onChange,y=t.onClearValue,S=t.value,M=t.hideClearValueButton,B=t.rc,E=t.defaultValue,V=void 0===E?"":E,H=t.disabled,_=t.rows,N=void 0===_?5:_,T=t.sizeVariant,F=void 0===T?oe:T,D=t.textAlign,j=void 0===D?le:D,W=t.sx,Z=void 0===W?{}:W,$=i(t,_t),P=A(h),O=r.useState("number"==typeof S?S.toString():"string"==typeof S?S:V),Q=s(O,2),q=Q[0],U=Q[1],X=r.useCallback((function(){return void 0!==S?null==y?void 0:y():(P.current&&(P.current.value="",P.current.focus()),null==I||I({type:"change",target:null==P?void 0:P.current}),U(""),null==y||y(),!1)}),[P,I,S,y,U]),G=r.useCallback((function(e){void 0===S&&U(e.target.value),null==I||I(e)}),[U,I,S]),K=null!=S?S:q,Y=o(),J=z(F,oe,ie),ee=c(yt,Bt({validationStatus:w,size:J,theme:Y,hasValue:Boolean(K)}),Et({validationStatus:w,size:F,theme:Y,hasValue:Boolean(K)}),Z),te=c(At,St({textAlign:j,theme:Y,size:J}),Mt({textAlign:j,theme:Y,size:F})),ne=R(te),ae=c(zt,Vt({theme:Y,size:J}),Ht({theme:Y,size:F})),re=r.useState(!1),se=s(re,2),ce=se[0],de=se[1];return n(g,{children:function(t){var i=t.cx;return d(f,{rc:B,domRef:l,className:i("".concat(null!=k?k:""," TextArea"),{disabled:H,focused:ce}),testId:v,sx:ee,"data-validation-status":w,onClick:function(e){var t;null==a||a(e),null===(t=P.current)||void 0===t||t.focus()},children:[n("textarea",e(e({},$),{},{rows:N,disabled:H,name:b,ref:P,"data-testid":"".concat(v,"__textarea"),onChange:G,value:K,id:L,placeholder:p,css:ne,onFocus:function(e){var t;de(!0),null===(t=$.onFocus)||void 0===t||t.call($,e)},onBlur:function(e){var t;de(!1),null===(t=$.onBlur)||void 0===t||t.call($,e)}})),n(m,{children:K&&!M&&n(lt,{sx:ae,disabled:H,onClick:X,testId:"".concat(v,"__clearValueButton")})})]})}})}Nt.displayName="TextArea";var Tt=["children"];function Ft(t){var a=t.children,o=i(t,Tt);return n(f,e(e({},o),{},{children:a}))}Ft.displayName="Tooltip.Content";var Rt=["children"];function Dt(t){var a=t.children,o=i(t,Rt);return n(p,e(e({},o),{},{children:a}))}Dt.displayName="Tooltip.Target";var jt=["id","children","size","domRef"];function Wt(t){var a=t.id,o=t.children,c=t.size,d=void 0===c?fe:c,u=t.domRef,h=void 0===u?{current:null}:u,m=i(t,jt),f=A(h),x=r.useId(),g=a||x,v=l(o,Dt),b=l(o,Ft),C=ce((function(e){return e})).dispatchAction,L=r.useState(""),k=s(L,2),w=k[0],I=k[1];r.useEffect((function(){C({type:de,payload:{id:g,content:b}})}),[b,g,C]),X((function(){return I(g),function(){return C({type:ue,payload:{id:g}})}}),[]),r.useEffect((function(){w&&he(f.current,w,!0)}),[w,f,o]),r.useEffect((function(){var e,t=null===(e=f.current)||void 0===e?void 0:e.getBoundingClientRect();C({type:pe,payload:{id:g,size:d,content:b,targetRect:t}})}),[g,d,b,f,C]);var y=r.useCallback((function(){he(f.current,w,!0)}),[w,f]),S=r.useMemo((function(){return{triggerDomRecrawl:y}}),[y]);return v?n(me.Provider,{value:S,children:n(p,e(e({},m),{},{id:g,domRef:f,children:v}))}):null}Wt.displayName="Tooltip",Wt.Target=Dt,Wt.Content=Ft;var Zt=["value","defaultValue","step","size","onChange","min","max","name","id","minErrorText","maxErrorText","testId","textAlign","validationStatus","className"],$t={name:"eivff4",styles:"display:none"};function Pt(t){var a=t.value,o=t.defaultValue,l=void 0===o?"0":o,c=t.step,u=void 0===c?"1":c,p=t.size,m=t.onChange,f=t.min,g=t.max,v=t.name,b=t.id,C=void 0===b?v:b,L=t.minErrorText,k=void 0===L?"Minimum value reached":L,w=t.maxErrorText,I=void 0===w?"Maximum value reached":w,y=t.testId,A=void 0===y?"NumberStepper":y;t.textAlign,t.validationStatus;var S=t.className,M=i(t,Zt),z=r.useRef(null),B="string"==typeof a,E=r.useState(B?a:l),V=s(E,2),H=V[0],_=V[1],N=null!=a?a:H,T=r.useMemo((function(){return N===f}),[f,N]),F=r.useMemo((function(){return N===g}),[g,N]),R=r.useCallback((function(){if(B){var e,t,n;null===(e=z.current)||void 0===e||e.stepUp(),null==m||m(null!==(t=null===(n=z.current)||void 0===n?void 0:n.value)&&void 0!==t?t:""),z.current&&(z.current.value=a)}else{var i,o,r,s,l;if(F)return;null===(i=z.current)||void 0===i||i.stepUp(),_(null!==(o=null===(r=z.current)||void 0===r?void 0:r.value)&&void 0!==o?o:""),null==m||m(null!==(s=null===(l=z.current)||void 0===l?void 0:l.value)&&void 0!==s?s:"")}}),[F,B,m,a]),D=r.useCallback((function(){if(B){var e,t,n;null===(e=z.current)||void 0===e||e.stepDown(),null==m||m(null!==(t=null===(n=z.current)||void 0===n?void 0:n.value)&&void 0!==t?t:""),z.current&&(z.current.value=a)}else{var i,o,r,s,l;if(T)return;null===(i=z.current)||void 0===i||i.stepDown(),_(null!==(o=null===(r=z.current)||void 0===r?void 0:r.value)&&void 0!==o?o:""),null==m||m(null!==(s=null===(l=z.current)||void 0===l?void 0:l.value)&&void 0!==s?s:"")}}),[T,B,m,a]),j=n(h,{size:p,icon:"Add",variant:"tertiary",onClick:R,testId:"".concat(A,"__incrementBtn")}),W=n(h,{size:p,icon:"Minus",variant:"tertiary",onClick:D,testId:"".concat(A,"__decrementBtn")});return d(x,e(e({},M),{},{direction:"row",alignItems:"center",className:"".concat(null!=S?S:""," NumberStepper"),testId:A,children:[T?d(Wt,{size:"small",children:[n(Wt.Target,{children:W}),n(Wt.Content,{testId:"".concat(A,"__tooltipContent"),children:k})]}):W,n($,{testId:"".concat(A,"__value"),children:N}),n("input",{type:"number",name:v,id:C,value:N.toString(),ref:z,step:u,css:$t,onChange:B?m:xe,"data-testid":"".concat(A,"__input")}),F?d(Wt,{size:"small",children:[n(Wt.Target,{children:j}),n(Wt.Content,{testId:"".concat(A,"__tooltipContent"),children:I})]}):j]}))}Pt.displayName="NumberStepper";var Ot=["size","children","testId","sx","textAlign"];function Qt(t){var a=t.size,o=void 0===a?"small":a,r=t.children,s=t.testId,l=t.sx,d=void 0===l?{}:l,u=t.textAlign,h=void 0===u?q:u,p=i(t,Ot);return n($,e(e({},p),{},{testId:s,rc:n("span",{}),size:o,sx:c({marginBottom:"base.spacing.x2",color:"base.color.text.body.secondary",textAlign:h},d),children:r}))}Qt.displayName="FormControlCaption";var qt=["size","children","testId","sx","textAlign"];function Ut(t){var a=t.size,o=void 0===a?"small":a,r=t.children,s=t.testId,l=t.sx,d=void 0===l?{}:l,u=t.textAlign,h=void 0===u?q:u,p=i(t,qt);return n($,e(e({},p),{},{testId:s,rc:n("label",{}),size:o,sx:c({color:"base.color.text.body.primary",textAlign:h,cursor:"pointer"},d),children:r}))}Ut.displayName="FormControlLabel";var Xt=["size","children","validationStatus","testId","sx","textAlign"];function Gt(t){var a=t.size,o=void 0===a?"small":a,s=t.children,l=t.validationStatus,u=t.testId,h=t.sx,p=void 0===h?{}:h,m=t.textAlign,f=void 0===m?q:m,x=i(t,Xt),g=e(e({marginTop:"-1px",order:"right"===f?1:0},"right"===f?{ml:"base.spacing.x1"}:{mr:"base.spacing.x1"}),{},{width:"base.icon.size.250"}),v=r.useMemo((function(){switch(l){case"error":return"fatal";case"success":return"success";default:return"guidance"}}),[l]),b=r.useMemo((function(){switch(l){case"error":return"Exclamation";case"success":return"Tick";default:return"Information"}}),[l]);return d($,e(e({},x),{},{rc:n("span",{}),size:o,testId:u,sx:c({color:"base.color.brand.4",display:"flex",alignItems:"center",flexGrow:1,justifyContent:"right"===f?"flex-end":"flex-start"},p),children:[n(It,{icon:b,sx:g,variant:"bold",iconVariant:"bold",colorVariant:v}),s]}))}Gt.displayName="FormControlValidation";var Kt=["domRef","sx","id","testId","children","validationStatus","textAlign"],Yt=[Nt,Ct,be,Ce,Le,ge,kt,Pt];function Jt(t){var a=t.domRef,o=t.sx,s=void 0===o?{}:o,u=t.id,h=t.testId,m=t.children,x=t.validationStatus,g=t.textAlign,v=void 0===g?q:g,C=i(t,Kt),L=r.useId(),k=u||L,w=l(m,Ut),I=l(m,Qt),y=l(m,Gt),A=r.useMemo((function(){return b(m)}),[m]).find((function(e){return Yt.some((function(t){return r.isValidElement(e)&&e.type===t}))})),S=r.isValidElement(A)&&(A.type===Nt||A.type===Ct||A.type===ge||A.type===kt||A.type===Pt);return n(f,e(e({},C),{},{domRef:a,testId:h,sx:c({display:"flex",flexDirection:S?"column":"row",gap:"base.spacing.x1"},s),children:d(ve,S?{children:[w&&n(p,{textAlign:w.props.textAlign||v,htmlFor:k,children:w}),A&&n(p,{textAlign:A.props.textAlign||v,id:k,validationStatus:A.props.validationStatus||x,children:A}),I&&n(p,{textAlign:I.props.textAlign||v,htmlFor:k,children:I}),y&&n(p,{htmlFor:k,textAlign:y.props.textAlign||v,validationStatus:y.props.validationStatus||x,children:y})]}:{children:[d(f,{sx:{d:"flex",flexDirection:"column",justifyContent:"center"},children:[w&&n(p,{textAlign:w.props.textAlign||v,htmlFor:k,children:w}),I&&n(p,{htmlFor:k,textAlign:I.props.textAlign||v,children:I}),y&&n(p,{htmlFor:k,textAlign:y.props.textAlign||v,validationStatus:y.props.validationStatus||x,children:y})]}),A&&n(p,{id:k,validationStatus:A.props.validationStatus||x,sx:c(e({order:"left"===v?"-1":"1"},"left"===v?{mr:"base.spacing.x2"}:{ml:"base.spacing.x2"}),e({},A.props.sx)),children:A})]})}))}function en({visible:e,targetChainId:t,provider:a,checkout:i,onCloseDrawer:o,onNetworkSwitch:s}){const{t:l}=ke(),c=we(i.config.environment??Ie.PRODUCTION,"/switchnetworkethereum.png"),u=we(i.config.environment??Ie.PRODUCTION,"/switchnetworkzkevm.png"),p=ye(t),m=t===Ae(i.config),x=r.useCallback((async()=>{if(!i)return;const e=await i.switchNetwork({provider:a,chainId:t});s&&s(e.provider)}),[i,a,s,t]),g=Se(a),v=r.useMemo((()=>g?a.provider?.session?.peer?.metadata?.name:""),[a,g]),b=r.useMemo((()=>v?.toLowerCase().includes("metamask")),[v]),C=r.useMemo((()=>Me(a)?"MetaMask wallet":g&&v?v:"wallet"),[a,g,v]),L=g&&b;return r.useEffect((()=>{(new Image).src=c;(new Image).src=u}),[]),n(Ve,{size:"threeQuarter",visible:e,onCloseDrawer:o,showHeaderBar:!1,children:d(Ve.Content,{sx:{display:"flex",flexDirection:"column",justifyContent:"space-between",alignItems:"center"},children:[n(ze,{aspectRatio:"21:9",responsiveSizes:[450,512,640,720,860,1024,1280,1440],imageUrl:m?c:u}),n(h,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:o}),d(f,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:"base.spacing.x4",paddingX:"base.spacing.x6"},children:[n(Be,{size:"small",weight:"bold",sx:{textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.heading",{wallet:C})}),L&&n($,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.manualSwitch.body",{chain:p})}),!L&&n($,{size:"medium",weight:"regular",sx:{color:"base.color.text.body.secondary",textAlign:"center",paddingX:"base.spacing.x6"},children:l("drawers.networkSwitch.controlledSwitch.body",{chain:p})})]}),d(f,{sx:{display:"flex",flexDirection:"column",paddingX:"base.spacing.x4",width:"100%"},children:[!L&&n(I,{size:"large",variant:"primary",sx:{width:"100%",marginBottom:"base.spacing.x2"},onClick:x,children:l("drawers.networkSwitch.switchButton",{chain:p})}),n(Ee,{})]})]})})}function tn({testId:e,children:t,subtext:a,textAlign:i,isErrored:o,errorMessage:r,sx:s}){return d(Jt,{testId:e,textAlign:i??"left",validationStatus:o?"error":"success",sx:s,children:[t,a&&n(Jt.Caption,{testId:`${e}-subtext`,children:a}),o&&n(Jt.Validation,{testId:`${e}-error`,children:r})]})}function nn({onClick:e,icon:t,name:a,symbol:i,balance:o,defaultTokenImage:r,testId:s,id:l}){const{t:c}=ke();return d(ae,{testId:`${s}-coin-selector__option-${l}`,emphasized:!0,size:"small",onClick:e,children:[!t&&n(ae.Icon,{icon:"Coins",variant:"bold"}),t&&n(ae.FramedImage,{imageUrl:t,circularFrame:!0,defaultImageUrl:r}),n(ae.Label,{children:a}),n(ae.Caption,{children:i}),o&&n(ae.PriceDisplay,{fiatAmount:`${c("drawers.coinSelector.option.fiatPricePrefix")}${o.formattedFiatAmount}`,price:o.formattedAmount})]})}Jt.displayName="FormControl",Jt.Label=Ut,Jt.Validation=Gt,Jt.Caption=Qt;const an={display:"flex",flexDirection:"column",gap:"2px",paddingX:"base.spacing.x4",paddingBottom:"base.spacing.x4"},on={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function rn({heading:e,options:t,defaultTokenImage:a,optionsLoading:i,children:o,onCloseDrawer:r,visible:s}){const{t:l}=ke();return d(Ve,{headerBarTitle:e,size:"full",onCloseDrawer:r,visible:s,children:[n(Ve.Target,{children:o}),n(Ve.Content,{children:d(f,{sx:an,children:[i&&0===t.length&&d(f,{sx:on,children:[n(ae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),n(ae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),n(ae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!i&&0===t.length&&n($,{sx:{padding:"base.spacing.x4"},children:l("drawers.coinSelector.noCoins")}),!i&&t.map((({onClick:e,icon:t,name:i,symbol:o,balance:r,id:s,testId:l})=>n(nn,{id:s,testId:l,onClick:e,icon:t,name:i,symbol:o,balance:r,defaultTokenImage:a},`${o}-${i}`)))]})})]})}function sn({testId:e,options:t,optionsLoading:a,subtext:i,onSelectChange:o,textAlign:s,errorMessage:l,disabled:c,selectedOption:u,coinSelectorHeading:h,defaultTokenImage:p}){const[m,x]=r.useState(!1),g=r.useMemo((()=>t.map((t=>({...t,testId:e,onClick:()=>{o(t.id),x(!1)}})))),[t,o,x]);return d(f,{children:[n(rn,{heading:h,options:g,defaultTokenImage:p,optionsLoading:a??!1,visible:m,onCloseDrawer:()=>x(!1)}),n(tn,{testId:`${e}-select-control`,textAlign:s??"left",subtext:l?void 0:i,isErrored:!!l,errorMessage:l,children:n(ge,{testId:`${e}-select`,size:"large",defaultLabel:"Select coin",targetClickOveride:()=>x(!0),selectedOption:(()=>{if(u&&0!==t.length&&t.find((e=>e.id===u)))return u})(),sx:{minw:"170px"},children:t.filter((e=>e.id===u))?.map((e=>d(He,{optionKey:e.id,testId:e.testId,disabled:c,children:[!e.icon&&n(He.Icon,{icon:"Coins",variant:"bold"}),e.icon&&n(He.FramedImage,{imageUrl:e.icon,circularFrame:!0,defaultImageUrl:p,sx:{background:"base.color.translucent.standard.100"}}),n(He.Label,{children:e.symbol})]},e.id)))})})]})}function ln({testId:e,value:t,placeholder:a,errorMessage:i,validator:o,onTextInputChange:r,onTextInputBlur:s,onTextInputFocus:l,onTextInputEnter:c,textAlign:d,type:u,subtext:h,maxButtonClick:p,disabled:m}){return n(tn,{testId:`${e}-text-control`,textAlign:d??"left",subtext:i?void 0:h,isErrored:!!i,errorMessage:i,sx:{width:"100%"},children:n(Ct,{testId:`${e}-text`,onChange:e=>((e,t)=>{let n=e.target.value;"number"===u&&"."===n&&(n="0."),o(n)?r(n):r(t??"")})(e,t),sizeVariant:"large",value:t,validationStatus:i?"error":"success",placeholder:a,onBlur:e=>{if(!s)return;const t=e.target.value;o(t)&&s(t)},onFocus:e=>{if(!l)return;const t=e.target.value;o(t)&&l(t)},onKeyDown:e=>{c&&"Enter"===e.key&&c()},disabled:m,hideClearValueButton:!0,sx:{minWidth:"100%"},children:p&&n(Ct.Button,{testId:`${e}-max-button`,onClick:p,disabled:m,children:"max"})})})}const cn={display:"flex",flexDirection:"column",height:"100%",padding:"16px 16px 0 16px"},dn={display:"flex",flexDirection:"column",gap:"10px",height:"100%"},un={display:"flex",width:"100%"},hn=e=>({width:"50%",color:e?"base.color.text.body.primary":"base.color.text.body.secondary"}),pn={width:"50%"},mn={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"};function fn({boldLabel:e,label:t,amount:a,fiatAmount:i,tokenSymbol:o,prefix:r=""}){const s=t.toLowerCase().replace(" ","-");return d(f,{sx:un,testId:`fee-item-${s}`,children:[n($,{sx:hn(e),children:t}),n(_e,{testId:s,sx:pn,price:`${r}${o} ${a}`,fiatAmount:i})]})}function xn({fees:e,children:t,visible:a,onCloseDrawer:i,totalFiatAmount:o,totalAmount:r,tokenSymbol:s,loading:l=!1}){const{t:c}=ke();return d(Ve,{headerBarTitle:c("drawers.feesBreakdown.heading"),size:"threeQuarter",onCloseDrawer:i,visible:a,children:[n(Ve.Target,{children:t}),d(Ve.Content,{testId:"fees-breakdown-content",sx:cn,children:[d(f,{sx:dn,children:[l&&d(f,{sx:mn,children:[n(ae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),n(ae,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"})]}),!l&&e.map((({label:e,amount:t,fiatAmount:a,prefix:i})=>n(fn,{label:e,amount:t,fiatAmount:a,tokenSymbol:s,prefix:i},e))),r&&d(ve,{children:[n(L,{size:"xSmall"}),n(fn,{label:c("drawers.feesBreakdown.total"),amount:Ne(r),fiatAmount:o?`~ ${c("drawers.feesBreakdown.fees.fiatPricePrefix")}${o}`:Te("0"),tokenSymbol:s,boldLabel:!0},c("drawers.feesBreakdown.total"))]})]}),n(Ee,{})]})]})}const gn={backgroundColor:"base.color.translucent.emphasis.100"},vn={marginBottom:"base.spacing.x4",color:"base.color.text.body.secondary"};function bn({gasFeeValue:e,gasFeeToken:t,gasFeeFiatValue:a,fees:i,onFeesClick:o,loading:s,sx:l}){const[c,u]=r.useState(!1),{t:h}=ke();if(!e&&!s)return n(f,{});const p=Te(Ne(e)),m=t?.symbol;return d(ve,{children:[d(rt,{targetClickOveride:()=>{u(!0),o?.()},sx:{...gn,paddingBottom:"base.spacing.x2",...l},children:[n(rt.TargetLeftSlot,{children:n($,{size:"medium",sx:vn,children:h("drawers.feesBreakdown.heading")})}),d(rt.TargetRightSlot,{children:[s&&n(f,{sx:{width:"218px",position:"relative"},children:n(f,{sx:{display:"block",position:"absolute",top:"-15px",width:"100%",height:"68px",WebkitMaskPosition:"right center",WebkitMaskRepeat:"no-repeat",WebkitMaskSize:"contain",WebkitMaskImage:'url(\'data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="196" height="96"><path d="M182.85 55.2Q181.65 54 180 54h-56q-1.7 0-2.85 1.2Q120 56.35 120 58v4q0 1.7 1.15 2.85Q122.3 66 124 66h56q1.65 0 2.85-1.15Q184 63.7 184 62v-4q0-1.65-1.15-2.8m0-22Q181.65 32 180 32H68q-1.7 0-2.85 1.2Q64 34.35 64 36v8q0 1.7 1.15 2.85Q66.3 48 68 48h112q1.65 0 2.85-1.15Q184 45.7 184 44v-8q0-1.65-1.15-2.8Z" id="a"/></svg>\')'},rc:n("span",{}),children:n(Fe,{rc:n("span",{})})})}),!s&&n(_e,{testId:"fees-gas-fee__priceDisplay",fiatAmount:`~ ${h("drawers.feesBreakdown.fees.fiatPricePrefix")}${a}`,price:`~ ${m} ${Te(Ne(p))}`})]})]}),n(xn,{tokenSymbol:m??"",fees:i,visible:c,loading:s,onCloseDrawer:()=>u(!1)})]})}const Cn={display:"flex",flexDirection:"column",alignItems:"center",paddingY:"50px",paddingX:"base.spacing.x4",height:"100%"},Ln={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"15px"},kn={display:"flex",flexDirection:"column",justifyContent:"flex-end",gap:"8px",height:"100%",width:"100%"},wn={width:"100%",height:"64px"};function In({onCloseDrawer:e,visible:t,showHeaderBar:a,onRetry:i}){const{t:o}=ke();return n(Ve,{headerBarTitle:void 0,size:"full",onCloseDrawer:e,visible:t,showHeaderBar:a,children:n(Ve.Content,{children:d(f,{sx:Cn,children:[n(It,{icon:"Information",colorVariant:"guidance",iconVariant:"bold"}),d(Be,{size:"small",sx:Ln,testId:"transaction-rejected-heading",children:[o("drawers.transactionFailed.content.heading1"),n("br",{}),o("drawers.transactionFailed.content.heading2")]}),d($,{sx:Ln,children:[o("drawers.transactionFailed.content.body1"),n("br",{}),o("drawers.transactionFailed.content.body2")]}),d(f,{sx:kn,children:[n(I,{sx:wn,variant:"tertiary",onClick:i,children:o("drawers.transactionFailed.buttons.retry")}),n(I,{sx:wn,variant:"tertiary",onClick:e,testId:"transaction-rejected-cancel-button",children:o("drawers.transactionFailed.buttons.cancel")})]})]})})})}function yn(){return n(f,{testId:"wallet-approve-hero",sx:{...Re,background:"base.color.translucent.emphasis.100"},children:n(f,{sx:{...De,...je},children:d("svg",{width:"430",height:"305",viewBox:"0 0 430 305",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[n("path",{d:"M227.517 171.325L182.178 85.6034C181.033 83.4446 179.583 82.3652 178.156 82.3652C175.711 82.3652 174.322 84.1157 172.863 86.6218L137.285 164.056L183.689 253.776L227.522 171.32L227.517 171.325Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M226.841 137.597C228.497 133.997 228.338 128.188 226.484 124.682L197.866 70.5767C196.012 67.0757 193.14 67.1508 191.484 70.7503L164.936 128.427L168.399 134.936L165.396 141.464L168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992L165.846 154.52L169.3 161.048L166.287 167.562L187.922 208.465C189.776 211.966 192.648 211.891 194.304 208.292L226.845 137.597H226.841Z",fill:"#F191FA"}),n("path",{d:"M168.85 147.992L165.396 141.464L168.399 134.936L164.936 128.427L191.484 70.7503C193.14 67.1508 196.012 67.0757 197.866 70.5767L226.484 124.682C228.338 128.188 228.497 133.997 226.841 137.597H226.845L194.304 208.292C192.648 211.891 189.776 211.966 187.922 208.465L166.287 167.562L169.3 161.048L165.846 154.52L168.85 147.992ZM168.85 147.992L171.853 141.464L175.307 147.992L172.304 154.52L168.85 147.992Z",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M159.384 154.519L155.93 147.991L158.939 141.463L162.388 147.991L159.384 154.519Z",fill:"#F191FA"}),n("path",{d:"M203.136 132.773C202.484 134.19 201.353 134.223 200.621 132.843L196.101 124.297C195.369 122.917 195.308 120.627 195.961 119.21L200.621 109.082C201.273 107.665 202.404 107.632 203.136 109.012L207.656 117.558C208.388 118.938 208.449 121.228 207.796 122.645L203.136 132.773Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M206.22 114.837L204.68 118.183C204.174 119.286 203.291 119.309 202.724 118.234L199.345 111.852",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M197.542 127.015L199.058 123.716C199.565 122.613 200.447 122.589 201.015 123.664L204.394 130.046",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M293.369 250.453L252.263 172.733C249.936 168.331 243.957 164.731 238.982 164.731H173.769C171.516 164.731 169.306 164.14 167.358 163.014L162.876 160.423C160.929 159.297 158.718 158.706 156.466 158.706H147.896L141.237 164.534L189.659 256C190.612 257.493 192.452 258.417 194.939 258.417L287.456 258.445L291.473 260.904L293.904 255.733H293.895C294.556 254.315 294.449 252.471 293.379 250.448L293.369 250.453Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M232.923 169.903L235.354 164.731",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),n("path",{d:"M249.832 177.908C247.505 173.506 241.526 169.907 236.551 169.907L142.025 169.878C139.355 169.878 137.436 168.813 136.549 167.128L186.313 261.185C187.266 262.677 189.105 263.602 191.592 263.602L286.118 263.63C291.098 263.63 293.266 260.03 290.938 255.633L249.832 177.913V177.908Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M255.328 198.77L245.041 179.313C243.581 176.548 240.235 174.042 237.161 174.042L143.555 173.93",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M188.64 259.548L282.448 259.558C285.569 259.558 286.418 257.577 285.198 255.264L276.103 238.064",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M150.238 159.776C150.965 161.151 149.539 163.338 147.051 164.652C144.564 165.966 141.96 165.919 141.227 164.539C140.495 163.159 141.927 160.977 144.414 159.663C145.62 159.025 146.854 158.71 147.891 158.71C148.99 158.71 149.863 159.067 150.238 159.776Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M147.826 161.052C148.164 161.69 147.502 162.704 146.348 163.314C145.193 163.924 143.983 163.9 143.645 163.262C143.307 162.624 143.969 161.61 145.123 161C145.681 160.705 146.254 160.559 146.737 160.559C147.249 160.559 147.652 160.723 147.826 161.057V161.052Z",fill:"black"}),n("path",{d:"M171.652 85.828L136.755 161.652C135.788 163.75 135.784 165.669 136.549 167.124C136.549 167.124 137.717 169.874 142.025 169.874C146.333 169.874 151.754 169.907 151.754 169.907L153.115 167.5L143.419 167.467C139.669 167.467 137.637 165.186 139.205 161.779L174.163 85.8233C175.223 83.5238 176.678 82.3646 178.156 82.3646C178.156 82.3646 173.431 81.961 171.652 85.8233V85.828Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M273.579 230.377L277.263 229.767L287.024 238.458L278.347 222.051L270.373 223.609L273.579 230.377Z",fill:"black"}),n("path",{d:"M274.968 235.918C272.495 231.239 272.777 228.33 278.296 226.565C281.262 225.617 283.951 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.049 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495L255.399 206.127L271.073 235.923H274.973L274.968 235.918Z",fill:"#EBE9E9"}),n("path",{d:"M274.968 235.918C272.495 231.239 272.776 228.33 278.295 226.565C281.261 225.617 283.95 224.073 286.255 221.98L291.328 217.371C295.725 213.378 297.048 205.813 294.275 200.561C291.497 195.31 285.626 194.282 281.233 198.276L275.071 203.874C272.983 205.775 270.327 206.939 267.516 207.206C261.79 207.746 259.392 206.456 256.769 201.495",stroke:"black",strokeWidth:"0.469297",strokeMiterlimit:"10"}),n("path",{d:"M289.926 200.125C287.265 199.276 284.074 201.829 282.793 205.832C281.512 209.835 282.629 213.768 285.29 214.617L286.533 215.016L291.17 200.524L289.926 200.125Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M293.683 209.321C294.963 205.319 293.846 201.386 291.187 200.535C288.528 199.685 285.335 202.239 284.055 206.241C282.775 210.242 283.892 214.176 286.551 215.026C289.21 215.877 292.403 213.322 293.683 209.321Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M213.26 224.182C211.237 224.182 208.816 222.722 207.868 220.934L189.021 185.301C188.077 183.513 188.955 182.053 190.978 182.053L231.3 182.039C233.322 182.039 235.744 183.499 236.692 185.287L255.539 220.92C256.482 222.708 255.604 224.168 253.582 224.168L213.26 224.182Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M214.334 222.319C212.312 222.319 209.89 220.859 208.942 219.071L190.095 183.438C189.884 183.034 189.767 182.649 189.729 182.292C188.64 182.776 188.302 183.944 189.02 185.301L207.867 220.934C208.811 222.722 211.237 224.182 213.26 224.182L253.582 224.168C255.144 224.168 256.022 223.29 255.9 222.065C255.557 222.22 255.14 222.305 254.652 222.305L214.33 222.319H214.334Z",fill:"#EBE9E9",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M231.586 203.083L233.646 206.978H228.756H223.871H218.981H215.513C214.733 206.978 214.363 207.489 214.691 208.109L215.555 209.737C215.883 210.361 216.794 210.873 217.577 210.873H221.046H225.936L227.395 213.632C227.724 214.256 228.634 214.763 229.418 214.763H231.464C232.243 214.763 232.614 214.252 232.285 213.628L230.826 210.868H235.716H239.184C239.963 210.868 240.334 210.352 240.005 209.732L238.546 206.973L237.086 204.214C236.758 203.589 235.847 203.083 235.063 203.083H231.595H231.586Z",fill:"#F191FA"}),n("path",{d:"M214.855 199.191L216.315 201.951C216.648 202.575 217.554 203.086 218.342 203.086H221.81H226.696H231.586L230.126 200.322C229.793 199.698 228.887 199.187 228.099 199.187H224.631H219.746H214.855V199.191Z",fill:"#F191FA"}),n("path",{d:"M214.986 187.501C214.207 187.501 213.837 188.013 214.165 188.632L215.625 191.392H210.735H207.266C206.487 191.392 206.117 191.903 206.445 192.527L207.905 195.287L209.364 198.046C209.693 198.671 210.603 199.177 211.387 199.177H214.855L212.795 195.282H217.685H222.57H227.46H230.928C231.707 195.282 232.078 194.771 231.75 194.147L230.891 192.523C230.558 191.899 229.652 191.387 228.868 191.387H225.4H220.51L219.051 188.628C218.722 188.003 217.812 187.497 217.028 187.497H214.982L214.986 187.501Z",fill:"#F191FA"}),n("path",{d:"M214.098 243.795L212.428 240.641C211.78 239.412 210.109 238.412 208.725 238.412H202.849L200.428 233.832C199.78 232.602 198.114 231.603 196.725 231.603H191.751C191 231.603 190.483 231.898 190.263 232.363L189.066 234.906L191.464 235.826L192.835 238.417H186.959C186.208 238.417 185.692 238.712 185.471 239.177L184.275 241.721L186.612 242.528L187.288 243.804C187.935 245.034 189.606 246.033 190.99 246.033H196.866L199.287 250.614C199.935 251.843 201.601 252.843 202.99 252.843H205.032L208.256 254.631L209.452 252.087C209.635 251.693 209.607 251.177 209.307 250.614L206.885 246.033H210.194L213.057 247.817L214.253 245.273C214.441 244.879 214.408 244.363 214.108 243.8L214.098 243.795Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.529 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.529 234.146H190.554C189.165 234.146 188.564 235.151 189.212 236.38L191.634 240.961H185.758C184.369 240.961 183.763 241.97 184.416 243.195L186.086 246.348C186.734 247.578 188.405 248.577 189.789 248.577H195.665L198.086 253.158C198.734 254.387 200.4 255.387 201.789 255.387H206.764C208.153 255.387 208.753 254.383 208.106 253.153L205.684 248.573H211.56C212.949 248.573 213.554 247.564 212.902 246.339Z",fill:"black",stroke:"black",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M208.107 253.158L205.685 248.573",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M191.634 240.96H185.758",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M212.902 246.339L211.231 243.185C210.584 241.956 208.913 240.956 207.528 240.956H201.653L199.231 236.376C198.584 235.151 196.918 234.146 195.528 234.146H190.554",stroke:"#EBE9E9",strokeWidth:"0.469297",strokeLinecap:"round",strokeLinejoin:"round"}),n("path",{d:"M356.061 232.632L355.632 231L354 231.429L354.429 233.061L356.061 232.632Z",fill:"white"}),n("path",{d:"M57.6531 168.341L57.1006 166.24L54.9996 166.793L55.5521 168.894L57.6531 168.341Z",fill:"white"}),n("path",{d:"M103.489 244.345L101.345 244L101 246.145L103.144 246.49L103.489 244.345Z",fill:"white"}),n("path",{d:"M341.286 111.905L341.905 110.619L340.619 110L340 111.286L341.286 111.905Z",fill:"white"}),n("path",{d:"M323.144 179.08L322.592 176.979L320.491 177.531L321.043 179.632L323.144 179.08Z",fill:"white"}),n("path",{d:"M328.919 177.658L329.538 176.372L328.252 175.753L327.633 177.039L328.919 177.658Z",fill:"white"}),n("path",{d:"M88.1441 141.383L87.2188 140.296L86.1321 141.221L87.0574 142.308L88.1441 141.383Z",fill:"white"}),n("path",{d:"M258.286 89.9052L258.905 88.6191L257.619 88L257 89.2861L258.286 89.9052Z",fill:"white"})]})})})}const An=async({checkout:e,provider:t,allowTokenListType:n,chainId:a,allowZero:i=!1,retryPolicy:o=Pe})=>{const r=a||(await e.getNetworkInfo({provider:t})).chainId,s=await t.getSigner().getAddress(),l=await Oe((()=>e.getAllBalances({provider:t,walletAddress:s,chainId:r})),{...o});if(void 0===l)return;const c=await e.getTokenAllowList({chainId:r,type:n}),d=new Map;c.tokens.forEach((e=>d.set(e.address?.toLowerCase()||We,!0)));const u=l.balances.filter((e=>!(e.balance.lte(0)&&!i)&&d.get(e.token.address?.toLowerCase()||We))).map((t=>({...t,token:{...t.token,icon:Ze(e.config.environment,$e(t.token.address)?t.token.symbol:t.token.address??"")}})))??[];return c.tokens=c.tokens.map((t=>({...t,icon:Ze(e.config.environment,$e(t.address)?t.symbol:t.address??"")}))),{allowList:c,allowedBalances:u}};export{rt as A,bn as F,en as N,sn as S,ln as T,yn as W,In as a,tn as b,An as g};
|