@ape.swap/bonds-sdk 3.0.70 → 3.0.72

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.
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ declare const LoadingSpinner: ({ isLoading, size }: {
3
+ isLoading: boolean;
4
+ size: number;
5
+ }) => React.JSX.Element;
6
+ export default LoadingSpinner;
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ declare const StepBubble: ({ number, title, currentStep, hideBar, loading, }: {
3
+ number: number;
4
+ title: string;
5
+ currentStep: number;
6
+ hideBar?: boolean;
7
+ loading?: boolean;
8
+ }) => React.JSX.Element;
9
+ export default StepBubble;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import { SvgProps } from './types';
3
+ declare const Tick: React.FC<SvgProps>;
4
+ export default Tick;
@@ -114,3 +114,4 @@ export { default as StarFilled } from './StarFilled';
114
114
  export { default as FirePink } from './FirePink';
115
115
  export { default as Farcaster } from './Farcaster';
116
116
  export { default as Timer } from './Timer';
117
+ export { default as Tick } from './Tick';
@@ -161,7 +161,8 @@ export declare enum icons {
161
161
  FirePink = "FirePink",
162
162
  GRAPHLINQ = "GRAPHLINQ",
163
163
  Farcaster = "Farcaster",
164
- TIMER = "Timer"
164
+ TIMER = "Timer",
165
+ TICK = "TICK"
165
166
  }
166
167
  export declare enum directions {
167
168
  LEFT = "left",
package/dist/main.js CHANGED
@@ -4037,6 +4037,7 @@ var icons;
4037
4037
  icons["GRAPHLINQ"] = "GRAPHLINQ";
4038
4038
  icons["Farcaster"] = "Farcaster";
4039
4039
  icons["TIMER"] = "Timer";
4040
+ icons["TICK"] = "TICK";
4040
4041
  })(icons || (icons = {}));
4041
4042
  var directions;
4042
4043
  (function (directions) {
@@ -6661,6 +6662,20 @@ const Timer = ({ direction = 'right', color = 'text', width, getStyles }) => {
6661
6662
  return (jsx$2("svg", { width: width || '28', xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", fill: color, children: jsx$2("path", { d: "M256 0a256 256 0 1 1 0 512A256 256 0 1 1 256 0zM232 120l0 136c0 8 4 15.5 10.7 20l96 64c11 7.4 25.9 4.4 33.3-6.7s4.4-25.9-6.7-33.3L280 243.2 280 120c0-13.3-10.7-24-24-24s-24 10.7-24 24z" }) }));
6662
6663
  };
6663
6664
 
6665
+ const Tick = ({ direction = 'down', color = 'text', width, getStyles }) => {
6666
+ const deg = {
6667
+ left: 90,
6668
+ up: 180,
6669
+ right: 270,
6670
+ down: 0,
6671
+ };
6672
+ const style = getStyles({
6673
+ degree: deg[direction],
6674
+ color,
6675
+ });
6676
+ return (jsx$2("svg", { width: width || '12', height: width || '10', viewBox: "0 0 12 10", sx: style, children: jsx$2("path", { d: "M5.4142 9.19908C4.63315 9.98013 3.36682 9.98013 2.58577 9.19908L0.802622 7.41593C0.282018 6.89533 0.282018 6.05126 0.802622 5.53066C1.32377 5.00951 2.16891 5.01014 2.68929 5.53205L2.87303 5.71634C3.49507 6.34022 4.50539 6.34071 5.12803 5.71744L9.64356 1.19734C10.1643 0.676038 11.0092 0.675825 11.5302 1.19687C12.0511 1.71772 12.0511 2.5622 11.5302 3.08306L5.4142 9.19908Z", fill: "#FAFAFA" }) }));
6677
+ };
6678
+
6664
6679
  const BANANA = ({ width }) => {
6665
6680
  return (jsxs("svg", { width: width || '25', viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx$2("path", { d: "M16.5444 34.937L16.5429 34.9368C13.2548 34.654 10.1202 33.4202 7.52143 31.386C4.9227 29.3518 2.97226 26.6053 1.90808 23.4814C0.843902 20.3575 0.712007 16.9915 1.52849 13.7939C2.34497 10.5964 4.07452 7.7056 6.50611 5.47434C8.9377 3.24307 11.9662 1.76779 15.222 1.22852C18.4779 0.689239 21.8203 1.10928 24.8415 2.43739C27.8626 3.7655 30.4319 5.94425 32.2358 8.70778C34.0396 11.4713 35.0001 14.7001 35 18.0003C35 22.5089 33.2089 26.8328 30.0208 30.0209C26.8327 33.209 22.5087 35 18 35C17.5092 35 17.024 34.9789 16.5444 34.937Z", fill: "#FAF4E6", stroke: "white", strokeWidth: "2" }), jsx$2("path", { d: "M17.1717 20.2991C17.1717 20.2991 17.3079 18.3836 14.8592 16.2792C11.3558 13.2704 10.9537 12.6088 13.8571 13.079C16.7606 13.5492 18.8753 15.9825 18.8753 15.9825", fill: "#FFCA28" }), jsx$2("path", { d: "M11.0577 25.5935L10.9691 24.3691L8.5525 24.5464C8.43256 24.5553 8.32107 24.6114 8.24253 24.7025C8.16398 24.7936 8.12483 24.9121 8.13368 25.0321L8.15295 25.3468C8.16183 25.4668 8.21793 25.5785 8.30895 25.6572C8.39998 25.736 8.51851 25.7754 8.63857 25.7669L11.0577 25.5935Z", fill: "#AC752C" }), jsx$2("path", { d: "M11.0577 25.5935L11.0128 24.9819L8.14526 25.1913L8.15297 25.3468C8.16185 25.4668 8.21795 25.5784 8.30898 25.6572C8.40001 25.7359 8.51854 25.7754 8.6386 25.7669L11.0577 25.5935Z", fill: "#7D551F" }), jsx$2("path", { d: "M21.7311 21.4104C21.3081 20.9631 20.8252 20.5765 20.2961 20.2619C19.7822 19.9458 19.2323 19.6953 18.6927 19.4319C18.2161 19.1994 17.7831 18.9347 17.2641 18.8333L17.1934 18.9335C17.169 18.9669 17.1433 18.999 17.1202 19.0324C17.0675 19.1082 17.0097 19.1827 16.9519 19.2585L16.9301 19.2868L16.8569 19.3818C16.8312 19.4152 16.8029 19.4473 16.7759 19.4808C16.7181 19.5553 16.6577 19.6272 16.5961 19.6979C16.4162 19.9124 16.2261 20.1218 16.0282 20.3248C15.9948 20.3599 15.9614 20.3933 15.928 20.425C15.8753 20.4803 15.8214 20.5342 15.7661 20.5856L15.6492 20.6974C15.6094 20.7359 15.5708 20.7719 15.531 20.8079L15.5053 20.8323C15.4462 20.8875 15.3846 20.9428 15.3216 20.9954L15.2792 21.0327C15.2556 21.0559 15.2308 21.0778 15.2047 21.0982L15.1302 21.1612C15.066 21.2138 15.0017 21.2678 14.94 21.3192C14.8514 21.3924 14.7576 21.4656 14.6651 21.5363C14.5726 21.607 14.5161 21.6506 14.439 21.7046L14.3966 21.7342L14.209 21.8626C14.1088 21.9333 14.0048 22.0027 13.8994 22.0695C13.6853 22.2091 13.4643 22.3427 13.2365 22.4703C12.8252 22.703 12.4 22.9102 11.9634 23.0908C11.7771 23.1705 11.5869 23.245 11.3955 23.3144C11.2992 23.3491 11.2015 23.3837 11.1039 23.4159C11.0062 23.448 10.933 23.4737 10.8469 23.5006C10.7287 23.5366 10.6118 23.57 10.4949 23.6034C10.465 23.6158 10.4358 23.6299 10.4076 23.6458C10.3921 23.6548 10.3742 23.6651 10.3549 23.6741L10.3253 23.6921L10.2958 23.7113C10.0256 23.8808 9.81464 24.13 9.69197 24.4244C9.69197 24.4334 9.69196 24.4423 9.68169 24.4526C9.61021 24.6516 9.5826 24.8638 9.60075 25.0744C9.60839 25.1947 9.6282 25.314 9.65985 25.4303C9.68079 25.5144 9.71231 25.5956 9.75363 25.6718C9.90561 25.9343 10.1387 26.1403 10.4178 26.2589C10.9857 26.5262 11.7257 26.5763 12.1715 26.5776C14.0656 26.5467 15.9275 26.0819 17.6139 25.2188C19.3003 24.3558 20.7664 23.1175 21.8994 21.5993C21.8454 21.5376 21.7902 21.4746 21.7311 21.4104Z", fill: "#FFB300" }), jsx$2("path", { d: "M18.6877 19.4371C18.211 19.2045 17.7781 18.9399 17.2591 18.8384L17.1884 18.9386C17.164 18.972 17.1383 19.0041 17.1152 19.0375C17.092 19.0709 17.0651 19.1043 17.0394 19.1364C17.0137 19.1686 16.9777 19.2212 16.9469 19.2649L16.925 19.2932L16.8518 19.3882C16.8261 19.4216 16.7978 19.4538 16.7709 19.4872C16.7439 19.5206 16.7143 19.554 16.6861 19.5887L16.591 19.7043C16.5358 19.7698 16.4779 19.8328 16.4214 19.8983C16.4111 19.9098 16.4009 19.9227 16.3893 19.9342L16.3084 20.0255C16.248 20.0923 16.1876 20.1539 16.1246 20.2233L16.0232 20.3312C15.9897 20.3663 15.9563 20.3997 15.9229 20.4314C15.869 20.4867 15.815 20.5394 15.7611 20.592L15.6442 20.7038C15.6043 20.7423 15.5658 20.7783 15.526 20.8143L15.5003 20.8387C15.4412 20.8939 15.3795 20.9479 15.3166 21.0019L15.2742 21.0391L15.1996 21.1046L15.1251 21.1676C15.0609 21.2203 14.9967 21.2742 14.935 21.3256L14.7616 21.4541L14.6601 21.5363C14.5855 21.5915 14.511 21.6506 14.4339 21.7046L14.3916 21.7341L14.204 21.8626C14.1552 21.8973 14.1051 21.9281 14.0537 21.9615L13.8944 22.0695C13.8173 22.1196 13.7402 22.1658 13.6631 22.2146L13.5346 22.2891C13.4344 22.3508 13.3317 22.4112 13.2302 22.4703L13.022 22.5833L12.7099 22.7452L12.494 22.8493C12.387 22.9007 12.2778 22.9508 12.1664 22.9996L11.957 23.0908C11.8285 23.1422 11.7103 23.1923 11.5857 23.2386L11.4431 23.2925C11.4251 23.3002 11.4046 23.3066 11.3892 23.3143C11.2928 23.349 11.1952 23.3837 11.0975 23.4158L10.8406 23.5006C10.7224 23.5366 10.6055 23.57 10.4886 23.6034C10.4586 23.6158 10.4294 23.6299 10.4012 23.6458C10.3858 23.6548 10.3678 23.6651 10.3485 23.6741L10.319 23.6921L10.2894 23.7113C10.0193 23.8808 9.80829 24.1299 9.68562 24.4244C9.68562 24.4333 9.68562 24.4423 9.67534 24.4526C9.60386 24.6516 9.57626 24.8637 9.5944 25.0744C9.60205 25.1947 9.62185 25.314 9.6535 25.4303H9.67405C10.1331 25.434 10.5921 25.4121 11.0487 25.3648C11.712 25.2965 12.3685 25.1741 13.0118 24.9986C13.1595 24.9601 13.3072 24.9164 13.455 24.8701C16.0181 24.0755 18.2518 22.466 19.8169 20.2863C19.8709 20.2117 19.9223 20.1347 19.9737 20.0589C19.5523 19.8417 19.118 19.64 18.6877 19.4371Z", fill: "#FFD54F" }), jsx$2("path", { d: "M22.2205 21.1471L19.8104 20.2991L16.9301 19.2868L16.9519 19.2585C16.9827 19.2161 17.0148 19.1737 17.0444 19.13C17.0739 19.0864 17.0945 19.0645 17.1202 19.0311C17.1459 18.9977 17.169 18.9656 17.1934 18.9322C17.2568 18.8465 17.3185 18.7609 17.3784 18.6752C17.4182 18.6187 17.4555 18.5596 17.494 18.5031C17.5698 18.3862 17.6444 18.2706 17.7137 18.1524C17.7394 18.1125 17.7638 18.0727 17.7882 18.0329L17.8101 17.9956L17.9386 17.7798C17.9814 17.7027 18.0242 17.6269 18.067 17.5524L18.2032 17.2839C18.2405 17.2094 18.279 17.1336 18.315 17.0578C18.351 16.982 18.3908 16.8959 18.4306 16.815C18.4422 16.788 18.455 16.7623 18.4653 16.7366C18.4897 16.6826 18.5128 16.6287 18.536 16.5734V16.5619C18.5681 16.4822 18.6028 16.4039 18.6349 16.3229C18.6433 16.3054 18.6506 16.2874 18.6567 16.269L18.6747 16.224C18.6965 16.1662 18.7158 16.1109 18.7364 16.0544C18.7569 15.9979 18.7736 15.9632 18.789 15.9182C18.8045 15.8733 18.8237 15.8257 18.8404 15.7795L18.8533 15.7448C18.8623 15.7165 18.8726 15.687 18.8815 15.6574C18.8905 15.6279 18.9008 15.5996 18.9098 15.5675C18.974 15.3705 19.0344 15.1727 19.091 14.974C19.1179 14.8725 19.1449 14.7735 19.1706 14.6721C19.2079 14.5282 19.2413 14.3843 19.2708 14.2365L19.2811 14.1916C19.2811 14.1787 19.2811 14.1672 19.2811 14.1556C19.3158 13.986 19.3453 13.8151 19.3749 13.6417C19.3839 13.5839 19.3929 13.5261 19.3993 13.4683C19.4057 13.4105 19.4147 13.3539 19.4237 13.2948C19.4327 13.2357 19.4404 13.1664 19.4481 13.0906C19.4481 13.0482 19.4571 13.0083 19.461 12.9621C19.4712 12.8889 19.4764 12.8131 19.4828 12.7373C19.4892 12.6615 19.4944 12.6088 19.4995 12.5343C19.5072 12.4161 19.5123 12.2966 19.5188 12.1771C19.5188 12.1167 19.5188 12.0486 19.5188 11.9934C19.5188 11.9703 19.5188 11.9472 19.5188 11.9253C19.5201 11.9022 19.5201 11.879 19.5188 11.8559C19.5188 11.811 19.5188 11.7647 19.5188 11.7198C19.5188 11.6748 19.5188 11.6144 19.5188 11.563C19.5188 11.3883 19.5111 11.2161 19.5021 11.0414C19.5021 11.0324 19.5021 11.0234 19.5021 11.0144C19.4931 10.8564 19.4815 10.6971 19.4661 10.5365C19.4327 9.88004 19.1822 8.3525 19.3016 7.26563C19.3569 6.77101 19.4892 6.36632 19.7564 6.19032C19.7894 6.16692 19.8247 6.14711 19.8618 6.13122C19.9008 6.11808 19.9408 6.10777 19.9813 6.10039H19.9877C20.3545 6.05294 20.7266 6.12936 21.045 6.3175C21.5058 6.58519 21.912 6.93736 22.2424 7.35556C23.6055 9.39993 24.3294 11.8037 24.3221 14.2608C24.3148 16.7179 23.5765 19.1173 22.2013 21.1535L22.2205 21.1471Z", fill: "#FFD770" }), jsx$2("path", { d: "M19.8104 20.2992C21.2266 18.3335 22.0351 15.9957 22.1358 13.5751C22.2365 11.1545 21.625 8.75759 20.377 6.68111C20.3024 6.56035 20.2267 6.4383 20.1496 6.31882C20.1007 6.24302 20.0481 6.16722 19.9993 6.09399C19.9587 6.10138 19.9188 6.11169 19.8798 6.12483C19.8427 6.14072 19.8073 6.16053 19.7744 6.18392C19.5072 6.3625 19.3749 6.76462 19.3196 7.25924C19.2002 8.34097 19.4481 9.87365 19.4841 10.5301C19.4995 10.6907 19.5111 10.85 19.5201 11.0081C19.5201 11.017 19.5201 11.026 19.5201 11.035C19.529 11.2098 19.5355 11.3819 19.5368 11.5566C19.5368 11.5721 19.5368 11.59 19.5368 11.6042V11.7288C19.5368 11.7738 19.5368 11.82 19.5368 11.865C19.5381 11.8881 19.5381 11.9112 19.5368 11.9343C19.5368 11.9562 19.5368 11.9793 19.5368 12.0024C19.5368 12.0641 19.5368 12.1309 19.5368 12.1861C19.5303 12.3056 19.5252 12.4251 19.5175 12.5433C19.5175 12.6114 19.5085 12.6795 19.5008 12.7463C19.4931 12.8131 19.4867 12.8979 19.4789 12.9711C19.4789 13.0135 19.4699 13.0533 19.4661 13.0996C19.4584 13.169 19.4507 13.2371 19.4417 13.3039C19.4327 13.3707 19.425 13.4208 19.4173 13.4773C19.4096 13.5338 19.4019 13.5929 19.3929 13.6507C19.3633 13.8203 19.3338 13.9912 19.2991 14.1646C19.2991 14.1762 19.2991 14.1877 19.2991 14.2006L19.2888 14.2456C19.2593 14.3933 19.2259 14.5372 19.1886 14.6811C19.1629 14.7826 19.1359 14.8815 19.1089 14.983C19.0524 15.1825 18.992 15.3804 18.9278 15.5765C18.9188 15.6086 18.9098 15.6369 18.8995 15.6665C18.8893 15.696 18.8803 15.7256 18.8713 15.7538L18.8584 15.7885C18.8417 15.8348 18.825 15.881 18.807 15.9273C18.789 15.9735 18.7723 16.0185 18.7544 16.0634C18.7364 16.1084 18.7145 16.1752 18.6927 16.233L18.6747 16.278C18.6685 16.2964 18.6612 16.3144 18.6529 16.3319C18.6207 16.4129 18.5861 16.4913 18.5539 16.5709V16.5825C18.5308 16.6377 18.5077 16.6917 18.4833 16.7456C18.473 16.7713 18.4602 16.797 18.4486 16.824C18.4088 16.9049 18.3715 16.9872 18.333 17.0668C18.2944 17.1465 18.2585 17.2184 18.2212 17.2929L18.085 17.5614C18.0422 17.6359 17.9994 17.7117 17.9565 17.7888L17.8281 18.0047L17.7882 18.0239C17.7638 18.0638 17.7394 18.1036 17.7137 18.1434C17.6444 18.2616 17.5698 18.3772 17.494 18.4941C17.4555 18.5507 17.4182 18.6098 17.3784 18.6663C17.3185 18.7519 17.2568 18.8376 17.1934 18.9232C17.169 18.9566 17.1433 18.9888 17.1202 19.0222C17.0971 19.0556 17.0701 19.089 17.0444 19.1211C17.0187 19.1532 16.9827 19.2059 16.9519 19.2495L16.9301 19.2778L19.8104 20.2992Z", fill: "#FFEA8C" }), jsx$2("path", { d: "M16.9301 19.2869C16.9301 19.2869 19.5201 20.2594 20.5504 21.2884C22.1717 22.9098 22.7948 23.4082 21.8518 28.2927C21.8184 28.4713 21.7889 28.6499 21.7683 28.831C21.6771 29.643 21.5872 31.7011 24.7848 26.9374C28.63 21.2075 23.1764 19.5965 23.1764 19.5965C21.1722 19.0171 19.0434 18.9541 16.9301 19.2869Z", fill: "#FFCA28" })] }));
6666
6681
  };
@@ -7171,6 +7186,8 @@ const Svg = (_a) => {
7171
7186
  return jsx$2(GRAPHLINQ, Object.assign({}, props, { getStyles: getStyles }));
7172
7187
  case icons.TIMER:
7173
7188
  return jsx$2(Timer, Object.assign({}, props, { getStyles: getStyles }));
7189
+ case icons.TICK:
7190
+ return jsx$2(Tick, Object.assign({}, props, { getStyles: getStyles }));
7174
7191
  case icons.BLAST:
7175
7192
  return jsx$2(BLAST, Object.assign({}, props, { getStyles: getStyles }));
7176
7193
  case icons.CROSSFI:
@@ -19032,10 +19049,10 @@ const TokenInfoAndName = ({ tokenSymbol, chain, tag, vestEnds, isHotBond, }) =>
19032
19049
  };
19033
19050
 
19034
19051
  /*
19035
- * bignumber.js v9.3.0
19052
+ * bignumber.js v9.1.2
19036
19053
  * A JavaScript library for arbitrary-precision arithmetic.
19037
19054
  * https://github.com/MikeMcl/bignumber.js
19038
- * Copyright (c) 2025 Michael Mclaughlin <M8ch88l@gmail.com>
19055
+ * Copyright (c) 2022 Michael Mclaughlin <M8ch88l@gmail.com>
19039
19056
  * MIT Licensed.
19040
19057
  *
19041
19058
  * BigNumber.prototype methods | BigNumber methods
@@ -19936,7 +19953,7 @@ function clone$2(configObject) {
19936
19953
 
19937
19954
  // xc now represents str converted to baseOut.
19938
19955
 
19939
- // The index of the rounding digit.
19956
+ // THe index of the rounding digit.
19940
19957
  d = e + dp + 1;
19941
19958
 
19942
19959
  // The rounding digit: the digit to the right of the digit that may be rounded up.
@@ -24306,7 +24323,6 @@ bn$1.exports;
24306
24323
  this.words[i] = carry;
24307
24324
  this.length++;
24308
24325
  }
24309
- this.length = num === 0 ? 1 : this.length;
24310
24326
 
24311
24327
  return isNegNum ? this.ineg() : this;
24312
24328
  };
@@ -58560,6 +58576,14 @@ const discountEarnTokenPrice = (bond, useTiers) => {
58560
58576
  const trueBondPriceWithFee = getBalanceNumber(new BigNumber$1(trueBondPrice).times((100 + fee) / 100));
58561
58577
  return getFirstNonZeroDigits(principalTokenPrice * trueBondPriceWithFee);
58562
58578
  };
58579
+ const discountEarnTokenPriceForUser = (bond, useTiers, userTier) => {
58580
+ var _a, _b, _c;
58581
+ const fee = (_a = bond === null || bond === void 0 ? void 0 : bond.feeInPayout) !== null && _a !== void 0 ? _a : 0;
58582
+ const principalTokenPrice = parseFloat((_b = bond.principalTokenPrice) !== null && _b !== void 0 ? _b : '0');
58583
+ const trueBondPrice = (_c = findHighestTrueBondPrice(TIERS_WEIGHT[userTier] , bond)) === null || _c === void 0 ? void 0 : _c.trueBondPrice;
58584
+ const trueBondPriceWithFee = getBalanceNumber(new BigNumber$1(trueBondPrice).times((100 + fee) / 100));
58585
+ return getFirstNonZeroDigits(principalTokenPrice * trueBondPriceWithFee);
58586
+ };
58563
58587
  const maxBuy = (bond) => {
58564
58588
  var _a, _b, _c, _d, _e, _f;
58565
58589
  const available = new BigNumber$1((_a = bond === null || bond === void 0 ? void 0 : bond.tokensRemaining) !== null && _a !== void 0 ? _a : '0');
@@ -61016,7 +61040,7 @@ const useModal = (modal, closeOnOverlayClick = true, updateOnPropsChange = false
61016
61040
  const nodeIdIndex = nodeId.indexOf(modalId);
61017
61041
  const onPresentCallback = useCallback(() => {
61018
61042
  if (nodeIdIndex !== -1) {
61019
- console.error('Modal is already open.'); //TODO: when sure this works as expected. remove console
61043
+ console.error('Modal is already open.', modalId); //TODO: when sure this works as expected. remove console
61020
61044
  return;
61021
61045
  }
61022
61046
  else {
@@ -61024,7 +61048,6 @@ const useModal = (modal, closeOnOverlayClick = true, updateOnPropsChange = false
61024
61048
  }
61025
61049
  }, [modal, modalId, clearModalStack, onPresent, nodeIdIndex]);
61026
61050
  useEffect(() => {
61027
- // NodeId is needed in case there are 2 useModal hooks on the same page and one has updateOnPropsChange
61028
61051
  if (updateOnPropsChange) {
61029
61052
  const modalProps = get$1(modal, 'props');
61030
61053
  const oldModalProps = get$1(modalNode[nodeIdIndex], 'props');
@@ -61117,11 +61140,12 @@ function useBondNFTData(id, billNftAddress, chainId) {
61117
61140
  });
61118
61141
  }
61119
61142
  const getBondNFTData = (apiV2URL, id, billNftAddress, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
61143
+ var _a;
61120
61144
  try {
61121
61145
  // console.log('Bond NFT Data: Started')
61122
61146
  const billNFTData = yield getBillNftBatchData(apiV2URL, [id], billNftAddress, chainId);
61123
61147
  // console.log('Bond NFT Data: Finished')
61124
- return billNFTData[0];
61148
+ return (_a = billNFTData === null || billNFTData === void 0 ? void 0 : billNFTData[0]) !== null && _a !== void 0 ? _a : null;
61125
61149
  }
61126
61150
  catch (e) {
61127
61151
  console.error(e);
@@ -61131,6 +61155,7 @@ const getBondNFTData = (apiV2URL, id, billNftAddress, chainId) => __awaiter$9(vo
61131
61155
  extraInfo: { type: 'getBondNFTData', billNftAddress, e },
61132
61156
  chainId,
61133
61157
  });
61158
+ return null;
61134
61159
  }
61135
61160
  });
61136
61161
 
@@ -77912,6 +77937,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
77912
77937
  if (txHash && isConfirmed) {
77913
77938
  setTxHash('');
77914
77939
  refetch();
77940
+ console.log('refetch allowance');
77915
77941
  }
77916
77942
  }, [txHash, confirmingTxOnChain]);
77917
77943
  const handleApprove = useCallback(() => __awaiter$9(void 0, void 0, void 0, function* () {
@@ -77949,6 +77975,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
77949
77975
  chainId,
77950
77976
  account,
77951
77977
  });
77978
+ throw error;
77952
77979
  }
77953
77980
  }), [amount, currency, chainId]);
77954
77981
  let approvalState = ApprovalState.NOT_APPROVED;
@@ -77964,7 +77991,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
77964
77991
  return [approvalState !== null && approvalState !== void 0 ? approvalState : ApprovalState.NOT_APPROVED, handleApprove];
77965
77992
  };
77966
77993
 
77967
- const version$1 = '2.29.1';
77994
+ const version$1 = '2.23.6';
77968
77995
 
77969
77996
  let errorConfig = {
77970
77997
  getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
@@ -78796,7 +78823,7 @@ const ProjectDescription = ({ description, isProjectView }) => {
78796
78823
  }, onClick: () => setIsOpen(true), children: ["View More ", '>'] }))] }), jsx$2(Flex, { sx: { display: ['none', 'none', 'none', 'flex'] }, children: jsx$2(SafeHTMLComponent, { html: description !== null && description !== void 0 ? description : '' }) })] })) }));
78797
78824
  };
78798
78825
 
78799
- const NewRateModal = ({ bond, zapTrueBondPrice, depositAmount, youSpendString, isZap, fetchingZapQuote, zapError, handleZap, onDismiss, }) => {
78826
+ const NewRateModal = ({ bond, zapTrueBondPrice, depositAmount, youSpendString, fetchingZapQuote, zapError, onDismiss, }) => {
78800
78827
  var _a, _b, _c, _d, _e;
78801
78828
  const { data: userPoints } = useTierPoints();
78802
78829
  const trueBondPrice = findHighestTrueBondPrice(userPoints, bond);
@@ -78814,17 +78841,14 @@ const NewRateModal = ({ bond, zapTrueBondPrice, depositAmount, youSpendString, i
78814
78841
  borderRadius: '8px',
78815
78842
  width: '100%',
78816
78843
  alignItems: 'center',
78817
- }, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { size: 30, symbol: tokenSymbol }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '10px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', fontWeight: '300', lineHeight: '14px' }, children: "Old Bonus:" }), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: [oldBonus === null || oldBonus === void 0 ? void 0 : oldBonus.toFixed(2), "% ", tokenSymbol] })] })] }), jsx$2(Flex, { sx: { width: '15px', height: '15px', ml: '20px', mr: '10px', alignItems: 'center' }, children: jsx$2(Svg, { icon: "arrow", direction: "right" }) }), jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { size: 30, symbol: tokenSymbol }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '10px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', fontWeight: '300', lineHeight: '14px' }, children: "New Bonus:" }), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: [zapBonusWithFee.toFixed(2), "% ", tokenSymbol] })] })] })] }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: Object.assign(Object.assign({}, bond), { trueBillPrice: zapTrueBondPrice }), youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(Flex, { sx: {
78844
+ }, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { size: 30, symbol: tokenSymbol }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '10px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', fontWeight: '300', lineHeight: '14px' }, children: "Old Bonus:" }), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: [oldBonus === null || oldBonus === void 0 ? void 0 : oldBonus.toFixed(2), "% ", tokenSymbol] })] })] }), jsx$2(Flex, { sx: { width: '15px', height: '15px', ml: '20px', mr: '10px', alignItems: 'center' }, children: jsx$2(Svg, { icon: "arrow", direction: "right" }) }), jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(TokenImage, { size: 30, symbol: tokenSymbol }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '10px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', fontWeight: '300', lineHeight: '14px' }, children: "New Bonus:" }), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 400 }, children: [zapBonusWithFee.toFixed(2), "% ", tokenSymbol] })] })] })] }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: Object.assign(Object.assign({}, bond), { trueBillPrice: zapTrueBondPrice }), youSpendString: youSpendString, fetchingZapQuote: fetchingZapQuote, zapError: zapError, isZap: true }), jsx$2(Flex, { sx: {
78818
78845
  width: '100%',
78819
78846
  fontSize: '14px',
78820
78847
  fontWeight: 500,
78821
78848
  color: 'textDisabledButton',
78822
78849
  justifyContent: 'flex-start',
78823
78850
  mb: '10px',
78824
- }, children: "Would you like to confirm the new rate?" }), jsx$2(Button, { fullWidth: true, onClick: () => {
78825
- handleZap();
78826
- onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
78827
- }, disabled: fetchingZapQuote, load: fetchingZapQuote, children: fetchingZapQuote ? 'Loading' : 'Buy' })] }) }));
78851
+ }, children: "Would you like to confirm the new rate?" }), jsx$2(Button, { fullWidth: true, onClick: onDismiss, disabled: fetchingZapQuote, load: fetchingZapQuote, children: fetchingZapQuote ? 'Loading' : 'Confirm' })] }) }));
78828
78852
  };
78829
78853
 
78830
78854
  const NoBonusModal = ({ onAcknowledge, showcaseTokenName }) => {
@@ -78920,16 +78944,224 @@ const GetUpToComponent = ({ bond, depositAmount }) => {
78920
78944
  } }), jsxs(Flex, { sx: { alignItems: 'center', display: ['ruby', 'ruby', 'ruby', 'flex'] }, children: [jsx$2("img", { src: `/images/launch/legend.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), "Get up to", jsx$2(Flex, { sx: { color: 'success', mx: '3px', fontWeight: 700 }, children: `+${(_a = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.boost) !== null && _a !== void 0 ? _a : 0}%` }), "Boost By locking ABOND"] }), !!depositAmount && parseFloat(depositAmount) !== 0 && (jsxs(Flex, { sx: { color: 'success', fontWeight: 700, minWidth: '65px', justifyContent: 'flex-end' }, children: ["$ ", formatUSDNumber(boostAmount.toString()), jsx$2(Flex, { sx: { ml: '4px' }, children: jsx$2(Svg, { icon: "caret", direction: isOpen ? 'up' : 'down' }) })] }))] }), jsx$2(AnimatePresence, { children: isOpen && (jsx$2(motion.div, { initial: { height: 0 }, animate: { height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { height: 0 }, sx: { overflow: 'hidden', width: '100%', marginTop: '5px' }, children: jsx$2(BonusTable, { trueBondPrices: bond.trueBondPrices, minTier: bond.minTier, hideTitle: true }) })) })] })));
78921
78945
  };
78922
78946
 
78947
+ const StepBubble = ({ number, title, currentStep, hideBar, loading, }) => {
78948
+ const stepCompleted = currentStep > number;
78949
+ const isNextStep = number > currentStep;
78950
+ return (jsxs(Flex, { sx: { width: !hideBar && '100%', minWidth: hideBar && '40px', alignItems: 'center' }, children: [jsxs(Flex, { sx: {
78951
+ minWidth: '40px',
78952
+ height: '40px',
78953
+ backgroundColor: isNextStep ? 'white2' : 'primaryButton',
78954
+ border: isNextStep ? '1px solid var(--theme-ui-colors-white4)' : '1px solid primaryButton',
78955
+ borderRadius: '40px',
78956
+ justifyContent: 'center',
78957
+ alignItems: 'center',
78958
+ fontWeight: 500,
78959
+ zIndex: 1,
78960
+ position: 'relative',
78961
+ }, children: [loading ? (jsx$2(Spinner, { size: 15 })) : stepCompleted ? (jsx$2(AnimatePresence, { children: jsx$2(motion.div, { initial: { rotate: 0 }, animate: {
78962
+ rotate: 360,
78963
+ scale: [1, 2, 1],
78964
+ transition: {
78965
+ rotate: { duration: 0.5, ease: 'linear' },
78966
+ scale: { duration: 1, ease: 'easeInOut', delay: 0.5 },
78967
+ },
78968
+ }, children: jsx$2(Svg, { icon: "TICK", width: '15px' }) }) })) : (number), jsx$2(Flex, { sx: {
78969
+ width: '100px',
78970
+ textAlign: 'center',
78971
+ justifyContent: 'center',
78972
+ fontSize: '12px',
78973
+ fontWeight: 500,
78974
+ position: 'absolute',
78975
+ top: '45px',
78976
+ left: '50%',
78977
+ transform: 'translate(-50%, 0)',
78978
+ color: 'textDisabledButton',
78979
+ }, children: title })] }), !hideBar && (jsx$2(Flex, { sx: {
78980
+ width: `100%`,
78981
+ height: '2px',
78982
+ top: '50%',
78983
+ left: `40px`,
78984
+ backgroundColor: stepCompleted ? 'primaryButton' : 'white4',
78985
+ zIndex: 0,
78986
+ } }))] }));
78987
+ };
78988
+
78989
+ const LoadingSpinner = ({ isLoading, size }) => {
78990
+ const stylesLoading = {
78991
+ width: `${size}px`,
78992
+ height: `${size}px`,
78993
+ border: `${size / 8}px solid var(--theme-ui-colors-white5)`,
78994
+ borderTopColor: 'primaryButton',
78995
+ borderRadius: '50%',
78996
+ display: 'inline-block',
78997
+ boxSizing: 'border-box',
78998
+ animation: 'rotation 1s linear infinite',
78999
+ transform: 'rotate(40deg)',
79000
+ '@keyframes rotation': {
79001
+ '0%': {
79002
+ transform: 'rotate(40deg)',
79003
+ },
79004
+ '100%': {
79005
+ transform: 'rotate(400deg)',
79006
+ },
79007
+ },
79008
+ };
79009
+ const styles = {
79010
+ width: `${size}px`,
79011
+ height: `${size}px`,
79012
+ border: `${size / 8}px solid var(--theme-ui-colors-white5)`,
79013
+ borderTopColor: 'white5',
79014
+ borderRadius: '50%',
79015
+ display: 'inline-block',
79016
+ boxSizing: 'border-box',
79017
+ };
79018
+ return jsx$2(Flex, { sx: isLoading ? stylesLoading : styles });
79019
+ };
79020
+
79021
+ const stepDelay = 1000;
79022
+ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, bondData, inputToken, inputValue, depositAmount, buyTxHash, rateChanged, }) => {
79023
+ var _a, _b, _c, _d, _e;
79024
+ // Hooks
79025
+ const { chain } = useAccount();
79026
+ const { data: userPoints } = useTierPoints();
79027
+ const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, txChain);
79028
+ const { switchChainAsync } = useSwitchChain();
79029
+ // Flow
79030
+ const initialChain = useMemo(() => chain === null || chain === void 0 ? void 0 : chain.id, []);
79031
+ const showSwitchChainFlow = txChain !== initialChain;
79032
+ // const showSwitchChainFlow = true
79033
+ const [hasToSwitchChain, setHasToSwitchChain] = useState(showSwitchChainFlow);
79034
+ const [hasToApprove, setHasToApprove] = useState(true);
79035
+ // Loading state
79036
+ const [loadingSwitchChain, setLoadingSwitchChain] = useState(false);
79037
+ const [approveLoading, setApproveLoading] = useState(false);
79038
+ const estimatedOutputAmount = getPayoutAmount(bondData, depositAmount, userPoints !== null && userPoints !== void 0 ? userPoints : '0');
79039
+ const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
79040
+ const handleSwitchChain = () => {
79041
+ setLoadingSwitchChain(true);
79042
+ switchChainAsync({ chainId: txChain })
79043
+ .then(() => {
79044
+ setHasToSwitchChain(false);
79045
+ setApproveLoading(true);
79046
+ })
79047
+ .finally(() => {
79048
+ setLoadingSwitchChain(false);
79049
+ });
79050
+ };
79051
+ const handleApprove = () => {
79052
+ setApproveLoading(true);
79053
+ approveCallback().catch(() => {
79054
+ setApproveLoading(false);
79055
+ });
79056
+ };
79057
+ // Switch Chain Step #1
79058
+ const hasTriggeredSwitch = useRef(false);
79059
+ useEffect(() => {
79060
+ if (hasToSwitchChain && !hasTriggeredSwitch.current) {
79061
+ setLoadingSwitchChain(true);
79062
+ const delay = setTimeout(() => {
79063
+ hasTriggeredSwitch.current = true;
79064
+ handleSwitchChain();
79065
+ }, stepDelay);
79066
+ return () => clearTimeout(delay);
79067
+ }
79068
+ }, [hasToSwitchChain]);
79069
+ // Trigger approve Step #2
79070
+ const hasTriggeredApproval = useRef(false);
79071
+ useEffect(() => {
79072
+ if (!hasToSwitchChain || !showSwitchChainFlow) {
79073
+ if (inputToken === 'NATIVE')
79074
+ setApproveLoading(true);
79075
+ if (approvalState === ApprovalState.APPROVED) {
79076
+ setApproveLoading(true);
79077
+ const delay = setTimeout(() => {
79078
+ setApproveLoading(false);
79079
+ setHasToApprove(false);
79080
+ }, stepDelay);
79081
+ return () => clearTimeout(delay);
79082
+ }
79083
+ else if (!hasTriggeredApproval.current && approvalState !== ApprovalState.PENDING) {
79084
+ setApproveLoading(true);
79085
+ const delay = setTimeout(() => {
79086
+ hasTriggeredApproval.current = true;
79087
+ handleApprove();
79088
+ }, stepDelay);
79089
+ return () => clearTimeout(delay);
79090
+ }
79091
+ else {
79092
+ console.log('bingo!');
79093
+ setApproveLoading(false);
79094
+ }
79095
+ }
79096
+ }, [hasToSwitchChain, approvalState]);
79097
+ // Execute main tx Step #3
79098
+ const hasTriggeredTx = useRef(false);
79099
+ useEffect(() => {
79100
+ if (!hasToSwitchChain && !hasToApprove && !hasTriggeredTx.current) {
79101
+ hasTriggeredTx.current = true;
79102
+ if (rateChanged) {
79103
+ onDismiss();
79104
+ }
79105
+ else {
79106
+ console.log('trigger tx');
79107
+ setApproveLoading(false);
79108
+ txCallback();
79109
+ }
79110
+ }
79111
+ }, [hasToSwitchChain, hasToApprove, txCallback]);
79112
+ // Close modal if a hash is found. Final Step
79113
+ const { data: txReceipt, isSuccess, isLoading: verifyingTx } = useMonitorTxHash(buyTxHash, txChain);
79114
+ useEffect(() => {
79115
+ if (buyTxHash && txReceipt) {
79116
+ if (isSuccess) {
79117
+ onDismiss();
79118
+ }
79119
+ }
79120
+ }, [buyTxHash, txReceipt, isSuccess]);
79121
+ const currentStep = showSwitchChainFlow ? (hasToSwitchChain ? 1 : hasToApprove ? 2 : 3) : hasToApprove ? 1 : 2;
79122
+ const splited = typeof inputToken !== 'string' ? (_b = inputToken === null || inputToken === void 0 ? void 0 : inputToken.symbol) === null || _b === void 0 ? void 0 : _b.split('-') : undefined;
79123
+ return (jsxs(Modal, { children: [jsx$2(ModalHeader, { onDismiss: onDismiss, hideDivider: true }), jsxs(Flex, { sx: { flexDirection: 'column', width: '100%' }, children: [jsxs(Flex, { sx: { width: '100%', alignItems: 'center', p: '10px' }, children: [showSwitchChainFlow && (jsx$2(StepBubble, { number: 1, title: 'Switch Chain', currentStep: currentStep, loading: loadingSwitchChain })), jsx$2(StepBubble, { number: showSwitchChainFlow ? 2 : 1, title: 'Approve', currentStep: currentStep, loading: approveLoading || approvalState === ApprovalState.PENDING }), jsx$2(StepBubble, { number: showSwitchChainFlow ? 3 : 2, title: 'Buy', currentStep: currentStep, loading: loadingTx || verifyingTx, hideBar: true })] }), jsx$2(Flex, { sx: { width: '100%', mt: '40px', justifyContent: 'center' }, children: jsx$2(LoadingSpinner, { isLoading: loadingSwitchChain ||
79124
+ approveLoading ||
79125
+ loadingTx ||
79126
+ verifyingTx ||
79127
+ approvalState === ApprovalState.PENDING, size: 100 }) }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', mt: '10px' }, children: hasToSwitchChain
79128
+ ? loadingSwitchChain
79129
+ ? 'Switching Chain...'
79130
+ : 'Switch Chain'
79131
+ : hasToApprove
79132
+ ? approveLoading || approvalState === ApprovalState.PENDING
79133
+ ? 'Approving...'
79134
+ : 'Approve Contract'
79135
+ : loadingTx || verifyingTx
79136
+ ? 'Buying...'
79137
+ : 'Buy' }), jsxs(Flex, { sx: { width: '100%', flexDirection: 'column', mt: '20px' }, children: [jsxs(Flex, { sx: {
79138
+ width: '100%',
79139
+ background: 'white3',
79140
+ p: '5px',
79141
+ borderRadius: 'normal',
79142
+ color: 'textDisabledButton',
79143
+ justifyContent: 'center',
79144
+ }, children: [bondData.earnToken.symbol, " (", getVestingTermsString(bondData), ")"] }), jsxs(Flex, { sx: { width: '100%', background: 'white3', p: '10px', borderRadius: 'normal', mt: '10px' }, children: [jsx$2(TokenImage, { symbol: bondData.earnToken.symbol, size: 40, chain: txChain }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', fontSize: '12px', ml: '10px' }, children: [jsx$2(Flex, { sx: { color: 'textDisabledButton', fontWeight: 400, textDecoration: 'line-through' }, children: earnTokenPrice(bondData) }), jsxs(Flex, { sx: { color: 'green', fontWeight: 600 }, children: ["$", discountEarnTokenPriceForUser(bondData, true, getUserTier(userPoints))] })] }), jsxs(Flex, { sx: {
79145
+ p: '5px',
79146
+ borderRadius: 'normal',
79147
+ border: '1px solid var(--theme-ui-colors-success)',
79148
+ background: 'rgba(56, 166, 17, 0.13)',
79149
+ color: 'success',
79150
+ lineHeight: '18px',
79151
+ }, children: [(_d = (_c = findHighestTrueBondPrice(TIERS_WEIGHT[getUserTier(userPoints)], bondData)) === null || _c === void 0 ? void 0 : _c.bonusWithFee) === null || _d === void 0 ? void 0 : _d.toFixed(2), "% Bonus"] })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between', mt: '10px' }, children: [jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [lodashExports.isArray(splited) ? (jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 20, chain: txChain })) : (jsx$2(TokenImage, { symbol: getSymbol(inputToken, txChain), size: 20, chain: txChain })), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: (_e = formatNumber$1(inputValue)) !== null && _e !== void 0 ? _e : '0' }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["(", (inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) && inputValue
79152
+ ? `$${formatUSDNumber(((inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) * parseFloat(inputValue)).toFixed(2))}`
79153
+ : '0.00', ")"] })] }), jsx$2(Svg, { icon: 'arrow', direction: 'right', width: '10px' }), jsxs(Flex, { sx: { p: '10px', borderRadius: 'normal', background: 'white3', alignItems: 'center', width: '45%' }, children: [jsx$2(TokenImage, { symbol: getSymbol(bondData.earnToken, txChain), chain: txChain, size: 20 }), jsx$2(Flex, { sx: { fontSize: '14px', fontWeight: 600, mx: '5px' }, children: formatNumber$1(estimatedOutputAmount.toString()) }), jsxs(Flex, { sx: { color: 'textDisabledButton', fontSize: '12px', fontWeight: 400 }, children: ["($", formatUSDNumber(estimatedOutputUSD.toString()), ")"] })] })] })] }), jsx$2(Flex, { sx: { mt: '20px' }, children: hasToSwitchChain ? (jsxs(Button, { load: loadingSwitchChain, disabled: loadingSwitchChain, onClick: handleSwitchChain, fullWidth: true, children: ["switch to ", NETWORK_LABEL[txChain]] })) : !hasToApprove ? (jsx$2(Button, { load: loadingTx || verifyingTx, disabled: loadingTx || verifyingTx, onClick: txCallback, fullWidth: true, children: "buy" })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING || approveLoading, disabled: approvalState === ApprovalState.PENDING || approveLoading, onClick: handleApprove, fullWidth: true, children: "Approve" })) })] })] }));
79154
+ };
79155
+
78923
79156
  const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isProjectView }) => {
78924
- var _a, _b, _c, _d, _e, _f, _g;
79157
+ var _a, _b, _c, _d, _e, _f, _g, _h;
78925
79158
  const SDKConfig = useSDKConfig();
78926
79159
  // Hooks
78927
79160
  const userChainId = useChainId();
78928
79161
  const { address: account } = useAccount();
78929
- const { switchChain } = useSwitchChain();
78930
79162
  const { writeContractAsync } = useWriteContract();
78931
79163
  const { sendTransactionAsync } = useSendTransaction();
78932
- const { data: bonds } = useBondsData();
79164
+ const { data: bonds, refetch: refetchBondState } = useBondsData();
78933
79165
  const sendReferenceId = useSendReferenceId();
78934
79166
  const { data: userPoints } = useTierPoints();
78935
79167
  const bondData = bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => { var _a; return ((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
@@ -78967,13 +79199,13 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
78967
79199
  inputToken.address[bondChain].toLowerCase());
78968
79200
  const inputCurrencyBalance = enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.balance;
78969
79201
  const inputTokenPrice = enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.price;
78970
- const rateChanged = parseFloat(zapTrueBondPrice !== null && zapTrueBondPrice !== void 0 ? zapTrueBondPrice : '0') > parseFloat(trueBondPrice !== null && trueBondPrice !== void 0 ? trueBondPrice : '0');
79202
+ const rateChanged = parseFloat(zapTrueBondPrice !== null && zapTrueBondPrice !== void 0 ? zapTrueBondPrice : '0') > parseFloat(trueBondPrice !== null && trueBondPrice !== void 0 ? trueBondPrice : '0') * 1.01 && isZap;
78971
79203
  // Estimations
78972
79204
  const depositAmount = isZap ? zapDepositAmount : inputValue;
78973
79205
  const youSpendString = `${formatNumber$1(inputValue)} ${getSymbol(inputToken, bondData === null || bondData === void 0 ? void 0 : bondData.chainId)} =
78974
79206
  $${formatUSDNumber((parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0)).toString())}`;
78975
79207
  // Validations
78976
- const isGoldRush = (bondData === null || bondData === void 0 ? void 0 : bondData.billArt.collection) === types.BillArtCollection.GoldenTicket_Collection1;
79208
+ const isGoldRush = ((_f = bondData === null || bondData === void 0 ? void 0 : bondData.billArt) === null || _f === void 0 ? void 0 : _f.collection) === types.BillArtCollection.GoldenTicket_Collection1;
78977
79209
  const zapEnabled = supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId);
78978
79210
  const exceedsMaxBuy = maxBuy(bondData).lt(getPayoutAmount(bondData, depositAmount, userPoints !== null && userPoints !== void 0 ? userPoints : '0'));
78979
79211
  const exceedsBalance = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0').lt(inputValue);
@@ -79000,9 +79232,9 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
79000
79232
  });
79001
79233
  };
79002
79234
  // Approve & Purchase Functions
79003
- const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (_f = (isZap ? SoulZapTokenManager === null || SoulZapTokenManager === void 0 ? void 0 : SoulZapTokenManager[bondData === null || bondData === void 0 ? void 0 : bondData.chainId] : bondData === null || bondData === void 0 ? void 0 : bondData.billAddress)) !== null && _f !== void 0 ? _f : null, account !== null && account !== void 0 ? account : null, (_g = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _g !== void 0 ? _g : null);
79004
- const handleApprove = () => {
79005
- approveCallback().then(() => {
79235
+ const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (_g = (isZap ? SoulZapTokenManager === null || SoulZapTokenManager === void 0 ? void 0 : SoulZapTokenManager[bondData === null || bondData === void 0 ? void 0 : bondData.chainId] : bondData === null || bondData === void 0 ? void 0 : bondData.billAddress)) !== null && _g !== void 0 ? _g : null, account !== null && account !== void 0 ? account : null, (_h = bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== null && _h !== void 0 ? _h : null);
79236
+ const handleApprove = useCallback(() => __awaiter$9(void 0, void 0, void 0, function* () {
79237
+ return approveCallback().then(() => {
79006
79238
  track({
79007
79239
  event: 'approveBondClick',
79008
79240
  chain: userChainId,
@@ -79012,8 +79244,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
79012
79244
  },
79013
79245
  });
79014
79246
  });
79015
- };
79016
- // This is the regular buy bond interaction (a.k.a. write method called "deposit" in smartcontract)
79247
+ }), [userChainId, approveCallback]);
79017
79248
  const handleBuyCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
79018
79249
  var _a, _b, _c, _d, _e, _f;
79019
79250
  const billAddress = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress;
@@ -79072,7 +79303,6 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
79072
79303
  addToastError(error.shortMessage);
79073
79304
  }
79074
79305
  });
79075
- // ignore this for SOL migration
79076
79306
  const handleZapCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
79077
79307
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
79078
79308
  if (zapData && ((_a = zapData === null || zapData === void 0 ? void 0 : zapData.txData) === null || _a === void 0 ? void 0 : _a.to) && ((_b = zapData === null || zapData === void 0 ? void 0 : zapData.txData) === null || _b === void 0 ? void 0 : _b.data)) {
@@ -79140,13 +79370,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
79140
79370
  const handleBothPurchases = () => {
79141
79371
  setLoadingTx(true);
79142
79372
  if (isZap) {
79143
- // ignore this for SOL migration
79144
- if (rateChanged) {
79145
- openNewRateModal();
79146
- }
79147
- else {
79148
- handleZapCallback().finally(() => setLoadingTx(false));
79149
- }
79373
+ handleZapCallback().finally(() => setLoadingTx(false));
79150
79374
  }
79151
79375
  else {
79152
79376
  handleBuyCallback().finally(() => setLoadingTx(false));
@@ -79159,7 +79383,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
79159
79383
  openNoBonusModal();
79160
79384
  }
79161
79385
  else {
79162
- handleBothPurchases();
79386
+ openTxModal();
79163
79387
  }
79164
79388
  };
79165
79389
  const openExternal = () => {
@@ -79172,9 +79396,10 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
79172
79396
  }
79173
79397
  };
79174
79398
  // Modals
79399
+ const [openNewRateModal] = useModal(jsx$2(NewRateModal, { bond: bondData, zapTrueBondPrice: zapTrueBondPrice, depositAmount: depositAmount, youSpendString: youSpendString, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), true, false, 'newRateModal');
79400
+ const [openTxModal] = useModal(jsx$2(TransactionModal, { txChain: bondChain, approvalState: approvalState, approveCallback: handleApprove, loadingTx: loadingTx, txCallback: handleBothPurchases, bondData: bondData, inputToken: inputToken, inputValue: inputValue, depositAmount: depositAmount, buyTxHash: buyTxHash, rateChanged: rateChanged }), false, true, 'transactionModal');
79175
79401
  const [onOpenZapModal] = useModal(jsx$2(ZapModal, { outputToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, account: account, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId }), true, true, 'zapModal');
79176
- const [openNewRateModal] = useModal(jsx$2(NewRateModal, { bond: bondData, zapTrueBondPrice: zapTrueBondPrice, depositAmount: depositAmount, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError, handleZap: () => handleZapCallback().finally(() => setLoadingTx(false)) }), true, false);
79177
- const [openNoBonusModal] = useModal(jsx$2(NoBonusModal, { onAcknowledge: handleBothPurchases, showcaseTokenName: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), true, true, 'NoBonusModal');
79402
+ const [openNoBonusModal] = useModal(jsx$2(NoBonusModal, { onAcknowledge: openTxModal, showcaseTokenName: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), true, true, 'NoBonusModal');
79178
79403
  // Effects
79179
79404
  const [hasChecked, setHasChecked] = useState(false);
79180
79405
  const [hasCheckedTrack, setHasCheckedTrack] = useState(false);
@@ -79203,6 +79428,14 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
79203
79428
  });
79204
79429
  }
79205
79430
  }, [inputCurrencyBalance, sortedZapList, bondData]);
79431
+ // If rateChanged meaning the zap quote has a >1% difference from the true bond price, we let the user know and we update state
79432
+ useEffect(() => {
79433
+ if (rateChanged) {
79434
+ console.log('rate changed, refetch state and let user know');
79435
+ openNewRateModal();
79436
+ refetchBondState();
79437
+ }
79438
+ }, [rateChanged]);
79206
79439
  return bondData ? (jsxs(Flex, { className: `modal-content ${isGoldRush ? 'gold-rush' : ''}`, children: [!isProjectView && jsx$2("div", { className: "gold-ribbon" }), jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }), jsx$2(ProjectDescription, { description: bondData.shortDescription, isProjectView: true }), jsx$2(Flex, { sx: { width: '100%', display: isProjectView ? ['flex', 'flex', 'flex', 'none'] : 'flex' }, children: jsx$2(BondCards$1, { bondData: bondData }) }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: zapEnabled, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice, inputDisabled: isUserRestricted }), SDKConfig.useTiers && jsx$2(GetUpToComponent, { bond: bondData, depositAmount: depositAmount }), (bondData === null || bondData === void 0 ? void 0 : bondData.warningCard) && (jsx$2(Flex, { sx: {
79207
79440
  width: '100%',
79208
79441
  background: '#DE62F366',
@@ -79216,10 +79449,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
79216
79449
  ? handleOpenZapModal()
79217
79450
  : openExternal(), variant: "secondary", fullWidth: true, children: bondData.billVersion === types.BillVersion.V4 && SDKConfig.useTiers
79218
79451
  ? `Get ${!isMobile ? 'your' : ''} Tier`
79219
- : `Get ${getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)}` }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : isUserRestricted ? (jsx$2(Button, { className: "action-button", disabled: true, children: "INSUFFICIENT TIER" })) : userChainId !== bondData.chainId ? (jsx$2(Button, { className: "action-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut), onClick: (event) => {
79220
- event.stopPropagation();
79221
- switchChain({ chainId: bondData.chainId });
79222
- }, style: { fontSize: '14px', padding: '6px', marginLeft: '0px' }, children: `Switch to ${NETWORK_LABEL[bondData.chainId]}` })) : approvalState === ApprovalState.APPROVED ? (jsx$2(Button, { className: "action-button", load: load || fetchingZapQuote, disabled: load ||
79452
+ : `Get ${getSymbol(bondData === null || bondData === void 0 ? void 0 : bondData.lpToken)}` }) })), jsx$2(Flex, { className: "button-container buy", children: !account ? (jsx$2(ConnectButton, {})) : isUserRestricted ? (jsx$2(Button, { className: "action-button", disabled: true, children: "INSUFFICIENT TIER" })) : (jsx$2(Button, { className: "action-button", load: load || fetchingZapQuote, disabled: load ||
79223
79453
  (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
79224
79454
  !account ||
79225
79455
  !inputValue ||
@@ -79227,17 +79457,16 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
79227
79457
  fetchingZapQuote ||
79228
79458
  zapError ||
79229
79459
  exceedsMaxBuy ||
79230
- exceedsBalance, onClick: handleOpenModal, children: exceedsMaxBuy
79460
+ exceedsBalance ||
79461
+ (isZap && !zapData), onClick: handleOpenModal, children: exceedsMaxBuy
79231
79462
  ? 'Exceeds Max Buy'
79232
79463
  : exceedsBalance
79233
79464
  ? 'Exceeds balance'
79234
79465
  : zapError
79235
79466
  ? 'something went wrong'
79236
- : `buy` })) : (jsx$2(Button, { className: "action-button", load: approvalState === ApprovalState.PENDING, disabled: approvalState === ApprovalState.PENDING ||
79237
- (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
79238
- !account ||
79239
- !inputValue ||
79240
- parseFloat(inputValue) === 0, onClick: handleApprove, children: "enable" })) })] })] })] })) : (jsx$2(Fragment$1, {}));
79467
+ : !inputValue || parseFloat(inputValue) === 0
79468
+ ? 'Insert amount'
79469
+ : `buy` })) })] })] })] })) : (jsx$2(Fragment$1, {}));
79241
79470
  };
79242
79471
 
79243
79472
  const BuyBondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
@@ -79389,9 +79618,6 @@ const BuyAction = ({ launchBond, inputValue, selectedCurrency, soldout, }) => {
79389
79618
  const { addToastError } = usePopups();
79390
79619
  // Buy confirm modal
79391
79620
  const [onOpenPurchaseModal] = useModal(jsx$2(ParticipationSuccessful, { launchBond: launchBond, inputAmount: inputValue }), true, true, `confirm buy modal`);
79392
- useEffect(() => {
79393
- onOpenPurchaseModal();
79394
- }, []);
79395
79621
  // Approve logic
79396
79622
  const [approvalState, approveCallback] = useApproval(inputValue, selectedCurrency, launchBond === null || launchBond === void 0 ? void 0 : launchBond.contractAddress, account, chainId);
79397
79623
  const handleApprove = () => {
@@ -79636,7 +79862,7 @@ const BonusContainer = ({ trueBondPrices, minTier, bonus, tooltipPosition = 'bot
79636
79862
  return (jsx$2("div", { className: `discount-column`, children: jsx$2(BonusComponent, { trueBondPrices: trueBondPrices, minTier: minTier, bonus: bonus, tooltipPosition: isMobile ? tooltipPosition : 'bottomLeft' }) }));
79637
79863
  };
79638
79864
 
79639
- const BondRow = ({ bondAddress, bondChain, payoutToken, tag, bondSoldOut, trueBondPrices, minTier, bonus, vestingTermString, vestingCliffString, percentageAvailable, remainingTokensString, }) => {
79865
+ const BondRow = ({ bondAddress, bondChain, payoutToken, tag, bondSoldOut, trueBondPrices, minTier, bonus, vestingTermString, vestingCliffString, percentageAvailable, remainingTokensString, projectURL, twitterURL, auditURL, }) => {
79640
79866
  var _a, _b, _c;
79641
79867
  const locationPath = window.location.pathname.replace('/', '');
79642
79868
  // Modal
@@ -79680,11 +79906,7 @@ const BondRow = ({ bondAddress, bondChain, payoutToken, tag, bondSoldOut, trueBo
79680
79906
  // num: remainingTokensUsd(bond).toNumber(),
79681
79907
  // isPrice: true,
79682
79908
  // })})`}
79683
- toolTip: remainingTokensString }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_b = (_a = payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.address) === null || _a === void 0 ? void 0 : _a[bondChain]) !== null && _b !== void 0 ? _b : '', earnTokenSymbol: (_c = payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.symbol) !== null && _c !== void 0 ? _c : '', bondContract: bondAddress !== null && bondAddress !== void 0 ? bondAddress : '',
79684
- // projectLink={bond?.projectLink}
79685
- // twitter={bond?.twitter}
79686
- // audit={bond?.audit}
79687
- chain: bondChain, isSoldOut: bondSoldOut }), width: "205px", placement: "bottomRight", transformTip: "translate(7%, -2%)", children: jsx$2(Flex, { className: "more-icon", sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] })] }, `${bondAddress}-${bondChain}`));
79909
+ toolTip: remainingTokensString }) }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (_b = (_a = payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.address) === null || _a === void 0 ? void 0 : _a[bondChain]) !== null && _b !== void 0 ? _b : '', earnTokenSymbol: (_c = payoutToken === null || payoutToken === void 0 ? void 0 : payoutToken.symbol) !== null && _c !== void 0 ? _c : '', bondContract: bondAddress !== null && bondAddress !== void 0 ? bondAddress : '', projectLink: projectURL, twitter: twitterURL, audit: auditURL, chain: bondChain, isSoldOut: bondSoldOut }), width: "205px", placement: "bottomRight", transformTip: "translate(7%, -2%)", children: jsx$2(Flex, { className: "more-icon", sx: { opacity: 0.8 }, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] })] }, `${bondAddress}-${bondChain}`));
79688
79910
  };
79689
79911
 
79690
79912
  const HotBondCard = ({ bond }) => {
@@ -79837,7 +80059,7 @@ const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
79837
80059
  var _a, _b, _c, _d, _e;
79838
80060
  const bondAddress = (_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) !== null && _a !== void 0 ? _a : (_b = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId];
79839
80061
  const remainingTokensString = getRemainingTokensString(bond);
79840
- return (jsx$2(BondRow, { bondAddress: (_c = bond.billAddress) !== null && _c !== void 0 ? _c : (_d = bond.contractAddress) === null || _d === void 0 ? void 0 : _d[bond.chainId], bondChain: bond.chainId, payoutToken: bond.earnToken, tag: (_e = bond.tags) === null || _e === void 0 ? void 0 : _e[0], bondSoldOut: isBondSoldOut(bond), trueBondPrices: bond === null || bond === void 0 ? void 0 : bond.trueBondPrices, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString }, `${bondAddress}-${bond.chainId}-${index}`));
80062
+ return (jsx$2(BondRow, { bondAddress: (_c = bond.billAddress) !== null && _c !== void 0 ? _c : (_d = bond.contractAddress) === null || _d === void 0 ? void 0 : _d[bond.chainId], bondChain: bond.chainId, payoutToken: bond.earnToken, tag: (_e = bond.tags) === null || _e === void 0 ? void 0 : _e[0], bondSoldOut: isBondSoldOut(bond), trueBondPrices: bond === null || bond === void 0 ? void 0 : bond.trueBondPrices, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit }, `${bondAddress}-${bond.chainId}-${index}`));
79841
80063
  }), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key))] }) }, key));
79842
80064
  };
79843
80065
 
@@ -79990,7 +80212,8 @@ const PreTGERows = ({ showSoldout }) => {
79990
80212
  const tokensRemainingUSD = tokensRemaining * bond.earnTokenPrice;
79991
80213
  const percentageAvailable = 100 - Math.floor((totalPrincipalBilled * 100) / raiseGoal);
79992
80214
  const earnToken = (_g = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _g === void 0 ? void 0 : _g.symbol;
79993
- return (jsx$2(BondRow, { bondAddress: bond.contractAddress, bondChain: bond.chainId, payoutToken: bond.earnToken, tag: (_h = bond.tags) === null || _h === void 0 ? void 0 : _h[0], bondSoldOut: bond.finalized || bond.finishTime < Date.now() / 1000, bonus: `${((bond.tgePrice / bond.initPrice) * 100 - 100).toFixed(0)}%`, percentageAvailable: percentageAvailable, remainingTokensString: `${formatNumberSI(tokensRemaining, 0)} ${earnToken} ($${formatNumberSI(tokensRemainingUSD, 2)})`, vestingTermString: `${getTimePeriods(parseInt(bond.vestingTerm)).months} Mo` }, `${bond.contractAddress}-${i}`));
80215
+ const isFinished = bond.finalized || bond.finishTime < Date.now() / 1000 || bond.soldOut;
80216
+ return (jsx$2(BondRow, { bondAddress: bond.contractAddress, bondChain: bond.chainId, payoutToken: bond.earnToken, tag: (_h = bond.tags) === null || _h === void 0 ? void 0 : _h[0], bondSoldOut: isFinished, bonus: isFinished ? '' : `${((bond.tgePrice / bond.initPrice) * 100 - 100).toFixed(0)}%`, percentageAvailable: isFinished ? 100 : percentageAvailable, remainingTokensString: `${formatNumberSI(tokensRemaining, 0)} ${earnToken} ($${formatNumberSI(tokensRemainingUSD, 2)})`, vestingTermString: `${getTimePeriods(parseInt(bond.vestingTerm)).months} Mo`, projectURL: bond.projectLink, twitterURL: bond.twitter, auditURL: bond.audit }, `${bond.contractAddress}-${i}`));
79994
80217
  })] }));
79995
80218
  };
79996
80219
 
@@ -1,6 +1,7 @@
1
+ import { BigNumber } from 'bignumber.js';
1
2
  import { UserBill } from '../types/yourbonds';
2
3
  import { BondsData } from '../types/bonds';
3
- import { BillsConfig } from '@ape.swap/apeswap-lists';
4
+ import { BillsConfig, LaunchBondTiers } from '@ape.swap/apeswap-lists';
4
5
  export declare const claimable: (userBill: UserBill) => number;
5
6
  export declare const claimableUSD: (userBill: UserBill) => number;
6
7
  export declare const earnTokenPrice: (bond: BondsData) => string;
@@ -19,6 +20,7 @@ export declare const getPendingVestingString: (bond?: UserBill) => string;
19
20
  export declare const getVestingTermsString: (bond?: BondsData | BillsConfig) => string;
20
21
  export declare const getVestingTermsTooltipString: (bond?: BondsData | BillsConfig) => string;
21
22
  export declare const discountEarnTokenPrice: (bond: BondsData, useTiers?: boolean) => string;
23
+ export declare const discountEarnTokenPriceForUser: (bond: BondsData, useTiers?: boolean, userTier?: LaunchBondTiers) => string;
22
24
  export declare const maxBuy: (bond: BondsData) => BigNumber;
23
25
  export declare function formatNumber(input: string): string;
24
26
  export declare function formatUSDNumber(input: string): string;
@@ -14,6 +14,9 @@ interface BondRowProps {
14
14
  vestingCliffString?: string;
15
15
  percentageAvailable: number;
16
16
  remainingTokensString: string;
17
+ projectURL?: string;
18
+ twitterURL?: string;
19
+ auditURL?: string;
17
20
  }
18
21
  declare const BondRow: React.FC<BondRowProps>;
19
22
  export default BondRow;
@@ -1,14 +1,12 @@
1
1
  import React from 'react';
2
2
  import { BondsData } from '../../../../types/bonds';
3
- declare const NewRateModal: ({ bond, zapTrueBondPrice, depositAmount, youSpendString, isZap, fetchingZapQuote, zapError, handleZap, onDismiss, }: {
3
+ declare const NewRateModal: ({ bond, zapTrueBondPrice, depositAmount, youSpendString, fetchingZapQuote, zapError, onDismiss, }: {
4
4
  bond?: BondsData;
5
5
  zapTrueBondPrice?: string;
6
6
  depositAmount: string;
7
7
  youSpendString?: string;
8
- isZap?: boolean;
9
8
  fetchingZapQuote?: boolean;
10
9
  zapError?: boolean;
11
- handleZap: () => void;
12
10
  onDismiss?: () => void;
13
11
  }) => React.JSX.Element;
14
12
  export default NewRateModal;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { ApprovalState } from '../../state/allowance/useAllowance';
3
+ import { BondsData } from '../../types/bonds';
4
+ import { Token } from '@ape.swap/apeswap-lists';
5
+ declare const TransactionModal: ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, bondData, inputToken, inputValue, depositAmount, buyTxHash, rateChanged, }: {
6
+ onDismiss?: () => void;
7
+ txChain?: number;
8
+ approvalState?: ApprovalState;
9
+ approveCallback?: () => Promise<void>;
10
+ loadingTx?: boolean;
11
+ txCallback?: () => void;
12
+ bondData: BondsData;
13
+ inputToken: Token | "NATIVE" | undefined;
14
+ inputValue: string;
15
+ depositAmount: string;
16
+ buyTxHash?: string;
17
+ rateChanged: boolean;
18
+ }) => React.JSX.Element;
19
+ export default TransactionModal;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "3.0.70",
6
+ "version": "3.0.72",
7
7
  "module": "dist/main.js",
8
8
  "type": "module",
9
9
  "types": "dist/main.d.ts",