@ape.swap/bonds-sdk 3.0.65 → 3.0.66-test.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +158 -287
- package/dist/state/abtesting/useABTesting.d.ts +2 -1
- 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/views/Bonds/utils.d.ts +1 -0
- package/package.json +2 -2
- package/dist/utils/reportError.d.ts +0 -8
package/dist/main.js
CHANGED
|
@@ -18130,7 +18130,6 @@ var types = {};
|
|
|
18130
18130
|
BillArtCollection['AITECH_Collection1'] = 'AITECH_Collection1';
|
|
18131
18131
|
BillArtCollection['GPT_Collection1'] = 'GPT_Collection1';
|
|
18132
18132
|
BillArtCollection['GoldenTicket_Collection1'] = 'GoldenTicket_Collection1';
|
|
18133
|
-
BillArtCollection['Berachain_Collection1'] = 'Berachain_Collection1';
|
|
18134
18133
|
})((BillArtCollection = exports.BillArtCollection || (exports.BillArtCollection = {})));
|
|
18135
18134
|
exports.defaultBillArtCollection = BillArtCollection.ApeBond_Collection1;
|
|
18136
18135
|
exports.MigrationVestingTerms = {
|
|
@@ -18866,6 +18865,7 @@ const TokenImage = ({ symbol, symbol2, size, chain, }) => {
|
|
|
18866
18865
|
|
|
18867
18866
|
const QUERY_KEYS = {
|
|
18868
18867
|
TIERS: 'tiers',
|
|
18868
|
+
AB_TEST_VALUE: 'ABTestValue',
|
|
18869
18869
|
// used values on SDK
|
|
18870
18870
|
BOND_API_STATS: 'ApeBond-SDK-bondApiStats',
|
|
18871
18871
|
SDK_CONFIG: 'ApeBond-SDK-sdkConfig',
|
|
@@ -58330,37 +58330,6 @@ const useURLByEnvironment = (key) => {
|
|
|
58330
58330
|
return config === null || config === void 0 ? void 0 : config.urls[key];
|
|
58331
58331
|
};
|
|
58332
58332
|
|
|
58333
|
-
function reportError(_a) {
|
|
58334
|
-
return __awaiter$9(this, arguments, void 0, function* ({ apiUrl, error, extraInfo = {}, chainId, account, rpc, }) {
|
|
58335
|
-
const isClient = typeof window !== 'undefined';
|
|
58336
|
-
const url = isClient ? window.location.href : null;
|
|
58337
|
-
const errors = {
|
|
58338
|
-
message: error instanceof Error ? error.message : String(error),
|
|
58339
|
-
stack: error instanceof Error ? error.stack : null,
|
|
58340
|
-
extra: extraInfo,
|
|
58341
|
-
};
|
|
58342
|
-
const payload = {
|
|
58343
|
-
chainId: chainId,
|
|
58344
|
-
walletAddress: account,
|
|
58345
|
-
rpc,
|
|
58346
|
-
url,
|
|
58347
|
-
log: errors,
|
|
58348
|
-
};
|
|
58349
|
-
try {
|
|
58350
|
-
yield fetch(`${apiUrl}/stats/log`, {
|
|
58351
|
-
method: 'POST',
|
|
58352
|
-
body: JSON.stringify(payload),
|
|
58353
|
-
headers: {
|
|
58354
|
-
'Content-Type': 'application/json',
|
|
58355
|
-
},
|
|
58356
|
-
});
|
|
58357
|
-
}
|
|
58358
|
-
catch (err) {
|
|
58359
|
-
console.error('Error reporting the error:', err);
|
|
58360
|
-
}
|
|
58361
|
-
});
|
|
58362
|
-
}
|
|
58363
|
-
|
|
58364
58333
|
/**
|
|
58365
58334
|
* @deprecated This map is deprecated. Boost values are now being retrieved from the Realtime API.
|
|
58366
58335
|
*/
|
|
@@ -58417,7 +58386,7 @@ const getUserTier = (weight) => {
|
|
|
58417
58386
|
else
|
|
58418
58387
|
return null;
|
|
58419
58388
|
};
|
|
58420
|
-
const fetchUserPoints = (account, useTiers
|
|
58389
|
+
const fetchUserPoints = (account, useTiers) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
58421
58390
|
const lensContractAddress = LENS_CONTRACT[types.ChainId.BSC];
|
|
58422
58391
|
if (account && useTiers) {
|
|
58423
58392
|
try {
|
|
@@ -58432,12 +58401,6 @@ const fetchUserPoints = (account, useTiers, apiUrl) => __awaiter$9(void 0, void
|
|
|
58432
58401
|
}
|
|
58433
58402
|
catch (e) {
|
|
58434
58403
|
console.error(e);
|
|
58435
|
-
reportError({
|
|
58436
|
-
apiUrl,
|
|
58437
|
-
error: e,
|
|
58438
|
-
extraInfo: { type: 'fetchUserPoints', e },
|
|
58439
|
-
account,
|
|
58440
|
-
});
|
|
58441
58404
|
return '0';
|
|
58442
58405
|
}
|
|
58443
58406
|
}
|
|
@@ -58445,13 +58408,11 @@ const fetchUserPoints = (account, useTiers, apiUrl) => __awaiter$9(void 0, void
|
|
|
58445
58408
|
return '0';
|
|
58446
58409
|
});
|
|
58447
58410
|
function useTierPoints() {
|
|
58448
|
-
var _a;
|
|
58449
58411
|
const { address: account } = useAccount();
|
|
58450
58412
|
const SDKConfig = useSDKConfig();
|
|
58451
|
-
const apiUrl = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2;
|
|
58452
58413
|
return useQuery({
|
|
58453
58414
|
queryKey: [QUERY_KEYS.TIERS, account],
|
|
58454
|
-
queryFn: () => fetchUserPoints(account, SDKConfig.useTiers
|
|
58415
|
+
queryFn: () => fetchUserPoints(account, SDKConfig.useTiers),
|
|
58455
58416
|
staleTime: 60000,
|
|
58456
58417
|
refetchInterval: 30000, // i.e. 30 secs
|
|
58457
58418
|
refetchOnWindowFocus: false,
|
|
@@ -61077,12 +61038,6 @@ const getBillNftBatchData = (apiV2URL, billNftIds, billNftAddress, chainId) => _
|
|
|
61077
61038
|
}
|
|
61078
61039
|
catch (e) {
|
|
61079
61040
|
console.error(e);
|
|
61080
|
-
reportError({
|
|
61081
|
-
apiUrl: apiV2URL,
|
|
61082
|
-
error: e,
|
|
61083
|
-
extraInfo: { type: 'getBillNftBatchData', billNftIds, billNftAddress, e },
|
|
61084
|
-
chainId,
|
|
61085
|
-
});
|
|
61086
61041
|
// If an error occurs, return null
|
|
61087
61042
|
return null;
|
|
61088
61043
|
}
|
|
@@ -61107,12 +61062,6 @@ const getBondNFTData = (apiV2URL, id, billNftAddress, chainId) => __awaiter$9(vo
|
|
|
61107
61062
|
}
|
|
61108
61063
|
catch (e) {
|
|
61109
61064
|
console.error(e);
|
|
61110
|
-
reportError({
|
|
61111
|
-
apiUrl: apiV2URL,
|
|
61112
|
-
error: e,
|
|
61113
|
-
extraInfo: { type: 'getBondNFTData', billNftAddress, e },
|
|
61114
|
-
chainId,
|
|
61115
|
-
});
|
|
61116
61065
|
}
|
|
61117
61066
|
});
|
|
61118
61067
|
|
|
@@ -62395,7 +62344,6 @@ const useMonitorTxHash = (txHash, chainId) => {
|
|
|
62395
62344
|
const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
62396
62345
|
var _a, _b, _c;
|
|
62397
62346
|
// Hooks
|
|
62398
|
-
const SDKConfig = useSDKConfig();
|
|
62399
62347
|
const userChainId = useChainId();
|
|
62400
62348
|
const { address: account } = useAccount();
|
|
62401
62349
|
const { switchChain } = useSwitchChain();
|
|
@@ -62407,7 +62355,7 @@ const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
|
62407
62355
|
const { addToastError } = usePopups();
|
|
62408
62356
|
const load = loadingTx || (isLoading && !isConfirmed);
|
|
62409
62357
|
const handleTransfer = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
62410
|
-
var _a
|
|
62358
|
+
var _a;
|
|
62411
62359
|
const address = userBill === null || userBill === void 0 ? void 0 : userBill.billNftAddress;
|
|
62412
62360
|
try {
|
|
62413
62361
|
setLoadingTx(true);
|
|
@@ -62440,13 +62388,6 @@ const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
|
62440
62388
|
console.error('Transfer failed:', error);
|
|
62441
62389
|
setLoadingTx(false);
|
|
62442
62390
|
addToastError(error.shortMessage);
|
|
62443
|
-
reportError({
|
|
62444
|
-
apiUrl: (_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _b === void 0 ? void 0 : _b.apiV2,
|
|
62445
|
-
error,
|
|
62446
|
-
extraInfo: { type: 'transfer', userBill, error },
|
|
62447
|
-
chainId: userChainId,
|
|
62448
|
-
account,
|
|
62449
|
-
});
|
|
62450
62391
|
}
|
|
62451
62392
|
});
|
|
62452
62393
|
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" })) }));
|
|
@@ -69748,35 +69689,28 @@ var PRICE_GETTER_V3_ABI = [
|
|
|
69748
69689
|
];
|
|
69749
69690
|
|
|
69750
69691
|
function useTokenPrices() {
|
|
69751
|
-
var _a;
|
|
69752
69692
|
const realTime = useURLByEnvironment('realTimeApi');
|
|
69753
69693
|
const SDKConfig = useSDKConfig();
|
|
69754
|
-
const apiUrl = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2;
|
|
69755
69694
|
return useQuery({
|
|
69756
69695
|
queryKey: [QUERY_KEYS.TOKEN_PRICES],
|
|
69757
|
-
queryFn: () => getTokenPrices(realTime, SDKConfig.chains
|
|
69696
|
+
queryFn: () => getTokenPrices(realTime, SDKConfig.chains),
|
|
69758
69697
|
refetchInterval: 60000, // 60 sec
|
|
69759
69698
|
refetchOnMount: false,
|
|
69760
69699
|
refetchOnWindowFocus: false,
|
|
69761
69700
|
enabled: !!SDKConfig.chains && SDKConfig.chains.length > 0,
|
|
69762
69701
|
});
|
|
69763
69702
|
}
|
|
69764
|
-
const getTokenPrices = (
|
|
69703
|
+
const getTokenPrices = (apiURL, chains) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69765
69704
|
try {
|
|
69766
|
-
const response = yield axios.get(`${
|
|
69705
|
+
const response = yield axios.get(`${apiURL}/utils/tokens`);
|
|
69767
69706
|
const tokenList = response.data;
|
|
69768
69707
|
const promises = chains.map((chain) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69769
69708
|
try {
|
|
69770
69709
|
// Directly return the result of fetching prices, or handle any exceptions here
|
|
69771
|
-
return yield getAllTokenPrices(+chain, tokenList
|
|
69710
|
+
return yield getAllTokenPrices(+chain, tokenList);
|
|
69772
69711
|
}
|
|
69773
69712
|
catch (error) {
|
|
69774
69713
|
console.error(`Failed to fetch prices for chain ${chain}:`, error);
|
|
69775
|
-
reportError({
|
|
69776
|
-
apiUrl,
|
|
69777
|
-
error,
|
|
69778
|
-
extraInfo: { type: 'getAllTokenPrices', chains, error },
|
|
69779
|
-
});
|
|
69780
69714
|
return null;
|
|
69781
69715
|
}
|
|
69782
69716
|
}));
|
|
@@ -69790,16 +69724,11 @@ const getTokenPrices = (realTimeApiURL, chains, apiUrl) => __awaiter$9(void 0, v
|
|
|
69790
69724
|
}, []);
|
|
69791
69725
|
return flattenedPrices;
|
|
69792
69726
|
}
|
|
69793
|
-
catch (
|
|
69794
|
-
reportError({
|
|
69795
|
-
apiUrl,
|
|
69796
|
-
error,
|
|
69797
|
-
extraInfo: { type: 'getTokenPrices', chains, error },
|
|
69798
|
-
});
|
|
69727
|
+
catch (_a) {
|
|
69799
69728
|
return [];
|
|
69800
69729
|
}
|
|
69801
69730
|
});
|
|
69802
|
-
const getAllTokenPrices = (chainId, tokens
|
|
69731
|
+
const getAllTokenPrices = (chainId, tokens) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69803
69732
|
const { externalTokens, filterTokensToCall, arrayFilterTokens } = Object.keys(tokens).reduce((acc, key) => {
|
|
69804
69733
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
69805
69734
|
const token = tokens[key];
|
|
@@ -69834,7 +69763,7 @@ const getAllTokenPrices = (chainId, tokens, apiUrl) => __awaiter$9(void 0, void
|
|
|
69834
69763
|
};
|
|
69835
69764
|
});
|
|
69836
69765
|
}
|
|
69837
|
-
const externalResults = yield getBatchTokensExternal({ chainId, tokens: externalTokens
|
|
69766
|
+
const externalResults = yield getBatchTokensExternal({ chainId, tokens: externalTokens });
|
|
69838
69767
|
const tokenResults = yield getTokenPricesV3FromPriceGetter(filterTokensToCall, chainId);
|
|
69839
69768
|
const parsedTokenResults = arrayFilterTokens.map((token, i) => {
|
|
69840
69769
|
var _a, _b, _c;
|
|
@@ -69850,7 +69779,7 @@ const getAllTokenPrices = (chainId, tokens, apiUrl) => __awaiter$9(void 0, void
|
|
|
69850
69779
|
return [...parsedTokenResults, ...externalResults];
|
|
69851
69780
|
});
|
|
69852
69781
|
const getBatchTokensExternal = (params) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69853
|
-
const { chainId, tokens
|
|
69782
|
+
const { chainId, tokens } = params;
|
|
69854
69783
|
try {
|
|
69855
69784
|
const baseURL = 'https://price-api.ape.bond/prices';
|
|
69856
69785
|
const tokensToCall = tokens.map((token) => token.address);
|
|
@@ -69870,14 +69799,8 @@ const getBatchTokensExternal = (params) => __awaiter$9(void 0, void 0, void 0, f
|
|
|
69870
69799
|
};
|
|
69871
69800
|
});
|
|
69872
69801
|
}
|
|
69873
|
-
catch (
|
|
69802
|
+
catch (_a) {
|
|
69874
69803
|
console.log(`Failed to get price from api for chain ${chainId}.`);
|
|
69875
|
-
reportError({
|
|
69876
|
-
apiUrl,
|
|
69877
|
-
error,
|
|
69878
|
-
extraInfo: { type: 'getBatchTokensExternal', tokens, error },
|
|
69879
|
-
chainId,
|
|
69880
|
-
});
|
|
69881
69804
|
return [];
|
|
69882
69805
|
}
|
|
69883
69806
|
});
|
|
@@ -69966,7 +69889,6 @@ const SafeHTMLComponent = ({ html }) => {
|
|
|
69966
69889
|
const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
69967
69890
|
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;
|
|
69968
69891
|
// Hooks
|
|
69969
|
-
const SDKConfig = useSDKConfig();
|
|
69970
69892
|
const chainId = useChainId();
|
|
69971
69893
|
const { switchChain } = useSwitchChain();
|
|
69972
69894
|
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);
|
|
@@ -69987,7 +69909,6 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
69987
69909
|
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
69988
69910
|
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
69989
69911
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
69990
|
-
var _a;
|
|
69991
69912
|
const address = billAddress;
|
|
69992
69913
|
try {
|
|
69993
69914
|
setLoadingTx(true);
|
|
@@ -70018,13 +69939,6 @@ const YourBondsModal = ({ onDismiss, userBill }) => {
|
|
|
70018
69939
|
console.error('Claim Failed:', error);
|
|
70019
69940
|
setLoadingTx(false);
|
|
70020
69941
|
addToastError(error.message);
|
|
70021
|
-
reportError({
|
|
70022
|
-
apiUrl: (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2,
|
|
70023
|
-
error,
|
|
70024
|
-
extraInfo: { type: 'redeem', userBill, error },
|
|
70025
|
-
chainId,
|
|
70026
|
-
account,
|
|
70027
|
-
});
|
|
70028
69942
|
}
|
|
70029
69943
|
});
|
|
70030
69944
|
// Functions to calculate display values for modal
|
|
@@ -70179,7 +70093,6 @@ const BondInfoTooltip = ({ earnTokenContract, earnTokenSymbol, bondContract, pro
|
|
|
70179
70093
|
const UserBondRow = ({ bill }) => {
|
|
70180
70094
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
70181
70095
|
const userChainId = useChainId();
|
|
70182
|
-
const SDKConfig = useSDKConfig();
|
|
70183
70096
|
const { address: account } = useAccount();
|
|
70184
70097
|
const { switchChain } = useSwitchChain();
|
|
70185
70098
|
const { writeContractAsync } = useWriteContract();
|
|
@@ -70190,7 +70103,6 @@ const UserBondRow = ({ bill }) => {
|
|
|
70190
70103
|
const load = loadingTx || (isConfirming && !isConfirmed);
|
|
70191
70104
|
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModal, { userBill: bill }));
|
|
70192
70105
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70193
|
-
var _a;
|
|
70194
70106
|
const address = billAddress;
|
|
70195
70107
|
try {
|
|
70196
70108
|
setLoadingTx(true);
|
|
@@ -70221,13 +70133,6 @@ const UserBondRow = ({ bill }) => {
|
|
|
70221
70133
|
setLoadingTx(false);
|
|
70222
70134
|
console.error('Claim failed:', error);
|
|
70223
70135
|
addToastError(error.message);
|
|
70224
|
-
reportError({
|
|
70225
|
-
apiUrl: (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2,
|
|
70226
|
-
error,
|
|
70227
|
-
extraInfo: { type: 'claim', bill, error },
|
|
70228
|
-
chainId: bill.bond.chainId,
|
|
70229
|
-
account,
|
|
70230
|
-
});
|
|
70231
70136
|
}
|
|
70232
70137
|
});
|
|
70233
70138
|
// Display Info
|
|
@@ -70253,25 +70158,19 @@ const UserBondRow = ({ bill }) => {
|
|
|
70253
70158
|
|
|
70254
70159
|
function useBondsList() {
|
|
70255
70160
|
const realTime = useURLByEnvironment('realTimeApi');
|
|
70256
|
-
const apiUrl = useURLByEnvironment('apiV2');
|
|
70257
70161
|
return useQuery({
|
|
70258
70162
|
queryKey: [QUERY_KEYS.BONDS_LIST],
|
|
70259
|
-
queryFn: () => getBondsList(realTime
|
|
70163
|
+
queryFn: () => getBondsList(realTime),
|
|
70260
70164
|
staleTime: Infinity,
|
|
70261
70165
|
refetchOnWindowFocus: false,
|
|
70262
70166
|
});
|
|
70263
70167
|
}
|
|
70264
|
-
const getBondsList = (
|
|
70168
|
+
const getBondsList = (apiURL) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70265
70169
|
try {
|
|
70266
|
-
const response = yield axios.get(`${
|
|
70170
|
+
const response = yield axios.get(`${apiURL}/utils/bonds`);
|
|
70267
70171
|
return response.data;
|
|
70268
70172
|
}
|
|
70269
|
-
catch (
|
|
70270
|
-
reportError({
|
|
70271
|
-
apiUrl,
|
|
70272
|
-
error: e,
|
|
70273
|
-
extraInfo: { type: 'getBondsList', e },
|
|
70274
|
-
});
|
|
70173
|
+
catch (_a) {
|
|
70275
70174
|
return [];
|
|
70276
70175
|
}
|
|
70277
70176
|
});
|
|
@@ -70376,24 +70275,22 @@ const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices) => __awaiter$
|
|
|
70376
70275
|
});
|
|
70377
70276
|
|
|
70378
70277
|
function useUserBonds() {
|
|
70379
|
-
var _a;
|
|
70380
70278
|
// First fetch the full list of bonds
|
|
70381
70279
|
const { data: bondList } = useBondsList();
|
|
70382
70280
|
const { address } = useAccount();
|
|
70383
70281
|
const SDKConfig = useSDKConfig();
|
|
70384
70282
|
const { data: tokenPrices } = useTokenPrices();
|
|
70385
70283
|
const chains = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.chains;
|
|
70386
|
-
const apiUrl = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2;
|
|
70387
70284
|
// Once the full list is fetched, fetch user's purchased bonds
|
|
70388
70285
|
return useQuery({
|
|
70389
70286
|
queryKey: [QUERY_KEYS.USER_BONDS, address],
|
|
70390
|
-
queryFn: () => getUserBonds(address, bondList, chains, tokenPrices
|
|
70287
|
+
queryFn: () => getUserBonds(address, bondList, chains, tokenPrices),
|
|
70391
70288
|
refetchOnWindowFocus: false,
|
|
70392
70289
|
refetchInterval: 60000,
|
|
70393
70290
|
enabled: !!bondList && !!address && !!tokenPrices,
|
|
70394
70291
|
});
|
|
70395
70292
|
}
|
|
70396
|
-
const getUserBonds = (account, bondList, chains, tokenPrices
|
|
70293
|
+
const getUserBonds = (account, bondList, chains, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70397
70294
|
try {
|
|
70398
70295
|
const bondsByChain = bondList.reduce((acc, bond) => {
|
|
70399
70296
|
var _a;
|
|
@@ -70423,13 +70320,7 @@ const getUserBonds = (account, bondList, chains, tokenPrices, apiUrl) => __await
|
|
|
70423
70320
|
.map((result) => result.value);
|
|
70424
70321
|
return fulfilledResults.flat().flatMap((result) => result.userOwnedBills);
|
|
70425
70322
|
}
|
|
70426
|
-
catch (
|
|
70427
|
-
reportError({
|
|
70428
|
-
apiUrl,
|
|
70429
|
-
error: e,
|
|
70430
|
-
extraInfo: { type: 'getUserBonds', bondList, chains, e },
|
|
70431
|
-
account,
|
|
70432
|
-
});
|
|
70323
|
+
catch (_a) {
|
|
70433
70324
|
return [];
|
|
70434
70325
|
}
|
|
70435
70326
|
});
|
|
@@ -70771,7 +70662,6 @@ const ClaimAllModal = () => {
|
|
|
70771
70662
|
const { addToastError } = usePopups();
|
|
70772
70663
|
const { writeContractAsync } = useWriteContract();
|
|
70773
70664
|
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70774
|
-
var _a;
|
|
70775
70665
|
try {
|
|
70776
70666
|
bondsOfSelectedChain === null || bondsOfSelectedChain === void 0 ? void 0 : bondsOfSelectedChain.map((purchasedBond) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
70777
70667
|
const address = purchasedBond.bond.contractAddress[purchasedBond.bond.chainId];
|
|
@@ -70797,13 +70687,6 @@ const ClaimAllModal = () => {
|
|
|
70797
70687
|
catch (error) {
|
|
70798
70688
|
console.error('Claim All failed:', error);
|
|
70799
70689
|
addToastError(error.message);
|
|
70800
|
-
reportError({
|
|
70801
|
-
apiUrl: (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2,
|
|
70802
|
-
error,
|
|
70803
|
-
extraInfo: { type: 'claimAll', bondsOfSelectedChain, error },
|
|
70804
|
-
chainId,
|
|
70805
|
-
account,
|
|
70806
|
-
});
|
|
70807
70690
|
}
|
|
70808
70691
|
});
|
|
70809
70692
|
const purchasedBillsChains = (_a = groupedBills === null || groupedBills === void 0 ? void 0 : groupedBills.reduce((acc, bill) => {
|
|
@@ -73214,46 +73097,37 @@ var launchBondsABI_V2_2_0 = [
|
|
|
73214
73097
|
];
|
|
73215
73098
|
|
|
73216
73099
|
function usePreTGEList() {
|
|
73217
|
-
|
|
73218
|
-
const SDKConfig = useSDKConfig();
|
|
73219
|
-
const realTime = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.realTimeApi;
|
|
73220
|
-
const apiUrl = (_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _b === void 0 ? void 0 : _b.apiV2;
|
|
73100
|
+
const realTime = useURLByEnvironment('realTimeApi');
|
|
73221
73101
|
return useQuery({
|
|
73222
73102
|
queryKey: [QUERY_KEYS.PRE_TGE_LIST],
|
|
73223
|
-
queryFn: () => getPreTGEList(realTime
|
|
73103
|
+
queryFn: () => getPreTGEList(realTime),
|
|
73224
73104
|
staleTime: Infinity,
|
|
73225
73105
|
refetchOnWindowFocus: false,
|
|
73226
73106
|
});
|
|
73227
73107
|
}
|
|
73228
|
-
const getPreTGEList = (
|
|
73108
|
+
const getPreTGEList = (apiURL) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73229
73109
|
try {
|
|
73230
|
-
const response = yield axios.get(`${
|
|
73110
|
+
const response = yield axios.get(`${apiURL}/utils/pre-tge-bonds`);
|
|
73231
73111
|
return response.data;
|
|
73232
73112
|
}
|
|
73233
|
-
catch (
|
|
73234
|
-
reportError({
|
|
73235
|
-
apiUrl,
|
|
73236
|
-
error: e,
|
|
73237
|
-
extraInfo: { type: 'getPreTGEList', e },
|
|
73238
|
-
});
|
|
73113
|
+
catch (_a) {
|
|
73239
73114
|
return [];
|
|
73240
73115
|
}
|
|
73241
73116
|
});
|
|
73242
73117
|
|
|
73243
73118
|
function usePreTGEBondsData() {
|
|
73244
|
-
var _a
|
|
73119
|
+
var _a;
|
|
73245
73120
|
const { data: preTGEList } = usePreTGEList();
|
|
73246
73121
|
const SDKConfig = useSDKConfig();
|
|
73247
|
-
const apiUrl = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.apiV2;
|
|
73248
73122
|
return useQuery({
|
|
73249
|
-
queryKey: [QUERY_KEYS.PRE_TGE_BONDS, (
|
|
73250
|
-
queryFn: () => getLaunchBondsPublicData(preTGEList, SDKConfig.chains
|
|
73123
|
+
queryKey: [QUERY_KEYS.PRE_TGE_BONDS, (_a = preTGEList === null || preTGEList === void 0 ? void 0 : preTGEList.length) !== null && _a !== void 0 ? _a : ''],
|
|
73124
|
+
queryFn: () => getLaunchBondsPublicData(preTGEList, SDKConfig.chains),
|
|
73251
73125
|
staleTime: 60000,
|
|
73252
73126
|
refetchOnWindowFocus: false,
|
|
73253
73127
|
enabled: !!preTGEList && preTGEList.length > 0,
|
|
73254
73128
|
});
|
|
73255
73129
|
}
|
|
73256
|
-
const getLaunchBondsPublicData = (preTGEBonds, chains
|
|
73130
|
+
const getLaunchBondsPublicData = (preTGEBonds, chains) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73257
73131
|
try {
|
|
73258
73132
|
if (!(preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.length))
|
|
73259
73133
|
return null;
|
|
@@ -73316,12 +73190,7 @@ const getLaunchBondsPublicData = (preTGEBonds, chains, apiUrl) => __awaiter$9(vo
|
|
|
73316
73190
|
}
|
|
73317
73191
|
return data.flat();
|
|
73318
73192
|
}
|
|
73319
|
-
catch (
|
|
73320
|
-
reportError({
|
|
73321
|
-
apiUrl,
|
|
73322
|
-
error: e,
|
|
73323
|
-
extraInfo: { type: 'getLaunchBondsPublicData', preTGEBonds, chains, e },
|
|
73324
|
-
});
|
|
73193
|
+
catch (_a) {
|
|
73325
73194
|
return [];
|
|
73326
73195
|
}
|
|
73327
73196
|
});
|
|
@@ -73330,16 +73199,15 @@ function usePreTGEUserBonds() {
|
|
|
73330
73199
|
var _a;
|
|
73331
73200
|
const { data: preTGEBonds } = usePreTGEBondsData();
|
|
73332
73201
|
const { address } = useAccount();
|
|
73333
|
-
const apiUrl = useURLByEnvironment('apiV2');
|
|
73334
73202
|
return useQuery({
|
|
73335
73203
|
queryKey: [QUERY_KEYS.PRE_TGE_BONDS, (_a = preTGEBonds === null || preTGEBonds === void 0 ? void 0 : preTGEBonds.length) !== null && _a !== void 0 ? _a : '', address],
|
|
73336
|
-
queryFn: () => fetchPreTGEUserBonds(preTGEBonds, address
|
|
73204
|
+
queryFn: () => fetchPreTGEUserBonds(preTGEBonds, address),
|
|
73337
73205
|
staleTime: 30000,
|
|
73338
73206
|
refetchOnWindowFocus: false,
|
|
73339
73207
|
enabled: !!preTGEBonds && preTGEBonds.length > 0 && !!address,
|
|
73340
73208
|
});
|
|
73341
73209
|
}
|
|
73342
|
-
const fetchPreTGEUserBonds = (preTGEBonds, account
|
|
73210
|
+
const fetchPreTGEUserBonds = (preTGEBonds, account) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73343
73211
|
try {
|
|
73344
73212
|
const res = yield Promise.all(preTGEBonds.map((bond) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
73345
73213
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
@@ -73421,12 +73289,6 @@ const fetchPreTGEUserBonds = (preTGEBonds, account, apiUrl) => __awaiter$9(void
|
|
|
73421
73289
|
}
|
|
73422
73290
|
catch (e) {
|
|
73423
73291
|
console.log(e);
|
|
73424
|
-
reportError({
|
|
73425
|
-
apiUrl,
|
|
73426
|
-
error: e,
|
|
73427
|
-
extraInfo: { type: 'fetchPreTGEUserBonds', preTGEBonds, e },
|
|
73428
|
-
account,
|
|
73429
|
-
});
|
|
73430
73292
|
return [];
|
|
73431
73293
|
}
|
|
73432
73294
|
});
|
|
@@ -73687,6 +73549,22 @@ const isBondSupported = (SDKVersion, bondVersion) => {
|
|
|
73687
73549
|
// If none of the above conditions are met, version1 is less
|
|
73688
73550
|
return false;
|
|
73689
73551
|
};
|
|
73552
|
+
const getRemainingTokensString = (bond) => {
|
|
73553
|
+
const remainingTokensFormat = (bond) => {
|
|
73554
|
+
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
73555
|
+
return formatNumberSI(parseFloat(tokensRemaining), 0);
|
|
73556
|
+
};
|
|
73557
|
+
const remainingTokensUsd = (bond) => {
|
|
73558
|
+
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
73559
|
+
const payoutTokenPrice = 'payoutTokenPrice' in bond ? bond.payoutTokenPrice : 0;
|
|
73560
|
+
const tokens = new BigNumber$1(tokensRemaining);
|
|
73561
|
+
return tokens.times(payoutTokenPrice);
|
|
73562
|
+
};
|
|
73563
|
+
return `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} (${formatDollar({
|
|
73564
|
+
num: remainingTokensUsd(bond).toNumber(),
|
|
73565
|
+
isPrice: true,
|
|
73566
|
+
})})`;
|
|
73567
|
+
};
|
|
73690
73568
|
|
|
73691
73569
|
var BOND_2_4_0 = [
|
|
73692
73570
|
{
|
|
@@ -76099,11 +75977,10 @@ function useBondsData() {
|
|
|
76099
75977
|
const { data: tokenPrices } = useTokenPrices();
|
|
76100
75978
|
const { data: bondList } = useBondsList();
|
|
76101
75979
|
const SDKConfig = useSDKConfig();
|
|
76102
|
-
const apiUrl = useURLByEnvironment('apiV2');
|
|
76103
75980
|
const realTimeApiURL = useURLByEnvironment('realTimeApi');
|
|
76104
75981
|
return useQuery({
|
|
76105
75982
|
queryKey: [QUERY_KEYS.BONDS_DATA],
|
|
76106
|
-
queryFn: () => getBondsData(SDKConfig.chains, realTimeApiURL, tokenPrices, bondList
|
|
75983
|
+
queryFn: () => getBondsData(SDKConfig.chains, realTimeApiURL, tokenPrices, bondList),
|
|
76107
75984
|
refetchInterval: 20000, // i.e. 20 sec
|
|
76108
75985
|
refetchOnWindowFocus: false,
|
|
76109
75986
|
retry: 0,
|
|
@@ -76111,12 +75988,12 @@ function useBondsData() {
|
|
|
76111
75988
|
enabled: !!SDKConfig.chains && SDKConfig.chains.length > 0,
|
|
76112
75989
|
});
|
|
76113
75990
|
}
|
|
76114
|
-
const getBondsData = (chains, realTimeApiURL, tokenPrices, bondList
|
|
75991
|
+
const getBondsData = (chains, realTimeApiURL, tokenPrices, bondList) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
76115
75992
|
try {
|
|
76116
75993
|
const response = yield axios.get(`${realTimeApiURL}/bonds`);
|
|
76117
75994
|
return response.data.bonds;
|
|
76118
75995
|
}
|
|
76119
|
-
catch (
|
|
75996
|
+
catch (_a) {
|
|
76120
75997
|
console.time('Fallback'); // Start debug timer
|
|
76121
75998
|
const billData = [];
|
|
76122
75999
|
if (tokenPrices && bondList) {
|
|
@@ -76133,11 +76010,6 @@ const getBondsData = (chains, realTimeApiURL, tokenPrices, bondList, apiUrl) =>
|
|
|
76133
76010
|
})));
|
|
76134
76011
|
}
|
|
76135
76012
|
console.timeEnd(`Fallback`); // End chain-specific timer
|
|
76136
|
-
reportError({
|
|
76137
|
-
apiUrl,
|
|
76138
|
-
error: e,
|
|
76139
|
-
extraInfo: { type: 'getBondsData', e },
|
|
76140
|
-
});
|
|
76141
76013
|
return billData === null || billData === void 0 ? void 0 : billData.flat();
|
|
76142
76014
|
}
|
|
76143
76015
|
});
|
|
@@ -76592,16 +76464,15 @@ var ERC_20_ABI = [
|
|
|
76592
76464
|
function useUserTokensBalance(tokens, chainId) {
|
|
76593
76465
|
const keys = tokens.map((token) => (token === 'NATIVE' ? 'NATIVE' : token.address[chainId]));
|
|
76594
76466
|
const { address: account } = useAccount();
|
|
76595
|
-
const apiUrl = useURLByEnvironment('apiV2');
|
|
76596
76467
|
return useQuery({
|
|
76597
76468
|
queryKey: [`${QUERY_KEYS.USER_TOKENS_BALANCES}-${keys}-${account}`],
|
|
76598
|
-
queryFn: () => getTokensBalance(account, tokens, chainId
|
|
76469
|
+
queryFn: () => getTokensBalance(account, tokens, chainId),
|
|
76599
76470
|
staleTime: 60000,
|
|
76600
76471
|
refetchOnWindowFocus: false,
|
|
76601
76472
|
enabled: !!account,
|
|
76602
76473
|
});
|
|
76603
76474
|
}
|
|
76604
|
-
const getTokensBalance = (account, tokens, chainId
|
|
76475
|
+
const getTokensBalance = (account, tokens, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
76605
76476
|
try {
|
|
76606
76477
|
const callsToken = tokens
|
|
76607
76478
|
.filter((token) => token !== 'NATIVE')
|
|
@@ -76643,14 +76514,7 @@ const getTokensBalance = (account, tokens, chainId, apiUrl) => __awaiter$9(void
|
|
|
76643
76514
|
});
|
|
76644
76515
|
return [...balancesToken, ...balancesNative];
|
|
76645
76516
|
}
|
|
76646
|
-
catch (
|
|
76647
|
-
reportError({
|
|
76648
|
-
apiUrl,
|
|
76649
|
-
error: e,
|
|
76650
|
-
extraInfo: { type: 'getTokensBalance', tokens, e },
|
|
76651
|
-
account,
|
|
76652
|
-
chainId,
|
|
76653
|
-
});
|
|
76517
|
+
catch (_a) {
|
|
76654
76518
|
return [];
|
|
76655
76519
|
}
|
|
76656
76520
|
});
|
|
@@ -77743,7 +77607,6 @@ const getTokenAllowance = (currency, spender, account, chainId) => __awaiter$9(v
|
|
|
77743
77607
|
return value.toNumber();
|
|
77744
77608
|
});
|
|
77745
77609
|
const useApproval = (amount, currency, spender, account, chainId) => {
|
|
77746
|
-
const apiUrl = useURLByEnvironment('apiV2');
|
|
77747
77610
|
const [confirmingTxOnWallet, setConfirmingTxOnWallet] = useState(false);
|
|
77748
77611
|
const [txHash, setTxHash] = useState('');
|
|
77749
77612
|
const { data: allowance, refetch } = useAllowance(currency, spender, account, chainId);
|
|
@@ -77785,13 +77648,6 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
77785
77648
|
setConfirmingTxOnWallet(false);
|
|
77786
77649
|
console.error('Approval failed:', error);
|
|
77787
77650
|
addToastError(error.message);
|
|
77788
|
-
reportError({
|
|
77789
|
-
apiUrl,
|
|
77790
|
-
error,
|
|
77791
|
-
extraInfo: { type: 'approval', tokenAddress: tokenAddress, spenderAddress: spender, error },
|
|
77792
|
-
chainId,
|
|
77793
|
-
account,
|
|
77794
|
-
});
|
|
77795
77651
|
}
|
|
77796
77652
|
}), [amount, currency, chainId]);
|
|
77797
77653
|
let approvalState = ApprovalState.NOT_APPROVED;
|
|
@@ -78040,7 +77896,6 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
78040
77896
|
const [typedValue, setTypedValue] = useState('');
|
|
78041
77897
|
const [inputTokenString, setInputTokenString] = useState('NATIVE');
|
|
78042
77898
|
// Hooks
|
|
78043
|
-
const SDKConfig = useSDKConfig();
|
|
78044
77899
|
const userChainId = useChainId();
|
|
78045
77900
|
const { switchChain } = useSwitchChain();
|
|
78046
77901
|
const inputToken = useTokenFromZapList(inputTokenString, chainId, null);
|
|
@@ -78069,7 +77924,7 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
78069
77924
|
setTypedValue(inputTokenBalance !== null && inputTokenBalance !== void 0 ? inputTokenBalance : '');
|
|
78070
77925
|
}, [inputTokenBalance]);
|
|
78071
77926
|
const soulZapCallback = useCallback(() => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
78072
|
-
var _a, _b
|
|
77927
|
+
var _a, _b;
|
|
78073
77928
|
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)) {
|
|
78074
77929
|
try {
|
|
78075
77930
|
console.log(zapData);
|
|
@@ -78102,13 +77957,6 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
78102
77957
|
console.error(e);
|
|
78103
77958
|
setPendingTx(false);
|
|
78104
77959
|
addToastError(e.shortMessage);
|
|
78105
|
-
reportError({
|
|
78106
|
-
apiUrl: (_c = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _c === void 0 ? void 0 : _c.apiV2,
|
|
78107
|
-
error: e,
|
|
78108
|
-
extraInfo: { type: 'zap-lp', zapData, e },
|
|
78109
|
-
chainId,
|
|
78110
|
-
account,
|
|
78111
|
-
});
|
|
78112
77960
|
}
|
|
78113
77961
|
}
|
|
78114
77962
|
}), [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]);
|
|
@@ -78458,10 +78306,59 @@ const useIsMobile = () => {
|
|
|
78458
78306
|
return isMobile;
|
|
78459
78307
|
};
|
|
78460
78308
|
|
|
78309
|
+
var ABTestKeys;
|
|
78310
|
+
(function (ABTestKeys) {
|
|
78311
|
+
ABTestKeys["BOND_DESCRIPTION"] = "bondDescription";
|
|
78312
|
+
ABTestKeys["BOND_BUY_BUTTON"] = "bondBuyButton";
|
|
78313
|
+
ABTestKeys["BOND_BUY_ARR"] = "bondBuyArr";
|
|
78314
|
+
})(ABTestKeys || (ABTestKeys = {}));
|
|
78315
|
+
function useABTesting({ key, defaultValue = (Math.random() < 0.5).toString(), }) {
|
|
78316
|
+
const { cookie, updateCookie } = useCookie(QUERY_KEYS.AB_TEST_VALUE, null);
|
|
78317
|
+
let abTestValue = '';
|
|
78318
|
+
let parseCookie = null;
|
|
78319
|
+
if (cookie === null || cookie === undefined || cookie[key] === undefined) {
|
|
78320
|
+
parseCookie = Object.assign(Object.assign({}, cookie), { [key]: defaultValue.toString() });
|
|
78321
|
+
abTestValue = defaultValue.toString();
|
|
78322
|
+
updateCookie(parseCookie);
|
|
78323
|
+
}
|
|
78324
|
+
if (cookie) {
|
|
78325
|
+
parseCookie = cookie;
|
|
78326
|
+
if (parseCookie && parseCookie[key]) {
|
|
78327
|
+
abTestValue = parseCookie[key].toString();
|
|
78328
|
+
}
|
|
78329
|
+
}
|
|
78330
|
+
return { abTestValue };
|
|
78331
|
+
}
|
|
78332
|
+
|
|
78333
|
+
const ProgressBar = ({ value, color = 'text' }) => {
|
|
78334
|
+
return (jsx$2(Flex$1, { sx: { width: ['100px', '100px', '100px', '100%'], alignItems: 'center', flexDirection: 'row', mt: '5px' }, children: jsx$2(Box$1, { className: "progressbar-background", children: jsx$2(Box$1, { className: "progressbar-completed", style: {
|
|
78335
|
+
width: `${value <= 3 ? 3 : value}%`,
|
|
78336
|
+
} }) }) }));
|
|
78337
|
+
};
|
|
78338
|
+
|
|
78339
|
+
const styles$9 = {
|
|
78340
|
+
titleText: {
|
|
78341
|
+
opacity: 0.6,
|
|
78342
|
+
fontSize: '12px',
|
|
78343
|
+
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
78344
|
+
fontWeight: 400,
|
|
78345
|
+
},
|
|
78346
|
+
skeleton: {
|
|
78347
|
+
width: ['45px', '45px', '60px'],
|
|
78348
|
+
maxHeight: '18px',
|
|
78349
|
+
minHeight: '18px',
|
|
78350
|
+
}};
|
|
78351
|
+
|
|
78352
|
+
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
78353
|
+
return (jsxs(Flex, { sx: style, children: [jsx$2(Flex, { sx: { alignItems: 'center' }, children: jsx$2(Text, { sx: styles$9.titleText, children: `${title}` }) }), showTooltip ? (jsx$2(Flex, { sx: { alignItems: 'center', width: '100%' }, children: jsx$2(TooltipBubble, { placement: toolTipPlacement, transformTip: toolTipTransform, body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: toolTip }), width: "250px", children: jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', width: '127px' }, children: value ? value : jsx$2(Skeleton, { sx: styles$9.skeleton }) }) }) })) : (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center' }, children: value ? value : jsx$2(Skeleton, { sx: styles$9.skeleton }) }))] }));
|
|
78354
|
+
};
|
|
78355
|
+
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
78356
|
+
|
|
78461
78357
|
const BondCards$1 = ({ bondData }) => {
|
|
78462
78358
|
var _a, _b, _c;
|
|
78463
78359
|
const isMobile = useIsMobile();
|
|
78464
78360
|
const SDKConfig = useSDKConfig();
|
|
78361
|
+
const { abTestValue } = useABTesting({ key: ABTestKeys.BOND_BUY_ARR });
|
|
78465
78362
|
return (jsxs("div", { className: "bonds-cards", children: [jsxs("div", { className: "bond-card-block", sx: {
|
|
78466
78363
|
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
78467
78364
|
'&:first-of-type': {
|
|
@@ -78472,7 +78369,7 @@ const BondCards$1 = ({ bondData }) => {
|
|
|
78472
78369
|
borderBottomRightRadius: 'normal',
|
|
78473
78370
|
borderBottomLeftRadius: 'normal',
|
|
78474
78371
|
},
|
|
78475
|
-
}, children: [jsxs(Flex, { className: "bond-card-title", children: ["Bonus", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(BonusComponent, { trueBondPrices: bondData.trueBondPrices, minTier: bondData.minTier, tooltipPosition: isMobile ? 'bottomRight' : 'bottomLeft' })] }), jsxs("div", { className: "bond-card-block hide-mobile", sx: {
|
|
78372
|
+
}, children: [jsxs(Flex, { className: "bond-card-title", children: ["Bonus", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(BonusComponent, { trueBondPrices: bondData.trueBondPrices, minTier: bondData.minTier, tooltipPosition: isMobile ? 'bottomRight' : 'bottomLeft' })] }), abTestValue === 'true' && (jsxs("div", { className: "bond-card-block hide-mobile", sx: {
|
|
78476
78373
|
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
78477
78374
|
'&:first-of-type': {
|
|
78478
78375
|
borderTopRightRadius: 'normal',
|
|
@@ -78500,7 +78397,22 @@ const BondCards$1 = ({ bondData }) => {
|
|
|
78500
78397
|
zIndex: 1,
|
|
78501
78398
|
background: 'primaryButton',
|
|
78502
78399
|
opacity: 0.3,
|
|
78503
|
-
} }), jsxs(Flex, { sx: { width: '100%', zIndex: 2, alignItems: 'center' }, children: [jsx$2("img", { src: `/images/launch/legend.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { children: calculateARR(bondData, (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers) && bondData.billVersion === types.BillVersion.V4) })] })] })) : (calculateARR(bondData, (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers) && bondData.billVersion === types.BillVersion.V4))] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
78400
|
+
} }), jsxs(Flex, { sx: { width: '100%', zIndex: 2, alignItems: 'center' }, children: [jsx$2("img", { src: `/images/launch/legend.png`, alt: "minTier", style: { width: '21px', height: '21px', marginRight: '3px', zIndex: 1 } }), jsx$2(Flex, { children: calculateARR(bondData, (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers) && bondData.billVersion === types.BillVersion.V4) })] })] })) : (calculateARR(bondData, (SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.useTiers) && bondData.billVersion === types.BillVersion.V4))] })), abTestValue === 'false' && (jsxs("div", { className: "bond-card-block", sx: {
|
|
78401
|
+
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
78402
|
+
'&:first-of-type': {
|
|
78403
|
+
borderTopRightRadius: 'normal',
|
|
78404
|
+
borderTopLeftRadius: 'normal',
|
|
78405
|
+
},
|
|
78406
|
+
'&:last-of-type': {
|
|
78407
|
+
borderBottomRightRadius: 'normal',
|
|
78408
|
+
borderBottomLeftRadius: 'normal',
|
|
78409
|
+
},
|
|
78410
|
+
}, children: [jsxs(Flex, { className: "bond-card-title", children: ["Tokens Remaining", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: remainingPercentage(bondData) }), style: {
|
|
78411
|
+
width: '127px',
|
|
78412
|
+
height: '25px',
|
|
78413
|
+
flexDirection: 'column',
|
|
78414
|
+
justifyContent: 'center',
|
|
78415
|
+
}, showTooltip: true, toolTip: getRemainingTokensString(bondData) })] })), jsxs("div", { className: "bond-card-block", sx: {
|
|
78504
78416
|
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
78505
78417
|
'&:first-of-type': {
|
|
78506
78418
|
borderTopRightRadius: 'normal',
|
|
@@ -78647,14 +78559,7 @@ const getTierProofSig = (apiAddress, account, bondAddress, chainId) => __awaiter
|
|
|
78647
78559
|
const response = yield axios.post(`${apiAddress}/tier-signature`, requestBody);
|
|
78648
78560
|
return response.data.tierProofSignature;
|
|
78649
78561
|
}
|
|
78650
|
-
catch (
|
|
78651
|
-
reportError({
|
|
78652
|
-
apiUrl: apiAddress,
|
|
78653
|
-
error: e,
|
|
78654
|
-
extraInfo: { type: 'getTierProofSig', bondAddress, e },
|
|
78655
|
-
chainId,
|
|
78656
|
-
account,
|
|
78657
|
-
});
|
|
78562
|
+
catch (_a) {
|
|
78658
78563
|
return null;
|
|
78659
78564
|
}
|
|
78660
78565
|
});
|
|
@@ -78713,6 +78618,17 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78713
78618
|
const { data: userPoints } = useTierPoints();
|
|
78714
78619
|
const bondData = bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => { var _a; return ((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
|
|
78715
78620
|
const isMobile = useIsMobile();
|
|
78621
|
+
const { abTestValue } = useABTesting({ key: ABTestKeys.BOND_BUY_ARR });
|
|
78622
|
+
let reason = '';
|
|
78623
|
+
let trackOpenModal = '';
|
|
78624
|
+
if (isMobile) {
|
|
78625
|
+
reason = abTestValue === 'true' ? 'bondBuyMobile' : 'bondBuyRemainingMobile';
|
|
78626
|
+
trackOpenModal = abTestValue === 'true' ? 'openModalARRMobile' : 'openModalRemainingMobile';
|
|
78627
|
+
}
|
|
78628
|
+
else {
|
|
78629
|
+
reason = abTestValue === 'true' ? 'bondBuyARRDesktop' : 'bondBuyRemainingDesktop';
|
|
78630
|
+
trackOpenModal = abTestValue === 'true' ? 'openModalARRDesktop' : 'openModalRemainingDesktop';
|
|
78631
|
+
}
|
|
78716
78632
|
// Tier Gating
|
|
78717
78633
|
const userTier = getUserTier(userPoints !== null && userPoints !== void 0 ? userPoints : '0');
|
|
78718
78634
|
const minTier = (bondData === null || bondData === void 0 ? void 0 : bondData.minTier) !== undefined ? bondData.minTier : null;
|
|
@@ -78783,7 +78699,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78783
78699
|
};
|
|
78784
78700
|
// This is the regular buy bond interaction (a.k.a. write method called "deposit" in smartcontract)
|
|
78785
78701
|
const handleBuyCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
78786
|
-
var _a, _b, _c, _d, _e
|
|
78702
|
+
var _a, _b, _c, _d, _e;
|
|
78787
78703
|
const billAddress = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress;
|
|
78788
78704
|
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;
|
|
78789
78705
|
track({
|
|
@@ -78811,7 +78727,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78811
78727
|
});
|
|
78812
78728
|
if (hash) {
|
|
78813
78729
|
setBuyTxHash(hash);
|
|
78814
|
-
yield sendReferenceId(billAddress, userChainId, hash);
|
|
78730
|
+
yield sendReferenceId(billAddress, userChainId, hash, reason);
|
|
78815
78731
|
handlePurchasedBond === null || handlePurchasedBond === void 0 ? void 0 : handlePurchasedBond(hash);
|
|
78816
78732
|
track({
|
|
78817
78733
|
event: 'bond',
|
|
@@ -78830,19 +78746,12 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78830
78746
|
}
|
|
78831
78747
|
catch (error) {
|
|
78832
78748
|
console.error('Buy error', error);
|
|
78833
|
-
reportError({
|
|
78834
|
-
apiUrl: (_f = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _f === void 0 ? void 0 : _f.apiV2,
|
|
78835
|
-
error,
|
|
78836
|
-
extraInfo: { type: 'buyBond', bondData, error },
|
|
78837
|
-
chainId: bondChain,
|
|
78838
|
-
account,
|
|
78839
|
-
});
|
|
78840
78749
|
addToastError(error.shortMessage);
|
|
78841
78750
|
}
|
|
78842
78751
|
});
|
|
78843
78752
|
// ignore this for SOL migration
|
|
78844
78753
|
const handleZapCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
78845
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
78754
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
78846
78755
|
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)) {
|
|
78847
78756
|
console.log('Attempting zap tx');
|
|
78848
78757
|
track({
|
|
@@ -78865,7 +78774,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78865
78774
|
});
|
|
78866
78775
|
if (hash) {
|
|
78867
78776
|
setBuyTxHash(hash);
|
|
78868
|
-
yield sendReferenceId((_d = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress) !== null && _d !== void 0 ? _d : '', userChainId, hash);
|
|
78777
|
+
yield sendReferenceId((_d = bondData === null || bondData === void 0 ? void 0 : bondData.billAddress) !== null && _d !== void 0 ? _d : '', userChainId, hash, reason);
|
|
78869
78778
|
handlePurchasedBond === null || handlePurchasedBond === void 0 ? void 0 : handlePurchasedBond(hash);
|
|
78870
78779
|
track({
|
|
78871
78780
|
event: 'zap',
|
|
@@ -78895,13 +78804,6 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78895
78804
|
catch (e) {
|
|
78896
78805
|
console.log(e);
|
|
78897
78806
|
addToastError(e.shortMessage);
|
|
78898
|
-
reportError({
|
|
78899
|
-
apiUrl: (_j = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _j === void 0 ? void 0 : _j.apiV2,
|
|
78900
|
-
error: e,
|
|
78901
|
-
extraInfo: { type: 'zapBuyBond', bondData, zapData, e },
|
|
78902
|
-
chainId: bondChain,
|
|
78903
|
-
account,
|
|
78904
|
-
});
|
|
78905
78807
|
}
|
|
78906
78808
|
}
|
|
78907
78809
|
});
|
|
@@ -78945,7 +78847,9 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78945
78847
|
const [openNoBonusModal] = useModal(jsx$2(NoBonusModal, { onAcknowledge: handleBothPurchases, showcaseTokenName: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), true, true, 'NoBonusModal');
|
|
78946
78848
|
// Effects
|
|
78947
78849
|
const [hasChecked, setHasChecked] = useState(false);
|
|
78850
|
+
const [hasCheckedTrack, setHasCheckedTrack] = useState(false);
|
|
78948
78851
|
useEffect(() => {
|
|
78852
|
+
var _a;
|
|
78949
78853
|
if (inputCurrencyBalance !== undefined &&
|
|
78950
78854
|
inputCurrencyBalance === '0' &&
|
|
78951
78855
|
!hasChecked &&
|
|
@@ -78957,7 +78861,17 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, isPro
|
|
|
78957
78861
|
setHasChecked(true);
|
|
78958
78862
|
setInputTokenString(sortedZapList[0].token === 'NATIVE' ? 'NATIVE' : sortedZapList[0].token.address[bondChain]);
|
|
78959
78863
|
}
|
|
78960
|
-
|
|
78864
|
+
if (bondData && !hasCheckedTrack) {
|
|
78865
|
+
setHasCheckedTrack(true);
|
|
78866
|
+
track({
|
|
78867
|
+
event: trackOpenModal,
|
|
78868
|
+
chain: bondData.chainId,
|
|
78869
|
+
data: {
|
|
78870
|
+
bond: (_a = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol) !== null && _a !== void 0 ? _a : '',
|
|
78871
|
+
},
|
|
78872
|
+
});
|
|
78873
|
+
}
|
|
78874
|
+
}, [inputCurrencyBalance, sortedZapList, bondData]);
|
|
78961
78875
|
return bondData ? (jsxs(Flex, { className: `modal-content ${isGoldRush ? 'gold-rush' : ''}`, children: [!isProjectView && 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$1, { 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: zapEnabled, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice, inputDisabled: isUserRestricted }), SDKConfig.useTiers && jsx$2(GetUpToComponent, { bond: bondData, depositAmount: depositAmount }), (bondData === null || bondData === void 0 ? void 0 : bondData.warningCard) && (jsx$2(Flex, { sx: {
|
|
78962
78876
|
width: '100%',
|
|
78963
78877
|
background: '#DE62F366',
|
|
@@ -79043,7 +78957,7 @@ const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
79043
78957
|
} }));
|
|
79044
78958
|
};
|
|
79045
78959
|
|
|
79046
|
-
const styles$
|
|
78960
|
+
const styles$8 = {
|
|
79047
78961
|
buyContainer: {
|
|
79048
78962
|
width: '100%',
|
|
79049
78963
|
mb: ['30px', '30px', '30px', '0px'],
|
|
@@ -79241,7 +79155,7 @@ const BondCards = ({ bond }) => {
|
|
|
79241
79155
|
borderBottomRightRadius: 'normal',
|
|
79242
79156
|
borderBottomLeftRadius: 'normal',
|
|
79243
79157
|
},
|
|
79244
|
-
}, children: [jsxs(Flex, { className: "bond-card-title", children: ["TGE", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: "This is the date and time when this token will become tradeable and officially live on-chain." }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }),
|
|
79158
|
+
}, children: [jsxs(Flex, { className: "bond-card-title", children: ["TGE", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: "This is the date and time when this token will become tradeable and officially live on-chain." }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), "May 25th, 13:00 UTC"] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
79245
79159
|
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
79246
79160
|
'&:first-of-type': {
|
|
79247
79161
|
borderTopRightRadius: 'normal',
|
|
@@ -79251,7 +79165,7 @@ const BondCards = ({ bond }) => {
|
|
|
79251
79165
|
borderBottomRightRadius: 'normal',
|
|
79252
79166
|
borderBottomLeftRadius: 'normal',
|
|
79253
79167
|
},
|
|
79254
|
-
}, children: [jsxs("div", { className: "bond-card-title", children: ["Initial Release", jsx$2(TooltipBubble, { className: "tooltip-bubble", body:
|
|
79168
|
+
}, children: [jsxs("div", { className: "bond-card-title", children: ["Initial Release", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: "This is the percentage of tokens you can claim immediately on May 25th at 11:00 UTC. The rest follows the vesting schedule." }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2("div", { className: "bond-card-tooltip", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), "25%"] }), jsxs("div", { className: "bond-card-block", sx: {
|
|
79255
79169
|
borderRadius: ['0px', '0px', '0px', 'normal'],
|
|
79256
79170
|
'&:first-of-type': {
|
|
79257
79171
|
borderTopRightRadius: 'normal',
|
|
@@ -79296,7 +79210,7 @@ const BuyComponent = ({ bondAddress, bondChain, onDismiss, }) => {
|
|
|
79296
79210
|
}
|
|
79297
79211
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
79298
79212
|
};
|
|
79299
|
-
return (jsxs(Modal, { onDismiss: handleClose, sx: { width: '740px' }, children: [jsx$2(ModalHeader, { onDismiss: handleClose, hideDivider: true }), jsx$2(Flex, { sx: styles$
|
|
79213
|
+
return (jsxs(Modal, { onDismiss: handleClose, sx: { width: '740px' }, children: [jsx$2(ModalHeader, { onDismiss: handleClose, hideDivider: true }), jsx$2(Flex, { sx: styles$8.buyContainer, children: jsxs(Flex, { sx: styles$8.cardContainer, children: [jsx$2(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: jsxs(Flex, { children: [jsxs(Flex, { children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: bond.earnToken.symbol, size: 50, chain: bond.chainId }) }), jsxs(Flex, { className: "title-container bondname", children: [bond.earnToken.symbol, jsx$2(ListTag, { text: (_f = bond === null || bond === void 0 ? void 0 : bond.tags) === null || _f === void 0 ? void 0 : _f[0] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '15px' }, children: [jsxs(Flex, { className: "price-container price", children: ["$", bond.tgePrice] }), jsxs(Flex, { sx: { fontSize: '24px', fontWeight: 700 }, children: ["$", bond.initPrice] })] })] }) }), jsx$2(ProjectDescription, { description: bond.shortDescription, isProjectView: true }), jsx$2(BondCards, { bond: bond }), jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$8.infoRowsContainer), { mt: '10px' }), children: [jsxs(Flex, { sx: styles$8.infoRow, children: [jsx$2(Text, { sx: styles$8.infoTitle, children: "You Spend:" }), jsxs(Text, { sx: styles$8.infoData, children: [isNaN(parseFloat(inputValueToDisplay)) ? 0 : inputValueToDisplay, " ", bond === null || bond === void 0 ? void 0 : bond.token.symbol, " = $", isNaN(inputValueToDisplayUSD) ? '0' : inputValueToDisplayUSD.toFixed(2)] })] }), jsxs(Flex, { sx: styles$8.infoRow, children: [jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$8.infoTitle), { alignItems: 'center' }), children: ["Bonus:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), 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" }) }) })] }), jsxs(Text, { sx: Object.assign(Object.assign({}, styles$8.infoData), { color: 'success' }), children: ["$", isNaN(bonusUSD) ? '0' : bonusUSD.toFixed(2)] })] }), jsxs(Flex, { sx: styles$8.infoRow, children: [jsx$2(Text, { sx: styles$8.infoTitle, children: "You Get:" }), jsxs(Text, { sx: styles$8.infoData, children: [isNaN(youGet) ? 0 : formatNumberSI(youGet, 0), " ", bond === null || bond === void 0 ? void 0 : bond.earnToken.symbol, " = $", isNaN(youGetUSD) ? '0' : youGetUSD.toFixed(2)] })] })] }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: bond === null || bond === void 0 ? void 0 : bond.token, handleValueBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(principalTokenBalance !== null && principalTokenBalance !== void 0 ? principalTokenBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: () => null, chainId: bond === null || bond === void 0 ? void 0 : bond.chainId, enableZap: false, bondPrincipalToken: bond === null || bond === void 0 ? void 0 : bond.token, tokenBalance: principalTokenBalance, selectedTokenPrice: bond.principalTokenPrice, inputDisabled: false }), jsxs(Flex, { sx: {
|
|
79300
79214
|
width: '100%',
|
|
79301
79215
|
background: '#DE62F366',
|
|
79302
79216
|
justifyContent: 'center',
|
|
@@ -79391,30 +79305,6 @@ const ChainTitle = ({ chain, pt, hideTitles, isOpen, }) => {
|
|
|
79391
79305
|
}, children: [NETWORK_LABEL[chain], " Bonds", jsx$2(Flex, { sx: { ml: '7px' }, children: jsx$2(Svg, { icon: "caret", direction: isOpen ? 'down' : 'up', width: 8, color: "textDisabledButton" }) }), ((_a = NETWORK_LABEL[chain]) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes('testnet')) && (jsxs(Flex, { sx: { ml: '15px' }, children: [jsx$2(Text, { sx: { fontSize: '12px', color: '#DE62F3', fontWeight: 700, mr: '7px' }, children: "TESTNET" }), jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Text, { sx: { textTransform: 'none' }, children: "Testnet Bonds let you experiment with fake tokens for free on upcoming chains still in development." }), width: isMobile ? '272px' : '280px', placement: isMobile ? 'bottomRight' : 'bottomLeft', transformTip: isMobile ? 'translate(10%, -5%)' : 'translate(-5%, -5%)', children: jsx$2(Svg, { icon: "questionCircle", width: 14, color: "textDisabledButton" }) })] }))] }));
|
|
79392
79306
|
};
|
|
79393
79307
|
|
|
79394
|
-
const ProgressBar = ({ value, color = 'text' }) => {
|
|
79395
|
-
return (jsx$2(Flex$1, { sx: { width: ['100px', '100px', '100px', '100%'], alignItems: 'center', flexDirection: 'row', mt: '5px' }, children: jsx$2(Box$1, { className: "progressbar-background", children: jsx$2(Box$1, { className: "progressbar-completed", style: {
|
|
79396
|
-
width: `${value <= 3 ? 3 : value}%`,
|
|
79397
|
-
} }) }) }));
|
|
79398
|
-
};
|
|
79399
|
-
|
|
79400
|
-
const styles$8 = {
|
|
79401
|
-
titleText: {
|
|
79402
|
-
opacity: 0.6,
|
|
79403
|
-
fontSize: '12px',
|
|
79404
|
-
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
79405
|
-
fontWeight: 400,
|
|
79406
|
-
},
|
|
79407
|
-
skeleton: {
|
|
79408
|
-
width: ['45px', '45px', '60px'],
|
|
79409
|
-
maxHeight: '18px',
|
|
79410
|
-
minHeight: '18px',
|
|
79411
|
-
}};
|
|
79412
|
-
|
|
79413
|
-
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
79414
|
-
return (jsxs(Flex, { sx: style, children: [jsx$2(Flex, { sx: { alignItems: 'center' }, children: jsx$2(Text, { sx: styles$8.titleText, children: `${title}` }) }), showTooltip ? (jsx$2(Flex, { sx: { alignItems: 'center', width: '100%' }, children: jsx$2(TooltipBubble, { placement: toolTipPlacement, transformTip: toolTipTransform, body: jsx$2(Flex, { sx: { justifyContent: 'center' }, children: toolTip }), width: "250px", children: jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center', width: '127px' }, children: value ? value : jsx$2(Skeleton, { sx: styles$8.skeleton }) }) }) })) : (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center' }, children: value ? value : jsx$2(Skeleton, { sx: styles$8.skeleton }) }))] }));
|
|
79415
|
-
};
|
|
79416
|
-
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
79417
|
-
|
|
79418
79308
|
const BonusContainer = ({ trueBondPrices, minTier, bonus, tooltipPosition = 'bottomRight', }) => {
|
|
79419
79309
|
const isMobile = useIsMobile();
|
|
79420
79310
|
return (jsx$2("div", { className: `discount-column`, children: jsx$2(BonusComponent, { trueBondPrices: trueBondPrices, minTier: minTier, bonus: bonus, tooltipPosition: isMobile ? tooltipPosition : 'bottomLeft' }) }));
|
|
@@ -79492,10 +79382,9 @@ const HotBondCard = ({ bond }) => {
|
|
|
79492
79382
|
};
|
|
79493
79383
|
|
|
79494
79384
|
function useHotBondContracts() {
|
|
79495
|
-
const apiUrl = useURLByEnvironment('apiV2');
|
|
79496
79385
|
return useQuery({
|
|
79497
79386
|
queryKey: [QUERY_KEYS.HOT_BONDS_CONTRACTS],
|
|
79498
|
-
queryFn:
|
|
79387
|
+
queryFn: getHotBondsContracts,
|
|
79499
79388
|
staleTime: Infinity,
|
|
79500
79389
|
refetchOnWindowFocus: false,
|
|
79501
79390
|
refetchOnMount: false,
|
|
@@ -79514,18 +79403,13 @@ function useHotBonds() {
|
|
|
79514
79403
|
retry: 0,
|
|
79515
79404
|
});
|
|
79516
79405
|
}
|
|
79517
|
-
const getHotBondsContracts = (
|
|
79406
|
+
const getHotBondsContracts = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
79518
79407
|
try {
|
|
79519
79408
|
console.log('call!');
|
|
79520
79409
|
const response = yield axios.get(`${STRAPI_URL}/hot-bonds`);
|
|
79521
79410
|
return response.data.map((bond) => bond.BondAddress.toLowerCase());
|
|
79522
79411
|
}
|
|
79523
|
-
catch (
|
|
79524
|
-
reportError({
|
|
79525
|
-
apiUrl,
|
|
79526
|
-
error: e,
|
|
79527
|
-
extraInfo: { type: 'getHotBondsContracts', e },
|
|
79528
|
-
});
|
|
79412
|
+
catch (_a) {
|
|
79529
79413
|
return [];
|
|
79530
79414
|
}
|
|
79531
79415
|
});
|
|
@@ -79620,20 +79504,7 @@ const BondRowsWithTitle = ({ chain, bonds, showHotBonds }) => {
|
|
|
79620
79504
|
}, className: "bonds-card-container", children: [TESTNET_CHAINS.includes(chain) && jsx$2(BannerTestnet, { chainId: chain }), bonds === null || bonds === void 0 ? void 0 : bonds.map((bond, index) => {
|
|
79621
79505
|
var _a, _b, _c, _d, _e;
|
|
79622
79506
|
const bondAddress = (_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) !== null && _a !== void 0 ? _a : (_b = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _b === void 0 ? void 0 : _b[bond === null || bond === void 0 ? void 0 : bond.chainId];
|
|
79623
|
-
const
|
|
79624
|
-
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
79625
|
-
return formatNumberSI(parseFloat(tokensRemaining), 0);
|
|
79626
|
-
};
|
|
79627
|
-
const remainingTokensUsd = (bond) => {
|
|
79628
|
-
const tokensRemaining = 'tokensRemaining' in bond ? bond.tokensRemaining : '0';
|
|
79629
|
-
const payoutTokenPrice = 'payoutTokenPrice' in bond ? bond.payoutTokenPrice : 0;
|
|
79630
|
-
const tokens = new BigNumber$1(tokensRemaining);
|
|
79631
|
-
return tokens.times(payoutTokenPrice);
|
|
79632
|
-
};
|
|
79633
|
-
const remainingTokensString = `${remainingTokensFormat(bond)} ${bond.earnToken.symbol} (${formatDollar({
|
|
79634
|
-
num: remainingTokensUsd(bond).toNumber(),
|
|
79635
|
-
isPrice: true,
|
|
79636
|
-
})})`;
|
|
79507
|
+
const remainingTokensString = getRemainingTokensString(bond);
|
|
79637
79508
|
return (jsx$2(BondRow, { bondAddress: (_c = bond.billAddress) !== null && _c !== void 0 ? _c : (_d = bond.contractAddress) === null || _d === void 0 ? void 0 : _d[bond.chainId], bondChain: bond.chainId, payoutToken: bond.earnToken, tag: (_e = bond.tags) === null || _e === void 0 ? void 0 : _e[0], bondSoldOut: isBondSoldOut(bond), trueBondPrices: bond === null || bond === void 0 ? void 0 : bond.trueBondPrices, minTier: bond === null || bond === void 0 ? void 0 : bond.minTier, vestingTermString: getVestingTermsString(bond), vestingCliffString: getVestingTermsTooltipString(bond), percentageAvailable: remainingPercentage(bond), remainingTokensString: remainingTokensString }, `${bondAddress}-${bond.chainId}-${index}`));
|
|
79638
79509
|
}), showHotBonds && (jsx$2(SwiperProvider, { children: jsx$2(HotBondCards, {}) }))] }, key))] }) }, key));
|
|
79639
79510
|
};
|
|
@@ -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[]
|
|
7
|
+
export declare const getBondsData: (chains: number[], realTimeApiURL: string, tokenPrices?: TokenPrices[], bondList?: BillsConfig[]) => 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: (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: (
|
|
5
|
+
export declare const getHotBondsContracts: () => 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[]
|
|
6
|
+
export declare const getUserBonds: (account: string, bondList: BillsConfig[], chains: number[], tokenPrices: TokenPrices[]) => 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
|
|
7
|
+
export declare const getTokensBalance: (account: string, tokens: ("NATIVE" | Token)[], chainId: number) => 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[]
|
|
19
|
+
export declare const getLaunchBondsPublicData: (preTGEBonds: PreTGEBond[], chains?: number[]) => 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: (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
|
|
33
|
+
export declare const fetchPreTGEUserBonds: (preTGEBonds: PreTGEBondData[], account: 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
|
|
34
|
+
export declare const fetchUserPoints: (account?: string, useTiers?: boolean) => 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: (apiURL: string, chains: number[]) => Promise<TokenPrices[]>;
|
|
11
11
|
export declare function getTokenPricesV3FromPriceGetter(tokensToCall: Record<string, Token>, chain: ChainId): Promise<any>;
|
|
@@ -15,3 +15,4 @@ export declare const remainingPercentage: (bond: BondsData) => number;
|
|
|
15
15
|
export declare const getDiscountColor: (discount?: number) => string;
|
|
16
16
|
export declare const calculateARR: (bond: BondsData | BillsConfig, useTiers: boolean) => string;
|
|
17
17
|
export declare const isBondSupported: (SDKVersion: string, bondVersion: string) => boolean;
|
|
18
|
+
export declare const getRemainingTokensString: (bond: BondsData | BillsConfig) => string;
|
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.66-test.1",
|
|
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.3.
|
|
60
|
+
"@ape.swap/apeswap-lists": "4.3.13",
|
|
61
61
|
"@emotion/react": "11.11.4",
|
|
62
62
|
"bignumber.js": "^9.1.2",
|
|
63
63
|
"chart.js": "4.2.0",
|