@ape.swap/bonds-sdk 1.0.561 → 1.0.563

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.
@@ -48,7 +48,7 @@ import { isNumber } from '../../../utils/numbers';
48
48
  import { TooltipBubble, Button, Svg, ListTag } from '../../uikit-sdk';
49
49
  import { TooltipText } from '../../../enum/tooltips';
50
50
  import { ethers } from 'ethers';
51
- import { adjustDecimals } from "../../../utils/convertToTokenValue";
51
+ import convertToTokenValue, { adjustDecimals } from "../../../utils/convertToTokenValue";
52
52
  import TokenImage from '../../uikit-sdk/TokenImage';
53
53
  import BOND_ABI from '../../../config/abi/bond.json';
54
54
  import ERC_20_ABI from '../../../config/abi/erc20.json';
@@ -106,16 +106,17 @@ var BondModal = function (_a) {
106
106
  }); };
107
107
  //You approve the token, not the contract (this code will have to be updated for zap)
108
108
  var handleApprove = function () { return __awaiter(void 0, void 0, void 0, function () {
109
- var tokenAddress, amount, tx, error_2;
109
+ var tokenAddress, decimals, amount, tx, error_2;
110
110
  return __generator(this, function (_a) {
111
111
  switch (_a.label) {
112
112
  case 0:
113
113
  tokenAddress = bondData[0].principalToken;
114
+ decimals = 18;
114
115
  _a.label = 1;
115
116
  case 1:
116
117
  _a.trys.push([1, 3, , 4]);
117
118
  console.log(adjustDecimals(inputValue));
118
- amount = ethers.BigNumber.from(inputValue);
119
+ amount = convertToTokenValue(inputValue, decimals);
119
120
  console.log('Amount:', amount);
120
121
  return [4 /*yield*/, writeContract({
121
122
  address: tokenAddress,
@@ -126,10 +127,12 @@ var BondModal = function (_a) {
126
127
  case 2:
127
128
  tx = _a.sent();
128
129
  console.log('Transaction:', tx);
130
+ alert('Buy Successful');
129
131
  return [3 /*break*/, 4];
130
132
  case 3:
131
133
  error_2 = _a.sent();
132
134
  console.error('Approval failed:', error_2);
135
+ alert('Approval Failed');
133
136
  return [3 /*break*/, 4];
134
137
  case 4: return [2 /*return*/];
135
138
  }
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.561",
6
+ "version": "1.0.563",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",