@ape.swap/bonds-sdk 1.0.327 → 1.0.329

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.
@@ -56,7 +56,8 @@ import getTimePeriods from '../../utils/getTimePeriods';
56
56
  import axios from 'axios';
57
57
  import { BigNumber } from 'bignumber.js';
58
58
  import { getFirstNonZeroDigits } from '../../utils/roundNumber';
59
- import { Button, Svg, ListTag } from '../uikit-sdk';
59
+ import { TooltipBubble, Button, Svg, ListTag } from '../uikit-sdk';
60
+ import { UserBillTooltipText } from '../../enum/tooltips';
60
61
  import billAbi from '../../config/abi/bond.json';
61
62
  import TokenImage from '../uikit-sdk/TokenImage';
62
63
  import { getBalanceNumber } from '../../utils/getBalanceNumber';
@@ -64,6 +65,8 @@ import multicall from '../../utils/multicall';
64
65
  import { BillVersion } from '../../enum/apeswaplists';
65
66
  import { ACF_TO_ABOND } from '../../config/constants/addresses';
66
67
  import { MAINNET_CHAINS } from '../../config/constants/chains';
68
+ import { getPendingVesting } from '../../hooks/usePendingVesting';
69
+ import { formatNumberSI } from '../../utils/formatNumber';
67
70
  var YourBondsModal = function (_a) {
68
71
  var isOpen = _a.isOpen, onClose = _a.onClose, bondAddress = _a.bondAddress;
69
72
  if (!isOpen)
@@ -232,11 +235,11 @@ var YourBondsModal = function (_a) {
232
235
  return getFirstNonZeroDigits(parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0'));
233
236
  };
234
237
  return (_jsx(ThemeUIProvider, __assign({ theme: defaultTheme }, { children: userOwnedBillsData.flat().map(function (data) {
235
- var _a, _b, _c, _d, _e, _f;
238
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
236
239
  var userBill = data.userOwnedBills.find(function (bill) { return bill.bond.billAddress.toLowerCase() === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
237
240
  console.log("USER BILL LOG");
238
241
  console.log(userBill);
239
- return userBill ? (_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: [_jsx(Flex, __assign({ className: "modal-container bondimage" }, { children: "IMAGE" })), _jsxs(Flex, __assign({ className: "modal-container bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "modal-container title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bondicon" }, { children: _jsx(TokenImage, { symbol: (_a = userBill.bond.showcaseTokenName) !== null && _a !== void 0 ? _a : userBill.bond.payoutTokenName, size: 50 }) })), _jsx(Flex, __assign({ className: "title-container bondname" }, { children: (_b = userBill.bond) === null || _b === void 0 ? void 0 : _b.showcaseTokenName })), _jsx(Flex, __assign({ className: "title-container tokentags" }, { children: _jsx(ListTag, { text: (_d = (_c = userBill.bond) === null || _c === void 0 ? void 0 : _c.tags) === null || _d === void 0 ? void 0 : _d[0], variant: ((_f = (_e = userBill.bond) === null || _e === void 0 ? void 0 : _e.tags) === null || _f === void 0 ? void 0 : _f[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) }))] })), _jsxs(Flex, __assign({ className: "modal-container blocks-container" }, { children: [_jsx(Flex, __assign({ className: "modal-block column-discount" }, { children: _jsx(Flex, __assign({ className: "block-header header" }, { children: "Traits" })) })), _jsx(Flex, __assign({ className: "modal-block column-arr" }, { children: _jsx(Flex, __assign({ className: "block-header header" }, { children: "Fully Vested" })) })), _jsx(Flex, __assign({ className: "modal-block column-term" }, { children: _jsx(Flex, __assign({ className: "block-header header" }, { children: "Pending" })) })), _jsx(Flex, __assign({ className: "modal-block column-maxbuy" }, { children: _jsx(Flex, __assign({ className: "block-header header" }, { children: "Claimable" })) }))] })), _jsxs(Flex, __assign({ className: "modal-container button-container" }, { children: [_jsx(Flex, __assign({ className: "button-container get" }, { children: _jsx(Button, { children: "CLAIM" }) })), _jsx(Flex, __assign({ className: "button-container buy" }, { children: _jsx(Button, { children: "TRANSFER" }) }))] }))] }))] }))] })) })) }, userBill.bond.billAddress)) : null;
242
+ return userBill ? (_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: [_jsx(Flex, __assign({ className: "modal-container bondimage" }, { children: "IMAGE" })), _jsxs(Flex, __assign({ className: "modal-container bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "modal-container title-container" }, { children: [_jsx(Flex, __assign({ className: "title-container bondicon" }, { children: _jsx(TokenImage, { symbol: (_a = userBill.bond.showcaseTokenName) !== null && _a !== void 0 ? _a : userBill.bond.payoutTokenName, size: 40 }) })), _jsx(Flex, __assign({ className: "title-container bondname" }, { children: (_b = userBill.bond) === null || _b === void 0 ? void 0 : _b.showcaseTokenName })), _jsx(Flex, __assign({ className: "title-container tokentags" }, { children: _jsx(ListTag, { text: (_d = (_c = userBill.bond) === null || _c === void 0 ? void 0 : _c.tags) === null || _d === void 0 ? void 0 : _d[0], variant: ((_f = (_e = userBill.bond) === null || _e === void 0 ? void 0 : _e.tags) === null || _f === void 0 ? void 0 : _f[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) }))] })), _jsxs(Flex, __assign({ className: "modal-container blocks-container" }, { children: [_jsx(Flex, __assign({ className: "modal-block row-traits" }, { children: _jsx(Flex, __assign({ className: "modal-block header" }, { children: "Traits" })) })), _jsxs(Flex, __assign({ className: "modal-block row-vested" }, { children: [_jsxs(Flex, __assign({ className: "modal-block header" }, { children: ["Fully Vested", _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" }) })) }))] })), _jsx(Flex, __assign({ className: "modal-block info" }, { children: getPendingVesting(userBill.lastBlockTimestamp, userBill.vesting) }))] })), _jsxs(Flex, __assign({ className: "modal-block row-pending" }, { children: [_jsxs(Flex, __assign({ className: "modal-block header" }, { children: ["Pending", _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: "modal-block info" }, { children: [_jsx(TokenImage, { symbol: (_g = userBill.bond.showcaseTokenName) !== null && _g !== void 0 ? _g : userBill.bond.payoutTokenName, size: 25 }), formatNumberSI(parseFloat(totalPending(userBill).toFixed(4)), 4), "($".concat((totalPending(userBill) * ((_h = parseFloat(earnTokenPrice(userBill.bond))) !== null && _h !== void 0 ? _h : 0)).toFixed(2), ")")] }))] })), _jsxs(Flex, __assign({ className: "modal-block row-claimable" }, { children: [_jsxs(Flex, __assign({ className: "modal-block header" }, { children: ["Claimable", _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: "modal-block info" }, { children: [_jsx(TokenImage, { symbol: (_j = userBill.bond.showcaseTokenName) !== null && _j !== void 0 ? _j : userBill.bond.payoutTokenName, size: 25 }), formatNumberSI(parseFloat(claimable(userBill).toFixed(4)), 4), "($".concat((claimable(userBill) * ((_k = parseFloat(earnTokenPrice(userBill.bond))) !== null && _k !== void 0 ? _k : 0)).toFixed(2), ")")] }))] }))] })), _jsxs(Flex, __assign({ className: "modal-container 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, { children: "TRANSFER" }) }))] }))] }))] }))] })) })) }, userBill.bond.billAddress)) : null;
240
243
  }) })));
241
244
  };
242
245
  export default YourBondsModal;
@@ -6,3 +6,8 @@ export declare const TooltipText: {
6
6
  MaxBuy: (payoutToken: string) => string;
7
7
  Premium: string;
8
8
  };
9
+ export declare const UserBillTooltipText: {
10
+ FullyVested: string;
11
+ Pending: string;
12
+ Claimable: string;
13
+ };
@@ -6,3 +6,8 @@ export var TooltipText = {
6
6
  MaxBuy: function (payoutToken) { return "This is the maximum amount of ".concat(payoutToken, " you can currently purchase through this Bond."); },
7
7
  Premium: "This is the dollar value of the additional tokens you’ll receive at current market price.",
8
8
  };
9
+ export var UserBillTooltipText = {
10
+ FullyVested: "This is the time remaining until all tokens from the bond are available to claim.",
11
+ Pending: "This is the amount of unvested tokens that cannot be claimed yet.",
12
+ Claimable: "This is the amount of tokens that have vested and are available to claim."
13
+ };
@@ -108,9 +108,8 @@
108
108
  }
109
109
 
110
110
  .modal-block {
111
- min-width: 0px;
112
111
  display: flex;
113
- flex-direction: column;
112
+ flex-direction: row;
114
113
  align-items: center;
115
114
  background: var(--theme-ui-colors-white3);
116
115
  font-weight: 900;
@@ -121,11 +120,12 @@
121
120
  padding-bottom: 10px;
122
121
  }
123
122
 
124
- .block-header.header {
123
+ .modal-block.header {
125
124
  color: white;
126
125
  font-weight: bold;
127
126
  font-size: 12px;
128
127
  padding-bottom: 10px;
128
+ align-items: center;
129
129
  }
130
130
 
131
131
  .block-header.icon {
@@ -134,24 +134,48 @@
134
134
  cursor: pointer;
135
135
  }
136
136
 
137
- .modal-block.column-discount {
138
- width: 100%;
139
- flex-direction: column;
137
+ .modal-block.info {
138
+ flex-direction: row;
139
+ align-items: center;
140
+ justify-content: space-around;
140
141
  }
141
142
 
142
- .modal-block.column-arr {
143
- width: 100%;
144
- flex-direction: column;
143
+ .modal-block.row-traits {
144
+ flex-direction: row;
145
+ width: 400px;
146
+ margin-bottom: 10px;
147
+ align-items: center;
148
+ justify-content: start;
145
149
  }
146
150
 
147
- .modal-block.column-term {
148
- width: 100%;
149
- flex-direction: column;
151
+ .modal-block.row-vested {
152
+ flex-direction: row;
153
+ width: 400px;
154
+ margin-bottom: 10px;
155
+ padding-left: 10px;
156
+ padding-right: 10px;
157
+ align-items: center;
158
+ justify-content: space-between;
150
159
  }
151
160
 
152
- .modal-block.column-maxbuy {
153
- width: 100%;
154
- flex-direction: column;
161
+ .modal-block.row-pending {
162
+ flex-direction: row;
163
+ width: 400px;
164
+ margin-bottom: 10px;
165
+ padding-left: 10px;
166
+ padding-right: 10px;
167
+ align-items: center;
168
+ justify-content: space-between;
169
+ }
170
+
171
+ .modal-block.row-claimable {
172
+ flex-direction: row;
173
+ width: 400px;
174
+ margin-bottom: 10px;
175
+ padding-left: 10px;
176
+ padding-right: 10px;
177
+ align-items: center;
178
+ justify-content: space-between;
155
179
  }
156
180
 
157
181
  .modal-container.button-container {
@@ -162,21 +186,21 @@
162
186
  justify-content: space-between;
163
187
  }
164
188
 
165
- .button-container.get {
189
+ .button-container.claim {
166
190
  justify-content: center;
167
191
  align-items: center;
168
192
  cursor: pointer;
169
193
 
170
194
  Button {
171
- width: 275px;
195
+ width: 300px;
172
196
  }
173
197
  }
174
198
 
175
- .button-container.buy {
199
+ .button-container.transfer {
176
200
  justify-content: center;
177
201
  align-items: center;
178
202
 
179
203
  Button {
180
- width: 375px;
204
+ width: 100px;
181
205
  }
182
206
  }
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.327",
6
+ "version": "1.0.329",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",