@ape.swap/bonds-sdk 1.0.453 → 1.0.455

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/dist/components/{Bonds/BondRows → BondRows}/BondRow.d.ts +2 -2
  2. package/dist/components/{Bonds/BondRows → BondRows}/BondRow.js +10 -10
  3. package/dist/components/{Bonds/BondRows → BondRows}/BondRowHeader.d.ts +1 -1
  4. package/dist/components/{Bonds/BondRows → BondRows}/BondRowHeader.js +4 -4
  5. package/dist/components/{Bonds/BondRows → BondRows}/BondRowsByChain.d.ts +1 -1
  6. package/dist/components/{Bonds/BondRows → BondRows}/BondRowsByChain.js +3 -2
  7. package/dist/components/{Bonds/BondRows → BondRows}/BondRowsWithTitle.d.ts +1 -1
  8. package/dist/components/{Bonds/BondRows → BondRows}/BondRowsWithTitle.js +1 -1
  9. package/dist/components/{Bonds/BondRows → BondRows}/ChainTitle.js +2 -2
  10. package/dist/components/{BondModal → Modals/BondModal}/BondModal.d.ts +1 -1
  11. package/dist/components/{BondModal → Modals/BondModal}/BondModal.js +12 -12
  12. package/dist/components/{BondModal → Modals/BondModal}/helper.d.ts +1 -1
  13. package/dist/components/{BondModal → Modals/BondModal}/helper.js +1 -1
  14. package/dist/components/Modals/YourBondsModal/YourBondsModal.d.ts +9 -0
  15. package/dist/components/Modals/YourBondsModal/YourBondsModal.js +150 -0
  16. package/dist/components/{YourBondsModal → Modals/YourBondsModal}/styles.js +1 -1
  17. package/dist/components/YourBondsModal/YourBondsModal.js +2 -2
  18. package/dist/index.d.ts +5 -5
  19. package/dist/index.js +5 -5
  20. package/dist/{components → pages}/BondSingle/BondSingle.js +2 -2
  21. package/dist/{components → pages}/Bonds/Bonds.js +3 -3
  22. package/dist/{components → pages}/YourBonds/YourBonds.js +3 -3
  23. package/dist/scss/BondRowHeader.scss +1 -1
  24. package/package.json +1 -1
  25. /package/dist/components/{Bonds/BondRows → BondRows}/ChainTitle.d.ts +0 -0
  26. /package/dist/components/{YourBondsModal → Modals/YourBondsModal}/styles.d.ts +0 -0
  27. /package/dist/{components → pages}/BondSingle/BondSingle.d.ts +0 -0
  28. /package/dist/{components → pages}/Bonds/Bonds.d.ts +0 -0
  29. /package/dist/{components → pages}/YourBonds/YourBonds.d.ts +0 -0
  30. /package/dist/{components → pages}/YourBonds/fetchBillsUser.d.ts +0 -0
  31. /package/dist/{components → pages}/YourBonds/fetchBillsUser.js +0 -0
  32. /package/dist/{components → pages}/YourBonds/getBillNftData.d.ts +0 -0
  33. /package/dist/{components → pages}/YourBonds/getBillNftData.js +0 -0
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { BondsDataResponse } from "../../../types/bonds";
3
- import '../../../scss/BondRow.scss';
2
+ import { BondsDataResponse } from "../../types/bonds";
3
+ import '../../scss/BondRow.scss';
4
4
  interface BondRowProps {
5
5
  key: string;
6
6
  bond: BondsDataResponse;
@@ -11,18 +11,18 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
13
13
  import BigNumber from "bignumber.js";
14
- import { ChainId } from "../../../enum/apeswaplists";
15
- import ProgressBar from "../../ProgressBar/ProgressBar";
16
- import ProgressBarWrapper from "../../ProgressBar/ProgressBarWrapper";
17
- import TokenInfoAndName from "../../TokenInfoAndName";
18
- import Tooltip from "../../Tooltip/Tooltip";
19
- import { Flex, Svg, TooltipBubble } from "../../uikit-sdk";
20
- import { formatDollar, formatValue } from "../../../utils/formatNumbers";
21
- import getTimePeriods from "../../../utils/getTimePeriods";
22
- import { BLOCK_EXPLORER } from "../../../config/constants/chains";
14
+ import { ChainId } from "../../enum/apeswaplists";
15
+ import ProgressBar from "../ProgressBar/ProgressBar";
16
+ import ProgressBarWrapper from "../ProgressBar/ProgressBarWrapper";
17
+ import TokenInfoAndName from "../TokenInfoAndName";
18
+ import Tooltip from "../Tooltip/Tooltip";
19
+ import { Flex, Svg, TooltipBubble } from "../uikit-sdk";
20
+ import { formatDollar, formatValue } from "../../utils/formatNumbers";
21
+ import getTimePeriods from "../../utils/getTimePeriods";
22
+ import { BLOCK_EXPLORER } from "../../config/constants/chains";
23
23
  import { useState } from "react";
24
24
  import { useNavigate } from "react-router-dom";
25
- import '../../../scss/BondRow.scss';
25
+ import '../../scss/BondRow.scss';
26
26
  var BondRow = function (_a) {
27
27
  var _b, _c, _d;
28
28
  var bond = _a.bond, hotBonds = _a.hotBonds;
@@ -1,6 +1,6 @@
1
1
  /** @jsxImportSource theme-ui */
2
2
  import React from 'react';
3
- import '../../../scss/BondRowHeader.scss';
3
+ import '../../scss/BondRowHeader.scss';
4
4
  interface BondRowHeaderProps {
5
5
  inputValue: string;
6
6
  onInputChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
@@ -11,10 +11,10 @@ var __assign = (this && this.__assign) || function () {
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
13
13
  import { Flex } from 'theme-ui';
14
- import { Input } from '../../uikit-sdk/Input';
15
- import { Svg, TooltipBubble } from '../../uikit-sdk';
16
- import { TooltipText } from '../../../enum/tooltips';
17
- import '../../../scss/BondRowHeader.scss';
14
+ import { Input } from '../uikit-sdk/Input';
15
+ import { Svg, TooltipBubble } from '../uikit-sdk';
16
+ import { TooltipText } from '../../enum/tooltips';
17
+ import '../../scss/BondRowHeader.scss';
18
18
  var BondRowHeader = function (_a) {
19
19
  var inputValue = _a.inputValue, onInputChange = _a.onInputChange, onSort = _a.onSort;
20
20
  return (_jsxs(Flex, __assign({ className: "container header-container" }, { children: [_jsxs(Flex, __assign({ className: "column column-tokens" }, { children: [_jsx(Flex, __assign({ className: "column column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] } }, { children: _jsx(Input, { value: inputValue, onChange: onInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) })), _jsx(Flex, { className: "column column-tokenicons" })] })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-discount" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)" }, { children: ["DISCOUNT", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('discount'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-arr" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)" }, { children: ["ARR", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('arr'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-terms" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)" }, { children: ["TERMS", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('terms'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsxs(Flex, __assign({ className: "column column-tokensremaining" }, { children: [_jsx(Flex, __assign({ className: "column tooltip" }, { children: _jsxs(TooltipBubble, __assign({ body: _jsx(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)" }, { children: ["TOKENS REMAINING", _jsx(Flex, __assign({ className: "column header-icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) }))] })) })), _jsx(Flex, __assign({ className: "column header-icon", onClick: function () { return onSort('tokensRemaining'); } }, { children: _jsx(Svg, { icon: "sort", width: "12px" }) }))] })), _jsx(Flex, { className: "column column-hotbond" })] }))] })));
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { BondsDataResponse } from '../../../types/bonds';
2
+ import { BondsDataResponse } from '../../types/bonds';
3
3
  declare const BondRowsByChain: ({ bonds, hotBonds, rowClick }: {
4
4
  bonds: BondsDataResponse[];
5
5
  hotBonds?: string[] | undefined;
@@ -10,9 +10,10 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
13
- import { Flex } from '../../uikit-sdk';
14
- import { ChainId, MAINNET_CHAINS } from '../../../config/constants/chains';
15
13
  import BondRowsWithTitle from './BondRowsWithTitle';
14
+ import { ChainId } from '../../enum/apeswaplists';
15
+ import { Flex } from '../uikit-sdk';
16
+ import { MAINNET_CHAINS } from '../../config/constants/chains';
16
17
  var BondRowsByChain = function (_a) {
17
18
  var bonds = _a.bonds, hotBonds = _a.hotBonds, rowClick = _a.rowClick;
18
19
  return (_jsxs(Flex, __assign({ sx: { width: '100%', flexDirection: 'column', mt: '5px' } }, { children: [[ChainId.MAINNET].map(function (chain, index) {
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import { BondsDataResponse } from "../../../types/bonds";
2
+ import { BondsDataResponse } from "../../types/bonds";
3
3
  declare const BondRowsWithTitle: ({ chain, bonds, hotBonds, rowClick, }: {
4
4
  chain: number;
5
5
  bonds: BondsDataResponse[];
@@ -10,11 +10,11 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
13
- import { Flex } from "../../uikit-sdk";
14
13
  import { AnimatePresence, motion } from "framer-motion";
15
14
  import ChainTitle from "./ChainTitle";
16
15
  import BondRow from "./BondRow";
17
16
  import { useState } from "react";
17
+ import { Flex } from "../uikit-sdk";
18
18
  var BondRowsWithTitle = function (_a) {
19
19
  var chain = _a.chain, bonds = _a.bonds, hotBonds = _a.hotBonds, rowClick = _a.rowClick;
20
20
  var billsFilteredByChain = bonds.filter(function (bill) { return bill.chainId === chain; });
@@ -10,8 +10,8 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "theme-ui/jsx-runtime";
13
- import { NETWORK_LABEL } from '../../../config/constants/chains';
14
- import { Flex, Svg } from '../../uikit-sdk';
13
+ import { Flex, Svg } from '../uikit-sdk';
14
+ import { NETWORK_LABEL } from '../../config/constants/chains';
15
15
  var ChainTitle = function (_a) {
16
16
  var chain = _a.chain, pt = _a.pt, isOpen = _a.isOpen;
17
17
  return (_jsxs(Flex, __assign({ sx: {
@@ -1,6 +1,6 @@
1
1
  /** @jsxImportSource theme-ui */
2
2
  import React from 'react';
3
- import '../../scss/BondModal.scss';
3
+ import '../../../scss/BondModal.scss';
4
4
  declare const BondModal: ({ isOpen, onClose, bondAddress }: {
5
5
  isOpen: boolean;
6
6
  onClose: () => void;
@@ -50,23 +50,23 @@ import { jsxs as _jsxs, jsx as _jsx } from "theme-ui/jsx-runtime";
50
50
  import React, { useEffect, useState } from 'react';
51
51
  import { Flex, Input, ThemeUIProvider } from 'theme-ui';
52
52
  import { useWeb3React } from '@web3-react/core';
53
- import { defaultTheme } from '../../theme';
54
- import getTimePeriods from '../../utils/getTimePeriods';
53
+ import { defaultTheme } from '../../../theme';
54
+ import getTimePeriods from '../../../utils/getTimePeriods';
55
55
  import axios from 'axios';
56
56
  import { BigNumber } from 'bignumber.js';
57
- import { getFirstNonZeroDigits } from '../../utils/roundNumber';
57
+ import { getFirstNonZeroDigits } from '../../../utils/roundNumber';
58
58
  import { useNavigate } from 'react-router-dom';
59
- import { isNumber } from '../../utils/numbers';
60
- import { TooltipBubble, Button, Svg, ListTag } from '../uikit-sdk';
61
- import { TooltipText } from '../../enum/tooltips';
59
+ import { isNumber } from '../../../utils/numbers';
60
+ import { TooltipBubble, Button, Svg, ListTag } from '../../uikit-sdk';
61
+ import { TooltipText } from '../../../enum/tooltips';
62
62
  import { ethers } from 'ethers';
63
- import { adjustDecimals } from "../../utils/convertToTokenValue";
64
- import TokenImage from '../uikit-sdk/TokenImage';
65
- import '../../scss/BondModal.scss';
66
- import BOND_ABI from '../../config/abi/bond.json';
67
- import ERC_20_ABI from '../../config/abi/bond.json';
68
- import { NETWORK_ICONS } from '../../config/constants/chains';
63
+ import { adjustDecimals } from "../../../utils/convertToTokenValue";
64
+ import TokenImage from '../../uikit-sdk/TokenImage';
65
+ import BOND_ABI from '../../../config/abi/bond.json';
66
+ import ERC_20_ABI from '../../../config/abi/bond.json';
67
+ import { NETWORK_ICONS } from '../../../config/constants/chains';
69
68
  import { formatUSDNumber, getPremiumColor, premium, youGet, youGetUSD, youSpend, youSpendUSD } from './helper';
69
+ import '../../../scss/BondModal.scss';
70
70
  var BondModal = function (_a) {
71
71
  var isOpen = _a.isOpen, onClose = _a.onClose, bondAddress = _a.bondAddress;
72
72
  if (!isOpen)
@@ -1,4 +1,4 @@
1
- import { BondsDataResponse } from "../../types/bonds";
1
+ import { BondsDataResponse } from "../../../types/bonds";
2
2
  declare function formatNumber(input: string): string;
3
3
  declare function formatUSDNumber(input: string): string;
4
4
  declare const youSpend: (inputValue: string) => string;
@@ -1,5 +1,5 @@
1
1
  import BigNumber from "bignumber.js";
2
- import { formatNumberSI } from "../../utils/formatNumber";
2
+ import { formatNumberSI } from "../../../utils/formatNumber";
3
3
  function formatNumber(input) {
4
4
  var number = new BigNumber(input);
5
5
  if (number.isNaN())
@@ -0,0 +1,9 @@
1
+ /** @jsxImportSource theme-ui */
2
+ import React from 'react';
3
+ import '../../../scss/YourBondsModal.scss';
4
+ declare const YourBondsModal: ({ isOpen, onClose, bondAddress }: {
5
+ isOpen: boolean;
6
+ onClose: () => void;
7
+ bondAddress: string | null;
8
+ }) => React.JSX.Element | null;
9
+ export default YourBondsModal;
@@ -0,0 +1,150 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
13
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
+ return new (P || (P = Promise))(function (resolve, reject) {
15
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
19
+ });
20
+ };
21
+ var __generator = (this && this.__generator) || function (thisArg, body) {
22
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
23
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
24
+ function verb(n) { return function (v) { return step([n, v]); }; }
25
+ function step(op) {
26
+ if (f) throw new TypeError("Generator is already executing.");
27
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
+ if (y = 0, t) op = [op[0] & 2, t.value];
30
+ switch (op[0]) {
31
+ case 0: case 1: t = op; break;
32
+ case 4: _.label++; return { value: op[1], done: false };
33
+ case 5: _.label++; y = op[1]; op = [0]; continue;
34
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
35
+ default:
36
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
37
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
38
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
39
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
40
+ if (t[2]) _.ops.pop();
41
+ _.trys.pop(); continue;
42
+ }
43
+ op = body.call(thisArg, _);
44
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
45
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
+ }
47
+ };
48
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "theme-ui/jsx-runtime";
49
+ /** @jsxImportSource theme-ui */
50
+ import React, { useEffect, useState } from 'react';
51
+ import { Flex, ThemeUIProvider } from 'theme-ui';
52
+ import { useWeb3React } from '@web3-react/core';
53
+ import axios from 'axios';
54
+ import { BigNumber } from 'bignumber.js';
55
+ import { AnimatePresence, motion } from 'framer-motion';
56
+ import { MAINNET_CHAINS, NETWORK_ICONS } from '../../../config/constants/chains';
57
+ import { fetchUserOwnedBillsDataAsync } from '../../../pages/YourBonds/fetchBillsUser';
58
+ import { getBalanceNumber } from '../../../utils/getBalanceNumber';
59
+ import { getFirstNonZeroDigits } from '../../../utils/roundNumber';
60
+ import { defaultTheme } from '../../../theme';
61
+ import TokenImage from '../../uikit-sdk/TokenImage';
62
+ import { Button, ListTag, Skeleton, Svg, Text, TooltipBubble } from '../../uikit-sdk';
63
+ import { UserBillTooltipText } from '../../../enum/tooltips';
64
+ import { getPendingVesting } from '../../../hooks/usePendingVesting';
65
+ import { formatNumberSI } from '../../../utils/formatNumber';
66
+ import { StyledHeadingText, TraitsContentContainer } from './styles';
67
+ import '../../../scss/YourBondsModal.scss';
68
+ var YourBondsModal = function (_a) {
69
+ var isOpen = _a.isOpen, onClose = _a.onClose, bondAddress = _a.bondAddress;
70
+ if (!isOpen)
71
+ return null;
72
+ var _b = useWeb3React(), account = _b.account, chainId = _b.chainId, isActive = _b.isActive;
73
+ // Fetch data for user owned bill
74
+ var _c = useState([]), bondData = _c[0], setBondData = _c[1];
75
+ var _d = useState([]), userOwnedBillsData = _d[0], setUserOwnedBillsData = _d[1];
76
+ useEffect(function () {
77
+ axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
78
+ var bond = response.data.bonds.filter(function (x) {
79
+ return x.billAddress.toLowerCase() === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase());
80
+ });
81
+ setBondData(bond);
82
+ });
83
+ }, [bondAddress]);
84
+ useEffect(function () {
85
+ var fetchData = function () { return __awaiter(void 0, void 0, void 0, function () {
86
+ var results, error_1;
87
+ return __generator(this, function (_a) {
88
+ switch (_a.label) {
89
+ case 0:
90
+ if (!account) return [3 /*break*/, 4];
91
+ _a.label = 1;
92
+ case 1:
93
+ _a.trys.push([1, 3, , 4]);
94
+ return [4 /*yield*/, Promise.all(MAINNET_CHAINS.map(function (chain) { return fetchUserOwnedBillsDataAsync(chain, account, bondData); }))];
95
+ case 2:
96
+ results = _a.sent();
97
+ setUserOwnedBillsData(results);
98
+ return [3 /*break*/, 4];
99
+ case 3:
100
+ error_1 = _a.sent();
101
+ console.error('Error fetching user owned bills data:', error_1);
102
+ return [3 /*break*/, 4];
103
+ case 4: return [2 /*return*/];
104
+ }
105
+ });
106
+ }); };
107
+ fetchData();
108
+ }, [account]);
109
+ // Functions to calculate display values for modal
110
+ var totalPending = function (userBill) {
111
+ var _a, _b, _c, _d;
112
+ return getBalanceNumber(new BigNumber((_a = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _a !== void 0 ? _a : 0), (_d = (_c = (_b = userBill.bond.earnToken) === null || _b === void 0 ? void 0 : _b.decimals) === null || _c === void 0 ? void 0 : _c[chainId]) !== null && _d !== void 0 ? _d : 18);
113
+ };
114
+ var claimable = function (userBill) {
115
+ var _a, _b, _c;
116
+ return getBalanceNumber(new BigNumber(userBill.pendingRewards), (_c = (_b = (_a = userBill.bond.earnToken) === null || _a === void 0 ? void 0 : _a.decimals) === null || _b === void 0 ? void 0 : _b[chainId]) !== null && _c !== void 0 ? _c : 18);
117
+ };
118
+ var earnTokenPrice = function (bond) {
119
+ var _a;
120
+ return getFirstNonZeroDigits(parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0'));
121
+ };
122
+ var BILL_ATTRIBUTES = ['The Legend', 'The Location', 'The Moment', 'The Trend', 'The Innovation'];
123
+ var _e = useState(false), isOpenTraits = _e[0], setIsOpenTraits = _e[1];
124
+ var _f = useState(false), billRendered = _f[0], setBillRendered = _f[1];
125
+ useEffect(function () {
126
+ if (userOwnedBillsData.length > 0) {
127
+ setBillRendered(true);
128
+ }
129
+ }, [userOwnedBillsData]);
130
+ return (_jsx(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: billRendered && (_jsx(_Fragment, { children: userOwnedBillsData.flat().map(function (data) {
131
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
132
+ var userBill = data.userOwnedBills.find(function (bill) { return bill.bond.billAddress.toLowerCase() === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
133
+ var attributes = (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.nftData) === null || _a === void 0 ? void 0 : _a.data.attributes) === null || _b === void 0 ? void 0 : _b.filter(function (attrib) { return BILL_ATTRIBUTES.includes(attrib.trait_type); });
134
+ return userBill ? (_jsx(React.Fragment, { children: _jsx(Flex, __assign({ className: "yourbondsmodal backdrop" }, { children: _jsxs(Flex, __assign({ className: "yourbondsmodal content" }, { children: [_jsx(Flex, __assign({ className: "yourbondsmodal header" }, { children: _jsx(Flex, __assign({ className: "svg-close", onClick: onClose }, { children: _jsx(Svg, { icon: "close" }) })) })), _jsxs(Flex, __assign({ className: "yourbondsmodal table-container" }, { children: [_jsx(Flex, __assign({ className: "yourbondsmodal bondimage" }, { children: _jsx("img", { src: (_c = userBill.nftData) === null || _c === void 0 ? void 0 : _c.data.image }) })), _jsxs(Flex, __assign({ className: "yourbondsmodal yourbondinfo" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bondicon" }, { children: _jsxs("div", __assign({ className: "icon-container" }, { children: [_jsx(Svg, { width: 18, height: 18, icon: (_d = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[userBill.bond.chainId]) !== null && _d !== void 0 ? _d : 'question' }), _jsx(TokenImage, { symbol: (_e = userBill.bond.showcaseTokenName) !== null && _e !== void 0 ? _e : userBill.bond.payoutTokenName, size: 40 })] })) })), _jsx(Flex, __assign({ className: "title-container tokenname" }, { children: _jsx(StyledHeadingText, { children: (_f = userBill.bond) === null || _f === void 0 ? void 0 : _f.showcaseTokenName }) })), _jsx(Flex, __assign({ className: "title-container tokentags" }, { children: (_g = userBill.bond.tags) === null || _g === void 0 ? void 0 : _g.slice(0, 1).map(function (tag) {
135
+ return (_jsx(Flex, __assign({ sx: { marginRight: '10px' } }, { children: _jsx(ListTag, { variant: tag === 'Cex Fund' ? 'cex_fund' : 'liquidity', text: tag === null || tag === void 0 ? void 0 : tag.toUpperCase() }) }), tag));
136
+ }) })), _jsxs(Text, __assign({ sx: { color: 'text', opacity: '0.6', fontSize: ['12px', '12px', '12px', '16px'] } }, { children: ["#", userBill.id] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo blocks-container" }, { children: [_jsx(Flex, __assign({ className: "yourbondinfo-block attributes" }, { children: _jsxs(Flex, __assign({ sx: { flexDirection: 'column', width: '100%' } }, { children: [_jsxs(Flex, __assign({ sx: {
137
+ justifyContent: 'space-between',
138
+ height: '24px',
139
+ background: 'white3',
140
+ px: '15px',
141
+ borderRadius: "".concat(isOpenTraits ? '6px 6px 0px 0px' : 'normal'),
142
+ display: ['none', 'none', 'none', 'flex'],
143
+ }, onClick: function () { return setIsOpenTraits(!isOpenTraits); } }, { children: [_jsxs(Flex, __assign({ sx: { gap: '10px', alignItems: 'center' } }, { children: [_jsx(Svg, { icon: "tag", direction: "down" }), _jsx(Text, __assign({ sx: { fontSize: '12px', fontWeight: 400, color: 'text', opacity: '0.6' } }, { children: "Traits" }))] })), _jsx(Svg, { icon: "caret", direction: isOpenTraits ? 'up' : 'down' })] })), _jsx(AnimatePresence, { children: isOpenTraits && (_jsx(motion.div, __assign({ initial: { height: 0 }, animate: { height: 'fit-content' }, transition: { opacity: { duration: 0.2 } }, exit: { height: 0 }, sx: { overflow: 'hidden', width: '100%' } }, { children: _jsx(Flex, __assign({ sx: { flexDirection: 'column', gap: '1px' } }, { children: attributes
144
+ ? attributes.map(function (a) { return (_jsxs(TraitsContentContainer, { children: [_jsx(Text, __assign({ sx: { fontSize: '10px', fontWeight: 500 } }, { children: a === null || a === void 0 ? void 0 : a.trait_type })), _jsx(Text, __assign({ sx: { fontSize: '10px', fontWeight: 500 } }, { children: a === null || a === void 0 ? void 0 : a.value }))] }, a.value)); })
145
+ : BILL_ATTRIBUTES.map(function (attrib) {
146
+ return (_jsxs(TraitsContentContainer, { children: [_jsx(Text, __assign({ sx: { fontSize: '10px', fontWeight: 500 } }, { children: attrib })), _jsx(Skeleton, { width: "150px" })] }, attrib));
147
+ }) })) }))) })] })) })), _jsxs(Flex, __assign({ className: "yourbondinfo-block row-vested" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo-block header" }, { children: [_jsx(Flex, __assign({ className: "yourbondinfo-block header-title" }, { children: "Fully Vested" })), _jsx(Flex, __assign({ className: "yourbondinfo-block header-tooltip" }, { children: _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: UserBillTooltipText.FullyVested }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) })) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block info" }, { children: [_jsx(Flex, { className: "block-info icon" }), _jsx(Flex, __assign({ className: "block-info text" }, { children: _jsx(Text, __assign({ sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 } }, { children: getPendingVesting(userBill.lastBlockTimestamp, userBill.vesting) })) }))] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block row-pending" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo-block header" }, { children: [_jsx(Flex, __assign({ className: "yourbondinfo-block header-title" }, { children: "Pending" })), _jsx(Flex, __assign({ className: "yourbondinfo-block header-tooltip" }, { children: _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: UserBillTooltipText.Pending }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) })) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block info" }, { children: [_jsx(Flex, __assign({ className: "block-info icon" }, { children: _jsxs("div", __assign({ className: "icon-container-small" }, { children: [_jsx(Svg, { width: 10, height: 10, icon: (_h = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[userBill.bond.chainId]) !== null && _h !== void 0 ? _h : 'question' }), _jsx(TokenImage, { symbol: (_j = userBill.bond.showcaseTokenName) !== null && _j !== void 0 ? _j : userBill.bond.payoutTokenName, size: 25 })] })) })), _jsxs(Flex, __assign({ className: "block-info text" }, { children: [_jsx(Text, __assign({ sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 } }, { children: formatNumberSI(parseFloat(totalPending(userBill).toFixed(4)), 4) })), _jsx(Text, __assign({ sx: { fontSize: ['10px', '10px', '10px', '12px'], fontWeight: [500, 500, 500, 400], paddingLeft: '10px' } }, { children: "($".concat((totalPending(userBill) * ((_k = parseFloat(earnTokenPrice(userBill.bond))) !== null && _k !== void 0 ? _k : 0)).toFixed(2), ")") }))] }))] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block row-claimable" }, { children: [_jsxs(Flex, __assign({ className: "yourbondinfo-block header" }, { children: [_jsx(Flex, __assign({ className: "yourbondinfo-block header-title" }, { children: "Claimable" })), _jsx(Flex, __assign({ className: "yourbondinfo-block header-tooltip" }, { children: _jsx(TooltipBubble, __assign({ body: _jsx(Flex, { children: UserBillTooltipText.Claimable }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)" }, { children: _jsx(Flex, __assign({ className: "block-header icon" }, { children: _jsx(Svg, { icon: "questionCircle", width: "12px" }) })) })) }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo-block info" }, { children: [_jsx(Flex, __assign({ className: "block-info icon" }, { children: _jsxs("div", __assign({ className: "icon-container-small" }, { children: [_jsx(Svg, { width: 10, height: 10, icon: (_l = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[userBill.bond.chainId]) !== null && _l !== void 0 ? _l : 'question' }), _jsx(TokenImage, { symbol: (_m = userBill.bond.showcaseTokenName) !== null && _m !== void 0 ? _m : userBill.bond.payoutTokenName, size: 25 })] })) })), _jsxs(Flex, __assign({ className: "block-info text" }, { children: [_jsx(Text, __assign({ sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 } }, { children: formatNumberSI(parseFloat(claimable(userBill).toFixed(4)), 4) })), _jsx(Text, __assign({ sx: { fontSize: ['10px', '10px', '10px', '12px'], fontWeight: [500, 500, 500, 400], paddingLeft: '10px' } }, { children: "($".concat((claimable(userBill) * ((_o = parseFloat(earnTokenPrice(userBill.bond))) !== null && _o !== void 0 ? _o : 0)).toFixed(2), ")") }))] }))] }))] }))] })), _jsxs(Flex, __assign({ className: "yourbondinfo button-container" }, { children: [_jsx(Flex, __assign({ className: "button-container claim" }, { children: _jsx(Button, { children: "CLAIM" }) })), _jsx(Flex, __assign({ className: "button-container transfer" }, { children: _jsx(Button, __assign({ variant: "secondary" }, { children: "TRANSFER" })) }))] }))] }))] }))] })) })) }, userBill.bond.billAddress)) : null;
148
+ }) })) })));
149
+ };
150
+ export default YourBondsModal;
@@ -3,7 +3,7 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
3
3
  return cooked;
4
4
  };
5
5
  import styled from "@emotion/styled";
6
- import { Flex, Text } from "../uikit-sdk";
6
+ import { Flex, Text } from "../../uikit-sdk";
7
7
  export var StyledHeadingText = styled(Text)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n font-size: 12px;\n align-self: center;\n @media screen and (min-width: 1180px) {\n font-size: 22px;\n }\n"], ["\n font-size: 12px;\n align-self: center;\n @media screen and (min-width: 1180px) {\n font-size: 22px;\n }\n"])));
8
8
  export var TraitsContentContainer = styled(Flex)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n justify-content: space-between;\n background: ", ";\n padding: 0px 15px;\n &:last-child {\n border-radius: 0px 0px 6px 6px;\n }\n @media screen and (max-width: 667px) {\n :first-of-type {\n border-radius: 6px 6px 0px 0px;\n }\n }\n"], ["\n justify-content: space-between;\n background: ", ";\n padding: 0px 15px;\n &:last-child {\n border-radius: 0px 0px 6px 6px;\n }\n @media screen and (max-width: 667px) {\n :first-of-type {\n border-radius: 6px 6px 0px 0px;\n }\n }\n"])), function (_a) {
9
9
  var theme = _a.theme;
@@ -62,9 +62,9 @@ import { getBalanceNumber } from '../../utils/getBalanceNumber';
62
62
  import { MAINNET_CHAINS, NETWORK_ICONS } from '../../config/constants/chains';
63
63
  import { getPendingVesting } from '../../hooks/usePendingVesting';
64
64
  import { formatNumberSI } from '../../utils/formatNumber';
65
- import { fetchUserOwnedBillsDataAsync } from '../YourBonds/fetchBillsUser';
66
- import { StyledHeadingText, TraitsContentContainer } from './styles';
65
+ import { StyledHeadingText, TraitsContentContainer } from '../Modals/YourBondsModal/styles';
67
66
  import { AnimatePresence, motion } from 'framer-motion';
67
+ import { fetchUserOwnedBillsDataAsync } from '../../pages/YourBonds/fetchBillsUser';
68
68
  var YourBondsModal = function (_a) {
69
69
  var isOpen = _a.isOpen, onClose = _a.onClose, bondAddress = _a.bondAddress;
70
70
  if (!isOpen)
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import Bonds from './components/Bonds/Bonds';
2
- import BondSingle from './components/BondSingle/BondSingle';
3
- import BondModal from './components/BondModal/BondModal';
4
- import YourBonds from './components/YourBonds/YourBonds';
5
- import YourBondsModal from './components/YourBondsModal/YourBondsModal';
1
+ import Bonds from './pages/Bonds/Bonds';
2
+ import BondSingle from './pages/BondSingle/BondSingle';
3
+ import YourBonds from './pages/YourBonds/YourBonds';
4
+ import BondModal from './components/Modals/BondModal/BondModal';
5
+ import YourBondsModal from './components/Modals/YourBondsModal/YourBondsModal';
6
6
  export { Bonds, BondSingle, BondModal, YourBonds, YourBondsModal };
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // src/index.ts
2
- import Bonds from './components/Bonds/Bonds';
3
- import BondSingle from './components/BondSingle/BondSingle';
4
- import BondModal from './components/BondModal/BondModal';
5
- import YourBonds from './components/YourBonds/YourBonds';
6
- import YourBondsModal from './components/YourBondsModal/YourBondsModal';
2
+ import Bonds from './pages/Bonds/Bonds';
3
+ import BondSingle from './pages/BondSingle/BondSingle';
4
+ import YourBonds from './pages/YourBonds/YourBonds';
5
+ import BondModal from './components/Modals/BondModal/BondModal';
6
+ import YourBondsModal from './components/Modals/YourBondsModal/YourBondsModal';
7
7
  export { Bonds, BondSingle, BondModal, YourBonds, YourBondsModal };
@@ -22,10 +22,10 @@ import { BigNumber } from 'bignumber.js';
22
22
  import { getFirstNonZeroDigits } from '../../utils/roundNumber';
23
23
  import { useParams } from 'react-router-dom';
24
24
  import { isNumber } from '../../utils/numbers';
25
- import { Button, ListTag, Svg, TooltipBubble } from '../uikit-sdk';
25
+ import { Button, ListTag, Svg, TooltipBubble } from '../../components/uikit-sdk';
26
26
  import { TooltipText } from '../../enum/tooltips';
27
27
  import { formatNumberSI } from '../../utils/formatNumber';
28
- import TokenImage from '../uikit-sdk/TokenImage';
28
+ import TokenImage from '../../components/uikit-sdk/TokenImage';
29
29
  var BondSingle = function (_a) {
30
30
  var billAddress = useParams().billAddress;
31
31
  var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
@@ -68,9 +68,9 @@ import { BigNumber } from 'bignumber.js';
68
68
  import { ChainId } from '../../enum/apeswaplists';
69
69
  import { formatValue } from '../../utils/formatNumbers';
70
70
  import { BLOCK_EXPLORER } from '../../config/constants/chains';
71
- import BondRowsByChain from './BondRows/BondRowsByChain';
72
71
  import '../../scss/Bonds.scss';
73
- import BondRowsHeader from './BondRows/BondRowHeader';
72
+ import BondRowHeader from '../../components/BondRows/BondRowHeader';
73
+ import BondRowsByChain from '../../components/BondRows/BondRowsByChain';
74
74
  var Bonds = function (_a) {
75
75
  var connectionString = _a.connectionString;
76
76
  var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
@@ -267,6 +267,6 @@ var Bonds = function (_a) {
267
267
  setBondsRendered(true);
268
268
  }
269
269
  }, [filteredBonds]);
270
- return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), bondsRendered && (_jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsx(BondRowsHeader, { inputValue: inputValue, onInputChange: handleInputChange, onSort: handleSort }), _jsx(BondRowsByChain, { bonds: filteredBonds, hotBonds: hotBonds, rowClick: rowClick })] })))] })));
270
+ return (_jsxs(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: [isActive && account && _jsx("p", { children: account }), isActive && account && _jsx("button", __assign({ onClick: handleApprove }, { children: "Approve USDT" })), bondsRendered && (_jsxs(Flex, __assign({ className: "container table-container" }, { children: [_jsx(BondRowHeader, { inputValue: inputValue, onInputChange: handleInputChange, onSort: handleSort }), _jsx(BondRowsByChain, { bonds: filteredBonds, hotBonds: hotBonds, rowClick: rowClick })] })))] })));
271
271
  };
272
272
  export default Bonds;
@@ -65,9 +65,9 @@ import getTimePeriods from '../../utils/getTimePeriods';
65
65
  import { defaultTheme } from '../../theme';
66
66
  import '../../scss/YourBonds.scss';
67
67
  import { BigNumber } from 'bignumber.js';
68
- import { Text, Button, Svg } from '../uikit-sdk';
68
+ import { Text, Button, Svg } from '../../components/uikit-sdk';
69
69
  import { MAINNET_CHAINS } from '../../config/constants/chains';
70
- import TokenInfoAndName from '../TokenInfoAndName';
70
+ import TokenInfoAndName from '../../components/TokenInfoAndName';
71
71
  import { getBalanceNumber } from '../../utils/getBalanceNumber';
72
72
  import { getFirstNonZeroDigits } from '../../utils/roundNumber';
73
73
  import { formatNumberSI } from '../../utils/formatNumber';
@@ -75,7 +75,7 @@ import useCurrentTime from '../../hooks/useTimer';
75
75
  import { getPendingVesting } from '../../hooks/usePendingVesting';
76
76
  import axios from 'axios';
77
77
  import { fetchUserOwnedBillsDataAsync } from './fetchBillsUser';
78
- import { Input } from '../uikit-sdk/Input';
78
+ import { Input } from '../../components/uikit-sdk/Input';
79
79
  var YourBonds = function (_a) {
80
80
  var connectionString = _a.connectionString;
81
81
  var _b = useWeb3React(), account = _b.account, isActive = _b.isActive;
@@ -8,7 +8,7 @@
8
8
  padding-left: 15px;
9
9
  padding-right: 15px;
10
10
  padding-bottom: 5px;
11
- font-size: 12px;
11
+ font-size: 11px;
12
12
  color: #73728E;
13
13
  }
14
14
 
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": "1.0.453",
6
+ "version": "1.0.455",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",
File without changes