@ape.swap/bonds-sdk 1.0.462 → 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) {
|
|
@@ -127,25 +127,25 @@ var BondModal = function (_a) {
|
|
|
127
127
|
return [2 /*return*/];
|
|
128
128
|
}
|
|
129
129
|
console.log('---');
|
|
130
|
-
console.log(bondData);
|
|
130
|
+
console.log((_a = bondData[0]) === null || _a === void 0 ? void 0 : _a.principalToken);
|
|
131
131
|
provider = new ethers.providers.Web3Provider(window.ethereum);
|
|
132
132
|
signer = provider.getSigner();
|
|
133
|
-
bondContract = new ethers.Contract((
|
|
134
|
-
|
|
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;
|
|
135
135
|
case 1:
|
|
136
|
-
|
|
136
|
+
_d.trys.push([1, 4, , 5]);
|
|
137
137
|
amount = adjustDecimals(inputValue);
|
|
138
138
|
return [4 /*yield*/, bondContract.approve(bondAddress, amount)];
|
|
139
139
|
case 2:
|
|
140
|
-
tx =
|
|
140
|
+
tx = _d.sent();
|
|
141
141
|
return [4 /*yield*/, tx.wait()];
|
|
142
142
|
case 3:
|
|
143
|
-
|
|
143
|
+
_d.sent();
|
|
144
144
|
setApprovalStatus(true);
|
|
145
145
|
alert('Approve Successful');
|
|
146
146
|
return [3 /*break*/, 5];
|
|
147
147
|
case 4:
|
|
148
|
-
error_2 =
|
|
148
|
+
error_2 = _d.sent();
|
|
149
149
|
console.error('Approval error', error_2);
|
|
150
150
|
alert('Approval Failed');
|
|
151
151
|
return [3 /*break*/, 5];
|