@ape.swap/bonds-sdk 1.0.461 → 1.0.463
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.
|
@@ -116,9 +116,9 @@ var BondModal = function (_a) {
|
|
|
116
116
|
//You approve the token, not the contract (this code will have to be updated for zap)
|
|
117
117
|
var handleApprove = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
118
118
|
var provider, signer, bondContract, amount, tx, error_2;
|
|
119
|
-
var _a;
|
|
120
|
-
return __generator(this, function (
|
|
121
|
-
switch (
|
|
119
|
+
var _a, _b, _c;
|
|
120
|
+
return __generator(this, function (_d) {
|
|
121
|
+
switch (_d.label) {
|
|
122
122
|
case 0:
|
|
123
123
|
console.log('handle approve clicked');
|
|
124
124
|
if (!window.ethereum) {
|
|
@@ -126,25 +126,26 @@ var BondModal = function (_a) {
|
|
|
126
126
|
alert('No Ethereum provider found');
|
|
127
127
|
return [2 /*return*/];
|
|
128
128
|
}
|
|
129
|
-
console.log(
|
|
129
|
+
console.log('---');
|
|
130
|
+
console.log((_a = bondData[0]) === null || _a === void 0 ? void 0 : _a.principalToken);
|
|
130
131
|
provider = new ethers.providers.Web3Provider(window.ethereum);
|
|
131
132
|
signer = provider.getSigner();
|
|
132
|
-
bondContract = new ethers.Contract((
|
|
133
|
-
|
|
133
|
+
bondContract = new ethers.Contract((_c = (_b = bondData[0]) === null || _b === void 0 ? void 0 : _b.principalToken) !== null && _c !== void 0 ? _c : "", ERC_20_ABI, signer);
|
|
134
|
+
_d.label = 1;
|
|
134
135
|
case 1:
|
|
135
|
-
|
|
136
|
+
_d.trys.push([1, 4, , 5]);
|
|
136
137
|
amount = adjustDecimals(inputValue);
|
|
137
138
|
return [4 /*yield*/, bondContract.approve(bondAddress, amount)];
|
|
138
139
|
case 2:
|
|
139
|
-
tx =
|
|
140
|
+
tx = _d.sent();
|
|
140
141
|
return [4 /*yield*/, tx.wait()];
|
|
141
142
|
case 3:
|
|
142
|
-
|
|
143
|
+
_d.sent();
|
|
143
144
|
setApprovalStatus(true);
|
|
144
145
|
alert('Approve Successful');
|
|
145
146
|
return [3 /*break*/, 5];
|
|
146
147
|
case 4:
|
|
147
|
-
error_2 =
|
|
148
|
+
error_2 = _d.sent();
|
|
148
149
|
console.error('Approval error', error_2);
|
|
149
150
|
alert('Approval Failed');
|
|
150
151
|
return [3 /*break*/, 5];
|