@ape.swap/bonds-sdk 1.0.360 → 1.0.361
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.
|
@@ -59,13 +59,13 @@ import { useNavigate } from 'react-router-dom';
|
|
|
59
59
|
import { isNumber } from '../../utils/numbers';
|
|
60
60
|
import { TooltipBubble, Button, Svg, ListTag } from '../uikit-sdk';
|
|
61
61
|
import { TooltipText } from '../../enum/tooltips';
|
|
62
|
-
import { formatNumberSI } from '../../utils/formatNumber';
|
|
63
62
|
import { ethers } from 'ethers';
|
|
64
63
|
import { adjustDecimals } from "../../utils/convertToTokenValue";
|
|
65
64
|
import TokenImage from '../uikit-sdk/TokenImage';
|
|
66
65
|
import '../../scss/BondModal.scss';
|
|
67
66
|
import BOND_ABI from '../../config/abi/bond.json';
|
|
68
67
|
import ERC_20_ABI from '../../config/abi/bond.json';
|
|
68
|
+
import { formatUSDNumber, getPremiumColor, premium, youGet, youGetUSD, youSpend, youSpendUSD } from './helper';
|
|
69
69
|
var BondModal = function (_a) {
|
|
70
70
|
var isOpen = _a.isOpen, onClose = _a.onClose, bondAddress = _a.bondAddress;
|
|
71
71
|
if (!isOpen)
|
|
@@ -116,62 +116,6 @@ var BondModal = function (_a) {
|
|
|
116
116
|
setSelectedBond(bond);
|
|
117
117
|
navigate("/bondsingle/".concat(bond.billAddress));
|
|
118
118
|
};
|
|
119
|
-
//Note to Gordon: Can we put all this in a helper file or something so the code in here is less?
|
|
120
|
-
/////////////////////
|
|
121
|
-
function formatNumber(input) {
|
|
122
|
-
var number = new BigNumber(input);
|
|
123
|
-
if (number.isNaN())
|
|
124
|
-
return '0';
|
|
125
|
-
return number.gt(1000000)
|
|
126
|
-
? formatNumberSI(number.toNumber())
|
|
127
|
-
: number.gt(1000)
|
|
128
|
-
? number.toNumber().toLocaleString(undefined, { maximumFractionDigits: 0 })
|
|
129
|
-
: number.gt(0.01)
|
|
130
|
-
? parseFloat(number.toFixed(2)).toLocaleString(undefined)
|
|
131
|
-
: parseFloat(number.toPrecision(5)).toLocaleString(undefined);
|
|
132
|
-
}
|
|
133
|
-
function formatUSDNumber(input) {
|
|
134
|
-
var number = new BigNumber(input);
|
|
135
|
-
if (number.isNaN())
|
|
136
|
-
return '0';
|
|
137
|
-
// If the number is greater than 0 but less than 0.01
|
|
138
|
-
if (number.gt(0) && number.lt(0.01)) {
|
|
139
|
-
return '< 0.01';
|
|
140
|
-
}
|
|
141
|
-
// If the number is greater than 1k, round to no decimals.
|
|
142
|
-
if (number.gt(1000)) {
|
|
143
|
-
return number.toNumber().toLocaleString(undefined, { maximumFractionDigits: 0 });
|
|
144
|
-
}
|
|
145
|
-
// Note: Between 1k and 0.01 show 2 decimals
|
|
146
|
-
return parseFloat(number.toFixed(2)).toLocaleString(undefined);
|
|
147
|
-
}
|
|
148
|
-
var youSpend = formatNumber(inputValue);
|
|
149
|
-
var youSpendUSD = function (bond) {
|
|
150
|
-
return (parseFloat(inputValue) * parseFloat(bond.principalTokenPrice)).toString();
|
|
151
|
-
};
|
|
152
|
-
var youGet = function (bond) {
|
|
153
|
-
var _a;
|
|
154
|
-
var bigValue = new BigNumber(inputValue).times(new BigNumber(10).pow(18));
|
|
155
|
-
var billValue = bigValue.div(new BigNumber((_a = bond.trueBillPrice) !== null && _a !== void 0 ? _a : 0));
|
|
156
|
-
return formatNumber(billValue.toString());
|
|
157
|
-
};
|
|
158
|
-
var youGetUSD = function (bond) {
|
|
159
|
-
var _a;
|
|
160
|
-
var bigValue = new BigNumber(inputValue).times(new BigNumber(10).pow(18));
|
|
161
|
-
var billValue = bigValue.div(new BigNumber((_a = bond.trueBillPrice) !== null && _a !== void 0 ? _a : 0));
|
|
162
|
-
return (billValue.toNumber() * parseFloat(bond.payoutTokenPrice)).toString();
|
|
163
|
-
};
|
|
164
|
-
var premium = function (bond) {
|
|
165
|
-
var premiumUSD = parseFloat(youGetUSD(bond)) - parseFloat(youSpendUSD(bond));
|
|
166
|
-
return formatUSDNumber(premiumUSD.toString());
|
|
167
|
-
};
|
|
168
|
-
var getPremiumColor = function (bond) {
|
|
169
|
-
var getPremium = premium(bond);
|
|
170
|
-
return parseFloat(getPremium) < 0 ? 'premium-negative' : 'premium-positive';
|
|
171
|
-
};
|
|
172
|
-
////////////////////////////////////////////////////////////////////////////////////
|
|
173
|
-
////////////////////////////////////////////////////////////////////////////////////
|
|
174
|
-
////////////////////////////////////////////////////////////////////////////////////
|
|
175
119
|
var handleBuy = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
176
120
|
var provider, signer, bondContract, maxPrice, amount, tx, error_1;
|
|
177
121
|
return __generator(this, function (_a) {
|
|
@@ -249,7 +193,7 @@ var BondModal = function (_a) {
|
|
|
249
193
|
}); };
|
|
250
194
|
return (_jsx(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: bondData.map(function (bond) {
|
|
251
195
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
252
|
-
return (_jsx(React.Fragment, { children: _jsx(Flex, __assign({ className: "modal modal-backdrop" }, { children: _jsxs(Flex, __assign({ className: "modal modal-content" }, { children: [isActive && account && (_jsxs("p", { children: ["Wallet Address: ", account] })), _jsx(Flex, __assign({ className: "modal modal-header" }, { children: _jsx(Flex, __assign({ className: "svg-close", onClick: onClose }, { children: _jsx(Svg, { icon: "close" }) })) })), _jsxs(Flex, __assign({ className: "modal-container table-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-container title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bondicon" }, { children: _jsx(TokenImage, { symbol: (_a = bond.showcaseTokenName) !== null && _a !== void 0 ? _a : bond.payoutTokenName, size: 50 }) })), _jsx(Flex, __assign({ className: "title-container bondname" }, { children: bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName })), _jsxs(Flex, __assign({ className: "title-container price-container" }, { children: [_jsxs(Flex, __assign({ className: "price-container price" }, { children: ["$", earnTokenPrice(bond)] })), _jsxs(Flex, __assign({ className: "price-container discounted" }, { children: ["$", discountEarnTokenPrice(bond)] }))] })), _jsx(Flex, __assign({ className: "title-container tokentags" }, { children: _jsx(ListTag, { text: (_b = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _b === void 0 ? void 0 : _b[0], variant: ((_c = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _c === void 0 ? void 0 : _c[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) }))] })), _jsx(Flex, __assign({ className: "modal-container description-container" }, { children: bond === null || bond === void 0 ? void 0 : bond.shortDescription })), _jsxs(Flex, __assign({ className: "modal-container blocks-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-block column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Discount", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), "".concat((_d = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _d === void 0 ? void 0 : _d.toFixed(2), "%")] })), _jsxs(Flex, __assign({ className: "modal-block column-arr" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["ARR", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), "".concat(((((_e = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _e !== void 0 ? _e : 0) * 365) / vestingTime((_f = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _f !== void 0 ? _f : 0).days).toFixed(2), "%")] })), _jsxs(Flex, __assign({ className: "modal-block column-term" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Terms", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), vestingTime((_g = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _g !== void 0 ? _g : 0).days ? "".concat(vestingTime((_h = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _h !== void 0 ? _h : 0).days, " D") : '-'] })), _jsxs(Flex, __assign({ className: "modal-block column-maxbuy" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Max Buy", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.MaxBuy(bond.payoutTokenName) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), (_j = parseFloat(maxBuy(bond).toFixed(0))) === null || _j === void 0 ? void 0 : _j.toLocaleString('en-US')] }))] })), _jsxs(Flex, __assign({ className: "modal-container text-container" }, { children: [_jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsx(Flex, __assign({ className: "row-container spend" }, { children: "You spend:" })), _jsxs(Flex, __assign({ className: "row-container spend-val" }, { children: [youSpend, " ", bond.principalTokenName, " = $ ", formatUSDNumber(youSpendUSD(bond))] }))] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsxs(Flex, __assign({ className: "row-container premium" }, { children: ["Premium:", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "row-container premium-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), _jsxs(Flex, __assign({ className: "row-container premium-val ".concat(getPremiumColor(bond)) }, { children: ["$ ", premium(bond)] }))] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsxs(Flex, __assign({ className: "row-container get" }, { children: ["You get (over ", vestingTime((_k = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _k !== void 0 ? _k : 0).days, " days):"] })), _jsxs(Flex, __assign({ className: "row-container get-val" }, { children: [youGet(bond), " ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName, " = $ ", formatUSDNumber(youGetUSD(bond))] }))] }))] })), _jsxs(Flex, __assign({ className: "modal-container input-container" }, { children: [_jsx(Flex, __assign({ className: "input-container input" }, { children: _jsx(Input, { placeholder: "0.0", value: inputValue, pattern: "^[0-9]*[.,]?[0-9]*$", onChange: handleInputChange, onInput: function (v) {
|
|
196
|
+
return (_jsx(React.Fragment, { children: _jsx(Flex, __assign({ className: "modal modal-backdrop" }, { children: _jsxs(Flex, __assign({ className: "modal modal-content" }, { children: [isActive && account && (_jsxs("p", { children: ["Wallet Address: ", account] })), _jsx(Flex, __assign({ className: "modal modal-header" }, { children: _jsx(Flex, __assign({ className: "svg-close", onClick: onClose }, { children: _jsx(Svg, { icon: "close" }) })) })), _jsxs(Flex, __assign({ className: "modal-container table-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-container title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bondicon" }, { children: _jsx(TokenImage, { symbol: (_a = bond.showcaseTokenName) !== null && _a !== void 0 ? _a : bond.payoutTokenName, size: 50 }) })), _jsx(Flex, __assign({ className: "title-container bondname" }, { children: bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName })), _jsxs(Flex, __assign({ className: "title-container price-container" }, { children: [_jsxs(Flex, __assign({ className: "price-container price" }, { children: ["$", earnTokenPrice(bond)] })), _jsxs(Flex, __assign({ className: "price-container discounted" }, { children: ["$", discountEarnTokenPrice(bond)] }))] })), _jsx(Flex, __assign({ className: "title-container tokentags" }, { children: _jsx(ListTag, { text: (_b = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _b === void 0 ? void 0 : _b[0], variant: ((_c = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _c === void 0 ? void 0 : _c[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) }))] })), _jsx(Flex, __assign({ className: "modal-container description-container" }, { children: bond === null || bond === void 0 ? void 0 : bond.shortDescription })), _jsxs(Flex, __assign({ className: "modal-container blocks-container" }, { children: [_jsxs(Flex, __assign({ className: "modal-block column-discount ".concat(getDiscountColor(bond === null || bond === void 0 ? void 0 : bond.discount)) }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Discount", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), "".concat((_d = bond === null || bond === void 0 ? void 0 : bond.discount) === null || _d === void 0 ? void 0 : _d.toFixed(2), "%")] })), _jsxs(Flex, __assign({ className: "modal-block column-arr" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["ARR", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), "".concat(((((_e = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _e !== void 0 ? _e : 0) * 365) / vestingTime((_f = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _f !== void 0 ? _f : 0).days).toFixed(2), "%")] })), _jsxs(Flex, __assign({ className: "modal-block column-term" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Terms", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), vestingTime((_g = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _g !== void 0 ? _g : 0).days ? "".concat(vestingTime((_h = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _h !== void 0 ? _h : 0).days, " D") : '-'] })), _jsxs(Flex, __assign({ className: "modal-block column-maxbuy" }, { children: [_jsxs(Flex, __assign({ className: "block-header header" }, { children: ["Max Buy", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.MaxBuy(bond.payoutTokenName) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), (_j = parseFloat(maxBuy(bond).toFixed(0))) === null || _j === void 0 ? void 0 : _j.toLocaleString('en-US')] }))] })), _jsxs(Flex, __assign({ className: "modal-container text-container" }, { children: [_jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsx(Flex, __assign({ className: "row-container spend" }, { children: "You spend:" })), _jsxs(Flex, __assign({ className: "row-container spend-val" }, { children: [youSpend(inputValue), " ", bond.principalTokenName, " = $ ", formatUSDNumber(youSpendUSD(bond, inputValue))] }))] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsxs(Flex, __assign({ className: "row-container premium" }, { children: ["Premium:", _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "row-container premium-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) }))] })), _jsxs(Flex, __assign({ className: "row-container premium-val ".concat(getPremiumColor(bond, inputValue)) }, { children: ["$ ", premium(bond, inputValue)] }))] })), _jsxs(Flex, __assign({ className: "text-container row" }, { children: [_jsxs(Flex, __assign({ className: "row-container get" }, { children: ["You get (over ", vestingTime((_k = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _k !== void 0 ? _k : 0).days, " days):"] })), _jsxs(Flex, __assign({ className: "row-container get-val" }, { children: [youGet(bond, inputValue), " ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName, " = $ ", formatUSDNumber(youGetUSD(bond, inputValue))] }))] }))] })), _jsxs(Flex, __assign({ className: "modal-container input-container" }, { children: [_jsx(Flex, __assign({ className: "input-container input" }, { children: _jsx(Input, { placeholder: "0.0", value: inputValue, pattern: "^[0-9]*[.,]?[0-9]*$", onChange: handleInputChange, onInput: function (v) {
|
|
253
197
|
if (v.currentTarget.value.includes(',')) {
|
|
254
198
|
v.currentTarget.value = v.currentTarget.value.replace(/,/g, '.');
|
|
255
199
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BondsDataResponse } from "../../types/bonds";
|
|
2
|
+
export declare function formatNumber(input: string): string;
|
|
3
|
+
export declare function formatUSDNumber(input: string): string;
|
|
4
|
+
export declare const youSpend: (inputValue: string) => string;
|
|
5
|
+
export declare const youSpendUSD: (bond: BondsDataResponse, inputValue: string) => string;
|
|
6
|
+
export declare const youGet: (bond: BondsDataResponse, inputValue: string) => string;
|
|
7
|
+
export declare const youGetUSD: (bond: BondsDataResponse, inputValue: string) => string;
|
|
8
|
+
export declare const premium: (bond: BondsDataResponse, inputValue: string) => string;
|
|
9
|
+
export declare const getPremiumColor: (bond: BondsDataResponse, inputValue: string) => string;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import BigNumber from "bignumber.js";
|
|
2
|
+
import { formatNumberSI } from "../../utils/formatNumber";
|
|
3
|
+
export function formatNumber(input) {
|
|
4
|
+
var number = new BigNumber(input);
|
|
5
|
+
if (number.isNaN())
|
|
6
|
+
return '0';
|
|
7
|
+
return number.gt(1000000)
|
|
8
|
+
? formatNumberSI(number.toNumber())
|
|
9
|
+
: number.gt(1000)
|
|
10
|
+
? number.toNumber().toLocaleString(undefined, { maximumFractionDigits: 0 })
|
|
11
|
+
: number.gt(0.01)
|
|
12
|
+
? parseFloat(number.toFixed(2)).toLocaleString(undefined)
|
|
13
|
+
: parseFloat(number.toPrecision(5)).toLocaleString(undefined);
|
|
14
|
+
}
|
|
15
|
+
export function formatUSDNumber(input) {
|
|
16
|
+
var number = new BigNumber(input);
|
|
17
|
+
if (number.isNaN())
|
|
18
|
+
return '0';
|
|
19
|
+
// If the number is greater than 0 but less than 0.01
|
|
20
|
+
if (number.gt(0) && number.lt(0.01)) {
|
|
21
|
+
return '< 0.01';
|
|
22
|
+
}
|
|
23
|
+
// If the number is greater than 1k, round to no decimals.
|
|
24
|
+
if (number.gt(1000)) {
|
|
25
|
+
return number.toNumber().toLocaleString(undefined, { maximumFractionDigits: 0 });
|
|
26
|
+
}
|
|
27
|
+
// Note: Between 1k and 0.01 show 2 decimals
|
|
28
|
+
return parseFloat(number.toFixed(2)).toLocaleString(undefined);
|
|
29
|
+
}
|
|
30
|
+
export var youSpend = function (inputValue) { return formatNumber(inputValue); };
|
|
31
|
+
export var youSpendUSD = function (bond, inputValue) {
|
|
32
|
+
return (parseFloat(inputValue) * parseFloat(bond.principalTokenPrice)).toString();
|
|
33
|
+
};
|
|
34
|
+
export var youGet = function (bond, inputValue) {
|
|
35
|
+
var _a;
|
|
36
|
+
var bigValue = new BigNumber(inputValue).times(new BigNumber(10).pow(18));
|
|
37
|
+
var billValue = bigValue.div(new BigNumber((_a = bond.trueBillPrice) !== null && _a !== void 0 ? _a : 0));
|
|
38
|
+
return formatNumber(billValue.toString());
|
|
39
|
+
};
|
|
40
|
+
export var youGetUSD = function (bond, inputValue) {
|
|
41
|
+
var _a;
|
|
42
|
+
var bigValue = new BigNumber(inputValue).times(new BigNumber(10).pow(18));
|
|
43
|
+
var billValue = bigValue.div(new BigNumber((_a = bond.trueBillPrice) !== null && _a !== void 0 ? _a : 0));
|
|
44
|
+
return (billValue.toNumber() * parseFloat(bond.payoutTokenPrice)).toString();
|
|
45
|
+
};
|
|
46
|
+
export var premium = function (bond, inputValue) {
|
|
47
|
+
var premiumUSD = parseFloat(youGetUSD(bond, inputValue)) - parseFloat(youSpendUSD(bond, inputValue));
|
|
48
|
+
return formatUSDNumber(premiumUSD.toString());
|
|
49
|
+
};
|
|
50
|
+
export var getPremiumColor = function (bond, inputValue) {
|
|
51
|
+
var getPremium = premium(bond, inputValue);
|
|
52
|
+
return parseFloat(getPremium) < 0 ? 'premium-negative' : 'premium-positive';
|
|
53
|
+
};
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
align-items: center;
|
|
11
11
|
z-index: 1000;
|
|
12
12
|
overflow: auto;
|
|
13
|
+
padding: 50px;
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
.yourbondsmodal.content {
|
|
@@ -20,8 +21,8 @@
|
|
|
20
21
|
padding: 10px;
|
|
21
22
|
border-radius: 10px;
|
|
22
23
|
z-index: 1001;
|
|
23
|
-
max-width:
|
|
24
|
-
min-width:
|
|
24
|
+
max-width: 1200px;
|
|
25
|
+
min-width: 1000px;
|
|
25
26
|
overflow: auto;
|
|
26
27
|
}
|
|
27
28
|
|
|
@@ -154,7 +155,7 @@
|
|
|
154
155
|
flex-direction: row;
|
|
155
156
|
height: 25px;
|
|
156
157
|
padding-left: 10px;
|
|
157
|
-
width:
|
|
158
|
+
width: 100%;
|
|
158
159
|
margin-bottom: 10px;
|
|
159
160
|
align-items: center;
|
|
160
161
|
justify-content: start;
|
|
@@ -163,7 +164,7 @@
|
|
|
163
164
|
.yourbondinfo-block.row-vested {
|
|
164
165
|
flex-direction: row;
|
|
165
166
|
height: 50px;
|
|
166
|
-
width:
|
|
167
|
+
width: 100%;
|
|
167
168
|
margin-bottom: 10px;
|
|
168
169
|
padding-left: 10px;
|
|
169
170
|
padding-right: 10px;
|
|
@@ -174,7 +175,7 @@
|
|
|
174
175
|
.yourbondinfo-block.row-pending {
|
|
175
176
|
flex-direction: row;
|
|
176
177
|
height: 50px;
|
|
177
|
-
width:
|
|
178
|
+
width: 100%;
|
|
178
179
|
margin-bottom: 10px;
|
|
179
180
|
padding-left: 10px;
|
|
180
181
|
padding-right: 10px;
|
|
@@ -185,7 +186,7 @@
|
|
|
185
186
|
.yourbondinfo-block.row-claimable {
|
|
186
187
|
flex-direction: row;
|
|
187
188
|
height: 50px;
|
|
188
|
-
width:
|
|
189
|
+
width: 100%;
|
|
189
190
|
margin-bottom: 10px;
|
|
190
191
|
padding-left: 10px;
|
|
191
192
|
padding-right: 10px;
|