@ape.swap/bonds-sdk 1.0.618 → 1.0.620

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.
@@ -154,8 +154,8 @@ var BondModal = function (_a) {
154
154
  var _g = useState(null), toastMessage = _g[0], setToastMessage = _g[1];
155
155
  useEffect(function () {
156
156
  if (isConfirmed) {
157
- setToastMessage("Transaction complete");
158
- setTimeout(function () { return setToastMessage(null); }, 5000); // Hide toast after 5 seconds
157
+ setToastMessage("Transaction complete.");
158
+ setTimeout(function () { return setToastMessage(null); }, 10000);
159
159
  }
160
160
  }, [approveTx, buyTx, isConfirmed]);
161
161
  var _h = useState(null), tokenBalance = _h[0], setTokenBalance = _h[1];
@@ -51,7 +51,7 @@ import { getPendingVesting } from '../../../hooks/usePendingVesting';
51
51
  import { formatNumberSI } from '../../../utils/formatNumber';
52
52
  import { StyledHeadingText, TraitsContentContainer } from './styles';
53
53
  import '../../../scss/YourBondsModal.scss';
54
- import { useWriteContract } from 'wagmi';
54
+ import { useWaitForTransactionReceipt, useWriteContract } from 'wagmi';
55
55
  import BOND_ABI from '../../../config/abi/bond.json';
56
56
  var YourBondsModal = function (_a) {
57
57
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
@@ -59,7 +59,12 @@ var YourBondsModal = function (_a) {
59
59
  if (!isOpen)
60
60
  return null;
61
61
  var _s = useWeb3React(), account = _s.account, chainId = _s.chainId, isActive = _s.isActive;
62
- var _t = useWriteContract(), hash = _t.data, isPending = _t.isPending, writeContract = _t.writeContract;
62
+ var _t = useWriteContract(), hash = _t.data, isPending = _t.isPending, writeContract = _t.writeContract, writeContractAsync = _t.writeContractAsync;
63
+ var _u = useWaitForTransactionReceipt({
64
+ confirmations: 4,
65
+ chainId: userBill === null || userBill === void 0 ? void 0 : userBill.bond.chainId,
66
+ hash: hash,
67
+ }), isConfirming = _u.isLoading, isConfirmed = _u.isSuccess;
63
68
  var handleClaim = function (billId, billAddress) { return __awaiter(void 0, void 0, void 0, function () {
64
69
  var address;
65
70
  return __generator(this, function (_a) {
@@ -82,17 +87,14 @@ var YourBondsModal = function (_a) {
82
87
  return [2 /*return*/];
83
88
  });
84
89
  }); };
85
- var _u = useState(null), claimTx = _u[0], setClaimTx = _u[1];
86
- var _v = useState(null), toastMessage = _v[0], setToastMessage = _v[1];
90
+ var _v = useState(null), claimTx = _v[0], setClaimTx = _v[1];
91
+ var _w = useState(null), toastMessage = _w[0], setToastMessage = _w[1];
87
92
  useEffect(function () {
88
93
  if (claimTx) {
89
- setToastMessage("Transaction complete: ".concat(claimTx));
90
- setTimeout(function () { return setToastMessage(null); }, 5000); // Hide toast after 5 seconds
94
+ setToastMessage("Transaction complete.");
95
+ setTimeout(function () { return setToastMessage(null); }, 10000);
91
96
  }
92
- }, [claimTx]);
93
- // Fetch data for user owned bill
94
- var _w = useState([]), bondData = _w[0], setBondData = _w[1];
95
- var _x = useState([]), userOwnedBillsData = _x[0], setUserOwnedBillsData = _x[1];
97
+ }, [claimTx, isConfirmed]);
96
98
  // Functions to calculate display values for modal
97
99
  var totalPending = function (userBill) {
98
100
  var _a, _b, _c, _d;
@@ -107,8 +109,8 @@ var YourBondsModal = function (_a) {
107
109
  return getFirstNonZeroDigits(parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0'));
108
110
  };
109
111
  var BILL_ATTRIBUTES = ['The Legend', 'The Location', 'The Moment', 'The Trend', 'The Innovation'];
110
- var _y = useState(false), isOpenTraits = _y[0], setIsOpenTraits = _y[1];
111
- var _z = useState(false), billRendered = _z[0], setBillRendered = _z[1];
112
+ var _x = useState(false), isOpenTraits = _x[0], setIsOpenTraits = _x[1];
113
+ var _y = useState(false), billRendered = _y[0], setBillRendered = _y[1];
112
114
  var attributes = (_c = (_b = userBill.nftData) === null || _b === void 0 ? void 0 : _b.data.attributes) === null || _c === void 0 ? void 0 : _c.filter(function (attrib) { return BILL_ATTRIBUTES.includes(attrib.trait_type); });
113
115
  return (_jsx(_Fragment, { children: _jsx(React.Fragment, { children: _jsx(Flex, { className: "yourbondsmodal backdrop", children: _jsxs(Flex, { className: "yourbondsmodal content", children: [toastMessage && (_jsx(Flex, { className: "toast", children: toastMessage })), _jsx(Flex, { className: "yourbondsmodal header", children: _jsx(Flex, { className: "svg-close", onClick: onClose, children: _jsx(Svg, { icon: "close" }) }) }), _jsxs(Flex, { className: "yourbondsmodal table-container", children: [_jsx(Flex, { className: "yourbondsmodal bondimage", children: _jsx("img", { src: (_d = userBill.nftData) === null || _d === void 0 ? void 0 : _d.data.image }) }), _jsxs(Flex, { className: "yourbondsmodal yourbondinfo", children: [_jsxs(Flex, { className: "yourbondinfo title-container", children: [_jsx(Flex, { className: "title-container bondicon", children: _jsxs("div", { className: "icon-container", children: [_jsx(Svg, { width: 18, height: 18, icon: (_e = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[userBill.bond.chainId]) !== null && _e !== void 0 ? _e : 'question' }), _jsx(TokenImage, { symbol: (_f = userBill.bond.showcaseTokenName) !== null && _f !== void 0 ? _f : userBill.bond.payoutTokenName, size: 40 })] }) }), _jsx(Flex, { className: "title-container tokenname", children: _jsx(StyledHeadingText, { children: (_g = userBill.bond) === null || _g === void 0 ? void 0 : _g.showcaseTokenName }) }), _jsx(Flex, { className: "title-container tokentags", children: (_h = userBill.bond.tags) === null || _h === void 0 ? void 0 : _h.slice(0, 1).map(function (tag) {
114
116
  return (_jsx(Flex, { sx: { marginRight: '10px' }, children: _jsx(ListTag, { variant: tag === 'Cex Fund' ? 'cex_fund' : 'liquidity', text: tag === null || tag === void 0 ? void 0 : tag.toUpperCase() }) }, tag));
@@ -409,10 +409,11 @@
409
409
 
410
410
  .toast {
411
411
  position: fixed;
412
- bottom: 20px;
412
+ bottom: 50px;
413
413
  right: 20px;
414
- background-color: #333;
415
- color: #fff;
414
+ background-color: var(--theme-ui-colors-white2);
415
+ color: var(--theme-ui-colors-success);
416
+ font-size: 24px;
416
417
  padding: 10px 20px;
417
418
  border-radius: 5px;
418
419
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
@@ -422,10 +423,10 @@
422
423
 
423
424
  @keyframes fadein {
424
425
  from { bottom: 0; opacity: 0; }
425
- to { bottom: 20px; opacity: 1; }
426
+ to { bottom: 50px; opacity: 1; }
426
427
  }
427
428
 
428
429
  @keyframes fadeout {
429
- from { bottom: 20px; opacity: 1; }
430
+ from { bottom: 50px; opacity: 1; }
430
431
  to { bottom: 0; opacity: 0; }
431
432
  }
@@ -267,10 +267,11 @@
267
267
 
268
268
  .toast {
269
269
  position: fixed;
270
- bottom: 20px;
270
+ bottom: 50px;
271
271
  right: 20px;
272
- background-color: #333;
273
- color: #fff;
272
+ background-color: var(--theme-ui-colors-white2);
273
+ color: var(--theme-ui-colors-success);
274
+ font-size: 24px;
274
275
  padding: 10px 20px;
275
276
  border-radius: 5px;
276
277
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
@@ -280,10 +281,10 @@
280
281
 
281
282
  @keyframes fadein {
282
283
  from { bottom: 0; opacity: 0; }
283
- to { bottom: 20px; opacity: 1; }
284
+ to { bottom: 50px; opacity: 1; }
284
285
  }
285
286
 
286
287
  @keyframes fadeout {
287
- from { bottom: 20px; opacity: 1; }
288
+ from { bottom: 50px; opacity: 1; }
288
289
  to { bottom: 0; opacity: 0; }
289
290
  }
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.618",
6
+ "version": "1.0.620",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",