@ape.swap/bonds-sdk 3.0.63 → 3.0.64
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/main.js +239 -44
- package/dist/state/bonds/useBondsData.d.ts +1 -1
- package/dist/state/bonds/useBondsList.d.ts +1 -1
- package/dist/state/bonds/useHotBonds.d.ts +1 -1
- package/dist/state/bonds/useUserBonds.d.ts +1 -1
- package/dist/state/bonds/useUserTokensBalance.d.ts +1 -1
- package/dist/state/preTGEBonds/usePreTGEBondsData.d.ts +1 -1
- package/dist/state/preTGEBonds/usePreTGEList.d.ts +1 -1
- package/dist/state/preTGEBonds/usePreTGEUserBonds.d.ts +1 -1
- package/dist/state/tiers/useTierPoints.d.ts +1 -1
- package/dist/state/tokenPrices/useTokenPrices.d.ts +1 -1
- package/dist/utils/reportError.d.ts +8 -0
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -58329,6 +58329,37 @@ const useURLByEnvironment = (key) => {
|
|
|
58329
58329
|
return config === null || config === void 0 ? void 0 : config.urls[key];
|
|
58330
58330
|
};
|
|
58331
58331
|
|
|
58332
|
+
function reportError(_a) {
|
|
58333
|
+
return __awaiter$9(this, arguments, void 0, function* ({ apiUrl, error, extraInfo = {}, chainId, account, rpc, }) {
|
|
58334
|
+
const isClient = typeof window !== 'undefined';
|
|
58335
|
+
const url = isClient ? window.location.href : null;
|
|
58336
|
+
const errors = {
|
|
58337
|
+
message: error instanceof Error ? error.message : String(error),
|
|
58338
|
+
stack: error instanceof Error ? error.stack : null,
|
|
58339
|
+
extra: extraInfo,
|
|
58340
|
+
};
|
|
58341
|
+
const payload = {
|
|
58342
|
+
chainId: chainId,
|
|
58343
|
+
walletAddress: account,
|
|
58344
|
+
rpc,
|
|
58345
|
+
url,
|
|
58346
|
+
log: errors,
|
|
58347
|
+
};
|
|
58348
|
+
try {
|
|
58349
|
+
yield fetch(`${apiUrl}/stats/log`, {
|
|
58350
|
+
method: 'POST',
|
|
58351
|
+
body: JSON.stringify(payload),
|
|
58352
|
+
headers: {
|
|
58353
|
+
'Content-Type': 'application/json',
|
|
58354
|
+
},
|
|
58355
|
+
});
|
|
58356
|
+
}
|
|
58357
|
+
catch (err) {
|
|
58358
|
+
console.error('Error reporting the error:', err);
|
|
58359
|
+
}
|
|
58360
|
+
});
|
|
58361
|
+
}
|
|
58362
|
+
|
|
58332
58363
|
/**
|
|
58333
58364
|
* @deprecated This map is deprecated. Boost values are now being retrieved from the Realtime API.
|
|
58334
58365
|
*/
|
|
@@ -58385,7 +58416,7 @@ const getUserTier = (weight) => {
|
|
|
58385
58416
|
else
|
|
58386
58417
|
return null;
|
|
58387
58418
|
};
|
|
58388
|
-
const fetchUserPoints = (account, useTiers) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
58419
|
+
const fetchUserPoints = (account, useTiers, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
58389
58420
|
const lensContractAddress = LENS_CONTRACT[types.ChainId.BSC];
|
|
58390
58421
|
if (account && useTiers) {
|
|
58391
58422
|
try {
|
|
@@ -58400,6 +58431,12 @@ const fetchUserPoints = (account, useTiers) => __awaiter$9(void 0, void 0, void
|
|
|
58400
58431
|
}
|
|
58401
58432
|
catch (e) {
|
|
58402
58433
|
console.error(e);
|
|
58434
|
+
reportError({
|
|
58435
|
+
apiUrl,
|
|
58436
|
+
error: e,
|
|
58437
|
+
extraInfo: { type: 'fetchUserPoints', e },
|
|
58438
|
+
account,
|
|
58439
|
+
});
|
|
58403
58440
|
return '0';
|
|
58404
58441
|
}
|
|
58405
58442
|
}
|
|
@@ -58407,11 +58444,13 @@ const fetchUserPoints = (account, useTiers) => __awaiter$9(void 0, void 0, void
|
|
|
58407
58444
|
return '0';
|
|
58408
58445
|
});
|
|
58409
58446
|
function useTierPoints() {
|
|
58447
|
+
var _a;
|
|
58410
58448
|
const { address: account } = useAccount();
|
|
58411
58449
|
const SDKConfig = useSDKConfig();
|
|
58450
|
+
const apiUrl = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2;
|
|
58412
58451
|
return useQuery({
|
|
58413
58452
|
queryKey: [QUERY_KEYS.TIERS, account],
|
|
58414
|
-
queryFn: () => fetchUserPoints(account, SDKConfig.useTiers),
|
|
58453
|
+
queryFn: () => fetchUserPoints(account, SDKConfig.useTiers, apiUrl),
|
|
58415
58454
|
staleTime: 60000,
|
|
58416
58455
|
refetchInterval: 30000, // i.e. 30 secs
|
|
58417
58456
|
refetchOnWindowFocus: false,
|
|
@@ -61037,6 +61076,12 @@ const getBillNftBatchData = (apiV2URL, billNftIds, billNftAddress, chainId) => _
|
|
|
61037
61076
|
}
|
|
61038
61077
|
catch (e) {
|
|
61039
61078
|
console.error(e);
|
|
61079
|
+
reportError({
|
|
61080
|
+
apiUrl: apiV2URL,
|
|
61081
|
+
error: e,
|
|
61082
|
+
extraInfo: { type: 'getBillNftBatchData', billNftIds, billNftAddress, e },
|
|
61083
|
+
chainId,
|
|
61084
|
+
});
|
|
61040
61085
|
// If an error occurs, return null
|
|
61041
61086
|
return null;
|
|
61042
61087
|
}
|
|
@@ -61061,6 +61106,12 @@ const getBondNFTData = (apiV2URL, id, billNftAddress, chainId) => __awaiter$9(vo
|
|
|
61061
61106
|
}
|
|
61062
61107
|
catch (e) {
|
|
61063
61108
|
console.error(e);
|
|
61109
|
+
reportError({
|
|
61110
|
+
apiUrl: apiV2URL,
|
|
61111
|
+
error: e,
|
|
61112
|
+
extraInfo: { type: 'getBondNFTData', billNftAddress, e },
|
|
61113
|
+
chainId,
|
|
61114
|
+
});
|
|
61064
61115
|
}
|
|
61065
61116
|
});
|
|
61066
61117
|
|
|
@@ -62343,6 +62394,7 @@ const useMonitorTxHash = (txHash, chainId) => {
|
|
|
62343
62394
|
const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
62344
62395
|
var _a, _b, _c;
|
|
62345
62396
|
// Hooks
|
|
62397
|
+
const SDKConfig = useSDKConfig();
|
|
62346
62398
|
const userChainId = useChainId();
|
|
62347
62399
|
const { address: account } = useAccount();
|
|
62348
62400
|
const { switchChain } = useSwitchChain();
|
|
@@ -62354,7 +62406,7 @@ const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
|
62354
62406
|
const { addToastError } = usePopups();
|
|
62355
62407
|
const load = loadingTx || (isLoading && !isConfirmed);
|
|
62356
62408
|
const handleTransfer = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
62357
|
-
var _a;
|
|
62409
|
+
var _a, _b;
|
|
62358
62410
|
const address = userBill === null || userBill === void 0 ? void 0 : userBill.billNftAddress;
|
|
62359
62411
|
try {
|
|
62360
62412
|
setLoadingTx(true);
|
|
@@ -62387,6 +62439,13 @@ const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
|
62387
62439
|
console.error('Transfer failed:', error);
|
|
62388
62440
|
setLoadingTx(false);
|
|
62389
62441
|
addToastError(error.shortMessage);
|
|
62442
|
+
reportError({
|
|
62443
|
+
apiUrl: (_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _b === void 0 ? void 0 : _b.apiV2,
|
|
62444
|
+
error,
|
|
62445
|
+
extraInfo: { type: 'transfer', userBill, error },
|
|
62446
|
+
chainId: userChainId,
|
|
62447
|
+
account,
|
|
62448
|
+
});
|
|
62390
62449
|
}
|
|
62391
62450
|
});
|
|
62392
62451
|
return (jsx$2(Fragment$1, { children: userChainId !== ((_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.chainId) ? (jsxs(Button, { onClick: () => { var _a; return switchChain({ chainId: (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId }); }, children: ["Switch to ", NETWORK_LABEL[(_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.chainId]] })) : (jsx$2(Button, { onClick: handleTransfer, load: load, disabled: load || disabled, fullWidth: true, children: "transfer" })) }));
|
|
@@ -69688,28 +69747,35 @@ var PRICE_GETTER_V3_ABI = [
|
|
|
69688
69747
|
];
|
|
69689
69748
|
|
|
69690
69749
|
function useTokenPrices() {
|
|
69750
|
+
var _a;
|
|
69691
69751
|
const realTime = useURLByEnvironment('realTimeApi');
|
|
69692
69752
|
const SDKConfig = useSDKConfig();
|
|
69753
|
+
const apiUrl = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2;
|
|
69693
69754
|
return useQuery({
|
|
69694
69755
|
queryKey: [QUERY_KEYS.TOKEN_PRICES],
|
|
69695
|
-
queryFn: () => getTokenPrices(realTime, SDKConfig.chains),
|
|
69756
|
+
queryFn: () => getTokenPrices(realTime, SDKConfig.chains, apiUrl),
|
|
69696
69757
|
refetchInterval: 60000, // 60 sec
|
|
69697
69758
|
refetchOnMount: false,
|
|
69698
69759
|
refetchOnWindowFocus: false,
|
|
69699
69760
|
enabled: !!SDKConfig.chains && SDKConfig.chains.length > 0,
|
|
69700
69761
|
});
|
|
69701
69762
|
}
|
|
69702
|
-
const getTokenPrices = (
|
|
69763
|
+
const getTokenPrices = (realTimeApiURL, chains, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69703
69764
|
try {
|
|
69704
|
-
const response = yield axios.get(`${
|
|
69765
|
+
const response = yield axios.get(`${realTimeApiURL}/utils/tokens`);
|
|
69705
69766
|
const tokenList = response.data;
|
|
69706
69767
|
const promises = chains.map((chain) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69707
69768
|
try {
|
|
69708
69769
|
// Directly return the result of fetching prices, or handle any exceptions here
|
|
69709
|
-
return yield getAllTokenPrices(+chain, tokenList);
|
|
69770
|
+
return yield getAllTokenPrices(+chain, tokenList, apiUrl);
|
|
69710
69771
|
}
|
|
69711
69772
|
catch (error) {
|
|
69712
69773
|
console.error(`Failed to fetch prices for chain ${chain}:`, error);
|
|
69774
|
+
reportError({
|
|
69775
|
+
apiUrl,
|
|
69776
|
+
error,
|
|
69777
|
+
extraInfo: { type: 'getAllTokenPrices', chains, error },
|
|
69778
|
+
});
|
|
69713
69779
|
return null;
|
|
69714
69780
|
}
|
|
69715
69781
|
}));
|
|
@@ -69723,11 +69789,16 @@ const getTokenPrices = (apiURL, chains) => __awaiter$9(void 0, void 0, void 0, f
|
|
|
69723
69789
|
}, []);
|
|
69724
69790
|
return flattenedPrices;
|
|
69725
69791
|
}
|
|
69726
|
-
catch (
|
|
69792
|
+
catch (error) {
|
|
69793
|
+
reportError({
|
|
69794
|
+
apiUrl,
|
|
69795
|
+
error,
|
|
69796
|
+
extraInfo: { type: 'getTokenPrices', chains, error },
|
|
69797
|
+
});
|
|
69727
69798
|
return [];
|
|
69728
69799
|
}
|
|
69729
69800
|
});
|
|
69730
|
-
const getAllTokenPrices = (chainId, tokens) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69801
|
+
const getAllTokenPrices = (chainId, tokens, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69731
69802
|
const { externalTokens, filterTokensToCall, arrayFilterTokens } = Object.keys(tokens).reduce((acc, key) => {
|
|
69732
69803
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
69733
69804
|
const token = tokens[key];
|
|
@@ -69762,7 +69833,7 @@ const getAllTokenPrices = (chainId, tokens) => __awaiter$9(void 0, void 0, void
|
|
|
69762
69833
|
};
|
|
69763
69834
|
});
|
|
69764
69835
|
}
|
|
69765
|
-
const externalResults = yield getBatchTokensExternal({ chainId, tokens: externalTokens });
|
|
69836
|
+
const externalResults = yield getBatchTokensExternal({ chainId, tokens: externalTokens, apiUrl });
|
|
69766
69837
|
const tokenResults = yield getTokenPricesV3FromPriceGetter(filterTokensToCall, chainId);
|
|
69767
69838
|
const parsedTokenResults = arrayFilterTokens.map((token, i) => {
|
|
69768
69839
|
var _a, _b, _c;
|
|
@@ -69778,7 +69849,7 @@ const getAllTokenPrices = (chainId, tokens) => __awaiter$9(void 0, void 0, void
|
|
|
69778
69849
|
return [...parsedTokenResults, ...externalResults];
|
|
69779
69850
|
});
|
|
69780
69851
|
const getBatchTokensExternal = (params) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69781
|
-
const { chainId, tokens } = params;
|
|
69852
|
+
const { chainId, tokens, apiUrl } = params;
|
|
69782
69853
|
try {
|
|
69783
69854
|
const baseURL = 'https://price-api.ape.bond/prices';
|
|
69784
69855
|
const tokensToCall = tokens.map((token) => token.address);
|
|
@@ -69798,8 +69869,14 @@ const getBatchTokensExternal = (params) => __awaiter$9(void 0, void 0, void 0, f
|
|
|
69798
69869
|
};
|
|
69799
69870
|
});
|
|
69800
69871
|
}
|
|
69801
|
-
catch (
|
|
69872
|
+
catch (error) {
|
|
69802
69873
|
console.log(`Failed to get price from api for chain ${chainId}.`);
|
|
69874
|
+
reportError({
|
|
69875
|
+
apiUrl,
|
|
69876
|
+
error,
|
|
69877
|
+
extraInfo: { type: 'getBatchTokensExternal', tokens, error },
|
|
69878
|
+
chainId,
|
|
69879
|
+
});
|
|
69803
69880
|
return [];
|
|
69804
69881
|
}
|
|
69805
69882
|
});
|
|
@@ -69888,6 +69965,7 @@ const SafeHTMLComponent = ({ html }) => {
|
|
|
69888
69965
|
const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
69889
69966
|
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;
|
|
69890
69967
|
// Hooks
|
|
69968
|
+
const SDKConfig = useSDKConfig();
|
|
69891
69969
|
const chainId = useChainId();
|
|
69892
69970
|
const { switchChain } = useSwitchChain();
|
|
69893
69971
|
const { data: bondNFTData } = useBondNFTData(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.billNftAddress, (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
|
|
@@ -69908,6 +69986,7 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
69908
69986
|
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
69909
69987
|
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
69910
69988
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69989
|
+
var _a;
|
|
69911
69990
|
const address = billAddress;
|
|
69912
69991
|
try {
|
|
69913
69992
|
setLoadingTx(true);
|
|
@@ -69938,6 +70017,13 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
69938
70017
|
console.error('Claim Failed:', error);
|
|
69939
70018
|
setLoadingTx(false);
|
|
69940
70019
|
addToastError(error.message);
|
|
70020
|
+
reportError({
|
|
70021
|
+
apiUrl: (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2,
|
|
70022
|
+
error,
|
|
70023
|
+
extraInfo: { type: 'redeem', userBill, error },
|
|
70024
|
+
chainId,
|
|
70025
|
+
account,
|
|
70026
|
+
});
|
|
69941
70027
|
}
|
|
69942
70028
|
});
|
|
69943
70029
|
// Functions to calculate display values for modal
|
|
@@ -70092,6 +70178,7 @@ const BondInfoTooltip = ({ earnTokenContract, earnTokenSymbol, bondContract, pro
|
|
|
70092
70178
|
const UserBondRow = ({ bill }) => {
|
|
70093
70179
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
70094
70180
|
const userChainId = useChainId();
|
|
70181
|
+
const SDKConfig = useSDKConfig();
|
|
70095
70182
|
const { address: account } = useAccount();
|
|
70096
70183
|
const { switchChain } = useSwitchChain();
|
|
70097
70184
|
const { writeContractAsync } = useWriteContract();
|
|
@@ -70102,6 +70189,7 @@ const UserBondRow = ({ bill }) => {
|
|
|
70102
70189
|
const load = loadingTx || (isConfirming && !isConfirmed);
|
|
70103
70190
|
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModal, { userBill: bill }));
|
|
70104
70191
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70192
|
+
var _a;
|
|
70105
70193
|
const address = billAddress;
|
|
70106
70194
|
try {
|
|
70107
70195
|
setLoadingTx(true);
|
|
@@ -70132,6 +70220,13 @@ const UserBondRow = ({ bill }) => {
|
|
|
70132
70220
|
setLoadingTx(false);
|
|
70133
70221
|
console.error('Claim failed:', error);
|
|
70134
70222
|
addToastError(error.message);
|
|
70223
|
+
reportError({
|
|
70224
|
+
apiUrl: (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2,
|
|
70225
|
+
error,
|
|
70226
|
+
extraInfo: { type: 'claim', bill, error },
|
|
70227
|
+
chainId: bill.bond.chainId,
|
|
70228
|
+
account,
|
|
70229
|
+
});
|
|
70135
70230
|
}
|
|
70136
70231
|
});
|
|
70137
70232
|
// Display Info
|
|
@@ -70157,19 +70252,25 @@ const UserBondRow = ({ bill }) => {
|
|
|
70157
70252
|
|
|
70158
70253
|
function useBondsList() {
|
|
70159
70254
|
const realTime = useURLByEnvironment('realTimeApi');
|
|
70255
|
+
const apiUrl = useURLByEnvironment('apiV2');
|
|
70160
70256
|
return useQuery({
|
|
70161
70257
|
queryKey: [QUERY_KEYS.BONDS_LIST],
|
|
70162
|
-
queryFn: () => getBondsList(realTime),
|
|
70258
|
+
queryFn: () => getBondsList(realTime, apiUrl),
|
|
70163
70259
|
staleTime: Infinity,
|
|
70164
70260
|
refetchOnWindowFocus: false,
|
|
70165
70261
|
});
|
|
70166
70262
|
}
|
|
70167
|
-
const getBondsList = (
|
|
70263
|
+
const getBondsList = (realTimeapiURL, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70168
70264
|
try {
|
|
70169
|
-
const response = yield axios.get(`${
|
|
70265
|
+
const response = yield axios.get(`${realTimeapiURL}/utils/bonds`);
|
|
70170
70266
|
return response.data;
|
|
70171
70267
|
}
|
|
70172
|
-
catch (
|
|
70268
|
+
catch (e) {
|
|
70269
|
+
reportError({
|
|
70270
|
+
apiUrl,
|
|
70271
|
+
error: e,
|
|
70272
|
+
extraInfo: { type: 'getBondsList', e },
|
|
70273
|
+
});
|
|
70173
70274
|
return [];
|
|
70174
70275
|
}
|
|
70175
70276
|
});
|
|
@@ -70274,22 +70375,24 @@ const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices) => __awaiter$
|
|
|
70274
70375
|
});
|
|
70275
70376
|
|
|
70276
70377
|
function useUserBonds() {
|
|
70378
|
+
var _a;
|
|
70277
70379
|
// First fetch the full list of bonds
|
|
70278
70380
|
const { data: bondList } = useBondsList();
|
|
70279
70381
|
const { address } = useAccount();
|
|
70280
70382
|
const SDKConfig = useSDKConfig();
|
|
70281
70383
|
const { data: tokenPrices } = useTokenPrices();
|
|
70282
70384
|
const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
|
|
70385
|
+
const apiUrl = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2;
|
|
70283
70386
|
// Once the full list is fetched, fetch user's purchased bonds
|
|
70284
70387
|
return useQuery({
|
|
70285
70388
|
queryKey: [QUERY_KEYS.USER_BONDS, address],
|
|
70286
|
-
queryFn: () => getUserBonds(address, bondList, chains, tokenPrices),
|
|
70389
|
+
queryFn: () => getUserBonds(address, bondList, chains, tokenPrices, apiUrl),
|
|
70287
70390
|
refetchOnWindowFocus: false,
|
|
70288
70391
|
refetchInterval: 60000,
|
|
70289
70392
|
enabled: !!bondList && !!address && !!tokenPrices,
|
|
70290
70393
|
});
|
|
70291
70394
|
}
|
|
70292
|
-
const getUserBonds = (account, bondList, chains, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70395
|
+
const getUserBonds = (account, bondList, chains, tokenPrices, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70293
70396
|
try {
|
|
70294
70397
|
const bondsByChain = bondList.reduce((acc, bond) => {
|
|
70295
70398
|
var _a;
|
|
@@ -70319,7 +70422,13 @@ const getUserBonds = (account, bondList, chains, tokenPrices) => __awaiter$9(voi
|
|
|
70319
70422
|
.map((result) => result.value);
|
|
70320
70423
|
return fulfilledResults.flat().flatMap((result) => result.userOwnedBills);
|
|
70321
70424
|
}
|
|
70322
|
-
catch (
|
|
70425
|
+
catch (e) {
|
|
70426
|
+
reportError({
|
|
70427
|
+
apiUrl,
|
|
70428
|
+
error: e,
|
|
70429
|
+
extraInfo: { type: 'getUserBonds', bondList, chains, e },
|
|
70430
|
+
account,
|
|
70431
|
+
});
|
|
70323
70432
|
return [];
|
|
70324
70433
|
}
|
|
70325
70434
|
});
|
|
@@ -70661,6 +70770,7 @@ const ClaimAllModal = () => {
|
|
|
70661
70770
|
const { addToastError } = usePopups();
|
|
70662
70771
|
const { writeContractAsync } = useWriteContract();
|
|
70663
70772
|
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70773
|
+
var _a;
|
|
70664
70774
|
try {
|
|
70665
70775
|
bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.map((purchasedBond) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70666
70776
|
const address = purchasedBond.bond.contractAddress[purchasedBond.bond.chainId];
|
|
@@ -70686,6 +70796,13 @@ const ClaimAllModal = () => {
|
|
|
70686
70796
|
catch (error) {
|
|
70687
70797
|
console.error('Claim All failed:', error);
|
|
70688
70798
|
addToastError(error.message);
|
|
70799
|
+
reportError({
|
|
70800
|
+
apiUrl: (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2,
|
|
70801
|
+
error,
|
|
70802
|
+
extraInfo: { type: 'claimAll', bondsOfSelectedChain, error },
|
|
70803
|
+
chainId,
|
|
70804
|
+
account,
|
|
70805
|
+
});
|
|
70689
70806
|
}
|
|
70690
70807
|
});
|
|
70691
70808
|
const purchasedBillsChains = (_a = groupedBills === null || groupedBills === void 0 ? void 0 : groupedBills.reduce((acc, bill) => {
|
|
@@ -73096,37 +73213,46 @@ var launchBondsABI_V2_2_0 = [
|
|
|
73096
73213
|
];
|
|
73097
73214
|
|
|
73098
73215
|
function usePreTGEList() {
|
|
73099
|
-
|
|
73216
|
+
var _a, _b;
|
|
73217
|
+
const SDKConfig = useSDKConfig();
|
|
73218
|
+
const realTime = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.realTimeApi;
|
|
73219
|
+
const apiUrl = (_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _b === void 0 ? void 0 : _b.apiV2;
|
|
73100
73220
|
return useQuery({
|
|
73101
73221
|
queryKey: [QUERY_KEYS.PRE_TGE_LIST],
|
|
73102
|
-
queryFn: () => getPreTGEList(realTime),
|
|
73222
|
+
queryFn: () => getPreTGEList(realTime, apiUrl),
|
|
73103
73223
|
staleTime: Infinity,
|
|
73104
73224
|
refetchOnWindowFocus: false,
|
|
73105
73225
|
});
|
|
73106
73226
|
}
|
|
73107
|
-
const getPreTGEList = (
|
|
73227
|
+
const getPreTGEList = (apiRealTimeURL, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73108
73228
|
try {
|
|
73109
|
-
const response = yield axios.get(`${
|
|
73229
|
+
const response = yield axios.get(`${apiRealTimeURL}/utils/pre-tge-bonds`);
|
|
73110
73230
|
return response.data;
|
|
73111
73231
|
}
|
|
73112
|
-
catch (
|
|
73232
|
+
catch (e) {
|
|
73233
|
+
reportError({
|
|
73234
|
+
apiUrl,
|
|
73235
|
+
error: e,
|
|
73236
|
+
extraInfo: { type: 'getPreTGEList', e },
|
|
73237
|
+
});
|
|
73113
73238
|
return [];
|
|
73114
73239
|
}
|
|
73115
73240
|
});
|
|
73116
73241
|
|
|
73117
73242
|
function usePreTGEBondsData() {
|
|
73118
|
-
var _a;
|
|
73243
|
+
var _a, _b;
|
|
73119
73244
|
const { data: preTGEList } = usePreTGEList();
|
|
73120
73245
|
const SDKConfig = useSDKConfig();
|
|
73246
|
+
const apiUrl = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2;
|
|
73121
73247
|
return useQuery({
|
|
73122
|
-
queryKey: [QUERY_KEYS.PRE_TGE_BONDS, (
|
|
73123
|
-
queryFn: () => getLaunchBondsPublicData(preTGEList, SDKConfig.chains),
|
|
73248
|
+
queryKey: [QUERY_KEYS.PRE_TGE_BONDS, (_b = preTGEList === null || preTGEList === void 0 ? void 0 : preTGEList.length) !== null && _b !== void 0 ? _b : ''],
|
|
73249
|
+
queryFn: () => getLaunchBondsPublicData(preTGEList, SDKConfig.chains, apiUrl),
|
|
73124
73250
|
staleTime: 60000,
|
|
73125
73251
|
refetchOnWindowFocus: false,
|
|
73126
73252
|
enabled: !!preTGEList && preTGEList.length > 0,
|
|
73127
73253
|
});
|
|
73128
73254
|
}
|
|
73129
|
-
const getLaunchBondsPublicData = (preTGEBonds, chains) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73255
|
+
const getLaunchBondsPublicData = (preTGEBonds, chains, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73130
73256
|
try {
|
|
73131
73257
|
if (!(preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.length))
|
|
73132
73258
|
return null;
|
|
@@ -73189,7 +73315,12 @@ const getLaunchBondsPublicData = (preTGEBonds, chains) => __awaiter$9(void 0, vo
|
|
|
73189
73315
|
}
|
|
73190
73316
|
return data.flat();
|
|
73191
73317
|
}
|
|
73192
|
-
catch (
|
|
73318
|
+
catch (e) {
|
|
73319
|
+
reportError({
|
|
73320
|
+
apiUrl,
|
|
73321
|
+
error: e,
|
|
73322
|
+
extraInfo: { type: 'getLaunchBondsPublicData', preTGEBonds, chains, e },
|
|
73323
|
+
});
|
|
73193
73324
|
return [];
|
|
73194
73325
|
}
|
|
73195
73326
|
});
|
|
@@ -73198,15 +73329,16 @@ function usePreTGEUserBonds() {
|
|
|
73198
73329
|
var _a;
|
|
73199
73330
|
const { data: preTGEBonds } = usePreTGEBondsData();
|
|
73200
73331
|
const { address } = useAccount();
|
|
73332
|
+
const apiUrl = useURLByEnvironment('apiV2');
|
|
73201
73333
|
return useQuery({
|
|
73202
73334
|
queryKey: [QUERY_KEYS.PRE_TGE_BONDS, (_a = preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.length) !== null && _a !== void 0 ? _a : '', address],
|
|
73203
|
-
queryFn: () => fetchPreTGEUserBonds(preTGEBonds, address),
|
|
73335
|
+
queryFn: () => fetchPreTGEUserBonds(preTGEBonds, address, apiUrl),
|
|
73204
73336
|
staleTime: 30000,
|
|
73205
73337
|
refetchOnWindowFocus: false,
|
|
73206
73338
|
enabled: !!preTGEBonds && preTGEBonds.length > 0 && !!address,
|
|
73207
73339
|
});
|
|
73208
73340
|
}
|
|
73209
|
-
const fetchPreTGEUserBonds = (preTGEBonds, account) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73341
|
+
const fetchPreTGEUserBonds = (preTGEBonds, account, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73210
73342
|
try {
|
|
73211
73343
|
const res = yield Promise.all(preTGEBonds.map((bond) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73212
73344
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
@@ -73288,6 +73420,12 @@ const fetchPreTGEUserBonds = (preTGEBonds, account) => __awaiter$9(void 0, void
|
|
|
73288
73420
|
}
|
|
73289
73421
|
catch (e) {
|
|
73290
73422
|
console.log(e);
|
|
73423
|
+
reportError({
|
|
73424
|
+
apiUrl,
|
|
73425
|
+
error: e,
|
|
73426
|
+
extraInfo: { type: 'fetchPreTGEUserBonds', preTGEBonds, e },
|
|
73427
|
+
account,
|
|
73428
|
+
});
|
|
73291
73429
|
return [];
|
|
73292
73430
|
}
|
|
73293
73431
|
});
|
|
@@ -75960,10 +76098,11 @@ function useBondsData() {
|
|
|
75960
76098
|
const { data: tokenPrices } = useTokenPrices();
|
|
75961
76099
|
const { data: bondList } = useBondsList();
|
|
75962
76100
|
const SDKConfig = useSDKConfig();
|
|
76101
|
+
const apiUrl = useURLByEnvironment('apiV2');
|
|
75963
76102
|
const realTimeApiURL = useURLByEnvironment('realTimeApi');
|
|
75964
76103
|
return useQuery({
|
|
75965
76104
|
queryKey: [QUERY_KEYS.BONDS_DATA],
|
|
75966
|
-
queryFn: () => getBondsData(SDKConfig.chains, realTimeApiURL, tokenPrices, bondList),
|
|
76105
|
+
queryFn: () => getBondsData(SDKConfig.chains, realTimeApiURL, tokenPrices, bondList, apiUrl),
|
|
75967
76106
|
refetchInterval: 20000, // i.e. 20 sec
|
|
75968
76107
|
refetchOnWindowFocus: false,
|
|
75969
76108
|
retry: 0,
|
|
@@ -75971,12 +76110,12 @@ function useBondsData() {
|
|
|
75971
76110
|
enabled: !!SDKConfig.chains && SDKConfig.chains.length > 0,
|
|
75972
76111
|
});
|
|
75973
76112
|
}
|
|
75974
|
-
const getBondsData = (chains, realTimeApiURL, tokenPrices, bondList) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
76113
|
+
const getBondsData = (chains, realTimeApiURL, tokenPrices, bondList, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
75975
76114
|
try {
|
|
75976
76115
|
const response = yield axios.get(`${realTimeApiURL}/bonds`);
|
|
75977
76116
|
return response.data.bonds;
|
|
75978
76117
|
}
|
|
75979
|
-
catch (
|
|
76118
|
+
catch (e) {
|
|
75980
76119
|
console.time('Fallback'); // Start debug timer
|
|
75981
76120
|
const billData = [];
|
|
75982
76121
|
if (tokenPrices && bondList) {
|
|
@@ -75993,6 +76132,11 @@ const getBondsData = (chains, realTimeApiURL, tokenPrices, bondList) => __awaite
|
|
|
75993
76132
|
})));
|
|
75994
76133
|
}
|
|
75995
76134
|
console.timeEnd(`Fallback`); // End chain-specific timer
|
|
76135
|
+
reportError({
|
|
76136
|
+
apiUrl,
|
|
76137
|
+
error: e,
|
|
76138
|
+
extraInfo: { type: 'getBondsData', e },
|
|
76139
|
+
});
|
|
75996
76140
|
return billData === null || billData === void 0 ? void 0 : billData.flat();
|
|
75997
76141
|
}
|
|
75998
76142
|
});
|
|
@@ -76447,15 +76591,16 @@ var ERC_20_ABI = [
|
|
|
76447
76591
|
function useUserTokensBalance(tokens, chainId) {
|
|
76448
76592
|
const keys = tokens.map((token) => (token === 'NATIVE' ? 'NATIVE' : token.address[chainId]));
|
|
76449
76593
|
const { address: account } = useAccount();
|
|
76594
|
+
const apiUrl = useURLByEnvironment('apiV2');
|
|
76450
76595
|
return useQuery({
|
|
76451
76596
|
queryKey: [`${QUERY_KEYS.USER_TOKENS_BALANCES}-${keys}-${account}`],
|
|
76452
|
-
queryFn: () => getTokensBalance(account, tokens, chainId),
|
|
76597
|
+
queryFn: () => getTokensBalance(account, tokens, chainId, apiUrl),
|
|
76453
76598
|
staleTime: 60000,
|
|
76454
76599
|
refetchOnWindowFocus: false,
|
|
76455
76600
|
enabled: !!account,
|
|
76456
76601
|
});
|
|
76457
76602
|
}
|
|
76458
|
-
const getTokensBalance = (account, tokens, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
76603
|
+
const getTokensBalance = (account, tokens, chainId, apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
76459
76604
|
try {
|
|
76460
76605
|
const callsToken = tokens
|
|
76461
76606
|
.filter((token) => token !== 'NATIVE')
|
|
@@ -76497,7 +76642,14 @@ const getTokensBalance = (account, tokens, chainId) => __awaiter$9(void 0, void
|
|
|
76497
76642
|
});
|
|
76498
76643
|
return [...balancesToken, ...balancesNative];
|
|
76499
76644
|
}
|
|
76500
|
-
catch (
|
|
76645
|
+
catch (e) {
|
|
76646
|
+
reportError({
|
|
76647
|
+
apiUrl,
|
|
76648
|
+
error: e,
|
|
76649
|
+
extraInfo: { type: 'getTokensBalance', tokens, e },
|
|
76650
|
+
account,
|
|
76651
|
+
chainId,
|
|
76652
|
+
});
|
|
76501
76653
|
return [];
|
|
76502
76654
|
}
|
|
76503
76655
|
});
|
|
@@ -77590,6 +77742,7 @@ const getTokenAllowance = (currency, spender, account, chainId) => __awaiter$9(v
|
|
|
77590
77742
|
return value.toNumber();
|
|
77591
77743
|
});
|
|
77592
77744
|
const useApproval = (amount, currency, spender, account, chainId) => {
|
|
77745
|
+
const apiUrl = useURLByEnvironment('apiV2');
|
|
77593
77746
|
const [confirmingTxOnWallet, setConfirmingTxOnWallet] = useState(false);
|
|
77594
77747
|
const [txHash, setTxHash] = useState('');
|
|
77595
77748
|
const { data: allowance, refetch } = useAllowance(currency, spender, account, chainId);
|
|
@@ -77631,6 +77784,13 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
77631
77784
|
setConfirmingTxOnWallet(false);
|
|
77632
77785
|
console.error('Approval failed:', error);
|
|
77633
77786
|
addToastError(error.message);
|
|
77787
|
+
reportError({
|
|
77788
|
+
apiUrl,
|
|
77789
|
+
error,
|
|
77790
|
+
extraInfo: { type: 'approval', tokenAddress: tokenAddress, spenderAddress: spender, error },
|
|
77791
|
+
chainId,
|
|
77792
|
+
account,
|
|
77793
|
+
});
|
|
77634
77794
|
}
|
|
77635
77795
|
}), [amount, currency, chainId]);
|
|
77636
77796
|
let approvalState = ApprovalState.NOT_APPROVED;
|
|
@@ -77879,6 +78039,7 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
77879
78039
|
const [typedValue, setTypedValue] = useState('');
|
|
77880
78040
|
const [inputTokenString, setInputTokenString] = useState('NATIVE');
|
|
77881
78041
|
// Hooks
|
|
78042
|
+
const SDKConfig = useSDKConfig();
|
|
77882
78043
|
const userChainId = useChainId();
|
|
77883
78044
|
const { switchChain } = useSwitchChain();
|
|
77884
78045
|
const inputToken = useTokenFromZapList(inputTokenString, chainId, null);
|
|
@@ -77907,7 +78068,7 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
77907
78068
|
setTypedValue(inputTokenBalance !== null && inputTokenBalance !== void 0 ? inputTokenBalance : '');
|
|
77908
78069
|
}, [inputTokenBalance]);
|
|
77909
78070
|
const soulZapCallback = useCallback(() => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
77910
|
-
var _a, _b;
|
|
78071
|
+
var _a, _b, _c;
|
|
77911
78072
|
if (zapData && ((_a = zapData === null || zapData === void 0 ? void 0 : zapData.txData) === null || _a === void 0 ? void 0 : _a.to) && ((_b = zapData === null || zapData === void 0 ? void 0 : zapData.txData) === null || _b === void 0 ? void 0 : _b.data)) {
|
|
77912
78073
|
try {
|
|
77913
78074
|
console.log(zapData);
|
|
@@ -77940,6 +78101,13 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
77940
78101
|
console.error(e);
|
|
77941
78102
|
setPendingTx(false);
|
|
77942
78103
|
addToastError(e.shortMessage);
|
|
78104
|
+
reportError({
|
|
78105
|
+
apiUrl: (_c = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _c === void 0 ? void 0 : _c.apiV2,
|
|
78106
|
+
error: e,
|
|
78107
|
+
extraInfo: { type: 'zap-lp', zapData, e },
|
|
78108
|
+
chainId,
|
|
78109
|
+
account,
|
|
78110
|
+
});
|
|
77943
78111
|
}
|
|
77944
78112
|
}
|
|
77945
78113
|
}), [zapData, (_f = zapData === null || zapData === void 0 ? void 0 : zapData.txData) === null || _f === void 0 ? void 0 : _f.to, (_g = zapData === null || zapData === void 0 ? void 0 : zapData.txData) === null || _g === void 0 ? void 0 : _g.data]);
|
|
@@ -78478,7 +78646,14 @@ const getTierProofSig = (apiAddress, account, bondAddress, chainId) => __awaiter
|
|
|
78478
78646
|
const response = yield axios.post(`${apiAddress}/tier-signature`, requestBody);
|
|
78479
78647
|
return response.data.tierProofSignature;
|
|
78480
78648
|
}
|
|
78481
|
-
catch (
|
|
78649
|
+
catch (e) {
|
|
78650
|
+
reportError({
|
|
78651
|
+
apiUrl: apiAddress,
|
|
78652
|
+
error: e,
|
|
78653
|
+
extraInfo: { type: 'getTierProofSig', bondAddress, e },
|
|
78654
|
+
chainId,
|
|
78655
|
+
account,
|
|
78656
|
+
});
|
|
78482
78657
|
return null;
|
|
78483
78658
|
}
|
|
78484
78659
|
});
|
|
@@ -78607,7 +78782,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78607
78782
|
};
|
|
78608
78783
|
// This is the regular buy bond interaction (a.k.a. write method called "deposit" in smartcontract)
|
|
78609
78784
|
const handleBuyCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
78610
|
-
var _a, _b, _c, _d, _e;
|
|
78785
|
+
var _a, _b, _c, _d, _e, _f;
|
|
78611
78786
|
const billAddress = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress;
|
|
78612
78787
|
const decimals = (_b = (_a = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken.decimals) === null || _a === void 0 ? void 0 : _a[bondData === null || bondData === void 0 ? void 0 : bondData.chainId]) !== null && _b !== void 0 ? _b : 18;
|
|
78613
78788
|
track({
|
|
@@ -78654,12 +78829,19 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78654
78829
|
}
|
|
78655
78830
|
catch (error) {
|
|
78656
78831
|
console.error('Buy error', error);
|
|
78832
|
+
reportError({
|
|
78833
|
+
apiUrl: (_f = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _f === void 0 ? void 0 : _f.apiV2,
|
|
78834
|
+
error,
|
|
78835
|
+
extraInfo: { type: 'buyBond', bondData, error },
|
|
78836
|
+
chainId: bondChain,
|
|
78837
|
+
account,
|
|
78838
|
+
});
|
|
78657
78839
|
addToastError(error.shortMessage);
|
|
78658
78840
|
}
|
|
78659
78841
|
});
|
|
78660
78842
|
// ignore this for SOL migration
|
|
78661
78843
|
const handleZapCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
78662
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
78844
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
78663
78845
|
if (zapData && ((_a = zapData === null || zapData === void 0 ? void 0 : zapData.txData) === null || _a === void 0 ? void 0 : _a.to) && ((_b = zapData === null || zapData === void 0 ? void 0 : zapData.txData) === null || _b === void 0 ? void 0 : _b.data)) {
|
|
78664
78846
|
console.log('Attempting zap tx');
|
|
78665
78847
|
track({
|
|
@@ -78712,6 +78894,13 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78712
78894
|
catch (e) {
|
|
78713
78895
|
console.log(e);
|
|
78714
78896
|
addToastError(e.shortMessage);
|
|
78897
|
+
reportError({
|
|
78898
|
+
apiUrl: (_j = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _j === void 0 ? void 0 : _j.apiV2,
|
|
78899
|
+
error: e,
|
|
78900
|
+
extraInfo: { type: 'zapBuyBond', bondData, zapData, e },
|
|
78901
|
+
chainId: bondChain,
|
|
78902
|
+
account,
|
|
78903
|
+
});
|
|
78715
78904
|
}
|
|
78716
78905
|
}
|
|
78717
78906
|
});
|
|
@@ -79302,9 +79491,10 @@ const HotBondCard = ({ bond }) => {
|
|
|
79302
79491
|
};
|
|
79303
79492
|
|
|
79304
79493
|
function useHotBondContracts() {
|
|
79494
|
+
const apiUrl = useURLByEnvironment('apiV2');
|
|
79305
79495
|
return useQuery({
|
|
79306
79496
|
queryKey: [QUERY_KEYS.HOT_BONDS_CONTRACTS],
|
|
79307
|
-
queryFn: getHotBondsContracts,
|
|
79497
|
+
queryFn: () => getHotBondsContracts(apiUrl),
|
|
79308
79498
|
staleTime: Infinity,
|
|
79309
79499
|
refetchOnWindowFocus: false,
|
|
79310
79500
|
refetchOnMount: false,
|
|
@@ -79323,13 +79513,18 @@ function useHotBonds() {
|
|
|
79323
79513
|
retry: 0,
|
|
79324
79514
|
});
|
|
79325
79515
|
}
|
|
79326
|
-
const getHotBondsContracts = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
79516
|
+
const getHotBondsContracts = (apiUrl) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
79327
79517
|
try {
|
|
79328
79518
|
console.log('call!');
|
|
79329
79519
|
const response = yield axios.get(`${STRAPI_URL}/hot-bonds`);
|
|
79330
79520
|
return response.data.map((bond) => bond.BondAddress.toLowerCase());
|
|
79331
79521
|
}
|
|
79332
|
-
catch (
|
|
79522
|
+
catch (e) {
|
|
79523
|
+
reportError({
|
|
79524
|
+
apiUrl,
|
|
79525
|
+
error: e,
|
|
79526
|
+
extraInfo: { type: 'getHotBondsContracts', e },
|
|
79527
|
+
});
|
|
79333
79528
|
return [];
|
|
79334
79529
|
}
|
|
79335
79530
|
});
|
|
@@ -4,6 +4,6 @@ import { TokenPrices } from '../tokenPrices/useTokenPrices';
|
|
|
4
4
|
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
5
5
|
import BigNumber from 'bignumber.js';
|
|
6
6
|
export default function useBondsData(): UseQueryResult<BondsData[]>;
|
|
7
|
-
export declare const getBondsData: (chains: number[], realTimeApiURL: string, tokenPrices?: TokenPrices[], bondList?: BillsConfig[]) => Promise<BondsData[]>;
|
|
7
|
+
export declare const getBondsData: (chains: number[], realTimeApiURL: string, tokenPrices?: TokenPrices[], bondList?: BillsConfig[], apiUrl?: string) => Promise<BondsData[]>;
|
|
8
8
|
export declare const getBonusWithFee: (feeInPayout: number, trueBillPrice: BigNumber, lpPrice: number, earnTokenPrice: number) => number;
|
|
9
9
|
export declare const getRawBonus: (trueBillPrice: any, lpPrice: number, earnTokenPrice: number) => number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
3
3
|
export default function useBondsList(): UseQueryResult<BillsConfig[]>;
|
|
4
|
-
export declare const getBondsList: (
|
|
4
|
+
export declare const getBondsList: (realTimeapiURL: string, apiUrl: string) => Promise<BillsConfig[][]>;
|
|
@@ -2,5 +2,5 @@ import { UseQueryResult } from '@tanstack/react-query';
|
|
|
2
2
|
import { BondsData } from '../../types/bonds';
|
|
3
3
|
export declare function useHotBondContracts(): UseQueryResult<string[], Error>;
|
|
4
4
|
export default function useHotBonds(): UseQueryResult<BondsData[]>;
|
|
5
|
-
export declare const getHotBondsContracts: () => Promise<string[]>;
|
|
5
|
+
export declare const getHotBondsContracts: (apiUrl: string) => Promise<string[]>;
|
|
6
6
|
export declare const getHotBonds: (bondData: BondsData[], hotBondContracts: string[]) => Promise<BondsData[]>;
|
|
@@ -3,4 +3,4 @@ import { BillsConfig } from '@ape.swap/apeswap-lists';
|
|
|
3
3
|
import { UserBill } from '../../types/yourbonds';
|
|
4
4
|
import { TokenPrices } from '../tokenPrices/useTokenPrices';
|
|
5
5
|
export default function useUserBonds(): UseQueryResult<UserBill[]>;
|
|
6
|
-
export declare const getUserBonds: (account: string, bondList: BillsConfig[], chains: number[], tokenPrices: TokenPrices[]) => Promise<UserBill[]>;
|
|
6
|
+
export declare const getUserBonds: (account: string, bondList: BillsConfig[], chains: number[], tokenPrices: TokenPrices[], apiUrl?: string) => Promise<UserBill[]>;
|
|
@@ -4,7 +4,7 @@ export default function useUserTokensBalance(tokens: ('NATIVE' | Token)[], chain
|
|
|
4
4
|
address: string;
|
|
5
5
|
balance: string;
|
|
6
6
|
}[]>;
|
|
7
|
-
export declare const getTokensBalance: (account: string, tokens: ("NATIVE" | Token)[], chainId: number) => Promise<{
|
|
7
|
+
export declare const getTokensBalance: (account: string, tokens: ("NATIVE" | Token)[], chainId: number, apiUrl?: string) => Promise<{
|
|
8
8
|
address: string;
|
|
9
9
|
balance: string;
|
|
10
10
|
}[]>;
|
|
@@ -16,4 +16,4 @@ export interface PreTGEBondData extends PreTGEBond {
|
|
|
16
16
|
vestingTerm: string;
|
|
17
17
|
}
|
|
18
18
|
export default function usePreTGEBondsData(): UseQueryResult<PreTGEBondData[]>;
|
|
19
|
-
export declare const getLaunchBondsPublicData: (preTGEBonds: PreTGEBond[], chains?: number[]) => Promise<PreTGEBondData[]>;
|
|
19
|
+
export declare const getLaunchBondsPublicData: (preTGEBonds: PreTGEBond[], chains?: number[], apiUrl?: string) => Promise<PreTGEBondData[]>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { UseQueryResult } from '@tanstack/react-query';
|
|
2
2
|
import { PreTGEBond } from '@ape.swap/apeswap-lists';
|
|
3
3
|
export default function usePreTGEList(): UseQueryResult<PreTGEBond[]>;
|
|
4
|
-
export declare const getPreTGEList: (
|
|
4
|
+
export declare const getPreTGEList: (apiRealTimeURL: string, apiUrl: string) => Promise<PreTGEBond[]>;
|
|
@@ -30,4 +30,4 @@ export interface PreTGEUserBonds extends PreTGEBond {
|
|
|
30
30
|
vestingTerm: string;
|
|
31
31
|
}
|
|
32
32
|
export default function usePreTGEUserBonds(): UseQueryResult<PreTGEUserBonds[]>;
|
|
33
|
-
export declare const fetchPreTGEUserBonds: (preTGEBonds: PreTGEBondData[], account: string) => Promise<PreTGEUserBonds[]>;
|
|
33
|
+
export declare const fetchPreTGEUserBonds: (preTGEBonds: PreTGEBondData[], account: string, apiUrl: string) => Promise<PreTGEUserBonds[]>;
|
|
@@ -31,5 +31,5 @@ export declare const TIERS_NAMES: {
|
|
|
31
31
|
4: string;
|
|
32
32
|
};
|
|
33
33
|
export declare const getUserTier: (weight: string) => LaunchBondTiers | null;
|
|
34
|
-
export declare const fetchUserPoints: (account?: string, useTiers?: boolean) => Promise<string | null>;
|
|
34
|
+
export declare const fetchUserPoints: (account?: string, useTiers?: boolean, apiUrl?: string) => Promise<string | null>;
|
|
35
35
|
export default function useTierPoints(): import("@tanstack/react-query").UseQueryResult<string, Error>;
|
|
@@ -7,5 +7,5 @@ export interface TokenPrices {
|
|
|
7
7
|
chainId: ChainId | undefined;
|
|
8
8
|
}
|
|
9
9
|
export default function useTokenPrices(): UseQueryResult<TokenPrices[]>;
|
|
10
|
-
export declare const getTokenPrices: (
|
|
10
|
+
export declare const getTokenPrices: (realTimeApiURL: string, chains: number[], apiUrl?: string) => Promise<TokenPrices[]>;
|
|
11
11
|
export declare function getTokenPricesV3FromPriceGetter(tokensToCall: Record<string, Token>, chain: ChainId): Promise<any>;
|