@ape.swap/bonds-sdk 3.0.24 → 3.0.26
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/README.md
CHANGED
|
@@ -58,6 +58,7 @@ const MyBondsComponent = () => {
|
|
|
58
58
|
useHotBonds={true}
|
|
59
59
|
theme={{
|
|
60
60
|
"radii": "10px",
|
|
61
|
+
customFont: 'Poppins',
|
|
61
62
|
"colors": {
|
|
62
63
|
"primaryButton": "#6560C5",
|
|
63
64
|
"white1": "#0E0D16",
|
|
@@ -128,6 +129,8 @@ https://sdk.ape.bond/
|
|
|
128
129
|
|
|
129
130
|
Once you are happy with the styles, make sure to copy the output styles object and paste it under the `theme` param on the SDK component you will be using.
|
|
130
131
|
|
|
132
|
+
To use a custom font in the theme, include the `customFont` property with the name of your desired font family. Please note that you will need to manually download the font and embed it in your project using a `<script>` or `<link>` tag in your HTML file.
|
|
133
|
+
|
|
131
134
|
Bear in mind, that the components of the SDK will use the width and height provided by the parent component.
|
|
132
135
|
|
|
133
136
|
---
|
package/dist/main.js
CHANGED
|
@@ -17904,8 +17904,10 @@ var types = {};
|
|
|
17904
17904
|
exports.defaultBillArtCollection =
|
|
17905
17905
|
exports.BillArtCollection =
|
|
17906
17906
|
exports.BillVersion =
|
|
17907
|
-
exports.Wrappers =
|
|
17908
17907
|
exports.Protocols =
|
|
17908
|
+
exports.ProtocolsWithWrapper =
|
|
17909
|
+
exports.Wrappers =
|
|
17910
|
+
exports.PriceApiProtocols =
|
|
17909
17911
|
exports.ZapVersion =
|
|
17910
17912
|
exports.IchiSupportedDex =
|
|
17911
17913
|
exports.LiquidityDex =
|
|
@@ -17954,6 +17956,7 @@ var types = {};
|
|
|
17954
17956
|
ChainId[(ChainId['CROSSFI'] = 4158)] = 'CROSSFI';
|
|
17955
17957
|
ChainId[(ChainId['SONIC'] = 146)] = 'SONIC';
|
|
17956
17958
|
ChainId[(ChainId['MONAD_TESTNET'] = 10143)] = 'MONAD_TESTNET';
|
|
17959
|
+
ChainId[(ChainId['SOL'] = 7565164)] = 'SOL';
|
|
17957
17960
|
})((ChainId = exports.ChainId || (exports.ChainId = {})));
|
|
17958
17961
|
var LiquidityDex
|
|
17959
17962
|
;(function (LiquidityDex) {
|
|
@@ -17988,6 +17991,8 @@ var types = {};
|
|
|
17988
17991
|
LiquidityDex['Synthswap'] = 'Synthswap';
|
|
17989
17992
|
LiquidityDex['Aerodrome'] = 'Aerodrome';
|
|
17990
17993
|
LiquidityDex['SmarDex'] = 'SmarDex';
|
|
17994
|
+
LiquidityDex['TrebleSwapV2'] = 'TrebleSwap V2';
|
|
17995
|
+
LiquidityDex['TrebleAlgebraIntegral'] = 'Treble Algebra Integral';
|
|
17991
17996
|
//IOTA
|
|
17992
17997
|
LiquidityDex['MagicSea'] = 'MagicSea';
|
|
17993
17998
|
//ARBITRUM
|
|
@@ -18043,6 +18048,29 @@ var types = {};
|
|
|
18043
18048
|
ZapVersion['SoulZap'] = 'SoulZap';
|
|
18044
18049
|
ZapVersion['SoulZapApi'] = 'SoulZapApi';
|
|
18045
18050
|
})((ZapVersion = exports.ZapVersion || (exports.ZapVersion = {})));
|
|
18051
|
+
//Price API Protocols
|
|
18052
|
+
var PriceApiProtocols
|
|
18053
|
+
;(function (PriceApiProtocols) {
|
|
18054
|
+
PriceApiProtocols[(PriceApiProtocols['UniV2'] = 0)] = 'UniV2';
|
|
18055
|
+
PriceApiProtocols[(PriceApiProtocols['UniV3'] = 1)] = 'UniV3';
|
|
18056
|
+
PriceApiProtocols[(PriceApiProtocols['UniV4'] = 2)] = 'UniV4';
|
|
18057
|
+
PriceApiProtocols[(PriceApiProtocols['Algebra'] = 3)] = 'Algebra';
|
|
18058
|
+
PriceApiProtocols[(PriceApiProtocols['AlgebraIntegral'] = 4)] = 'AlgebraIntegral';
|
|
18059
|
+
PriceApiProtocols[(PriceApiProtocols['Solidly'] = 5)] = 'Solidly';
|
|
18060
|
+
PriceApiProtocols[(PriceApiProtocols['Curve'] = 6)] = 'Curve';
|
|
18061
|
+
})((PriceApiProtocols = exports.PriceApiProtocols || (exports.PriceApiProtocols = {})));
|
|
18062
|
+
(function (Wrappers) {
|
|
18063
|
+
Wrappers[(Wrappers['Gamma'] = 0)] = 'Gamma';
|
|
18064
|
+
Wrappers[(Wrappers['Ichi'] = 1)] = 'Ichi';
|
|
18065
|
+
Wrappers[(Wrappers['Steer'] = 2)] = 'Steer';
|
|
18066
|
+
})((exports.Wrappers || (exports.Wrappers = {})));
|
|
18067
|
+
exports.ProtocolsWithWrapper = [
|
|
18068
|
+
PriceApiProtocols.UniV3,
|
|
18069
|
+
PriceApiProtocols.UniV4,
|
|
18070
|
+
PriceApiProtocols.Algebra,
|
|
18071
|
+
PriceApiProtocols.AlgebraIntegral,
|
|
18072
|
+
];
|
|
18073
|
+
//Protocols
|
|
18046
18074
|
var Protocols
|
|
18047
18075
|
;(function (Protocols) {
|
|
18048
18076
|
Protocols[(Protocols['Both'] = 1)] = 'Both';
|
|
@@ -18056,11 +18084,6 @@ var types = {};
|
|
|
18056
18084
|
Protocols[(Protocols['Curve'] = 9)] = 'Curve';
|
|
18057
18085
|
Protocols[(Protocols['AlgebraIntegral'] = 10)] = 'AlgebraIntegral';
|
|
18058
18086
|
})((Protocols = exports.Protocols || (exports.Protocols = {})));
|
|
18059
|
-
(function (Wrappers) {
|
|
18060
|
-
Wrappers[(Wrappers['Gamma'] = 0)] = 'Gamma';
|
|
18061
|
-
Wrappers[(Wrappers['Ichi'] = 1)] = 'Ichi';
|
|
18062
|
-
Wrappers[(Wrappers['Steer'] = 2)] = 'Steer';
|
|
18063
|
-
})((exports.Wrappers || (exports.Wrappers = {})));
|
|
18064
18087
|
(function (BillVersion) {
|
|
18065
18088
|
BillVersion['V1'] = 'V1';
|
|
18066
18089
|
BillVersion['V2'] = 'V2';
|
|
@@ -18640,6 +18663,8 @@ var types = {};
|
|
|
18640
18663
|
(_6[LiquidityDex.ShadowExchange] = {}),
|
|
18641
18664
|
(_6[LiquidityDex.SwapX] = {}),
|
|
18642
18665
|
(_6[LiquidityDex.SwapXAlgebraIntegral] = {}),
|
|
18666
|
+
(_6[LiquidityDex.TrebleSwapV2] = {}),
|
|
18667
|
+
(_6[LiquidityDex.TrebleAlgebraIntegral] = {}),
|
|
18643
18668
|
_6);
|
|
18644
18669
|
|
|
18645
18670
|
} (types));
|
|
@@ -18911,7 +18936,7 @@ const defaultUrls = {
|
|
|
18911
18936
|
const useSDKConfig = (config) => {
|
|
18912
18937
|
const { data } = useQuery({
|
|
18913
18938
|
queryKey: [QUERY_KEYS.SDK_CONFIG],
|
|
18914
|
-
initialData: Object.assign(Object.assign({ useHotBonds: true, useRainbowKit: false, useTiers: false }, config), { urls: Object.assign(Object.assign({}, defaultUrls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.
|
|
18939
|
+
initialData: Object.assign(Object.assign({ useHotBonds: true, useRainbowKit: false, useTiers: false }, config), { urls: Object.assign(Object.assign({}, defaultUrls), config === null || config === void 0 ? void 0 : config.urls), highestCompatibleVersion: '2.1.1' }),
|
|
18915
18940
|
});
|
|
18916
18941
|
return data;
|
|
18917
18942
|
};
|
|
@@ -60880,7 +60905,7 @@ const getBillNftBatchData = (apiV2URL, billNftIds, billNftAddress, chainId) => _
|
|
|
60880
60905
|
return null;
|
|
60881
60906
|
}
|
|
60882
60907
|
// Make a GET request to the API to retrieve the batch data for the specified bill NFT IDs
|
|
60883
|
-
const response = yield axios.get(`${apiV2URL}/bills/batch/${chainId}/${billNftAddress}/?billIds[]=${billNftIds.join('&billIds[]=')}
|
|
60908
|
+
const response = yield axios.get(`${apiV2URL}/bills/batch/${chainId}/${billNftAddress}/?billIds[]=${billNftIds.join('&billIds[]=')}`, { timeout: 3000 });
|
|
60884
60909
|
// If the response status code is 500, return null
|
|
60885
60910
|
const billNftDataResp = yield response.data;
|
|
60886
60911
|
if (billNftDataResp.statusCode === 500) {
|
|
@@ -62256,7 +62281,7 @@ const TransferModal = ({ onDismiss, userBill }) => {
|
|
|
62256
62281
|
const { lpToken, earnToken } = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) !== null && _a !== void 0 ? _a : {};
|
|
62257
62282
|
const pending = chainId &&
|
|
62258
62283
|
((_e = getBalanceNumber(new BigNumber$1((_b = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _b !== void 0 ? _b : 0), (_d = (_c = earnToken === null || earnToken === void 0 ? void 0 : earnToken.decimals) === null || _c === void 0 ? void 0 : _c[chainId]) !== null && _d !== void 0 ? _d : 18)) === null || _e === void 0 ? void 0 : _e.toFixed(4));
|
|
62259
|
-
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond", zIndex: 130, children: [jsx$2(Flex, { sx: { mt: '20px' }, children: jsx$2(Text, { sx: { fontWeight: 700 }, children: " Transferring: " }) }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', mt: '30px', mr: '10px' }, children: [jsxs(Text, { sx: { fontWeight: 700, fontSize: '25px' }, children: [lpToken === null || lpToken === void 0 ? void 0 : lpToken.symbol, " #", userBill === null || userBill === void 0 ? void 0 : userBill.id] }), jsxs(Flex, { sx: { mt: '5px' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', mr: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Vesting time" }), getPendingVestingString(userBill)] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Pending" }), jsxs(Flex, { children: [jsx$2(TokenImage, { symbol: (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.showcaseTokenName) !== null && _g !== void 0 ? _g : (_j = (_h = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _h === void 0 ? void 0 : _h.earnToken) === null || _j === void 0 ? void 0 : _j.symbol, size: 20, chain: (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.chainId }), jsx$2(Text, { sx: { fontWeight: 700, ml: '5px' }, children: pending })] })] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', mt: '30px' }, children: [jsx$2(Text, { sx: { fontWeight: 700 }, children: "Receiving Address:" }), jsx$2(Input, { mt: "10px", size: "lg", placeholder: 'Paste the address here', value: toAddress, onChange: (e) => setToAddress(e.target.value), style: { width: '345px', border: 'none' } })] }), jsx$2(Flex, { sx: { mt: '15px' }, children: jsxs(Text, { sx: { lineHeight: '18px', fontSize: '12px', color: 'rgba(223, 65, 65, 1)' }, children: [jsx$2(Text, { sx: { display: 'block', width: '100%', fontWeight: 700, fontSize: '13px', color: 'rgba(223, 65, 65, 1)' }, children: "WARNING" }), "When transfering the NFT all pending rewards will also be transfered to the receiver address."] }) }), jsxs(Flex, { onClick: () => setConfirmSend((prev) => !prev), sx: { mt: '20px', cursor: 'pointer', alignItems: 'center' }, children: [jsx$2(Checkbox, { checked: confirmSend
|
|
62284
|
+
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond", zIndex: 130, children: [jsx$2(Flex, { sx: { mt: '20px' }, children: jsx$2(Text, { sx: { fontWeight: 700 }, children: " Transferring: " }) }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', mt: '30px', mr: '10px' }, children: [jsxs(Text, { sx: { fontWeight: 700, fontSize: '25px' }, children: [lpToken === null || lpToken === void 0 ? void 0 : lpToken.symbol, " #", userBill === null || userBill === void 0 ? void 0 : userBill.id] }), jsxs(Flex, { sx: { mt: '5px' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', mr: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Vesting time" }), getPendingVestingString(userBill)] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Pending" }), jsxs(Flex, { children: [jsx$2(TokenImage, { symbol: (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.showcaseTokenName) !== null && _g !== void 0 ? _g : (_j = (_h = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _h === void 0 ? void 0 : _h.earnToken) === null || _j === void 0 ? void 0 : _j.symbol, size: 20, chain: (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.chainId }), jsx$2(Text, { sx: { fontWeight: 700, ml: '5px' }, children: pending })] })] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', mt: '30px' }, children: [jsx$2(Text, { sx: { fontWeight: 700 }, children: "Receiving Address:" }), jsx$2(Input, { mt: "10px", size: "lg", placeholder: 'Paste the address here', value: toAddress, onChange: (e) => setToAddress(e.target.value), style: { width: '345px', border: 'none' } })] }), jsx$2(Flex, { sx: { mt: '15px' }, children: jsxs(Text, { sx: { lineHeight: '18px', fontSize: '12px', color: 'rgba(223, 65, 65, 1)' }, children: [jsx$2(Text, { sx: { display: 'block', width: '100%', fontWeight: 700, fontSize: '13px', color: 'rgba(223, 65, 65, 1)' }, children: "WARNING" }), "When transfering the NFT all pending rewards will also be transfered to the receiver address."] }) }), jsxs(Flex, { onClick: () => setConfirmSend((prev) => !prev), sx: { mt: '20px', cursor: 'pointer', alignItems: 'center' }, children: [jsx$2(Checkbox, { checked: confirmSend }), jsx$2(Text, { sx: { ml: '10px', fontSize: '12px', fontWeight: 500, lineHeight: '18px' }, children: "I understand the new wallet gains ownership of all unclaimed assets." })] }), jsx$2(Flex, { sx: { justifyContent: 'center', mt: '15px' }, children: jsx$2(TransferAction, { userBill: userBill, toAddress: toAddress, disabled: !confirmSend || !toAddress }) })] }));
|
|
62260
62285
|
};
|
|
62261
62286
|
var TransferBondModal = React__default.memo(TransferModal);
|
|
62262
62287
|
|
|
@@ -68652,233 +68677,6 @@ const zapInputTokens = {
|
|
|
68652
68677
|
],
|
|
68653
68678
|
};
|
|
68654
68679
|
|
|
68655
|
-
var ERC_20_ABI = [
|
|
68656
|
-
{
|
|
68657
|
-
constant: true,
|
|
68658
|
-
inputs: [
|
|
68659
|
-
],
|
|
68660
|
-
name: "name",
|
|
68661
|
-
outputs: [
|
|
68662
|
-
{
|
|
68663
|
-
name: "",
|
|
68664
|
-
type: "string"
|
|
68665
|
-
}
|
|
68666
|
-
],
|
|
68667
|
-
payable: false,
|
|
68668
|
-
stateMutability: "view",
|
|
68669
|
-
type: "function"
|
|
68670
|
-
},
|
|
68671
|
-
{
|
|
68672
|
-
constant: false,
|
|
68673
|
-
inputs: [
|
|
68674
|
-
{
|
|
68675
|
-
name: "_spender",
|
|
68676
|
-
type: "address"
|
|
68677
|
-
},
|
|
68678
|
-
{
|
|
68679
|
-
name: "_value",
|
|
68680
|
-
type: "uint256"
|
|
68681
|
-
}
|
|
68682
|
-
],
|
|
68683
|
-
name: "approve",
|
|
68684
|
-
outputs: [
|
|
68685
|
-
{
|
|
68686
|
-
name: "",
|
|
68687
|
-
type: "bool"
|
|
68688
|
-
}
|
|
68689
|
-
],
|
|
68690
|
-
payable: false,
|
|
68691
|
-
stateMutability: "nonpayable",
|
|
68692
|
-
type: "function"
|
|
68693
|
-
},
|
|
68694
|
-
{
|
|
68695
|
-
constant: true,
|
|
68696
|
-
inputs: [
|
|
68697
|
-
],
|
|
68698
|
-
name: "totalSupply",
|
|
68699
|
-
outputs: [
|
|
68700
|
-
{
|
|
68701
|
-
name: "",
|
|
68702
|
-
type: "uint256"
|
|
68703
|
-
}
|
|
68704
|
-
],
|
|
68705
|
-
payable: false,
|
|
68706
|
-
stateMutability: "view",
|
|
68707
|
-
type: "function"
|
|
68708
|
-
},
|
|
68709
|
-
{
|
|
68710
|
-
constant: false,
|
|
68711
|
-
inputs: [
|
|
68712
|
-
{
|
|
68713
|
-
name: "_from",
|
|
68714
|
-
type: "address"
|
|
68715
|
-
},
|
|
68716
|
-
{
|
|
68717
|
-
name: "_to",
|
|
68718
|
-
type: "address"
|
|
68719
|
-
},
|
|
68720
|
-
{
|
|
68721
|
-
name: "_value",
|
|
68722
|
-
type: "uint256"
|
|
68723
|
-
}
|
|
68724
|
-
],
|
|
68725
|
-
name: "transferFrom",
|
|
68726
|
-
outputs: [
|
|
68727
|
-
{
|
|
68728
|
-
name: "",
|
|
68729
|
-
type: "bool"
|
|
68730
|
-
}
|
|
68731
|
-
],
|
|
68732
|
-
payable: false,
|
|
68733
|
-
stateMutability: "nonpayable",
|
|
68734
|
-
type: "function"
|
|
68735
|
-
},
|
|
68736
|
-
{
|
|
68737
|
-
constant: true,
|
|
68738
|
-
inputs: [
|
|
68739
|
-
],
|
|
68740
|
-
name: "decimals",
|
|
68741
|
-
outputs: [
|
|
68742
|
-
{
|
|
68743
|
-
name: "",
|
|
68744
|
-
type: "uint8"
|
|
68745
|
-
}
|
|
68746
|
-
],
|
|
68747
|
-
payable: false,
|
|
68748
|
-
stateMutability: "view",
|
|
68749
|
-
type: "function"
|
|
68750
|
-
},
|
|
68751
|
-
{
|
|
68752
|
-
constant: true,
|
|
68753
|
-
inputs: [
|
|
68754
|
-
{
|
|
68755
|
-
name: "_owner",
|
|
68756
|
-
type: "address"
|
|
68757
|
-
}
|
|
68758
|
-
],
|
|
68759
|
-
name: "balanceOf",
|
|
68760
|
-
outputs: [
|
|
68761
|
-
{
|
|
68762
|
-
name: "balance",
|
|
68763
|
-
type: "uint256"
|
|
68764
|
-
}
|
|
68765
|
-
],
|
|
68766
|
-
payable: false,
|
|
68767
|
-
stateMutability: "view",
|
|
68768
|
-
type: "function"
|
|
68769
|
-
},
|
|
68770
|
-
{
|
|
68771
|
-
constant: true,
|
|
68772
|
-
inputs: [
|
|
68773
|
-
],
|
|
68774
|
-
name: "symbol",
|
|
68775
|
-
outputs: [
|
|
68776
|
-
{
|
|
68777
|
-
name: "",
|
|
68778
|
-
type: "string"
|
|
68779
|
-
}
|
|
68780
|
-
],
|
|
68781
|
-
payable: false,
|
|
68782
|
-
stateMutability: "view",
|
|
68783
|
-
type: "function"
|
|
68784
|
-
},
|
|
68785
|
-
{
|
|
68786
|
-
constant: false,
|
|
68787
|
-
inputs: [
|
|
68788
|
-
{
|
|
68789
|
-
name: "_to",
|
|
68790
|
-
type: "address"
|
|
68791
|
-
},
|
|
68792
|
-
{
|
|
68793
|
-
name: "_value",
|
|
68794
|
-
type: "uint256"
|
|
68795
|
-
}
|
|
68796
|
-
],
|
|
68797
|
-
name: "transfer",
|
|
68798
|
-
outputs: [
|
|
68799
|
-
{
|
|
68800
|
-
name: "",
|
|
68801
|
-
type: "bool"
|
|
68802
|
-
}
|
|
68803
|
-
],
|
|
68804
|
-
payable: false,
|
|
68805
|
-
stateMutability: "nonpayable",
|
|
68806
|
-
type: "function"
|
|
68807
|
-
},
|
|
68808
|
-
{
|
|
68809
|
-
constant: true,
|
|
68810
|
-
inputs: [
|
|
68811
|
-
{
|
|
68812
|
-
name: "_owner",
|
|
68813
|
-
type: "address"
|
|
68814
|
-
},
|
|
68815
|
-
{
|
|
68816
|
-
name: "_spender",
|
|
68817
|
-
type: "address"
|
|
68818
|
-
}
|
|
68819
|
-
],
|
|
68820
|
-
name: "allowance",
|
|
68821
|
-
outputs: [
|
|
68822
|
-
{
|
|
68823
|
-
name: "",
|
|
68824
|
-
type: "uint256"
|
|
68825
|
-
}
|
|
68826
|
-
],
|
|
68827
|
-
payable: false,
|
|
68828
|
-
stateMutability: "view",
|
|
68829
|
-
type: "function"
|
|
68830
|
-
},
|
|
68831
|
-
{
|
|
68832
|
-
payable: true,
|
|
68833
|
-
stateMutability: "payable",
|
|
68834
|
-
type: "fallback"
|
|
68835
|
-
},
|
|
68836
|
-
{
|
|
68837
|
-
anonymous: false,
|
|
68838
|
-
inputs: [
|
|
68839
|
-
{
|
|
68840
|
-
indexed: true,
|
|
68841
|
-
name: "owner",
|
|
68842
|
-
type: "address"
|
|
68843
|
-
},
|
|
68844
|
-
{
|
|
68845
|
-
indexed: true,
|
|
68846
|
-
name: "spender",
|
|
68847
|
-
type: "address"
|
|
68848
|
-
},
|
|
68849
|
-
{
|
|
68850
|
-
indexed: false,
|
|
68851
|
-
name: "value",
|
|
68852
|
-
type: "uint256"
|
|
68853
|
-
}
|
|
68854
|
-
],
|
|
68855
|
-
name: "Approval",
|
|
68856
|
-
type: "event"
|
|
68857
|
-
},
|
|
68858
|
-
{
|
|
68859
|
-
anonymous: false,
|
|
68860
|
-
inputs: [
|
|
68861
|
-
{
|
|
68862
|
-
indexed: true,
|
|
68863
|
-
name: "from",
|
|
68864
|
-
type: "address"
|
|
68865
|
-
},
|
|
68866
|
-
{
|
|
68867
|
-
indexed: true,
|
|
68868
|
-
name: "to",
|
|
68869
|
-
type: "address"
|
|
68870
|
-
},
|
|
68871
|
-
{
|
|
68872
|
-
indexed: false,
|
|
68873
|
-
name: "value",
|
|
68874
|
-
type: "uint256"
|
|
68875
|
-
}
|
|
68876
|
-
],
|
|
68877
|
-
name: "Transfer",
|
|
68878
|
-
type: "event"
|
|
68879
|
-
}
|
|
68880
|
-
];
|
|
68881
|
-
|
|
68882
68680
|
var PRICE_GETTER_V3_ABI = [
|
|
68883
68681
|
{
|
|
68884
68682
|
anonymous: false,
|
|
@@ -69771,11 +69569,11 @@ const getTokenPrices = (apeswapListsURL, chains) => __awaiter$9(void 0, void 0,
|
|
|
69771
69569
|
}
|
|
69772
69570
|
});
|
|
69773
69571
|
const getAllTokenPrices = (chainId, tokens) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69774
|
-
const {
|
|
69572
|
+
const { externalTokens, filterTokensToCall, arrayFilterTokens } = Object.keys(tokens).reduce((acc, key) => {
|
|
69775
69573
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
69776
69574
|
const token = tokens[key];
|
|
69777
69575
|
if (((_a = token === null || token === void 0 ? void 0 : token.liquidityDex) === null || _a === void 0 ? void 0 : _a[chainId]) === types.LiquidityDex.External) {
|
|
69778
|
-
acc.
|
|
69576
|
+
acc.externalTokens.push(Object.assign(Object.assign({}, token), { address: (_b = token.address[chainId]) !== null && _b !== void 0 ? _b : '', decimals: (_d = (_c = token === null || token === void 0 ? void 0 : token.decimals) === null || _c === void 0 ? void 0 : _c[chainId]) !== null && _d !== void 0 ? _d : 18, lpToken: (_e = token.lpToken) !== null && _e !== void 0 ? _e : false }));
|
|
69779
69577
|
}
|
|
69780
69578
|
else if ((token === null || token === void 0 ? void 0 : token.active) &&
|
|
69781
69579
|
token.address[chainId] &&
|
|
@@ -69789,7 +69587,7 @@ const getAllTokenPrices = (chainId, tokens) => __awaiter$9(void 0, void 0, void
|
|
|
69789
69587
|
},
|
|
69790
69588
|
// Accumulator
|
|
69791
69589
|
{
|
|
69792
|
-
|
|
69590
|
+
externalTokens: [],
|
|
69793
69591
|
filterTokensToCall: {},
|
|
69794
69592
|
arrayFilterTokens: [],
|
|
69795
69593
|
});
|
|
@@ -69805,7 +69603,7 @@ const getAllTokenPrices = (chainId, tokens) => __awaiter$9(void 0, void 0, void
|
|
|
69805
69603
|
};
|
|
69806
69604
|
});
|
|
69807
69605
|
}
|
|
69808
|
-
const
|
|
69606
|
+
const externalResults = yield getBatchTokensExternal({ chainId, tokens: externalTokens });
|
|
69809
69607
|
const tokenResults = yield getTokenPricesV3FromPriceGetter(filterTokensToCall, chainId);
|
|
69810
69608
|
const parsedTokenResults = arrayFilterTokens.map((token, i) => {
|
|
69811
69609
|
var _a, _b, _c;
|
|
@@ -69818,143 +69616,36 @@ const getAllTokenPrices = (chainId, tokens) => __awaiter$9(void 0, void 0, void
|
|
|
69818
69616
|
chainId,
|
|
69819
69617
|
};
|
|
69820
69618
|
});
|
|
69821
|
-
return [...parsedTokenResults, ...
|
|
69619
|
+
return [...parsedTokenResults, ...externalResults];
|
|
69822
69620
|
});
|
|
69823
|
-
const
|
|
69621
|
+
const getBatchTokensExternal = (params) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69824
69622
|
const { chainId, tokens } = params;
|
|
69825
|
-
// as I'm reutilizing the same array, I need to clone it to avoid changing the original array
|
|
69826
|
-
const tokensCopy = lodashExports.cloneDeep(tokens);
|
|
69827
69623
|
try {
|
|
69828
|
-
const baseURL = 'https://api.
|
|
69829
|
-
const
|
|
69830
|
-
|
|
69831
|
-
|
|
69832
|
-
const
|
|
69833
|
-
|
|
69834
|
-
|
|
69835
|
-
|
|
69836
|
-
|
|
69837
|
-
|
|
69838
|
-
{
|
|
69839
|
-
chainId: chainName,
|
|
69840
|
-
baseToken: {
|
|
69841
|
-
address: token.address,
|
|
69842
|
-
},
|
|
69843
|
-
liquidity: {
|
|
69844
|
-
usd: 1,
|
|
69845
|
-
},
|
|
69846
|
-
priceUsd: 1,
|
|
69847
|
-
},
|
|
69848
|
-
],
|
|
69849
|
-
};
|
|
69850
|
-
}
|
|
69851
|
-
if (symbol.toLowerCase() === 'inj' || symbol.toLowerCase() === 'winj') {
|
|
69852
|
-
token.address = 'inj';
|
|
69853
|
-
}
|
|
69854
|
-
if (token.symbol.toUpperCase() === 'WGLQ') {
|
|
69855
|
-
token.address = '0x9f9c8ec3534c3ce16f928381372bfbfbfb9f4d24';
|
|
69856
|
-
chainName = 'ethereum';
|
|
69857
|
-
}
|
|
69858
|
-
if (token.symbol.toUpperCase() === 'ETH' && chainId === types.ChainId.GRAPHLINQ) {
|
|
69859
|
-
token.address = '0x2170Ed0880ac9A755fd29B2688956BD959F933F8';
|
|
69860
|
-
chainName = 'bsc';
|
|
69861
|
-
}
|
|
69862
|
-
if (!chainName) {
|
|
69863
|
-
console.log(`Chain ${chainId} is not supported by dexscreener.`);
|
|
69864
|
-
return null;
|
|
69865
|
-
}
|
|
69866
|
-
else {
|
|
69867
|
-
chains.push(chainName);
|
|
69868
|
-
}
|
|
69869
|
-
let endpoint;
|
|
69870
|
-
if (lpToken) {
|
|
69871
|
-
if (!totalSupply) {
|
|
69872
|
-
const calls = [
|
|
69873
|
-
{
|
|
69874
|
-
address: token.address,
|
|
69875
|
-
name: 'totalSupply',
|
|
69876
|
-
},
|
|
69877
|
-
];
|
|
69878
|
-
const supply = getBalanceNumber((yield multicall(chainId, ERC_20_ABI, calls))[0], decimals);
|
|
69879
|
-
totalSupplies.push(supply);
|
|
69880
|
-
}
|
|
69881
|
-
else {
|
|
69882
|
-
totalSupplies.push(totalSupply);
|
|
69883
|
-
}
|
|
69884
|
-
endpoint = `pairs/${chainName}`;
|
|
69885
|
-
}
|
|
69886
|
-
else {
|
|
69887
|
-
endpoint = `tokens`;
|
|
69888
|
-
}
|
|
69889
|
-
const url = `${baseURL}/${endpoint}/${token.address}`;
|
|
69890
|
-
try {
|
|
69891
|
-
const response = yield axios.get(url);
|
|
69892
|
-
return response.data;
|
|
69893
|
-
}
|
|
69894
|
-
catch (error) {
|
|
69895
|
-
console.log(`Failed to fetch data for token ${token.address}: ${error}`);
|
|
69896
|
-
return null;
|
|
69897
|
-
}
|
|
69898
|
-
}));
|
|
69899
|
-
const result = yield Promise.all(calls);
|
|
69900
|
-
return result.map((response, index) => {
|
|
69624
|
+
const baseURL = 'https://price-api.ape.bond/prices';
|
|
69625
|
+
const tokensToCall = tokens.map((token) => token.address);
|
|
69626
|
+
if (tokensToCall.length === 0)
|
|
69627
|
+
return [];
|
|
69628
|
+
const response = yield axios.post(`${baseURL}`, {
|
|
69629
|
+
rpcUrl: 'string',
|
|
69630
|
+
tokens: tokensToCall,
|
|
69631
|
+
chain: chainId,
|
|
69632
|
+
});
|
|
69633
|
+
return response.data.map((token) => {
|
|
69901
69634
|
var _a;
|
|
69902
|
-
|
|
69903
|
-
|
|
69904
|
-
|
|
69905
|
-
|
|
69906
|
-
|
|
69907
|
-
|
|
69908
|
-
|
|
69909
|
-
if (token.lpToken) {
|
|
69910
|
-
const liquidity = response.pair.liquidity.usd;
|
|
69911
|
-
price = liquidity / supply;
|
|
69912
|
-
}
|
|
69913
|
-
else {
|
|
69914
|
-
const pairs = response.pairs;
|
|
69915
|
-
price = (_a = pairs
|
|
69916
|
-
.filter((pair) => pair.chainId === chains[index] && pair.baseToken.address.toLowerCase() === token.address.toLowerCase())
|
|
69917
|
-
.sort((a, b) => { var _a, _b; return ((_a = b === null || b === void 0 ? void 0 : b.liquidity) === null || _a === void 0 ? void 0 : _a.usd) - ((_b = a === null || a === void 0 ? void 0 : a.liquidity) === null || _b === void 0 ? void 0 : _b.usd); })[0]) === null || _a === void 0 ? void 0 : _a.priceUsd;
|
|
69918
|
-
}
|
|
69919
|
-
}
|
|
69920
|
-
catch (_b) {
|
|
69921
|
-
price = undefined;
|
|
69922
|
-
}
|
|
69923
|
-
let originalAddress = token.address;
|
|
69924
|
-
if (token.address === 'inj') {
|
|
69925
|
-
originalAddress = '0x4569348D39cc38F4d6a1180573Df73B7b03251d9';
|
|
69926
|
-
}
|
|
69927
|
-
if (token.address === '0x2170Ed0880ac9A755fd29B2688956BD959F933F8' && chainId === types.ChainId.GRAPHLINQ) {
|
|
69928
|
-
originalAddress = '0xbeED106D0f2e6950BFa1Eec74E1253CA0a643442';
|
|
69929
|
-
chainName = 'ethereum';
|
|
69930
|
-
}
|
|
69931
|
-
if (token.address === '0x9f9c8ec3534c3ce16f928381372bfbfbfb9f4d24') {
|
|
69932
|
-
originalAddress = '0xEB567ec41738c2bAb2599A1070FC5B727721b3B6';
|
|
69933
|
-
}
|
|
69934
|
-
return Object.assign(Object.assign({}, tokensCopy === null || tokensCopy === void 0 ? void 0 : tokensCopy[index]), { address: originalAddress, chainId, price: parseFloat(price !== null && price !== void 0 ? price : '0') });
|
|
69635
|
+
return {
|
|
69636
|
+
symbol: token.symbol,
|
|
69637
|
+
address: token.tokenAddress,
|
|
69638
|
+
price: parseFloat(token.price),
|
|
69639
|
+
decimals: (_a = tokens.find((t) => t.address.toLowerCase() === token.tokenAddress.toLowerCase())) === null || _a === void 0 ? void 0 : _a.decimals,
|
|
69640
|
+
chainId,
|
|
69641
|
+
};
|
|
69935
69642
|
});
|
|
69936
69643
|
}
|
|
69937
69644
|
catch (_a) {
|
|
69938
|
-
console.log(`Failed to get price from
|
|
69939
|
-
return
|
|
69940
|
-
return Object.assign(Object.assign({}, token), { chainId, price: undefined });
|
|
69941
|
-
});
|
|
69645
|
+
console.log(`Failed to get price from api for chain ${chainId}.`);
|
|
69646
|
+
return [];
|
|
69942
69647
|
}
|
|
69943
69648
|
});
|
|
69944
|
-
const getDexScreenerChainName = (chainId) => {
|
|
69945
|
-
const chainsName = {
|
|
69946
|
-
[types.ChainId.MAINNET]: 'ethereum',
|
|
69947
|
-
[types.ChainId.TLOS]: 'telos',
|
|
69948
|
-
[types.ChainId.BSC]: 'bsc',
|
|
69949
|
-
[types.ChainId.MATIC]: 'polygon',
|
|
69950
|
-
[types.ChainId.ARBITRUM]: 'arbitrum',
|
|
69951
|
-
[types.ChainId.INEVM]: 'injective',
|
|
69952
|
-
[types.ChainId.LINEA]: 'linea',
|
|
69953
|
-
[types.ChainId.GRAPHLINQ]: 'ethereum',
|
|
69954
|
-
};
|
|
69955
|
-
//@ts-ignore
|
|
69956
|
-
return chainsName[chainId];
|
|
69957
|
-
};
|
|
69958
69649
|
function getTokenPricesV3FromPriceGetter(tokensToCall, chain) {
|
|
69959
69650
|
return __awaiter$9(this, void 0, void 0, function* () {
|
|
69960
69651
|
const calls = [];
|
|
@@ -71004,8 +70695,35 @@ const LinkShare = ({ bondNFTData, userBill, chainId, }) => {
|
|
|
71004
70695
|
return (jsx$2(Flex$1, { sx: styles$b.containerLinksShare, children: bondNFTData && bondNFTData.data && (jsxs(Fragment$1, { children: [jsx$2(Link, { href: "https://app.fuul.xyz/incentives/apebond", target: "_blank", className: `fade-out ${hideTag ? 'hidden' : ''}`, children: jsx$2(Flex$1, { sx: styles$b.tagShareBond, children: "Share your Bonds and earn rewards!" }) }), jsx$2(Flex$1, { sx: styles$b.linkShareButton, onClick: () => handleShare(`https://twitter.com/intent/tweet?text=${text}&url=${shareUrl}`, 'x'), children: isLoading[0] ? jsx$2(Spinner, { size: 16 }) : jsx$2(Svg, { icon: "twitter", width: 24 }) }), jsx$2(Flex$1, { sx: styles$b.linkShareButton, onClick: () => handleShare(`https://warpcast.com/~/compose?text=${text}&embeds[]=${shareUrl}`, 'farcaster'), children: isLoading[1] ? jsx$2(Spinner, { size: 16 }) : jsx$2(Svg, { icon: "Farcaster", width: 16 }) })] })) }));
|
|
71005
70696
|
};
|
|
71006
70697
|
|
|
70698
|
+
// Custom HTML sanitizer
|
|
70699
|
+
function sanitizeHTML(html) {
|
|
70700
|
+
var _a;
|
|
70701
|
+
const tagWhitelist = ['a', 'br', 'span']; // Allowed tags
|
|
70702
|
+
const attrWhitelist = ['target', 'rel', 'style', 'href']; // Allowed attributes
|
|
70703
|
+
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
70704
|
+
const elements = doc.body.querySelectorAll('*');
|
|
70705
|
+
for (const el of elements) {
|
|
70706
|
+
// Remove elements that are not in the whitelist
|
|
70707
|
+
if (!tagWhitelist.includes(el.tagName.toLowerCase())) {
|
|
70708
|
+
(_a = el === null || el === void 0 ? void 0 : el.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(el);
|
|
70709
|
+
continue;
|
|
70710
|
+
}
|
|
70711
|
+
// Loop through the element's attributes and remove those that are not in the whitelist
|
|
70712
|
+
Array.from(el.attributes).forEach((attr) => {
|
|
70713
|
+
if (!attrWhitelist.includes(attr.name.toLowerCase())) {
|
|
70714
|
+
el.removeAttribute(attr.name);
|
|
70715
|
+
}
|
|
70716
|
+
});
|
|
70717
|
+
}
|
|
70718
|
+
return doc.body.innerHTML;
|
|
70719
|
+
}
|
|
70720
|
+
const SafeHTMLComponent = ({ html }) => {
|
|
70721
|
+
const sanitizedHTML = sanitizeHTML(html);
|
|
70722
|
+
return jsx$2("div", { dangerouslySetInnerHTML: { __html: sanitizedHTML } });
|
|
70723
|
+
};
|
|
70724
|
+
|
|
71007
70725
|
const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
71008
|
-
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, _5;
|
|
70726
|
+
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, _5, _6, _7;
|
|
71009
70727
|
// Hooks
|
|
71010
70728
|
const chainId = useChainId();
|
|
71011
70729
|
const { switchChain } = useSwitchChain();
|
|
@@ -71108,11 +70826,16 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
71108
70826
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
71109
70827
|
fontWeight: [500, 500, 500, 400],
|
|
71110
70828
|
paddingLeft: '10px',
|
|
71111
|
-
}, children: `($${(claimable(userBill) * ((_4 = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.price) !== null && _4 !== void 0 ? _4 : 0)).toFixed(2)})` })] })] })] })] }),
|
|
70829
|
+
}, children: `($${(claimable(userBill) * ((_4 = earnTokenPrice === null || earnTokenPrice === void 0 ? void 0 : earnTokenPrice.price) !== null && _4 !== void 0 ? _4 : 0)).toFixed(2)})` })] })] })] })] }), ((_5 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _5 === void 0 ? void 0 : _5.warningCard) && (jsx$2(Flex$1, { sx: {
|
|
70830
|
+
width: '100%',
|
|
70831
|
+
background: '#DE62F366',
|
|
70832
|
+
justifyContent: 'center',
|
|
70833
|
+
borderRadius: 'normal',
|
|
70834
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (_6 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _6 === void 0 ? void 0 : _6.warningCard }) }) })), jsxs(Flex$1, { className: "yourbondinfo button-container", children: [jsx$2(Flex$1, { className: "button-container claim", children: userBill && chainId !== (userBill === null || userBill === void 0 ? void 0 : userBill.bond.chainId) ? (jsxs(Button, { className: "switch-button", disabled: claimable(userBill) === 0 || load, onClick: (event) => {
|
|
71112
70835
|
var _a;
|
|
71113
70836
|
event.stopPropagation();
|
|
71114
70837
|
switchChain({ chainId: (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId });
|
|
71115
|
-
}, children: ["Switch to ", NETWORK_LABEL[(
|
|
70838
|
+
}, children: ["Switch to ", NETWORK_LABEL[(_7 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _7 === void 0 ? void 0 : _7.chainId]] })) : (jsx$2(Button, { className: "claim-button", disabled: claimable(userBill) === 0 || load || !userBill || isPendingCliff, load: load, onClick: (event) => {
|
|
71116
70839
|
event.stopPropagation();
|
|
71117
70840
|
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
71118
70841
|
}, children: isPendingCliff
|
|
@@ -71730,7 +71453,7 @@ const ChainOptionsButtons = ({ selectedChain, setSelectedChain, setViewAllChains
|
|
|
71730
71453
|
|
|
71731
71454
|
const ClaimAllModal = () => {
|
|
71732
71455
|
var _a, _b;
|
|
71733
|
-
const { chainId } = useAccount();
|
|
71456
|
+
const { chainId, address: account } = useAccount();
|
|
71734
71457
|
const { switchChain } = useSwitchChain();
|
|
71735
71458
|
const SDKConfig = useSDKConfig();
|
|
71736
71459
|
const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
|
|
@@ -71763,8 +71486,6 @@ const ClaimAllModal = () => {
|
|
|
71763
71486
|
try {
|
|
71764
71487
|
bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.map((purchasedBond) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
71765
71488
|
const address = purchasedBond.bond.contractAddress[purchasedBond.bond.chainId];
|
|
71766
|
-
console.log(purchasedBond);
|
|
71767
|
-
console.log(address);
|
|
71768
71489
|
track({
|
|
71769
71490
|
event: 'bond',
|
|
71770
71491
|
chain: purchasedBond.bond.chainId,
|
|
@@ -71775,12 +71496,12 @@ const ClaimAllModal = () => {
|
|
|
71775
71496
|
},
|
|
71776
71497
|
});
|
|
71777
71498
|
return writeContractAsync({
|
|
71778
|
-
address
|
|
71499
|
+
address,
|
|
71779
71500
|
abi: BOND_ABI,
|
|
71780
71501
|
functionName: 'batchRedeem',
|
|
71781
71502
|
args: [purchasedBond.userOwnedBills.map((b) => b.id)],
|
|
71782
71503
|
chain: chainId,
|
|
71783
|
-
account
|
|
71504
|
+
account,
|
|
71784
71505
|
});
|
|
71785
71506
|
}));
|
|
71786
71507
|
}
|
|
@@ -74711,6 +74432,233 @@ function isAddress(value) {
|
|
|
74711
74432
|
}
|
|
74712
74433
|
}
|
|
74713
74434
|
|
|
74435
|
+
var ERC_20_ABI = [
|
|
74436
|
+
{
|
|
74437
|
+
constant: true,
|
|
74438
|
+
inputs: [
|
|
74439
|
+
],
|
|
74440
|
+
name: "name",
|
|
74441
|
+
outputs: [
|
|
74442
|
+
{
|
|
74443
|
+
name: "",
|
|
74444
|
+
type: "string"
|
|
74445
|
+
}
|
|
74446
|
+
],
|
|
74447
|
+
payable: false,
|
|
74448
|
+
stateMutability: "view",
|
|
74449
|
+
type: "function"
|
|
74450
|
+
},
|
|
74451
|
+
{
|
|
74452
|
+
constant: false,
|
|
74453
|
+
inputs: [
|
|
74454
|
+
{
|
|
74455
|
+
name: "_spender",
|
|
74456
|
+
type: "address"
|
|
74457
|
+
},
|
|
74458
|
+
{
|
|
74459
|
+
name: "_value",
|
|
74460
|
+
type: "uint256"
|
|
74461
|
+
}
|
|
74462
|
+
],
|
|
74463
|
+
name: "approve",
|
|
74464
|
+
outputs: [
|
|
74465
|
+
{
|
|
74466
|
+
name: "",
|
|
74467
|
+
type: "bool"
|
|
74468
|
+
}
|
|
74469
|
+
],
|
|
74470
|
+
payable: false,
|
|
74471
|
+
stateMutability: "nonpayable",
|
|
74472
|
+
type: "function"
|
|
74473
|
+
},
|
|
74474
|
+
{
|
|
74475
|
+
constant: true,
|
|
74476
|
+
inputs: [
|
|
74477
|
+
],
|
|
74478
|
+
name: "totalSupply",
|
|
74479
|
+
outputs: [
|
|
74480
|
+
{
|
|
74481
|
+
name: "",
|
|
74482
|
+
type: "uint256"
|
|
74483
|
+
}
|
|
74484
|
+
],
|
|
74485
|
+
payable: false,
|
|
74486
|
+
stateMutability: "view",
|
|
74487
|
+
type: "function"
|
|
74488
|
+
},
|
|
74489
|
+
{
|
|
74490
|
+
constant: false,
|
|
74491
|
+
inputs: [
|
|
74492
|
+
{
|
|
74493
|
+
name: "_from",
|
|
74494
|
+
type: "address"
|
|
74495
|
+
},
|
|
74496
|
+
{
|
|
74497
|
+
name: "_to",
|
|
74498
|
+
type: "address"
|
|
74499
|
+
},
|
|
74500
|
+
{
|
|
74501
|
+
name: "_value",
|
|
74502
|
+
type: "uint256"
|
|
74503
|
+
}
|
|
74504
|
+
],
|
|
74505
|
+
name: "transferFrom",
|
|
74506
|
+
outputs: [
|
|
74507
|
+
{
|
|
74508
|
+
name: "",
|
|
74509
|
+
type: "bool"
|
|
74510
|
+
}
|
|
74511
|
+
],
|
|
74512
|
+
payable: false,
|
|
74513
|
+
stateMutability: "nonpayable",
|
|
74514
|
+
type: "function"
|
|
74515
|
+
},
|
|
74516
|
+
{
|
|
74517
|
+
constant: true,
|
|
74518
|
+
inputs: [
|
|
74519
|
+
],
|
|
74520
|
+
name: "decimals",
|
|
74521
|
+
outputs: [
|
|
74522
|
+
{
|
|
74523
|
+
name: "",
|
|
74524
|
+
type: "uint8"
|
|
74525
|
+
}
|
|
74526
|
+
],
|
|
74527
|
+
payable: false,
|
|
74528
|
+
stateMutability: "view",
|
|
74529
|
+
type: "function"
|
|
74530
|
+
},
|
|
74531
|
+
{
|
|
74532
|
+
constant: true,
|
|
74533
|
+
inputs: [
|
|
74534
|
+
{
|
|
74535
|
+
name: "_owner",
|
|
74536
|
+
type: "address"
|
|
74537
|
+
}
|
|
74538
|
+
],
|
|
74539
|
+
name: "balanceOf",
|
|
74540
|
+
outputs: [
|
|
74541
|
+
{
|
|
74542
|
+
name: "balance",
|
|
74543
|
+
type: "uint256"
|
|
74544
|
+
}
|
|
74545
|
+
],
|
|
74546
|
+
payable: false,
|
|
74547
|
+
stateMutability: "view",
|
|
74548
|
+
type: "function"
|
|
74549
|
+
},
|
|
74550
|
+
{
|
|
74551
|
+
constant: true,
|
|
74552
|
+
inputs: [
|
|
74553
|
+
],
|
|
74554
|
+
name: "symbol",
|
|
74555
|
+
outputs: [
|
|
74556
|
+
{
|
|
74557
|
+
name: "",
|
|
74558
|
+
type: "string"
|
|
74559
|
+
}
|
|
74560
|
+
],
|
|
74561
|
+
payable: false,
|
|
74562
|
+
stateMutability: "view",
|
|
74563
|
+
type: "function"
|
|
74564
|
+
},
|
|
74565
|
+
{
|
|
74566
|
+
constant: false,
|
|
74567
|
+
inputs: [
|
|
74568
|
+
{
|
|
74569
|
+
name: "_to",
|
|
74570
|
+
type: "address"
|
|
74571
|
+
},
|
|
74572
|
+
{
|
|
74573
|
+
name: "_value",
|
|
74574
|
+
type: "uint256"
|
|
74575
|
+
}
|
|
74576
|
+
],
|
|
74577
|
+
name: "transfer",
|
|
74578
|
+
outputs: [
|
|
74579
|
+
{
|
|
74580
|
+
name: "",
|
|
74581
|
+
type: "bool"
|
|
74582
|
+
}
|
|
74583
|
+
],
|
|
74584
|
+
payable: false,
|
|
74585
|
+
stateMutability: "nonpayable",
|
|
74586
|
+
type: "function"
|
|
74587
|
+
},
|
|
74588
|
+
{
|
|
74589
|
+
constant: true,
|
|
74590
|
+
inputs: [
|
|
74591
|
+
{
|
|
74592
|
+
name: "_owner",
|
|
74593
|
+
type: "address"
|
|
74594
|
+
},
|
|
74595
|
+
{
|
|
74596
|
+
name: "_spender",
|
|
74597
|
+
type: "address"
|
|
74598
|
+
}
|
|
74599
|
+
],
|
|
74600
|
+
name: "allowance",
|
|
74601
|
+
outputs: [
|
|
74602
|
+
{
|
|
74603
|
+
name: "",
|
|
74604
|
+
type: "uint256"
|
|
74605
|
+
}
|
|
74606
|
+
],
|
|
74607
|
+
payable: false,
|
|
74608
|
+
stateMutability: "view",
|
|
74609
|
+
type: "function"
|
|
74610
|
+
},
|
|
74611
|
+
{
|
|
74612
|
+
payable: true,
|
|
74613
|
+
stateMutability: "payable",
|
|
74614
|
+
type: "fallback"
|
|
74615
|
+
},
|
|
74616
|
+
{
|
|
74617
|
+
anonymous: false,
|
|
74618
|
+
inputs: [
|
|
74619
|
+
{
|
|
74620
|
+
indexed: true,
|
|
74621
|
+
name: "owner",
|
|
74622
|
+
type: "address"
|
|
74623
|
+
},
|
|
74624
|
+
{
|
|
74625
|
+
indexed: true,
|
|
74626
|
+
name: "spender",
|
|
74627
|
+
type: "address"
|
|
74628
|
+
},
|
|
74629
|
+
{
|
|
74630
|
+
indexed: false,
|
|
74631
|
+
name: "value",
|
|
74632
|
+
type: "uint256"
|
|
74633
|
+
}
|
|
74634
|
+
],
|
|
74635
|
+
name: "Approval",
|
|
74636
|
+
type: "event"
|
|
74637
|
+
},
|
|
74638
|
+
{
|
|
74639
|
+
anonymous: false,
|
|
74640
|
+
inputs: [
|
|
74641
|
+
{
|
|
74642
|
+
indexed: true,
|
|
74643
|
+
name: "from",
|
|
74644
|
+
type: "address"
|
|
74645
|
+
},
|
|
74646
|
+
{
|
|
74647
|
+
indexed: true,
|
|
74648
|
+
name: "to",
|
|
74649
|
+
type: "address"
|
|
74650
|
+
},
|
|
74651
|
+
{
|
|
74652
|
+
indexed: false,
|
|
74653
|
+
name: "value",
|
|
74654
|
+
type: "uint256"
|
|
74655
|
+
}
|
|
74656
|
+
],
|
|
74657
|
+
name: "Transfer",
|
|
74658
|
+
type: "event"
|
|
74659
|
+
}
|
|
74660
|
+
];
|
|
74661
|
+
|
|
74714
74662
|
function useCurrencyBalance(currency, account, chainId) {
|
|
74715
74663
|
return useQuery({
|
|
74716
74664
|
queryKey: [
|
|
@@ -76545,33 +76493,6 @@ const Estimations = ({ depositAmount, bondData, youSpendString, isZap, fetchingZ
|
|
|
76545
76493
|
} }), jsxs(Flex, { className: "row-container premium", sx: { zIndex: 1 }, children: [jsx$2("img", { src: `/images/launch/${tierName === null || tierName === void 0 ? void 0 : tierName.toLowerCase()}.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { sx: { color: 'success', mr: '3px', fontWeight: 700 }, children: boostMap[userTier] }), "Boost:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Boost }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val premium-positive`, children: ["$ ", formatUSDNumber(boostAmount.toString())] }))] })), !!bondData.feeInPayout && (jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Fee:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex, { children: ["This is the platform fee (", bondData.feeInPayout, "%)."] }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: `row-container premium-val`, children: ["$ ", formatUSDNumber(feeUSD.toString())] }))] })), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You Get (over ", vestingTime(((_c = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _c !== void 0 ? _c : 0) - ((_d = bondData.vestingCliff) !== null && _d !== void 0 ? _d : 0)).days, " days):"] }), isZap && fetchingZapQuote ? (jsx$2(Dots, {})) : isZap && zapError ? ('-') : (jsxs(Flex, { className: "row-container get-val", children: [formatNumber$1(estimatedOutputAmount.toString()), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(estimatedOutputUSD.toString())] }))] })] }));
|
|
76546
76494
|
};
|
|
76547
76495
|
|
|
76548
|
-
// Custom HTML sanitizer
|
|
76549
|
-
function sanitizeHTML(html) {
|
|
76550
|
-
var _a;
|
|
76551
|
-
const tagWhitelist = ['a', 'br', 'span']; // Allowed tags
|
|
76552
|
-
const attrWhitelist = ['target', 'rel', 'style', 'href']; // Allowed attributes
|
|
76553
|
-
const doc = new DOMParser().parseFromString(html, 'text/html');
|
|
76554
|
-
const elements = doc.body.querySelectorAll('*');
|
|
76555
|
-
for (const el of elements) {
|
|
76556
|
-
// Remove elements that are not in the whitelist
|
|
76557
|
-
if (!tagWhitelist.includes(el.tagName.toLowerCase())) {
|
|
76558
|
-
(_a = el === null || el === void 0 ? void 0 : el.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(el);
|
|
76559
|
-
continue;
|
|
76560
|
-
}
|
|
76561
|
-
// Loop through the element's attributes and remove those that are not in the whitelist
|
|
76562
|
-
Array.from(el.attributes).forEach((attr) => {
|
|
76563
|
-
if (!attrWhitelist.includes(attr.name.toLowerCase())) {
|
|
76564
|
-
el.removeAttribute(attr.name);
|
|
76565
|
-
}
|
|
76566
|
-
});
|
|
76567
|
-
}
|
|
76568
|
-
return doc.body.innerHTML;
|
|
76569
|
-
}
|
|
76570
|
-
const SafeHTMLComponent = ({ html }) => {
|
|
76571
|
-
const sanitizedHTML = sanitizeHTML(html);
|
|
76572
|
-
return jsx$2("div", { dangerouslySetInnerHTML: { __html: sanitizedHTML } });
|
|
76573
|
-
};
|
|
76574
|
-
|
|
76575
76496
|
var ABTestKeys;
|
|
76576
76497
|
(function (ABTestKeys) {
|
|
76577
76498
|
ABTestKeys["BOND_DESCRIPTION"] = "bondDescription";
|
|
@@ -76754,7 +76675,7 @@ const GetUpToComponent = ({ bond, depositAmount }) => {
|
|
|
76754
76675
|
};
|
|
76755
76676
|
|
|
76756
76677
|
const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isProjectView }) => {
|
|
76757
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
76678
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
76758
76679
|
const SDKConfig = useSDKConfig();
|
|
76759
76680
|
const { data: geoData } = useGeoFencing();
|
|
76760
76681
|
// Hooks
|
|
@@ -77004,13 +76925,13 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
77004
76925
|
console.log('change to native');
|
|
77005
76926
|
}
|
|
77006
76927
|
}, [inputCurrencyBalance]);
|
|
77007
|
-
return bondData ? (jsxs(Flex, { className: `modal-content ${isGoldRush ? 'gold-rush' : ''}`, children: [jsx$2("div", { className: "gold-ribbon" }), jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }), jsx$2(ProjectDescription, { description: bondData.shortDescription, isProjectView: true }), jsx$2(Flex, { sx: { width: '100%', display: isProjectView ? ['flex', 'flex', 'flex', 'none'] : 'flex' }, children: jsx$2(BondCards, { bondData: bondData }) }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price, inputDisabled: isUserRestricted }), SDKConfig.useTiers && jsx$2(GetUpToComponent, { bond: bondData, depositAmount: depositAmount }), (
|
|
76928
|
+
return bondData ? (jsxs(Flex, { className: `modal-content ${isGoldRush ? 'gold-rush' : ''}`, children: [jsx$2("div", { className: "gold-ribbon" }), jsxs(Flex, { className: "modaltable-container", children: [jsx$2(BondModalHeader, { bondData: bondData, onDismiss: onDismiss, showProjectInfoButton: (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.referenceId) === 'apebond' }), jsx$2(ProjectDescription, { description: bondData.shortDescription, isProjectView: true }), jsx$2(Flex, { sx: { width: '100%', display: isProjectView ? ['flex', 'flex', 'flex', 'none'] : 'flex' }, children: jsx$2(BondCards, { bondData: bondData }) }), jsx$2(Estimations, { depositAmount: depositAmount, bondData: bondData, youSpendString: youSpendString, isZap: isZap, fetchingZapQuote: fetchingZapQuote, zapError: zapError }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId), bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price, inputDisabled: isUserRestricted }), SDKConfig.useTiers && jsx$2(GetUpToComponent, { bond: bondData, depositAmount: depositAmount }), (bondData === null || bondData === void 0 ? void 0 : bondData.warningCard) && (jsx$2(Flex, { sx: {
|
|
77008
76929
|
width: '100%',
|
|
77009
76930
|
background: '#DE62F366',
|
|
77010
76931
|
justifyContent: 'center',
|
|
77011
76932
|
mt: '15px',
|
|
77012
76933
|
borderRadius: 'normal',
|
|
77013
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children:
|
|
76934
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: bondData === null || bondData === void 0 ? void 0 : bondData.warningCard }) }) })), jsxs(Flex, { className: "modaltable-container button-container", children: [account && (jsx$2(Flex, { className: "button-container get", children: jsx$2(Button, { className: "action-button", onClick: () => bondData.billVersion === types.BillVersion.V4 && SDKConfig.useTiers
|
|
77014
76935
|
? window.open('http://ape.bond/tier-staking', '_blank')
|
|
77015
76936
|
: supportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId)
|
|
77016
76937
|
? handleOpenZapModal()
|
|
@@ -78469,6 +78390,11 @@ const Providers = ({ children, theme }) => {
|
|
|
78469
78390
|
if ((themeToUse === null || themeToUse === void 0 ? void 0 : themeToUse.radii) && (theme === null || theme === void 0 ? void 0 : theme.radii)) {
|
|
78470
78391
|
themeToUse.radii = { normal: theme === null || theme === void 0 ? void 0 : theme.radii };
|
|
78471
78392
|
}
|
|
78393
|
+
if ((themeToUse === null || themeToUse === void 0 ? void 0 : themeToUse.fonts) && (theme === null || theme === void 0 ? void 0 : theme.customFont)) {
|
|
78394
|
+
themeToUse.fonts = {
|
|
78395
|
+
body: `${theme === null || theme === void 0 ? void 0 : theme.customFont}, sans-serif`,
|
|
78396
|
+
};
|
|
78397
|
+
}
|
|
78472
78398
|
return (jsx$2(ThemeUIProvider, { theme: themeToUse, children: jsx$2(ModalProvider, { children: jsx$2(Popups, { children: children }) }) }));
|
|
78473
78399
|
};
|
|
78474
78400
|
|
|
@@ -9,5 +9,4 @@ export interface TokenPrices {
|
|
|
9
9
|
}
|
|
10
10
|
export default function useTokenPrices(): UseQueryResult<TokenPrices[]>;
|
|
11
11
|
export declare const getTokenPrices: (apeswapListsURL: string, chains: number[]) => Promise<TokenPrices[]>;
|
|
12
|
-
export declare const getDexScreenerChainName: (chainId: ChainId) => string | undefined;
|
|
13
12
|
export declare function getTokenPricesV3FromPriceGetter(tokensToCall: Record<string, Token>, chain: ChainId): Promise<any>;
|
package/dist/types/bonds.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BondsData } from '../../types/bonds';
|
|
1
|
+
import { BondsData, TrueBondPrices } from '../../types/bonds';
|
|
2
2
|
/**
|
|
3
3
|
* Finds the highest TrueBondPrices element where userPoints is higher than points in the array.
|
|
4
4
|
* @param userPoints - The user's points as a string representing a BigNumber.
|
|
5
5
|
* @param bondData - Bond Data containing an array of TrueBondPrices to analyze.
|
|
6
6
|
* @returns The highest TrueBondPrices element where userPoints is higher than the item's points, or `undefined` if none matches.
|
|
7
7
|
*/
|
|
8
|
-
export declare const findHighestTrueBondPrice: (userPoints?: string | null, bondData?: BondsData) =>
|
|
8
|
+
export declare const findHighestTrueBondPrice: (userPoints?: string | null, bondData?: BondsData) => TrueBondPrices;
|
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": "3.0.
|
|
6
|
+
"version": "3.0.26",
|
|
7
7
|
"module": "dist/main.js",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"types": "dist/main.d.ts",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"yalc": "^1.0.0-pre.53"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@ape.swap/apeswap-lists": "4.
|
|
60
|
+
"@ape.swap/apeswap-lists": "4.3.0",
|
|
61
61
|
"@emotion/react": "11.11.4",
|
|
62
62
|
"bignumber.js": "^9.1.2",
|
|
63
63
|
"chart.js": "4.2.0",
|