@ape.swap/bonds-sdk 1.0.576 → 1.0.577

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.
@@ -47,7 +47,7 @@ import { isNumber } from '../../../utils/numbers';
47
47
  import { TooltipBubble, Button, Svg, ListTag } from '../../uikit-sdk';
48
48
  import { TooltipText } from '../../../enum/tooltips';
49
49
  import { ethers } from 'ethers';
50
- import convertToTokenValue from "../../../utils/convertToTokenValue";
50
+ import convertToTokenValue, { adjustDecimals } from "../../../utils/convertToTokenValue";
51
51
  import TokenImage from '../../uikit-sdk/TokenImage';
52
52
  import BOND_ABI from '../../../config/abi/bond.json';
53
53
  import ERC_20_ABI from '../../../config/abi/erc20.json';
@@ -70,14 +70,17 @@ var BondModal = function (_a) {
70
70
  //user to buy
71
71
  //Check with Fede if this needs to be temp, if we force approval everytime, isn't this fine?
72
72
  var handleBuy = function () { return __awaiter(void 0, void 0, void 0, function () {
73
- var billAddress, decimals, maxPrice, amount;
74
- return __generator(this, function (_a) {
73
+ var billAddress, decimals, maxPrice, amount, amountAlt, amountAlt2;
74
+ var _a;
75
+ return __generator(this, function (_b) {
75
76
  billAddress = bondData[0].billAddress;
76
77
  decimals = 18;
77
78
  try {
78
79
  console.log('HANDLEBUY CLICKED');
79
80
  maxPrice = new BigNumber(bondData[0].trueBillPrice).times(102).div(100);
80
81
  amount = convertToTokenValue(inputValue, decimals);
82
+ amountAlt = adjustDecimals(inputValue);
83
+ amountAlt2 = new BigNumber(amountAlt).times(new BigNumber(10).pow((_a = bondData[0].principalTokenDecimals) !== null && _a !== void 0 ? _a : 18)).toString();
81
84
  console.log('Amount:', amount);
82
85
  console.log('MaxPrice:', maxPrice);
83
86
  // @ts-ignore
@@ -85,7 +88,7 @@ var BondModal = function (_a) {
85
88
  address: billAddress,
86
89
  abi: BOND_ABI,
87
90
  functionName: 'deposit',
88
- args: [amount, maxPrice, account],
91
+ args: [amount, maxPrice.toFixed(0), account],
89
92
  });
90
93
  console.log('BuyTransaction:', hash);
91
94
  if (hash) {
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.576",
6
+ "version": "1.0.577",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",