@ape.swap/bonds-sdk 1.0.474 → 1.0.476

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.
@@ -1,4 +1,4 @@
1
- declare const useClaimBill: (billAddress: string, billIds: string[]) => {
1
+ declare const useClaimBill: (billAddress: string, billIds: string[], chainId: number) => {
2
2
  onClaimBill: () => Promise<import("ethers").ContractTransaction>;
3
3
  };
4
4
  export default useClaimBill;
@@ -35,12 +35,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
35
35
  }
36
36
  };
37
37
  import { useCallback } from 'react';
38
- // import { useBillType } from './useBillType'
39
- import { useWeb3React } from '@web3-react/core';
40
38
  import { useBondContract } from '../hooks/useContract';
41
39
  // Claim a Bill
42
- var useClaimBill = function (billAddress, billIds) {
43
- var chainId = useWeb3React().chainId;
40
+ var useClaimBill = function (billAddress, billIds, chainId) {
41
+ //const { chainId } = useWeb3React()
44
42
  var bondContract = useBondContract(billAddress);
45
43
  // const billType = useBillType(billAddress)
46
44
  var handleClaimBill = useCallback(function () { return __awaiter(void 0, void 0, void 0, function () {
@@ -50,6 +48,8 @@ var useClaimBill = function (billAddress, billIds) {
50
48
  case 0: return [4 /*yield*/, bondContract.batchRedeem(billIds)];
51
49
  case 1:
52
50
  tx = _a.sent();
51
+ console.log('HANDLECLAIMBILL TX');
52
+ console.log(tx);
53
53
  return [2 /*return*/, tx];
54
54
  }
55
55
  });
@@ -82,7 +82,7 @@ var YourBonds = function (_a) {
82
82
  //const toastError = useToastError()
83
83
  // const { onClaimBill } = useClaimBill(billAddress, billIds)
84
84
  var _b = useState(false), pendingTrx = _b[0], setPendingTrx = _b[1];
85
- var handleClaim = function (billAddress, billIds, event) { return __awaiter(void 0, void 0, void 0, function () {
85
+ var handleClaim = function (billAddress, billIds, chainId, event) { return __awaiter(void 0, void 0, void 0, function () {
86
86
  var onClaimBill;
87
87
  return __generator(this, function (_a) {
88
88
  switch (_a.label) {
@@ -90,7 +90,7 @@ var YourBonds = function (_a) {
90
90
  event === null || event === void 0 ? void 0 : event.stopPropagation();
91
91
  if (!accountChainId || !account)
92
92
  return [2 /*return*/];
93
- onClaimBill = useClaimBill(billAddress, billIds).onClaimBill;
93
+ onClaimBill = useClaimBill(billAddress, billIds, chainId).onClaimBill;
94
94
  setPendingTrx(true);
95
95
  return [4 /*yield*/, onClaimBill().catch(function (e) {
96
96
  console.error(e);
@@ -305,9 +305,9 @@ var YourBonds = function (_a) {
305
305
  } }, { children: "CLAIM ALL" })) }))] }))] })), filteredBonds.map(function (bill) {
306
306
  var _a, _b;
307
307
  return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill); } }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-claimable" }, { children: [formatNumberSI(parseFloat(claimable(bill).toFixed(3)), 0), _jsx(Text, __assign({ 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, __assign({ className: "column column-pending" }, { children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), _jsx(Text, __assign({ 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, __assign({ className: "column column-terms" }, { children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") })), _jsx(Flex, __assign({ className: "column column-claimall" }, { children: _jsx(Button, __assign({ disabled: !account && (claimableNumber(bill) === 0), onClick: function (event) {
308
- event.stopPropagation();
308
+ // event.stopPropagation();
309
309
  // Add your claim logic here
310
- handleClaim(bill.bond.billAddress, [bill.id], event);
310
+ handleClaim(bill.bond.billAddress, [bill.id], bill.bond.chainId, event);
311
311
  }, sx: {
312
312
  height: ['36px', '36px', '36px', '26px'],
313
313
  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.474",
6
+ "version": "1.0.476",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",