@ape.swap/bonds-sdk 1.0.604 → 1.0.606

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.
@@ -54,22 +54,20 @@ import ERC_20_ABI from '../../../config/abi/erc20.json';
54
54
  import { NETWORK_ICONS } from '../../../config/constants/chains';
55
55
  import { formatUSDNumber, getPremiumColor, premium, youGet, youGetUSD, youSpend, youSpendUSD } from './helper';
56
56
  import '../../../scss/BondModal.scss';
57
- import { useWaitForTransactionReceipt, useWriteContract } from "wagmi";
57
+ import { useWriteContract } from "wagmi";
58
58
  import { PUBLIC_RPC_URLS } from "../../../config/constants/networks";
59
59
  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
63
  var _b = useWriteContract(), hash = _b.data, isPending = _b.isPending, writeContract = _b.writeContract, writeContractAsync = _b.writeContractAsync;
64
- var transactionReceipt = function (txHash) { return __awaiter(void 0, void 0, void 0, function () {
65
- return __generator(this, function (_a) {
66
- return [2 /*return*/, useWaitForTransactionReceipt({
67
- confirmations: 4,
68
- hash: txHash,
69
- pollingInterval: 1000
70
- })];
71
- });
72
- }); };
64
+ // const transactionReceipt = async (txHash: `0x${string}`) => {
65
+ // return useWaitForTransactionReceipt({
66
+ // confirmations: 4,
67
+ // hash: txHash,
68
+ // pollingInterval: 1_000
69
+ // });
70
+ // }
73
71
  var _c = useState([]), bondData = _c[0], setBondData = _c[1];
74
72
  //This is a temp solution, but we will force approval each time, and then once set we will set status here and allow
75
73
  //user to buy
@@ -116,7 +114,7 @@ var BondModal = function (_a) {
116
114
  var _d = useState(null), buyTx = _d[0], setBuyTx = _d[1];
117
115
  //You approve the token, not the contract (this code will have to be updated for zap)
118
116
  var handleApprove = function () { return __awaiter(void 0, void 0, void 0, function () {
119
- var tokenAddress, decimals, amount, tx, receipt, error_2;
117
+ var tokenAddress, decimals, amount, tx, error_2;
120
118
  return __generator(this, function (_a) {
121
119
  switch (_a.label) {
122
120
  case 0:
@@ -124,7 +122,7 @@ var BondModal = function (_a) {
124
122
  decimals = tokenDecimals !== null && tokenDecimals !== void 0 ? tokenDecimals : 18;
125
123
  _a.label = 1;
126
124
  case 1:
127
- _a.trys.push([1, 4, , 5]);
125
+ _a.trys.push([1, 3, , 4]);
128
126
  amount = convertToTokenValue(inputValue, decimals);
129
127
  console.log('Amount:', amount);
130
128
  return [4 /*yield*/, writeContractAsync({
@@ -135,24 +133,27 @@ var BondModal = function (_a) {
135
133
  })];
136
134
  case 2:
137
135
  tx = _a.sent();
138
- return [4 /*yield*/, transactionReceipt(tx)];
139
- case 3:
140
- receipt = _a.sent();
141
- if (receipt.isSuccess) {
142
- setReceiptTx(receipt.data.transactionHash);
143
- console.log('Receipt:', receipt);
144
- }
136
+ // const receipt = useWaitForTransactionReceipt({
137
+ // confirmations: 4,
138
+ // hash: tx,
139
+ // pollingInterval: 1_000
140
+ // });
141
+ // console.log('Receipt',receipt);
142
+ // if(receipt.isSuccess) {
143
+ // setReceiptTx(receipt.data.transactionHash);
144
+ // console.log('Receipt:', receipt);
145
+ // }
145
146
  if (tx) {
146
147
  setApproveTx(tx);
147
148
  console.log('setApproveTx:', tx);
148
149
  }
149
- return [3 /*break*/, 5];
150
- case 4:
150
+ return [3 /*break*/, 4];
151
+ case 3:
151
152
  error_2 = _a.sent();
152
153
  console.error('Approval failed:', error_2);
153
154
  alert('Approval Failed');
154
- return [3 /*break*/, 5];
155
- case 5: return [2 /*return*/];
155
+ return [3 /*break*/, 4];
156
+ case 4: return [2 /*return*/];
156
157
  }
157
158
  });
158
159
  }); };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ape Bond SDK",
4
4
  "author": "Ape Bond",
5
5
  "license": "MIT",
6
- "version": "1.0.604",
6
+ "version": "1.0.606",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",