@ape.swap/bonds-sdk 1.0.78-2.test.29 → 1.0.78-2.test.30
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.
|
@@ -97,9 +97,7 @@ export var getTokenAllowance = function (amount, currency, spender, account, cha
|
|
|
97
97
|
params: [account, spender],
|
|
98
98
|
},
|
|
99
99
|
];
|
|
100
|
-
return [4 /*yield*/, multicall(chainId, erc20ABI, calls)
|
|
101
|
-
// @ts-ignore
|
|
102
|
-
];
|
|
100
|
+
return [4 /*yield*/, multicall(chainId, erc20ABI, calls)];
|
|
103
101
|
case 1:
|
|
104
102
|
data = _b.sent();
|
|
105
103
|
value = new BigNumber((_a = data[0]) !== null && _a !== void 0 ? _a : 0).div(new BigNumber(10).pow(currency.decimals[chainId]));
|
|
@@ -117,9 +115,7 @@ export var useApproval = function (amount, currency, spender, account, chainId)
|
|
|
117
115
|
switch (_a.label) {
|
|
118
116
|
case 0:
|
|
119
117
|
if (!chainId || !amount || currency === 'NATIVE' || !currency)
|
|
120
|
-
return [2 /*return*/, null
|
|
121
|
-
// @ts-ignore
|
|
122
|
-
];
|
|
118
|
+
return [2 /*return*/, null];
|
|
123
119
|
decimals = currency.decimals[chainId];
|
|
124
120
|
tokenAddress = currency.address[chainId];
|
|
125
121
|
if (!decimals || !tokenAddress)
|
|
@@ -73,9 +73,7 @@ export var getTokenBalance = function (currency, account, chainId) { return __aw
|
|
|
73
73
|
return [4 /*yield*/, multicall(chainId, currency === 'NATIVE' ? multicallV2Abi : erc20ABI, calls)];
|
|
74
74
|
case 1:
|
|
75
75
|
data = _b.sent();
|
|
76
|
-
value = new BigNumber((_a = data[0]) !== null && _a !== void 0 ? _a : 0).div(
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
new BigNumber(10).pow(currency === 'NATIVE' ? 18 : currency.decimals[chainId]));
|
|
76
|
+
value = new BigNumber((_a = data[0]) !== null && _a !== void 0 ? _a : 0).div(new BigNumber(10).pow(currency === 'NATIVE' ? 18 : currency.decimals[chainId]));
|
|
79
77
|
return [2 /*return*/, value.toString()];
|
|
80
78
|
}
|
|
81
79
|
});
|
|
@@ -59,7 +59,6 @@ var useSoulZapBondQuote = function (typedValue, inputCurrency, bond, account) {
|
|
|
59
59
|
var bondContractAddress = bond === null || bond === void 0 ? void 0 : bond.billAddress;
|
|
60
60
|
var chainId = bond === null || bond === void 0 ? void 0 : bond.chainId;
|
|
61
61
|
var inputCurrencyString = inputCurrency === 'NATIVE' ? '0x0000000000000000000000000000000000000000' : inputCurrency === null || inputCurrency === void 0 ? void 0 : inputCurrency.address[chainId];
|
|
62
|
-
// @ts-ignore
|
|
63
62
|
var inputCurrencyDecimals = inputCurrency === 'NATIVE' ? 18 : inputCurrency === null || inputCurrency === void 0 ? void 0 : inputCurrency.decimals[chainId];
|
|
64
63
|
var principalContractAddress = principalToken === null || principalToken === void 0 ? void 0 : principalToken.address[chainId];
|
|
65
64
|
var chainName = getChainParam(chainId);
|
|
@@ -56,7 +56,6 @@ var useSoulZapTokenQuote = function (typedValue, inputCurrency, outputToken, cha
|
|
|
56
56
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
|
|
57
57
|
var allowedSlippage = '0.5';
|
|
58
58
|
var inputCurrencyString = inputCurrency === 'NATIVE' ? '0x0000000000000000000000000000000000000000' : inputCurrency === null || inputCurrency === void 0 ? void 0 : inputCurrency.address[chainId];
|
|
59
|
-
// @ts-ignore
|
|
60
59
|
var inputCurrencyDecimals = inputCurrency === 'NATIVE' ? 18 : inputCurrency === null || inputCurrency === void 0 ? void 0 : inputCurrency.decimals[chainId];
|
|
61
60
|
var contractAddress = outputToken === null || outputToken === void 0 ? void 0 : outputToken.address[chainId];
|
|
62
61
|
var chain = getChainParam(chainId);
|
|
@@ -310,7 +310,7 @@ var BondModal = function (_a) {
|
|
|
310
310
|
toNumber(inputValue) / toNumber(earnTokenPrice(bond))).toFixed(2), _jsx("span", { className: "text-highlight", children: "\u00A0additional" })] }), _jsx(Flex, { className: "button-container buy", sx: { justifyContent: 'end' }, children: chainId !== bond.chainId ? (_jsx(Button, { className: "switch-button button-narrow", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut) || !account, onClick: function (event) {
|
|
311
311
|
event.stopPropagation();
|
|
312
312
|
switchChain({ chainId: bond.chainId });
|
|
313
|
-
}, children: !account ? 'Connect Wallet' : "Switch to ".concat(NETWORK_LABEL[bond.chainId]) })) : approveTx != null && isConfirmed ? (_jsx(Button, { className: "action-button button-narrow", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut) || !account, onClick: handleBuy, children: getActionButtonText(bond) })) : (_jsx(Button, { className: "action-button button-narrow", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut) || !account, onClick: handleApprove, children: getActionButtonText(bond) })) })] }), _jsx(Flex, { sx: { width: '100%', marginTop: '10px', marginBottom: '10px' }, children: _jsx("hr", { className: "fading-hr" }) }), _jsxs(Flex, { sx: { width: '100%' }, children: [_jsxs(Flex, { sx: { width: '50%', flexDirection: 'column' }, children: ["Market Price: $", formatUSDNumber((toNumber(youGet(bond, inputValue)) * toNumber(earnTokenPrice(bond))).toString()), _jsx("hr", { className: "fading-hr" }), _jsx("span", { className: "text-highlight flex-inline", children: "Our price: " }), _jsxs("span", { className: "flex-inline", children: ["$", formatUSDNumber((toNumber(inputValue) * toNumber(bond.principalTokenPrice)).toString()), ' '] }), _jsxs("span", { className: "text-highlight flex-inline", children: ["(discount rate ", bond === null || bond === void 0 ? void 0 : bond.discount.toFixed(2), "%)"] })] }), _jsx(Flex, { sx: { width: '50px', alignItems: 'center', justifyContent: 'center' }, children: "vs." }), _jsxs(Flex, { sx: { width: '50%', flexDirection: 'column' }, children: ["If purchased from market: ", (toNumber(inputValue) / toNumber(earnTokenPrice(bond))).toFixed(0), ' ', bond.earnToken.symbol, _jsx("hr", { className: "fading-hr" }), _jsx("span", { className: "text-highlight flex-inline", children: "Amount you will get:" }), ' ', youGet(bond, inputValue), " ", _jsx("span", { className: "flex-inline", children: bond.earnToken.symbol })] })] })] })] })] }), _jsxs(Flex, { className: "footer-details", children: [_jsxs(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: ["Vesting start date: ", moment().format('DD-MMM-YYYY')] }), _jsxs(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: ["Vesting end date:", ' ', moment()
|
|
313
|
+
}, children: !account ? 'Connect Wallet' : "Switch to ".concat(NETWORK_LABEL[bond.chainId]) })) : approveTx != null && isConfirmed ? (_jsx(Button, { className: "action-button button-narrow", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut) || !account, onClick: handleBuy, children: getActionButtonText(bond) })) : (_jsx(Button, { className: "action-button button-narrow", disabled: isPending || isConfirming || (bond === null || bond === void 0 ? void 0 : bond.soldOut) || !account, onClick: handleApprove, children: getActionButtonText(bond) })) })] }), _jsx(Flex, { sx: { width: '100%', marginTop: '10px', marginBottom: '10px' }, children: _jsx("hr", { className: "fading-hr" }) }), _jsxs(Flex, { sx: { width: '100%' }, children: [_jsxs(Flex, { sx: { width: '50%', flexDirection: 'column' }, children: ["Market Price: $", formatUSDNumber((toNumber(youGet(bond, inputValue)) * toNumber(earnTokenPrice(bond))).toString()), _jsx("hr", { className: "fading-hr" }), _jsx("span", { className: "text-highlight flex-inline", children: "Our price: " }), _jsxs("span", { className: "flex-inline", children: ["$", formatUSDNumber((toNumber(inputValue) * toNumber(bond.principalTokenPrice)).toString()), ' '] }), _jsxs("span", { className: "text-highlight flex-inline", children: ["(discount rate ", bond === null || bond === void 0 ? void 0 : bond.discount.toFixed(2), "%)"] })] }), _jsx(Flex, { sx: { width: '50px', alignItems: 'center', justifyContent: 'center' }, children: "vs." }), _jsxs(Flex, { sx: { width: '50%', flexDirection: 'column' }, children: ["If purchased from market: ", (toNumber(inputValue) / toNumber(earnTokenPrice(bond))).toFixed(0), ' ', bond.earnToken.symbol, _jsx("hr", { className: "fading-hr" }), _jsx("span", { className: "text-highlight flex-inline", children: "Amount you will get:" }), ' ', toNumber(youGet(bond, inputValue)).toFixed(0), " ", _jsx("span", { className: "flex-inline", children: bond.earnToken.symbol })] })] })] })] })] }), _jsxs(Flex, { className: "footer-details", children: [_jsxs(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: ["Vesting start date: ", moment().format('DD-MMM-YYYY')] }), _jsxs(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: ["Vesting end date:", ' ', moment()
|
|
314
314
|
.add(vestingTime((_u = bond === null || bond === void 0 ? void 0 : bond.vestingTerm) !== null && _u !== void 0 ? _u : 0).days, 'days')
|
|
315
315
|
.format('DD-MMM-YYYY')] }), _jsx(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: "Vesting type: Linear" }), _jsx(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: "What are bonds?" })] }), accordionVisible && (_jsx(Flex, { className: "modaltable-container accordion-container", children: _jsx(AccordionText, { title: accordionTitle, body: accordionBody, isVisible: accordionVisible }) }))] }) })) }, bond.billAddress));
|
|
316
316
|
}) }));
|
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.78-2.test.
|
|
6
|
+
"version": "1.0.78-2.test.30",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"module": "dist/index.es.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -67,6 +67,7 @@
|
|
|
67
67
|
"@rainbow-me/rainbowkit": "^2.1.7",
|
|
68
68
|
"@reduxjs/toolkit": "^2.2.6",
|
|
69
69
|
"@tanstack/react-query": "^5.51.5",
|
|
70
|
+
"@tanstack/react-query-devtools": "^5.58.0",
|
|
70
71
|
"@types/node": "^20.14.10",
|
|
71
72
|
"@uniswap/token-lists": "^1.0.0-beta.34",
|
|
72
73
|
"axios-retry": "^4.4.2",
|