@ape.swap/bonds-sdk 1.0.564 → 1.0.566

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.
@@ -61,9 +61,9 @@ var BondModal = function (_a) {
61
61
  var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive, isOpen = _a.isOpen, onClose = _a.onClose, bondAddress = _a.bondAddress;
62
62
  if (!isOpen)
63
63
  return null;
64
- var writeContract = useWriteContract().writeContract;
64
+ var _b = useWriteContract(), hash = _b.data, writeContract = _b.writeContract;
65
65
  //const { account, isActive } = useWeb3React();
66
- var _b = useState([]), bondData = _b[0], setBondData = _b[1];
66
+ var _c = useState([]), bondData = _c[0], setBondData = _c[1];
67
67
  //This is a temp solution, but we will force approval each time, and then once set we will set status here and allow
68
68
  //user to buy
69
69
  //Check with Fede if this needs to be temp, if we force approval everytime, isn't this fine?
@@ -101,10 +101,10 @@ var BondModal = function (_a) {
101
101
  }
102
102
  });
103
103
  }); };
104
- var _c = useState(null), buyTx = _c[0], setBuyTx = _c[1];
104
+ var _d = useState(null), buyTx = _d[0], setBuyTx = _d[1];
105
105
  //You approve the token, not the contract (this code will have to be updated for zap)
106
106
  var handleApprove = function () { return __awaiter(void 0, void 0, void 0, function () {
107
- var tokenAddress, decimals, amount, tx, error_2;
107
+ var tokenAddress, decimals, amount, error_2;
108
108
  return __generator(this, function (_a) {
109
109
  switch (_a.label) {
110
110
  case 0:
@@ -122,10 +122,10 @@ var BondModal = function (_a) {
122
122
  args: [account, amount],
123
123
  })];
124
124
  case 2:
125
- tx = _a.sent();
126
- console.log('Transaction:', tx);
127
- if (tx != null) {
128
- setApproveTx(tx);
125
+ _a.sent();
126
+ console.log('Transaction:', hash);
127
+ if (hash != null) {
128
+ setApproveTx(hash);
129
129
  }
130
130
  return [3 /*break*/, 4];
131
131
  case 3:
@@ -137,7 +137,7 @@ var BondModal = function (_a) {
137
137
  }
138
138
  });
139
139
  }); };
140
- var _d = useState(null), approveTx = _d[0], setApproveTx = _d[1];
140
+ var _e = useState(null), approveTx = _e[0], setApproveTx = _e[1];
141
141
  // Fetch data
142
142
  useEffect(function () {
143
143
  axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
@@ -170,17 +170,17 @@ var BondModal = function (_a) {
170
170
  var singlePurchaseLimit = new BigNumber((_c = bond === null || bond === void 0 ? void 0 : bond.maxPayout) !== null && _c !== void 0 ? _c : 0).div(new BigNumber(10).pow((_d = bond === null || bond === void 0 ? void 0 : bond.payoutTokenDecimals) !== null && _d !== void 0 ? _d : 18));
171
171
  return !available ? 0 : (singlePurchaseLimit.lt(safeAvailable) ? singlePurchaseLimit : safeAvailable);
172
172
  };
173
- var _e = useState(''), inputValue = _e[0], setInputValue = _e[1];
173
+ var _f = useState(''), inputValue = _f[0], setInputValue = _f[1];
174
174
  var handleInputChange = function (event) {
175
175
  setInputValue(event.target.value);
176
176
  };
177
- var _f = useState(null), selectedBond = _f[0], setSelectedBond = _f[1];
177
+ var _g = useState(null), selectedBond = _g[0], setSelectedBond = _g[1];
178
178
  var navigate = useNavigate();
179
179
  var projectInfo = function (bond) {
180
180
  setSelectedBond(bond);
181
181
  navigate("/bondsingle/".concat(bond.billAddress));
182
182
  };
183
- var _g = useState(null), tokenBalance = _g[0], setTokenBalance = _g[1];
183
+ var _h = useState(null), tokenBalance = _h[0], setTokenBalance = _h[1];
184
184
  useEffect(function () {
185
185
  if (isActive && account && bondData.length > 0) {
186
186
  getTokenBalance(bondData[0].chainId, bondData[0].principalToken, account).then(function (balance) {
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.564",
6
+ "version": "1.0.566",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",