@ape.swap/bonds-sdk 1.0.473 → 1.0.475

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.
Files changed (128) hide show
  1. package/dist/config/abi/bondNft.json +424 -0
  2. package/dist/config/abi/ens-public-resolver.json +816 -0
  3. package/dist/config/abi/ens-registrar.json +422 -0
  4. package/dist/config/abi/erc20_bytes32.json +30 -0
  5. package/dist/config/abi/jungleChef.json +291 -0
  6. package/dist/config/abi/launchBonds.json +2014 -0
  7. package/dist/config/abi/lockVeAbond.json +2198 -0
  8. package/dist/config/abi/migrationBond.json +1639 -0
  9. package/dist/config/abi/migrationFveAbond.json +160 -0
  10. package/dist/config/abi/multicallv3.json +92 -0
  11. package/dist/config/abi/sousChef.json +649 -0
  12. package/dist/config/abi/types/Banana.d.ts +417 -0
  13. package/dist/config/abi/types/Banana.js +1 -0
  14. package/dist/config/abi/types/Bond.d.ts +803 -0
  15. package/dist/config/abi/types/Bond.js +1 -0
  16. package/dist/config/abi/types/BondNft.d.ts +603 -0
  17. package/dist/config/abi/types/BondNft.js +1 -0
  18. package/dist/config/abi/types/EnsPublicResolver.d.ts +513 -0
  19. package/dist/config/abi/types/EnsPublicResolver.js +1 -0
  20. package/dist/config/abi/types/EnsRegistrar.d.ts +274 -0
  21. package/dist/config/abi/types/EnsRegistrar.js +1 -0
  22. package/dist/config/abi/types/Erc20.d.ts +168 -0
  23. package/dist/config/abi/types/Erc20.js +1 -0
  24. package/dist/config/abi/types/Erc20_bytes32.d.ts +50 -0
  25. package/dist/config/abi/types/Erc20_bytes32.js +1 -0
  26. package/dist/config/abi/types/JungleChef.d.ts +260 -0
  27. package/dist/config/abi/types/JungleChef.js +1 -0
  28. package/dist/config/abi/types/LaunchBonds.d.ts +1362 -0
  29. package/dist/config/abi/types/LaunchBonds.js +1 -0
  30. package/dist/config/abi/types/LensContract.d.ts +295 -0
  31. package/dist/config/abi/types/LensContract.js +1 -0
  32. package/dist/config/abi/types/LockVeAbond.d.ts +1279 -0
  33. package/dist/config/abi/types/LockVeAbond.js +1 -0
  34. package/dist/config/abi/types/MigrationBond.d.ts +1136 -0
  35. package/dist/config/abi/types/MigrationBond.js +1 -0
  36. package/dist/config/abi/types/MigrationFveAbond.d.ts +290 -0
  37. package/dist/config/abi/types/MigrationFveAbond.js +1 -0
  38. package/dist/config/abi/types/MiniComplexRewarder.d.ts +469 -0
  39. package/dist/config/abi/types/MiniComplexRewarder.js +1 -0
  40. package/dist/config/abi/types/Multicallv2.d.ts +150 -0
  41. package/dist/config/abi/types/Multicallv2.js +1 -0
  42. package/dist/config/abi/types/Multicallv3.d.ts +98 -0
  43. package/dist/config/abi/types/Multicallv3.js +1 -0
  44. package/dist/config/abi/types/NonFungibleApes.d.ts +532 -0
  45. package/dist/config/abi/types/NonFungibleApes.js +1 -0
  46. package/dist/config/abi/types/NonFungibleBananas.d.ts +505 -0
  47. package/dist/config/abi/types/NonFungibleBananas.js +1 -0
  48. package/dist/config/abi/types/PriceGetter.d.ts +713 -0
  49. package/dist/config/abi/types/PriceGetter.js +1 -0
  50. package/dist/config/abi/types/PriceGetterLinea.d.ts +789 -0
  51. package/dist/config/abi/types/PriceGetterLinea.js +1 -0
  52. package/dist/config/abi/types/PriceGetterV2.d.ts +729 -0
  53. package/dist/config/abi/types/PriceGetterV2.js +1 -0
  54. package/dist/config/abi/types/SousChef.d.ts +579 -0
  55. package/dist/config/abi/types/SousChef.js +1 -0
  56. package/dist/config/abi/types/Treasury.d.ts +277 -0
  57. package/dist/config/abi/types/Treasury.js +1 -0
  58. package/dist/config/abi/types/Weth.d.ts +221 -0
  59. package/dist/config/abi/types/Weth.js +1 -0
  60. package/dist/config/abi/types/Zap.d.ts +528 -0
  61. package/dist/config/abi/types/Zap.js +1 -0
  62. package/dist/config/abi/types/common.d.ts +22 -0
  63. package/dist/config/abi/types/common.js +1 -0
  64. package/dist/config/abi/types/factories/Banana__factory.d.ts +475 -0
  65. package/dist/config/abi/types/factories/Banana__factory.js +628 -0
  66. package/dist/config/abi/types/factories/BondNft__factory.d.ts +723 -0
  67. package/dist/config/abi/types/factories/BondNft__factory.js +951 -0
  68. package/dist/config/abi/types/factories/Bond__factory.d.ts +799 -0
  69. package/dist/config/abi/types/factories/Bond__factory.js +1042 -0
  70. package/dist/config/abi/types/factories/EnsPublicResolver__factory.d.ts +649 -0
  71. package/dist/config/abi/types/factories/EnsPublicResolver__factory.js +833 -0
  72. package/dist/config/abi/types/factories/EnsRegistrar__factory.d.ts +338 -0
  73. package/dist/config/abi/types/factories/EnsRegistrar__factory.js +439 -0
  74. package/dist/config/abi/types/factories/Erc20__factory.d.ts +175 -0
  75. package/dist/config/abi/types/factories/Erc20__factory.js +239 -0
  76. package/dist/config/abi/types/factories/Erc20_bytes32__factory.d.ts +30 -0
  77. package/dist/config/abi/types/factories/Erc20_bytes32__factory.js +47 -0
  78. package/dist/config/abi/types/factories/JungleChef__factory.d.ts +247 -0
  79. package/dist/config/abi/types/factories/JungleChef__factory.js +326 -0
  80. package/dist/config/abi/types/factories/LaunchBonds__factory.d.ts +1560 -0
  81. package/dist/config/abi/types/factories/LaunchBonds__factory.js +2031 -0
  82. package/dist/config/abi/types/factories/LensContract__factory.d.ts +254 -0
  83. package/dist/config/abi/types/factories/LensContract__factory.js +338 -0
  84. package/dist/config/abi/types/factories/LockVeAbond__factory.d.ts +1698 -0
  85. package/dist/config/abi/types/factories/LockVeAbond__factory.js +2215 -0
  86. package/dist/config/abi/types/factories/MigrationBond__factory.d.ts +1268 -0
  87. package/dist/config/abi/types/factories/MigrationBond__factory.js +1656 -0
  88. package/dist/config/abi/types/factories/MigrationFveAbond__factory.d.ts +262 -0
  89. package/dist/config/abi/types/factories/MigrationFveAbond__factory.js +346 -0
  90. package/dist/config/abi/types/factories/MiniComplexRewarder__factory.d.ts +448 -0
  91. package/dist/config/abi/types/factories/MiniComplexRewarder__factory.js +586 -0
  92. package/dist/config/abi/types/factories/Multicallv2__factory.d.ts +115 -0
  93. package/dist/config/abi/types/factories/Multicallv2__factory.js +160 -0
  94. package/dist/config/abi/types/factories/Multicallv3__factory.d.ts +76 -0
  95. package/dist/config/abi/types/factories/Multicallv3__factory.js +109 -0
  96. package/dist/config/abi/types/factories/NonFungibleApes__factory.d.ts +617 -0
  97. package/dist/config/abi/types/factories/NonFungibleApes__factory.js +810 -0
  98. package/dist/config/abi/types/factories/NonFungibleBananas__factory.d.ts +576 -0
  99. package/dist/config/abi/types/factories/NonFungibleBananas__factory.js +756 -0
  100. package/dist/config/abi/types/factories/PriceGetterLinea__factory.d.ts +1105 -0
  101. package/dist/config/abi/types/factories/PriceGetterLinea__factory.js +1465 -0
  102. package/dist/config/abi/types/factories/PriceGetterV2__factory.d.ts +1027 -0
  103. package/dist/config/abi/types/factories/PriceGetterV2__factory.js +1364 -0
  104. package/dist/config/abi/types/factories/PriceGetter__factory.d.ts +999 -0
  105. package/dist/config/abi/types/factories/PriceGetter__factory.js +1326 -0
  106. package/dist/config/abi/types/factories/SousChef__factory.d.ts +511 -0
  107. package/dist/config/abi/types/factories/SousChef__factory.js +666 -0
  108. package/dist/config/abi/types/factories/Treasury__factory.d.ts +235 -0
  109. package/dist/config/abi/types/factories/Treasury__factory.js +309 -0
  110. package/dist/config/abi/types/factories/Weth__factory.d.ts +220 -0
  111. package/dist/config/abi/types/factories/Weth__factory.js +296 -0
  112. package/dist/config/abi/types/factories/Zap__factory.d.ts +695 -0
  113. package/dist/config/abi/types/factories/Zap__factory.js +889 -0
  114. package/dist/config/abi/types/factories/index.d.ts +25 -0
  115. package/dist/config/abi/types/factories/index.js +28 -0
  116. package/dist/config/abi/types/index.d.ts +51 -0
  117. package/dist/config/abi/types/index.js +26 -0
  118. package/dist/config/abi/weth.json +279 -0
  119. package/dist/hooks/useClaimBill.d.ts +4 -0
  120. package/dist/hooks/useClaimBill.js +59 -0
  121. package/dist/hooks/useContract.d.ts +25 -0
  122. package/dist/hooks/useContract.js +107 -0
  123. package/dist/pages/YourBonds/YourBonds.js +37 -10
  124. package/dist/utils/index.d.ts +16 -0
  125. package/dist/utils/index.js +127 -0
  126. package/dist/utils/track.d.ts +7 -0
  127. package/dist/utils/track.js +17 -0
  128. package/package.json +1 -1
@@ -76,10 +76,36 @@ import { getPendingVesting } from '../../hooks/usePendingVesting';
76
76
  import axios from 'axios';
77
77
  import { fetchUserOwnedBillsDataAsync } from './fetchBillsUser';
78
78
  import { Input } from '../../components/uikit-sdk/Input';
79
+ import useClaimBill from '../../hooks/useClaimBill';
79
80
  var YourBonds = function (_a) {
80
81
  var account = _a.account, accountChainId = _a.accountChainId, isActive = _a.isActive;
82
+ //const toastError = useToastError()
83
+ // const { onClaimBill } = useClaimBill(billAddress, billIds)
84
+ var _b = useState(false), pendingTrx = _b[0], setPendingTrx = _b[1];
85
+ var handleClaim = function (billAddress, billIds, chainId, event) { return __awaiter(void 0, void 0, void 0, function () {
86
+ var onClaimBill;
87
+ return __generator(this, function (_a) {
88
+ switch (_a.label) {
89
+ case 0:
90
+ event === null || event === void 0 ? void 0 : event.stopPropagation();
91
+ if (!accountChainId || !account)
92
+ return [2 /*return*/];
93
+ onClaimBill = useClaimBill(billAddress, billIds, chainId).onClaimBill;
94
+ setPendingTrx(true);
95
+ return [4 /*yield*/, onClaimBill().catch(function (e) {
96
+ console.error(e);
97
+ //toastError(e);
98
+ setPendingTrx(false);
99
+ })];
100
+ case 1:
101
+ _a.sent();
102
+ setPendingTrx(false);
103
+ return [2 /*return*/];
104
+ }
105
+ });
106
+ }); };
81
107
  // const { account, isActive } = useWeb3React();
82
- var _b = useSearchParams(), searchParams = _b[0], setSearchParams = _b[1];
108
+ var _c = useSearchParams(), searchParams = _c[0], setSearchParams = _c[1];
83
109
  var navigate = useNavigate();
84
110
  var USDT_ABI = [
85
111
  // The ERC-20 approve function ABI
@@ -121,8 +147,8 @@ var YourBonds = function (_a) {
121
147
  });
122
148
  }); };
123
149
  // Fetch data
124
- var _c = useState([]), bondData = _c[0], setBondData = _c[1];
125
- var _d = useState([]), mappedUserBills = _d[0], setMappedUserBills = _d[1];
150
+ var _d = useState([]), bondData = _d[0], setBondData = _d[1];
151
+ var _e = useState([]), mappedUserBills = _e[0], setMappedUserBills = _e[1];
126
152
  useEffect(function () {
127
153
  axios.get('https://realtime-api.ape.bond/bonds').then(function (response) {
128
154
  var bonds = response.data.bonds;
@@ -158,8 +184,8 @@ var YourBonds = function (_a) {
158
184
  }); };
159
185
  fetchData();
160
186
  }, [account]);
161
- var _e = useState(null), sortConfig = _e[0], setSortConfig = _e[1];
162
- var _f = useState(mappedUserBills), sortedBonds = _f[0], setSortedBonds = _f[1];
187
+ var _f = useState(null), sortConfig = _f[0], setSortConfig = _f[1];
188
+ var _g = useState(mappedUserBills), sortedBonds = _g[0], setSortedBonds = _g[1];
163
189
  var handleSort = function (key) {
164
190
  var direction = 'asc';
165
191
  if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'asc') {
@@ -240,16 +266,16 @@ var YourBonds = function (_a) {
240
266
  return getFirstNonZeroDigits(parseFloat((_a = bond === null || bond === void 0 ? void 0 : bond.payoutTokenPrice) !== null && _a !== void 0 ? _a : '0'));
241
267
  };
242
268
  // Modal
243
- var _g = useState(false), isModalOpen = _g[0], setIsModalOpen = _g[1];
244
- var _h = useState(null), selectedBill = _h[0], setSelectedBill = _h[1];
269
+ var _h = useState(false), isModalOpen = _h[0], setIsModalOpen = _h[1];
270
+ var _j = useState(null), selectedBill = _j[0], setSelectedBill = _j[1];
245
271
  var rowClick = function (bill) {
246
272
  setSelectedBill(bill);
247
273
  setIsModalOpen(true);
248
274
  navigate("/YourBonds/?bondAddress=".concat(bill.address, "&bondChain=").concat(bill.bond.chainId), { replace: true });
249
275
  };
250
276
  // Search logic
251
- var _j = useState(''), inputValue = _j[0], setInputValue = _j[1];
252
- var _k = useState(sortedBonds), filteredBonds = _k[0], setFilteredBonds = _k[1];
277
+ var _k = useState(''), inputValue = _k[0], setInputValue = _k[1];
278
+ var _l = useState(sortedBonds), filteredBonds = _l[0], setFilteredBonds = _l[1];
253
279
  useEffect(function () {
254
280
  if (inputValue === '') {
255
281
  setFilteredBonds(sortedBonds);
@@ -264,7 +290,7 @@ var YourBonds = function (_a) {
264
290
  setInputValue(event.target.value);
265
291
  };
266
292
  // Page render logic
267
- var _l = useState(false), bondsRendered = _l[0], setBondsRendered = _l[1];
293
+ var _m = useState(false), bondsRendered = _m[0], setBondsRendered = _m[1];
268
294
  useEffect(function () {
269
295
  if (filteredBonds.length > 0) {
270
296
  setBondsRendered(true);
@@ -281,6 +307,7 @@ var YourBonds = function (_a) {
281
307
  return (_jsxs(Flex, __assign({ className: "container bondrow-container", onClick: function () { return rowClick(bill); } }, { children: [_jsx(Flex, __assign({ className: "column column-tokens" }, { children: _jsx(Flex, __assign({ className: "column column-tokeninfoname" }, { children: _jsx(TokenInfoAndName, { bill: bill.bond, vestEnds: "Ends in ".concat(getPendingVesting(bill.lastBlockTimestamp, bill.vesting)) }) })) })), _jsxs(Flex, __assign({ className: "column column-bondinfo" }, { children: [_jsxs(Flex, __assign({ className: "column column-claimable" }, { children: [formatNumberSI(parseFloat(claimable(bill).toFixed(3)), 0), _jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' } }, { children: "($".concat((claimable(bill) * ((_a = parseFloat(earnTokenPrice(bill.bond))) !== null && _a !== void 0 ? _a : 0)).toFixed(2), ")") }))] })), _jsxs(Flex, __assign({ className: "column column-pending" }, { children: [formatNumberSI(parseFloat(totalPending(bill).toFixed(0)), 0), _jsx(Text, __assign({ sx: { opacity: '0.6', fontSize: '12px', paddingLeft: '5px' } }, { children: "($".concat((totalPending(bill) * ((_b = parseFloat(earnTokenPrice(bill.bond))) !== null && _b !== void 0 ? _b : 0)).toFixed(2), ")") }))] })), _jsx(Flex, __assign({ className: "column column-terms" }, { children: "".concat(vestingTimeRemaining(bill).days, "d, ").concat(vestingTimeRemaining(bill).hours, "h, ").concat(vestingTimeRemaining(bill).minutes, "m") })), _jsx(Flex, __assign({ className: "column column-claimall" }, { children: _jsx(Button, __assign({ disabled: !account && (claimableNumber(bill) === 0), onClick: function (event) {
282
308
  event.stopPropagation();
283
309
  // Add your claim logic here
310
+ handleClaim(bill.bond.billAddress, [bill.id], bill.bond.chainId, event);
284
311
  }, sx: {
285
312
  height: ['36px', '36px', '36px', '26px'],
286
313
  lineHeight: '12px',
@@ -0,0 +1,16 @@
1
+ import { Contract } from '@ethersproject/contracts';
2
+ import type { JsonRpcProvider } from '@ethersproject/providers';
3
+ import { ChainId } from '../config/constants/chains';
4
+ export declare function isAddress(value: any): string | false;
5
+ export declare function getContract(address: string, ABI: any, provider: JsonRpcProvider, account?: string): Contract;
6
+ export declare function isSupportedChain(chainId: number | null | undefined): chainId is ChainId;
7
+ export declare function getEtherscanLink(data: string | number, type: 'transaction' | 'token' | 'address' | 'block' | 'countdown', chainId: ChainId): string;
8
+ /**
9
+ * Prompt the user to add a custom token to metamask
10
+ * @param tokenAddress
11
+ * @param tokenSymbol
12
+ * @param tokenDecimals
13
+ * @param tokenImage
14
+ * @returns {boolean} true if the token has been added, false otherwise
15
+ */
16
+ export declare const registerToken: (tokenAddress: string, tokenSymbol: string | undefined, tokenDecimals: number, tokenImage: string | undefined) => Promise<any>;
@@ -0,0 +1,127 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
12
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
+ function verb(n) { return function (v) { return step([n, v]); }; }
14
+ function step(op) {
15
+ if (f) throw new TypeError("Generator is already executing.");
16
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
+ if (y = 0, t) op = [op[0] & 2, t.value];
19
+ switch (op[0]) {
20
+ case 0: case 1: t = op; break;
21
+ case 4: _.label++; return { value: op[1], done: false };
22
+ case 5: _.label++; y = op[1]; op = [0]; continue;
23
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
+ default:
25
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
+ if (t[2]) _.ops.pop();
30
+ _.trys.pop(); continue;
31
+ }
32
+ op = body.call(thisArg, _);
33
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
+ }
36
+ };
37
+ import { getAddress } from '@ethersproject/address';
38
+ import { AddressZero } from '@ethersproject/constants';
39
+ import { Contract } from '@ethersproject/contracts';
40
+ import { BLOCK_EXPLORER, ChainId } from '../config/constants/chains';
41
+ // returns the checksummed address if the address is valid, otherwise returns false
42
+ export function isAddress(value) {
43
+ try {
44
+ // Alphabetical letters must be made lowercase for getAddress to work.
45
+ // See documentation here: https://docs.ethers.io/v5/api/utils/address/
46
+ return getAddress(value.toLowerCase());
47
+ }
48
+ catch (_a) {
49
+ return false;
50
+ }
51
+ }
52
+ // account is not optional
53
+ function getSigner(provider, account) {
54
+ return provider.getSigner(account).connectUnchecked();
55
+ }
56
+ // account is optional
57
+ function getProviderOrSigner(provider, account) {
58
+ return account ? getSigner(provider, account) : provider;
59
+ }
60
+ // account is optional
61
+ export function getContract(address, ABI, provider, account) {
62
+ if (!isAddress(address) || address === AddressZero) {
63
+ throw Error("Invalid 'address' parameter '".concat(address, "'."));
64
+ }
65
+ return new Contract(address, ABI, getProviderOrSigner(provider, account));
66
+ }
67
+ export function isSupportedChain(chainId) {
68
+ return !!chainId && !!ChainId[chainId];
69
+ }
70
+ export function getEtherscanLink(data, type, chainId) {
71
+ switch (type) {
72
+ case 'transaction': {
73
+ return "".concat(BLOCK_EXPLORER[chainId], "/tx/").concat(data);
74
+ }
75
+ case 'token': {
76
+ return "".concat(BLOCK_EXPLORER[chainId], "/token/").concat(data);
77
+ }
78
+ case 'block': {
79
+ return "".concat(BLOCK_EXPLORER[chainId], "/block/").concat(data);
80
+ }
81
+ case 'countdown': {
82
+ return "".concat(BLOCK_EXPLORER[chainId], "/block/countdown/").concat(data);
83
+ }
84
+ default: {
85
+ return "".concat(BLOCK_EXPLORER[chainId], "/address/").concat(data);
86
+ }
87
+ }
88
+ }
89
+ /**
90
+ * Prompt the user to add a custom token to metamask
91
+ * @param tokenAddress
92
+ * @param tokenSymbol
93
+ * @param tokenDecimals
94
+ * @param tokenImage
95
+ * @returns {boolean} true if the token has been added, false otherwise
96
+ */
97
+ export var registerToken = function (tokenAddress, tokenSymbol, tokenDecimals, tokenImage) { return __awaiter(void 0, void 0, void 0, function () {
98
+ var tokenAdded, _a;
99
+ var _b;
100
+ return __generator(this, function (_c) {
101
+ switch (_c.label) {
102
+ case 0:
103
+ if (!((_b = window === null || window === void 0 ? void 0 : window.ethereum) === null || _b === void 0 ? void 0 : _b.request)) return [3 /*break*/, 2];
104
+ return [4 /*yield*/, window.ethereum.request({
105
+ method: 'wallet_watchAsset',
106
+ params: {
107
+ type: 'ERC20',
108
+ options: {
109
+ address: tokenAddress,
110
+ symbol: tokenSymbol,
111
+ decimals: tokenDecimals,
112
+ image: tokenImage,
113
+ },
114
+ },
115
+ })];
116
+ case 1:
117
+ _a = _c.sent();
118
+ return [3 /*break*/, 3];
119
+ case 2:
120
+ _a = null;
121
+ _c.label = 3;
122
+ case 3:
123
+ tokenAdded = _a;
124
+ return [2 /*return*/, tokenAdded];
125
+ }
126
+ });
127
+ }); };
@@ -0,0 +1,7 @@
1
+ declare function track({ event, chain, data, value, }: {
2
+ event: string;
3
+ chain: number | undefined | string;
4
+ data: any;
5
+ value?: number | string;
6
+ }): void;
7
+ export default track;
@@ -0,0 +1,17 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ function track(_a) {
13
+ var _b;
14
+ var event = _a.event, chain = _a.chain, data = _a.data, value = _a.value;
15
+ (_b = window.dataLayer) === null || _b === void 0 ? void 0 : _b.push(__assign({ event: event, value: value, chain: chain }, data));
16
+ }
17
+ export default track;
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.473",
6
+ "version": "1.0.475",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.es.js",
9
9
  "types": "dist/index.d.ts",