@ape.swap/bonds-sdk 1.0.604 → 1.0.605
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.
|
@@ -61,15 +61,13 @@ var BondModal = function (_a) {
|
|
|
61
61
|
if (!isOpen)
|
|
62
62
|
return null;
|
|
63
63
|
var _b = useWriteContract(), hash = _b.data, isPending = _b.isPending, writeContract = _b.writeContract, writeContractAsync = _b.writeContractAsync;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
});
|
|
72
|
-
}); };
|
|
64
|
+
// const transactionReceipt = async (txHash: `0x${string}`) => {
|
|
65
|
+
// return useWaitForTransactionReceipt({
|
|
66
|
+
// confirmations: 4,
|
|
67
|
+
// hash: txHash,
|
|
68
|
+
// pollingInterval: 1_000
|
|
69
|
+
// });
|
|
70
|
+
// }
|
|
73
71
|
var _c = useState([]), bondData = _c[0], setBondData = _c[1];
|
|
74
72
|
//This is a temp solution, but we will force approval each time, and then once set we will set status here and allow
|
|
75
73
|
//user to buy
|
|
@@ -124,7 +122,7 @@ var BondModal = function (_a) {
|
|
|
124
122
|
decimals = tokenDecimals !== null && tokenDecimals !== void 0 ? tokenDecimals : 18;
|
|
125
123
|
_a.label = 1;
|
|
126
124
|
case 1:
|
|
127
|
-
_a.trys.push([1,
|
|
125
|
+
_a.trys.push([1, 3, , 4]);
|
|
128
126
|
amount = convertToTokenValue(inputValue, decimals);
|
|
129
127
|
console.log('Amount:', amount);
|
|
130
128
|
return [4 /*yield*/, writeContractAsync({
|
|
@@ -135,9 +133,12 @@ var BondModal = function (_a) {
|
|
|
135
133
|
})];
|
|
136
134
|
case 2:
|
|
137
135
|
tx = _a.sent();
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
receipt = useWaitForTransactionReceipt({
|
|
137
|
+
confirmations: 4,
|
|
138
|
+
hash: tx,
|
|
139
|
+
pollingInterval: 1000
|
|
140
|
+
});
|
|
141
|
+
;
|
|
141
142
|
if (receipt.isSuccess) {
|
|
142
143
|
setReceiptTx(receipt.data.transactionHash);
|
|
143
144
|
console.log('Receipt:', receipt);
|
|
@@ -146,13 +147,13 @@ var BondModal = function (_a) {
|
|
|
146
147
|
setApproveTx(tx);
|
|
147
148
|
console.log('setApproveTx:', tx);
|
|
148
149
|
}
|
|
149
|
-
return [3 /*break*/,
|
|
150
|
-
case
|
|
150
|
+
return [3 /*break*/, 4];
|
|
151
|
+
case 3:
|
|
151
152
|
error_2 = _a.sent();
|
|
152
153
|
console.error('Approval failed:', error_2);
|
|
153
154
|
alert('Approval Failed');
|
|
154
|
-
return [3 /*break*/,
|
|
155
|
-
case
|
|
155
|
+
return [3 /*break*/, 4];
|
|
156
|
+
case 4: return [2 /*return*/];
|
|
156
157
|
}
|
|
157
158
|
});
|
|
158
159
|
}); };
|