@ape.swap/bonds-sdk 1.0.545 → 1.0.547

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.
@@ -66,6 +66,7 @@ import { fetchUserOwnedBillsDataAsync } from './fetchBillsUser';
66
66
  import { Input } from '../../components/uikit-sdk/Input';
67
67
  import { YourBondsModal } from "../../index";
68
68
  import BOND_ABI from '../../config/abi/bond.json';
69
+ import { ethers } from 'ethers';
69
70
  var YourBonds = function (_a) {
70
71
  //const toastError = useToastError()
71
72
  // const { onClaimBill } = useClaimBill(billAddress, billIds)
@@ -85,8 +86,8 @@ var YourBonds = function (_a) {
85
86
  // });
86
87
  // setPendingTrx(false);
87
88
  // };
88
- var handleClaim = function (billId) { return __awaiter(void 0, void 0, void 0, function () {
89
- var tokenAddress, tx, error_1;
89
+ var handleClaim = function (billId, billAddress) { return __awaiter(void 0, void 0, void 0, function () {
90
+ var tokenAddress, uint256BillId, tx, error_1;
90
91
  return __generator(this, function (_a) {
91
92
  switch (_a.label) {
92
93
  case 0:
@@ -94,11 +95,15 @@ var YourBonds = function (_a) {
94
95
  _a.label = 1;
95
96
  case 1:
96
97
  _a.trys.push([1, 3, , 4]);
98
+ console.log('claimClicked');
99
+ console.log('billId:', billId);
100
+ console.log('billAddress:', billAddress);
101
+ uint256BillId = ethers.BigNumber.from(billId);
97
102
  return [4 /*yield*/, writeContract({
98
- address: tokenAddress,
103
+ address: billAddress,
99
104
  abi: BOND_ABI,
100
- functionName: 'redeem',
101
- args: [billId],
105
+ functionName: 'claim',
106
+ args: [uint256BillId],
102
107
  })];
103
108
  case 2:
104
109
  tx = _a.sent();
@@ -273,7 +278,7 @@ var YourBonds = function (_a) {
273
278
  return (_jsxs(Flex, { className: "container bondrow-container", onClick: function () { return rowClick(bill); }, children: [_jsx(Flex, { className: "column column-tokens", children: _jsx(Flex, { className: "column column-tokeninfoname", children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) }) }), _jsxs(Flex, { className: "column column-bondinfo", children: [_jsxs(Flex, { className: "column column-claimable", children: [formatNumberSI(parseFloat(claimable(bill).toFixed(3)), 0), _jsx(Text, { sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' }, children: "($".concat((claimable(bill) * ((_a = parseFloat(earnTokenPrice(bill.bond))) !== null && _a !== void 0 ? _a : 0)).toFixed(2), ")") })] }), _jsxs(Flex, { className: "column column-pending", children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), _jsx(Text, { sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' }, children: "($".concat((totalPending(bill) * ((_b = parseFloat(earnTokenPrice(bill.bond))) !== null && _b !== void 0 ? _b : 0)).toFixed(2), ")") })] }), _jsx(Flex, { className: "column column-terms", children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") }), _jsx(Flex, { className: "column column-claimall", children: _jsx(Button, { disabled: !account && (claimableNumber(bill) === 0), onClick: function (event) {
274
279
  event.stopPropagation();
275
280
  // Add your claim logic here
276
- handleClaim(bill.id);
281
+ handleClaim(bill.id, bill.address);
277
282
  }, sx: {
278
283
  height: ['36px', '36px', '36px', '26px'],
279
284
  lineHeight: '12px',
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.545",
6
+ "version": "1.0.547",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",