@ape.swap/bonds-sdk 1.0.567 → 1.0.568
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.
|
@@ -71,7 +71,7 @@ var BondModal = function (_a) {
|
|
|
71
71
|
//user to buy
|
|
72
72
|
//Check with Fede if this needs to be temp, if we force approval everytime, isn't this fine?
|
|
73
73
|
var handleBuy = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
74
|
-
var billAddress, decimals, maxPrice, amount,
|
|
74
|
+
var billAddress, decimals, maxPrice, amount, error_1;
|
|
75
75
|
return __generator(this, function (_a) {
|
|
76
76
|
switch (_a.label) {
|
|
77
77
|
case 0:
|
|
@@ -82,6 +82,7 @@ var BondModal = function (_a) {
|
|
|
82
82
|
_a.trys.push([1, 3, , 4]);
|
|
83
83
|
maxPrice = new BigNumber(bondData[0].trueBillPrice).times(102).div(100);
|
|
84
84
|
amount = convertToTokenValue(inputValue, decimals);
|
|
85
|
+
// @ts-ignore
|
|
85
86
|
return [4 /*yield*/, writeContract({
|
|
86
87
|
address: billAddress,
|
|
87
88
|
abi: BOND_ABI,
|
|
@@ -89,10 +90,11 @@ var BondModal = function (_a) {
|
|
|
89
90
|
args: [amount, maxPrice, account],
|
|
90
91
|
})];
|
|
91
92
|
case 2:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
93
|
+
// @ts-ignore
|
|
94
|
+
_a.sent();
|
|
95
|
+
console.log('Transaction:', hash);
|
|
96
|
+
if (hash != null) {
|
|
97
|
+
setBuyTx(hash);
|
|
96
98
|
}
|
|
97
99
|
return [3 /*break*/, 4];
|
|
98
100
|
case 3:
|
|
@@ -107,7 +109,7 @@ var BondModal = function (_a) {
|
|
|
107
109
|
var _e = useState(null), buyTx = _e[0], setBuyTx = _e[1];
|
|
108
110
|
//You approve the token, not the contract (this code will have to be updated for zap)
|
|
109
111
|
var handleApprove = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
110
|
-
var tokenAddress, decimals, amount,
|
|
112
|
+
var tokenAddress, decimals, amount, error_2;
|
|
111
113
|
return __generator(this, function (_a) {
|
|
112
114
|
switch (_a.label) {
|
|
113
115
|
case 0:
|
|
@@ -122,15 +124,14 @@ var BondModal = function (_a) {
|
|
|
122
124
|
address: tokenAddress,
|
|
123
125
|
abi: ERC_20_ABI,
|
|
124
126
|
functionName: 'approve',
|
|
125
|
-
args: [account, amount]
|
|
127
|
+
args: [account, amount]
|
|
126
128
|
})];
|
|
127
129
|
case 2:
|
|
128
|
-
|
|
130
|
+
_a.sent();
|
|
129
131
|
console.log('Transaction:', hash);
|
|
130
|
-
console.log('IsPending:', isPending);
|
|
131
|
-
console.log('IsConfirmed:', isConfirmed);
|
|
132
132
|
if (hash != null) {
|
|
133
133
|
setApproveTx(hash);
|
|
134
|
+
console.log('setApproveTx:', hash);
|
|
134
135
|
}
|
|
135
136
|
return [3 /*break*/, 4];
|
|
136
137
|
case 3:
|