@imtbl/sdk 1.45.0 → 1.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/blockchain_data.js +2 -2
  2. package/dist/browser/checkout/{BridgeWidget-bbe814fd.js → BridgeWidget-1fe55e1d.js} +1 -1
  3. package/dist/browser/checkout/{OnRampWidget-1cd03821.js → OnRampWidget-b2906496.js} +1 -1
  4. package/dist/browser/checkout/SaleWidget-cb5741e0.js +1 -0
  5. package/dist/browser/checkout/{SpendingCapHero-6e77f245.js → SpendingCapHero-5b467efd.js} +1 -1
  6. package/dist/browser/checkout/{SwapWidget-78d29615.js → SwapWidget-0cf02a7c.js} +1 -1
  7. package/dist/browser/checkout/{TopUpView-816276af.js → TopUpView-742d8a9b.js} +1 -1
  8. package/dist/browser/checkout/{WalletWidget-c3835446.js → WalletWidget-04923baf.js} +1 -1
  9. package/dist/browser/checkout/{auto-track-c6ad18e6.js → auto-track-d8e12e3d.js} +1 -1
  10. package/dist/browser/checkout/{balance-d958d96d.js → balance-2290eaf3.js} +1 -1
  11. package/dist/browser/checkout/{index-c7ef03ad.js → index-1a84a032.js} +1 -1
  12. package/dist/browser/checkout/{index-9bf3a185.js → index-23793c68.js} +2 -2
  13. package/dist/browser/checkout/index-2af5207e.js +1 -0
  14. package/dist/browser/checkout/{index-fda04d5e.js → index-58429539.js} +1 -1
  15. package/dist/browser/checkout/{index-a1e97a3f.js → index-8aaa9aa6.js} +1 -1
  16. package/dist/browser/checkout/{index-702d1385.js → index-b19a05ed.js} +1 -1
  17. package/dist/browser/checkout/{index-51e74135.js → index-d2960e63.js} +1 -1
  18. package/dist/browser/checkout/{index-c78eb20f.js → index-ff545313.js} +1 -1
  19. package/dist/browser/checkout/{index.umd-3937a859.js → index.umd-6b0466d0.js} +1 -1
  20. package/dist/browser/checkout/{retry-fda49d8c.js → retry-52c80d97.js} +1 -1
  21. package/dist/browser/checkout/sdk.js +4 -4
  22. package/dist/browser/checkout/widgets-esm.js +1 -1
  23. package/dist/browser/checkout/widgets.js +1 -1
  24. package/dist/checkout.js +4 -4
  25. package/dist/config.js +1 -1
  26. package/dist/index.browser.js +4 -4
  27. package/dist/index.browser.js.map +1 -1
  28. package/dist/index.cjs +10 -8
  29. package/dist/index.js +10 -8
  30. package/dist/minting_backend.js +2 -2
  31. package/dist/orderbook.js +1 -1
  32. package/dist/passport.js +7 -5
  33. package/dist/webhook.js +1 -1
  34. package/dist/x.js +3 -3
  35. package/package.json +1 -1
  36. package/dist/browser/checkout/SaleWidget-6d726c41.js +0 -1
  37. package/dist/browser/checkout/index-ab16b9d8.js +0 -1
@@ -1 +1 @@
1
- import{j as o,ab as e,a as t,ac as n,ad as r,n as i}from"./index-9bf3a185.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{j as o,ab as e,a as t,ac as n,ad as r,n as i}from"./index-23793c68.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{l as e,b7 as t,b8 as o,n as a,b9 as n,a as s,ba as r,j as i,o as d,bb as l,r as c,at as p,V as u,q as m,t as w,d as f,U as y,x as T,p as E,w as g,K as v,L as A,bc as S,a7 as x,bd as h,H as b,be as I,bf as k,Y as C,A as P,aV as R,v as _,bg as F,G as W,bh as O,bi as D,bj as N,bk as L,z as V,aD as B,bl as U,bm as M,bn as q,E as j,$ as G,bo as z,a3 as H,bp as $,aj as J,ae as K,bq as X,ah as Q,ai as Y,T as Z,R as ee,br as te,bs as oe,bt as ae,bu as ne,aL as se,bv as re,bw as ie,ak as de,I as le}from"./index-9bf3a185.js";import{S as ce,T as pe,a as ue,F as me,N as we,W as fe,g as ye}from"./balance-d958d96d.js";import{p as Te,S as Ee,f as ge,C as ve,a as Ae,c as Se,T as xe,b as he}from"./TopUpView-816276af.js";import{u as be}from"./retry-fda49d8c.js";import{S as Ie}from"./SpendingCapHero-6e77f245.js";function ke({theme:c,environment:p}){const{t:u}=e(),m=c===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:l,children:u("footers.quickswapFooter.disclaimerText")})]})}const Ce={exchange:null,walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,allowedTokens:[]};var Pe;!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"}(Pe||(Pe={}));const Re=c.createContext({swapState:Ce,swapDispatch:()=>{}});Re.displayName="SwapContext";const _e=(e,t)=>{switch(t.payload.type){case Pe.SET_EXCHANGE:return{...e,exchange:t.payload.exchange};case Pe.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case Pe.SET_NETWORK:return{...e,network:t.payload.network};case Pe.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 Pe.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case Pe.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};default:return e}},Fe={fromAmountIn:async(e,t,o,a,n)=>{const s=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountIn(s,o.address,n.address,p.from(Te(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(Te(a,o.decimals)))}},We={display:"flex",flexDirection:"row",justifyContent:"space-between",columnGap:"base.spacing.x1"},Oe={flex:1},De={flex:2};function Ne({testId:e,options:t,textInputValue:o,textInputPlaceholder:n,textInputValidator:r,textInputType:d,onTextInputChange:l,onTextInputBlur:c,onTextInputFocus:p,textInputTextAlign:u,textInputSubtext:m,textInputErrorMessage:w,testInputMode:f,selectTextAlign:y,selectSubtext:T,selectErrorMessage:E,textInputMaxButtonClick:g,onSelectChange:v,textInputDisabled:A,selectInputDisabled:S,selectedOption:x,coinSelectorHeading:h,defaultTokenImage:b,environment:I,theme:k}){return a(s,{sx:We,children:[i(s,{sx:Oe,children:i(ce,{testId:`${e}-select-form`,options:t,subtext:T,textAlign:y,errorMessage:E,onSelectChange:v,disabled:S,selectedOption:x,coinSelectorHeading:h,defaultTokenImage:b,environment:I,theme:k})}),i(s,{sx:De,children:i(pe,{type:d,testId:`${e}-text-form`,value:o,placeholder:n,subtext:m,textAlign:u,errorMessage:w,validator:r,onTextInputChange:l,onTextInputBlur:c,onTextInputFocus:p,maxButtonClick:g,disabled:A,inputMode:f})})]})}const Le={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"},Ve={width:"base.icon.size.400"};function Be({loading:t,updateLoading:o,validator:n,transaction:r,data:d,insufficientFundsForGas:l,openNotEnoughImxDrawer:S,openNetworkSwitchDrawer:x}){const{t:h}=e(),[b,I]=c.useState(!1),{viewDispatch:k}=c.useContext(u),{connectLoaderState:C}=c.useContext(m),{checkout:P,provider:R}=C,{track:_}=w(),F=async()=>{const e=n();if(_({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:!l}}),e&&P&&R&&r)if(l)S();else{try{const e=await R.provider.request({method:"eth_chainId",params:[]});if(parseInt(e.toString())!==T(P.config))return void x()}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 k({payload:{type:E.UPDATE_VIEW,view:{type:Ee.APPROVE_ERC20,data:{approveTransaction:r.approval.transaction,transaction:r.swap.transaction,info:r.quote,swapFormInfo:e}}}});const t=await P.sendTransaction({provider:R,transaction:{...r.swap.transaction,gasPrice:g(R)?p.from(0):void 0}});k({payload:{type:E.UPDATE_VIEW,view:{type:Ee.IN_PROGRESS,data:{transactionResponse:t.transactionResponse,swapForm:e}}}})}catch(e){if(console.error(e),o(!1),e.type===v.USER_REJECTED_REQUEST_ERROR)return void I(!0);if(e.type===v.UNPREDICTABLE_GAS_LIMIT)return void k({payload:{type:E.UPDATE_VIEW,view:{type:Ee.PRICE_SURGE,data:d}}});if(e.type===v.TRANSACTION_FAILED||e.type===v.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status)return void k({payload:{type:E.UPDATE_VIEW,view:{type:Ee.FAIL,reason:"Transaction failed",data:d}}});k({payload:{type:E.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}}};return a(s,{sx:Le,children:[i(f,{testId:"swap-button",disabled:t,variant:"primary",onClick:F,size:"large",children:t?i(f.Icon,{icon:"Loading",sx:Ve}):h("views.SWAP.swapForm.buttonText")}),i(ue,{visible:b,showHeaderBar:!1,onCloseDrawer:()=>I(!1),onRetry:()=>{F(),I(!1)}})]})}const Ue={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},Me={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},qe={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},je={width:"100%",height:"base.spacing.x16"},Ge={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"};function ze({environment:t,visible:o,showAdjustAmount:n,hasZeroImx:r,onCloseDrawer:l,onAddCoinsClick:c}){const{t:p}=e(),u=S(t);return i(x,{size:"full",onCloseDrawer:l,visible:o,showHeaderBar:!1,children:i(x.Content,{children:a(s,{testId:"not-enough-gas-bottom-sheet",sx:Ue,children:[i(h,{sx:{w:"base.icon.size.600",h:"base.icon.size.600"},use:i("img",{src:u,alt:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)})}),i(b,{size:"small",sx:Me,testId:"not-enough-gas-heading",children:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)}),i(d,{sx:Me,children:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.body`)}),a(s,{sx:qe,children:[n&&i(f,{testId:"not-enough-gas-adjust-amount-button",sx:je,variant:"tertiary",onClick:l,children:p("drawers.notEnoughImx.buttons.adjustAmount")}),i(f,{testId:"not-enough-gas-add-imx-button",sx:je,variant:"tertiary",onClick:c,children:p("drawers.notEnoughImx.buttons.addMoreImx")}),i(f,{sx:je,variant:"tertiary",onClick:l,testId:"not-enough-gas-cancel-button",children:p("drawers.notEnoughImx.buttons.cancel")})]}),i(s,{sx:Ge,children:i(I,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const He={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x4",paddingX:"base.spacing.x4",height:"100%"},$e={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},Je={display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},Ke={width:"100%",height:"base.spacing.x16",marginBottom:"base.spacing.x16"},Xe={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},Qe={width:"base.icon.size.600",fill:"base.color.status.fatal.bright"};function Ye({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:He,children:[i(k,{icon:"Alert",testId:"unable-to-swap-icon",variant:"bold",sx:Qe}),i(b,{size:"small",sx:$e,testId:"unable-to-swap-heading",children:n("drawers.unableToSwap.heading")}),i(d,{sx:$e,children:n("drawers.unableToSwap.body")}),i(s,{sx:Je,children:i(f,{sx:Ke,variant:"tertiary",onClick:o,testId:"unable-to-swap-cancel-button",children:n("drawers.unableToSwap.buttons.cancel")})}),i(s,{sx:Xe,children:i(I,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const Ze=(e,t=500)=>{const[o,a]=c.useState(e);return c.useEffect((()=>{const o=setTimeout((()=>{a(e)}),t);return()=>{clearTimeout(o)}}),[e,t]),o};class et{static id=0;promiseId=0;promise;isCancelled=!1;onCancel=null;rejectPromise=()=>{};constructor(e){et.id+=1,this.promiseId=et.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 et(((t,o)=>{Promise.all(e.map((e=>e instanceof et?e.promise:e))).then(t,o)}))}then(e,t){return new et(((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 et(((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}}const tt=(e,t,o)=>{const a=[];if(!e.swap)return a;const n=(e,n,s="≈ ")=>{const r=p.from(e?.value??0);if(e&&r.gt(0)){const i=ge(r,e.token.decimals);a.push({label:n,fiatAmount:`≈ ${o("drawers.feesBreakdown.fees.fiatPricePrefix")}${C(i,e.token.symbol||"",t.conversions)}`,amount:`${P(i)}`,prefix:s,token:e.token})}};return e.swap&&e.swap.gasFeeEstimate&&n(e.swap.gasFeeEstimate,o("drawers.feesBreakdown.fees.swapGasFee.label")),e.approval&&e.approval.gasFeeEstimate&&n(e.approval.gasFeeEstimate,o("drawers.feesBreakdown.fees.approvalFee.label")),e.quote?.fees?.forEach((e=>{n(e.amount,o("drawers.feesBreakdown.fees.swapSecondaryFee.label",{amount:e.basisPoints/100+"%"}),"")})),a},ot=(e,t)=>{if(!R(e))return t;const o={...t};return o.swap?.gasFeeEstimate&&(o.swap.gasFeeEstimate.value=p.from(0)),o.approval?.gasFeeEstimate&&(o.approval.gasFeeEstimate.value=p.from(0)),o},at=(e,t)=>{if(!t.quote.fees)return t;const o=t.quote.fees.map((t=>t.amount.token.symbol?t:{...t,amount:{...t.amount,token:{...t.amount.token,symbol:e.address===t.amount.token.address?e.symbol:t.amount.token.symbol}}}));return{...t,quote:{...t.quote,fees:o}}},nt=(e,t)=>{if(!t.quote.amount&&!t.quote.amountWithMaxSlippage)return t;const o={...t.quote.amount,token:{...t.quote.amount.token,symbol:e.address===t.quote.amount.token.address?e.symbol:t.quote.amount.token.symbol}},a={...t.quote.amountWithMaxSlippage,token:{...t.quote.amountWithMaxSlippage.token,symbol:e.address===t.quote.amountWithMaxSlippage.token.address?e.symbol:t.quote.amountWithMaxSlippage.token.symbol}};return{...t,quote:{...t.quote,amount:o,amountWithMaxSlippage:a}}},st=(e,t,o,a,n)=>{const s=o.quote.fees[0],r=t,i=o.quote.amount.token,d=parseFloat(e),l=Te(d.toString(),r.decimals),c=p.from(o.quote.amount.value),u=r.decimals,m=o.quote.amount.token.decimals,w=Math.max(u,m),f=p.from("10").pow(w-u),y=p.from("10").pow(w-m),T=l.mul(f),E=c.mul(y),g=E.div(T),v=E.mod(T),A=p.from("10").pow(w),S=v.mul(A).div(T),x=g.mul(A).add(S),h=_(P(ge(x,w)),!0);return n(a,{fromSymbol:r.symbol,toSymbol:i.symbol,rate:h,fee:(s?.basisPoints??0)/100})};var rt;!function(e){e.FROM="FROM",e.TO="TO"}(rt||(rt={}));const it=(e,t)=>void 0!==e&&(""!==e&&t!==e);let dt;function lt({data:t,theme:o}){const{t:n}=e(),{swapState:{allowedTokens:r,exchange:d,tokenBalances:l,network:f}}=c.useContext(Re),{connectLoaderState:v}=c.useContext(m),{checkout:S,provider:x}=v,h=F(S?.config.environment,o),I=c.useCallback(((e,t)=>W(t)?O:`${e.toLowerCase()}-${t.toLowerCase()}`),[]),{cryptoFiatState:R,cryptoFiatDispatch:j}=c.useContext(ve),{viewDispatch:G}=c.useContext(u),[z,H]=c.useState(rt.FROM),[$,J]=c.useState(!1),{track:K}=w(),[X,Q]=c.useState(t?.fromAmount||""),[Y,Z]=c.useState(""),ee=Ze(X,U),[te,oe]=c.useState(),[ae,ne]=c.useState(""),[se,re]=c.useState(""),[ie,de]=c.useState(0),[le,ce]=c.useState(t?.toAmount||""),[pe,ue]=c.useState(""),fe=Ze(le,U),[ye,Ee]=c.useState(),[xe,he]=c.useState(""),[Ie,ke]=c.useState(""),[Ce,Pe]=c.useState(null),[_e,We]=c.useState(""),[Oe,De]=c.useState(void 0),[Le,Ve]=c.useState(""),[Ue,Me]=c.useState([]),qe=c.useMemo((()=>Ce?tt(Ce,R,n):[]),[Ce,R,n]),[je,Ge]=c.useState(null),[He,$e]=c.useState(""),Je=c.useMemo((()=>Ce&&He&&je?st(He,je,Ce,"views.SWAP.swapForm.conversionRate",n):""),[He,je,Ce,n]),[Ke,Xe]=c.useState(!1),[Qe,lt]=c.useState(!1),[ct,pt]=c.useState(!1);c.useEffect((()=>{if(0===l.length)return;if(!f)return;const e=l.filter((e=>e.balance.gt(0))).map((e=>({id:I(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedAmount:P(e.formattedBalance),formattedFiatAmount:0===R.conversions.size?_(""):C(e.formattedBalance,e.token.symbol||"",R.conversions)}})));Me(e),t?.fromTokenAddress&&!te&&(oe(r.find((e=>W(e.address)&&t?.fromTokenAddress?.toLowerCase()===O||e.address?.toLowerCase()===t?.fromTokenAddress?.toLowerCase()))),ne(l.find((e=>W(e.token.address)&&t?.fromTokenAddress?.toLowerCase()===O||e.token.address?.toLowerCase()===t?.fromTokenAddress?.toLowerCase()))?.formattedBalance??"")),it(t?.toTokenAddress,t?.fromTokenAddress)&&!ye&&Ee(r.find((e=>W(e.address)&&t?.toTokenAddress?.toLowerCase()===O||e.address?.toLowerCase()===t?.toTokenAddress?.toLowerCase())))}),[l,r,R.conversions,t?.fromTokenAddress,t?.toTokenAddress,oe,ne,Ee,Me,I,_,f]);const ut=c.useMemo((()=>r.map((e=>({id:I(e.symbol,e.address),name:e.name,symbol:e.symbol,icon:e.icon})))),[r,te]);c.useEffect((()=>{j({payload:{type:Ae.SET_TOKEN_SYMBOLS,tokenSymbols:r.map((e=>e.symbol))}})}),[j,r]);const mt=()=>{Z(""),re(""),ue(""),he("")},wt=()=>{dt&&dt.cancel(),$e(""),Ge(null),Ve(""),Pe(null)},ft=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!te&&(!!ye&&(!t||!$)))),yt=async(e=!1)=>{ft(X,e)&&(dt&&dt.cancel(),e||J(!0),await(async(e=!1)=>{if(x&&d&&te&&ye){try{const e=Fe.fromAmountIn(d,x,te,X,ye),t=et.all([e]);dt=t;const o=await t;let a=ot(x,o[0]);a=at(te,a),a=nt(ye,a);const n=a.swap.gasFeeEstimate;let s=p.from(n?.value||0);a.approval?.gasFeeEstimate&&(s=s.add(a.approval.gasFeeEstimate.value));const i=ge(s,q),l=n?.token,c=r.find((e=>e.address?.toLocaleLowerCase()===l?.address?.toLocaleLowerCase()));Ge(te),$e(X),Pe(a),We(i),De({name:c?.name||"",symbol:c?.symbol||"",decimals:c?.decimals||0,address:c?.address,icon:c?.icon}),Ve(C(i,c?.symbol||"",R.conversions)),ce(_(P(ge(a.quote.amount.value,a.quote.amount.token.decimals),a.quote.amount.token.decimals))),mt()}catch(e){e.cancelled||(console.error("Error fetching quote.",e),wt(),Xe(!1),lt(!0))}e||J(!1)}})(e))},Tt=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!te&&(!!ye&&(!t||!$)))),Et=async(e=!1)=>{Tt(le,e)&&(dt&&dt.cancel(),e||J(!0),await(async(e=!1)=>{if(x&&d&&te&&ye){try{const e=Fe.fromAmountOut(d,x,ye,le,te),t=et.all([e]);dt=t;const o=await t;let a=ot(x,o[0]);a=at(te,a);const n=a.swap.gasFeeEstimate;let s=p.from(n?.value||0);a.approval?.gasFeeEstimate&&(s=s.add(a.approval.gasFeeEstimate.value));const i=ge(s,q),l=n?.token,c=r.find((e=>e.symbol===l?.symbol));Ge(ye),$e(le),Pe(a),We(i),De({name:c?.name||"",symbol:c?.symbol||"",decimals:c?.decimals||0,address:c?.address,icon:c?.icon}),Ve(C(i,c?.symbol||"",R.conversions)),Q(_(P(ge(a.quote.amount.value,a.quote.amount.token.decimals)))),mt()}catch(e){e.cancelled||(wt(),Xe(!1),lt(!0))}e||J(!1)}})(e))},gt=async(e=!1)=>{z===rt.FROM?await yt(e):await Et(e)};be((()=>gt(!0)),D),c.useEffect((()=>{if(z===rt.FROM){if(ee<=0)return J(!1),void wt();(async()=>{await gt()})()}}),[ee,te,ye,ie]),c.useEffect((()=>{if(z===rt.TO){if(fe<=0)return J(!1),void wt();(async()=>{await gt()})()}}),[fe,ye,te]);const vt=c.useMemo((()=>{if(!x)return!0;if(g(x))return!1;const e=l.find((e=>e.token.address?.toLowerCase()===O));if(!e)return!0;const t=te?.address?.toLowerCase()===O,o=Se(0!==_e.length?_e:"0"),a=t&&!Number.isNaN(parseFloat(X))?Te(X,te?.decimals||18):p.from("0");return o.add(a).gt(e.balance)}),[_e,l,te,X,x]);c.useEffect((()=>{X&&te&&ke(C(X,te.symbol,R.conversions))}),[X,te,R.conversions]);const At=c.useCallback((e=>{const t=l.find((t=>e===I(t.token.symbol,t.token.address)));t&&(ye&&e===I(ye.symbol,ye?.address)&&Ee(void 0),oe(t.token),ne(t.formattedBalance),re(""))}),[ye]),St=c.useCallback((e=>{const t=r.find((t=>e===I(t.symbol,t.address)));t&&(te&&e===I(te.symbol,te?.address)&&oe(void 0),Ee(t),he(""))}),[te]);return a(B,{children:[a(s,{sx:{paddingX:"base.spacing.x4",marginBottom:"base.spacing.x2"},children:[i(b,{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(b,{size:"xSmall",sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:n("views.SWAP.swapForm.from.label")}),i(Ne,{testId:"fromTokenInputs",options:Ue,selectSubtext:te?`${n("views.SWAP.content.availableBalancePrefix")} ${P(ae)}`:"",selectTextAlign:"left",textInputType:"number",testInputMode:"decimal",textInputValue:X,textInputPlaceholder:n("views.SWAP.swapForm.from.inputPlaceholder"),textInputSubtext:`${n("views.SWAP.content.fiatPricePrefix")} \n $${_(Ie,!0)}`,textInputTextAlign:"right",textInputValidator:N,onTextInputChange:e=>{var t;(t=e)!==X&&(mt(),wt(),ce(""),ft(t,!1)&&J(!0),Q(t))},onTextInputFocus:()=>{H(rt.FROM)},textInputMaxButtonClick:()=>{if(!ae)return;const e=ae.slice(0,ae.indexOf(".")+M+1);mt(),wt(),H(rt.FROM),ce(""),ft(e,!1)&&J(!0),X===e?de(ie+1):Q(e),K({userJourney:y.SWAP,screen:"SwapCoins",control:"MaxFrom",controlType:"Button",extras:{fromBalance:ae,fromBalanceTruncated:e}})},onSelectChange:At,textInputErrorMessage:n(Y),selectErrorMessage:n(se),selectedOption:te?I(te.symbol,te.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.from.selectorTitle"),defaultTokenImage:h,environment:S?.config.environment,theme:o})]}),a(s,{children:[a(s,{sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:[i(b,{size:"xSmall",children:n("views.SWAP.swapForm.to.label")}),Je?.length>0&&a(L,{children:[i(L.Target,{children:i(k,{icon:"InformationCircle",sx:{w:"base.icon.size.300"}})}),i(L.Content,{children:Je})]})]}),i(Ne,{testId:"toTokenInputs",options:ut,selectTextAlign:"left",textInputType:"number",testInputMode:"decimal",textInputValue:le,textInputPlaceholder:n("views.SWAP.swapForm.to.inputPlaceholder"),textInputTextAlign:"right",textInputValidator:N,onTextInputChange:e=>{var t;(t=e)!==le&&(mt(),wt(),ke(""),Q(""),Tt(t,!1)&&J(!0),ce(t))},onTextInputFocus:()=>{H(rt.TO)},onSelectChange:St,textInputErrorMessage:n(pe),selectErrorMessage:n(xe),selectedOption:ye?I(ye.symbol,ye.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.to.selectorTitle"),defaultTokenImage:h,environment:S?.config.environment,theme:o})]})]}),!g(x)&&i(me,{gasFeeFiatValue:Le,gasFeeToken:Oe,gasFeeValue:_e,fees:qe,onFeesClick:()=>{K({userJourney:y.SWAP,screen:"SwapCoins",control:"ViewFees",controlType:"Button"})},sx:{paddingBottom:"0"},loading:$})]}),i(Be,{validator:()=>{const e=function(e){return e?"":"views.SWAP.validation.noFromTokenSelected"}(te),t=(a=ae,(o=X)&&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"}(ye),s=function(e){return e&&0!==parseFloat(e)?"":"views.SWAP.validation.noAmountInputted"}(le);z===rt.FROM?(ue(""),t&&Z(t)):z===rt.TO&&(Z(""),s&&ue(s)),e&&re(e),n&&he(n);let r=!0;return(e||n||t&&z===rt.FROM||s&&z===rt.TO)&&(r=!1),K({userJourney:y.SWAP,screen:"SwapCoins",control:"FormValid",controlType:"Button",extras:{isSwapFormValid:r,swapFromAddress:te?.address,swapFromAmount:X,swapFromTokenSymbol:te?.symbol,swapToAddress:ye?.address,swapToAmount:le,swapToTokenSymbol:ye?.symbol}}),r},updateLoading:e=>{J(e)},loading:$,transaction:Ce,data:{fromAmount:X,toAmount:le,fromTokenSymbol:te?.symbol,fromTokenAddress:te?.address,toTokenSymbol:ye?.symbol,toTokenAddress:ye?.address},insufficientFundsForGas:vt,openNotEnoughImxDrawer:()=>{lt(!1),Xe(!0)},openNetworkSwitchDrawer:()=>pt(!0)}),i(ze,{environment:S?.config.environment??V.PRODUCTION,visible:Ke,showAdjustAmount:te?.address===O,hasZeroImx:!1,onAddCoinsClick:()=>{G({payload:{type:E.UPDATE_VIEW,view:{type:A.TOP_UP_VIEW},currentViewData:{fromTokenAddress:te?.address??"",fromAmount:X,toTokenAddress:ye?.address??""}}})},onCloseDrawer:()=>Xe(!1)}),i(Ye,{visible:Qe,onCloseDrawer:()=>{lt(!1),oe(void 0),Q(""),Ee(void 0),ce("")}}),i(we,{visible:ct,targetChainId:T(S?.config),provider:x,checkout:S,onCloseDrawer:()=>pt(!1)})]})}const ct=(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 pt({theme:t,fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d}){const{t:l}=e(),{viewDispatch:p}=c.useContext(u),{eventTargetState:{eventTarget:f}}=c.useContext(j),{swapState:{tokenBalances:T}}=c.useContext(Re),{connectLoaderState:{checkout:v,provider:S}}=c.useContext(m),[x,h]=c.useState(!1),{page:b}=w();return c.useEffect((()=>{b({userJourney:y.SWAP,screen:"SwapCoins",extras:{fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d}})}),[]),c.useEffect((()=>{ct(T,$)&&!g(S)&&h(!0)}),[T]),i(H,{header:i(G,{title:l("views.SWAP.header.title"),onCloseButtonClick:()=>z(f)}),footer:i(ke,{environment:v?.config.environment,theme:t}),children:a(s,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[i(lt,{data:{fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d},theme:t}),i(ze,{environment:v?.config.environment??V.PRODUCTION,visible:x,showAdjustAmount:!1,hasZeroImx:!0,onAddCoinsClick:()=>{p({payload:{type:E.UPDATE_VIEW,view:{type:A.TOP_UP_VIEW}}})},onCloseDrawer:()=>{h(!1)}})]})})}function ut({transactionResponse:t,swapForm:o}){const{t:a}=e(),{viewDispatch:n}=c.useContext(u),{page:s}=w();return c.useEffect((()=>{s({userJourney:y.SWAP,screen:"SwapInProgress",extras:{swapFormInfo:o}})}),[]),c.useEffect((()=>{(async()=>{try{const e=await t.wait();if(1===e.status)return void n({payload:{type:E.UPDATE_VIEW,view:{type:Ee.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:Ee.FAIL,data:o,reason:"Transaction failed"}}})}catch{n({payload:{type:E.UPDATE_VIEW,view:{type:Ee.FAIL,data:o,reason:"Transaction failed"}}})}})()}),[t]),i(J,{loadingText:a("views.SWAP.IN_PROGRESS.loading.text")})}function mt({data:t}){const{t:o}=e(),{swapState:{allowedTokens:n}}=c.useContext(Re),{connectLoaderState:r}=c.useContext(m),{checkout:d,provider:l}=r,{viewDispatch:f}=c.useContext(u),{eventTargetState:{eventTarget:T}}=c.useContext(j),S=g(l),[x,h]=c.useState(!1),[b,I]=c.useState(!1),[k,C]=c.useState(!1),[P,R]=c.useState(!1),[_,F]=c.useState(!1),[W,O]=c.useState(!1),{page:D,track:N}=w();c.useEffect((()=>{D({userJourney:y.SWAP,screen:"ApproveERC20",extras:{swapFormInfo:t.swapFormInfo}})}),[]);const L=c.useMemo((()=>n.find((e=>e.address===t.swapFormInfo.fromTokenAddress))),[n,t.swapFormInfo.fromTokenAddress]),V=c.useCallback((()=>{f({payload:{type:E.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[f]),U=c.useCallback((()=>{f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.SWAP,data:t.swapFormInfo}}})}),[f]),M=(e,t)=>{e.type!==v.UNPREDICTABLE_GAS_LIMIT?e.type===v.TRANSACTION_FAILED||e.type===v.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.FAIL,reason:"Transaction failed",data:t}}}):(console.error("Approve ERC20 failed",e),f({payload:{type:E.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})):f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.PRICE_SURGE,data:t}}})},q=(e,t=!1)=>({...e,gasPrice:t?p.from(0):void 0}),$=c.useCallback((async()=>{if(!P)if(N({userJourney:y.SWAP,screen:"ApproveERC20",control:"ApproveSpending",controlType:"Button"}),R(!0),d&&l){if(!x){h(!0);try{const e=await d.sendTransaction({provider:l,transaction:q(t.approveTransaction,S)});I(!0);if(1!==(await e.transactionResponse.wait()).status)return void f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.FAIL,data:t.swapFormInfo}}});I(!1),h(!1),C(!0)}catch(e){if(I(!1),h(!1),e.type===v.USER_REJECTED_REQUEST_ERROR)return void F(!0);M(e,t.swapFormInfo)}finally{R(!1)}}}else V()}),[d,l,V,f,O,t.approveTransaction,t.swapFormInfo,x,h,I]),Q=c.useMemo((()=>a(K,{heading:o(`views.APPROVE_ERC20.approveSpending.content.${S?"passport":"metamask"}.heading`),children:[S&&i(s,{children:o("views.APPROVE_ERC20.approveSpending.content.passport.body")}),!S&&i(s,{children:o("views.APPROVE_ERC20.approveSpending.content.metamask.body",{amount:`${t.swapFormInfo.fromAmount} ${L?.symbol||""}`})})]})),[t.swapFormInfo,L,S]),Y=c.useMemo((()=>i(X,{loading:P,actionText:o(_?"views.APPROVE_ERC20.approveSpending.footer.retryText":"views.APPROVE_ERC20.approveSpending.footer.buttonText"),onActionClick:$})),[_,$,P]),Z=c.useCallback((async()=>{if(!P)if(N({userJourney:y.SWAP,screen:"ApproveERC20",control:"ApproveSwap",controlType:"Button"}),R(!0),d&&l){if(!x){h(!0);try{const e=await d.sendTransaction({provider:l,transaction:q(t.transaction,S)});h(!1),f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.IN_PROGRESS,data:{transactionResponse:e.transactionResponse,swapForm:t.swapFormInfo}}}})}catch(e){if(h(!1),e.type===v.USER_REJECTED_REQUEST_ERROR)return void O(!0);M(e,t.swapFormInfo)}finally{R(!1)}}}else V()}),[d,l,V,f,O,t.transaction,t.swapFormInfo,x,h]),ee=i(K,{heading:o("views.APPROVE_ERC20.approveSwap.content.heading"),children:i(s,{children:o("views.APPROVE_ERC20.approveSwap.content.body")})}),te=c.useMemo((()=>i(X,{loading:P,actionText:o(W?"views.APPROVE_ERC20.approveSwap.footer.retryText":"views.APPROVE_ERC20.approveSwap.footer.buttonText"),onActionClick:Z})),[W,Z,P]);return a(B,{children:[b&&i(J,{loadingText:o("views.APPROVE_ERC20.approveSpending.loading.text")}),!b&&i(H,{header:i(G,{transparent:!0,showBack:!0,onCloseButtonClick:()=>z(T),onBackButtonClick:U}),floatHeader:!0,heroContent:i(k?fe:Ie,{}),footer:k?te:Y,children:k?ee:Q})]})}function wt({amount:t,fromTokenAddress:o,toTokenAddress:n,config:s}){const{t:r}=e(),{eventTargetState:{eventTarget:d}}=c.useContext(j),{environment:l,theme:p,isOnRampEnabled:f,isSwapEnabled:g,isBridgeEnabled:v}=s,{connectLoaderState:{checkout:S,provider:x}}=c.useContext(m),[h,b]=c.useReducer(Q,{...Y,history:[]}),[I,k]=c.useReducer(_e,Ce),{page:C}=w(),[P,R]=c.useState(!1),_=c.useMemo((()=>({swapState:I,swapDispatch:k})),[I,k]),F=c.useMemo((()=>({viewState:h,viewDispatch:b})),[h,b]),W=c.useCallback(((e,t)=>{b({payload:{type:E.UPDATE_VIEW,view:{type:A.ERROR_VIEW,tryAgain:t,error:e}}})}),[b]),O=c.useCallback((()=>{b({payload:{type:E.UPDATE_VIEW,view:{type:Ee.SWAP}}})}),[b]),D=c.useCallback((async()=>{if(!S)throw new Error("loadBalances: missing checkout");if(!x)throw new Error("loadBalances: missing provider");try{const e=await ye({checkout:S,provider:x,allowTokenListType:Z.SWAP});if(void 0===e)return!1;k({payload:{type:Pe.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}}),k({payload:{type:Pe.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}})}catch(e){if(ee.nonRetryable(e))return W(e,D),!1}return!0}),[S,x]);return c.useEffect((()=>{(async()=>{if(!S||!x)return;const e=await S.getNetworkInfo({provider:x});if(e.chainId!==T(S.config))return;let t;try{t=await S.config.remote.getConfig("dex")}catch(e){return void W(e)}const o=new te({chainId:e.chainId,baseConfig:new oe({environment:l}),secondaryFees:t.secondaryFees,overrides:t.overrides});k({payload:{type:Pe.SET_EXCHANGE,exchange:o}}),k({payload:{type:Pe.SET_NETWORK,network:e}}),await D()&&h.view.type===A.LOADING_VIEW&&O()})()}),[S,x]),i(u.Provider,{value:F,children:i(Re.Provider,{value:_,children:a(he,{environment:l,children:[h.view.type===A.LOADING_VIEW&&i(J,{loadingText:r("views.LOADING_VIEW.text")}),h.view.type===Ee.SWAP&&i(pt,{theme:p,fromAmount:h.view.data?.fromAmount??t,fromTokenAddress:h.view.data?.fromTokenAddress??o,toTokenAddress:h.view.data?.toTokenAddress??n}),h.view.type===Ee.IN_PROGRESS&&i(ut,{transactionResponse:h.view.data.transactionResponse,swapForm:h.view.data.swapForm}),h.view.type===Ee.APPROVE_ERC20&&i(mt,{data:h.view.data}),h.view.type===Ee.SUCCESS&&i(ae,{statusText:r("views.SWAP.success.text"),actionText:r("views.SWAP.success.actionText"),onRenderEvent:()=>{C({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}}),ne(d,h.view.data.transactionHash)},onActionClick:()=>z(d),statusType:se.SUCCESS,testId:"success-view"}),h.view.type===Ee.FAIL&&i(ae,{statusText:r("views.SWAP.failed.text"),actionText:r("views.SWAP.failed.actionText"),onRenderEvent:()=>{C({userJourney:y.SWAP,screen:"SwapFailed"}),re(d,"Transaction failed")},onActionClick:()=>{h.view.type===Ee.FAIL&&b({payload:{type:E.UPDATE_VIEW,view:{type:Ee.SWAP,data:h.view.data}}})},statusType:se.FAILURE,onCloseClick:()=>z(d),testId:"fail-view"}),h.view.type===Ee.PRICE_SURGE&&i(ae,{statusText:r("views.SWAP.rejected.text"),actionText:r("views.SWAP.rejected.actionText"),onRenderEvent:()=>{C({userJourney:y.SWAP,screen:"PriceSurge"}),ie(d,"Price surge")},onActionClick:()=>{h.view.type===Ee.PRICE_SURGE&&b({payload:{type:E.UPDATE_VIEW,view:{type:Ee.SWAP,data:h.view.data}}})},statusType:se.WARNING,onCloseClick:()=>z(d),testId:"price-surge-view"}),h.view.type===A.ERROR_VIEW&&i(de,{actionText:r("views.ERROR_VIEW.actionText"),onActionClick:async()=>{R(!0);const e=h.view;if(!e.tryAgain)return O(),void R(!1);await e.tryAgain()&&O(),R(!1)},onCloseClick:()=>z(d),errorEventActionLoading:P}),h.view.type===A.TOP_UP_VIEW&&i(xe,{analytics:{userJourney:y.SWAP},checkout:S,provider:x,widgetEvent:le.IMTBL_SWAP_WIDGET_EVENT,showOnrampOption:f,showSwapOption:g,showBridgeOption:v,onCloseButtonClick:()=>z(d)})]})})})}export{wt as default};
1
+ import{l as e,b7 as t,b8 as o,n as a,b9 as n,a as s,ba as r,j as i,o as d,bb as l,r as c,at as p,V as u,q as m,t as w,d as f,U as y,x as T,p as E,w as g,K as v,L as A,bc as S,a7 as x,bd as h,H as b,be as I,bf as k,Y as C,A as P,aV as R,v as _,bg as F,G as W,bh as O,bi as D,bj as N,bk as L,z as V,aD as B,bl as U,bm as M,bn as q,E as j,$ as G,bo as z,a3 as H,bp as $,aj as J,ae as K,bq as X,ah as Q,ai as Y,T as Z,R as ee,br as te,bs as oe,bt as ae,bu as ne,aL as se,bv as re,bw as ie,ak as de,I as le}from"./index-23793c68.js";import{S as ce,T as pe,a as ue,F as me,N as we,W as fe,g as ye}from"./balance-2290eaf3.js";import{p as Te,S as Ee,f as ge,C as ve,a as Ae,c as Se,T as xe,b as he}from"./TopUpView-742d8a9b.js";import{u as be}from"./retry-52c80d97.js";import{S as Ie}from"./SpendingCapHero-5b467efd.js";function ke({theme:c,environment:p}){const{t:u}=e(),m=c===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:l,children:u("footers.quickswapFooter.disclaimerText")})]})}const Ce={exchange:null,walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,allowedTokens:[]};var Pe;!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"}(Pe||(Pe={}));const Re=c.createContext({swapState:Ce,swapDispatch:()=>{}});Re.displayName="SwapContext";const _e=(e,t)=>{switch(t.payload.type){case Pe.SET_EXCHANGE:return{...e,exchange:t.payload.exchange};case Pe.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case Pe.SET_NETWORK:return{...e,network:t.payload.network};case Pe.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 Pe.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case Pe.SET_ALLOWED_TOKENS:return{...e,allowedTokens:t.payload.allowedTokens};default:return e}},Fe={fromAmountIn:async(e,t,o,a,n)=>{const s=await t.getSigner().getAddress();return e.getUnsignedSwapTxFromAmountIn(s,o.address,n.address,p.from(Te(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(Te(a,o.decimals)))}},We={display:"flex",flexDirection:"row",justifyContent:"space-between",columnGap:"base.spacing.x1"},Oe={flex:1},De={flex:2};function Ne({testId:e,options:t,textInputValue:o,textInputPlaceholder:n,textInputValidator:r,textInputType:d,onTextInputChange:l,onTextInputBlur:c,onTextInputFocus:p,textInputTextAlign:u,textInputSubtext:m,textInputErrorMessage:w,testInputMode:f,selectTextAlign:y,selectSubtext:T,selectErrorMessage:E,textInputMaxButtonClick:g,onSelectChange:v,textInputDisabled:A,selectInputDisabled:S,selectedOption:x,coinSelectorHeading:h,defaultTokenImage:b,environment:I,theme:k}){return a(s,{sx:We,children:[i(s,{sx:Oe,children:i(ce,{testId:`${e}-select-form`,options:t,subtext:T,textAlign:y,errorMessage:E,onSelectChange:v,disabled:S,selectedOption:x,coinSelectorHeading:h,defaultTokenImage:b,environment:I,theme:k})}),i(s,{sx:De,children:i(pe,{type:d,testId:`${e}-text-form`,value:o,placeholder:n,subtext:m,textAlign:u,errorMessage:w,validator:r,onTextInputChange:l,onTextInputBlur:c,onTextInputFocus:p,maxButtonClick:g,disabled:A,inputMode:f})})]})}const Le={display:"flex",flexDirection:"column",paddingY:"base.spacing.x6",paddingX:"base.spacing.x4"},Ve={width:"base.icon.size.400"};function Be({loading:t,updateLoading:o,validator:n,transaction:r,data:d,insufficientFundsForGas:l,openNotEnoughImxDrawer:S,openNetworkSwitchDrawer:x}){const{t:h}=e(),[b,I]=c.useState(!1),{viewDispatch:k}=c.useContext(u),{connectLoaderState:C}=c.useContext(m),{checkout:P,provider:R}=C,{track:_}=w(),F=async()=>{const e=n();if(_({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:!l}}),e&&P&&R&&r)if(l)S();else{try{const e=await R.provider.request({method:"eth_chainId",params:[]});if(parseInt(e.toString())!==T(P.config))return void x()}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 k({payload:{type:E.UPDATE_VIEW,view:{type:Ee.APPROVE_ERC20,data:{approveTransaction:r.approval.transaction,transaction:r.swap.transaction,info:r.quote,swapFormInfo:e}}}});const t=await P.sendTransaction({provider:R,transaction:{...r.swap.transaction,gasPrice:g(R)?p.from(0):void 0}});k({payload:{type:E.UPDATE_VIEW,view:{type:Ee.IN_PROGRESS,data:{transactionResponse:t.transactionResponse,swapForm:e}}}})}catch(e){if(console.error(e),o(!1),e.type===v.USER_REJECTED_REQUEST_ERROR)return void I(!0);if(e.type===v.UNPREDICTABLE_GAS_LIMIT)return void k({payload:{type:E.UPDATE_VIEW,view:{type:Ee.PRICE_SURGE,data:d}}});if(e.type===v.TRANSACTION_FAILED||e.type===v.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status)return void k({payload:{type:E.UPDATE_VIEW,view:{type:Ee.FAIL,reason:"Transaction failed",data:d}}});k({payload:{type:E.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})}}};return a(s,{sx:Le,children:[i(f,{testId:"swap-button",disabled:t,variant:"primary",onClick:F,size:"large",children:t?i(f.Icon,{icon:"Loading",sx:Ve}):h("views.SWAP.swapForm.buttonText")}),i(ue,{visible:b,showHeaderBar:!1,onCloseDrawer:()=>I(!1),onRetry:()=>{F(),I(!1)}})]})}const Ue={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x1",height:"100%"},Me={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},qe={display:"flex",flexDirection:"column",justifyContent:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},je={width:"100%",height:"base.spacing.x16"},Ge={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"};function ze({environment:t,visible:o,showAdjustAmount:n,hasZeroImx:r,onCloseDrawer:l,onAddCoinsClick:c}){const{t:p}=e(),u=S(t);return i(x,{size:"full",onCloseDrawer:l,visible:o,showHeaderBar:!1,children:i(x.Content,{children:a(s,{testId:"not-enough-gas-bottom-sheet",sx:Ue,children:[i(h,{sx:{w:"base.icon.size.600",h:"base.icon.size.600"},use:i("img",{src:u,alt:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)})}),i(b,{size:"small",sx:Me,testId:"not-enough-gas-heading",children:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.heading`)}),i(d,{sx:Me,children:p(`drawers.notEnoughImx.content.${r?"noImx":"insufficientImx"}.body`)}),a(s,{sx:qe,children:[n&&i(f,{testId:"not-enough-gas-adjust-amount-button",sx:je,variant:"tertiary",onClick:l,children:p("drawers.notEnoughImx.buttons.adjustAmount")}),i(f,{testId:"not-enough-gas-add-imx-button",sx:je,variant:"tertiary",onClick:c,children:p("drawers.notEnoughImx.buttons.addMoreImx")}),i(f,{sx:je,variant:"tertiary",onClick:l,testId:"not-enough-gas-cancel-button",children:p("drawers.notEnoughImx.buttons.cancel")})]}),i(s,{sx:Ge,children:i(I,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const He={display:"flex",flexDirection:"column",alignItems:"center",paddingTop:"base.spacing.x6",paddingBottom:"base.spacing.x4",paddingX:"base.spacing.x4",height:"100%"},$e={color:"base.color.text.body.secondary",fontFamily:"base.font.family.heading.secondary",textAlign:"center",marginTop:"base.spacing.x4"},Je={display:"flex",flexDirection:"column",justifyContent:"flex-end",alignItems:"center",gap:"base.spacing.x2",height:"100%",width:"100%"},Ke={width:"100%",height:"base.spacing.x16",marginBottom:"base.spacing.x16"},Xe={display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",paddingTop:"base.spacing.x6"},Qe={width:"base.icon.size.600",fill:"base.color.status.fatal.bright"};function Ye({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:He,children:[i(k,{icon:"Alert",testId:"unable-to-swap-icon",variant:"bold",sx:Qe}),i(b,{size:"small",sx:$e,testId:"unable-to-swap-heading",children:n("drawers.unableToSwap.heading")}),i(d,{sx:$e,children:n("drawers.unableToSwap.body")}),i(s,{sx:Je,children:i(f,{sx:Ke,variant:"tertiary",onClick:o,testId:"unable-to-swap-cancel-button",children:n("drawers.unableToSwap.buttons.cancel")})}),i(s,{sx:Xe,children:i(I,{testId:"footer-logo-image",logo:"ImmutableHorizontalLockup",sx:{width:"base.spacing.x25"}})})]})})})}const Ze=(e,t=500)=>{const[o,a]=c.useState(e);return c.useEffect((()=>{const o=setTimeout((()=>{a(e)}),t);return()=>{clearTimeout(o)}}),[e,t]),o};class et{static id=0;promiseId=0;promise;isCancelled=!1;onCancel=null;rejectPromise=()=>{};constructor(e){et.id+=1,this.promiseId=et.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 et(((t,o)=>{Promise.all(e.map((e=>e instanceof et?e.promise:e))).then(t,o)}))}then(e,t){return new et(((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 et(((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}}const tt=(e,t,o)=>{const a=[];if(!e.swap)return a;const n=(e,n,s="≈ ")=>{const r=p.from(e?.value??0);if(e&&r.gt(0)){const i=ge(r,e.token.decimals);a.push({label:n,fiatAmount:`≈ ${o("drawers.feesBreakdown.fees.fiatPricePrefix")}${C(i,e.token.symbol||"",t.conversions)}`,amount:`${P(i)}`,prefix:s,token:e.token})}};return e.swap&&e.swap.gasFeeEstimate&&n(e.swap.gasFeeEstimate,o("drawers.feesBreakdown.fees.swapGasFee.label")),e.approval&&e.approval.gasFeeEstimate&&n(e.approval.gasFeeEstimate,o("drawers.feesBreakdown.fees.approvalFee.label")),e.quote?.fees?.forEach((e=>{n(e.amount,o("drawers.feesBreakdown.fees.swapSecondaryFee.label",{amount:e.basisPoints/100+"%"}),"")})),a},ot=(e,t)=>{if(!R(e))return t;const o={...t};return o.swap?.gasFeeEstimate&&(o.swap.gasFeeEstimate.value=p.from(0)),o.approval?.gasFeeEstimate&&(o.approval.gasFeeEstimate.value=p.from(0)),o},at=(e,t)=>{if(!t.quote.fees)return t;const o=t.quote.fees.map((t=>t.amount.token.symbol?t:{...t,amount:{...t.amount,token:{...t.amount.token,symbol:e.address===t.amount.token.address?e.symbol:t.amount.token.symbol}}}));return{...t,quote:{...t.quote,fees:o}}},nt=(e,t)=>{if(!t.quote.amount&&!t.quote.amountWithMaxSlippage)return t;const o={...t.quote.amount,token:{...t.quote.amount.token,symbol:e.address===t.quote.amount.token.address?e.symbol:t.quote.amount.token.symbol}},a={...t.quote.amountWithMaxSlippage,token:{...t.quote.amountWithMaxSlippage.token,symbol:e.address===t.quote.amountWithMaxSlippage.token.address?e.symbol:t.quote.amountWithMaxSlippage.token.symbol}};return{...t,quote:{...t.quote,amount:o,amountWithMaxSlippage:a}}},st=(e,t,o,a,n)=>{const s=o.quote.fees[0],r=t,i=o.quote.amount.token,d=parseFloat(e),l=Te(d.toString(),r.decimals),c=p.from(o.quote.amount.value),u=r.decimals,m=o.quote.amount.token.decimals,w=Math.max(u,m),f=p.from("10").pow(w-u),y=p.from("10").pow(w-m),T=l.mul(f),E=c.mul(y),g=E.div(T),v=E.mod(T),A=p.from("10").pow(w),S=v.mul(A).div(T),x=g.mul(A).add(S),h=_(P(ge(x,w)),!0);return n(a,{fromSymbol:r.symbol,toSymbol:i.symbol,rate:h,fee:(s?.basisPoints??0)/100})};var rt;!function(e){e.FROM="FROM",e.TO="TO"}(rt||(rt={}));const it=(e,t)=>void 0!==e&&(""!==e&&t!==e);let dt;function lt({data:t,theme:o}){const{t:n}=e(),{swapState:{allowedTokens:r,exchange:d,tokenBalances:l,network:f}}=c.useContext(Re),{connectLoaderState:v}=c.useContext(m),{checkout:S,provider:x}=v,h=F(S?.config.environment,o),I=c.useCallback(((e,t)=>W(t)?O:`${e.toLowerCase()}-${t.toLowerCase()}`),[]),{cryptoFiatState:R,cryptoFiatDispatch:j}=c.useContext(ve),{viewDispatch:G}=c.useContext(u),[z,H]=c.useState(rt.FROM),[$,J]=c.useState(!1),{track:K}=w(),[X,Q]=c.useState(t?.fromAmount||""),[Y,Z]=c.useState(""),ee=Ze(X,U),[te,oe]=c.useState(),[ae,ne]=c.useState(""),[se,re]=c.useState(""),[ie,de]=c.useState(0),[le,ce]=c.useState(t?.toAmount||""),[pe,ue]=c.useState(""),fe=Ze(le,U),[ye,Ee]=c.useState(),[xe,he]=c.useState(""),[Ie,ke]=c.useState(""),[Ce,Pe]=c.useState(null),[_e,We]=c.useState(""),[Oe,De]=c.useState(void 0),[Le,Ve]=c.useState(""),[Ue,Me]=c.useState([]),qe=c.useMemo((()=>Ce?tt(Ce,R,n):[]),[Ce,R,n]),[je,Ge]=c.useState(null),[He,$e]=c.useState(""),Je=c.useMemo((()=>Ce&&He&&je?st(He,je,Ce,"views.SWAP.swapForm.conversionRate",n):""),[He,je,Ce,n]),[Ke,Xe]=c.useState(!1),[Qe,lt]=c.useState(!1),[ct,pt]=c.useState(!1);c.useEffect((()=>{if(0===l.length)return;if(!f)return;const e=l.filter((e=>e.balance.gt(0))).map((e=>({id:I(e.token.symbol,e.token.address),name:e.token.name,symbol:e.token.symbol,icon:e.token.icon,balance:{formattedAmount:P(e.formattedBalance),formattedFiatAmount:0===R.conversions.size?_(""):C(e.formattedBalance,e.token.symbol||"",R.conversions)}})));Me(e),t?.fromTokenAddress&&!te&&(oe(r.find((e=>W(e.address)&&t?.fromTokenAddress?.toLowerCase()===O||e.address?.toLowerCase()===t?.fromTokenAddress?.toLowerCase()))),ne(l.find((e=>W(e.token.address)&&t?.fromTokenAddress?.toLowerCase()===O||e.token.address?.toLowerCase()===t?.fromTokenAddress?.toLowerCase()))?.formattedBalance??"")),it(t?.toTokenAddress,t?.fromTokenAddress)&&!ye&&Ee(r.find((e=>W(e.address)&&t?.toTokenAddress?.toLowerCase()===O||e.address?.toLowerCase()===t?.toTokenAddress?.toLowerCase())))}),[l,r,R.conversions,t?.fromTokenAddress,t?.toTokenAddress,oe,ne,Ee,Me,I,_,f]);const ut=c.useMemo((()=>r.map((e=>({id:I(e.symbol,e.address),name:e.name,symbol:e.symbol,icon:e.icon})))),[r,te]);c.useEffect((()=>{j({payload:{type:Ae.SET_TOKEN_SYMBOLS,tokenSymbols:r.map((e=>e.symbol))}})}),[j,r]);const mt=()=>{Z(""),re(""),ue(""),he("")},wt=()=>{dt&&dt.cancel(),$e(""),Ge(null),Ve(""),Pe(null)},ft=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!te&&(!!ye&&(!t||!$)))),yt=async(e=!1)=>{ft(X,e)&&(dt&&dt.cancel(),e||J(!0),await(async(e=!1)=>{if(x&&d&&te&&ye){try{const e=Fe.fromAmountIn(d,x,te,X,ye),t=et.all([e]);dt=t;const o=await t;let a=ot(x,o[0]);a=at(te,a),a=nt(ye,a);const n=a.swap.gasFeeEstimate;let s=p.from(n?.value||0);a.approval?.gasFeeEstimate&&(s=s.add(a.approval.gasFeeEstimate.value));const i=ge(s,q),l=n?.token,c=r.find((e=>e.address?.toLocaleLowerCase()===l?.address?.toLocaleLowerCase()));Ge(te),$e(X),Pe(a),We(i),De({name:c?.name||"",symbol:c?.symbol||"",decimals:c?.decimals||0,address:c?.address,icon:c?.icon}),Ve(C(i,c?.symbol||"",R.conversions)),ce(_(P(ge(a.quote.amount.value,a.quote.amount.token.decimals),a.quote.amount.token.decimals))),mt()}catch(e){e.cancelled||(console.error("Error fetching quote.",e),wt(),Xe(!1),lt(!0))}e||J(!1)}})(e))},Tt=(e,t)=>!Number.isNaN(parseFloat(e))&&(!(parseFloat(e)<=0)&&(!!te&&(!!ye&&(!t||!$)))),Et=async(e=!1)=>{Tt(le,e)&&(dt&&dt.cancel(),e||J(!0),await(async(e=!1)=>{if(x&&d&&te&&ye){try{const e=Fe.fromAmountOut(d,x,ye,le,te),t=et.all([e]);dt=t;const o=await t;let a=ot(x,o[0]);a=at(te,a);const n=a.swap.gasFeeEstimate;let s=p.from(n?.value||0);a.approval?.gasFeeEstimate&&(s=s.add(a.approval.gasFeeEstimate.value));const i=ge(s,q),l=n?.token,c=r.find((e=>e.symbol===l?.symbol));Ge(ye),$e(le),Pe(a),We(i),De({name:c?.name||"",symbol:c?.symbol||"",decimals:c?.decimals||0,address:c?.address,icon:c?.icon}),Ve(C(i,c?.symbol||"",R.conversions)),Q(_(P(ge(a.quote.amount.value,a.quote.amount.token.decimals)))),mt()}catch(e){e.cancelled||(wt(),Xe(!1),lt(!0))}e||J(!1)}})(e))},gt=async(e=!1)=>{z===rt.FROM?await yt(e):await Et(e)};be((()=>gt(!0)),D),c.useEffect((()=>{if(z===rt.FROM){if(ee<=0)return J(!1),void wt();(async()=>{await gt()})()}}),[ee,te,ye,ie]),c.useEffect((()=>{if(z===rt.TO){if(fe<=0)return J(!1),void wt();(async()=>{await gt()})()}}),[fe,ye,te]);const vt=c.useMemo((()=>{if(!x)return!0;if(g(x))return!1;const e=l.find((e=>e.token.address?.toLowerCase()===O));if(!e)return!0;const t=te?.address?.toLowerCase()===O,o=Se(0!==_e.length?_e:"0"),a=t&&!Number.isNaN(parseFloat(X))?Te(X,te?.decimals||18):p.from("0");return o.add(a).gt(e.balance)}),[_e,l,te,X,x]);c.useEffect((()=>{X&&te&&ke(C(X,te.symbol,R.conversions))}),[X,te,R.conversions]);const At=c.useCallback((e=>{const t=l.find((t=>e===I(t.token.symbol,t.token.address)));t&&(ye&&e===I(ye.symbol,ye?.address)&&Ee(void 0),oe(t.token),ne(t.formattedBalance),re(""))}),[ye]),St=c.useCallback((e=>{const t=r.find((t=>e===I(t.symbol,t.address)));t&&(te&&e===I(te.symbol,te?.address)&&oe(void 0),Ee(t),he(""))}),[te]);return a(B,{children:[a(s,{sx:{paddingX:"base.spacing.x4",marginBottom:"base.spacing.x2"},children:[i(b,{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(b,{size:"xSmall",sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:n("views.SWAP.swapForm.from.label")}),i(Ne,{testId:"fromTokenInputs",options:Ue,selectSubtext:te?`${n("views.SWAP.content.availableBalancePrefix")} ${P(ae)}`:"",selectTextAlign:"left",textInputType:"number",testInputMode:"decimal",textInputValue:X,textInputPlaceholder:n("views.SWAP.swapForm.from.inputPlaceholder"),textInputSubtext:`${n("views.SWAP.content.fiatPricePrefix")} \n $${_(Ie,!0)}`,textInputTextAlign:"right",textInputValidator:N,onTextInputChange:e=>{var t;(t=e)!==X&&(mt(),wt(),ce(""),ft(t,!1)&&J(!0),Q(t))},onTextInputFocus:()=>{H(rt.FROM)},textInputMaxButtonClick:()=>{if(!ae)return;const e=ae.slice(0,ae.indexOf(".")+M+1);mt(),wt(),H(rt.FROM),ce(""),ft(e,!1)&&J(!0),X===e?de(ie+1):Q(e),K({userJourney:y.SWAP,screen:"SwapCoins",control:"MaxFrom",controlType:"Button",extras:{fromBalance:ae,fromBalanceTruncated:e}})},onSelectChange:At,textInputErrorMessage:n(Y),selectErrorMessage:n(se),selectedOption:te?I(te.symbol,te.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.from.selectorTitle"),defaultTokenImage:h,environment:S?.config.environment,theme:o})]}),a(s,{children:[a(s,{sx:{display:"flex",justifyContent:"space-between",paddingBottom:"base.spacing.x1"},children:[i(b,{size:"xSmall",children:n("views.SWAP.swapForm.to.label")}),Je?.length>0&&a(L,{children:[i(L.Target,{children:i(k,{icon:"InformationCircle",sx:{w:"base.icon.size.300"}})}),i(L.Content,{children:Je})]})]}),i(Ne,{testId:"toTokenInputs",options:ut,selectTextAlign:"left",textInputType:"number",testInputMode:"decimal",textInputValue:le,textInputPlaceholder:n("views.SWAP.swapForm.to.inputPlaceholder"),textInputTextAlign:"right",textInputValidator:N,onTextInputChange:e=>{var t;(t=e)!==le&&(mt(),wt(),ke(""),Q(""),Tt(t,!1)&&J(!0),ce(t))},onTextInputFocus:()=>{H(rt.TO)},onSelectChange:St,textInputErrorMessage:n(pe),selectErrorMessage:n(xe),selectedOption:ye?I(ye.symbol,ye.address):void 0,coinSelectorHeading:n("views.SWAP.swapForm.to.selectorTitle"),defaultTokenImage:h,environment:S?.config.environment,theme:o})]})]}),!g(x)&&i(me,{gasFeeFiatValue:Le,gasFeeToken:Oe,gasFeeValue:_e,fees:qe,onFeesClick:()=>{K({userJourney:y.SWAP,screen:"SwapCoins",control:"ViewFees",controlType:"Button"})},sx:{paddingBottom:"0"},loading:$})]}),i(Be,{validator:()=>{const e=function(e){return e?"":"views.SWAP.validation.noFromTokenSelected"}(te),t=(a=ae,(o=X)&&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"}(ye),s=function(e){return e&&0!==parseFloat(e)?"":"views.SWAP.validation.noAmountInputted"}(le);z===rt.FROM?(ue(""),t&&Z(t)):z===rt.TO&&(Z(""),s&&ue(s)),e&&re(e),n&&he(n);let r=!0;return(e||n||t&&z===rt.FROM||s&&z===rt.TO)&&(r=!1),K({userJourney:y.SWAP,screen:"SwapCoins",control:"FormValid",controlType:"Button",extras:{isSwapFormValid:r,swapFromAddress:te?.address,swapFromAmount:X,swapFromTokenSymbol:te?.symbol,swapToAddress:ye?.address,swapToAmount:le,swapToTokenSymbol:ye?.symbol}}),r},updateLoading:e=>{J(e)},loading:$,transaction:Ce,data:{fromAmount:X,toAmount:le,fromTokenSymbol:te?.symbol,fromTokenAddress:te?.address,toTokenSymbol:ye?.symbol,toTokenAddress:ye?.address},insufficientFundsForGas:vt,openNotEnoughImxDrawer:()=>{lt(!1),Xe(!0)},openNetworkSwitchDrawer:()=>pt(!0)}),i(ze,{environment:S?.config.environment??V.PRODUCTION,visible:Ke,showAdjustAmount:te?.address===O,hasZeroImx:!1,onAddCoinsClick:()=>{G({payload:{type:E.UPDATE_VIEW,view:{type:A.TOP_UP_VIEW},currentViewData:{fromTokenAddress:te?.address??"",fromAmount:X,toTokenAddress:ye?.address??""}}})},onCloseDrawer:()=>Xe(!1)}),i(Ye,{visible:Qe,onCloseDrawer:()=>{lt(!1),oe(void 0),Q(""),Ee(void 0),ce("")}}),i(we,{visible:ct,targetChainId:T(S?.config),provider:x,checkout:S,onCloseDrawer:()=>pt(!1)})]})}const ct=(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 pt({theme:t,fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d}){const{t:l}=e(),{viewDispatch:p}=c.useContext(u),{eventTargetState:{eventTarget:f}}=c.useContext(j),{swapState:{tokenBalances:T}}=c.useContext(Re),{connectLoaderState:{checkout:v,provider:S}}=c.useContext(m),[x,h]=c.useState(!1),{page:b}=w();return c.useEffect((()=>{b({userJourney:y.SWAP,screen:"SwapCoins",extras:{fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d}})}),[]),c.useEffect((()=>{ct(T,$)&&!g(S)&&h(!0)}),[T]),i(H,{header:i(G,{title:l("views.SWAP.header.title"),onCloseButtonClick:()=>z(f)}),footer:i(ke,{environment:v?.config.environment,theme:t}),children:a(s,{sx:{height:"100%",display:"flex",flexDirection:"column",justifyContent:"space-between"},children:[i(lt,{data:{fromAmount:o,toAmount:n,fromTokenAddress:r,toTokenAddress:d},theme:t}),i(ze,{environment:v?.config.environment??V.PRODUCTION,visible:x,showAdjustAmount:!1,hasZeroImx:!0,onAddCoinsClick:()=>{p({payload:{type:E.UPDATE_VIEW,view:{type:A.TOP_UP_VIEW}}})},onCloseDrawer:()=>{h(!1)}})]})})}function ut({transactionResponse:t,swapForm:o}){const{t:a}=e(),{viewDispatch:n}=c.useContext(u),{page:s}=w();return c.useEffect((()=>{s({userJourney:y.SWAP,screen:"SwapInProgress",extras:{swapFormInfo:o}})}),[]),c.useEffect((()=>{(async()=>{try{const e=await t.wait();if(1===e.status)return void n({payload:{type:E.UPDATE_VIEW,view:{type:Ee.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:Ee.FAIL,data:o,reason:"Transaction failed"}}})}catch{n({payload:{type:E.UPDATE_VIEW,view:{type:Ee.FAIL,data:o,reason:"Transaction failed"}}})}})()}),[t]),i(J,{loadingText:a("views.SWAP.IN_PROGRESS.loading.text")})}function mt({data:t}){const{t:o}=e(),{swapState:{allowedTokens:n}}=c.useContext(Re),{connectLoaderState:r}=c.useContext(m),{checkout:d,provider:l}=r,{viewDispatch:f}=c.useContext(u),{eventTargetState:{eventTarget:T}}=c.useContext(j),S=g(l),[x,h]=c.useState(!1),[b,I]=c.useState(!1),[k,C]=c.useState(!1),[P,R]=c.useState(!1),[_,F]=c.useState(!1),[W,O]=c.useState(!1),{page:D,track:N}=w();c.useEffect((()=>{D({userJourney:y.SWAP,screen:"ApproveERC20",extras:{swapFormInfo:t.swapFormInfo}})}),[]);const L=c.useMemo((()=>n.find((e=>e.address===t.swapFormInfo.fromTokenAddress))),[n,t.swapFormInfo.fromTokenAddress]),V=c.useCallback((()=>{f({payload:{type:E.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:new Error("No checkout object or no provider object found")}}})}),[f]),U=c.useCallback((()=>{f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.SWAP,data:t.swapFormInfo}}})}),[f]),M=(e,t)=>{e.type!==v.UNPREDICTABLE_GAS_LIMIT?e.type===v.TRANSACTION_FAILED||e.type===v.INSUFFICIENT_FUNDS||e.receipt&&0===e.receipt.status?f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.FAIL,reason:"Transaction failed",data:t}}}):(console.error("Approve ERC20 failed",e),f({payload:{type:E.UPDATE_VIEW,view:{type:A.ERROR_VIEW,error:e}}})):f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.PRICE_SURGE,data:t}}})},q=(e,t=!1)=>({...e,gasPrice:t?p.from(0):void 0}),$=c.useCallback((async()=>{if(!P)if(N({userJourney:y.SWAP,screen:"ApproveERC20",control:"ApproveSpending",controlType:"Button"}),R(!0),d&&l){if(!x){h(!0);try{const e=await d.sendTransaction({provider:l,transaction:q(t.approveTransaction,S)});I(!0);if(1!==(await e.transactionResponse.wait()).status)return void f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.FAIL,data:t.swapFormInfo}}});I(!1),h(!1),C(!0)}catch(e){if(I(!1),h(!1),e.type===v.USER_REJECTED_REQUEST_ERROR)return void F(!0);M(e,t.swapFormInfo)}finally{R(!1)}}}else V()}),[d,l,V,f,O,t.approveTransaction,t.swapFormInfo,x,h,I]),Q=c.useMemo((()=>a(K,{heading:o(`views.APPROVE_ERC20.approveSpending.content.${S?"passport":"metamask"}.heading`),children:[S&&i(s,{children:o("views.APPROVE_ERC20.approveSpending.content.passport.body")}),!S&&i(s,{children:o("views.APPROVE_ERC20.approveSpending.content.metamask.body",{amount:`${t.swapFormInfo.fromAmount} ${L?.symbol||""}`})})]})),[t.swapFormInfo,L,S]),Y=c.useMemo((()=>i(X,{loading:P,actionText:o(_?"views.APPROVE_ERC20.approveSpending.footer.retryText":"views.APPROVE_ERC20.approveSpending.footer.buttonText"),onActionClick:$})),[_,$,P]),Z=c.useCallback((async()=>{if(!P)if(N({userJourney:y.SWAP,screen:"ApproveERC20",control:"ApproveSwap",controlType:"Button"}),R(!0),d&&l){if(!x){h(!0);try{const e=await d.sendTransaction({provider:l,transaction:q(t.transaction,S)});h(!1),f({payload:{type:E.UPDATE_VIEW,view:{type:Ee.IN_PROGRESS,data:{transactionResponse:e.transactionResponse,swapForm:t.swapFormInfo}}}})}catch(e){if(h(!1),e.type===v.USER_REJECTED_REQUEST_ERROR)return void O(!0);M(e,t.swapFormInfo)}finally{R(!1)}}}else V()}),[d,l,V,f,O,t.transaction,t.swapFormInfo,x,h]),ee=i(K,{heading:o("views.APPROVE_ERC20.approveSwap.content.heading"),children:i(s,{children:o("views.APPROVE_ERC20.approveSwap.content.body")})}),te=c.useMemo((()=>i(X,{loading:P,actionText:o(W?"views.APPROVE_ERC20.approveSwap.footer.retryText":"views.APPROVE_ERC20.approveSwap.footer.buttonText"),onActionClick:Z})),[W,Z,P]);return a(B,{children:[b&&i(J,{loadingText:o("views.APPROVE_ERC20.approveSpending.loading.text")}),!b&&i(H,{header:i(G,{transparent:!0,showBack:!0,onCloseButtonClick:()=>z(T),onBackButtonClick:U}),floatHeader:!0,heroContent:i(k?fe:Ie,{}),footer:k?te:Y,children:k?ee:Q})]})}function wt({amount:t,fromTokenAddress:o,toTokenAddress:n,config:s}){const{t:r}=e(),{eventTargetState:{eventTarget:d}}=c.useContext(j),{environment:l,theme:p,isOnRampEnabled:f,isSwapEnabled:g,isBridgeEnabled:v}=s,{connectLoaderState:{checkout:S,provider:x}}=c.useContext(m),[h,b]=c.useReducer(Q,{...Y,history:[]}),[I,k]=c.useReducer(_e,Ce),{page:C}=w(),[P,R]=c.useState(!1),_=c.useMemo((()=>({swapState:I,swapDispatch:k})),[I,k]),F=c.useMemo((()=>({viewState:h,viewDispatch:b})),[h,b]),W=c.useCallback(((e,t)=>{b({payload:{type:E.UPDATE_VIEW,view:{type:A.ERROR_VIEW,tryAgain:t,error:e}}})}),[b]),O=c.useCallback((()=>{b({payload:{type:E.UPDATE_VIEW,view:{type:Ee.SWAP}}})}),[b]),D=c.useCallback((async()=>{if(!S)throw new Error("loadBalances: missing checkout");if(!x)throw new Error("loadBalances: missing provider");try{const e=await ye({checkout:S,provider:x,allowTokenListType:Z.SWAP});if(void 0===e)return!1;k({payload:{type:Pe.SET_ALLOWED_TOKENS,allowedTokens:e.allowList.tokens}}),k({payload:{type:Pe.SET_TOKEN_BALANCES,tokenBalances:e.allowedBalances}})}catch(e){if(ee.nonRetryable(e))return W(e,D),!1}return!0}),[S,x]);return c.useEffect((()=>{(async()=>{if(!S||!x)return;const e=await S.getNetworkInfo({provider:x});if(e.chainId!==T(S.config))return;let t;try{t=await S.config.remote.getConfig("dex")}catch(e){return void W(e)}const o=new te({chainId:e.chainId,baseConfig:new oe({environment:l}),secondaryFees:t.secondaryFees,overrides:t.overrides});k({payload:{type:Pe.SET_EXCHANGE,exchange:o}}),k({payload:{type:Pe.SET_NETWORK,network:e}}),await D()&&h.view.type===A.LOADING_VIEW&&O()})()}),[S,x]),i(u.Provider,{value:F,children:i(Re.Provider,{value:_,children:a(he,{environment:l,children:[h.view.type===A.LOADING_VIEW&&i(J,{loadingText:r("views.LOADING_VIEW.text")}),h.view.type===Ee.SWAP&&i(pt,{theme:p,fromAmount:h.view.data?.fromAmount??t,fromTokenAddress:h.view.data?.fromTokenAddress??o,toTokenAddress:h.view.data?.toTokenAddress??n}),h.view.type===Ee.IN_PROGRESS&&i(ut,{transactionResponse:h.view.data.transactionResponse,swapForm:h.view.data.swapForm}),h.view.type===Ee.APPROVE_ERC20&&i(mt,{data:h.view.data}),h.view.type===Ee.SUCCESS&&i(ae,{statusText:r("views.SWAP.success.text"),actionText:r("views.SWAP.success.actionText"),onRenderEvent:()=>{C({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}}),ne(d,h.view.data.transactionHash)},onActionClick:()=>z(d),statusType:se.SUCCESS,testId:"success-view"}),h.view.type===Ee.FAIL&&i(ae,{statusText:r("views.SWAP.failed.text"),actionText:r("views.SWAP.failed.actionText"),onRenderEvent:()=>{C({userJourney:y.SWAP,screen:"SwapFailed"}),re(d,"Transaction failed")},onActionClick:()=>{h.view.type===Ee.FAIL&&b({payload:{type:E.UPDATE_VIEW,view:{type:Ee.SWAP,data:h.view.data}}})},statusType:se.FAILURE,onCloseClick:()=>z(d),testId:"fail-view"}),h.view.type===Ee.PRICE_SURGE&&i(ae,{statusText:r("views.SWAP.rejected.text"),actionText:r("views.SWAP.rejected.actionText"),onRenderEvent:()=>{C({userJourney:y.SWAP,screen:"PriceSurge"}),ie(d,"Price surge")},onActionClick:()=>{h.view.type===Ee.PRICE_SURGE&&b({payload:{type:E.UPDATE_VIEW,view:{type:Ee.SWAP,data:h.view.data}}})},statusType:se.WARNING,onCloseClick:()=>z(d),testId:"price-surge-view"}),h.view.type===A.ERROR_VIEW&&i(de,{actionText:r("views.ERROR_VIEW.actionText"),onActionClick:async()=>{R(!0);const e=h.view;if(!e.tryAgain)return O(),void R(!1);await e.tryAgain()&&O(),R(!1)},onCloseClick:()=>z(d),errorEventActionLoading:P}),h.view.type===A.TOP_UP_VIEW&&i(xe,{analytics:{userJourney:y.SWAP},checkout:S,provider:x,widgetEvent:le.IMTBL_SWAP_WIDGET_EVENT,showOnrampOption:f,showSwapOption:g,showBridgeOption:v,onCloseButtonClick:()=>z(d)})]})})})}export{wt as default};
@@ -1 +1 @@
1
- import{at as t,co as e,cp as n,cq as o,cr as i,cs as r,ct as s,r as a,z as c,bG as l,j as u,n as d,M as f,a as m,l as h,V as E,E as p,t as g,bZ as S,$ as v,H as _,o as w,a3 as A,I,p as T,F as b}from"./index-9bf3a185.js";const C=new e(n),O={},y=t.from(0),R=t.from(-1);function x(t,n,o,i){const r={fault:n,operation:o};return void 0!==i&&(r.value=i),C.throwError(t,e.errors.NUMERIC_FAULT,r)}let N="0";for(;N.length<256;)N+=N;function P(e){if("number"!=typeof e)try{e=t.from(e).toNumber()}catch(t){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+N.substring(0,e):C.throwArgumentError("invalid decimal size","decimals",e)}function F(e,n){null==n&&(n=0);const o=P(n),i=(e=t.from(e)).lt(y);i&&(e=e.mul(R));let r=e.mod(o).toString();for(;r.length<o.length-1;)r="0"+r;r=r.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(o).toString();return e=1===o.length?s:s+"."+r,i&&(e="-"+e),e}function L(e,n){null==n&&(n=0);const o=P(n);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||C.throwArgumentError("invalid decimal value","value",e);const i="-"===e.substring(0,1);i&&(e=e.substring(1)),"."===e&&C.throwArgumentError("missing value","value",e);const r=e.split(".");r.length>2&&C.throwArgumentError("too many decimal points","value",e);let s=r[0],a=r[1];for(s||(s="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>o.length-1&&x("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<o.length-1;)a+="0";const c=t.from(s),l=t.from(a);let u=c.mul(o).add(l);return i&&(u=u.mul(R)),u}class U{constructor(t,n,o,i){t!==O&&C.throwError("cannot use FixedFormat constructor; use FixedFormat.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=n,this.width=o,this.decimals=i,this.name=(n?"":"u")+"fixed"+String(o)+"x"+String(i),this._multiplier=P(i),Object.freeze(this)}static from(t){if(t instanceof U)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,n=128,o=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||C.throwArgumentError("invalid fixed format","format",t),e="u"!==i[1],n=parseInt(i[2]),o=parseInt(i[3])}else if(t){const i=(e,n,o)=>null==t[e]?o:(typeof t[e]!==n&&C.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),n=i("width","number",n),o=i("decimals","number",o)}return n%8&&C.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),o>80&&C.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",o),new U(O,e,n,o)}}class k{constructor(t,n,o,i){t!==O&&C.throwError("cannot use FixedNumber constructor; use FixedNumber.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=n,this._value=o,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&C.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=k.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(W.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=k.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(W.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&C.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=k.from("1"+N.substring(0,t),this.format),o=D.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(o).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&C.throwArgumentError("invalid byte width","width",e);const n=t.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return o(n,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return k.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||i(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),k.fromString(F(t,e),U.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=U.from(e),i=L(t,n.decimals);!n.signed&&i.lt(y)&&x("unsigned value cannot be negative","overflow","value",t);let r=null;n.signed?r=i.toTwos(n.width).toHexString():(r=i.toHexString(),r=o(r,n.width/8));const s=F(i,n.decimals);return new k(O,r,s,n)}static fromBytes(e,n){null==n&&(n="fixed");const o=U.from(n);if(r(e).length>o.width/8)throw new Error("overflow");let i=t.from(e);o.signed&&(i=i.fromTwos(o.width));const s=i.toTwos((o.signed?0:1)+o.width).toHexString(),a=F(i,o.decimals);return new k(O,s,a,o)}static from(t,n){if("string"==typeof t)return k.fromString(t,n);if(s(t))return k.fromBytes(t,n);try{return k.fromValue(t,0,n)}catch(t){if(t.code!==e.errors.INVALID_ARGUMENT)throw t}return C.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const W=k.from(1),D=k.from("0.5"),B=new e("units/5.7.0"),V=["wei","kwei","mwei","gwei","szabo","finney","ether"];function M(t,e){if("string"==typeof e){const t=V.indexOf(e);-1!==t&&(e=3*t)}return F(t,null!=e?e:18)}function $(t,e){if("string"!=typeof t&&B.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=V.indexOf(e);-1!==t&&(e=3*t)}return L(t,null!=e?e:18)}function G(t){return $(t,18)}var K;!function(t){t.USD="usd"}(K||(K={}));const H={cryptoFiat:null,fiatSymbol:K.USD,tokenSymbols:[],conversions:new Map};var Y;!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"}(Y||(Y={}));const z=a.createContext({cryptoFiatState:H,cryptoFiatDispatch:()=>{}}),j=(t,e)=>{switch(e.payload.type){case Y.SET_CRYPTO_FIAT:return{...t,cryptoFiat:e.payload.cryptoFiat};case Y.SET_FIAT_SYMBOL:return{...t,fiatSymbol:e.payload.fiatSymbol};case Y.SET_TOKEN_SYMBOLS:return{...t,tokenSymbols:e.payload.tokenSymbols};case Y.SET_CONVERSIONS:return{...t,conversions:e.payload.conversions};default:return t}};var X;!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"}(X||(X={}));class q{baseConfig;constructor({baseConfig:t}){this.baseConfig=t}}const J={[c.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[c.PRODUCTION]:"https://checkout-api.immutable.com"};class Z{coinsCache;overridesCache;config;constructor(t){this.coinsCache=null,this.overridesCache=null,this.config=t.baseConfig}urlWithPath(t){return J[this.config.environment]+t}async fetchOverrides(){if(null!==this.overridesCache)return;const t=this.urlWithPath("/v1/fiat/coins/overrides"),e=await l.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 l.get(t);if(200!==e.status)throw new Error(`Error fetching coins list: ${e.status} ${e.statusText}`);const{data:n}=e;this.coinsCache=new Map;for(const t of n){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 n=e.filter((t=>""!==t));0===n.length&&n.push("usd"),await this.fetchCoins();const o=t.map((t=>this.coinsCache.get(t.toLowerCase()))).filter((t=>""!==t&&void 0!==t)).join(","),i=n.join(",").toLowerCase(),r=this.urlWithPath(`/v1/fiat/conversion?ids=${o}&currencies=${i}`),s=await l.get(r);if(200!==s.status)throw new Error(`Error fetching prices: ${s.status} ${s.statusText}`);const{data:a}=s,c={};for(const e of t){const t=e.toLowerCase(),n=this.coinsCache.get(t);c[t]={},n&&(c[t]=a[n]||{})}return c}}const Q=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 i=t[o][e];void 0!==i&&n.set(o,i)}return n})(await t.convert({tokenSymbols:n,fiatSymbols:[e]}),e)}catch(t){return new Map}},tt=["ETH","IMX"];function et({environment:t,children:e}){const[n,o]=a.useReducer(j,H),{cryptoFiat:i,fiatSymbol:r,tokenSymbols:s}=n;return a.useEffect((()=>{o({payload:{type:Y.SET_CRYPTO_FIAT,cryptoFiat:new Z(new q({baseConfig:{environment:t}}))}})}),[]),a.useEffect((()=>{i&&r&&(async()=>{const t=await Q(i,r,[...new Set([...s,...tt])]);o({payload:{type:Y.SET_CONVERSIONS,conversions:t}})})()}),[i,s,r]),u(z.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:o},children:e})}var nt;!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"}(nt||(nt={}));const ot=(t,e,n)=>{const o=a.useRef(!1);a.useEffect((()=>{o.current||("function"!=typeof e||e())&&(t(),o.current=!0)}),n||[])};const it=(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=M(t,e.decimals),r=n.get(e.symbol.toLocaleLowerCase());if(r){const t=parseFloat(i);if(Number.isNaN(t))return o;o=t*r}}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 rt;function st({testId:t,icon:e,iconVariant:n,intentIcon:o,heading:i,caption:r,onClick:s,renderFeeFunction:a,isDisabled:c}){return u(m,{testId:"top-up-view",sx:{paddingY:"1px"},children:d(f,{testId:`menu-item-${t}`,size:"small",emphasized:!0,onClick:c?void 0:s,sx:c?{opacity:"0.5",cursor:"not-allowed"}:{},children:[u(f.Icon,{icon:e,variant:n}),u(f.Label,{size:"medium",children:i}),u(f.IntentIcon,{icon:o}),d(f.Caption,{testId:`menu-item-caption-${t}`,children:[r,u("br",{}),c?"":a("-.--",!1)]})]})})}!function(t){t.ONRAMP="ONRAMP",t.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL"}(rt||(rt={}));const at={[c.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[c.PRODUCTION]:"https://toolkit.immutable.com"};function ct({widgetEvent:t,checkout:e,provider:n,showOnrampOption:o,showSwapOption:i,showBridgeOption:r,tokenAddress:s,amount:l,analytics:f,onCloseButtonClick:C,onBackButtonClick:O,heading:y,subheading:R}){const{t:x}=h(),{userJourney:N}=f,{viewDispatch:P}=a.useContext(E),{cryptoFiatState:F,cryptoFiatDispatch:L}=a.useContext(z),{conversions:U,fiatSymbol:k}=F,W=e?.config.environment??c.SANDBOX,{eventTargetState:{eventTarget:D}}=a.useContext(p),[B,V]=a.useState("-.--"),[,M]=a.useState("-.--"),[$,G]=a.useState(!0),K=y?x(...y):x("views.TOP_UP_VIEW.header.title"),H=R?x(...R):null,{page:j,track:q}=g();ot((()=>{j({userJourney:N,screen:"TopUp"})})),a.useEffect((()=>{L&&L({payload:{type:Y.SET_TOKEN_SYMBOLS,tokenSymbols:tt}})}),[L]),a.useEffect((()=>{e&&(async()=>{const t=await e.gasEstimate({gasEstimateType:S.BRIDGE_TO_L2}),n=await it(t,U);M(n)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{const t=(t=>{const{minPercentage:e,maxPercentage:n}=t;return void 0===e||void 0===n?"-.--":`${e}% to ${n}`})(await e.getExchangeFeeEstimate());V(t)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{G(await e.isSwapAvailable())})()}),[void 0!==e]);const J=(t,e,n="Button")=>{q({userJourney:N,screen:"TopUp",control:t,controlType:n,extras:e})},Z=()=>{if(t===I.IMTBL_ONRAMP_WIDGET_EVENT){const e={tokenAddress:"",amount:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:rt.ONRAMP,data:e}}}),void J("OnRamp",{...e,widgetEvent:t})}const e={tokenAddress:s??"",amount:l??""};b.sendRequestOnrampEvent(D,t,e),J("OnRamp",{...e,widgetEvent:t})},Q=t=>u(m,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:t}),et=[{testId:"onramp",icon:"BankCard",iconVariant:"bold",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.debit",onClickEvent:Z,fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.debit.subcaption")} ≈ ${B}%`),isAvailable:!0,isEnabled:o},{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.credit",onClickEvent:Z,fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.credit.subcaption")} ≈ ${B}%`),isAvailable:!0,isEnabled:o},{testId:"advanced",icon:"Minting",iconVariant:"bold",intentIcon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const e=at[W];J("AdvancedOptions",{...{tokenAddress:s??"",amount:l??""},widgetEvent:t}),window.open(`${e}/faster-bridge/`,"_blank")},fee:()=>Q(""),isAvailable:!0,isEnabled:!0},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(t===I.IMTBL_SWAP_WIDGET_EVENT){const e={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:X.SWAP,data:e}}}),void J("Swap",{...e,widgetEvent:t})}const e={fromTokenAddress:"",toTokenAddress:s??"",amount:""};b.sendRequestSwapEvent(D,t,e),J("Swap",{...e,widgetEvent:t})},fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${k.toUpperCase()}`),isAvailable:$,isEnabled:i},{testId:"bridge",icon:"ArrowForward",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(t===I.IMTBL_BRIDGE_WIDGET_EVENT){const e={fromTokenAddress:"",fromAmount:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:nt.WALLET_NETWORK_SELECTION,data:e}}}),void J("Bridge",{...e,widgetEvent:t})}const e={tokenAddress:"",amount:""};b.sendRequestBridgeEvent(D,t,e),J("Bridge",{...e,widgetEvent:t})},fee:()=>Q(""),isAvailable:!0,isEnabled:r}];return u(A,{header:u(v,{onBackButtonClick:O,onCloseButtonClick:C,showBack:!0}),children:d(m,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[u(_,{size:"small",children:K}),H&&u(w,{size:"small",sx:{color:"base.color.text.body.secondary"},children:H}),u(m,{sx:{paddingY:"base.spacing.x4"},children:et.sort(((t,e)=>Number(e.isAvailable)-Number(t.isAvailable))).map((t=>t.isEnabled&&u(st,{testId:t.testId,icon:t.icon,iconVariant:t.iconVariant,intentIcon:t.intentIcon,heading:x(`${t.textConfigKey}.heading`),caption:t.isAvailable?x(`${t.textConfigKey}.caption`):x(`${t.textConfigKey}.disabledCaption`),onClick:t.onClickEvent,renderFeeFunction:t.fee,isDisabled:!t.isAvailable},x(`${t.textConfigKey}.heading`).toLowerCase())))})]})})}export{nt as B,z as C,rt as O,X as S,ct as T,Y as a,et as b,G as c,M as f,$ as p,ot as u};
1
+ import{at as t,co as e,cp as n,cq as o,cr as i,cs as r,ct as s,r as a,z as c,bG as l,j as u,n as d,M as f,a as m,l as h,V as E,E as p,t as g,bZ as S,$ as v,H as _,o as w,a3 as A,I,p as T,F as b}from"./index-23793c68.js";const C=new e(n),O={},y=t.from(0),R=t.from(-1);function x(t,n,o,i){const r={fault:n,operation:o};return void 0!==i&&(r.value=i),C.throwError(t,e.errors.NUMERIC_FAULT,r)}let N="0";for(;N.length<256;)N+=N;function P(e){if("number"!=typeof e)try{e=t.from(e).toNumber()}catch(t){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+N.substring(0,e):C.throwArgumentError("invalid decimal size","decimals",e)}function F(e,n){null==n&&(n=0);const o=P(n),i=(e=t.from(e)).lt(y);i&&(e=e.mul(R));let r=e.mod(o).toString();for(;r.length<o.length-1;)r="0"+r;r=r.match(/^([0-9]*[1-9]|0)(0*)/)[1];const s=e.div(o).toString();return e=1===o.length?s:s+"."+r,i&&(e="-"+e),e}function L(e,n){null==n&&(n=0);const o=P(n);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||C.throwArgumentError("invalid decimal value","value",e);const i="-"===e.substring(0,1);i&&(e=e.substring(1)),"."===e&&C.throwArgumentError("missing value","value",e);const r=e.split(".");r.length>2&&C.throwArgumentError("too many decimal points","value",e);let s=r[0],a=r[1];for(s||(s="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>o.length-1&&x("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<o.length-1;)a+="0";const c=t.from(s),l=t.from(a);let u=c.mul(o).add(l);return i&&(u=u.mul(R)),u}class U{constructor(t,n,o,i){t!==O&&C.throwError("cannot use FixedFormat constructor; use FixedFormat.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=n,this.width=o,this.decimals=i,this.name=(n?"":"u")+"fixed"+String(o)+"x"+String(i),this._multiplier=P(i),Object.freeze(this)}static from(t){if(t instanceof U)return t;"number"==typeof t&&(t=`fixed128x${t}`);let e=!0,n=128,o=18;if("string"==typeof t)if("fixed"===t);else if("ufixed"===t)e=!1;else{const i=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||C.throwArgumentError("invalid fixed format","format",t),e="u"!==i[1],n=parseInt(i[2]),o=parseInt(i[3])}else if(t){const i=(e,n,o)=>null==t[e]?o:(typeof t[e]!==n&&C.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e]);e=i("signed","boolean",e),n=i("width","number",n),o=i("decimals","number",o)}return n%8&&C.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),o>80&&C.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",o),new U(O,e,n,o)}}class k{constructor(t,n,o,i){t!==O&&C.throwError("cannot use FixedNumber constructor; use FixedNumber.from",e.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=n,this._value=o,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(t){this.format.name!==t.format.name&&C.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",t)}addUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.add(n),this.format.decimals,this.format)}subUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.sub(n),this.format.decimals,this.format)}mulUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(t){this._checkFormat(t);const e=L(this._value,this.format.decimals),n=L(t._value,t.format.decimals);return k.fromValue(e.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=k.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return this.isNegative()&&n&&(e=e.subUnsafe(W.toFormat(e.format))),e}ceiling(){const t=this.toString().split(".");1===t.length&&t.push("0");let e=k.from(t[0],this.format);const n=!t[1].match(/^(0*)$/);return!this.isNegative()&&n&&(e=e.addUnsafe(W.toFormat(e.format))),e}round(t){null==t&&(t=0);const e=this.toString().split(".");if(1===e.length&&e.push("0"),(t<0||t>80||t%1)&&C.throwArgumentError("invalid decimal count","decimals",t),e[1].length<=t)return this;const n=k.from("1"+N.substring(0,t),this.format),o=D.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(o).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&C.throwArgumentError("invalid byte width","width",e);const n=t.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return o(n,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return k.fromString(this._value,t)}static fromValue(t,e,n){return null!=n||null==e||i(e)||(n=e,e=null),null==e&&(e=0),null==n&&(n="fixed"),k.fromString(F(t,e),U.from(n))}static fromString(t,e){null==e&&(e="fixed");const n=U.from(e),i=L(t,n.decimals);!n.signed&&i.lt(y)&&x("unsigned value cannot be negative","overflow","value",t);let r=null;n.signed?r=i.toTwos(n.width).toHexString():(r=i.toHexString(),r=o(r,n.width/8));const s=F(i,n.decimals);return new k(O,r,s,n)}static fromBytes(e,n){null==n&&(n="fixed");const o=U.from(n);if(r(e).length>o.width/8)throw new Error("overflow");let i=t.from(e);o.signed&&(i=i.fromTwos(o.width));const s=i.toTwos((o.signed?0:1)+o.width).toHexString(),a=F(i,o.decimals);return new k(O,s,a,o)}static from(t,n){if("string"==typeof t)return k.fromString(t,n);if(s(t))return k.fromBytes(t,n);try{return k.fromValue(t,0,n)}catch(t){if(t.code!==e.errors.INVALID_ARGUMENT)throw t}return C.throwArgumentError("invalid FixedNumber value","value",t)}static isFixedNumber(t){return!(!t||!t._isFixedNumber)}}const W=k.from(1),D=k.from("0.5"),B=new e("units/5.7.0"),V=["wei","kwei","mwei","gwei","szabo","finney","ether"];function M(t,e){if("string"==typeof e){const t=V.indexOf(e);-1!==t&&(e=3*t)}return F(t,null!=e?e:18)}function $(t,e){if("string"!=typeof t&&B.throwArgumentError("value must be a string","value",t),"string"==typeof e){const t=V.indexOf(e);-1!==t&&(e=3*t)}return L(t,null!=e?e:18)}function G(t){return $(t,18)}var K;!function(t){t.USD="usd"}(K||(K={}));const H={cryptoFiat:null,fiatSymbol:K.USD,tokenSymbols:[],conversions:new Map};var Y;!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"}(Y||(Y={}));const z=a.createContext({cryptoFiatState:H,cryptoFiatDispatch:()=>{}}),j=(t,e)=>{switch(e.payload.type){case Y.SET_CRYPTO_FIAT:return{...t,cryptoFiat:e.payload.cryptoFiat};case Y.SET_FIAT_SYMBOL:return{...t,fiatSymbol:e.payload.fiatSymbol};case Y.SET_TOKEN_SYMBOLS:return{...t,tokenSymbols:e.payload.tokenSymbols};case Y.SET_CONVERSIONS:return{...t,conversions:e.payload.conversions};default:return t}};var X;!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"}(X||(X={}));class q{baseConfig;constructor({baseConfig:t}){this.baseConfig=t}}const J={[c.SANDBOX]:"https://checkout-api.sandbox.immutable.com",[c.PRODUCTION]:"https://checkout-api.immutable.com"};class Z{coinsCache;overridesCache;config;constructor(t){this.coinsCache=null,this.overridesCache=null,this.config=t.baseConfig}urlWithPath(t){return J[this.config.environment]+t}async fetchOverrides(){if(null!==this.overridesCache)return;const t=this.urlWithPath("/v1/fiat/coins/overrides"),e=await l.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 l.get(t);if(200!==e.status)throw new Error(`Error fetching coins list: ${e.status} ${e.statusText}`);const{data:n}=e;this.coinsCache=new Map;for(const t of n){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 n=e.filter((t=>""!==t));0===n.length&&n.push("usd"),await this.fetchCoins();const o=t.map((t=>this.coinsCache.get(t.toLowerCase()))).filter((t=>""!==t&&void 0!==t)).join(","),i=n.join(",").toLowerCase(),r=this.urlWithPath(`/v1/fiat/conversion?ids=${o}&currencies=${i}`),s=await l.get(r);if(200!==s.status)throw new Error(`Error fetching prices: ${s.status} ${s.statusText}`);const{data:a}=s,c={};for(const e of t){const t=e.toLowerCase(),n=this.coinsCache.get(t);c[t]={},n&&(c[t]=a[n]||{})}return c}}const Q=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 i=t[o][e];void 0!==i&&n.set(o,i)}return n})(await t.convert({tokenSymbols:n,fiatSymbols:[e]}),e)}catch(t){return new Map}},tt=["ETH","IMX"];function et({environment:t,children:e}){const[n,o]=a.useReducer(j,H),{cryptoFiat:i,fiatSymbol:r,tokenSymbols:s}=n;return a.useEffect((()=>{o({payload:{type:Y.SET_CRYPTO_FIAT,cryptoFiat:new Z(new q({baseConfig:{environment:t}}))}})}),[]),a.useEffect((()=>{i&&r&&(async()=>{const t=await Q(i,r,[...new Set([...s,...tt])]);o({payload:{type:Y.SET_CONVERSIONS,conversions:t}})})()}),[i,s,r]),u(z.Provider,{value:{cryptoFiatState:n,cryptoFiatDispatch:o},children:e})}var nt;!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"}(nt||(nt={}));const ot=(t,e,n)=>{const o=a.useRef(!1);a.useEffect((()=>{o.current||("function"!=typeof e||e())&&(t(),o.current=!0)}),n||[])};const it=(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=M(t,e.decimals),r=n.get(e.symbol.toLocaleLowerCase());if(r){const t=parseFloat(i);if(Number.isNaN(t))return o;o=t*r}}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 rt;function st({testId:t,icon:e,iconVariant:n,intentIcon:o,heading:i,caption:r,onClick:s,renderFeeFunction:a,isDisabled:c}){return u(m,{testId:"top-up-view",sx:{paddingY:"1px"},children:d(f,{testId:`menu-item-${t}`,size:"small",emphasized:!0,onClick:c?void 0:s,sx:c?{opacity:"0.5",cursor:"not-allowed"}:{},children:[u(f.Icon,{icon:e,variant:n}),u(f.Label,{size:"medium",children:i}),u(f.IntentIcon,{icon:o}),d(f.Caption,{testId:`menu-item-caption-${t}`,children:[r,u("br",{}),c?"":a("-.--",!1)]})]})})}!function(t){t.ONRAMP="ONRAMP",t.IN_PROGRESS_LOADING="IN_PROGRESS_LOADING",t.IN_PROGRESS="IN_PROGRESS",t.SUCCESS="SUCCESS",t.FAIL="FAIL"}(rt||(rt={}));const at={[c.SANDBOX]:"https://checkout-playground.sandbox.immutable.com",[c.PRODUCTION]:"https://toolkit.immutable.com"};function ct({widgetEvent:t,checkout:e,provider:n,showOnrampOption:o,showSwapOption:i,showBridgeOption:r,tokenAddress:s,amount:l,analytics:f,onCloseButtonClick:C,onBackButtonClick:O,heading:y,subheading:R}){const{t:x}=h(),{userJourney:N}=f,{viewDispatch:P}=a.useContext(E),{cryptoFiatState:F,cryptoFiatDispatch:L}=a.useContext(z),{conversions:U,fiatSymbol:k}=F,W=e?.config.environment??c.SANDBOX,{eventTargetState:{eventTarget:D}}=a.useContext(p),[B,V]=a.useState("-.--"),[,M]=a.useState("-.--"),[$,G]=a.useState(!0),K=y?x(...y):x("views.TOP_UP_VIEW.header.title"),H=R?x(...R):null,{page:j,track:q}=g();ot((()=>{j({userJourney:N,screen:"TopUp"})})),a.useEffect((()=>{L&&L({payload:{type:Y.SET_TOKEN_SYMBOLS,tokenSymbols:tt}})}),[L]),a.useEffect((()=>{e&&(async()=>{const t=await e.gasEstimate({gasEstimateType:S.BRIDGE_TO_L2}),n=await it(t,U);M(n)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{const t=(t=>{const{minPercentage:e,maxPercentage:n}=t;return void 0===e||void 0===n?"-.--":`${e}% to ${n}`})(await e.getExchangeFeeEstimate());V(t)})()}),[void 0!==e]),a.useEffect((()=>{e&&(async()=>{G(await e.isSwapAvailable())})()}),[void 0!==e]);const J=(t,e,n="Button")=>{q({userJourney:N,screen:"TopUp",control:t,controlType:n,extras:e})},Z=()=>{if(t===I.IMTBL_ONRAMP_WIDGET_EVENT){const e={tokenAddress:"",amount:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:rt.ONRAMP,data:e}}}),void J("OnRamp",{...e,widgetEvent:t})}const e={tokenAddress:s??"",amount:l??""};b.sendRequestOnrampEvent(D,t,e),J("OnRamp",{...e,widgetEvent:t})},Q=t=>u(m,{sx:{fontSize:"base.text.caption.small.regular.fontSize",c:"base.color.translucent.standard.600"},children:t}),et=[{testId:"onramp",icon:"BankCard",iconVariant:"bold",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.debit",onClickEvent:Z,fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.debit.subcaption")} ≈ ${B}%`),isAvailable:!0,isEnabled:o},{testId:"onramp",icon:"BankCard",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.credit",onClickEvent:Z,fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.credit.subcaption")} ≈ ${B}%`),isAvailable:!0,isEnabled:o},{testId:"advanced",icon:"Minting",iconVariant:"bold",intentIcon:"JumpTo",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.advanced",onClickEvent:()=>{const e=at[W];J("AdvancedOptions",{...{tokenAddress:s??"",amount:l??""},widgetEvent:t}),window.open(`${e}/faster-bridge/`,"_blank")},fee:()=>Q(""),isAvailable:!0,isEnabled:!0},{testId:"swap",icon:"Swap",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.swap",onClickEvent:()=>{if(t===I.IMTBL_SWAP_WIDGET_EVENT){const e={toTokenAddress:"",fromAmount:"",fromTokenAddress:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:X.SWAP,data:e}}}),void J("Swap",{...e,widgetEvent:t})}const e={fromTokenAddress:"",toTokenAddress:s??"",amount:""};b.sendRequestSwapEvent(D,t,e),J("Swap",{...e,widgetEvent:t})},fee:()=>Q(`${x("views.TOP_UP_VIEW.topUpOptions.swap.subcaption")} ≈ $0.05 ${k.toUpperCase()}`),isAvailable:$,isEnabled:i},{testId:"bridge",icon:"ArrowForward",textConfigKey:"views.TOP_UP_VIEW.topUpOptions.bridge",onClickEvent:()=>{if(t===I.IMTBL_BRIDGE_WIDGET_EVENT){const e={fromTokenAddress:"",fromAmount:""};return P({payload:{type:T.UPDATE_VIEW,view:{type:nt.WALLET_NETWORK_SELECTION,data:e}}}),void J("Bridge",{...e,widgetEvent:t})}const e={tokenAddress:"",amount:""};b.sendRequestBridgeEvent(D,t,e),J("Bridge",{...e,widgetEvent:t})},fee:()=>Q(""),isAvailable:!0,isEnabled:r}];return u(A,{header:u(v,{onBackButtonClick:O,onCloseButtonClick:C,showBack:!0}),children:d(m,{sx:{paddingX:"base.spacing.x4",paddingY:"base.spacing.x4"},children:[u(_,{size:"small",children:K}),H&&u(w,{size:"small",sx:{color:"base.color.text.body.secondary"},children:H}),u(m,{sx:{paddingY:"base.spacing.x4"},children:et.sort(((t,e)=>Number(e.isAvailable)-Number(t.isAvailable))).map((t=>t.isEnabled&&u(st,{testId:t.testId,icon:t.icon,iconVariant:t.iconVariant,intentIcon:t.intentIcon,heading:x(`${t.textConfigKey}.heading`),caption:t.isAvailable?x(`${t.textConfigKey}.caption`):x(`${t.textConfigKey}.disabledCaption`),onClick:t.onClickEvent,renderFeeFunction:t.fee,isDisabled:!t.isAvailable},x(`${t.textConfigKey}.heading`).toLowerCase())))})]})})}export{nt as B,z as C,rt as O,X as S,ct as T,Y as a,et as b,G as c,M as f,$ as p,ot as u};
@@ -1 +1 @@
1
- import{B as e,_ as t,u as n,g as o,D as a,m as s,r,f as i,j as l,i as c,S as d,a as p,b as L,c as u,s as h,C,d as b,e as k,h as f,k as m,T as w,l as g,V as y,n as E,o as S,p as T,q as v,t as x,v as A,E as I,w as O,x as M,y as W,z as _,M as N,H as B,A as F,U as P,F as j,I as D,Z,G as R,J as z,K as U,L as V,N as G,O as $,P as H,Q as J,R as K,W as X,X as Y,Y as q,$ as Q,a0 as ee,a1 as te,a2 as ne,a3 as oe,a4 as ae,a5 as se,a6 as re,a7 as ie,a8 as le,a9 as ce,aa as de,ab as pe,ac as Le,ad as ue,ae as he,af as Ce,ag as be,ah as ke,ai as fe,aj as me,ak as we}from"./index-9bf3a185.js";import{C as ge,a as ye,b as Ee,T as Se}from"./TopUpView-816276af.js";import{T as Te,r as ve,u as xe}from"./retry-fda49d8c.js";var Ae={justifyContent:"stretch",bg:"base.color.translucent.standard.100",position:"relative",d:"flex",w:"100%"};function Ie(e){var t=e.size,n=e.theme,o=/large|medium/.test(t)?n.base.spacing.x2:n.base.spacing.x1;return{gap:o,padding:o,borderRadius:/large|medium/.test(t)?n.base.borderRadius.x8:n.base.borderRadius.x4}}var Oe=function(e){var t=e.size,n=e.theme;return L({size:t,theme:n,renderSxAtSize:Ie})},Me={flex:1,paddingX:"base.spacing.x4",transitionProperty:"background, color, box-shadow",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","& > span":{textAlign:"left",whiteSpace:"nowrap"},"&.HorizontalMenuButton, &.HorizontalMenuButtCon":{"&:hover:not([disabled])::before":{content:"unset"},"&:hover:not([disabled])":{bg:"base.color.translucent.emphasis.200",boxShadow:function(e){var t=e.base;return"inset 0 0 0 ".concat(t.border.size[100]," ").concat(t.color.translucent.standard[1e3])}},"&:active:not([disabled])":{bg:"base.color.translucent.emphasis.100"},"&.selected":{bg:"base.color.translucent.inverse.500"},"&.selected, &:active:not([disabled])":{boxShadow:function(e){var t=e.base;return"inset 0 0 0 ".concat(t.border.size[200]," ").concat(t.color.translucent.standard[1e3])}}}};function We(e){var t=e.size,n=e.theme;return{borderRadius:/large|medium/.test(t)?n.base.borderRadius.x4:n.base.spacing.x2}}var _e=function(e){var t=e.size,n=e.theme;return L({size:t,theme:n,renderSxAtSize:We})},Ne=["sx","size","selected","className"];function Be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pe(i){var c=i.sx,d=void 0===c?{}:c,p=i.size,L=void 0===p?"medium":p,b=i.selected,k=i.className,f=t(i,Ne),m=n(),w=o(L,a,u),g=r.useMemo((function(){return s(Me,We({size:w,theme:m}),_e({size:L,theme:m}),h(d,"base.color.translucent.emphasis.100"),d)}),[d,w,L,m]);return l(C,{children:function(t){var n=t.cx;return l(e,Fe(Fe({},f),{},{size:L,variant:"tertiary",sx:g,className:n(k,"HorizontalMenuButtCon",{selected:b})}))}})}Pe.displayName="HorizontalMenuButtCon",Pe.SvgIcon=e.SvgIcon;var je=["children","sx","size","selected","className"];function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Re(e){var i=e.children,c=e.sx,d=void 0===c?{}:c,p=e.size,L=void 0===p?"medium":p,k=e.selected,f=e.className,m=t(e,je),w=n(),g=o(L,a,u),y=r.useMemo((function(){return s(Me,We({size:g,theme:w}),_e({size:L,theme:w}),h(d,"base.color.translucent.emphasis.100"),d)}),[d,g,L,w]);return l(C,{children:function(e){var t=e.cx;return l(b,Ze(Ze({},m),{},{size:L,variant:"tertiary",className:t(f,"HorizontalMenuButton",{selected:k}),sx:y,children:i}))}})}Re.displayName="HorizontalMenuButton",Re.Icon=k,Re.Logo=f;var ze=["children","sx","size","className"];function Ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ge(e){var L=e.children,h=e.sx,C=void 0===h?{}:h,b=e.size,k=void 0===b?"medium":b,f=e.className,m=t(e,ze),w=n(),g=o(k,a,u),y=s(Ae,Ie({size:g,theme:w}),Oe({size:k,theme:w}),C),E=r.useMemo((function(){return i(L)}),[L]);return l(p,Ve(Ve({},m),{},{sx:y,className:"".concat(null!=f?f:""," HorizontalMenu"),children:r.Children.map(E,(function(e){return c(e,Pe)||c(e,Re)?l(d,{size:e.props.size?e.props.size:k,children:e}):e}))}))}Ge.displayName="HorizontalMenu",Ge.Button=Re,Ge.ButtCon=Pe;const $e={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var He;!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"}(He||(He={}));const Je=r.createContext({walletState:$e,walletDispatch:()=>{}});Je.displayName="WalletContext";const Ke=(e,t)=>{switch(t.payload.type){case He.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case He.SET_NETWORK:return{...e,network:t.payload.network};case He.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case He.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}},Xe=async(e,t)=>{const n=await e.getTokenAllowList({type:w.ALL,chainId:t}),o=new Set;return n.tokens.forEach((e=>{o.add(e.symbol)})),Array.from(o)},Ye={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},qe={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},Qe={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var et;function tt(t){const{t:n}=g(),{viewDispatch:o}=r.useContext(y),{totalBalance:a,loading:s}=t;return E(p,{sx:Ye,children:[E(p,{sx:qe,children:[l(S,{size:"medium",children:n("views.WALLET_BALANCES.totalTokenBalance.heading")}),l(p,{sx:{pl:"base.spacing.x1"},children:l(e,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:Qe,onClick:()=>o({payload:{type:T.UPDATE_VIEW,view:{type:et.COIN_INFO}}})})})]}),E(p,{sx:qe,children:[l(S,{testId:"total-token-balance-value",weight:"bold",shimmer:s?1:0,shimmerSx:{minw:"100px"},children:n("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!s&&E(S,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",a.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(et||(et={}));const nt=e=>({display:e?"":"none"});function ot({balanceInfo:e,theme:t,bridgeToL2OnClick:n}){const{connectLoaderState:o}=r.useContext(v),{track:a}=x(),{checkout:s,provider:i}=o,c=`≈ USD $${A(e.fiatAmount)}`,{walletState:d}=r.useContext(Je),{supportedTopUps:p,network:L}=d,[u,h]=r.useState(),[C,b]=r.useState(),[k,f]=r.useState(),{eventTargetState:{eventTarget:m}}=r.useContext(I),[g,y]=r.useState([]),S=O(i);r.useEffect((()=>{(async()=>{if(!s)return;const e=await s.getTokenAllowList({type:w.ONRAMP,chainId:M(s.config)});y(e.tokens)})()}),[s]),r.useEffect((()=>{if(!L||!p||!s)return;const e=L.chainId===M(s.config)&&(p?.isOnRampEnabled??!0);h(e);const t=(L.chainId===W(s.config)||L.chainId===M(s.config))&&(p?.isBridgeEnabled??!0);b(t);const n=L.chainId===M(s.config)&&(p?.isSwapEnabled??!0)&&(p?.isSwapAvailable??!0);f(n)}),[L,p,s,S]);const T=r.useMemo((()=>Boolean(u&&g.length>0&&g.find((t=>t.address?.toLowerCase()===e.address?.toLowerCase())))),[u,g]);return E(N,{testId:`balance-item-${e.symbol}`,emphasized:!0,children:[l(N.FramedImage,{use:l(Te,{theme:t,src:e.icon,name:e.symbol,environment:s?.config.environment??_.PRODUCTION}),circularFrame:!0}),l(N.Label,{children:e.symbol}),l(N.Caption,{children:e.description}),l(N.PriceDisplay,{testId:`balance-item-${e.symbol}`,use:l(B,{size:"xSmall"}),price:F(e.balance),fiatAmount:c}),(u||k||C)&&E(N.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}})},children:[E(N,{testId:"balance-item-add-option",sx:nt(T),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),j.sendRequestOnrampEvent(m,D.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e.address??"",amount:""})},children:[l(N.Icon,{icon:"Add"}),l(N.Label,{children:`Add ${e.symbol}`})]}),E(N,{testId:"balance-item-swap-option",sx:nt(k),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),j.sendRequestSwapEvent(m,D.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:e.address??"",toTokenAddress:"",amount:""})},children:[l(N.Icon,{icon:"Exchange"}),l(N.Label,{children:`Swap ${e.symbol}`})]}),E(N,{testId:"balance-item-move-option",sx:nt(C),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),n(e.address)},children:[l(N.Icon,{icon:"Minting"}),l(N.Label,{children:`Move ${e.symbol}`})]})]})]})}const at={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},st={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},rt=e=>e.filter((e=>e.balance!==Z||R(e.address)));function it({balanceInfoItems:e,theme:t,bridgeToL2OnClick:n}){const{t:o}=g(),a=rt(e);return E(p,{sx:at,children:[0===a.length&&l(p,{sx:st,children:l(S,{testId:"no-tokens-found",children:o("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),a.map((e=>l(ot,{balanceInfo:e,bridgeToL2OnClick:n,theme:t},e.id)))]})}const lt={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},ct={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},dt={fontWeight:"base.text.caption.small.bold.fontWeight"},pt=e=>({width:"22px",filter:e?void 0:"grayscale(1)"}),Lt={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function ut(){const{t:e}=g(),{connectLoaderState:t}=r.useContext(v),{eventTargetState:{eventTarget:n}}=r.useContext(I),{checkout:o,provider:a}=t,{viewDispatch:s}=r.useContext(y),{walletState:i,walletDispatch:c}=r.useContext(Je),{network:d}=i,[L,u]=r.useState([]),{track:h}=x(),C=r.useCallback((async e=>{if(o&&a&&d&&d.chainId!==e){h({userJourney:P.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await o.switchNetwork({provider:a,chainId:e});z(n,t.provider,t.network)}catch(e){e.type===U.USER_REJECTED_REQUEST_ERROR||s({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:e}}})}}}),[o,a,d,c,s]);return r.useEffect((()=>{(async()=>{if(o){const e=await o.getNetworkAllowList({type:G.ALL});u(e?.networks??[])}else u([])})()}),[o]),E(p,{testId:"network-menu",sx:lt,children:[l(S,{testId:"network-heading",size:"medium",sx:Lt,children:e("views.WALLET_BALANCES.networkStatus.heading")}),l(Ge,{children:o&&L?.sort(((e,t)=>$(e,t,o.config))).map((e=>E(Ge.Button,{testId:`${e.name}-network-button`,sx:e.chainId===d?.chainId?ct:dt,size:"small",onClick:()=>C(e.chainId),children:[l(H,{sx:pt(e.chainId===d?.chainId),use:l("img",{src:J(o?.config.environment,e.chainId),alt:e.name})}),e.name]},e.chainId)))})]})}const ht={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},Ct={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},bt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},kt=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},ft=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,mt=(e,t,n)=>t.map((t=>({id:ft(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:q(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function wt({balancesLoading:t,theme:n,showNetworkMenu:o}){const{t:a}=g(),{connectLoaderState:s}=r.useContext(v),{checkout:i,provider:c}=s,{cryptoFiatState:d,cryptoFiatDispatch:L}=r.useContext(ge),{walletState:u}=r.useContext(Je),{eventTargetState:{eventTarget:h}}=r.useContext(I),{viewDispatch:C}=r.useContext(y),[b,k]=r.useState(0),{network:f,supportedTopUps:m,tokenBalances:w}=u,{conversions:S}=d,A=!O(c)&&o,{track:W,page:_}=x(),B=r.useMemo((()=>mt(f?.chainId,w,S)),[w,S,f?.chainId]);r.useEffect((()=>{_({userJourney:P.WALLET,screen:"WalletBalances"})}),[]),r.useEffect((()=>{(async()=>{if(!i)return;if(!L)return;if(!f)return;const e=await Xe(i,f.chainId);L({payload:{type:ye.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[i,L,f?.chainId]),r.useEffect((()=>{let e=0;B.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),k(e)}),[B]);const F=r.useMemo((()=>!(!i||!f)&&(f.chainId===M(i.config)&&Boolean(m?.isBridgeEnabled||m?.isSwapEnabled||m?.isOnRampEnabled))),[i,f,m]);return l(oe,{testId:"wallet-balances",header:l(Q,{title:a("views.WALLET_BALANCES.header.title"),rightActions:l(e,{icon:"SettingsCog",sx:ee(),iconVariant:"bold",onClick:()=>{W({userJourney:P.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),C({payload:{type:T.UPDATE_VIEW,view:{type:et.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>te(h)}),footer:l(ne,{}),children:E(p,{sx:ht,children:[E(p,{sx:Ct,children:[A&&l(ut,{}),l(tt,{totalBalance:b,loading:t}),E(p,{sx:kt(A,F),children:[t&&E(p,{sx:bt,children:[l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!t&&l(it,{balanceInfoItems:B,bridgeToL2OnClick:e=>{j.sendRequestBridgeEvent(h,D.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:n})]})]}),F&&E(N,{testId:"add-coins",emphasized:!0,onClick:()=>{W({userJourney:P.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),C({payload:{type:T.UPDATE_VIEW,view:{type:V.TOP_UP_VIEW}}})},children:[l(N.FramedIcon,{icon:"Add"}),l(N.Label,{children:a("views.WALLET_BALANCES.addCoins")})]})]})})}function gt(e){switch(e){case ae.METAMASK:return"MetaMaskSymbol";case ae.PASSPORT:return"PassportSymbolOutlined";case"walletconnect":return"WalletConnectSymbol";default:return"MetaMaskSymbol"}}const yt={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"},Et={fill:"base.color.fixed.black.1000"};function St({provider:t,showL1Warning:n,setShowL1Warning:o}){const[a,s]=r.useState(""),[i,c]=r.useState(!1),{t:d}=g(),{track:p}=x(),L=r.useMemo((()=>O(t)&&!n?"ShowPassword":i?"Tick":"CopyText"),[t,n,i]);r.useEffect((()=>{t&&""===a&&(async()=>{const e=await t.getSigner().getAddress();s(e)})()}),[t,a]);return E(N,{testId:"wallet-address",emphasized:!0,size:"medium",children:[l(N.FramedLogo,{logo:gt(se(t)),sx:{backgroundColor:"base.color.translucent.standard.200"}}),l(e,{variant:"tertiary",iconVariant:"bold",size:"small",icon:L,iconSx:{...i?Et:{}},onClick:async()=>{a&&"CopyText"===L?(p({userJourney:P.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(a),c(!0),setTimeout((()=>c(!1)),1e3)):"ShowPassword"===L&&o(!0)},sx:{cursor:"pointer",...i?yt:{}}}),l(N.Label,{children:d("views.SETTINGS.walletAddress.label")}),l(N.Caption,{testId:"wallet-address",children:re(a)})]})}const Tt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},vt={marginTop:"32px"};function xt(){return l(p,{testId:"transfer-assets-l1-warning-hero",sx:{display:"flex",justifyContent:"center",padding:"base.spacing.x4"},children:l(p,{children:E("svg",{xmlns:"http://www.w3.org/2000/svg",width:"135",height:"137",viewBox:"0 0 135 137",fill:"none",children:[l("path",{d:"M76.2361 65.9046L76.5095 17.3023C76.5157 15.9172 76.0711 14.9946 75.3435 14.6207C74.0964 13.9799 72.9093 14.4957 71.4798 15.3728L29.2306 41.5137L28.3702 98.7706L76.2398 65.9035L76.2361 65.9046Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M85.4571 126.862L85.791 76.8509C85.8102 74.0184 83.742 70.6325 81.1983 69.3267L47.8586 51.3375C46.7068 50.7462 45.739 49.8676 45.0526 48.788L43.4726 46.3043C42.7862 45.2247 41.8184 44.3461 40.6665 43.7548L36.2848 41.5054L31.2783 42.6987L30.909 101.567C30.9861 102.57 31.6727 103.52 32.9446 104.173L80.2378 129.343L81.6163 131.639L84.2802 129.667L84.2754 129.664C85.0031 129.123 85.4546 128.164 85.4632 126.862L85.4571 126.862Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M83.1421 78.7933C83.1612 75.96 81.0925 72.5732 78.5483 71.267L30.2174 45.562C28.8517 44.8609 28.1628 43.8191 28.1721 42.7358L27.7773 103.281C27.8544 104.284 28.5413 105.234 29.8134 105.887L78.1443 131.592C80.6909 132.9 82.7889 131.652 82.8068 128.821L83.1408 78.7956L83.1421 78.7933Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M36.8699 42.6587C36.8641 43.5432 35.5341 44.2721 33.9017 44.2823C32.2694 44.2925 30.9508 43.5854 30.9555 42.6973C30.9602 41.8091 32.2913 41.0838 33.9237 41.0736C34.7155 41.0681 35.4328 41.2334 35.963 41.5055C36.5244 41.7937 36.8726 42.2027 36.8699 42.6587Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M35.2866 42.6695C35.284 43.0802 34.6673 43.4179 33.9096 43.4227C33.1519 43.4276 32.5394 43.098 32.5419 42.6874C32.5445 42.2767 33.1612 41.939 33.9189 41.9342C34.2856 41.9315 34.6182 42.0084 34.8653 42.1352C35.1268 42.2695 35.288 42.4582 35.2853 42.6719L35.2866 42.6695Z",fill:"black"}),l("path",{d:"M70.9275 14.9238L29.4561 40.1902C28.389 40.9925 27.8611 41.9567 27.8526 42.8886C27.8526 42.8886 27.6951 44.5777 29.8905 45.7049C32.0859 46.832 34.8391 48.2668 34.8391 48.2668L36.1919 47.4119L31.26 44.8586C29.3491 43.8775 28.9381 42.1986 30.6697 40.8949L72.2083 15.5784C73.3784 14.6992 74.4371 14.4968 75.1905 14.8835C75.1905 14.8835 72.8927 13.4441 70.9288 14.9215L70.9275 14.9238Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M81.0605 110.741L83.1092 111.399L85.7093 118.337L85.7797 107.796L81.2805 106.491L81.0605 110.741Z",fill:"black"}),l("path",{d:"M83.1104 113.492C83.1312 110.487 84.073 109.095 87.3742 109.652C89.1483 109.952 90.9444 109.879 92.6948 109.428L96.5484 108.436C99.8885 107.577 102.639 104.113 102.664 100.741C102.686 97.3675 99.9706 95.3116 96.6329 96.1724L91.9518 97.3781C90.3645 97.7883 88.6894 97.6786 87.181 97.0768C84.1103 95.8485 83.2401 94.5701 83.2615 91.3841L81.2915 93.3582L74.7155 111.72L83.1115 113.496L83.1104 113.492Z",fill:"#F3F3F3"}),l("path",{d:"M83.1053 113.501C83.1261 110.496 84.0681 109.104 87.3701 109.661C89.1445 109.961 90.9411 109.888 92.6918 109.437L96.5463 108.445C99.8871 107.585 102.638 104.12 102.663 100.747C102.685 97.3736 99.9692 95.3172 96.6308 96.1782L91.9487 97.3841C90.361 97.7944 88.6855 97.6847 87.1768 97.0828C84.1055 95.8542 83.2351 94.5755 83.2564 91.3888",stroke:"black",strokeWidth:"1.33831",strokeMiterlimit:"10"}),l("path",{d:"M100.563 99.4451C99.4403 98.3218 97.1152 98.7714 95.3661 100.45C93.6171 102.129 93.1092 104.399 94.2323 105.522L94.7567 106.048L101.088 99.9711L100.563 99.4451Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M99.9733 105.056C101.727 103.381 102.236 101.114 101.111 99.9926C99.986 98.8713 97.6528 99.3204 95.8996 100.996C94.1464 102.671 93.637 104.938 94.762 106.059C95.8869 107.18 98.2201 106.731 99.9733 105.056Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M51.6986 91.7452C50.6642 91.2142 49.827 89.8416 49.8336 88.6901L49.9893 65.7522C49.9984 64.6019 50.8483 64.0955 51.8828 64.6265L72.5076 75.205C73.542 75.736 74.3793 77.1086 74.3726 78.2601L74.2169 101.198C74.2079 102.348 73.3579 102.855 72.3235 102.324L51.6986 91.7452Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M52.7617 91.0867C51.7272 90.5557 50.89 89.1831 50.8966 88.0315L51.0523 65.0931C51.0553 64.8339 51.101 64.6088 51.1799 64.4189C50.4902 64.3771 49.9962 64.8783 49.9906 65.7516L49.8349 88.69C49.8259 89.8403 50.6655 91.2142 51.7 91.7452L72.3252 102.324C73.1244 102.734 73.8145 102.522 74.0887 101.871C73.8709 101.859 73.6341 101.792 73.3845 101.664L52.7593 91.0855L52.7617 91.0867Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M66.9055 85.8915L66.8883 88.4023L64.3853 87.1169L61.8847 85.8328L59.3817 84.5474L57.6065 83.6358C57.2078 83.4311 56.8773 83.5922 56.875 83.9917L56.8689 85.042C56.8653 85.4439 57.1906 85.9418 57.5917 86.1478L59.3669 87.0594L61.8699 88.3448L61.8577 90.1235C61.8541 90.5254 62.1807 91.0209 62.5818 91.2269L63.6292 91.7647C64.0279 91.9695 64.3584 91.8083 64.362 91.4064L64.3742 89.6277L66.8772 90.9131L68.6523 91.8247C69.0511 92.0295 69.3829 91.8659 69.3852 91.4664L69.3974 89.6877L69.4095 87.909C69.4131 87.5071 69.0866 87.0116 68.6854 86.8056L66.9103 85.894L66.9055 85.8915Z",fill:"white"}),l("path",{d:"M59.3703 79.5438L59.3581 81.3271C59.3569 81.7313 59.6802 82.2293 60.0844 82.4371L61.862 83.3511L64.3662 84.6386L66.8728 85.9274L66.8862 84.1416C66.8874 83.7374 66.5641 83.2394 66.16 83.0316L64.3823 82.1176L61.8781 80.8301L59.3716 79.5414L59.3703 79.5438Z",fill:"white"}),l("path",{d:"M62.6235 73.7033C62.2248 73.4985 61.8943 73.6597 61.892 74.0592L61.8798 75.8379L59.3768 74.5525L57.6016 73.641C57.2029 73.4362 56.8724 73.5973 56.8688 73.9992L56.8566 75.7779L56.8445 77.5566C56.8409 77.9585 57.1674 78.4541 57.5686 78.6601L59.3437 79.5717L59.3609 77.0609L61.8639 78.3463L64.3645 79.6304L66.8675 80.9157L68.6426 81.8273C69.0414 82.0321 69.3719 81.8709 69.3755 81.469L69.3827 80.4224C69.3838 80.0193 69.061 79.5226 68.6598 79.3166L66.8847 78.405L64.3817 77.1197L64.3938 75.341C64.3974 74.9391 64.0709 74.4435 63.6697 74.2375L62.6224 73.6997L62.6235 73.7033Z",fill:"white"}),l("path",{d:"M46.8192 101.66L46.8314 99.6311C46.838 98.841 46.2586 97.8985 45.551 97.5353L42.5478 95.9937L42.5679 93.0481C42.5746 92.258 41.9976 91.3167 41.2875 90.9523L38.7449 89.6471C38.3611 89.4501 38.0161 89.4638 37.7758 89.6403L36.4656 90.6093L37.4387 91.7024L37.4277 93.3685L34.4246 91.827C34.0408 91.63 33.6957 91.6437 33.4554 91.8201L32.1452 92.7891L33.1181 93.8094L33.113 94.6306C33.1063 95.4207 33.6858 96.3632 34.3934 96.7264L37.3965 98.268L37.3764 101.214C37.3698 102.004 37.9468 102.945 38.6568 103.309L39.7002 103.845L40.8571 105.593L42.1673 104.624C42.3691 104.473 42.4965 104.205 42.4976 103.842L42.5177 100.897L44.2088 101.765L45.1822 103.415L46.4924 102.446C46.6966 102.297 46.8216 102.028 46.8227 101.665L46.8192 101.66Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M45.514 102.623L45.5261 100.594C45.5327 99.8036 44.9532 98.8609 44.2455 98.4977L41.2419 96.9558L41.262 94.0097C41.2674 93.2219 40.6916 92.2781 39.9815 91.9135L37.4385 90.6082C36.7284 90.2437 36.1455 90.5927 36.1388 91.3829L36.1187 94.329L33.1151 92.7872C32.405 92.4227 31.8184 92.7728 31.8154 93.5619L31.8033 95.5912C31.7967 96.3815 32.3762 97.3241 33.0839 97.6874L36.0875 99.2293L36.0673 102.175C36.0607 102.966 36.6378 103.907 37.3479 104.272L39.8909 105.577C40.601 105.941 41.1839 105.592 41.1906 104.802L41.2107 101.856L44.2143 103.398C44.9244 103.762 45.511 103.412 45.514 102.623Z",fill:"white",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M55.4177 54.343L85.7278 37.2672L70.5728 15.9224L55.4177 54.343Z",fill:"#FF637F",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M55.4176 54.3431L51.6289 52.2086L66.7839 13.7881L70.5727 15.9226L55.4176 54.3431Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M69.1528 25.261L71.9944 23.6602V34.3325L69.1528 35.9334V25.261Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M69.1528 38.0676L71.9944 36.4667V39.6684L69.1528 41.2693V38.0676Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}function At({provider:t,showL1Warning:n,setShowL1Warning:o}){const{t:a}=g();return l(ie,{size:"full",visible:n,showHeaderBar:!1,children:E(ie.Content,{children:[l(e,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>o(!1)}),l(xt,{}),E(p,{sx:{px:"base.spacing.x6"},children:[l(B,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:a("views.SETTINGS.transferAssetsL1Warning.heading")}),l(S,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:a("views.SETTINGS.transferAssetsL1Warning.body")}),l(St,{provider:t,showL1Warning:n,setShowL1Warning:o})]})]})})}function It({showDisconnectButton:e}){const[t,n]=r.useState(!1),{t:o}=g(),{connectLoaderState:a}=r.useContext(v),{provider:s}=a,{eventTargetState:{eventTarget:i}}=r.useContext(I),{ethereumProvider:c}=le(),{page:d}=x();r.useEffect((()=>{d({userJourney:P.WALLET,screen:"Settings"})}),[]);return E(oe,{testId:"wallet-balances",header:l(Q,{showBack:!0,title:o("views.SETTINGS.header.title"),onCloseButtonClick:()=>te(i)}),footer:l(ne,{}),children:[E(p,{sx:Tt,children:[l(St,{provider:s,showL1Warning:t,setShowL1Warning:n}),e&&l(b,{testId:"disconnect-button",variant:"secondary",sx:vt,onClick:()=>{(async()=>{if(de(s))try{if(s.provider?.session){const e=s.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>c?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await s.provider.disconnect()}if(c){const e=c?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>c?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await c.disconnect()}}catch(e){console.error(e)}})().then((()=>{ce(i)}))},children:o("views.SETTINGS.disconnectButton.label")})]}),l(At,{provider:s,showL1Warning:t,setShowL1Warning:n})]})}function Ot(){return l(p,{sx:{...pe,background:"base.color.translucent.emphasis.100"},children:l(p,{sx:{...Le,...ue},children:E("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l("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)"}),l("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"}),l("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),l("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),l("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),l("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),l("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),l("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),l("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),l("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("defs",{children:E("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[l("stop",{stopColor:"#AD48BA"}),l("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function Mt(){const{t:e}=g(),{connectLoaderState:{provider:t}}=r.useContext(v),n=O(t),{page:o}=x();return r.useEffect((()=>{o({userJourney:P.WALLET,screen:"CoinInfo"})}),[]),E(oe,{testId:"coin-info",header:l(Q,{showBack:!0,transparent:!0}),footer:l(ne,{}),heroContent:l(Ot,{}),floatHeader:!0,children:[!n&&l(he,{heading:e("views.COIN_INFO.metamask.heading"),children:e("views.COIN_INFO.metamask.body")}),n&&E(he,{heading:e("views.COIN_INFO.passport.heading"),children:[e("views.COIN_INFO.passport.body1"),l(be,{onClick:()=>window.open(Ce),children:e("views.COIN_INFO.passport.linkText")}),e("views.COIN_INFO.passport.body2")]})]})}const Wt=({checkout:e,provider:t,refreshCallback:n,errorCallback:o})=>{const[a,s]=r.useState(!0),i=r.useCallback((async(a=!1)=>{if(e&&t)try{const o=await e.getNetworkInfo({provider:t});if(!o.isSupported)return;a||s(!0);const r=await(async(e,t,n)=>{if(!e||!t||!n)return[];const o=await t.getSigner().getAddress(),a=await ve((()=>e.getAllBalances({provider:t,walletAddress:o,chainId:n})),K);return a?X(e.config,a.balances,n).map((t=>({...t,token:{...t.token,icon:Y(e.config.environment,R(t.token.address)?t.token.symbol:t.token.address??"")}}))):[]})(e,t,o.chainId);a||s(!1),n(r)}catch(e){K.nonRetryable(e)&&o(e),a||s(!1)}}),[e,t]);return xe((()=>i(!0)),3e4),{balancesLoading:a,refreshBalances:i}};function _t(e){const{t:t}=g(),n=t("views.ERROR_VIEW.actionText"),o=t("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:a}}=r.useContext(I),{config:{environment:s,isOnRampEnabled:i,isSwapEnabled:c,isBridgeEnabled:d,theme:p},walletConfig:{showDisconnectButton:L,showNetworkMenu:u}}=e,{connectLoaderState:{checkout:h,provider:C}}=r.useContext(v),[b,k]=r.useReducer(ke,{...fe,history:[]}),[f,m]=r.useReducer(Ke,{...$e,walletConfig:{showDisconnectButton:L,showNetworkMenu:u}}),w=r.useMemo((()=>({walletState:f,walletDispatch:m})),[f,m]),S=r.useMemo((()=>({viewState:b,viewDispatch:k})),[b,k]),{balancesLoading:x,refreshBalances:A}=Wt({checkout:h,provider:C,refreshCallback:e=>{m({payload:{type:He.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),k({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});r.useEffect((()=>{(async()=>{if(!h)return;let e;try{e=await h.isSwapAvailable()}catch(t){e=!1}m({payload:{type:He.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:d,isSwapEnabled:c,isOnRampEnabled:i,isSwapAvailable:e}}})})()}),[d,c,i,s]);const O=async()=>{if(h&&C)try{const e=await h.getNetworkInfo({provider:C});if(!e.isSupported)return;A(),k({payload:{type:T.UPDATE_VIEW,view:{type:et.WALLET_BALANCES}}}),m({payload:{type:He.SET_NETWORK,network:e}})}catch(e){console.error(e),k({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:e}}})}};r.useEffect((()=>{h&&C&&O()}),[h,C]);return l(y.Provider,{value:S,children:l(Ee,{environment:s,children:E(Je.Provider,{value:w,children:[b.view.type===V.LOADING_VIEW&&l(me,{loadingText:o}),b.view.type===et.WALLET_BALANCES&&l(wt,{balancesLoading:x,theme:p,showNetworkMenu:u}),b.view.type===et.SETTINGS&&l(It,{showDisconnectButton:L}),b.view.type===et.COIN_INFO&&l(Mt,{}),b.view.type===V.ERROR_VIEW&&l(we,{actionText:n,onActionClick:async()=>{k({payload:{type:T.UPDATE_VIEW,view:{type:et.WALLET_BALANCES}}}),await O()},onCloseClick:()=>te(a)}),b.view.type===V.TOP_UP_VIEW&&l(Se,{analytics:{userJourney:P.WALLET},widgetEvent:D.IMTBL_WALLET_WIDGET_EVENT,checkout:h,provider:C,showOnrampOption:i,showSwapOption:c,showBridgeOption:d,onCloseButtonClick:()=>te(a)})]})})})}export{_t as default};
1
+ import{B as e,_ as t,u as n,g as o,D as a,m as s,r,f as i,j as l,i as c,S as d,a as p,b as L,c as u,s as h,C,d as b,e as k,h as f,k as m,T as w,l as g,V as y,n as E,o as S,p as T,q as v,t as x,v as A,E as I,w as O,x as M,y as W,z as _,M as N,H as B,A as F,U as P,F as j,I as D,Z,G as R,J as z,K as U,L as V,N as G,O as $,P as H,Q as J,R as K,W as X,X as Y,Y as q,$ as Q,a0 as ee,a1 as te,a2 as ne,a3 as oe,a4 as ae,a5 as se,a6 as re,a7 as ie,a8 as le,a9 as ce,aa as de,ab as pe,ac as Le,ad as ue,ae as he,af as Ce,ag as be,ah as ke,ai as fe,aj as me,ak as we}from"./index-23793c68.js";import{C as ge,a as ye,b as Ee,T as Se}from"./TopUpView-742d8a9b.js";import{T as Te,r as ve,u as xe}from"./retry-52c80d97.js";var Ae={justifyContent:"stretch",bg:"base.color.translucent.standard.100",position:"relative",d:"flex",w:"100%"};function Ie(e){var t=e.size,n=e.theme,o=/large|medium/.test(t)?n.base.spacing.x2:n.base.spacing.x1;return{gap:o,padding:o,borderRadius:/large|medium/.test(t)?n.base.borderRadius.x8:n.base.borderRadius.x4}}var Oe=function(e){var t=e.size,n=e.theme;return L({size:t,theme:n,renderSxAtSize:Ie})},Me={flex:1,paddingX:"base.spacing.x4",transitionProperty:"background, color, box-shadow",transitionDuration:"base.motion.normal.fast.cssDuration",transitionTimingFunction:"base.motion.normal.fast.cssEase","& > span":{textAlign:"left",whiteSpace:"nowrap"},"&.HorizontalMenuButton, &.HorizontalMenuButtCon":{"&:hover:not([disabled])::before":{content:"unset"},"&:hover:not([disabled])":{bg:"base.color.translucent.emphasis.200",boxShadow:function(e){var t=e.base;return"inset 0 0 0 ".concat(t.border.size[100]," ").concat(t.color.translucent.standard[1e3])}},"&:active:not([disabled])":{bg:"base.color.translucent.emphasis.100"},"&.selected":{bg:"base.color.translucent.inverse.500"},"&.selected, &:active:not([disabled])":{boxShadow:function(e){var t=e.base;return"inset 0 0 0 ".concat(t.border.size[200]," ").concat(t.color.translucent.standard[1e3])}}}};function We(e){var t=e.size,n=e.theme;return{borderRadius:/large|medium/.test(t)?n.base.borderRadius.x4:n.base.spacing.x2}}var _e=function(e){var t=e.size,n=e.theme;return L({size:t,theme:n,renderSxAtSize:We})},Ne=["sx","size","selected","className"];function Be(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Fe(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Be(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Pe(i){var c=i.sx,d=void 0===c?{}:c,p=i.size,L=void 0===p?"medium":p,b=i.selected,k=i.className,f=t(i,Ne),m=n(),w=o(L,a,u),g=r.useMemo((function(){return s(Me,We({size:w,theme:m}),_e({size:L,theme:m}),h(d,"base.color.translucent.emphasis.100"),d)}),[d,w,L,m]);return l(C,{children:function(t){var n=t.cx;return l(e,Fe(Fe({},f),{},{size:L,variant:"tertiary",sx:g,className:n(k,"HorizontalMenuButtCon",{selected:b})}))}})}Pe.displayName="HorizontalMenuButtCon",Pe.SvgIcon=e.SvgIcon;var je=["children","sx","size","selected","className"];function De(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ze(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?De(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):De(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Re(e){var i=e.children,c=e.sx,d=void 0===c?{}:c,p=e.size,L=void 0===p?"medium":p,k=e.selected,f=e.className,m=t(e,je),w=n(),g=o(L,a,u),y=r.useMemo((function(){return s(Me,We({size:g,theme:w}),_e({size:L,theme:w}),h(d,"base.color.translucent.emphasis.100"),d)}),[d,g,L,w]);return l(C,{children:function(e){var t=e.cx;return l(b,Ze(Ze({},m),{},{size:L,variant:"tertiary",className:t(f,"HorizontalMenuButton",{selected:k}),sx:y,children:i}))}})}Re.displayName="HorizontalMenuButton",Re.Icon=k,Re.Logo=f;var ze=["children","sx","size","className"];function Ue(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function Ve(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Ue(Object(n),!0).forEach((function(t){m(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Ue(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function Ge(e){var L=e.children,h=e.sx,C=void 0===h?{}:h,b=e.size,k=void 0===b?"medium":b,f=e.className,m=t(e,ze),w=n(),g=o(k,a,u),y=s(Ae,Ie({size:g,theme:w}),Oe({size:k,theme:w}),C),E=r.useMemo((function(){return i(L)}),[L]);return l(p,Ve(Ve({},m),{},{sx:y,className:"".concat(null!=f?f:""," HorizontalMenu"),children:r.Children.map(E,(function(e){return c(e,Pe)||c(e,Re)?l(d,{size:e.props.size?e.props.size:k,children:e}):e}))}))}Ge.displayName="HorizontalMenu",Ge.Button=Re,Ge.ButtCon=Pe;const $e={walletProviderName:null,network:null,tokenBalances:[],supportedTopUps:null,walletConfig:{showDisconnectButton:!0,showNetworkMenu:!0}};var He;!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"}(He||(He={}));const Je=r.createContext({walletState:$e,walletDispatch:()=>{}});Je.displayName="WalletContext";const Ke=(e,t)=>{switch(t.payload.type){case He.SET_WALLET_PROVIDER_NAME:return{...e,walletProviderName:t.payload.walletProviderName};case He.SET_NETWORK:return{...e,network:t.payload.network};case He.SET_TOKEN_BALANCES:return{...e,tokenBalances:t.payload.tokenBalances};case He.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}},Xe=async(e,t)=>{const n=await e.getTokenAllowList({type:w.ALL,chainId:t}),o=new Set;return n.tokens.forEach((e=>{o.add(e.symbol)})),Array.from(o)},Ye={display:"flex",flexDirection:"row",justifyContent:"space-between",paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"},qe={display:"flex",direction:"row",columnGap:"base.spacing.x1",alignItems:"center"},Qe={height:"base.icon.size.250",width:"base.icon.size.250",minWidth:"base.icon.size.250",fill:"base.color.accent.4",cursor:"pointer"};var et;function tt(t){const{t:n}=g(),{viewDispatch:o}=r.useContext(y),{totalBalance:a,loading:s}=t;return E(p,{sx:Ye,children:[E(p,{sx:qe,children:[l(S,{size:"medium",children:n("views.WALLET_BALANCES.totalTokenBalance.heading")}),l(p,{sx:{pl:"base.spacing.x1"},children:l(e,{testId:"coin-info-icon",variant:"tertiary",icon:"Information",sx:Qe,onClick:()=>o({payload:{type:T.UPDATE_VIEW,view:{type:et.COIN_INFO}}})})})]}),E(p,{sx:qe,children:[l(S,{testId:"total-token-balance-value",weight:"bold",shimmer:s?1:0,shimmerSx:{minw:"100px"},children:n("views.WALLET_BALANCES.totalTokenBalance.totalHeading")}),!s&&E(S,{testId:"total-token-balance",weight:"bold",children:["≈ USD $",a.toFixed(2)]})]})]})}!function(e){e.WALLET_BALANCES="WALLET_BALANCES",e.SETTINGS="SETTINGS",e.COIN_INFO="COIN_INFO",e.SUCCESS="SUCCESS",e.FAIL="FAIL"}(et||(et={}));const nt=e=>({display:e?"":"none"});function ot({balanceInfo:e,theme:t,bridgeToL2OnClick:n}){const{connectLoaderState:o}=r.useContext(v),{track:a}=x(),{checkout:s,provider:i}=o,c=`≈ USD $${A(e.fiatAmount)}`,{walletState:d}=r.useContext(Je),{supportedTopUps:p,network:L}=d,[u,h]=r.useState(),[C,b]=r.useState(),[k,f]=r.useState(),{eventTargetState:{eventTarget:m}}=r.useContext(I),[g,y]=r.useState([]),S=O(i);r.useEffect((()=>{(async()=>{if(!s)return;const e=await s.getTokenAllowList({type:w.ONRAMP,chainId:M(s.config)});y(e.tokens)})()}),[s]),r.useEffect((()=>{if(!L||!p||!s)return;const e=L.chainId===M(s.config)&&(p?.isOnRampEnabled??!0);h(e);const t=(L.chainId===W(s.config)||L.chainId===M(s.config))&&(p?.isBridgeEnabled??!0);b(t);const n=L.chainId===M(s.config)&&(p?.isSwapEnabled??!0)&&(p?.isSwapAvailable??!0);f(n)}),[L,p,s,S]);const T=r.useMemo((()=>Boolean(u&&g.length>0&&g.find((t=>t.address?.toLowerCase()===e.address?.toLowerCase())))),[u,g]);return E(N,{testId:`balance-item-${e.symbol}`,emphasized:!0,children:[l(N.FramedImage,{use:l(Te,{theme:t,src:e.icon,name:e.symbol,environment:s?.config.environment??_.PRODUCTION}),circularFrame:!0}),l(N.Label,{children:e.symbol}),l(N.Caption,{children:e.description}),l(N.PriceDisplay,{testId:`balance-item-${e.symbol}`,use:l(B,{size:"xSmall"}),price:F(e.balance),fiatAmount:c}),(u||k||C)&&E(N.OverflowPopoverMenu,{size:"small",testId:"token-menu",onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"BalanceItem",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}})},children:[E(N,{testId:"balance-item-add-option",sx:nt(T),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"AddTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),j.sendRequestOnrampEvent(m,D.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e.address??"",amount:""})},children:[l(N.Icon,{icon:"Add"}),l(N.Label,{children:`Add ${e.symbol}`})]}),E(N,{testId:"balance-item-swap-option",sx:nt(k),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"SwapTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),j.sendRequestSwapEvent(m,D.IMTBL_WALLET_WIDGET_EVENT,{fromTokenAddress:e.address??"",toTokenAddress:"",amount:""})},children:[l(N.Icon,{icon:"Exchange"}),l(N.Label,{children:`Swap ${e.symbol}`})]}),E(N,{testId:"balance-item-move-option",sx:nt(C),onClick:()=>{a({userJourney:P.WALLET,screen:"WalletBalances",control:"MoveTokens",controlType:"Button",extras:{tokenSymbol:e.symbol,tokenAddress:e.address}}),n(e.address)},children:[l(N.Icon,{icon:"Minting"}),l(N.Label,{children:`Move ${e.symbol}`})]})]})]})}const at={width:"100%",height:"100%",display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},st={width:"100%",height:"100%",display:"flex",justifyContent:"center",alignItems:"center"},rt=e=>e.filter((e=>e.balance!==Z||R(e.address)));function it({balanceInfoItems:e,theme:t,bridgeToL2OnClick:n}){const{t:o}=g(),a=rt(e);return E(p,{sx:at,children:[0===a.length&&l(p,{sx:st,children:l(S,{testId:"no-tokens-found",children:o("views.WALLET_BALANCES.tokenBalancesList.noTokensFound")})}),a.map((e=>l(ot,{balanceInfo:e,bridgeToL2OnClick:n,theme:t},e.id)))]})}const lt={display:"flex",flexDirection:"column",alignItems:"flex-start",paddingTop:"base.spacing.x4"},ct={fontWeight:"base.text.caption.small.bold.fontWeight",borderColor:"base.color.translucent.emphasis.1000",borderStyle:"solid",borderWidth:"base.border.size.200"},dt={fontWeight:"base.text.caption.small.bold.fontWeight"},pt=e=>({width:"22px",filter:e?void 0:"grayscale(1)"}),Lt={paddingX:"base.spacing.x3",paddingY:"base.spacing.x2"};function ut(){const{t:e}=g(),{connectLoaderState:t}=r.useContext(v),{eventTargetState:{eventTarget:n}}=r.useContext(I),{checkout:o,provider:a}=t,{viewDispatch:s}=r.useContext(y),{walletState:i,walletDispatch:c}=r.useContext(Je),{network:d}=i,[L,u]=r.useState([]),{track:h}=x(),C=r.useCallback((async e=>{if(o&&a&&d&&d.chainId!==e){h({userJourney:P.WALLET,screen:"WalletBalances",control:"SwitchNetwork",controlType:"Button",extras:{chainId:e}});try{const t=await o.switchNetwork({provider:a,chainId:e});z(n,t.provider,t.network)}catch(e){e.type===U.USER_REJECTED_REQUEST_ERROR||s({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:e}}})}}}),[o,a,d,c,s]);return r.useEffect((()=>{(async()=>{if(o){const e=await o.getNetworkAllowList({type:G.ALL});u(e?.networks??[])}else u([])})()}),[o]),E(p,{testId:"network-menu",sx:lt,children:[l(S,{testId:"network-heading",size:"medium",sx:Lt,children:e("views.WALLET_BALANCES.networkStatus.heading")}),l(Ge,{children:o&&L?.sort(((e,t)=>$(e,t,o.config))).map((e=>E(Ge.Button,{testId:`${e.name}-network-button`,sx:e.chainId===d?.chainId?ct:dt,size:"small",onClick:()=>C(e.chainId),children:[l(H,{sx:pt(e.chainId===d?.chainId),use:l("img",{src:J(o?.config.environment,e.chainId),alt:e.name})}),e.name]},e.chainId)))})]})}const ht={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x2",flex:1},Ct={backgroundColor:"base.color.neutral.800",paddingX:"base.spacing.x1",borderRadius:"base.borderRadius.x6",flex:1},bt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2"},kt=(e,t)=>{let n=460;e&&(n-=104),t&&(n-=98);return{height:`${n}px`,overflowY:"auto",borderRadius:"base.borderRadius.x6"}},ft=(e,t,n)=>n?`${e.toString()}-${t.toLowerCase()}-${n.toLowerCase()}`:`${e.toString()}-${t.toLowerCase()}`,mt=(e,t,n)=>t.map((t=>({id:ft(e,t.token.symbol,t.token.address),balance:t.formattedBalance,fiatAmount:q(t.formattedBalance,t.token.symbol,n),symbol:t.token.symbol,address:t.token.address,description:t.token.name,icon:t.token.icon})));function wt({balancesLoading:t,theme:n,showNetworkMenu:o}){const{t:a}=g(),{connectLoaderState:s}=r.useContext(v),{checkout:i,provider:c}=s,{cryptoFiatState:d,cryptoFiatDispatch:L}=r.useContext(ge),{walletState:u}=r.useContext(Je),{eventTargetState:{eventTarget:h}}=r.useContext(I),{viewDispatch:C}=r.useContext(y),[b,k]=r.useState(0),{network:f,supportedTopUps:m,tokenBalances:w}=u,{conversions:S}=d,A=!O(c)&&o,{track:W,page:_}=x(),B=r.useMemo((()=>mt(f?.chainId,w,S)),[w,S,f?.chainId]);r.useEffect((()=>{_({userJourney:P.WALLET,screen:"WalletBalances"})}),[]),r.useEffect((()=>{(async()=>{if(!i)return;if(!L)return;if(!f)return;const e=await Xe(i,f.chainId);L({payload:{type:ye.SET_TOKEN_SYMBOLS,tokenSymbols:e}})})()}),[i,L,f?.chainId]),r.useEffect((()=>{let e=0;B.forEach((t=>{const n=parseFloat(t.fiatAmount);Number.isNaN(n)||(e+=n)})),k(e)}),[B]);const F=r.useMemo((()=>!(!i||!f)&&(f.chainId===M(i.config)&&Boolean(m?.isBridgeEnabled||m?.isSwapEnabled||m?.isOnRampEnabled))),[i,f,m]);return l(oe,{testId:"wallet-balances",header:l(Q,{title:a("views.WALLET_BALANCES.header.title"),rightActions:l(e,{icon:"SettingsCog",sx:ee(),iconVariant:"bold",onClick:()=>{W({userJourney:P.WALLET,screen:"WalletBalances",control:"Settings",controlType:"Button"}),C({payload:{type:T.UPDATE_VIEW,view:{type:et.SETTINGS}}})},testId:"settings-button"}),onCloseButtonClick:()=>te(h)}),footer:l(ne,{}),children:E(p,{sx:ht,children:[E(p,{sx:Ct,children:[A&&l(ut,{}),l(tt,{totalBalance:b,loading:t}),E(p,{sx:kt(A,F),children:[t&&E(p,{sx:bt,children:[l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--1"}),l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--2"}),l(N,{shimmer:!0,emphasized:!0,testId:"balance-item-shimmer--3"})]}),!t&&l(it,{balanceInfoItems:B,bridgeToL2OnClick:e=>{j.sendRequestBridgeEvent(h,D.IMTBL_WALLET_WIDGET_EVENT,{tokenAddress:e??"",amount:""})},theme:n})]})]}),F&&E(N,{testId:"add-coins",emphasized:!0,onClick:()=>{W({userJourney:P.WALLET,screen:"WalletBalances",control:"AddCoins",controlType:"Button"}),C({payload:{type:T.UPDATE_VIEW,view:{type:V.TOP_UP_VIEW}}})},children:[l(N.FramedIcon,{icon:"Add"}),l(N.Label,{children:a("views.WALLET_BALANCES.addCoins")})]})]})})}function gt(e){switch(e){case ae.METAMASK:return"MetaMaskSymbol";case ae.PASSPORT:return"PassportSymbolOutlined";case"walletconnect":return"WalletConnectSymbol";default:return"MetaMaskSymbol"}}const yt={background:"base.color.status.success.bright",fill:"base.color.status.success.bright"},Et={fill:"base.color.fixed.black.1000"};function St({provider:t,showL1Warning:n,setShowL1Warning:o}){const[a,s]=r.useState(""),[i,c]=r.useState(!1),{t:d}=g(),{track:p}=x(),L=r.useMemo((()=>O(t)&&!n?"ShowPassword":i?"Tick":"CopyText"),[t,n,i]);r.useEffect((()=>{t&&""===a&&(async()=>{const e=await t.getSigner().getAddress();s(e)})()}),[t,a]);return E(N,{testId:"wallet-address",emphasized:!0,size:"medium",children:[l(N.FramedLogo,{logo:gt(se(t)),sx:{backgroundColor:"base.color.translucent.standard.200"}}),l(e,{variant:"tertiary",iconVariant:"bold",size:"small",icon:L,iconSx:{...i?Et:{}},onClick:async()=>{a&&"CopyText"===L?(p({userJourney:P.WALLET,screen:"Settings",control:"CopyWalletAddress",controlType:"Button"}),navigator.clipboard.writeText(a),c(!0),setTimeout((()=>c(!1)),1e3)):"ShowPassword"===L&&o(!0)},sx:{cursor:"pointer",...i?yt:{}}}),l(N.Label,{children:d("views.SETTINGS.walletAddress.label")}),l(N.Caption,{testId:"wallet-address",children:re(a)})]})}const Tt={display:"flex",flexDirection:"column",rowGap:"base.spacing.x2",paddingX:"base.spacing.x4"},vt={marginTop:"32px"};function xt(){return l(p,{testId:"transfer-assets-l1-warning-hero",sx:{display:"flex",justifyContent:"center",padding:"base.spacing.x4"},children:l(p,{children:E("svg",{xmlns:"http://www.w3.org/2000/svg",width:"135",height:"137",viewBox:"0 0 135 137",fill:"none",children:[l("path",{d:"M76.2361 65.9046L76.5095 17.3023C76.5157 15.9172 76.0711 14.9946 75.3435 14.6207C74.0964 13.9799 72.9093 14.4957 71.4798 15.3728L29.2306 41.5137L28.3702 98.7706L76.2398 65.9035L76.2361 65.9046Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M85.4571 126.862L85.791 76.8509C85.8102 74.0184 83.742 70.6325 81.1983 69.3267L47.8586 51.3375C46.7068 50.7462 45.739 49.8676 45.0526 48.788L43.4726 46.3043C42.7862 45.2247 41.8184 44.3461 40.6665 43.7548L36.2848 41.5054L31.2783 42.6987L30.909 101.567C30.9861 102.57 31.6727 103.52 32.9446 104.173L80.2378 129.343L81.6163 131.639L84.2802 129.667L84.2754 129.664C85.0031 129.123 85.4546 128.164 85.4632 126.862L85.4571 126.862Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M83.1421 78.7933C83.1612 75.96 81.0925 72.5732 78.5483 71.267L30.2174 45.562C28.8517 44.8609 28.1628 43.8191 28.1721 42.7358L27.7773 103.281C27.8544 104.284 28.5413 105.234 29.8134 105.887L78.1443 131.592C80.6909 132.9 82.7889 131.652 82.8068 128.821L83.1408 78.7956L83.1421 78.7933Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M36.8699 42.6587C36.8641 43.5432 35.5341 44.2721 33.9017 44.2823C32.2694 44.2925 30.9508 43.5854 30.9555 42.6973C30.9602 41.8091 32.2913 41.0838 33.9237 41.0736C34.7155 41.0681 35.4328 41.2334 35.963 41.5055C36.5244 41.7937 36.8726 42.2027 36.8699 42.6587Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M35.2866 42.6695C35.284 43.0802 34.6673 43.4179 33.9096 43.4227C33.1519 43.4276 32.5394 43.098 32.5419 42.6874C32.5445 42.2767 33.1612 41.939 33.9189 41.9342C34.2856 41.9315 34.6182 42.0084 34.8653 42.1352C35.1268 42.2695 35.288 42.4582 35.2853 42.6719L35.2866 42.6695Z",fill:"black"}),l("path",{d:"M70.9275 14.9238L29.4561 40.1902C28.389 40.9925 27.8611 41.9567 27.8526 42.8886C27.8526 42.8886 27.6951 44.5777 29.8905 45.7049C32.0859 46.832 34.8391 48.2668 34.8391 48.2668L36.1919 47.4119L31.26 44.8586C29.3491 43.8775 28.9381 42.1986 30.6697 40.8949L72.2083 15.5784C73.3784 14.6992 74.4371 14.4968 75.1905 14.8835C75.1905 14.8835 72.8927 13.4441 70.9288 14.9215L70.9275 14.9238Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M81.0605 110.741L83.1092 111.399L85.7093 118.337L85.7797 107.796L81.2805 106.491L81.0605 110.741Z",fill:"black"}),l("path",{d:"M83.1104 113.492C83.1312 110.487 84.073 109.095 87.3742 109.652C89.1483 109.952 90.9444 109.879 92.6948 109.428L96.5484 108.436C99.8885 107.577 102.639 104.113 102.664 100.741C102.686 97.3675 99.9706 95.3116 96.6329 96.1724L91.9518 97.3781C90.3645 97.7883 88.6894 97.6786 87.181 97.0768C84.1103 95.8485 83.2401 94.5701 83.2615 91.3841L81.2915 93.3582L74.7155 111.72L83.1115 113.496L83.1104 113.492Z",fill:"#F3F3F3"}),l("path",{d:"M83.1053 113.501C83.1261 110.496 84.0681 109.104 87.3701 109.661C89.1445 109.961 90.9411 109.888 92.6918 109.437L96.5463 108.445C99.8871 107.585 102.638 104.12 102.663 100.747C102.685 97.3736 99.9692 95.3172 96.6308 96.1782L91.9487 97.3841C90.361 97.7944 88.6855 97.6847 87.1768 97.0828C84.1055 95.8542 83.2351 94.5755 83.2564 91.3888",stroke:"black",strokeWidth:"1.33831",strokeMiterlimit:"10"}),l("path",{d:"M100.563 99.4451C99.4403 98.3218 97.1152 98.7714 95.3661 100.45C93.6171 102.129 93.1092 104.399 94.2323 105.522L94.7567 106.048L101.088 99.9711L100.563 99.4451Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M99.9733 105.056C101.727 103.381 102.236 101.114 101.111 99.9926C99.986 98.8713 97.6528 99.3204 95.8996 100.996C94.1464 102.671 93.637 104.938 94.762 106.059C95.8869 107.18 98.2201 106.731 99.9733 105.056Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M51.6986 91.7452C50.6642 91.2142 49.827 89.8416 49.8336 88.6901L49.9893 65.7522C49.9984 64.6019 50.8483 64.0955 51.8828 64.6265L72.5076 75.205C73.542 75.736 74.3793 77.1086 74.3726 78.2601L74.2169 101.198C74.2079 102.348 73.3579 102.855 72.3235 102.324L51.6986 91.7452Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M52.7617 91.0867C51.7272 90.5557 50.89 89.1831 50.8966 88.0315L51.0523 65.0931C51.0553 64.8339 51.101 64.6088 51.1799 64.4189C50.4902 64.3771 49.9962 64.8783 49.9906 65.7516L49.8349 88.69C49.8259 89.8403 50.6655 91.2142 51.7 91.7452L72.3252 102.324C73.1244 102.734 73.8145 102.522 74.0887 101.871C73.8709 101.859 73.6341 101.792 73.3845 101.664L52.7593 91.0855L52.7617 91.0867Z",fill:"#F3F3F3",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M66.9055 85.8915L66.8883 88.4023L64.3853 87.1169L61.8847 85.8328L59.3817 84.5474L57.6065 83.6358C57.2078 83.4311 56.8773 83.5922 56.875 83.9917L56.8689 85.042C56.8653 85.4439 57.1906 85.9418 57.5917 86.1478L59.3669 87.0594L61.8699 88.3448L61.8577 90.1235C61.8541 90.5254 62.1807 91.0209 62.5818 91.2269L63.6292 91.7647C64.0279 91.9695 64.3584 91.8083 64.362 91.4064L64.3742 89.6277L66.8772 90.9131L68.6523 91.8247C69.0511 92.0295 69.3829 91.8659 69.3852 91.4664L69.3974 89.6877L69.4095 87.909C69.4131 87.5071 69.0866 87.0116 68.6854 86.8056L66.9103 85.894L66.9055 85.8915Z",fill:"white"}),l("path",{d:"M59.3703 79.5438L59.3581 81.3271C59.3569 81.7313 59.6802 82.2293 60.0844 82.4371L61.862 83.3511L64.3662 84.6386L66.8728 85.9274L66.8862 84.1416C66.8874 83.7374 66.5641 83.2394 66.16 83.0316L64.3823 82.1176L61.8781 80.8301L59.3716 79.5414L59.3703 79.5438Z",fill:"white"}),l("path",{d:"M62.6235 73.7033C62.2248 73.4985 61.8943 73.6597 61.892 74.0592L61.8798 75.8379L59.3768 74.5525L57.6016 73.641C57.2029 73.4362 56.8724 73.5973 56.8688 73.9992L56.8566 75.7779L56.8445 77.5566C56.8409 77.9585 57.1674 78.4541 57.5686 78.6601L59.3437 79.5717L59.3609 77.0609L61.8639 78.3463L64.3645 79.6304L66.8675 80.9157L68.6426 81.8273C69.0414 82.0321 69.3719 81.8709 69.3755 81.469L69.3827 80.4224C69.3838 80.0193 69.061 79.5226 68.6598 79.3166L66.8847 78.405L64.3817 77.1197L64.3938 75.341C64.3974 74.9391 64.0709 74.4435 63.6697 74.2375L62.6224 73.6997L62.6235 73.7033Z",fill:"white"}),l("path",{d:"M46.8192 101.66L46.8314 99.6311C46.838 98.841 46.2586 97.8985 45.551 97.5353L42.5478 95.9937L42.5679 93.0481C42.5746 92.258 41.9976 91.3167 41.2875 90.9523L38.7449 89.6471C38.3611 89.4501 38.0161 89.4638 37.7758 89.6403L36.4656 90.6093L37.4387 91.7024L37.4277 93.3685L34.4246 91.827C34.0408 91.63 33.6957 91.6437 33.4554 91.8201L32.1452 92.7891L33.1181 93.8094L33.113 94.6306C33.1063 95.4207 33.6858 96.3632 34.3934 96.7264L37.3965 98.268L37.3764 101.214C37.3698 102.004 37.9468 102.945 38.6568 103.309L39.7002 103.845L40.8571 105.593L42.1673 104.624C42.3691 104.473 42.4965 104.205 42.4976 103.842L42.5177 100.897L44.2088 101.765L45.1822 103.415L46.4924 102.446C46.6966 102.297 46.8216 102.028 46.8227 101.665L46.8192 101.66Z",fill:"black",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M45.514 102.623L45.5261 100.594C45.5327 99.8036 44.9532 98.8609 44.2455 98.4977L41.2419 96.9558L41.262 94.0097C41.2674 93.2219 40.6916 92.2781 39.9815 91.9135L37.4385 90.6082C36.7284 90.2437 36.1455 90.5927 36.1388 91.3829L36.1187 94.329L33.1151 92.7872C32.405 92.4227 31.8184 92.7728 31.8154 93.5619L31.8033 95.5912C31.7967 96.3815 32.3762 97.3241 33.0839 97.6874L36.0875 99.2293L36.0673 102.175C36.0607 102.966 36.6378 103.907 37.3479 104.272L39.8909 105.577C40.601 105.941 41.1839 105.592 41.1906 104.802L41.2107 101.856L44.2143 103.398C44.9244 103.762 45.511 103.412 45.514 102.623Z",fill:"white",stroke:"black",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M55.4177 54.343L85.7278 37.2672L70.5728 15.9224L55.4177 54.343Z",fill:"#FF637F",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M55.4176 54.3431L51.6289 52.2086L66.7839 13.7881L70.5727 15.9226L55.4176 54.3431Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M69.1528 25.261L71.9944 23.6602V34.3325L69.1528 35.9334V25.261Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"}),l("path",{d:"M69.1528 38.0676L71.9944 36.4667V39.6684L69.1528 41.2693V38.0676Z",fill:"#131313",stroke:"#131313",strokeWidth:"1.33831",strokeLinecap:"round",strokeLinejoin:"round"})]})})})}function At({provider:t,showL1Warning:n,setShowL1Warning:o}){const{t:a}=g();return l(ie,{size:"full",visible:n,showHeaderBar:!1,children:E(ie.Content,{children:[l(e,{icon:"Close",variant:"tertiary",sx:{pos:"absolute",top:"base.spacing.x5",left:"base.spacing.x5",backdropFilter:"blur(30px)"},onClick:()=>o(!1)}),l(xt,{}),E(p,{sx:{px:"base.spacing.x6"},children:[l(B,{sx:{marginTop:"base.spacing.x6",marginBottom:"base.spacing.x2",textAlign:"center"},children:a("views.SETTINGS.transferAssetsL1Warning.heading")}),l(S,{size:"medium",sx:{display:"block",textAlign:"center",color:"base.color.text.body.secondary",marginBottom:"base.spacing.x13"},children:a("views.SETTINGS.transferAssetsL1Warning.body")}),l(St,{provider:t,showL1Warning:n,setShowL1Warning:o})]})]})})}function It({showDisconnectButton:e}){const[t,n]=r.useState(!1),{t:o}=g(),{connectLoaderState:a}=r.useContext(v),{provider:s}=a,{eventTargetState:{eventTarget:i}}=r.useContext(I),{ethereumProvider:c}=le(),{page:d}=x();r.useEffect((()=>{d({userJourney:P.WALLET,screen:"Settings"})}),[]);return E(oe,{testId:"wallet-balances",header:l(Q,{showBack:!0,title:o("views.SETTINGS.header.title"),onCloseButtonClick:()=>te(i)}),footer:l(ne,{}),children:[E(p,{sx:Tt,children:[l(St,{provider:s,showL1Warning:t,setShowL1Warning:n}),e&&l(b,{testId:"disconnect-button",variant:"secondary",sx:vt,onClick:()=>{(async()=>{if(de(s))try{if(s.provider?.session){const e=s.provider?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>c?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}return void await s.provider.disconnect()}if(c){const e=c?.signer.client.core.pairing.getPairings();if(e&&e.length>0){const t=e.map((e=>c?.signer.client.core.pairing.disconnect({topic:e.topic})));await Promise.allSettled(t)}await c.disconnect()}}catch(e){console.error(e)}})().then((()=>{ce(i)}))},children:o("views.SETTINGS.disconnectButton.label")})]}),l(At,{provider:s,showL1Warning:t,setShowL1Warning:n})]})}function Ot(){return l(p,{sx:{...pe,background:"base.color.translucent.emphasis.100"},children:l(p,{sx:{...Le,...ue},children:E("svg",{width:"430",height:"211",viewBox:"0 0 430 211",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[l("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)"}),l("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"}),l("path",{d:"M131.005 34.0566L130.576 32.4244L128.944 32.8537L129.373 34.4858L131.005 34.0566Z",fill:"white"}),l("path",{d:"M77.1152 45.7678L76.5627 43.6667L74.4617 44.2193L75.0142 46.3203L77.1152 45.7678Z",fill:"white"}),l("path",{d:"M264.238 30.1945L262.093 29.8494L261.748 31.9942L263.893 32.3394L264.238 30.1945Z",fill:"white"}),l("path",{d:"M348.157 2.3323L348.776 1.04626L347.49 0.427149L346.871 1.71319L348.157 2.3323Z",fill:"white"}),l("path",{d:"M342.606 56.5062L342.054 54.4052L339.953 54.9577L340.505 57.0587L342.606 56.5062Z",fill:"white"}),l("path",{d:"M348.381 55.0847L349 53.7986L347.714 53.1795L347.095 54.4656L348.381 55.0847Z",fill:"white"}),l("path",{d:"M107.606 18.8096L106.681 17.7229L105.594 18.6483L106.52 19.735L107.606 18.8096Z",fill:"white"}),l("path",{d:"M233.14 2.3323L233.759 1.04626L232.473 0.427149L231.854 1.71319L233.14 2.3323Z",fill:"white"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("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"}),l("defs",{children:E("linearGradient",{id:"paint0_linear_4525_125520",x1:"191",y1:"124.403",x2:"247.716",y2:"304.676",gradientUnits:"userSpaceOnUse",children:[l("stop",{stopColor:"#AD48BA"}),l("stop",{offset:"0.65625",stopColor:"#D178FF",stopOpacity:"0.24"})]})})]})})})}function Mt(){const{t:e}=g(),{connectLoaderState:{provider:t}}=r.useContext(v),n=O(t),{page:o}=x();return r.useEffect((()=>{o({userJourney:P.WALLET,screen:"CoinInfo"})}),[]),E(oe,{testId:"coin-info",header:l(Q,{showBack:!0,transparent:!0}),footer:l(ne,{}),heroContent:l(Ot,{}),floatHeader:!0,children:[!n&&l(he,{heading:e("views.COIN_INFO.metamask.heading"),children:e("views.COIN_INFO.metamask.body")}),n&&E(he,{heading:e("views.COIN_INFO.passport.heading"),children:[e("views.COIN_INFO.passport.body1"),l(be,{onClick:()=>window.open(Ce),children:e("views.COIN_INFO.passport.linkText")}),e("views.COIN_INFO.passport.body2")]})]})}const Wt=({checkout:e,provider:t,refreshCallback:n,errorCallback:o})=>{const[a,s]=r.useState(!0),i=r.useCallback((async(a=!1)=>{if(e&&t)try{const o=await e.getNetworkInfo({provider:t});if(!o.isSupported)return;a||s(!0);const r=await(async(e,t,n)=>{if(!e||!t||!n)return[];const o=await t.getSigner().getAddress(),a=await ve((()=>e.getAllBalances({provider:t,walletAddress:o,chainId:n})),K);return a?X(e.config,a.balances,n).map((t=>({...t,token:{...t.token,icon:Y(e.config.environment,R(t.token.address)?t.token.symbol:t.token.address??"")}}))):[]})(e,t,o.chainId);a||s(!1),n(r)}catch(e){K.nonRetryable(e)&&o(e),a||s(!1)}}),[e,t]);return xe((()=>i(!0)),3e4),{balancesLoading:a,refreshBalances:i}};function _t(e){const{t:t}=g(),n=t("views.ERROR_VIEW.actionText"),o=t("views.LOADING_VIEW.text"),{eventTargetState:{eventTarget:a}}=r.useContext(I),{config:{environment:s,isOnRampEnabled:i,isSwapEnabled:c,isBridgeEnabled:d,theme:p},walletConfig:{showDisconnectButton:L,showNetworkMenu:u}}=e,{connectLoaderState:{checkout:h,provider:C}}=r.useContext(v),[b,k]=r.useReducer(ke,{...fe,history:[]}),[f,m]=r.useReducer(Ke,{...$e,walletConfig:{showDisconnectButton:L,showNetworkMenu:u}}),w=r.useMemo((()=>({walletState:f,walletDispatch:m})),[f,m]),S=r.useMemo((()=>({viewState:b,viewDispatch:k})),[b,k]),{balancesLoading:x,refreshBalances:A}=Wt({checkout:h,provider:C,refreshCallback:e=>{m({payload:{type:He.SET_TOKEN_BALANCES,tokenBalances:e}})},errorCallback:e=>{console.error(e),k({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:new Error("Unable to fetch balances")}}})}});r.useEffect((()=>{(async()=>{if(!h)return;let e;try{e=await h.isSwapAvailable()}catch(t){e=!1}m({payload:{type:He.SET_SUPPORTED_TOP_UPS,supportedTopUps:{isBridgeEnabled:d,isSwapEnabled:c,isOnRampEnabled:i,isSwapAvailable:e}}})})()}),[d,c,i,s]);const O=async()=>{if(h&&C)try{const e=await h.getNetworkInfo({provider:C});if(!e.isSupported)return;A(),k({payload:{type:T.UPDATE_VIEW,view:{type:et.WALLET_BALANCES}}}),m({payload:{type:He.SET_NETWORK,network:e}})}catch(e){console.error(e),k({payload:{type:T.UPDATE_VIEW,view:{type:V.ERROR_VIEW,error:e}}})}};r.useEffect((()=>{h&&C&&O()}),[h,C]);return l(y.Provider,{value:S,children:l(Ee,{environment:s,children:E(Je.Provider,{value:w,children:[b.view.type===V.LOADING_VIEW&&l(me,{loadingText:o}),b.view.type===et.WALLET_BALANCES&&l(wt,{balancesLoading:x,theme:p,showNetworkMenu:u}),b.view.type===et.SETTINGS&&l(It,{showDisconnectButton:L}),b.view.type===et.COIN_INFO&&l(Mt,{}),b.view.type===V.ERROR_VIEW&&l(we,{actionText:n,onActionClick:async()=>{k({payload:{type:T.UPDATE_VIEW,view:{type:et.WALLET_BALANCES}}}),await O()},onCloseClick:()=>te(a)}),b.view.type===V.TOP_UP_VIEW&&l(Se,{analytics:{userJourney:P.WALLET},widgetEvent:D.IMTBL_WALLET_WIDGET_EVENT,checkout:h,provider:C,showOnrampOption:i,showSwapOption:c,showBridgeOption:d,onCloseButtonClick:()=>te(a)})]})})})}export{_t as default};
@@ -1 +1 @@
1
- import{cZ as t}from"./index-9bf3a185.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 c,a,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===(c=n.getElementsByTagName("a")[0])||void 0===c?void 0:c.getAttribute("href")),h=t(i.track(s,f,null!=o?o:{}),null!==(a=i.settings.timeout)&&void 0!==a?a: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 c;u.preventDefault?u.preventDefault():u.returnValue=!1;var a=e instanceof Function?e(n):e,s=r instanceof Function?r(n):r;t(i.track(a,s,null!=o?o:{}),null!==(c=i.settings.timeout)&&void 0!==c?c:500).catch(console.error).then((function(){n.submit()})).catch(console.error)},c=window.jQuery||window.Zepto;c?c(n).submit(u):n.addEventListener("submit",u,!1)})),this):this}export{e as form,n as link};
1
+ import{cZ as t}from"./index-23793c68.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 c,a,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===(c=n.getElementsByTagName("a")[0])||void 0===c?void 0:c.getAttribute("href")),h=t(i.track(s,f,null!=o?o:{}),null!==(a=i.settings.timeout)&&void 0!==a?a: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 c;u.preventDefault?u.preventDefault():u.returnValue=!1;var a=e instanceof Function?e(n):e,s=r instanceof Function?r(n):r;t(i.track(a,s,null!=o?o:{}),null!==(c=i.settings.timeout)&&void 0!==c?c:500).catch(console.error).then((function(){n.submit()})).catch(console.error)},c=window.jQuery||window.Zepto;c?c(n).submit(u):n.addEventListener("submit",u,!1)})),this):this}export{e as form,n as link};