@ape.swap/bonds-sdk 1.0.600 → 1.0.601
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.
|
@@ -60,7 +60,7 @@ var BondModal = function (_a) {
|
|
|
60
60
|
var account = _a.account, isActive = _a.isActive, isOpen = _a.isOpen, accountChainId = _a.accountChainId, onClose = _a.onClose, bondAddress = _a.bondAddress;
|
|
61
61
|
if (!isOpen)
|
|
62
62
|
return null;
|
|
63
|
-
var _b = useWriteContract(), hash = _b.data, isPending = _b.isPending, writeContract = _b.writeContract;
|
|
63
|
+
var _b = useWriteContract(), hash = _b.data, isPending = _b.isPending, writeContract = _b.writeContract, writeContractAsync = _b.writeContractAsync;
|
|
64
64
|
var _c = useWaitForTransactionReceipt({
|
|
65
65
|
hash: hash,
|
|
66
66
|
}), isConfirming = _c.isLoading, isConfirmed = _c.isSuccess;
|
|
@@ -75,12 +75,12 @@ var BondModal = function (_a) {
|
|
|
75
75
|
billAddress = bondData[0].billAddress;
|
|
76
76
|
decimals = 18;
|
|
77
77
|
try {
|
|
78
|
-
console.log('HANDLEBUY CLICKED
|
|
79
|
-
maxPrice = new BigNumber(bondData[0].trueBillPrice).times(
|
|
78
|
+
console.log('HANDLEBUY CLICKED');
|
|
79
|
+
maxPrice = new BigNumber(bondData[0].trueBillPrice).times(102).div(100);
|
|
80
80
|
amount = convertToTokenValue(inputValue, decimals);
|
|
81
81
|
console.log('BillAddress:', billAddress);
|
|
82
82
|
console.log('Amount:', amount);
|
|
83
|
-
console.log('MaxPrice:', maxPrice
|
|
83
|
+
console.log('MaxPrice:', maxPrice);
|
|
84
84
|
writeContract({
|
|
85
85
|
address: billAddress,
|
|
86
86
|
abi: BOND_ABI,
|
|
@@ -103,7 +103,7 @@ var BondModal = function (_a) {
|
|
|
103
103
|
var _e = useState(null), buyTx = _e[0], setBuyTx = _e[1];
|
|
104
104
|
//You approve the token, not the contract (this code will have to be updated for zap)
|
|
105
105
|
var handleApprove = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
106
|
-
var tokenAddress, decimals, amount,
|
|
106
|
+
var tokenAddress, decimals, amount, tx, error_1;
|
|
107
107
|
return __generator(this, function (_a) {
|
|
108
108
|
switch (_a.label) {
|
|
109
109
|
case 0:
|
|
@@ -113,20 +113,19 @@ var BondModal = function (_a) {
|
|
|
113
113
|
case 1:
|
|
114
114
|
_a.trys.push([1, 3, , 4]);
|
|
115
115
|
amount = convertToTokenValue(inputValue, decimals);
|
|
116
|
-
|
|
116
|
+
console.log('Amount:', amount);
|
|
117
|
+
return [4 /*yield*/, writeContractAsync({
|
|
117
118
|
address: tokenAddress,
|
|
118
119
|
abi: ERC_20_ABI,
|
|
119
120
|
functionName: 'approve',
|
|
120
121
|
args: [account, amount]
|
|
121
122
|
})];
|
|
122
123
|
case 2:
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
setApproveTx(hash_1);
|
|
129
|
-
console.log('setApproveTx:', hash_1);
|
|
124
|
+
tx = _a.sent();
|
|
125
|
+
console.log('ApproveTransaction:', tx);
|
|
126
|
+
if (tx) {
|
|
127
|
+
setApproveTx(tx);
|
|
128
|
+
console.log('setApproveTx:', tx);
|
|
130
129
|
}
|
|
131
130
|
return [3 /*break*/, 4];
|
|
132
131
|
case 3:
|