@ape.swap/bonds-sdk 1.0.606 → 1.0.607

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,7 +54,7 @@ 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 { useWriteContract } from "wagmi";
57
+ import { useWaitForTransactionReceipt, 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;
@@ -114,7 +114,7 @@ var BondModal = function (_a) {
114
114
  var _d = useState(null), buyTx = _d[0], setBuyTx = _d[1];
115
115
  //You approve the token, not the contract (this code will have to be updated for zap)
116
116
  var handleApprove = function () { return __awaiter(void 0, void 0, void 0, function () {
117
- var tokenAddress, decimals, amount, tx, error_2;
117
+ var tokenAddress, decimals, amount, tx, receipt, error_2;
118
118
  return __generator(this, function (_a) {
119
119
  switch (_a.label) {
120
120
  case 0:
@@ -133,16 +133,17 @@ var BondModal = function (_a) {
133
133
  })];
134
134
  case 2:
135
135
  tx = _a.sent();
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
- // }
136
+ receipt = useWaitForTransactionReceipt({
137
+ confirmations: 4,
138
+ chainId: accountChainId,
139
+ hash: tx,
140
+ pollingInterval: 1000
141
+ });
142
+ console.log('Receipt', receipt);
143
+ if (receipt.isSuccess) {
144
+ setReceiptTx(receipt.data.transactionHash);
145
+ console.log('Receipt:', receipt);
146
+ }
146
147
  if (tx) {
147
148
  setApproveTx(tx);
148
149
  console.log('setApproveTx:', tx);
@@ -253,7 +254,7 @@ var BondModal = function (_a) {
253
254
  !!v.currentTarget.value && isNumber(v.currentTarget.value) && parseFloat(v.currentTarget.value) >= 0
254
255
  ? v.currentTarget.value
255
256
  : v.currentTarget.value.slice(0, v.currentTarget.value.length - 1);
256
- } }) }), _jsxs(Flex, { className: "input-container token", children: [_jsx(Flex, { className: "input-container bondicon", children: _jsxs("div", { className: "icon-container-small", children: [_jsx(Svg, { width: 12, height: 12, icon: (_m = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bond.chainId]) !== null && _m !== void 0 ? _m : 'question' }), _jsx(TokenImage, { symbol: (_o = bond.principalTokenName) !== null && _o !== void 0 ? _o : bond.payoutTokenName, size: 30 })] }) }), _jsx(Flex, { className: "title-container tokenname-small", children: bond === null || bond === void 0 ? void 0 : bond.principalTokenName })] })] }), isActive && account && (_jsxs(Flex, { className: "input-container balancerow", children: [_jsxs(Flex, { className: "balancerow text", children: ["Balance: ", tokenBalance] }), _jsx(Flex, { className: "balancerow max", children: _jsx(Button, { onClick: function () { setInputValue(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0'); }, children: "Max" }) })] }))] }), _jsxs(Flex, { className: "modal-container button-container", children: [_jsx(Flex, { className: "button-container get", children: _jsxs(Button, { onClick: function () { window.open('https://ape.bond/swap', '_blank'); }, children: ["Get ", bond === null || bond === void 0 ? void 0 : bond.principalTokenName] }) }), _jsx(Flex, { className: "button-container buy", children: approveTx != null && receiptTx != null ?
257
+ } }) }), _jsxs(Flex, { className: "input-container token", children: [_jsx(Flex, { className: "input-container bondicon", children: _jsxs("div", { className: "icon-container-small", children: [_jsx(Svg, { width: 12, height: 12, icon: (_m = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bond.chainId]) !== null && _m !== void 0 ? _m : 'question' }), _jsx(TokenImage, { symbol: (_o = bond.principalTokenName) !== null && _o !== void 0 ? _o : bond.payoutTokenName, size: 30 })] }) }), _jsx(Flex, { className: "title-container tokenname-small", children: bond === null || bond === void 0 ? void 0 : bond.principalTokenName })] })] }), isActive && account && (_jsxs(Flex, { className: "input-container balancerow", children: [_jsxs(Flex, { className: "balancerow text", children: ["Balance: ", tokenBalance] }), _jsx(Flex, { className: "balancerow max", children: _jsx(Button, { onClick: function () { setInputValue(tokenBalance !== null && tokenBalance !== void 0 ? tokenBalance : '0'); }, children: "Max" }) })] }))] }), _jsxs(Flex, { className: "modal-container button-container", children: [_jsx(Flex, { className: "button-container get", children: _jsxs(Button, { onClick: function () { window.open('https://ape.bond/swap', '_blank'); }, children: ["Get ", bond === null || bond === void 0 ? void 0 : bond.principalTokenName] }) }), _jsx(Flex, { className: "button-container buy", children: approveTx != null ?
257
258
  _jsxs(Button, { disabled: isPending, onClick: handleBuy, children: ["Buy ", bond === null || bond === void 0 ? void 0 : bond.showcaseTokenName] })
258
259
  :
259
260
  _jsx(Button, { disabled: isPending, onClick: handleApprove, children: "Approve" }) })] })] })] }) }) }, bond.billAddress));
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.606",
6
+ "version": "1.0.607",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",