@ape.swap/bonds-sdk 3.0.71 → 3.0.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/LoadingSpinner/index.d.ts +6 -0
- package/dist/components/StepBubble/index.d.ts +9 -0
- package/dist/components/uikit-sdk/Svg/Icons/Tick.d.ts +4 -0
- package/dist/components/uikit-sdk/Svg/Icons/index.d.ts +1 -0
- package/dist/components/uikit-sdk/Svg/types.d.ts +2 -1
- package/dist/main.js +333 -53
- package/dist/utils/displayHelpers.d.ts +3 -1
- package/dist/views/Bonds/components/BondRows/BondRow.d.ts +3 -0
- package/dist/views/BuyBond/components/NewRateModal/NewRateModal.d.ts +1 -3
- package/dist/views/TransactionModal/TransactionModal.d.ts +19 -0
- package/package.json +1 -1
|
@@ -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;
|
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.
|
|
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)
|
|
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
|
-
//
|
|
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(useTiers ? TIERS_WEIGHT[userTier] : '0', 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
|
|
|
@@ -68912,6 +68937,58 @@ const zapInputTokens = {
|
|
|
68912
68937
|
active: true,
|
|
68913
68938
|
},
|
|
68914
68939
|
],
|
|
68940
|
+
[types.ChainId.SONIC]: [
|
|
68941
|
+
{
|
|
68942
|
+
symbol: 'wS',
|
|
68943
|
+
address: {
|
|
68944
|
+
[types.ChainId.SONIC]: '0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38',
|
|
68945
|
+
},
|
|
68946
|
+
decimals: {
|
|
68947
|
+
[types.ChainId.SONIC]: 18,
|
|
68948
|
+
},
|
|
68949
|
+
active: true,
|
|
68950
|
+
},
|
|
68951
|
+
{
|
|
68952
|
+
symbol: 'USDC',
|
|
68953
|
+
address: {
|
|
68954
|
+
[types.ChainId.SONIC]: '0x29219dd400f2Bf60E5a23d13Be72B486D4038894',
|
|
68955
|
+
},
|
|
68956
|
+
decimals: {
|
|
68957
|
+
[types.ChainId.SONIC]: 6,
|
|
68958
|
+
},
|
|
68959
|
+
active: true,
|
|
68960
|
+
},
|
|
68961
|
+
{
|
|
68962
|
+
symbol: 'USDT',
|
|
68963
|
+
address: {
|
|
68964
|
+
[types.ChainId.SONIC]: '0x6047828dc181963ba44974801FF68e538dA5eaF9',
|
|
68965
|
+
},
|
|
68966
|
+
decimals: {
|
|
68967
|
+
[types.ChainId.SONIC]: 6,
|
|
68968
|
+
},
|
|
68969
|
+
active: true,
|
|
68970
|
+
},
|
|
68971
|
+
{
|
|
68972
|
+
symbol: 'BTC',
|
|
68973
|
+
address: {
|
|
68974
|
+
[types.ChainId.SONIC]: '0x0555E30da8f98308EdB960aa94C0Db47230d2B9c',
|
|
68975
|
+
},
|
|
68976
|
+
decimals: {
|
|
68977
|
+
[types.ChainId.SONIC]: 8,
|
|
68978
|
+
},
|
|
68979
|
+
active: true,
|
|
68980
|
+
},
|
|
68981
|
+
{
|
|
68982
|
+
symbol: 'wETH',
|
|
68983
|
+
address: {
|
|
68984
|
+
[types.ChainId.SONIC]: '0x50c42dEAcD8Fc9773493ED674b675bE577f2634b',
|
|
68985
|
+
},
|
|
68986
|
+
decimals: {
|
|
68987
|
+
[types.ChainId.SONIC]: 18,
|
|
68988
|
+
},
|
|
68989
|
+
active: true,
|
|
68990
|
+
},
|
|
68991
|
+
],
|
|
68915
68992
|
};
|
|
68916
68993
|
|
|
68917
68994
|
var PRICE_GETTER_V3_ABI = [
|
|
@@ -77912,6 +77989,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
77912
77989
|
if (txHash && isConfirmed) {
|
|
77913
77990
|
setTxHash('');
|
|
77914
77991
|
refetch();
|
|
77992
|
+
console.log('refetch allowance');
|
|
77915
77993
|
}
|
|
77916
77994
|
}, [txHash, confirmingTxOnChain]);
|
|
77917
77995
|
const handleApprove = useCallback(() => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
@@ -77949,6 +78027,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
77949
78027
|
chainId,
|
|
77950
78028
|
account,
|
|
77951
78029
|
});
|
|
78030
|
+
throw error;
|
|
77952
78031
|
}
|
|
77953
78032
|
}), [amount, currency, chainId]);
|
|
77954
78033
|
let approvalState = ApprovalState.NOT_APPROVED;
|
|
@@ -77964,7 +78043,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
77964
78043
|
return [approvalState !== null && approvalState !== void 0 ? approvalState : ApprovalState.NOT_APPROVED, handleApprove];
|
|
77965
78044
|
};
|
|
77966
78045
|
|
|
77967
|
-
const version$1 = '2.
|
|
78046
|
+
const version$1 = '2.23.6';
|
|
77968
78047
|
|
|
77969
78048
|
let errorConfig = {
|
|
77970
78049
|
getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
|
|
@@ -78796,7 +78875,7 @@ const ProjectDescription = ({ description, isProjectView }) => {
|
|
|
78796
78875
|
}, 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
78876
|
};
|
|
78798
78877
|
|
|
78799
|
-
const NewRateModal = ({ bond, zapTrueBondPrice, depositAmount, youSpendString,
|
|
78878
|
+
const NewRateModal = ({ bond, zapTrueBondPrice, depositAmount, youSpendString, fetchingZapQuote, zapError, onDismiss, }) => {
|
|
78800
78879
|
var _a, _b, _c, _d, _e;
|
|
78801
78880
|
const { data: userPoints } = useTierPoints();
|
|
78802
78881
|
const trueBondPrice = findHighestTrueBondPrice(userPoints, bond);
|
|
@@ -78814,17 +78893,14 @@ const NewRateModal = ({ bond, zapTrueBondPrice, depositAmount, youSpendString, i
|
|
|
78814
78893
|
borderRadius: '8px',
|
|
78815
78894
|
width: '100%',
|
|
78816
78895
|
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,
|
|
78896
|
+
}, 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
78897
|
width: '100%',
|
|
78819
78898
|
fontSize: '14px',
|
|
78820
78899
|
fontWeight: 500,
|
|
78821
78900
|
color: 'textDisabledButton',
|
|
78822
78901
|
justifyContent: 'flex-start',
|
|
78823
78902
|
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' })] }) }));
|
|
78903
|
+
}, 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
78904
|
};
|
|
78829
78905
|
|
|
78830
78906
|
const NoBonusModal = ({ onAcknowledge, showcaseTokenName }) => {
|
|
@@ -78920,16 +78996,226 @@ const GetUpToComponent = ({ bond, depositAmount }) => {
|
|
|
78920
78996
|
} }), 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
78997
|
};
|
|
78922
78998
|
|
|
78999
|
+
const StepBubble = ({ number, title, currentStep, hideBar, loading, }) => {
|
|
79000
|
+
const stepCompleted = currentStep > number;
|
|
79001
|
+
const isNextStep = number > currentStep;
|
|
79002
|
+
return (jsxs(Flex, { sx: { width: !hideBar && '100%', minWidth: hideBar && '40px', alignItems: 'center' }, children: [jsxs(Flex, { sx: {
|
|
79003
|
+
minWidth: '40px',
|
|
79004
|
+
height: '40px',
|
|
79005
|
+
backgroundColor: isNextStep ? 'white2' : 'primaryButton',
|
|
79006
|
+
border: isNextStep ? '1px solid var(--theme-ui-colors-white4)' : '1px solid primaryButton',
|
|
79007
|
+
borderRadius: '40px',
|
|
79008
|
+
justifyContent: 'center',
|
|
79009
|
+
alignItems: 'center',
|
|
79010
|
+
fontWeight: 500,
|
|
79011
|
+
zIndex: 1,
|
|
79012
|
+
position: 'relative',
|
|
79013
|
+
}, children: [loading ? (jsx$2(Spinner, { size: 15 })) : stepCompleted ? (jsx$2(AnimatePresence, { children: jsx$2(motion.div, { initial: { rotate: 0 }, animate: {
|
|
79014
|
+
rotate: 360,
|
|
79015
|
+
scale: [1, 2, 1],
|
|
79016
|
+
transition: {
|
|
79017
|
+
rotate: { duration: 0.5, ease: 'linear' },
|
|
79018
|
+
scale: { duration: 1, ease: 'easeInOut', delay: 0.5 },
|
|
79019
|
+
},
|
|
79020
|
+
}, children: jsx$2(Svg, { icon: "TICK", width: '15px' }) }) })) : (number), jsx$2(Flex, { sx: {
|
|
79021
|
+
width: '100px',
|
|
79022
|
+
textAlign: 'center',
|
|
79023
|
+
justifyContent: 'center',
|
|
79024
|
+
fontSize: '12px',
|
|
79025
|
+
fontWeight: 500,
|
|
79026
|
+
position: 'absolute',
|
|
79027
|
+
top: '45px',
|
|
79028
|
+
left: '50%',
|
|
79029
|
+
transform: 'translate(-50%, 0)',
|
|
79030
|
+
color: 'textDisabledButton',
|
|
79031
|
+
}, children: title })] }), !hideBar && (jsx$2(Flex, { sx: {
|
|
79032
|
+
width: `100%`,
|
|
79033
|
+
height: '2px',
|
|
79034
|
+
top: '50%',
|
|
79035
|
+
left: `40px`,
|
|
79036
|
+
backgroundColor: stepCompleted ? 'primaryButton' : 'white4',
|
|
79037
|
+
zIndex: 0,
|
|
79038
|
+
} }))] }));
|
|
79039
|
+
};
|
|
79040
|
+
|
|
79041
|
+
const LoadingSpinner = ({ isLoading, size }) => {
|
|
79042
|
+
const stylesLoading = {
|
|
79043
|
+
width: `${size}px`,
|
|
79044
|
+
height: `${size}px`,
|
|
79045
|
+
border: `${size / 8}px solid var(--theme-ui-colors-white5)`,
|
|
79046
|
+
borderTopColor: 'primaryButton',
|
|
79047
|
+
borderRadius: '50%',
|
|
79048
|
+
display: 'inline-block',
|
|
79049
|
+
boxSizing: 'border-box',
|
|
79050
|
+
animation: 'rotation 1s linear infinite',
|
|
79051
|
+
transform: 'rotate(40deg)',
|
|
79052
|
+
'@keyframes rotation': {
|
|
79053
|
+
'0%': {
|
|
79054
|
+
transform: 'rotate(40deg)',
|
|
79055
|
+
},
|
|
79056
|
+
'100%': {
|
|
79057
|
+
transform: 'rotate(400deg)',
|
|
79058
|
+
},
|
|
79059
|
+
},
|
|
79060
|
+
};
|
|
79061
|
+
const styles = {
|
|
79062
|
+
width: `${size}px`,
|
|
79063
|
+
height: `${size}px`,
|
|
79064
|
+
border: `${size / 8}px solid var(--theme-ui-colors-white5)`,
|
|
79065
|
+
borderTopColor: 'white5',
|
|
79066
|
+
borderRadius: '50%',
|
|
79067
|
+
display: 'inline-block',
|
|
79068
|
+
boxSizing: 'border-box',
|
|
79069
|
+
};
|
|
79070
|
+
return jsx$2(Flex, { sx: isLoading ? stylesLoading : styles });
|
|
79071
|
+
};
|
|
79072
|
+
|
|
79073
|
+
const stepDelay = 1000;
|
|
79074
|
+
const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback, loadingTx, txCallback, bondData, inputToken, inputValue, depositAmount, buyTxHash, rateChanged, }) => {
|
|
79075
|
+
var _a, _b, _c, _d, _e;
|
|
79076
|
+
// Hooks
|
|
79077
|
+
const { chain } = useAccount();
|
|
79078
|
+
const { data: userPoints } = useTierPoints();
|
|
79079
|
+
const inputTokenPrice = useCurrencyPrice(inputToken !== null && inputToken !== void 0 ? inputToken : null, txChain);
|
|
79080
|
+
const { switchChainAsync } = useSwitchChain();
|
|
79081
|
+
const SDKConfig = useSDKConfig();
|
|
79082
|
+
// Flow
|
|
79083
|
+
const initialChain = useMemo(() => chain === null || chain === void 0 ? void 0 : chain.id, []);
|
|
79084
|
+
const showSwitchChainFlow = txChain !== initialChain;
|
|
79085
|
+
// const showSwitchChainFlow = true
|
|
79086
|
+
const [hasToSwitchChain, setHasToSwitchChain] = useState(showSwitchChainFlow);
|
|
79087
|
+
const [hasToApprove, setHasToApprove] = useState(true);
|
|
79088
|
+
// Loading state
|
|
79089
|
+
const [loadingSwitchChain, setLoadingSwitchChain] = useState(false);
|
|
79090
|
+
const [approveLoading, setApproveLoading] = useState(false);
|
|
79091
|
+
const estimatedOutputAmount = getPayoutAmount(bondData, depositAmount, userPoints !== null && userPoints !== void 0 ? userPoints : '0');
|
|
79092
|
+
const estimatedOutputUSD = estimatedOutputAmount * parseFloat((_a = bondData === null || bondData === void 0 ? void 0 : bondData.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0');
|
|
79093
|
+
const handleSwitchChain = () => {
|
|
79094
|
+
setLoadingSwitchChain(true);
|
|
79095
|
+
switchChainAsync({ chainId: txChain })
|
|
79096
|
+
.then(() => {
|
|
79097
|
+
setHasToSwitchChain(false);
|
|
79098
|
+
setApproveLoading(true);
|
|
79099
|
+
})
|
|
79100
|
+
.finally(() => {
|
|
79101
|
+
setLoadingSwitchChain(false);
|
|
79102
|
+
});
|
|
79103
|
+
};
|
|
79104
|
+
const handleApprove = () => {
|
|
79105
|
+
setApproveLoading(true);
|
|
79106
|
+
approveCallback().catch(() => {
|
|
79107
|
+
setApproveLoading(false);
|
|
79108
|
+
});
|
|
79109
|
+
};
|
|
79110
|
+
// Switch Chain Step #1
|
|
79111
|
+
const hasTriggeredSwitch = useRef(false);
|
|
79112
|
+
useEffect(() => {
|
|
79113
|
+
if (hasToSwitchChain && !hasTriggeredSwitch.current) {
|
|
79114
|
+
setLoadingSwitchChain(true);
|
|
79115
|
+
const delay = setTimeout(() => {
|
|
79116
|
+
hasTriggeredSwitch.current = true;
|
|
79117
|
+
handleSwitchChain();
|
|
79118
|
+
}, stepDelay);
|
|
79119
|
+
return () => clearTimeout(delay);
|
|
79120
|
+
}
|
|
79121
|
+
}, [hasToSwitchChain]);
|
|
79122
|
+
// Trigger approve Step #2
|
|
79123
|
+
const hasTriggeredApproval = useRef(false);
|
|
79124
|
+
useEffect(() => {
|
|
79125
|
+
if (!hasToSwitchChain || !showSwitchChainFlow) {
|
|
79126
|
+
if (inputToken === 'NATIVE')
|
|
79127
|
+
setApproveLoading(true);
|
|
79128
|
+
if (approvalState === ApprovalState.APPROVED) {
|
|
79129
|
+
setApproveLoading(true);
|
|
79130
|
+
const delay = setTimeout(() => {
|
|
79131
|
+
setApproveLoading(false);
|
|
79132
|
+
setHasToApprove(false);
|
|
79133
|
+
}, stepDelay);
|
|
79134
|
+
return () => clearTimeout(delay);
|
|
79135
|
+
}
|
|
79136
|
+
else if (!hasTriggeredApproval.current && approvalState !== ApprovalState.PENDING) {
|
|
79137
|
+
setApproveLoading(true);
|
|
79138
|
+
const delay = setTimeout(() => {
|
|
79139
|
+
hasTriggeredApproval.current = true;
|
|
79140
|
+
handleApprove();
|
|
79141
|
+
}, stepDelay);
|
|
79142
|
+
return () => clearTimeout(delay);
|
|
79143
|
+
}
|
|
79144
|
+
else {
|
|
79145
|
+
console.log('bingo!');
|
|
79146
|
+
setApproveLoading(false);
|
|
79147
|
+
}
|
|
79148
|
+
}
|
|
79149
|
+
}, [hasToSwitchChain, approvalState]);
|
|
79150
|
+
// Execute main tx Step #3
|
|
79151
|
+
const hasTriggeredTx = useRef(false);
|
|
79152
|
+
useEffect(() => {
|
|
79153
|
+
if (!hasToSwitchChain && !hasToApprove && !hasTriggeredTx.current) {
|
|
79154
|
+
hasTriggeredTx.current = true;
|
|
79155
|
+
if (rateChanged) {
|
|
79156
|
+
onDismiss();
|
|
79157
|
+
}
|
|
79158
|
+
else {
|
|
79159
|
+
console.log('trigger tx');
|
|
79160
|
+
setApproveLoading(false);
|
|
79161
|
+
txCallback();
|
|
79162
|
+
}
|
|
79163
|
+
}
|
|
79164
|
+
}, [hasToSwitchChain, hasToApprove, txCallback]);
|
|
79165
|
+
// Close modal if a hash is found. Final Step
|
|
79166
|
+
const { data: txReceipt, isSuccess, isLoading: verifyingTx } = useMonitorTxHash(buyTxHash, txChain);
|
|
79167
|
+
useEffect(() => {
|
|
79168
|
+
if (buyTxHash && txReceipt) {
|
|
79169
|
+
if (isSuccess) {
|
|
79170
|
+
onDismiss();
|
|
79171
|
+
}
|
|
79172
|
+
}
|
|
79173
|
+
}, [buyTxHash, txReceipt, isSuccess]);
|
|
79174
|
+
const currentStep = showSwitchChainFlow ? (hasToSwitchChain ? 1 : hasToApprove ? 2 : 3) : hasToApprove ? 1 : 2;
|
|
79175
|
+
const splited = typeof inputToken !== 'string' ? (_b = inputToken === null || inputToken === void 0 ? void 0 : inputToken.symbol) === null || _b === void 0 ? void 0 : _b.split('-') : undefined;
|
|
79176
|
+
const trueBondPrice = findHighestTrueBondPrice((_c = TIERS_WEIGHT[getUserTier(userPoints)]) !== null && _c !== void 0 ? _c : '0', bondData);
|
|
79177
|
+
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 ||
|
|
79178
|
+
approveLoading ||
|
|
79179
|
+
loadingTx ||
|
|
79180
|
+
verifyingTx ||
|
|
79181
|
+
approvalState === ApprovalState.PENDING, size: 100 }) }), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', mt: '10px' }, children: hasToSwitchChain
|
|
79182
|
+
? loadingSwitchChain
|
|
79183
|
+
? 'Switching Chain...'
|
|
79184
|
+
: 'Switch Chain'
|
|
79185
|
+
: hasToApprove
|
|
79186
|
+
? approveLoading || approvalState === ApprovalState.PENDING
|
|
79187
|
+
? 'Approving...'
|
|
79188
|
+
: 'Approve Contract'
|
|
79189
|
+
: loadingTx || verifyingTx
|
|
79190
|
+
? 'Buying...'
|
|
79191
|
+
: 'Buy' }), jsxs(Flex, { sx: { width: '100%', flexDirection: 'column', mt: '20px' }, children: [jsxs(Flex, { sx: {
|
|
79192
|
+
width: '100%',
|
|
79193
|
+
background: 'white3',
|
|
79194
|
+
p: '5px',
|
|
79195
|
+
borderRadius: 'normal',
|
|
79196
|
+
color: 'textDisabledButton',
|
|
79197
|
+
justifyContent: 'center',
|
|
79198
|
+
}, 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, SDKConfig.useTiers, getUserTier(userPoints))] })] }), jsxs(Flex, { sx: {
|
|
79199
|
+
p: '5px',
|
|
79200
|
+
borderRadius: 'normal',
|
|
79201
|
+
border: '1px solid var(--theme-ui-colors-success)',
|
|
79202
|
+
background: 'rgba(56, 166, 17, 0.13)',
|
|
79203
|
+
color: 'success',
|
|
79204
|
+
lineHeight: '18px',
|
|
79205
|
+
}, children: [(_d = trueBondPrice === null || trueBondPrice === void 0 ? void 0 : trueBondPrice.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
|
|
79206
|
+
? `$${formatUSDNumber(((inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) * parseFloat(inputValue)).toFixed(2))}`
|
|
79207
|
+
: '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" })) })] })] }));
|
|
79208
|
+
};
|
|
79209
|
+
|
|
78923
79210
|
const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isProjectView }) => {
|
|
78924
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
79211
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
78925
79212
|
const SDKConfig = useSDKConfig();
|
|
78926
79213
|
// Hooks
|
|
78927
79214
|
const userChainId = useChainId();
|
|
78928
79215
|
const { address: account } = useAccount();
|
|
78929
|
-
const { switchChain } = useSwitchChain();
|
|
78930
79216
|
const { writeContractAsync } = useWriteContract();
|
|
78931
79217
|
const { sendTransactionAsync } = useSendTransaction();
|
|
78932
|
-
const { data: bonds } = useBondsData();
|
|
79218
|
+
const { data: bonds, refetch: refetchBondState } = useBondsData();
|
|
78933
79219
|
const sendReferenceId = useSendReferenceId();
|
|
78934
79220
|
const { data: userPoints } = useTierPoints();
|
|
78935
79221
|
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 +79253,13 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78967
79253
|
inputToken.address[bondChain].toLowerCase());
|
|
78968
79254
|
const inputCurrencyBalance = enrichedTokenData === null || enrichedTokenData === void 0 ? void 0 : enrichedTokenData.balance;
|
|
78969
79255
|
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');
|
|
79256
|
+
const rateChanged = parseFloat(zapTrueBondPrice !== null && zapTrueBondPrice !== void 0 ? zapTrueBondPrice : '0') > parseFloat(trueBondPrice !== null && trueBondPrice !== void 0 ? trueBondPrice : '0') * 1.01 && isZap;
|
|
78971
79257
|
// Estimations
|
|
78972
79258
|
const depositAmount = isZap ? zapDepositAmount : inputValue;
|
|
78973
79259
|
const youSpendString = `${formatNumber$1(inputValue)} ${getSymbol(inputToken, bondData === null || bondData === void 0 ? void 0 : bondData.chainId)} =
|
|
78974
79260
|
$${formatUSDNumber((parseFloat(inputValue) * (inputTokenPrice !== null && inputTokenPrice !== void 0 ? inputTokenPrice : 0)).toString())}`;
|
|
78975
79261
|
// Validations
|
|
78976
|
-
const isGoldRush = (bondData === null || bondData === void 0 ? void 0 : bondData.billArt.collection) === types.BillArtCollection.GoldenTicket_Collection1;
|
|
79262
|
+
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
79263
|
const zapEnabled = supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId);
|
|
78978
79264
|
const exceedsMaxBuy = maxBuy(bondData).lt(getPayoutAmount(bondData, depositAmount, userPoints !== null && userPoints !== void 0 ? userPoints : '0'));
|
|
78979
79265
|
const exceedsBalance = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0').lt(inputValue);
|
|
@@ -79000,9 +79286,9 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79000
79286
|
});
|
|
79001
79287
|
};
|
|
79002
79288
|
// Approve & Purchase Functions
|
|
79003
|
-
const [approvalState, approveCallback] = useApproval(inputValue, inputToken !== null && inputToken !== void 0 ? inputToken : null, (
|
|
79004
|
-
const handleApprove = () => {
|
|
79005
|
-
approveCallback().then(() => {
|
|
79289
|
+
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);
|
|
79290
|
+
const handleApprove = useCallback(() => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
79291
|
+
return approveCallback().then(() => {
|
|
79006
79292
|
track({
|
|
79007
79293
|
event: 'approveBondClick',
|
|
79008
79294
|
chain: userChainId,
|
|
@@ -79012,8 +79298,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79012
79298
|
},
|
|
79013
79299
|
});
|
|
79014
79300
|
});
|
|
79015
|
-
};
|
|
79016
|
-
// This is the regular buy bond interaction (a.k.a. write method called "deposit" in smartcontract)
|
|
79301
|
+
}), [userChainId, approveCallback]);
|
|
79017
79302
|
const handleBuyCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
79018
79303
|
var _a, _b, _c, _d, _e, _f;
|
|
79019
79304
|
const billAddress = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress;
|
|
@@ -79072,7 +79357,6 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79072
79357
|
addToastError(error.shortMessage);
|
|
79073
79358
|
}
|
|
79074
79359
|
});
|
|
79075
|
-
// ignore this for SOL migration
|
|
79076
79360
|
const handleZapCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
79077
79361
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
79078
79362
|
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 +79424,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79140
79424
|
const handleBothPurchases = () => {
|
|
79141
79425
|
setLoadingTx(true);
|
|
79142
79426
|
if (isZap) {
|
|
79143
|
-
|
|
79144
|
-
if (rateChanged) {
|
|
79145
|
-
openNewRateModal();
|
|
79146
|
-
}
|
|
79147
|
-
else {
|
|
79148
|
-
handleZapCallback().finally(() => setLoadingTx(false));
|
|
79149
|
-
}
|
|
79427
|
+
handleZapCallback().finally(() => setLoadingTx(false));
|
|
79150
79428
|
}
|
|
79151
79429
|
else {
|
|
79152
79430
|
handleBuyCallback().finally(() => setLoadingTx(false));
|
|
@@ -79159,7 +79437,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79159
79437
|
openNoBonusModal();
|
|
79160
79438
|
}
|
|
79161
79439
|
else {
|
|
79162
|
-
|
|
79440
|
+
openTxModal();
|
|
79163
79441
|
}
|
|
79164
79442
|
};
|
|
79165
79443
|
const openExternal = () => {
|
|
@@ -79172,9 +79450,10 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79172
79450
|
}
|
|
79173
79451
|
};
|
|
79174
79452
|
// Modals
|
|
79453
|
+
const [openNewRateModal] = useModal(jsx$2(NewRateModal, { bond: bondData, zapTrueBondPrice: zapTrueBondPrice, depositAmount: depositAmount, youSpendString: youSpendString, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), true, false, 'newRateModal');
|
|
79454
|
+
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
79455
|
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 [
|
|
79177
|
-
const [openNoBonusModal] = useModal(jsx$2(NoBonusModal, { onAcknowledge: handleBothPurchases, showcaseTokenName: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), true, true, 'NoBonusModal');
|
|
79456
|
+
const [openNoBonusModal] = useModal(jsx$2(NoBonusModal, { onAcknowledge: openTxModal, showcaseTokenName: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), true, true, 'NoBonusModal');
|
|
79178
79457
|
// Effects
|
|
79179
79458
|
const [hasChecked, setHasChecked] = useState(false);
|
|
79180
79459
|
const [hasCheckedTrack, setHasCheckedTrack] = useState(false);
|
|
@@ -79203,6 +79482,14 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79203
79482
|
});
|
|
79204
79483
|
}
|
|
79205
79484
|
}, [inputCurrencyBalance, sortedZapList, bondData]);
|
|
79485
|
+
// If rateChanged meaning the zap quote has a >1% difference from the true bond price, we let the user know and we update state
|
|
79486
|
+
useEffect(() => {
|
|
79487
|
+
if (rateChanged) {
|
|
79488
|
+
console.log('rate changed, refetch state and let user know');
|
|
79489
|
+
openNewRateModal();
|
|
79490
|
+
refetchBondState();
|
|
79491
|
+
}
|
|
79492
|
+
}, [rateChanged]);
|
|
79206
79493
|
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
79494
|
width: '100%',
|
|
79208
79495
|
background: '#DE62F366',
|
|
@@ -79216,10 +79503,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79216
79503
|
? handleOpenZapModal()
|
|
79217
79504
|
: openExternal(), variant: "secondary", fullWidth: true, children: bondData.billVersion === types.BillVersion.V4 && SDKConfig.useTiers
|
|
79218
79505
|
? `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" })) :
|
|
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 ||
|
|
79506
|
+
: `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
79507
|
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
79224
79508
|
!account ||
|
|
79225
79509
|
!inputValue ||
|
|
@@ -79227,17 +79511,16 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
79227
79511
|
fetchingZapQuote ||
|
|
79228
79512
|
zapError ||
|
|
79229
79513
|
exceedsMaxBuy ||
|
|
79230
|
-
exceedsBalance
|
|
79514
|
+
exceedsBalance ||
|
|
79515
|
+
(isZap && !zapData), onClick: handleOpenModal, children: exceedsMaxBuy
|
|
79231
79516
|
? 'Exceeds Max Buy'
|
|
79232
79517
|
: exceedsBalance
|
|
79233
79518
|
? 'Exceeds balance'
|
|
79234
79519
|
: zapError
|
|
79235
79520
|
? 'something went wrong'
|
|
79236
|
-
:
|
|
79237
|
-
|
|
79238
|
-
|
|
79239
|
-
!inputValue ||
|
|
79240
|
-
parseFloat(inputValue) === 0, onClick: handleApprove, children: "enable" })) })] })] })] })) : (jsx$2(Fragment$1, {}));
|
|
79521
|
+
: !inputValue || parseFloat(inputValue) === 0
|
|
79522
|
+
? 'Insert amount'
|
|
79523
|
+
: `buy` })) })] })] })] })) : (jsx$2(Fragment$1, {}));
|
|
79241
79524
|
};
|
|
79242
79525
|
|
|
79243
79526
|
const BuyBondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond }) => {
|
|
@@ -79633,7 +79916,7 @@ const BonusContainer = ({ trueBondPrices, minTier, bonus, tooltipPosition = 'bot
|
|
|
79633
79916
|
return (jsx$2("div", { className: `discount-column`, children: jsx$2(BonusComponent, { trueBondPrices: trueBondPrices, minTier: minTier, bonus: bonus, tooltipPosition: isMobile ? tooltipPosition : 'bottomLeft' }) }));
|
|
79634
79917
|
};
|
|
79635
79918
|
|
|
79636
|
-
const BondRow = ({ bondAddress, bondChain, payoutToken, tag, bondSoldOut, trueBondPrices, minTier, bonus, vestingTermString, vestingCliffString, percentageAvailable, remainingTokensString, }) => {
|
|
79919
|
+
const BondRow = ({ bondAddress, bondChain, payoutToken, tag, bondSoldOut, trueBondPrices, minTier, bonus, vestingTermString, vestingCliffString, percentageAvailable, remainingTokensString, projectURL, twitterURL, auditURL, }) => {
|
|
79637
79920
|
var _a, _b, _c;
|
|
79638
79921
|
const locationPath = window.location.pathname.replace('/', '');
|
|
79639
79922
|
// Modal
|
|
@@ -79677,11 +79960,7 @@ const BondRow = ({ bondAddress, bondChain, payoutToken, tag, bondSoldOut, trueBo
|
|
|
79677
79960
|
// num: remainingTokensUsd(bond).toNumber(),
|
|
79678
79961
|
// isPrice: true,
|
|
79679
79962
|
// })})`}
|
|
79680
|
-
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 : '',
|
|
79681
|
-
// projectLink={bond?.projectLink}
|
|
79682
|
-
// twitter={bond?.twitter}
|
|
79683
|
-
// audit={bond?.audit}
|
|
79684
|
-
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}`));
|
|
79963
|
+
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}`));
|
|
79685
79964
|
};
|
|
79686
79965
|
|
|
79687
79966
|
const HotBondCard = ({ bond }) => {
|
|
@@ -79834,7 +80113,7 @@ const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
|
|
|
79834
80113
|
var _a, _b, _c, _d, _e;
|
|
79835
80114
|
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];
|
|
79836
80115
|
const remainingTokensString = getRemainingTokensString(bond);
|
|
79837
|
-
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}`));
|
|
80116
|
+
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}`));
|
|
79838
80117
|
}), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key))] }) }, key));
|
|
79839
80118
|
};
|
|
79840
80119
|
|
|
@@ -79987,7 +80266,8 @@ const PreTGERows = ({ showSoldout }) => {
|
|
|
79987
80266
|
const tokensRemainingUSD = tokensRemaining * bond.earnTokenPrice;
|
|
79988
80267
|
const percentageAvailable = 100 - Math.floor((totalPrincipalBilled * 100) / raiseGoal);
|
|
79989
80268
|
const earnToken = (_g = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _g === void 0 ? void 0 : _g.symbol;
|
|
79990
|
-
|
|
80269
|
+
const isFinished = bond.finalized || bond.finishTime < Date.now() / 1000 || bond.soldOut;
|
|
80270
|
+
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}`));
|
|
79991
80271
|
})] }));
|
|
79992
80272
|
};
|
|
79993
80273
|
|
|
@@ -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,
|
|
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;
|