@ape.swap/bonds-sdk 1.0.0 → 1.0.1
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.
- package/dist/cjs/index.js +27 -3
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +27 -3
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -100,6 +100,16 @@ function __generator(thisArg, body) {
|
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
function __spreadArray(to, from, pack) {
|
|
104
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
105
|
+
if (ar || !(i in from)) {
|
|
106
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
107
|
+
ar[i] = from[i];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
111
|
+
}
|
|
112
|
+
|
|
103
113
|
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
104
114
|
var e = new Error(message);
|
|
105
115
|
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
@@ -15340,7 +15350,7 @@ var AvailableFeesComponent = function (_a) {
|
|
|
15340
15350
|
var _c = React.useState(availableChains[0]), chain = _c[0], setChain = _c[1];
|
|
15341
15351
|
var _d = React.useState('0x0000000000000000000000000000000000000000'), address = _d[0], setAddress = _d[1];
|
|
15342
15352
|
var feesForSelectedChain = (_b = availableFees === null || availableFees === void 0 ? void 0 : availableFees.feeBalances.find(function (c) { return c.chainId === chain; })) === null || _b === void 0 ? void 0 : _b.tokenBalances;
|
|
15343
|
-
var filteredFees = feesForSelectedChain.filter(function (fees) { return parseFloat(fees.amountUsd) >
|
|
15353
|
+
var filteredFees = feesForSelectedChain.filter(function (fees) { return parseFloat(fees.amountUsd) > 10; });
|
|
15344
15354
|
// Data for the TX request to LiFi smartcontract
|
|
15345
15355
|
var _e = React.useState(''), data = _e[0], setData = _e[1];
|
|
15346
15356
|
var _f = React.useState(''), to = _f[0], setTo = _f[1];
|
|
@@ -15365,6 +15375,7 @@ var AvailableFeesComponent = function (_a) {
|
|
|
15365
15375
|
console.error(error);
|
|
15366
15376
|
});
|
|
15367
15377
|
}, [options]);
|
|
15378
|
+
var _g = React.useState([]), claimedTokens = _g[0], setClaimedTokens = _g[1];
|
|
15368
15379
|
var sendTransactionRequest = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
15369
15380
|
var tx;
|
|
15370
15381
|
return __generator(this, function (_a) {
|
|
@@ -15380,6 +15391,9 @@ var AvailableFeesComponent = function (_a) {
|
|
|
15380
15391
|
.sendTransaction({
|
|
15381
15392
|
to: to,
|
|
15382
15393
|
data: data,
|
|
15394
|
+
})
|
|
15395
|
+
.then(function () {
|
|
15396
|
+
setClaimedTokens(function (prevTokens) { return __spreadArray(__spreadArray([], prevTokens, true), [address], false); });
|
|
15383
15397
|
})
|
|
15384
15398
|
.catch(function (e) {
|
|
15385
15399
|
console.log(e);
|
|
@@ -15397,12 +15411,22 @@ var AvailableFeesComponent = function (_a) {
|
|
|
15397
15411
|
setData('');
|
|
15398
15412
|
setAddress(address);
|
|
15399
15413
|
};
|
|
15414
|
+
var _h = React.useState(null), tokens = _h[0], setTokens = _h[1];
|
|
15415
|
+
React.useEffect(function () {
|
|
15416
|
+
axios.get('https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/main/config/tokens.json').then(function (response) {
|
|
15417
|
+
setTokens(response.data);
|
|
15418
|
+
});
|
|
15419
|
+
}, []);
|
|
15420
|
+
var exists = Object.values(tokens !== null && tokens !== void 0 ? tokens : {}).some(function (token) { var _a, _b; return ((_b = (_a = token === null || token === void 0 ? void 0 : token.address) === null || _a === void 0 ? void 0 : _a[chain]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === (address === null || address === void 0 ? void 0 : address.toLowerCase()) || (address === null || address === void 0 ? void 0 : address.toLowerCase()) === '0x0000000000000000000000000000000000000000'; });
|
|
15421
|
+
React.useEffect(function () {
|
|
15422
|
+
setClaimedTokens([]);
|
|
15423
|
+
}, [chain]);
|
|
15400
15424
|
return (jsxs(Flex, { sx: { mt: '10px', flexDirection: 'column' }, children: [jsx(Text, { children: "SelectChain:" }), jsx(Flex, { sx: { width: '100px' }, children: jsx(Dropdown, { size: "sm", component: jsx(DropdownItem, { size: "sm", sx: { width: '100%' }, children: jsx(Flex, { sx: { width: '100%' }, children: chain }) }), sx: { background: 'white4', display: 'flex', alignItems: 'center' }, children: availableChains.map(function (chain, i) {
|
|
15401
15425
|
return (jsx(DropdownItem, { size: "sm", onClick: function () { return setChain(availableChains[i]); }, sx: { width: '100%' }, children: jsx(Flex, { sx: { width: '100%' }, children: chain }) }, chain));
|
|
15402
15426
|
}) }) }), jsxs(Flex, { sx: { position: 'relative' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', width: '300px' }, children: [jsx(Text, { sx: { my: '15px' }, children: " Available fees to collect: " }), filteredFees.map(function (fee) {
|
|
15403
15427
|
var _a;
|
|
15404
|
-
return (jsxs(Flex, { sx: { justifyContent: 'space-between' }, children: [jsx(Text, { sx: { fontSize: '14px', fontWeight: 400, width: '100px' }, children: (_a = fee.token.coinKey) !== null && _a !== void 0 ? _a : fee.token.symbol }), jsxs(Text, { sx: { fontSize: '14px', fontWeight: 400, width: '75px' }, children: ["$", fee.amountUsd] }), jsx(Button, { onClick: function () { return handleAddressChange(fee.token.address); }, sx: { fontSize: '12px', fontWeight: 500, height: '20px' }, children: "Select" })] }, fee.token.address));
|
|
15405
|
-
})] }), jsx(Flex, { sx: { mt: '10px', ml: '20px' }, children: jsxs(Flex, { sx: { flexDirection: 'column', position: 'sticky', top:
|
|
15428
|
+
return (jsxs(Flex, { sx: { justifyContent: 'space-between' }, children: [jsx(Text, { sx: { fontSize: '14px', fontWeight: 400, width: '100px' }, children: (_a = fee.token.coinKey) !== null && _a !== void 0 ? _a : fee.token.symbol }), jsxs(Text, { sx: { fontSize: '14px', fontWeight: 400, width: '75px' }, children: ["$", fee.amountUsd] }), jsx(Button, { onClick: function () { return handleAddressChange(fee.token.address); }, sx: { fontSize: '12px', fontWeight: 500, height: '20px' }, disabled: claimedTokens.length > 0 ? claimedTokens === null || claimedTokens === void 0 ? void 0 : claimedTokens.some(function (claimedToken) { var _a, _b; return claimedToken.toLowerCase() === ((_b = (_a = fee === null || fee === void 0 ? void 0 : fee.token) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b.toLowerCase()); }) : false, children: "Select" })] }, fee.token.address));
|
|
15429
|
+
})] }), jsx(Flex, { sx: { mt: '10px', ml: '20px' }, children: jsxs(Flex, { sx: { flexDirection: 'column', position: 'sticky', top: '75px', height: 'fit-content' }, children: [jsxs(Text, { sx: { fontSize: '12px', fontWeight: 500 }, children: ["Token Address: ", address] }), jsxs(Text, { sx: { fontSize: '12px', fontWeight: 500 }, children: ["Exists in token list:", jsx(Text, { sx: { color: exists ? 'success' : 'error', ml: '10px' }, children: exists.toString() })] }), jsx(Button, { onClick: sendTransactionRequest, children: "Collect!" })] }) })] })] }));
|
|
15406
15430
|
};
|
|
15407
15431
|
|
|
15408
15432
|
var colorScheme = {
|