@ape.swap/bonds-sdk 1.0.550 → 1.0.552
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 { useWriteContract } from 'wagmi';
|
|
69
70
|
var YourBonds = function (_a) {
|
|
70
71
|
//const toastError = useToastError()
|
|
71
72
|
// const { onClaimBill } = useClaimBill(billAddress, billIds)
|
|
@@ -85,31 +86,35 @@ var YourBonds = function (_a) {
|
|
|
85
86
|
// });
|
|
86
87
|
// setPendingTrx(false);
|
|
87
88
|
// };
|
|
89
|
+
var writeContract = useWriteContract().writeContract;
|
|
88
90
|
var handleClaim = function (billId, billAddress) { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
-
var tx, error_1;
|
|
91
|
+
var address, tx, error_1;
|
|
90
92
|
return __generator(this, function (_a) {
|
|
91
93
|
switch (_a.label) {
|
|
92
94
|
case 0:
|
|
93
|
-
|
|
95
|
+
address = billAddress;
|
|
96
|
+
_a.label = 1;
|
|
97
|
+
case 1:
|
|
98
|
+
_a.trys.push([1, 3, , 4]);
|
|
94
99
|
//const uint256BillId = ethers.BigNumber.from(billId);
|
|
95
100
|
console.log('claimClicked');
|
|
96
101
|
// console.log('billId:', uint256BillId);
|
|
97
102
|
console.log('billAddress:', billAddress);
|
|
98
103
|
return [4 /*yield*/, writeContract({
|
|
99
|
-
address:
|
|
104
|
+
address: address,
|
|
100
105
|
abi: BOND_ABI,
|
|
101
106
|
functionName: 'redeem',
|
|
102
107
|
args: [billId],
|
|
103
108
|
})];
|
|
104
|
-
case
|
|
109
|
+
case 2:
|
|
105
110
|
tx = _a.sent();
|
|
106
111
|
console.log('Transaction:', tx);
|
|
107
|
-
return [3 /*break*/,
|
|
108
|
-
case
|
|
112
|
+
return [3 /*break*/, 4];
|
|
113
|
+
case 3:
|
|
109
114
|
error_1 = _a.sent();
|
|
110
115
|
console.error('Approval failed:', error_1);
|
|
111
|
-
return [3 /*break*/,
|
|
112
|
-
case
|
|
116
|
+
return [3 /*break*/, 4];
|
|
117
|
+
case 4: return [2 /*return*/];
|
|
113
118
|
}
|
|
114
119
|
});
|
|
115
120
|
}); };
|