@ape.swap/bonds-sdk 1.0.504 → 1.0.505
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.
|
@@ -105,39 +105,35 @@ var BondModal = function (_a) {
|
|
|
105
105
|
}); };
|
|
106
106
|
//You approve the token, not the contract (this code will have to be updated for zap)
|
|
107
107
|
var handleApprove = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
108
|
-
var tokenAddress;
|
|
108
|
+
var tokenAddress, tx, error_2;
|
|
109
109
|
var _a;
|
|
110
110
|
return __generator(this, function (_b) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
111
|
+
switch (_b.label) {
|
|
112
|
+
case 0:
|
|
113
|
+
console.log('---!');
|
|
114
|
+
console.log((_a = bondData[0]) === null || _a === void 0 ? void 0 : _a.principalToken);
|
|
115
|
+
console.log(account);
|
|
116
|
+
tokenAddress = bondData[0].principalToken;
|
|
117
|
+
_b.label = 1;
|
|
118
|
+
case 1:
|
|
119
|
+
_b.trys.push([1, 3, , 4]);
|
|
120
|
+
console.log('BBBBB');
|
|
121
|
+
return [4 /*yield*/, writeContract({
|
|
122
|
+
address: tokenAddress,
|
|
123
|
+
abi: ERC_20_ABI,
|
|
124
|
+
functionName: 'approve',
|
|
125
|
+
args: [account, adjustDecimals(inputValue)],
|
|
126
|
+
})];
|
|
127
|
+
case 2:
|
|
128
|
+
tx = _b.sent();
|
|
129
|
+
console.log('Transaction:', tx);
|
|
130
|
+
return [3 /*break*/, 4];
|
|
131
|
+
case 3:
|
|
132
|
+
error_2 = _b.sent();
|
|
133
|
+
console.error('Approval failed:', error_2);
|
|
134
|
+
return [3 /*break*/, 4];
|
|
135
|
+
case 4: return [2 /*return*/];
|
|
116
136
|
}
|
|
117
|
-
console.log('---!');
|
|
118
|
-
console.log((_a = bondData[0]) === null || _a === void 0 ? void 0 : _a.principalToken);
|
|
119
|
-
//Here we need to approve the token, not the bond
|
|
120
|
-
// const provider = new ethers.providers.Web3Provider(window.ethereum);
|
|
121
|
-
// const signer = provider.getSigner();
|
|
122
|
-
//
|
|
123
|
-
// console.log(signer)
|
|
124
|
-
console.log(account);
|
|
125
|
-
tokenAddress = bondData[0].principalToken;
|
|
126
|
-
//
|
|
127
|
-
// const { writeAsync, isLoading, isSuccess, error } = useContractWrite({
|
|
128
|
-
// addressOrName: tokenAddress,
|
|
129
|
-
// contractInterface: ERC_20_ABI,
|
|
130
|
-
// functionName: 'approve',
|
|
131
|
-
// args: [account, adjustDecimals(inputValue)],
|
|
132
|
-
// });
|
|
133
|
-
// @ts-ignore
|
|
134
|
-
writeContract({
|
|
135
|
-
address: tokenAddress,
|
|
136
|
-
abi: ERC_20_ABI,
|
|
137
|
-
functionName: 'approve',
|
|
138
|
-
args: [account, adjustDecimals(inputValue)],
|
|
139
|
-
});
|
|
140
|
-
return [2 /*return*/];
|
|
141
137
|
});
|
|
142
138
|
}); };
|
|
143
139
|
// Fetch data
|