@ape.swap/bonds-sdk 4.1.0-test.1 → 4.1.0-test.11
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/hooks/{useMonitorTxHash.d.ts → useMonitorTx.d.ts} +1 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.js +489 -474
- package/dist/state/bonds/useBondNFTData.d.ts +3 -0
- package/dist/state/bonds/useUserBonds.d.ts +1 -1
- package/dist/state/tokenPrices/useTokenPrices.d.ts +1 -1
- package/dist/styles.css +4 -4
- package/dist/types/yourbonds.d.ts +2 -0
- package/dist/utils/displayHelpers.d.ts +2 -0
- package/dist/utils/getBalanceNumber.d.ts +1 -1
- package/dist/views/BuyBond/BuyComponentSolana.d.ts +3 -3
- package/dist/views/YourBonds/components/ProfitCard/ProfitCard.d.ts +6 -0
- package/dist/views/YourBonds/components/UserBondRow/UserBondRowSolana.d.ts +2 -1
- package/dist/views/YourBondsModal/YourBondsModal.d.ts +2 -3
- package/dist/views/YourBondsModal/YourBondsModalSolana.d.ts +4 -4
- package/package.json +5 -5
package/dist/main.js
CHANGED
|
@@ -20598,7 +20598,7 @@ const formatNumberSI = (num, digits = 2) => {
|
|
|
20598
20598
|
if (number > 1e6 && suffix) {
|
|
20599
20599
|
return `${localeFormat(number / suffix.value)} ${suffix.symbol}`;
|
|
20600
20600
|
}
|
|
20601
|
-
if (number >
|
|
20601
|
+
if (number > 100) {
|
|
20602
20602
|
return localeFormat(Math.round(number), 0);
|
|
20603
20603
|
}
|
|
20604
20604
|
if (number > 1) {
|
|
@@ -63179,7 +63179,6 @@ const QUERY_KEYS = {
|
|
|
63179
63179
|
BONDS_LIST: 'ApeBond-SDK-bondsList',
|
|
63180
63180
|
BONDS_LIST_PRE_TGE: 'ApeBond-SDK-bondsListPreTGE',
|
|
63181
63181
|
USER_BONDS: 'ApeBond-SDK-userBonds',
|
|
63182
|
-
BOND_NFT_DATA: 'ApeBond-SDK-bondNFTData',
|
|
63183
63182
|
TOKEN_PRICES: 'ApeBond-SDK-tokenPrices',
|
|
63184
63183
|
HOT_BONDS: 'ApeBond-SDK-hotBonds',
|
|
63185
63184
|
HOT_BONDS_CONTRACTS: 'ApeBond-SDK-hotBondsContracts',
|
|
@@ -63207,7 +63206,7 @@ const stagingUrls = {
|
|
|
63207
63206
|
apiV2: 'https://staging-api.ape.bond',
|
|
63208
63207
|
realTimeApi: 'https://realtime-api-staging.ape.bond',
|
|
63209
63208
|
mainUrl: 'https://staging.ape.bond',
|
|
63210
|
-
priceApi: 'https://price-api.ape.bond/realtime/prices',
|
|
63209
|
+
priceApi: 'https://price-api-staging.ape.bond/realtime/prices',
|
|
63211
63210
|
};
|
|
63212
63211
|
const useSDKConfig = (config) => {
|
|
63213
63212
|
const urls = process.env.NODE_ENV === 'production' ? defaultUrls : stagingUrls;
|
|
@@ -63875,12 +63874,24 @@ const vestingTimeRemainingString = (userBill) => {
|
|
|
63875
63874
|
}
|
|
63876
63875
|
return `${vestingTime.days}d, ${vestingTime.hours}h, ${vestingTime.minutes}m`;
|
|
63877
63876
|
};
|
|
63878
|
-
const
|
|
63877
|
+
const getPercentageVested = (bond) => {
|
|
63878
|
+
var _a;
|
|
63879
|
+
const vestingTerm = parseInt((_a = bond === null || bond === void 0 ? void 0 : bond.vesting) !== null && _a !== void 0 ? _a : '0');
|
|
63880
|
+
const timeLeftForFullyVested = getTimeLeftForFullyVested(bond);
|
|
63881
|
+
if (timeLeftForFullyVested <= 0)
|
|
63882
|
+
return 1;
|
|
63883
|
+
return 100 - ((vestingTerm - timeLeftForFullyVested) / vestingTerm) * 100;
|
|
63884
|
+
};
|
|
63885
|
+
const getTimeLeftForFullyVested = (bond) => {
|
|
63879
63886
|
var _a, _b;
|
|
63880
63887
|
const currentTime = new Date().getTime() / 1000;
|
|
63881
63888
|
const lastBlockTimestamp = parseInt((_a = bond === null || bond === void 0 ? void 0 : bond.lastBlockTimestamp) !== null && _a !== void 0 ? _a : '0');
|
|
63882
63889
|
const vesting = parseInt((_b = bond === null || bond === void 0 ? void 0 : bond.vesting) !== null && _b !== void 0 ? _b : '0');
|
|
63883
|
-
|
|
63890
|
+
return lastBlockTimestamp + vesting - currentTime;
|
|
63891
|
+
};
|
|
63892
|
+
const getPendingVestingString = (bond) => {
|
|
63893
|
+
const timeLeftForFullyVested = getTimeLeftForFullyVested(bond);
|
|
63894
|
+
const vestingTime = getTimePeriods(timeLeftForFullyVested, true);
|
|
63884
63895
|
return `${vestingTime.days}d, ${vestingTime.hours}h, ${vestingTime.minutes}m`;
|
|
63885
63896
|
};
|
|
63886
63897
|
const getVestingTermsString = (bond) => {
|
|
@@ -65129,7 +65140,7 @@ const fetchUserOwnedBillsDataAsync = (chainId, account, bondData, tokenPrices) =
|
|
|
65129
65140
|
});
|
|
65130
65141
|
/* MODIFIED FUNCTION FROM FRONTEND SPECIFICALLY FOR THE SDK */
|
|
65131
65142
|
const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
65132
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
65143
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
65133
65144
|
// Maps all the bills in the list repo to make a call to each of them to get Bills Id, meaning purchased bill ids
|
|
65134
65145
|
const billIdCalls = bonds.map((b) => {
|
|
65135
65146
|
var _a;
|
|
@@ -65161,34 +65172,31 @@ const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices) => __awaiter$
|
|
|
65161
65172
|
for (let i = 0; i < billVersions.length; i++) {
|
|
65162
65173
|
const billPos = i === 0 ? 0 : i * 2;
|
|
65163
65174
|
let bond = billDataCalls[billPos].bond;
|
|
65164
|
-
|
|
65165
|
-
|
|
65166
|
-
|
|
65167
|
-
// tokenPrice.chainId === bond.chainId,
|
|
65168
|
-
// )?.price
|
|
65169
|
-
const payoutTokenPrice = (_b = (_a = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices[bond.chainId]) === null || _a === void 0 ? void 0 : _a.find((tokenPrice) => { var _a, _b, _c, _d; return ((_a = tokenPrice === null || tokenPrice === void 0 ? void 0 : tokenPrice.tokenAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[bond.chainId]) === null || _d === void 0 ? void 0 : _d.toLowerCase()); })) === null || _b === void 0 ? void 0 : _b.price;
|
|
65170
|
-
bond = Object.assign(Object.assign({}, bond), { payoutTokenPrice: payoutTokenPrice === null || payoutTokenPrice === void 0 ? void 0 : payoutTokenPrice.toString() });
|
|
65175
|
+
const principalTokenPrice = (_b = (_a = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices[bond.chainId]) === null || _a === void 0 ? void 0 : _a.find((tokenPrice) => { var _a, _b, _c, _d; return ((_a = tokenPrice.tokenAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[bond.chainId]) === null || _d === void 0 ? void 0 : _d.toLowerCase()); })) === null || _b === void 0 ? void 0 : _b.price;
|
|
65176
|
+
const payoutTokenPrice = (_d = (_c = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices[bond.chainId]) === null || _c === void 0 ? void 0 : _c.find((tokenPrice) => { var _a, _b, _c, _d; return ((_a = tokenPrice === null || tokenPrice === void 0 ? void 0 : tokenPrice.tokenAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[bond.chainId]) === null || _d === void 0 ? void 0 : _d.toLowerCase()); })) === null || _d === void 0 ? void 0 : _d.price;
|
|
65177
|
+
bond = Object.assign(Object.assign({}, bond), { payoutTokenPrice: payoutTokenPrice === null || payoutTokenPrice === void 0 ? void 0 : payoutTokenPrice.toString(), principalTokenPrice: principalTokenPrice === null || principalTokenPrice === void 0 ? void 0 : principalTokenPrice.toString() });
|
|
65171
65178
|
const data = billVersions[i] !== types$1.BillVersion.V1
|
|
65172
65179
|
? {
|
|
65173
65180
|
address: billDataCalls[billPos].address,
|
|
65174
65181
|
id: billDataCalls[billPos].params[0].toString(),
|
|
65175
|
-
payout: new BigNumber$1((
|
|
65176
|
-
.minus((
|
|
65182
|
+
payout: new BigNumber$1((_e = billData[billPos][0]) === null || _e === void 0 ? void 0 : _e.payout.toString())
|
|
65183
|
+
.minus((_f = billData[billPos][0]) === null || _f === void 0 ? void 0 : _f.payoutClaimed.toString())
|
|
65177
65184
|
.toString(),
|
|
65178
|
-
|
|
65179
|
-
|
|
65180
|
-
|
|
65181
|
-
|
|
65182
|
-
|
|
65185
|
+
totalPayout: (_g = billData[billPos][0]) === null || _g === void 0 ? void 0 : _g.payout.toString(),
|
|
65186
|
+
payoutClaimed: (_h = billData[billPos][0]) === null || _h === void 0 ? void 0 : _h.payoutClaimed.toString(),
|
|
65187
|
+
billNftAddress: (_j = bond.billNnftAddress[bond.chainId]) !== null && _j !== void 0 ? _j : '',
|
|
65188
|
+
vesting: (_k = billData[billPos][0]) === null || _k === void 0 ? void 0 : _k.vesting.toString(),
|
|
65189
|
+
lastBlockTimestamp: (_l = billData[billPos][0]) === null || _l === void 0 ? void 0 : _l.lastClaimTimestamp.toString(),
|
|
65190
|
+
truePricePaid: (_m = billData[billPos][0]) === null || _m === void 0 ? void 0 : _m.truePricePaid.toString(),
|
|
65183
65191
|
pendingRewards: billData[billPos + 1][0].toString(),
|
|
65184
65192
|
bond,
|
|
65185
65193
|
}
|
|
65186
65194
|
: {
|
|
65187
65195
|
address: billDataCalls[billPos].address,
|
|
65188
65196
|
id: billDataCalls[billPos].params[0].toString(),
|
|
65189
|
-
payoutClaimed: (
|
|
65197
|
+
payoutClaimed: (_q = (_p = (_o = billData === null || billData === void 0 ? void 0 : billData[billPos]) === null || _o === void 0 ? void 0 : _o[0]) === null || _p === void 0 ? void 0 : _p.payoutClaimed) === null || _q === void 0 ? void 0 : _q.toString(),
|
|
65190
65198
|
payout: billData[billPos][0].toString(),
|
|
65191
|
-
billNftAddress: (
|
|
65199
|
+
billNftAddress: (_r = bond.billNnftAddress[bond.chainId]) !== null && _r !== void 0 ? _r : '',
|
|
65192
65200
|
vesting: billData[billPos][1].toString(),
|
|
65193
65201
|
lastBlockTimestamp: billData[billPos][2].toString(),
|
|
65194
65202
|
truePricePaid: billData[billPos][3].toString(),
|
|
@@ -65201,15 +65209,14 @@ const fetchUserOwnedBills = (chainId, account, bonds, tokenPrices) => __awaiter$
|
|
|
65201
65209
|
});
|
|
65202
65210
|
|
|
65203
65211
|
function useTokenPrices() {
|
|
65204
|
-
var _a;
|
|
65212
|
+
var _a, _b;
|
|
65205
65213
|
const SDKConfig = useSDKConfig();
|
|
65206
65214
|
const priceApi = (_a = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _a === void 0 ? void 0 : _a.priceApi;
|
|
65215
|
+
const apiv2 = (_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _b === void 0 ? void 0 : _b.apiV2;
|
|
65207
65216
|
return useQuery({
|
|
65208
65217
|
queryKey: [QUERY_KEYS.TOKEN_PRICES],
|
|
65209
65218
|
queryFn: () => __awaiter$9(this, void 0, void 0, function* () {
|
|
65210
|
-
|
|
65211
|
-
const prices = yield getTokenPrices(priceApi);
|
|
65212
|
-
console.timeEnd('PriceGetter');
|
|
65219
|
+
const prices = yield getTokenPrices(priceApi, apiv2);
|
|
65213
65220
|
return prices;
|
|
65214
65221
|
}),
|
|
65215
65222
|
refetchInterval: 30000, // 30 sec
|
|
@@ -65217,14 +65224,14 @@ function useTokenPrices() {
|
|
|
65217
65224
|
refetchOnWindowFocus: false,
|
|
65218
65225
|
});
|
|
65219
65226
|
}
|
|
65220
|
-
const getTokenPrices = (priceApi) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
65227
|
+
const getTokenPrices = (priceApi, apiv2) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
65221
65228
|
try {
|
|
65222
65229
|
const response = yield axios.get(`${priceApi}`);
|
|
65223
65230
|
return response.data;
|
|
65224
65231
|
}
|
|
65225
65232
|
catch (error) {
|
|
65226
65233
|
reportError$1({
|
|
65227
|
-
apiUrl:
|
|
65234
|
+
apiUrl: apiv2,
|
|
65228
65235
|
error,
|
|
65229
65236
|
extraInfo: { type: 'getTokenPrices', error },
|
|
65230
65237
|
});
|
|
@@ -65254,7 +65261,7 @@ const BOND_PRICING_DISCRIMINATOR = new Uint8Array([61, 208, 225, 148, 202, 31, 3
|
|
|
65254
65261
|
const BOND_TERM_DISCRIMINATOR = new Uint8Array([45, 207, 18, 171, 171, 222, 242, 107]);
|
|
65255
65262
|
// Instructions discriminators
|
|
65256
65263
|
const DEPOSIT_DISCRIMINATOR = buffer.Buffer.from([242, 35, 198, 137, 82, 225, 242, 182]);
|
|
65257
|
-
const CLAIM_DISCRIMINATOR
|
|
65264
|
+
const CLAIM_DISCRIMINATOR = buffer.Buffer.from([62, 198, 214, 193, 213, 159, 108, 210]);
|
|
65258
65265
|
const CLAIMABLE_PAYOUT_DISCRIMINATOR = buffer.Buffer.from([180, 245, 240, 160, 170, 121, 123, 10]);
|
|
65259
65266
|
buffer.Buffer.from([105, 2, 40, 104, 17, 101, 241, 72]);
|
|
65260
65267
|
// PDA constants
|
|
@@ -65267,11 +65274,11 @@ const FEE_PAYOUT_PDA_PROGRAM = new PublicKey(buffer.Buffer.from([
|
|
|
65267
65274
|
123, 216, 219, 233, 248, 89,
|
|
65268
65275
|
]));
|
|
65269
65276
|
// Common constants
|
|
65270
|
-
const COMMON_CONST_SEED
|
|
65277
|
+
const COMMON_CONST_SEED = buffer.Buffer.from([
|
|
65271
65278
|
6, 221, 246, 225, 215, 101, 161, 147, 217, 203, 225, 70, 206, 235, 121, 172, 28, 180, 133, 237, 95, 91, 55, 145, 58,
|
|
65272
65279
|
140, 245, 133, 126, 255, 0, 169,
|
|
65273
65280
|
]);
|
|
65274
|
-
const COMMON_PDA_PROGRAM
|
|
65281
|
+
const COMMON_PDA_PROGRAM = new PublicKey(buffer.Buffer.from([
|
|
65275
65282
|
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142,
|
|
65276
65283
|
123, 216, 219, 233, 248, 89,
|
|
65277
65284
|
]));
|
|
@@ -65471,11 +65478,12 @@ function getBondPricingAccountSolana(accountAddresses) {
|
|
|
65471
65478
|
|
|
65472
65479
|
function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
|
|
65473
65480
|
return __awaiter$9(this, void 0, void 0, function* () {
|
|
65474
|
-
var _a, _b, _c, _d, _e;
|
|
65481
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
65475
65482
|
if (!user)
|
|
65476
65483
|
return [];
|
|
65477
65484
|
try {
|
|
65478
|
-
console.log('
|
|
65485
|
+
console.log('fetch-SOL-bonds');
|
|
65486
|
+
console.time('fetch-SOL-bonds');
|
|
65479
65487
|
const results = [];
|
|
65480
65488
|
const userBase58 = new PublicKey(user).toBase58();
|
|
65481
65489
|
const connection = new Connection(getRPC(types$1.ChainId.SOL), 'confirmed');
|
|
@@ -65502,7 +65510,8 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
|
|
|
65502
65510
|
const bondIssuancePda = new PublicKey(bond.contractAddress[types$1.ChainId.SOL]);
|
|
65503
65511
|
const userBills = [];
|
|
65504
65512
|
const collection = bond.billNnftAddress[types$1.ChainId.SOL];
|
|
65505
|
-
const
|
|
65513
|
+
const principalTokenPrice = (_c = (_b = (_a = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices[types$1.ChainId.SOL]) === null || _a === void 0 ? void 0 : _a.find) === null || _b === void 0 ? void 0 : _b.call(_a, (t) => { var _a, _b, _c, _d; return ((_a = t === null || t === void 0 ? void 0 : t.tokenAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[types$1.ChainId.SOL]) === null || _d === void 0 ? void 0 : _d.toLowerCase()); })) === null || _c === void 0 ? void 0 : _c.price;
|
|
65514
|
+
const payoutTokenPrice = (_f = (_e = (_d = tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices[types$1.ChainId.SOL]) === null || _d === void 0 ? void 0 : _d.find) === null || _e === void 0 ? void 0 : _e.call(_d, (t) => { var _a, _b, _c, _d; return ((_a = t === null || t === void 0 ? void 0 : t.tokenAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[types$1.ChainId.SOL]) === null || _d === void 0 ? void 0 : _d.toLowerCase()); })) === null || _f === void 0 ? void 0 : _f.price;
|
|
65506
65515
|
const userAssets = allUserAssets.filter((asset) => {
|
|
65507
65516
|
var _a;
|
|
65508
65517
|
return asset.authorities[0].address.toLowerCase() === ((_a = bond.contractAddress[types$1.ChainId.SOL]) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
@@ -65525,9 +65534,12 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
|
|
|
65525
65534
|
continue;
|
|
65526
65535
|
}
|
|
65527
65536
|
const bondAccount = bondAccounts[0];
|
|
65537
|
+
const id = asset.content.metadata.name;
|
|
65538
|
+
const idTrimmed = (_g = id.split('-')[1]) === null || _g === void 0 ? void 0 : _g.trim();
|
|
65528
65539
|
userBills.push({
|
|
65529
65540
|
address: bondPda.toBase58(),
|
|
65530
|
-
id:
|
|
65541
|
+
id: idTrimmed,
|
|
65542
|
+
asset: nftMint.toBase58(),
|
|
65531
65543
|
vesting: bondAccount.vesting.toString(),
|
|
65532
65544
|
payout: (Number(bondAccount.payout) - Number(bondAccount.payoutClaimed)).toString(),
|
|
65533
65545
|
totalPayout: bondAccount.payout.toString(),
|
|
@@ -65535,12 +65547,11 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
|
|
|
65535
65547
|
lastBlockTimestamp: bondAccount.lastClaimTimestamp.toString(),
|
|
65536
65548
|
pendingRewards,
|
|
65537
65549
|
billNftAddress: collection,
|
|
65538
|
-
payoutClaimed:
|
|
65539
|
-
|
|
65540
|
-
bond: Object.assign(Object.assign({}, bond), { payoutTokenPrice }),
|
|
65550
|
+
payoutClaimed: bondAccount.payoutClaimed.toString(),
|
|
65551
|
+
bond: Object.assign(Object.assign({}, bond), { payoutTokenPrice: payoutTokenPrice === null || payoutTokenPrice === void 0 ? void 0 : payoutTokenPrice.toString(), principalTokenPrice: principalTokenPrice === null || principalTokenPrice === void 0 ? void 0 : principalTokenPrice.toString() }),
|
|
65541
65552
|
});
|
|
65542
65553
|
// ULTRA HOT FIX :( until we can figure out a multicall strategy
|
|
65543
|
-
yield new Promise((r) => setTimeout(r,
|
|
65554
|
+
yield new Promise((r) => setTimeout(r, 10));
|
|
65544
65555
|
}
|
|
65545
65556
|
catch (e) {
|
|
65546
65557
|
console.log(e);
|
|
@@ -65552,7 +65563,7 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
|
|
|
65552
65563
|
userOwnedBills: userBills,
|
|
65553
65564
|
});
|
|
65554
65565
|
}
|
|
65555
|
-
console.
|
|
65566
|
+
console.timeEnd('fetch-SOL-bonds');
|
|
65556
65567
|
return results;
|
|
65557
65568
|
}
|
|
65558
65569
|
catch (err) {
|
|
@@ -65622,7 +65633,7 @@ const useSOLAccount = () => {
|
|
|
65622
65633
|
return Object.assign(Object.assign({}, account), { publicKey: solAddress ? solPublicKey : account.publicKey });
|
|
65623
65634
|
};
|
|
65624
65635
|
|
|
65625
|
-
function useUserBonds() {
|
|
65636
|
+
function useUserBonds(dontFetch) {
|
|
65626
65637
|
var _a, _b, _c;
|
|
65627
65638
|
// First fetch the full list of bonds
|
|
65628
65639
|
const { data: bondList } = useBondsList();
|
|
@@ -65637,8 +65648,8 @@ function useUserBonds() {
|
|
|
65637
65648
|
return useQuery({
|
|
65638
65649
|
queryKey: [QUERY_KEYS.USER_BONDS, address, publicKey, (_c = (_b = Object.keys(tokenPrices !== null && tokenPrices !== void 0 ? tokenPrices : {})) === null || _b === void 0 ? void 0 : _b.length) !== null && _c !== void 0 ? _c : null],
|
|
65639
65650
|
queryFn: () => getUserBonds(address, solanaAccount, bondList, chains, tokenPrices, apiUrl),
|
|
65640
|
-
refetchInterval:
|
|
65641
|
-
enabled: !!bondList && !!(address || solanaAccount) && !!tokenPrices,
|
|
65651
|
+
refetchInterval: 120000, // TODO rollback this
|
|
65652
|
+
enabled: !!bondList && !!(address || solanaAccount) && !!tokenPrices && !dontFetch,
|
|
65642
65653
|
refetchOnWindowFocus: false,
|
|
65643
65654
|
refetchOnMount: false,
|
|
65644
65655
|
refetchOnReconnect: false,
|
|
@@ -65680,8 +65691,49 @@ const getUserBonds = (account, solanaAccount, bondList, chains, tokenPrices, api
|
|
|
65680
65691
|
const fulfilledResults = results
|
|
65681
65692
|
.filter((result) => result.status === 'fulfilled')
|
|
65682
65693
|
.map((result) => result.value);
|
|
65694
|
+
const onChainData = fulfilledResults.flat().flatMap((result) => result.userOwnedBills);
|
|
65695
|
+
// Prepare body for batch API call
|
|
65696
|
+
const body = Object.values(onChainData.reduce((acc, data) => {
|
|
65697
|
+
var _a, _b, _c;
|
|
65698
|
+
const contract = ((_a = data === null || data === void 0 ? void 0 : data.bond) === null || _a === void 0 ? void 0 : _a.chainId) === types$1.ChainId.SOL ? data.bond.contractAddress[data.bond.chainId] : data.billNftAddress;
|
|
65699
|
+
const key = `${(_b = data === null || data === void 0 ? void 0 : data.bond) === null || _b === void 0 ? void 0 : _b.chainId}-${contract}`;
|
|
65700
|
+
if (!acc[key]) {
|
|
65701
|
+
acc[key] = {
|
|
65702
|
+
chainId: (_c = data === null || data === void 0 ? void 0 : data.bond) === null || _c === void 0 ? void 0 : _c.chainId,
|
|
65703
|
+
contract: contract,
|
|
65704
|
+
billIds: [],
|
|
65705
|
+
};
|
|
65706
|
+
}
|
|
65707
|
+
acc[key].billIds.push(parseInt(data.id));
|
|
65708
|
+
return acc;
|
|
65709
|
+
}, {}));
|
|
65710
|
+
let response;
|
|
65711
|
+
try {
|
|
65712
|
+
response = yield axios.post(`${apiUrl}/bills/multi-batch`, body);
|
|
65713
|
+
}
|
|
65714
|
+
catch (e) {
|
|
65715
|
+
console.error(e);
|
|
65716
|
+
console.log('multibatch failed, using only on-chain data');
|
|
65717
|
+
console.timeEnd('getUserBonds');
|
|
65718
|
+
return onChainData;
|
|
65719
|
+
}
|
|
65720
|
+
console.log('multibatch success');
|
|
65721
|
+
// Enrich on-chain data with API data
|
|
65722
|
+
const enrichedData = onChainData.map((userBond) => {
|
|
65723
|
+
var _a, _b;
|
|
65724
|
+
const nftDataResponse = (_a = response.data) === null || _a === void 0 ? void 0 : _a.find((nft) => {
|
|
65725
|
+
var _a, _b;
|
|
65726
|
+
const contract = nft.contract.toLowerCase();
|
|
65727
|
+
const chain = nft.chainId;
|
|
65728
|
+
// API uses contractAddress for Solana bonds instead of NFT Address
|
|
65729
|
+
const contractToCompare = chain === types$1.ChainId.SOL ? (_a = userBond.bond) === null || _a === void 0 ? void 0 : _a.contractAddress[types$1.ChainId.SOL] : userBond.billNftAddress;
|
|
65730
|
+
return (contractToCompare === null || contractToCompare === void 0 ? void 0 : contractToCompare.toLowerCase()) === contract && ((_b = userBond.bond) === null || _b === void 0 ? void 0 : _b.chainId) === chain;
|
|
65731
|
+
});
|
|
65732
|
+
const nftData = (_b = nftDataResponse === null || nftDataResponse === void 0 ? void 0 : nftDataResponse.bills) === null || _b === void 0 ? void 0 : _b.find((billApiData) => billApiData.tokenId === parseInt(userBond.id));
|
|
65733
|
+
return Object.assign(Object.assign({}, userBond), { nftData });
|
|
65734
|
+
});
|
|
65683
65735
|
console.timeEnd('getUserBonds');
|
|
65684
|
-
return
|
|
65736
|
+
return enrichedData;
|
|
65685
65737
|
}
|
|
65686
65738
|
catch (e) {
|
|
65687
65739
|
console.error(e);
|
|
@@ -65691,7 +65743,7 @@ const getUserBonds = (account, solanaAccount, bondList, chains, tokenPrices, api
|
|
|
65691
65743
|
extraInfo: { type: 'getUserBonds', bondList, chains, e },
|
|
65692
65744
|
account,
|
|
65693
65745
|
});
|
|
65694
|
-
|
|
65746
|
+
throw new Error('Failed to fetch user bonds');
|
|
65695
65747
|
}
|
|
65696
65748
|
});
|
|
65697
65749
|
|
|
@@ -67872,7 +67924,7 @@ const ClaimAll = () => {
|
|
|
67872
67924
|
|
|
67873
67925
|
const YourBondsMenu = ({ chainFilterOption, setChainFilterOption, filterOptions, filterOption, setFilterOption, setInputValue, inputValue, handleSort, }) => {
|
|
67874
67926
|
const SDKConfig = useSDKConfig();
|
|
67875
|
-
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setInputValue('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsx$2(Flex$1, { sx: { width: '100%', maxWidth: '300px' }, children: jsx$2(Input, { className: "search-input", value: inputValue, onChange: (event) => setInputValue(event.target.value), variant: "search", sx: { fontWeight: 600, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }) }), jsxs("div", { className: "headers-container", sx: { pr: ['0', '0', '0', '20px'] }, children: [jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('claimable'), children: ["CLAIMABLE", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('pending'), children: ["PENDING", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2(Flex$1, { className: "claim-all-button-container", children: SDKConfig.referenceId === 'apebond' && jsx$2(ClaimAll, {}) })] })] })] }));
|
|
67927
|
+
return (jsxs("div", { className: "bonds-menu", children: [jsx$2(BondFilters, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setInputValue('') }), jsxs("div", { className: "table-header-container", children: [jsx$2("div", { className: "search-container", children: jsx$2(Flex$1, { sx: { width: '100%', maxWidth: '300px' }, children: jsx$2(Input, { className: "search-input", value: inputValue, onChange: (event) => setInputValue(event.target.value), variant: "search", sx: { fontWeight: 600, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }) }), jsxs("div", { className: "headers-container", sx: { pr: ['0', '0', '0', '20px'] }, children: [jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', 'none', 'none', 'none', 'flex'], width: '125px' } }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('claimable'), children: ["CLAIMABLE", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('pending'), children: ["PENDING", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs("div", { className: "your-bonds-table-headers", onClick: () => handleSort('terms'), children: ["TERMS", jsx$2(Flex$1, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2(Flex$1, { className: "claim-all-button-container", children: SDKConfig.referenceId === 'apebond' && jsx$2(ClaimAll, {}) })] })] })] }));
|
|
67876
67928
|
};
|
|
67877
67929
|
|
|
67878
67930
|
function useFavoriteTokens() {
|
|
@@ -67991,84 +68043,6 @@ const UserBillTooltipText = {
|
|
|
67991
68043
|
Claimed: 'This is the amount of tokens that you have already claimed.',
|
|
67992
68044
|
};
|
|
67993
68045
|
|
|
67994
|
-
// export const getBillNftData = async (billNftId: string, billNftAddress: string, chainId: number) => {
|
|
67995
|
-
// try {
|
|
67996
|
-
// const response = await axios.get(`${apiV2BaseUrl}/bills/single/${chainId}/${billNftAddress}/${billNftId}`)
|
|
67997
|
-
// const billNftDataResp = await response.data
|
|
67998
|
-
// if (billNftDataResp.statusCode === 500) {
|
|
67999
|
-
// return null
|
|
68000
|
-
// }
|
|
68001
|
-
// return billNftDataResp
|
|
68002
|
-
// } catch (e) {
|
|
68003
|
-
// console.error(e)
|
|
68004
|
-
// return null
|
|
68005
|
-
// }
|
|
68006
|
-
// }
|
|
68007
|
-
/**
|
|
68008
|
-
* Retrieves batch data for a list of bill NFT IDs from the API.
|
|
68009
|
-
* @param apiV2URL - prod or staging url to get NFT data from.
|
|
68010
|
-
* @param billNftIds - An array of bill NFT IDs to retrieve data for.
|
|
68011
|
-
* @param billNftAddress - The address of the bill NFT contract.
|
|
68012
|
-
* @param chainId - The ID of the blockchain network to retrieve data from.
|
|
68013
|
-
* @returns A Promise that resolves to the batch data for the specified bill NFT IDs, or null if an error occurs.
|
|
68014
|
-
*/
|
|
68015
|
-
const getBillNftBatchData = (apiV2URL, billNftIds, billNftAddress, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
68016
|
-
try {
|
|
68017
|
-
// If no bill NFT IDs are provided, return null
|
|
68018
|
-
if (!billNftIds || billNftIds.length === 0) {
|
|
68019
|
-
return null;
|
|
68020
|
-
}
|
|
68021
|
-
// Make a GET request to the API to retrieve the batch data for the specified bill NFT IDs
|
|
68022
|
-
const response = yield axios.get(`${apiV2URL}/bills/batch/${chainId}/${billNftAddress}/?billIds[]=${billNftIds.join('&billIds[]=')}`, { timeout: 3000 });
|
|
68023
|
-
// If the response status code is 500, return null
|
|
68024
|
-
const billNftDataResp = yield response.data;
|
|
68025
|
-
if (billNftDataResp.statusCode === 500) {
|
|
68026
|
-
return null;
|
|
68027
|
-
}
|
|
68028
|
-
// Return the batch data for the specified bill NFT IDs
|
|
68029
|
-
return billNftDataResp;
|
|
68030
|
-
}
|
|
68031
|
-
catch (e) {
|
|
68032
|
-
console.error(e);
|
|
68033
|
-
reportError$1({
|
|
68034
|
-
apiUrl: apiV2URL,
|
|
68035
|
-
error: e,
|
|
68036
|
-
extraInfo: { type: 'getBillNftBatchData', billNftIds, billNftAddress, e },
|
|
68037
|
-
chainId,
|
|
68038
|
-
});
|
|
68039
|
-
// If an error occurs, return null
|
|
68040
|
-
return null;
|
|
68041
|
-
}
|
|
68042
|
-
});
|
|
68043
|
-
|
|
68044
|
-
function useBondNFTData(id, billNftAddress, chainId) {
|
|
68045
|
-
const apiV2URL = useURLByEnvironment('apiV2');
|
|
68046
|
-
return useQuery({
|
|
68047
|
-
queryKey: [QUERY_KEYS.BOND_NFT_DATA, id, billNftAddress, chainId],
|
|
68048
|
-
queryFn: () => getBondNFTData(apiV2URL, id, billNftAddress, chainId),
|
|
68049
|
-
refetchOnWindowFocus: false,
|
|
68050
|
-
enabled: !!id && !!billNftAddress && !!chainId,
|
|
68051
|
-
retry: 2,
|
|
68052
|
-
});
|
|
68053
|
-
}
|
|
68054
|
-
const getBondNFTData = (apiV2URL, id, billNftAddress, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
68055
|
-
var _a;
|
|
68056
|
-
try {
|
|
68057
|
-
const billNFTData = yield getBillNftBatchData(apiV2URL, [id], billNftAddress, chainId);
|
|
68058
|
-
return (_a = billNFTData === null || billNFTData === void 0 ? void 0 : billNFTData[0]) !== null && _a !== void 0 ? _a : null;
|
|
68059
|
-
}
|
|
68060
|
-
catch (e) {
|
|
68061
|
-
console.error(e);
|
|
68062
|
-
reportError$1({
|
|
68063
|
-
apiUrl: apiV2URL,
|
|
68064
|
-
error: e,
|
|
68065
|
-
extraInfo: { type: 'getBondNFTData', billNftAddress, e },
|
|
68066
|
-
chainId,
|
|
68067
|
-
});
|
|
68068
|
-
throw e;
|
|
68069
|
-
}
|
|
68070
|
-
});
|
|
68071
|
-
|
|
68072
68046
|
var BOND_NFT_ABI = [
|
|
68073
68047
|
{
|
|
68074
68048
|
anonymous: false,
|
|
@@ -69026,7 +69000,7 @@ var BOND_NFT_ABI = [
|
|
|
69026
69000
|
}
|
|
69027
69001
|
];
|
|
69028
69002
|
|
|
69029
|
-
const
|
|
69003
|
+
const useMonitorTx = (txHash, chainId) => {
|
|
69030
69004
|
const { addToastError, addToastSuccess } = usePopups();
|
|
69031
69005
|
const transactionReceipt = useWaitForTransactionReceipt({
|
|
69032
69006
|
confirmations: 0,
|
|
@@ -69057,7 +69031,7 @@ const TransferAction$1 = ({ userBill, toAddress, disabled, }) => {
|
|
|
69057
69031
|
const [transferTxHash, setTransferTxHash] = useState(null);
|
|
69058
69032
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
69059
69033
|
const { writeContractAsync } = useWriteContract();
|
|
69060
|
-
const { isLoading, isSuccess: isConfirmed } =
|
|
69034
|
+
const { isLoading, isSuccess: isConfirmed } = useMonitorTx(transferTxHash, (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
|
|
69061
69035
|
const { addToastError } = usePopups();
|
|
69062
69036
|
const load = loadingTx || (isLoading && !isConfirmed);
|
|
69063
69037
|
const handleTransfer = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
@@ -69125,9 +69099,9 @@ const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
|
69125
69099
|
setLoadingTx(true);
|
|
69126
69100
|
const connection = new Connection(getRPC(types$1.ChainId.SOL));
|
|
69127
69101
|
// MPL Core program ID
|
|
69128
|
-
if (!(userBill === null || userBill === void 0 ? void 0 : userBill.id) || !toAddress || !userBill)
|
|
69102
|
+
if (!(userBill === null || userBill === void 0 ? void 0 : userBill.id) || !toAddress || !userBill || !(userBill === null || userBill === void 0 ? void 0 : userBill.asset))
|
|
69129
69103
|
return;
|
|
69130
|
-
const asset = new PublicKey(userBill === null || userBill === void 0 ? void 0 : userBill.
|
|
69104
|
+
const asset = new PublicKey(userBill === null || userBill === void 0 ? void 0 : userBill.asset);
|
|
69131
69105
|
const newOwner = new PublicKey(toAddress);
|
|
69132
69106
|
const collection = new PublicKey(userBill.billNftAddress);
|
|
69133
69107
|
// Create instruction data with discriminator (14) + null compression_proof
|
|
@@ -69179,17 +69153,19 @@ const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
|
69179
69153
|
};
|
|
69180
69154
|
|
|
69181
69155
|
const TransferModal = ({ onDismiss, userBill }) => {
|
|
69182
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
69156
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
69183
69157
|
// State
|
|
69184
69158
|
const [confirmSend, setConfirmSend] = useState(false);
|
|
69185
69159
|
const [toAddress, setToAddress] = useState('');
|
|
69186
69160
|
// Data
|
|
69187
69161
|
const bond = userBill === null || userBill === void 0 ? void 0 : userBill.bond;
|
|
69188
69162
|
const chainId = bond === null || bond === void 0 ? void 0 : bond.chainId;
|
|
69189
|
-
const { lpToken, earnToken } = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) !== null && _a !== void 0 ? _a : {};
|
|
69190
69163
|
const pending = chainId &&
|
|
69191
|
-
((_e = getBalanceNumber(new BigNumber$1((
|
|
69192
|
-
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond",
|
|
69164
|
+
((_e = getBalanceNumber(new BigNumber$1((_a = userBill === null || userBill === void 0 ? void 0 : userBill.payout) !== null && _a !== void 0 ? _a : 0), (_d = (_c = (_b = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _b === void 0 ? void 0 : _b.decimals) === null || _c === void 0 ? void 0 : _c[chainId]) !== null && _d !== void 0 ? _d : 18)) === null || _e === void 0 ? void 0 : _e.toFixed(4));
|
|
69165
|
+
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond", children: [jsx$2(Flex, { sx: { mt: '20px' }, children: jsx$2(Text, { sx: { fontWeight: 700 }, children: " Transferring: " }) }), jsxs(Flex, { sx: { flexDirection: 'column', alignItems: 'center', mt: '30px', mr: '10px' }, children: [jsxs(Text, { sx: { fontWeight: 700, fontSize: '25px' }, children: [(_f = bond === null || bond === void 0 ? void 0 : bond.earnToken) === null || _f === void 0 ? void 0 : _f.symbol, " Bond - ID # ", userBill === null || userBill === void 0 ? void 0 : userBill.id] }), jsxs(Flex, { sx: { mt: '5px' }, children: [jsxs(Flex, { sx: { flexDirection: 'column', mr: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Vesting time" }), getTimeLeftForFullyVested(userBill) > 0 ? `Ends in ${getPendingVestingString(userBill)}` : `Fully Vested`] }), jsxs(Flex, { sx: { flexDirection: 'column', ml: '20px' }, children: [jsx$2(Text, { sx: { textAlign: 'center', width: '100%', fontSize: '12px', opacity: 0.6 }, children: "Pending" }), jsxs(Flex, { children: [jsx$2(TokenImage, { symbol: (_h = (_g = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _g === void 0 ? void 0 : _g.showcaseTokenName) !== null && _h !== void 0 ? _h : (_k = (_j = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _j === void 0 ? void 0 : _j.earnToken) === null || _k === void 0 ? void 0 : _k.symbol, size: 20, chain: (_l = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _l === void 0 ? void 0 : _l.chainId }), jsx$2(Text, { sx: { fontWeight: 700, ml: '5px' }, children: pending })] })] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', mt: '30px' }, children: [jsx$2(Text, { sx: { fontWeight: 700 }, children: "Receiving Address:" }), jsx$2(Input, { mt: "10px", size: "lg", placeholder: 'Paste the address here', value: toAddress, onChange: (e) => setToAddress(e.target.value), style: { width: '345px', border: 'none' } })] }), jsx$2(Flex, { sx: { mt: '15px' }, children: jsxs(Text, { sx: { lineHeight: '18px', fontSize: '12px', color: 'rgba(223, 65, 65, 1)' }, children: [jsx$2(Text, { sx: { display: 'block', width: '100%', fontWeight: 700, fontSize: '13px', color: 'rgba(223, 65, 65, 1)' }, children: "WARNING" }), "When transfering the NFT all pending rewards will also be transfered to the receiver address."] }) }), jsxs(Flex, { onClick: () => setConfirmSend(!confirmSend), sx: { mt: '20px', cursor: 'pointer', alignItems: 'center' }, children: [jsx$2(Checkbox, { checked: confirmSend, onChange: (event) => {
|
|
69166
|
+
setConfirmSend(!confirmSend);
|
|
69167
|
+
event.stopPropagation();
|
|
69168
|
+
} }), jsx$2(Text, { sx: { ml: '10px', fontSize: '12px', fontWeight: 500, lineHeight: '18px' }, children: "I understand the new wallet gains ownership of all unclaimed assets." })] }), jsx$2(Flex, { sx: { justifyContent: 'center', mt: '15px' }, children: chainId === types$1.ChainId.SOL ? (jsx$2(TransferAction, { userBill: userBill, toAddress: toAddress, disabled: !confirmSend || !toAddress })) : (jsx$2(TransferAction$1, { userBill: userBill, toAddress: toAddress, disabled: !confirmSend || !toAddress })) })] }));
|
|
69193
69169
|
};
|
|
69194
69170
|
var TransferBondModal = React__default.memo(TransferModal);
|
|
69195
69171
|
|
|
@@ -74942,29 +74918,30 @@ const SafeHTMLComponent = ({ html }) => {
|
|
|
74942
74918
|
return jsx$2("div", { dangerouslySetInnerHTML: { __html: sanitizedHTML } });
|
|
74943
74919
|
};
|
|
74944
74920
|
|
|
74945
|
-
const YourBondsModal = ({
|
|
74946
|
-
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, _8, _9, _10, _11, _12
|
|
74921
|
+
const YourBondsModal = ({ billId, onDismiss }) => {
|
|
74922
|
+
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, _8, _9, _10, _11, _12;
|
|
74923
|
+
const { data: userBonds, refetch: refetchUserBonds } = useUserBonds();
|
|
74924
|
+
const userBill = userBonds === null || userBonds === void 0 ? void 0 : userBonds.find((bill) => bill.id === billId);
|
|
74947
74925
|
// Hooks
|
|
74948
74926
|
const SDKConfig = useSDKConfig();
|
|
74949
74927
|
const chainId = useChainId();
|
|
74950
|
-
const { data: userBonds, refetch: refetchUserBonds } = useUserBonds();
|
|
74951
|
-
const userBill = useMemo(() => userBonds === null || userBonds === void 0 ? void 0 : userBonds.find((b) => b.address.toLowerCase() === (bill === null || bill === void 0 ? void 0 : bill.address.toLowerCase()) && b.id === bill.id), [userBonds, bill]);
|
|
74952
74928
|
const { switchChain } = useSwitchChain();
|
|
74953
|
-
const { data: bondNFTData, refetch } = 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);
|
|
74954
74929
|
const { writeContractAsync } = useWriteContract();
|
|
74955
74930
|
const { address: account } = useEVMAccount();
|
|
74931
|
+
const { addToastError } = usePopups();
|
|
74956
74932
|
// State
|
|
74957
74933
|
const [imgLoaded, setImgLoaded] = useState(false);
|
|
74958
74934
|
const [isOpenTraits, setIsOpenTraits] = useState(false);
|
|
74959
74935
|
const [claimTxHash, setClaimTxHash] = useState(null);
|
|
74960
74936
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
74961
|
-
const { isLoading, isSuccess: isConfirmed } =
|
|
74962
|
-
const { addToastError } = usePopups();
|
|
74937
|
+
const { isLoading, isSuccess: isConfirmed } = useMonitorTx(claimTxHash, (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
|
|
74963
74938
|
const load = loadingTx || (isLoading && !isConfirmed);
|
|
74939
|
+
// Static Data
|
|
74940
|
+
const bondNFTData = userBill === null || userBill === void 0 ? void 0 : userBill.nftData;
|
|
74964
74941
|
// Cliff display info:
|
|
74965
|
-
const vestingCliff = (
|
|
74942
|
+
const vestingCliff = (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.vestingCliff;
|
|
74966
74943
|
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
74967
|
-
const lastBlockTimestamp = parseInt((
|
|
74944
|
+
const lastBlockTimestamp = parseInt((_c = userBill === null || userBill === void 0 ? void 0 : userBill.lastBlockTimestamp) !== null && _c !== void 0 ? _c : '0');
|
|
74968
74945
|
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
74969
74946
|
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
74970
74947
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
@@ -75009,7 +74986,7 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
75009
74986
|
}
|
|
75010
74987
|
});
|
|
75011
74988
|
const BILL_ATTRIBUTES = ['The Legend', 'The Location', 'The Moment', 'The Trend', 'The Innovation'];
|
|
75012
|
-
const attributes = (
|
|
74989
|
+
const attributes = (_d = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.attributes) === null || _d === void 0 ? void 0 : _d.filter((attrib) => BILL_ATTRIBUTES.includes(attrib.trait_type));
|
|
75013
74990
|
const handleImageLoad = () => {
|
|
75014
74991
|
setImgLoaded(true);
|
|
75015
74992
|
};
|
|
@@ -75017,7 +74994,6 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
75017
74994
|
useEffect(() => {
|
|
75018
74995
|
if (isConfirmed) {
|
|
75019
74996
|
refetchUserBonds();
|
|
75020
|
-
refetch();
|
|
75021
74997
|
}
|
|
75022
74998
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
75023
74999
|
}, [isConfirmed]);
|
|
@@ -75028,11 +75004,11 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
75028
75004
|
justifyContent: 'center',
|
|
75029
75005
|
alignItems: 'center',
|
|
75030
75006
|
zIndex: 1,
|
|
75031
|
-
}, children: jsx$2(Spinner, { width: 100 }) }))] }), jsxs(Flex$1, { className: "yourbondsmodal yourbondinfo", children: [jsxs(Flex$1, { className: "yourbondinfo title-container", children: [jsx$2(Flex$1, { className: "title-container bondicon", children: userBill && (jsx$2(TokenImage, { symbol: (
|
|
75007
|
+
}, children: jsx$2(Spinner, { width: 100 }) }))] }), jsxs(Flex$1, { className: "yourbondsmodal yourbondinfo", children: [jsxs(Flex$1, { className: "yourbondinfo title-container", children: [jsx$2(Flex$1, { className: "title-container bondicon", children: userBill && (jsx$2(TokenImage, { symbol: (_f = (_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.showcaseTokenName) !== null && _f !== void 0 ? _f : (_h = (_g = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _g === void 0 ? void 0 : _g.earnToken) === null || _h === void 0 ? void 0 : _h.symbol, size: 40, chain: (_j = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _j === void 0 ? void 0 : _j.chainId })) }), jsx$2(Flex$1, { className: "title-container tokenname", children: (_l = (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.showcaseTokenName) !== null && _l !== void 0 ? _l : (_m = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _m === void 0 ? void 0 : _m.earnToken.symbol }), jsx$2(Flex$1, { className: "title-container tokentags", children: (_p = (_o = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _o === void 0 ? void 0 : _o.tags) === null || _p === void 0 ? void 0 : _p.slice(0, 1).map((tag) => {
|
|
75032
75008
|
return (jsx$2(Flex$1, { sx: { marginRight: '10px' }, children: jsx$2(ListTag, { text: tag === null || tag === void 0 ? void 0 : tag.toUpperCase() }) }, tag));
|
|
75033
75009
|
}) }), jsxs(Text, { sx: { color: 'text', opacity: '0.6', fontSize: ['12px', '12px', '12px', '16px'] }, children: ["#", userBill === null || userBill === void 0 ? void 0 : userBill.id] })] }), jsxs(Flex$1, { className: "yourbondinfo blocks-container", children: [jsxs(Flex$1, { className: "attributes-container", children: [jsxs(Flex$1, { className: "attributes-header", sx: {
|
|
75034
75010
|
borderRadius: `${isOpenTraits ? '6px 6px 0px 0px' : 'normal'}`,
|
|
75035
|
-
}, onClick: () => setIsOpenTraits(!isOpenTraits), children: [jsxs(Flex$1, { sx: { gap: '10px', alignItems: 'center' }, children: [jsx$2(Svg, { icon: "tag", direction: "down" }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'text', opacity: '0.6' }, children: "Traits" })] }), jsx$2(Svg, { icon: "caret", direction: isOpenTraits ? 'up' : 'down' })] }), ((
|
|
75011
|
+
}, onClick: () => setIsOpenTraits(!isOpenTraits), children: [jsxs(Flex$1, { sx: { gap: '10px', alignItems: 'center' }, children: [jsx$2(Svg, { icon: "tag", direction: "down" }), jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, color: 'text', opacity: '0.6' }, children: "Traits" })] }), jsx$2(Svg, { icon: "caret", direction: isOpenTraits ? 'up' : 'down' })] }), ((_q = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _q === void 0 ? void 0 : _q.billType) === 'staking' && (jsxs(Flex$1, { sx: {
|
|
75036
75012
|
p: '5px 10px',
|
|
75037
75013
|
width: '100%',
|
|
75038
75014
|
background: '#8E568F',
|
|
@@ -75046,28 +75022,28 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
75046
75022
|
? attributes.map((a) => (jsxs(Flex$1, { sx: { background: 'white4', width: '100%', padding: '2px 8px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: a === null || a === void 0 ? void 0 : a.trait_type }), jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: a === null || a === void 0 ? void 0 : a.value })] }, a.value)))
|
|
75047
75023
|
: BILL_ATTRIBUTES.map((attrib) => {
|
|
75048
75024
|
return (jsxs(Flex$1, { sx: { background: 'white4', width: '100%', padding: '2px 8px' }, children: [jsx$2(Text, { sx: { fontSize: '10px', fontWeight: 500 }, children: attrib }), jsx$2(Skeleton, { width: "150px" })] }, attrib));
|
|
75049
|
-
}) }) })) })] }), ((
|
|
75025
|
+
}) }) })) })] }), ((_r = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _r === void 0 ? void 0 : _r.deposit) && (jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "You Spent" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.YouSpent }), width: "270px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsx$2(Flex$1, { className: "yourbondinfo-block info", children: jsx$2(Flex$1, { className: "block-info text", children: jsxs(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: ["$", (_s = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _s === void 0 ? void 0 : _s.dollarValue.toFixed(2)] }) }) })] })), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Fully Vested" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.FullyVested }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon" }), jsx$2(Flex$1, { className: "block-info text", children: jsxs(Flex$1, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: [vestingTimeRemainingString(userBill), isPendingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex$1, { children: ["Bond will be claimable in", ' ', `${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`, "."] }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex$1, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }) })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-pending", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Pending" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Pending }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_u = (_t = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _t === void 0 ? void 0 : _t.showcaseTokenName) !== null && _u !== void 0 ? _u : (_w = (_v = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _v === void 0 ? void 0 : _v.earnToken) === null || _w === void 0 ? void 0 : _w.symbol, size: 25, chain: (_x = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _x === void 0 ? void 0 : _x.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(pending(userBill), 4) }), jsx$2(Text, { sx: {
|
|
75050
75026
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75051
75027
|
fontWeight: [500, 500, 500, 400],
|
|
75052
75028
|
paddingLeft: '10px',
|
|
75053
|
-
}, children: `($${pendingUSD(userBill).toFixed(2)})` })] })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-claimable", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Claimable" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Claimable }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (
|
|
75029
|
+
}, children: `($${pendingUSD(userBill).toFixed(2)})` })] })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-claimable", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Claimable" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Claimable }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_z = (_y = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _y === void 0 ? void 0 : _y.showcaseTokenName) !== null && _z !== void 0 ? _z : (_1 = (_0 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _0 === void 0 ? void 0 : _0.earnToken) === null || _1 === void 0 ? void 0 : _1.symbol, size: 25, chain: (_2 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _2 === void 0 ? void 0 : _2.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(claimable(userBill), 4) }), jsx$2(Text, { sx: {
|
|
75054
75030
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75055
75031
|
fontWeight: [500, 500, 500, 400],
|
|
75056
75032
|
paddingLeft: '10px',
|
|
75057
|
-
}, children: `($${claimableUSD(userBill).toFixed(2)})` })] })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Claimed" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Claimed }), width: "250px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (
|
|
75033
|
+
}, children: `($${claimableUSD(userBill).toFixed(2)})` })] })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Claimed" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Claimed }), width: "250px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_4 = (_3 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _3 === void 0 ? void 0 : _3.showcaseTokenName) !== null && _4 !== void 0 ? _4 : (_6 = (_5 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _5 === void 0 ? void 0 : _5.earnToken) === null || _6 === void 0 ? void 0 : _6.symbol, size: 25, chain: (_7 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _7 === void 0 ? void 0 : _7.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(claimed(userBill), 4) }), jsx$2(Text, { sx: {
|
|
75058
75034
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75059
75035
|
fontWeight: [500, 500, 500, 400],
|
|
75060
75036
|
paddingLeft: '10px',
|
|
75061
|
-
}, children: `($${claimedUSD(userBill).toFixed(2)})` })] })] })] })] }), ((
|
|
75037
|
+
}, children: `($${claimedUSD(userBill).toFixed(2)})` })] })] })] })] }), ((_8 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _8 === void 0 ? void 0 : _8.warningCard) && (jsx$2(Flex$1, { sx: {
|
|
75062
75038
|
width: '100%',
|
|
75063
75039
|
background: '#DE62F366',
|
|
75064
75040
|
justifyContent: 'center',
|
|
75065
75041
|
borderRadius: 'normal',
|
|
75066
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (
|
|
75042
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (_9 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _9 === void 0 ? void 0 : _9.warningCard }) }) })), jsxs(Flex$1, { className: "yourbondinfo button-container", children: [jsx$2(Flex$1, { className: "button-container claim", children: userBill && !!((_10 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _10 === void 0 ? void 0 : _10.chainId) && chainId !== ((_11 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _11 === void 0 ? void 0 : _11.chainId) ? (jsxs(Button, { className: "switch-button", disabled: claimable(userBill) === 0 || load, onClick: (event) => {
|
|
75067
75043
|
var _a;
|
|
75068
75044
|
event.stopPropagation();
|
|
75069
75045
|
switchChain({ chainId: (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.chainId });
|
|
75070
|
-
}, children: ["Switch to ", NETWORK_LABEL[(
|
|
75046
|
+
}, children: ["Switch to ", NETWORK_LABEL[(_12 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _12 === void 0 ? void 0 : _12.chainId]] })) : (jsx$2(Button, { className: "claim-button", disabled: claimable(userBill) === 0 || load || !userBill || isPendingCliff, load: load, onClick: (event) => {
|
|
75071
75047
|
event.stopPropagation();
|
|
75072
75048
|
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
75073
75049
|
}, children: isPendingCliff
|
|
@@ -75158,8 +75134,54 @@ const BondInfoTooltip = ({ earnTokenContract, earnTokenSymbol, bondContract, pro
|
|
|
75158
75134
|
return (jsxs(Flex, { sx: { flexDirection: 'column', flexWrap: 'wrap' }, children: [jsx$2(ButtonsRow, { twitter: twitter, projectLink: projectLink, bubble: earnTokenContract, audit: audit, chain: chain }), (config === null || config === void 0 ? void 0 : config.referenceId) === 'apebond' && !isSoldOut && billType !== 'fcfs' && chain !== types$1.ChainId.SOL && (jsx$2(Flex, { sx: { width: '100%', my: '5px', justifyContent: 'center', position: 'relative', height: '25px' }, children: jsx$2(ExpandedViewButton, { handleNavigation: handleProjectViewNavigation, rightPos: '-5px' }) })), jsx$2(Flex, { sx: { justifyContent: 'center' }, children: jsxs(Flex, { sx: { width: '144px', flexDirection: 'column' }, children: [jsx$2(Flex, { sx: styles$a.linkRow, children: tokenLink && (jsxs(Link, { href: tokenLink, sx: styles$a.link, target: "_blank", children: ["View Token Contract", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) }), jsx$2(Flex, { sx: styles$a.linkRow, children: bondLink && (jsxs(Link, { href: bondLink, sx: styles$a.link, target: "_blank", children: ["View Bond Contract", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) }), jsx$2(Flex, { sx: styles$a.linkRow, children: billType !== 'fcfs' && chain !== types$1.ChainId.SOL && (jsxs(Link, { href: bondDashboard, sx: styles$a.link, target: "_blank", children: ["View Bond Insights", jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] })) })] }) })] }));
|
|
75159
75135
|
};
|
|
75160
75136
|
|
|
75137
|
+
const ProfitCard = ({ userBond }) => {
|
|
75138
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
75139
|
+
const totalPayout = getBalanceNumber((_a = userBond === null || userBond === void 0 ? void 0 : userBond.totalPayout) !== null && _a !== void 0 ? _a : '0', (_e = (_c = (_b = userBond === null || userBond === void 0 ? void 0 : userBond.bond) === null || _b === void 0 ? void 0 : _b.earnToken) === null || _c === void 0 ? void 0 : _c.decimals[(_d = userBond.bond) === null || _d === void 0 ? void 0 : _d.chainId]) !== null && _e !== void 0 ? _e : 18);
|
|
75140
|
+
const payoutTokenPrice = (_g = (_f = userBond === null || userBond === void 0 ? void 0 : userBond.bond) === null || _f === void 0 ? void 0 : _f.payoutTokenPrice) !== null && _g !== void 0 ? _g : '0';
|
|
75141
|
+
const totalPayoutUSD = totalPayout * parseFloat(payoutTokenPrice);
|
|
75142
|
+
const depositAmountUSD = (_k = (_j = (_h = userBond === null || userBond === void 0 ? void 0 : userBond.nftData) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.dollarValue) !== null && _k !== void 0 ? _k : 0;
|
|
75143
|
+
const profit = !depositAmountUSD ? 0 : totalPayoutUSD - depositAmountUSD;
|
|
75144
|
+
return (jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', 'none', 'none', 'none', 'flex'], width: '125px' }, children: profit > 0.01 ? (jsxs(Flex$1, { sx: {
|
|
75145
|
+
border: '1px solid rgb(56, 166, 17, 0.20)',
|
|
75146
|
+
p: '2px 6px',
|
|
75147
|
+
color: 'success',
|
|
75148
|
+
borderRadius: '5px',
|
|
75149
|
+
background: '#38A6110D',
|
|
75150
|
+
fontWeight: 700,
|
|
75151
|
+
fontSize: '14px',
|
|
75152
|
+
width: '100%',
|
|
75153
|
+
justifyContent: 'center',
|
|
75154
|
+
// I want a background with 5% opacity of this color
|
|
75155
|
+
}, children: ["+$", formatNumberSI(profit, profit > 100 ? 0 : 2), " Profit!"] })) : (jsx$2(Flex$1, { sx: { width: '125px' } })) }));
|
|
75156
|
+
};
|
|
75157
|
+
|
|
75158
|
+
const styles$9 = {
|
|
75159
|
+
titleText: {
|
|
75160
|
+
opacity: 0.6,
|
|
75161
|
+
fontSize: '12px',
|
|
75162
|
+
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
75163
|
+
fontWeight: 400,
|
|
75164
|
+
},
|
|
75165
|
+
skeleton: {
|
|
75166
|
+
width: ['45px', '45px', '60px'],
|
|
75167
|
+
maxHeight: '18px',
|
|
75168
|
+
minHeight: '18px',
|
|
75169
|
+
}};
|
|
75170
|
+
|
|
75171
|
+
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
75172
|
+
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 }) }))] }));
|
|
75173
|
+
};
|
|
75174
|
+
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
75175
|
+
|
|
75176
|
+
const ProgressBar = ({ value }) => {
|
|
75177
|
+
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: {
|
|
75178
|
+
width: `${value <= 3 ? 3 : value}%`,
|
|
75179
|
+
} }) }) }));
|
|
75180
|
+
};
|
|
75181
|
+
|
|
75161
75182
|
const UserBondRow = ({ bill }) => {
|
|
75162
75183
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
75184
|
+
// Hooks
|
|
75163
75185
|
const userChainId = useChainId();
|
|
75164
75186
|
const SDKConfig = useSDKConfig();
|
|
75165
75187
|
const { address: account } = useEVMAccount();
|
|
@@ -75167,11 +75189,12 @@ const UserBondRow = ({ bill }) => {
|
|
|
75167
75189
|
const { writeContractAsync } = useWriteContract();
|
|
75168
75190
|
const { addToastError } = usePopups();
|
|
75169
75191
|
const { refetch: refetchUserBonds } = useUserBonds();
|
|
75192
|
+
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModal, { billId: bill.id }));
|
|
75193
|
+
// State
|
|
75170
75194
|
const [claimTxHash, setClaimTxHash] = useState(null);
|
|
75171
|
-
const { isLoading: isConfirming, isSuccess: isConfirmed } =
|
|
75195
|
+
const { isLoading: isConfirming, isSuccess: isConfirmed } = useMonitorTx(claimTxHash, (_a = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _a === void 0 ? void 0 : _a.chainId);
|
|
75172
75196
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
75173
75197
|
const load = loadingTx || (isConfirming && !isConfirmed);
|
|
75174
|
-
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModal, { bill: bill }));
|
|
75175
75198
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
75176
75199
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
75177
75200
|
const address = billAddress;
|
|
@@ -75226,9 +75249,17 @@ const UserBondRow = ({ bill }) => {
|
|
|
75226
75249
|
}
|
|
75227
75250
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
75228
75251
|
}, [isConfirmed]);
|
|
75229
|
-
return (jsxs("div", { className: "your-bonds", onClick: onOpenPurchasedBond, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: (_g = (_f = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _f === void 0 ? void 0 : _f.earnToken) === null || _g === void 0 ? void 0 : _g.symbol, chain: (_h = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _h === void 0 ? void 0 : _h.chainId, tag: (_k = (_j = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _j === void 0 ? void 0 : _j.tags) === null || _k === void 0 ? void 0 : _k[0], vestEnds: `Ends in ${getPendingVestingString(bill)}`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: ((_l = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _l === void 0 ? void 0 : _l.earnToken.address[bill === null || bill === void 0 ? void 0 : bill.bond.chainId]) || '', earnTokenSymbol: ((_m = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _m === void 0 ? void 0 : _m.earnToken.symbol) || '', bondContract: (_o = bill === null || bill === void 0 ? void 0 : bill.address) !== null && _o !== void 0 ? _o : '', projectLink: (_p = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _p === void 0 ? void 0 : _p.projectLink, twitter: (_q = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _q === void 0 ? void 0 : _q.twitter, audit: (_r = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _r === void 0 ? void 0 : _r.audit, chain: (_s = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _s === void 0 ? void 0 : _s.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
|
|
75252
|
+
return (jsxs("div", { className: "your-bonds", onClick: onOpenPurchasedBond, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: (_g = (_f = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _f === void 0 ? void 0 : _f.earnToken) === null || _g === void 0 ? void 0 : _g.symbol, chain: (_h = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _h === void 0 ? void 0 : _h.chainId, tag: (_k = (_j = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _j === void 0 ? void 0 : _j.tags) === null || _k === void 0 ? void 0 : _k[0], vestEnds: getTimeLeftForFullyVested(bill) > 0 ? `Ends in ${getPendingVestingString(bill)}` : `Fully Vested`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: ((_l = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _l === void 0 ? void 0 : _l.earnToken.address[bill === null || bill === void 0 ? void 0 : bill.bond.chainId]) || '', earnTokenSymbol: ((_m = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _m === void 0 ? void 0 : _m.earnToken.symbol) || '', bondContract: (_o = bill === null || bill === void 0 ? void 0 : bill.address) !== null && _o !== void 0 ? _o : '', projectLink: (_p = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _p === void 0 ? void 0 : _p.projectLink, twitter: (_q = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _q === void 0 ? void 0 : _q.twitter, audit: (_r = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _r === void 0 ? void 0 : _r.audit, chain: (_s = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _s === void 0 ? void 0 : _s.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
|
|
75230
75253
|
opacity: 0.8,
|
|
75231
|
-
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimable(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pending(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(pending(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children:
|
|
75254
|
+
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(ProfitCard, { userBond: bill }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimable(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pending(bill), 3), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(pending(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: getPercentageVested(bill) }), style: {
|
|
75255
|
+
width: '127px',
|
|
75256
|
+
height: '25px',
|
|
75257
|
+
flexDirection: 'column',
|
|
75258
|
+
justifyContent: 'center',
|
|
75259
|
+
display: ['none', 'none', 'none', 'flex'],
|
|
75260
|
+
}, showTooltip: true, toolTip: getTimeLeftForFullyVested(bill) > 0
|
|
75261
|
+
? `Fully vested in ${getPendingVestingString(bill)}.`
|
|
75262
|
+
: `Fully Vested.` }) }), jsx$2("div", { className: "your-bonds-column-button", children: userChainId !== ((_t = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _t === void 0 ? void 0 : _t.chainId) ? (jsxs(Button, { className: "button", disabled: claimable(bill) === 0 || load, load: load, onClick: (event) => {
|
|
75232
75263
|
var _a;
|
|
75233
75264
|
event.stopPropagation();
|
|
75234
75265
|
// Add your claim logic here
|
|
@@ -75241,28 +75272,21 @@ const UserBondRow = ({ bill }) => {
|
|
|
75241
75272
|
: 'Claim' })) })] })] }));
|
|
75242
75273
|
};
|
|
75243
75274
|
|
|
75244
|
-
const
|
|
75245
|
-
|
|
75246
|
-
140, 245, 133, 126, 255, 0, 169,
|
|
75247
|
-
]);
|
|
75248
|
-
const COMMON_PDA_PROGRAM = new PublicKey(buffer.Buffer.from([
|
|
75249
|
-
140, 151, 37, 143, 78, 36, 137, 241, 187, 61, 16, 41, 20, 142, 13, 131, 11, 90, 19, 153, 218, 255, 16, 132, 4, 142,
|
|
75250
|
-
123, 216, 219, 233, 248, 89,
|
|
75251
|
-
]));
|
|
75252
|
-
const CLAIM_DISCRIMINATOR = buffer.Buffer.from([62, 198, 214, 193, 213, 159, 108, 210]);
|
|
75253
|
-
const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
75254
|
-
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;
|
|
75275
|
+
const YourBondsModalSolana = ({ billId, onDismiss }) => {
|
|
75276
|
+
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, _8, _9, _10;
|
|
75255
75277
|
// Hooks
|
|
75256
75278
|
const SDKConfig = useSDKConfig();
|
|
75257
75279
|
const { publicKey: accountSolana, signTransaction } = useSOLAccount();
|
|
75258
75280
|
const { setVisible } = useWalletModal();
|
|
75259
75281
|
const { addToastError, addToastSuccess } = usePopups();
|
|
75260
|
-
const { refetch } = useUserBonds();
|
|
75282
|
+
const { data: userBonds, refetch } = useUserBonds();
|
|
75261
75283
|
const connection = new Connection(getRPC(types$1.ChainId.SOL), 'confirmed');
|
|
75262
75284
|
// State
|
|
75263
75285
|
const [imgLoaded, setImgLoaded] = useState(false);
|
|
75264
75286
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
75265
|
-
|
|
75287
|
+
// Static Data
|
|
75288
|
+
const userBill = userBonds === null || userBonds === void 0 ? void 0 : userBonds.find((bill) => bill.asset === billId);
|
|
75289
|
+
const bondNFTData = userBill === null || userBill === void 0 ? void 0 : userBill.nftData;
|
|
75266
75290
|
// Cliff display info:
|
|
75267
75291
|
const vestingCliff = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff;
|
|
75268
75292
|
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
@@ -75299,17 +75323,17 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75299
75323
|
return userPayoutAta;
|
|
75300
75324
|
});
|
|
75301
75325
|
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
75302
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
75326
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
75303
75327
|
try {
|
|
75304
75328
|
setLoadingTx(true);
|
|
75305
75329
|
const earnTokenAddress = (_c = (_b = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[(_d = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _d === void 0 ? void 0 : _d.chainId];
|
|
75306
|
-
|
|
75330
|
+
const contractAddress = (_f = (_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.contractAddress) === null || _f === void 0 ? void 0 : _f[(_g = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _g === void 0 ? void 0 : _g.chainId];
|
|
75331
|
+
if (!earnTokenAddress || !userBill.asset || !contractAddress)
|
|
75307
75332
|
return;
|
|
75308
75333
|
const payoutMint = new PublicKey(earnTokenAddress);
|
|
75309
|
-
|
|
75310
|
-
const
|
|
75334
|
+
const bondIssuancePda = new PublicKey(contractAddress);
|
|
75335
|
+
const nftMint = new PublicKey(userBill.asset);
|
|
75311
75336
|
const [bondTermPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond_term'), bondIssuancePda.toBuffer()], PROGRAM_ID);
|
|
75312
|
-
const nftMint = new PublicKey(userBill.id);
|
|
75313
75337
|
const [bondPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond'), bondIssuancePda.toBuffer(), nftMint.toBuffer()], PROGRAM_ID);
|
|
75314
75338
|
const userPayoutAta = yield ensureUserPayoutAtaExists({
|
|
75315
75339
|
connection,
|
|
@@ -75347,26 +75371,28 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75347
75371
|
if (!signTransaction)
|
|
75348
75372
|
return;
|
|
75349
75373
|
const signedTx = yield signTransaction(transaction);
|
|
75350
|
-
const
|
|
75374
|
+
const txHash = yield connection.sendRawTransaction(signedTx.serialize(), {
|
|
75351
75375
|
skipPreflight: false,
|
|
75352
75376
|
preflightCommitment: 'confirmed',
|
|
75353
75377
|
});
|
|
75354
75378
|
yield connection.confirmTransaction({
|
|
75355
|
-
signature:
|
|
75379
|
+
signature: txHash,
|
|
75356
75380
|
blockhash,
|
|
75357
75381
|
lastValidBlockHeight,
|
|
75358
75382
|
}, 'confirmed');
|
|
75359
|
-
|
|
75360
|
-
|
|
75361
|
-
|
|
75383
|
+
const txStatus = yield connection.getSignatureStatus(txHash, { searchTransactionHistory: true });
|
|
75384
|
+
if (((_h = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _h === void 0 ? void 0 : _h.confirmationStatus) === 'confirmed' || ((_j = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _j === void 0 ? void 0 : _j.confirmationStatus) === 'finalized') {
|
|
75385
|
+
console.log('Tx confirmed on-chain, refetching bonds');
|
|
75362
75386
|
refetch();
|
|
75363
|
-
|
|
75387
|
+
addToastSuccess(txHash, types$1.ChainId.SOL);
|
|
75388
|
+
}
|
|
75389
|
+
setLoadingTx(false);
|
|
75364
75390
|
}
|
|
75365
75391
|
catch (error) {
|
|
75366
75392
|
console.error('Claim failed:', error);
|
|
75367
|
-
addToastError((
|
|
75393
|
+
addToastError((_k = error === null || error === void 0 ? void 0 : error.message) !== null && _k !== void 0 ? _k : 'Unknown error');
|
|
75368
75394
|
reportError({
|
|
75369
|
-
apiUrl: (
|
|
75395
|
+
apiUrl: (_l = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _l === void 0 ? void 0 : _l.apiV2,
|
|
75370
75396
|
error,
|
|
75371
75397
|
extraInfo: { type: 'claim', userBill, error },
|
|
75372
75398
|
});
|
|
@@ -75379,7 +75405,7 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75379
75405
|
setImgLoaded(true);
|
|
75380
75406
|
};
|
|
75381
75407
|
const [onTransferBondModal] = useModal(jsx$2(TransferBondModal, { userBill: userBill }), true, true, `transferModal${userBill === null || userBill === void 0 ? void 0 : userBill.id}}`);
|
|
75382
|
-
return (jsx$2(Modal, { className: "modal", children: jsxs(Flex$1, { className: "yourbondsmodal-content", children: [jsx$2(Flex$1, { className: "yourbondsmodal-header", children: jsx$2(Flex$1, { className: "svg-close", onClick: onDismiss, children: jsx$2(Svg, { icon: "close" }) }) }), jsxs(Flex$1, { className: "yourbondsmodal table-container", children: [jsxs(Flex$1, { className: "yourbondsmodal bondimage", children: [jsx$2("img", { src: `https://ape.bond/solBonds/${(_e = (_d = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) === null || _e === void 0 ? void 0 : _e.toLowerCase()}.png`, alt: "Solana Bonds Banner", onLoad: handleImageLoad, style: { zIndex: 2, width: '100%', height: '100%' } }), !imgLoaded && (jsx$2(Flex$1, { sx: {
|
|
75408
|
+
return (jsx$2(Modal, { className: "modal", children: jsxs(Flex$1, { className: "yourbondsmodal-content", children: [jsx$2(Flex$1, { className: "yourbondsmodal-header", children: jsx$2(Flex$1, { className: "svg-close", onClick: onDismiss, children: jsx$2(Svg, { icon: "close" }) }) }), jsxs(Flex$1, { className: "yourbondsmodal table-container", children: [jsxs(Flex$1, { className: "yourbondsmodal bondimage", children: [(bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.image) ? (jsx$2("img", { src: `${bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.image}?img-width=720`, onLoad: handleImageLoad, alt: "solana-NFT", style: { zIndex: 2, width: '100%', height: '100%' } })) : (userBill && (jsx$2("img", { src: `https://ape.bond/solBonds/${(_e = (_d = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) === null || _e === void 0 ? void 0 : _e.toLowerCase()}.png`, alt: "Solana Bonds Banner", onLoad: handleImageLoad, style: { zIndex: 2, width: '100%', height: '100%' } }))), (!imgLoaded || !userBill) && (jsx$2(Flex$1, { sx: {
|
|
75383
75409
|
position: 'absolute',
|
|
75384
75410
|
top: 'calc(50% - 24px)',
|
|
75385
75411
|
right: 'calc(50% - 50px)',
|
|
@@ -75388,7 +75414,7 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75388
75414
|
zIndex: 1,
|
|
75389
75415
|
}, children: jsx$2(Spinner, { width: 100 }) }))] }), jsxs(Flex$1, { className: "yourbondsmodal yourbondinfo", children: [jsxs(Flex$1, { className: "yourbondinfo title-container", children: [jsx$2(Flex$1, { className: "title-container bondicon", children: userBill && (jsx$2(TokenImage, { symbol: (_g = (_f = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _f === void 0 ? void 0 : _f.showcaseTokenName) !== null && _g !== void 0 ? _g : (_j = (_h = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _h === void 0 ? void 0 : _h.earnToken) === null || _j === void 0 ? void 0 : _j.symbol, size: 40, chain: (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.chainId })) }), jsx$2(Flex$1, { className: "title-container tokenname", children: (_m = (_l = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _l === void 0 ? void 0 : _l.showcaseTokenName) !== null && _m !== void 0 ? _m : (_o = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _o === void 0 ? void 0 : _o.earnToken.symbol }), jsx$2(Flex$1, { className: "title-container tokentags", children: (_q = (_p = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _p === void 0 ? void 0 : _p.tags) === null || _q === void 0 ? void 0 : _q.slice(0, 1).map((tag) => {
|
|
75390
75416
|
return (jsx$2(Flex$1, { sx: { marginRight: '10px' }, children: jsx$2(ListTag, { text: tag === null || tag === void 0 ? void 0 : tag.toUpperCase() }) }, tag));
|
|
75391
|
-
}) }), jsxs(Text, { sx: { color: 'text', opacity: '0.6', fontSize: ['12px', '12px', '12px', '16px'] }, children: ["ID # ", (_r =
|
|
75417
|
+
}) }), jsxs(Text, { sx: { color: 'text', opacity: '0.6', fontSize: ['12px', '12px', '12px', '16px'] }, children: ["ID # ", userBill === null || userBill === void 0 ? void 0 : userBill.id] })] }), jsxs(Flex$1, { className: "yourbondinfo blocks-container", children: [((_r = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _r === void 0 ? void 0 : _r.deposit) && (jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "You Spent" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.YouSpent }), width: "270px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsx$2(Flex$1, { className: "yourbondinfo-block info", children: jsx$2(Flex$1, { className: "block-info text", children: jsxs(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: ["$", (_s = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _s === void 0 ? void 0 : _s.dollarValue.toFixed(2)] }) }) })] })), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Fully Vested" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.FullyVested }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon" }), jsx$2(Flex$1, { className: "block-info text", children: jsxs(Flex$1, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: [vestingTimeRemainingString(userBill), isPendingCliff && (jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsxs(Flex$1, { children: ["Bond will be claimable in", ' ', `${cliffCountdown.days !== 0 ? `${cliffCountdown.days} days` : cliffCountdown.hours !== 0 ? `${cliffCountdown.hours} hours` : `${cliffCountdown.minutes} mins`}`, "."] }), width: "180px", placement: "bottomRight", transformTip: "translate(13%, 0%)", children: jsx$2(Flex$1, { sx: { opacity: 0.6, ml: '6px' }, children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }))] }) })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-pending", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Pending" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Pending }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_u = (_t = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _t === void 0 ? void 0 : _t.showcaseTokenName) !== null && _u !== void 0 ? _u : (_w = (_v = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _v === void 0 ? void 0 : _v.earnToken) === null || _w === void 0 ? void 0 : _w.symbol, size: 25, chain: (_x = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _x === void 0 ? void 0 : _x.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(pending(userBill), 4) }), jsx$2(Text, { sx: {
|
|
75392
75418
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75393
75419
|
fontWeight: [500, 500, 500, 400],
|
|
75394
75420
|
paddingLeft: '10px',
|
|
@@ -75396,15 +75422,19 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75396
75422
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75397
75423
|
fontWeight: [500, 500, 500, 400],
|
|
75398
75424
|
paddingLeft: '10px',
|
|
75399
|
-
}, children: `($${claimableUSD(userBill).toFixed(2)})` })] })] })] })] }), ((_3 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _3 === void 0 ? void 0 : _3.
|
|
75425
|
+
}, children: `($${claimableUSD(userBill).toFixed(2)})` })] })] })] }), jsxs(Flex$1, { className: "yourbondinfo-block row-vested", children: [jsxs(Flex$1, { className: "yourbondinfo-block header", children: [jsx$2(Flex$1, { className: "yourbondinfo-block header-title", children: "Claimed" }), jsx$2(Flex$1, { className: "yourbondinfo-block header-tooltip", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: UserBillTooltipText.Claimed }), width: "250px", placement: "bottomLeft", transformTip: "translate(-5%, 0%)", children: jsx$2(Flex$1, { className: "block-header icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) }) })] }), jsxs(Flex$1, { className: "yourbondinfo-block info", children: [jsx$2(Flex$1, { className: "block-info icon", children: userBill && (jsx$2(TokenImage, { symbol: (_4 = (_3 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _3 === void 0 ? void 0 : _3.showcaseTokenName) !== null && _4 !== void 0 ? _4 : (_6 = (_5 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _5 === void 0 ? void 0 : _5.earnToken) === null || _6 === void 0 ? void 0 : _6.symbol, size: 25, chain: (_7 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _7 === void 0 ? void 0 : _7.chainId })) }), jsxs(Flex$1, { className: "block-info text", children: [jsx$2(Text, { sx: { fontSize: ['12px', '12px', '12px', '19px'], fontWeight: 700 }, children: formatNumberSI(claimed(userBill), 4) }), jsx$2(Text, { sx: {
|
|
75426
|
+
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75427
|
+
fontWeight: [500, 500, 500, 400],
|
|
75428
|
+
paddingLeft: '10px',
|
|
75429
|
+
}, children: `($${claimedUSD(userBill).toFixed(2)})` })] })] })] })] }), ((_8 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _8 === void 0 ? void 0 : _8.warningCard) && (jsx$2(Flex$1, { sx: {
|
|
75400
75430
|
width: '100%',
|
|
75401
75431
|
background: '#DE62F366',
|
|
75402
75432
|
justifyContent: 'center',
|
|
75403
75433
|
borderRadius: 'normal',
|
|
75404
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (
|
|
75434
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (_9 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _9 === void 0 ? void 0 : _9.warningCard }) }) })), jsxs(Flex$1, { className: "yourbondinfo button-container", children: [jsx$2(Flex$1, { className: "button-container claim", children: userBill && !accountSolana ? (jsxs(Button, { className: "switch-button", disabled: claimable(userBill) === 0 || loadingTx, onClick: (event) => {
|
|
75405
75435
|
event.stopPropagation();
|
|
75406
75436
|
setVisible(true);
|
|
75407
|
-
}, children: ["Switch to ", NETWORK_LABEL[(
|
|
75437
|
+
}, children: ["Switch to ", NETWORK_LABEL[(_10 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _10 === void 0 ? void 0 : _10.chainId]] })) : (jsx$2(Button, { className: "claim-button", disabled: claimable(userBill) === 0 || loadingTx || !userBill || isPendingCliff, load: loadingTx, onClick: (event) => {
|
|
75408
75438
|
event.stopPropagation();
|
|
75409
75439
|
handleClaim();
|
|
75410
75440
|
}, children: isPendingCliff
|
|
@@ -75414,14 +75444,22 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75414
75444
|
|
|
75415
75445
|
const UserBondRowSolana = ({ bill }) => {
|
|
75416
75446
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
75447
|
+
// Hooks
|
|
75417
75448
|
const { setVisible } = useWalletModal();
|
|
75418
75449
|
const { publicKey: accountSolana, signTransaction } = useSOLAccount();
|
|
75419
75450
|
const { addToastError, addToastSuccess } = usePopups();
|
|
75420
75451
|
const { refetch } = useUserBonds();
|
|
75421
|
-
const [loadingTx, setLoadingTx] = useState(false);
|
|
75422
|
-
const load = loadingTx;
|
|
75423
|
-
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModalSolana, { userBill: bill }), true, true, `yoursolanabondsModal-${bill.id}`);
|
|
75424
75452
|
const connection = new Connection(getRPC(types$1.ChainId.SOL));
|
|
75453
|
+
// State
|
|
75454
|
+
const [loadingTx, setLoadingTx] = useState(false);
|
|
75455
|
+
// Static Data
|
|
75456
|
+
const earnTokenPrice = parseFloat((_b = (_a = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _a === void 0 ? void 0 : _a.payoutTokenPrice) !== null && _b !== void 0 ? _b : '0');
|
|
75457
|
+
const vestingCliff = (_c = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _c === void 0 ? void 0 : _c.vestingCliff;
|
|
75458
|
+
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
75459
|
+
const lastBlockTimestamp = parseInt((_d = bill === null || bill === void 0 ? void 0 : bill.lastBlockTimestamp) !== null && _d !== void 0 ? _d : '0');
|
|
75460
|
+
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
75461
|
+
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
75462
|
+
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModalSolana, { billId: bill.asset }));
|
|
75425
75463
|
const ensureUserPayoutAtaExists = (_a) => __awaiter$9(void 0, [_a], void 0, function* ({ connection, payer, payoutMint, user, }) {
|
|
75426
75464
|
const userPayoutAta = yield getAssociatedTokenAddress(payoutMint, user);
|
|
75427
75465
|
try {
|
|
@@ -75452,18 +75490,18 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75452
75490
|
return userPayoutAta;
|
|
75453
75491
|
});
|
|
75454
75492
|
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
75455
|
-
var _a, _b, _c, _d, _e, _f;
|
|
75493
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
75456
75494
|
try {
|
|
75457
75495
|
setLoadingTx(true);
|
|
75458
75496
|
const earnTokenAddress = (_c = (_b = (_a = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _a === void 0 ? void 0 : _a.earnToken) === null || _b === void 0 ? void 0 : _b.address) === null || _c === void 0 ? void 0 : _c[(_d = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _d === void 0 ? void 0 : _d.chainId];
|
|
75497
|
+
const contractAddress = (_f = (_e = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _e === void 0 ? void 0 : _e.contractAddress) === null || _f === void 0 ? void 0 : _f[(_g = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _g === void 0 ? void 0 : _g.chainId];
|
|
75498
|
+
if (!earnTokenAddress || !bill.asset || !contractAddress || !accountSolana)
|
|
75499
|
+
return;
|
|
75459
75500
|
const payoutMint = new PublicKey(earnTokenAddress);
|
|
75460
|
-
|
|
75461
|
-
const
|
|
75501
|
+
const bondIssuancePda = new PublicKey(contractAddress);
|
|
75502
|
+
const nftMint = new PublicKey(bill.asset);
|
|
75462
75503
|
const [bondTermPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond_term'), bondIssuancePda.toBuffer()], PROGRAM_ID);
|
|
75463
|
-
const nftMint = new PublicKey(bill.id);
|
|
75464
75504
|
const [bondPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond'), bondIssuancePda.toBuffer(), nftMint.toBuffer()], PROGRAM_ID);
|
|
75465
|
-
if (!accountSolana)
|
|
75466
|
-
return;
|
|
75467
75505
|
const userPayoutAta = yield ensureUserPayoutAtaExists({
|
|
75468
75506
|
connection,
|
|
75469
75507
|
payer: accountSolana,
|
|
@@ -75471,7 +75509,7 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75471
75509
|
user: accountSolana,
|
|
75472
75510
|
});
|
|
75473
75511
|
// treasury_ata = PDA
|
|
75474
|
-
const [treasuryAta] = PublicKey.findProgramAddressSync([bondIssuancePda.toBuffer(), COMMON_CONST_SEED
|
|
75512
|
+
const [treasuryAta] = PublicKey.findProgramAddressSync([bondIssuancePda.toBuffer(), COMMON_CONST_SEED, payoutMint.toBuffer()], COMMON_PDA_PROGRAM);
|
|
75475
75513
|
// Build keys list
|
|
75476
75514
|
const keys = [
|
|
75477
75515
|
{ pubkey: bondPda, isSigner: false, isWritable: true },
|
|
@@ -75484,13 +75522,13 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75484
75522
|
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
75485
75523
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
75486
75524
|
{ pubkey: new PublicKey('CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d'), isSigner: false, isWritable: false }, // mplCoreProgram
|
|
75487
|
-
{ pubkey: PROGRAM_ID, isSigner: false, isWritable: false,
|
|
75525
|
+
{ pubkey: PROGRAM_ID, isSigner: false, isWritable: false }, // passing programId is the same as passing null
|
|
75488
75526
|
];
|
|
75489
75527
|
// Build Instruction (no args → just discriminator)
|
|
75490
75528
|
const instruction = new TransactionInstruction({
|
|
75491
75529
|
keys,
|
|
75492
75530
|
programId: PROGRAM_ID,
|
|
75493
|
-
data: CLAIM_DISCRIMINATOR
|
|
75531
|
+
data: CLAIM_DISCRIMINATOR,
|
|
75494
75532
|
});
|
|
75495
75533
|
// Build Transaction
|
|
75496
75534
|
const transaction = new Transaction().add(instruction);
|
|
@@ -75500,42 +75538,48 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75500
75538
|
if (!signTransaction)
|
|
75501
75539
|
return;
|
|
75502
75540
|
const signedTx = yield signTransaction(transaction);
|
|
75503
|
-
const
|
|
75541
|
+
const txHash = yield connection.sendRawTransaction(signedTx.serialize(), {
|
|
75504
75542
|
skipPreflight: false,
|
|
75505
75543
|
preflightCommitment: 'confirmed',
|
|
75506
75544
|
});
|
|
75507
75545
|
yield connection.confirmTransaction({
|
|
75508
|
-
signature:
|
|
75546
|
+
signature: txHash,
|
|
75509
75547
|
blockhash,
|
|
75510
75548
|
lastValidBlockHeight,
|
|
75511
75549
|
}, 'confirmed');
|
|
75512
|
-
|
|
75513
|
-
|
|
75514
|
-
|
|
75550
|
+
const txStatus = yield connection.getSignatureStatus(txHash, { searchTransactionHistory: true });
|
|
75551
|
+
if (((_h = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _h === void 0 ? void 0 : _h.confirmationStatus) === 'confirmed' || ((_j = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _j === void 0 ? void 0 : _j.confirmationStatus) === 'finalized') {
|
|
75552
|
+
console.log('Tx confirmed on-chain, refetching bonds');
|
|
75515
75553
|
refetch();
|
|
75516
|
-
|
|
75554
|
+
addToastSuccess(txHash, types$1.ChainId.SOL);
|
|
75555
|
+
}
|
|
75556
|
+
setLoadingTx(false);
|
|
75517
75557
|
}
|
|
75518
75558
|
catch (error) {
|
|
75519
75559
|
console.error('Claim failed:', error);
|
|
75520
|
-
addToastError((
|
|
75560
|
+
addToastError((_k = error === null || error === void 0 ? void 0 : error.message) !== null && _k !== void 0 ? _k : 'Unknown error');
|
|
75521
75561
|
}
|
|
75522
75562
|
finally {
|
|
75523
75563
|
setLoadingTx(false);
|
|
75524
75564
|
}
|
|
75525
75565
|
});
|
|
75526
|
-
|
|
75527
|
-
|
|
75528
|
-
|
|
75529
|
-
|
|
75530
|
-
const lastBlockTimestamp = parseInt((_d = bill === null || bill === void 0 ? void 0 : bill.lastBlockTimestamp) !== null && _d !== void 0 ? _d : '0');
|
|
75531
|
-
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
75532
|
-
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
75533
|
-
return (jsxs("div", { className: "your-bonds", onClick: () => onOpenPurchasedBond(), children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: (_e = bill.bond) === null || _e === void 0 ? void 0 : _e.earnToken.symbol, chain: (_f = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _f === void 0 ? void 0 : _f.chainId, vestEnds: `Ends in ${getPendingVestingString(bill)}`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: ((_g = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _g === void 0 ? void 0 : _g.earnToken.address[bill === null || bill === void 0 ? void 0 : bill.bond.chainId]) || '', earnTokenSymbol: ((_h = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _h === void 0 ? void 0 : _h.earnToken.symbol) || '', bondContract: (_j = bill === null || bill === void 0 ? void 0 : bill.address) !== null && _j !== void 0 ? _j : '', projectLink: (_k = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _k === void 0 ? void 0 : _k.projectLink, twitter: (_l = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _l === void 0 ? void 0 : _l.twitter, audit: (_m = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _m === void 0 ? void 0 : _m.audit, chain: (_o = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _o === void 0 ? void 0 : _o.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
|
|
75566
|
+
return (jsxs("div", { className: "your-bonds", onClick: () => {
|
|
75567
|
+
if (bill.asset)
|
|
75568
|
+
onOpenPurchasedBond();
|
|
75569
|
+
}, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: (_e = bill.bond) === null || _e === void 0 ? void 0 : _e.earnToken.symbol, chain: (_f = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _f === void 0 ? void 0 : _f.chainId, vestEnds: getTimeLeftForFullyVested(bill) > 0 ? `Ends in ${getPendingVestingString(bill)}` : `Fully Vested`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: ((_g = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _g === void 0 ? void 0 : _g.earnToken.address[bill === null || bill === void 0 ? void 0 : bill.bond.chainId]) || '', earnTokenSymbol: ((_h = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _h === void 0 ? void 0 : _h.earnToken.symbol) || '', bondContract: (_j = bill === null || bill === void 0 ? void 0 : bill.address) !== null && _j !== void 0 ? _j : '', projectLink: (_k = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _k === void 0 ? void 0 : _k.projectLink, twitter: (_l = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _l === void 0 ? void 0 : _l.twitter, audit: (_m = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _m === void 0 ? void 0 : _m.audit, chain: (_o = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _o === void 0 ? void 0 : _o.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex, { sx: {
|
|
75534
75570
|
opacity: 0.8,
|
|
75535
|
-
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimable(bill), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pending(bill), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(pending(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children:
|
|
75571
|
+
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(ProfitCard, { userBond: bill }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimable(bill), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(claimable(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pending(bill), 4), jsx$2("div", { className: "your-bonds-content-tokens-usd-amount", children: `($${(pending(bill) * earnTokenPrice).toFixed(2)})` })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: jsx$2(ProgressBarWrapper$1, { title: '', value: jsx$2(ProgressBar, { value: getPercentageVested(bill) }), style: {
|
|
75572
|
+
width: '127px',
|
|
75573
|
+
height: '25px',
|
|
75574
|
+
flexDirection: 'column',
|
|
75575
|
+
justifyContent: 'center',
|
|
75576
|
+
display: ['none', 'none', 'none', 'flex'],
|
|
75577
|
+
}, showTooltip: true, toolTip: getTimeLeftForFullyVested(bill) > 0
|
|
75578
|
+
? `Fully vested in ${getPendingVestingString(bill)}.`
|
|
75579
|
+
: `Fully Vested.` }) }), jsx$2("div", { className: "your-bonds-column-button", children: !accountSolana ? (jsxs(Button, { className: "button", disabled: claimable(bill) === 0 || loadingTx, load: loadingTx, onClick: (event) => {
|
|
75536
75580
|
event.stopPropagation();
|
|
75537
75581
|
setVisible(true);
|
|
75538
|
-
}, fullWidth: true, children: ["Connect to ", NETWORK_LABEL[(_p = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _p === void 0 ? void 0 : _p.chainId]] })) : (jsx$2(Button, { className: "button", disabled: claimable(bill) === 0 ||
|
|
75582
|
+
}, fullWidth: true, children: ["Connect to ", NETWORK_LABEL[(_p = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _p === void 0 ? void 0 : _p.chainId]] })) : (jsx$2(Button, { className: "button", disabled: claimable(bill) === 0 || loadingTx || isPendingCliff, load: loadingTx, onClick: (event) => {
|
|
75539
75583
|
event.stopPropagation();
|
|
75540
75584
|
handleClaim();
|
|
75541
75585
|
}, fullWidth: true, children: isPendingCliff
|
|
@@ -78075,7 +78119,7 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
78075
78119
|
const [loading, setLoading] = useState(false);
|
|
78076
78120
|
const [hash, setHash] = useState('');
|
|
78077
78121
|
// Data
|
|
78078
|
-
const { isLoading: isLoadingOnChain, isSuccess } =
|
|
78122
|
+
const { isLoading: isLoadingOnChain, isSuccess } = useMonitorTx(hash, userBond === null || userBond === void 0 ? void 0 : userBond.chainId);
|
|
78079
78123
|
const hasRedeemed = (_a = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _a === void 0 ? void 0 : _a.hasRedeemed;
|
|
78080
78124
|
const redeemableIn = formatTimeLeft(((_b = userBond === null || userBond === void 0 ? void 0 : userBond.redeemTime) !== null && _b !== void 0 ? _b : 0) - new Date().getTime() / 1000, true, true);
|
|
78081
78125
|
const saleFinalized = userBond === null || userBond === void 0 ? void 0 : userBond.finalized;
|
|
@@ -78178,189 +78222,7 @@ const UserBondRowPreTGE = ({ userBond }) => {
|
|
|
78178
78222
|
const pendingUSD = pendingAmount * ((_x = userBond === null || userBond === void 0 ? void 0 : userBond.earnTokenPrice) !== null && _x !== void 0 ? _x : 0);
|
|
78179
78223
|
return (jsxs("div", { className: "your-bonds", onClick: () => null, children: [jsxs("div", { className: "token-info-container", children: [jsx$2(TokenInfoAndName, { tokenSymbol: userBond.earnToken.symbol, chain: userBond.chainId, tag: (_y = userBond.tags) === null || _y === void 0 ? void 0 : _y[0], vestEnds: isRedeemable ? 'Claim now!' : !hasRedeemed ? `Claim in ${redeemableIn}` : `Ends in ${vestingString}`, isHotBond: true }), jsx$2("div", { className: "tooltip-column", children: jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(BondInfoTooltip, { earnTokenContract: (userBond === null || userBond === void 0 ? void 0 : userBond.earnToken.address[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]) || '', earnTokenSymbol: (userBond === null || userBond === void 0 ? void 0 : userBond.earnToken.symbol) || '', bondContract: ((_z = userBond === null || userBond === void 0 ? void 0 : userBond.contractAddress) === null || _z === void 0 ? void 0 : _z[userBond === null || userBond === void 0 ? void 0 : userBond.chainId]) || '', projectLink: userBond === null || userBond === void 0 ? void 0 : userBond.projectLink, twitter: userBond === null || userBond === void 0 ? void 0 : userBond.twitter, audit: userBond === null || userBond === void 0 ? void 0 : userBond.audit, chain: userBond === null || userBond === void 0 ? void 0 : userBond.chainId }), width: "205px", placement: "bottomRight", transformTip: "translate(5%, 0%)", children: jsx$2(Flex$1, { sx: {
|
|
78180
78224
|
opacity: 0.8,
|
|
78181
|
-
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimableAmount, 3), jsxs("div", { className: "your-bonds-content-tokens-usd-amount", children: ["($", formatUSDNumber$1(claimableUSD), ")"] })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pendingAmount, 3), jsxs("div", { className: "your-bonds-content-tokens-usd-amount", children: ["($", formatUSDNumber$1(pendingUSD), ")"] })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: vestingString }), jsx$2("div", { className: "your-bonds-column-button", children: jsx$2(PreTgeActions, { userBond: userBond }) })] })] }));
|
|
78182
|
-
};
|
|
78183
|
-
|
|
78184
|
-
const YourBonds = ({ showOnly }) => {
|
|
78185
|
-
useTokenPrices();
|
|
78186
|
-
// Hooks
|
|
78187
|
-
const SDKConfig = useSDKConfig();
|
|
78188
|
-
const { address: account } = useEVMAccount();
|
|
78189
|
-
const { publicKey: solanaAccount } = useSOLAccount();
|
|
78190
|
-
const { data: userBonds, isFetched: userBondsFetched } = useUserBonds();
|
|
78191
|
-
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
78192
|
-
const { data: preTGEUserBonds } = useUserBondsPreTGE();
|
|
78193
|
-
const preTGEBondsToRender = preTGEUserBonds === null || preTGEUserBonds === void 0 ? void 0 : preTGEUserBonds.filter((userBond) => {
|
|
78194
|
-
var _a, _b, _c, _d;
|
|
78195
|
-
if (!((_a = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _a === void 0 ? void 0 : _a.hasRedeemed)) {
|
|
78196
|
-
return parseFloat((_c = (_b = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _b === void 0 ? void 0 : _b.depositAmount) !== null && _c !== void 0 ? _c : '0') > 0;
|
|
78197
|
-
}
|
|
78198
|
-
else {
|
|
78199
|
-
return ((_d = userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData) === null || _d === void 0 ? void 0 : _d.payout) !== '0';
|
|
78200
|
-
}
|
|
78201
|
-
});
|
|
78202
|
-
// State
|
|
78203
|
-
const [sortConfig, setSortConfig] = useState({
|
|
78204
|
-
key: 'pending',
|
|
78205
|
-
direction: 'desc',
|
|
78206
|
-
});
|
|
78207
|
-
const [inputValue, setInputValue] = useState('');
|
|
78208
|
-
const filterOptions = ['CLAIMABLE', 'ALL'];
|
|
78209
|
-
const [filterOption, setFilterOption] = useState(filterOptions[0]);
|
|
78210
|
-
const handleSort = (key) => {
|
|
78211
|
-
let direction = 'desc';
|
|
78212
|
-
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'desc') {
|
|
78213
|
-
direction = 'asc';
|
|
78214
|
-
}
|
|
78215
|
-
setSortConfig({ key, direction });
|
|
78216
|
-
};
|
|
78217
|
-
const bondsToRender = useMemo(() => {
|
|
78218
|
-
if (!userBonds)
|
|
78219
|
-
return { SOL: [], EVM: [] };
|
|
78220
|
-
let bondsToReturn = userBonds;
|
|
78221
|
-
// Handle Filtering //
|
|
78222
|
-
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
78223
|
-
var _a;
|
|
78224
|
-
return ((_a = bond.bond) === null || _a === void 0 ? void 0 : _a.onlyPartner) ? bond.bond.bondPartner === SDKConfig.bondPartner : true;
|
|
78225
|
-
});
|
|
78226
|
-
if (SDKConfig.bondPartner) {
|
|
78227
|
-
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
78228
|
-
var _a;
|
|
78229
|
-
return ((_a = bond.bond) === null || _a === void 0 ? void 0 : _a.bondPartner) === SDKConfig.bondPartner;
|
|
78230
|
-
});
|
|
78231
|
-
}
|
|
78232
|
-
// Filter Single Token View
|
|
78233
|
-
if (showOnly) {
|
|
78234
|
-
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
78235
|
-
var _a, _b, _c;
|
|
78236
|
-
return ((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.earnToken) === null || _b === void 0 ? void 0 : _b.symbol) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === showOnly.toLowerCase();
|
|
78237
|
-
});
|
|
78238
|
-
}
|
|
78239
|
-
// Filter by search query
|
|
78240
|
-
if (inputValue !== '') {
|
|
78241
|
-
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
78242
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
78243
|
-
return [
|
|
78244
|
-
(_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.showcaseTokenName) === null || _b === void 0 ? void 0 : _b.toLowerCase(),
|
|
78245
|
-
(_e = (_d = (_c = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _c === void 0 ? void 0 : _c.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) === null || _e === void 0 ? void 0 : _e.toLowerCase(),
|
|
78246
|
-
(_h = (_g = (_f = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _f === void 0 ? void 0 : _f.lpToken) === null || _g === void 0 ? void 0 : _g.symbol) === null || _h === void 0 ? void 0 : _h.toLowerCase(),
|
|
78247
|
-
].some((property) => property === null || property === void 0 ? void 0 : property.includes(inputValue.toLowerCase()));
|
|
78248
|
-
});
|
|
78249
|
-
}
|
|
78250
|
-
// Filter by chain selector
|
|
78251
|
-
if (!chainFilterOption.includes('All Chains')) {
|
|
78252
|
-
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
78253
|
-
var _a, _b, _c;
|
|
78254
|
-
return chainFilterOption.includes((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.chainId) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : '');
|
|
78255
|
-
});
|
|
78256
|
-
}
|
|
78257
|
-
// Filter by filter option (claimable or all buttons)
|
|
78258
|
-
if (filterOption === 'CLAIMABLE') {
|
|
78259
|
-
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
78260
|
-
var _a;
|
|
78261
|
-
if ((_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff) {
|
|
78262
|
-
return bond.payout !== '0';
|
|
78263
|
-
}
|
|
78264
|
-
return bond.pendingRewards !== '0';
|
|
78265
|
-
});
|
|
78266
|
-
}
|
|
78267
|
-
// Handle sorting //
|
|
78268
|
-
if (sortConfig !== null) {
|
|
78269
|
-
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.sort((a, b) => {
|
|
78270
|
-
let aValue, bValue;
|
|
78271
|
-
if (sortConfig.key === 'claimable') {
|
|
78272
|
-
aValue = claimableUSD(a);
|
|
78273
|
-
bValue = claimableUSD(b);
|
|
78274
|
-
}
|
|
78275
|
-
else if (sortConfig.key === 'pending') {
|
|
78276
|
-
aValue = pendingUSD(a);
|
|
78277
|
-
bValue = pendingUSD(b);
|
|
78278
|
-
}
|
|
78279
|
-
else if (sortConfig.key === 'terms') {
|
|
78280
|
-
const aRemainingTime = vestingTimeRemaining(a).days * 24 * 3600 +
|
|
78281
|
-
vestingTimeRemaining(a).hours * 3600 +
|
|
78282
|
-
vestingTimeRemaining(a).minutes * 60;
|
|
78283
|
-
const bRemainingTime = vestingTimeRemaining(b).days * 24 * 3600 +
|
|
78284
|
-
vestingTimeRemaining(b).hours * 3600 +
|
|
78285
|
-
vestingTimeRemaining(b).minutes * 60;
|
|
78286
|
-
aValue = aRemainingTime;
|
|
78287
|
-
bValue = bRemainingTime;
|
|
78288
|
-
}
|
|
78289
|
-
else {
|
|
78290
|
-
aValue = a[sortConfig.key];
|
|
78291
|
-
bValue = b[sortConfig.key];
|
|
78292
|
-
}
|
|
78293
|
-
if (aValue < bValue) {
|
|
78294
|
-
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
78295
|
-
}
|
|
78296
|
-
if (aValue > bValue) {
|
|
78297
|
-
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
78298
|
-
}
|
|
78299
|
-
return 0;
|
|
78300
|
-
});
|
|
78301
|
-
}
|
|
78302
|
-
const bondsToReturnGroupedByVM = bondsToReturn.reduce((acc, userBond) => {
|
|
78303
|
-
var _a;
|
|
78304
|
-
if (((_a = userBond === null || userBond === void 0 ? void 0 : userBond.bond) === null || _a === void 0 ? void 0 : _a.chainId) === types$1.ChainId.SOL) {
|
|
78305
|
-
acc['SOL'].push(userBond);
|
|
78306
|
-
}
|
|
78307
|
-
else {
|
|
78308
|
-
acc['EVM'].push(userBond);
|
|
78309
|
-
}
|
|
78310
|
-
return acc;
|
|
78311
|
-
}, { SOL: [], EVM: [] });
|
|
78312
|
-
return bondsToReturnGroupedByVM;
|
|
78313
|
-
/* eslint-disable react-hooks/exhaustive-deps */
|
|
78314
|
-
}, [userBonds, sortConfig, inputValue, chainFilterOption, filterOption, userBondsFetched]);
|
|
78315
|
-
const handleFilterOption = useCallback((newOption) => {
|
|
78316
|
-
setFilterOption(newOption);
|
|
78317
|
-
}, []);
|
|
78318
|
-
const hasBonds = useMemo(() => {
|
|
78319
|
-
return ((bondsToRender && (bondsToRender.SOL.length > 0 || bondsToRender.EVM.length > 0)) || !!(preTGEBondsToRender === null || preTGEBondsToRender === void 0 ? void 0 : preTGEBondsToRender.length));
|
|
78320
|
-
}, [bondsToRender, preTGEBondsToRender]);
|
|
78321
|
-
return (jsxs(Flex$1, { className: "yourbonds table-container", children: [!showOnly && (jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort })), !account && !solanaAccount ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected.' })) : hasBonds ? (jsxs(Fragment$1, { children: [preTGEBondsToRender === null || preTGEBondsToRender === void 0 ? void 0 : preTGEBondsToRender.map((userBond, index) => jsx$2(UserBondRowPreTGE, { userBond: userBond }, index)), solanaAccount &&
|
|
78322
|
-
bondsToRender.SOL.map((bill) => {
|
|
78323
|
-
return jsx$2(UserBondRowSolana, { bill: bill }, bill.id);
|
|
78324
|
-
}), account &&
|
|
78325
|
-
bondsToRender.EVM.map((bill) => {
|
|
78326
|
-
return jsx$2(UserBondRow, { bill: bill }, bill.id);
|
|
78327
|
-
})] })) : inputValue !== '' || !chainFilterOption.includes('All Chains') ? (jsx$2(PlaceholderMonkey, { text: 'No results, change filters.' })) : userBondsFetched && (userBonds === null || userBonds === void 0 ? void 0 : userBonds.length) === 0 ? (jsx$2(PlaceholderMonkey, { text: `You do not own any ${account && solanaAccount ? 'EVM nor SOL' : account ? 'EVM' : 'SOL'} Bonds.` })) : (jsx$2(Flex$1, { className: "yourbonds-spinner", children: jsx$2(Spinner, { size: 100 }) })), account && !solanaAccount && (jsx$2(Flex$1, { sx: { width: '100%', mt: '5px' }, children: jsx$2(ConnectToSolanaCard, {}) })), solanaAccount && !account && (jsx$2(Flex$1, { sx: { width: '100%', mt: '5px' }, children: jsx$2(ConnectToEVMBanner, {}) }))] }));
|
|
78328
|
-
};
|
|
78329
|
-
|
|
78330
|
-
// This basically returns the 2 tags with the higher active bond count
|
|
78331
|
-
const useTopTags = (initialBondList) => {
|
|
78332
|
-
const SDKConfig = useSDKConfig();
|
|
78333
|
-
const chains = SDKConfig.chains;
|
|
78334
|
-
const bonds = initialBondList;
|
|
78335
|
-
const countTagsInBonds = (bonds) => {
|
|
78336
|
-
const tagCount = {};
|
|
78337
|
-
bonds === null || bonds === void 0 ? void 0 : bonds.forEach((bond) => {
|
|
78338
|
-
var _a;
|
|
78339
|
-
if (bond.soldOut)
|
|
78340
|
-
return;
|
|
78341
|
-
(_a = bond.tags) === null || _a === void 0 ? void 0 : _a.forEach((tag) => {
|
|
78342
|
-
if (tag in tagCount) {
|
|
78343
|
-
tagCount[tag] += 1;
|
|
78344
|
-
}
|
|
78345
|
-
else {
|
|
78346
|
-
tagCount[tag] = 1;
|
|
78347
|
-
}
|
|
78348
|
-
});
|
|
78349
|
-
});
|
|
78350
|
-
return tagCount;
|
|
78351
|
-
};
|
|
78352
|
-
const activeBonds = bonds === null || bonds === void 0 ? void 0 : bonds.filter((bond) => !bond.soldOut && (chains === null || chains === void 0 ? void 0 : chains.includes(bond.chainId)));
|
|
78353
|
-
const filteredBonds = activeBonds === null || activeBonds === void 0 ? void 0 : activeBonds.filter((bond) => {
|
|
78354
|
-
var _a, _b;
|
|
78355
|
-
if (SDKConfig.bondPartner) {
|
|
78356
|
-
return ((_a = bond === null || bond === void 0 ? void 0 : bond.bondPartner) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.bondPartner) === null || _b === void 0 ? void 0 : _b.toLowerCase());
|
|
78357
|
-
}
|
|
78358
|
-
else
|
|
78359
|
-
return true;
|
|
78360
|
-
});
|
|
78361
|
-
const countedTags = countTagsInBonds(filteredBonds);
|
|
78362
|
-
const sortedTagsArray = Object.entries(countedTags).sort((a, b) => b[1] - a[1]);
|
|
78363
|
-
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
78225
|
+
}, children: jsx$2(Svg, { icon: "more", width: "25px" }) }) }) })] }), jsxs("div", { className: "your-bonds-columns-container", children: [jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', 'none', 'none', 'none', 'flex'], width: '125px' } }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Claimable" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(claimableAmount, 3), jsxs("div", { className: "your-bonds-content-tokens-usd-amount", children: ["($", formatUSDNumber$1(claimableUSD), ")"] })] })] }), jsxs("div", { className: "your-bonds-content", children: [jsx$2("div", { className: "your-bonds-content-title", children: "Pending" }), jsxs("div", { className: "your-bonds-content-tokens-amount", children: [formatNumberSI(pendingAmount, 3), jsxs("div", { className: "your-bonds-content-tokens-usd-amount", children: ["($", formatUSDNumber$1(pendingUSD), ")"] })] })] }), jsx$2("div", { className: "your-bonds-content hide-mobile", children: vestingString }), jsx$2("div", { className: "your-bonds-column-button", children: jsx$2(PreTgeActions, { userBond: userBond }) })] })] }));
|
|
78364
78226
|
};
|
|
78365
78227
|
|
|
78366
78228
|
/**
|
|
@@ -81425,19 +81287,16 @@ const calculateBondsData = (queryClient) => __awaiter$9(void 0, void 0, void 0,
|
|
|
81425
81287
|
}, {});
|
|
81426
81288
|
try {
|
|
81427
81289
|
// First, we try to fetch from realtime API
|
|
81428
|
-
console.time('BondsData');
|
|
81429
81290
|
const [solBonds, evmResponse] = yield Promise.all([
|
|
81430
81291
|
yield fetchBondsData(types$1.ChainId.SOL, reducedBonds[types$1.ChainId.SOL], apiUrl, tokenPrices === null || tokenPrices === void 0 ? void 0 : tokenPrices[types$1.ChainId.SOL]),
|
|
81431
81292
|
yield axios.get(`${realTimeApiURL}/bonds`),
|
|
81432
81293
|
]);
|
|
81433
|
-
console.timeEnd('BondsData');
|
|
81434
81294
|
return [...solBonds, ...evmResponse.data.bonds];
|
|
81435
81295
|
}
|
|
81436
81296
|
catch (_a) {
|
|
81437
81297
|
// If realtime fails, we trigger the fallback strategy on the client
|
|
81438
|
-
console.timeEnd('BondsData');
|
|
81439
|
-
console.time('Fallback BondsData');
|
|
81440
81298
|
if (bondList) {
|
|
81299
|
+
console.time('Fallback BondsData');
|
|
81441
81300
|
const billData = yield Promise.all([
|
|
81442
81301
|
...chains.map((chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
81443
81302
|
var _a;
|
|
@@ -81454,11 +81313,183 @@ const calculateBondsData = (queryClient) => __awaiter$9(void 0, void 0, void 0,
|
|
|
81454
81313
|
console.timeEnd('Fallback BondsData');
|
|
81455
81314
|
return billData.flat();
|
|
81456
81315
|
}
|
|
81457
|
-
console.timeEnd('Fallback BondsData');
|
|
81458
81316
|
return [];
|
|
81459
81317
|
}
|
|
81460
81318
|
});
|
|
81461
81319
|
|
|
81320
|
+
const YourBonds = ({ showOnly }) => {
|
|
81321
|
+
useTokenPrices();
|
|
81322
|
+
useBondsData();
|
|
81323
|
+
// Hooks
|
|
81324
|
+
const SDKConfig = useSDKConfig();
|
|
81325
|
+
const { address: account } = useEVMAccount();
|
|
81326
|
+
const { publicKey: solanaAccount } = useSOLAccount();
|
|
81327
|
+
const { data: userBonds, isFetched: userBondsFetched } = useUserBonds();
|
|
81328
|
+
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
81329
|
+
const { data: preTGEUserBonds, isFetched: preTGEFetched } = useUserBondsPreTGE();
|
|
81330
|
+
const hasFetched = userBondsFetched && (preTGEFetched || !account);
|
|
81331
|
+
const preTGEBondsToRender = preTGEUserBonds === null || preTGEUserBonds === void 0 ? void 0 : preTGEUserBonds.filter((userBond) => {
|
|
81332
|
+
var _a, _b, _c, _d;
|
|
81333
|
+
if (!((_a = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _a === void 0 ? void 0 : _a.hasRedeemed)) {
|
|
81334
|
+
return parseFloat((_c = (_b = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _b === void 0 ? void 0 : _b.depositAmount) !== null && _c !== void 0 ? _c : '0') > 0;
|
|
81335
|
+
}
|
|
81336
|
+
else {
|
|
81337
|
+
return ((_d = userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData) === null || _d === void 0 ? void 0 : _d.payout) !== '0';
|
|
81338
|
+
}
|
|
81339
|
+
});
|
|
81340
|
+
// State
|
|
81341
|
+
const [sortConfig, setSortConfig] = useState({
|
|
81342
|
+
key: 'claimable',
|
|
81343
|
+
direction: 'desc',
|
|
81344
|
+
});
|
|
81345
|
+
const [inputValue, setInputValue] = useState('');
|
|
81346
|
+
const filterOptions = ['CLAIMABLE', 'ALL'];
|
|
81347
|
+
const [filterOption, setFilterOption] = useState(filterOptions[0]);
|
|
81348
|
+
const handleSort = (key) => {
|
|
81349
|
+
let direction = 'desc';
|
|
81350
|
+
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'desc') {
|
|
81351
|
+
direction = 'asc';
|
|
81352
|
+
}
|
|
81353
|
+
setSortConfig({ key, direction });
|
|
81354
|
+
};
|
|
81355
|
+
const bondsToRender = useMemo(() => {
|
|
81356
|
+
if (!userBonds)
|
|
81357
|
+
return [];
|
|
81358
|
+
let bondsToReturn = userBonds;
|
|
81359
|
+
// Handle Filtering //
|
|
81360
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81361
|
+
var _a;
|
|
81362
|
+
return ((_a = bond.bond) === null || _a === void 0 ? void 0 : _a.onlyPartner) ? bond.bond.bondPartner === SDKConfig.bondPartner : true;
|
|
81363
|
+
});
|
|
81364
|
+
if (SDKConfig.bondPartner) {
|
|
81365
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81366
|
+
var _a;
|
|
81367
|
+
return ((_a = bond.bond) === null || _a === void 0 ? void 0 : _a.bondPartner) === SDKConfig.bondPartner;
|
|
81368
|
+
});
|
|
81369
|
+
}
|
|
81370
|
+
// Filter Single Token View
|
|
81371
|
+
if (showOnly) {
|
|
81372
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81373
|
+
var _a, _b, _c;
|
|
81374
|
+
return ((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.earnToken) === null || _b === void 0 ? void 0 : _b.symbol) === null || _c === void 0 ? void 0 : _c.toLowerCase()) === showOnly.toLowerCase();
|
|
81375
|
+
});
|
|
81376
|
+
}
|
|
81377
|
+
// Filter by search query
|
|
81378
|
+
if (inputValue !== '') {
|
|
81379
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81380
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
81381
|
+
return [
|
|
81382
|
+
(_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.showcaseTokenName) === null || _b === void 0 ? void 0 : _b.toLowerCase(),
|
|
81383
|
+
(_e = (_d = (_c = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _c === void 0 ? void 0 : _c.earnToken) === null || _d === void 0 ? void 0 : _d.symbol) === null || _e === void 0 ? void 0 : _e.toLowerCase(),
|
|
81384
|
+
(_h = (_g = (_f = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _f === void 0 ? void 0 : _f.lpToken) === null || _g === void 0 ? void 0 : _g.symbol) === null || _h === void 0 ? void 0 : _h.toLowerCase(),
|
|
81385
|
+
].some((property) => property === null || property === void 0 ? void 0 : property.includes(inputValue.toLowerCase()));
|
|
81386
|
+
});
|
|
81387
|
+
}
|
|
81388
|
+
// Filter by chain selector
|
|
81389
|
+
if (!chainFilterOption.includes('All Chains')) {
|
|
81390
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81391
|
+
var _a, _b, _c;
|
|
81392
|
+
return chainFilterOption.includes((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.chainId) === null || _b === void 0 ? void 0 : _b.toString()) !== null && _c !== void 0 ? _c : '');
|
|
81393
|
+
});
|
|
81394
|
+
}
|
|
81395
|
+
// Filter by filter option (claimable or all buttons)
|
|
81396
|
+
if (filterOption === 'CLAIMABLE') {
|
|
81397
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81398
|
+
var _a;
|
|
81399
|
+
if ((_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff) {
|
|
81400
|
+
return bond.payout !== '0';
|
|
81401
|
+
}
|
|
81402
|
+
return bond.pendingRewards !== '0';
|
|
81403
|
+
});
|
|
81404
|
+
}
|
|
81405
|
+
// Handle sorting //
|
|
81406
|
+
if (sortConfig !== null) {
|
|
81407
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.sort((a, b) => {
|
|
81408
|
+
let aValue, bValue;
|
|
81409
|
+
if (sortConfig.key === 'claimable') {
|
|
81410
|
+
aValue = claimableUSD(a);
|
|
81411
|
+
bValue = claimableUSD(b);
|
|
81412
|
+
}
|
|
81413
|
+
else if (sortConfig.key === 'pending') {
|
|
81414
|
+
aValue = pendingUSD(a);
|
|
81415
|
+
bValue = pendingUSD(b);
|
|
81416
|
+
}
|
|
81417
|
+
else if (sortConfig.key === 'terms') {
|
|
81418
|
+
const aRemainingTime = vestingTimeRemaining(a).days * 24 * 3600 +
|
|
81419
|
+
vestingTimeRemaining(a).hours * 3600 +
|
|
81420
|
+
vestingTimeRemaining(a).minutes * 60;
|
|
81421
|
+
const bRemainingTime = vestingTimeRemaining(b).days * 24 * 3600 +
|
|
81422
|
+
vestingTimeRemaining(b).hours * 3600 +
|
|
81423
|
+
vestingTimeRemaining(b).minutes * 60;
|
|
81424
|
+
aValue = aRemainingTime;
|
|
81425
|
+
bValue = bRemainingTime;
|
|
81426
|
+
}
|
|
81427
|
+
else {
|
|
81428
|
+
aValue = a[sortConfig.key];
|
|
81429
|
+
bValue = b[sortConfig.key];
|
|
81430
|
+
}
|
|
81431
|
+
if (aValue < bValue) {
|
|
81432
|
+
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
81433
|
+
}
|
|
81434
|
+
if (aValue > bValue) {
|
|
81435
|
+
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
81436
|
+
}
|
|
81437
|
+
return 0;
|
|
81438
|
+
});
|
|
81439
|
+
}
|
|
81440
|
+
return bondsToReturn;
|
|
81441
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
81442
|
+
}, [userBonds, sortConfig, inputValue, chainFilterOption, filterOption, userBondsFetched]);
|
|
81443
|
+
const handleFilterOption = useCallback((newOption) => {
|
|
81444
|
+
setFilterOption(newOption);
|
|
81445
|
+
}, []);
|
|
81446
|
+
const hasBonds = useMemo(() => {
|
|
81447
|
+
return (bondsToRender && bondsToRender.length > 0) || !!(preTGEBondsToRender === null || preTGEBondsToRender === void 0 ? void 0 : preTGEBondsToRender.length);
|
|
81448
|
+
}, [bondsToRender, preTGEBondsToRender]);
|
|
81449
|
+
return (jsxs(Flex$1, { className: "yourbonds table-container", children: [!showOnly && (jsx$2(YourBondsMenu, { chainFilterOption: chainFilterOption, setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleFilterOption, setInputValue: setInputValue, inputValue: inputValue, handleSort: handleSort })), !account && !solanaAccount ? (jsx$2(PlaceholderMonkey, { text: 'You are not connected.' })) : hasBonds && hasFetched ? (jsxs(Fragment$1, { children: [preTGEBondsToRender === null || preTGEBondsToRender === void 0 ? void 0 : preTGEBondsToRender.map((userBond, index) => jsx$2(UserBondRowPreTGE, { userBond: userBond }, index)), bondsToRender.map((bond) => {
|
|
81450
|
+
var _a;
|
|
81451
|
+
if (((_a = bond.bond) === null || _a === void 0 ? void 0 : _a.chainId) === types$1.ChainId.SOL)
|
|
81452
|
+
return jsx$2(UserBondRowSolana, { bill: bond }, `${bond.billNftAddress}-${bond.id}`);
|
|
81453
|
+
return jsx$2(UserBondRow, { bill: bond }, bond.id);
|
|
81454
|
+
})] })) : inputValue !== '' || !chainFilterOption.includes('All Chains') ? (jsx$2(PlaceholderMonkey, { text: 'No results, change filters.' })) : userBondsFetched && (userBonds === null || userBonds === void 0 ? void 0 : userBonds.length) === 0 ? (jsx$2(PlaceholderMonkey, { text: `You do not own any ${account && solanaAccount ? 'EVM nor SOL' : account ? 'EVM' : 'SOL'} Bonds.` })) : (jsx$2(Flex$1, { className: "yourbonds-spinner", children: jsx$2(Spinner, { size: 100 }) })), account && !solanaAccount && (jsx$2(Flex$1, { sx: { width: '100%', mt: '5px' }, children: jsx$2(ConnectToSolanaCard, {}) })), solanaAccount && !account && (jsx$2(Flex$1, { sx: { width: '100%', mt: '5px' }, children: jsx$2(ConnectToEVMBanner, {}) }))] }));
|
|
81455
|
+
};
|
|
81456
|
+
|
|
81457
|
+
// This basically returns the 2 tags with the higher active bond count
|
|
81458
|
+
const useTopTags = (initialBondList) => {
|
|
81459
|
+
const SDKConfig = useSDKConfig();
|
|
81460
|
+
const chains = SDKConfig.chains;
|
|
81461
|
+
const bonds = initialBondList;
|
|
81462
|
+
const countTagsInBonds = (bonds) => {
|
|
81463
|
+
const tagCount = {};
|
|
81464
|
+
bonds === null || bonds === void 0 ? void 0 : bonds.forEach((bond) => {
|
|
81465
|
+
var _a;
|
|
81466
|
+
if (bond.soldOut)
|
|
81467
|
+
return;
|
|
81468
|
+
(_a = bond.tags) === null || _a === void 0 ? void 0 : _a.forEach((tag) => {
|
|
81469
|
+
if (tag in tagCount) {
|
|
81470
|
+
tagCount[tag] += 1;
|
|
81471
|
+
}
|
|
81472
|
+
else {
|
|
81473
|
+
tagCount[tag] = 1;
|
|
81474
|
+
}
|
|
81475
|
+
});
|
|
81476
|
+
});
|
|
81477
|
+
return tagCount;
|
|
81478
|
+
};
|
|
81479
|
+
const activeBonds = bonds === null || bonds === void 0 ? void 0 : bonds.filter((bond) => !bond.soldOut && (chains === null || chains === void 0 ? void 0 : chains.includes(bond.chainId)));
|
|
81480
|
+
const filteredBonds = activeBonds === null || activeBonds === void 0 ? void 0 : activeBonds.filter((bond) => {
|
|
81481
|
+
var _a, _b;
|
|
81482
|
+
if (SDKConfig.bondPartner) {
|
|
81483
|
+
return ((_a = bond === null || bond === void 0 ? void 0 : bond.bondPartner) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === ((_b = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.bondPartner) === null || _b === void 0 ? void 0 : _b.toLowerCase());
|
|
81484
|
+
}
|
|
81485
|
+
else
|
|
81486
|
+
return true;
|
|
81487
|
+
});
|
|
81488
|
+
const countedTags = countTagsInBonds(filteredBonds);
|
|
81489
|
+
const sortedTagsArray = Object.entries(countedTags).sort((a, b) => b[1] - a[1]);
|
|
81490
|
+
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
81491
|
+
};
|
|
81492
|
+
|
|
81462
81493
|
function adjustDecimals(numStr) {
|
|
81463
81494
|
const parts = numStr.split('.');
|
|
81464
81495
|
if (parts.length < 2) {
|
|
@@ -83447,7 +83478,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
83447
83478
|
const [txHash, setTxHash] = useState('');
|
|
83448
83479
|
const { data: allowance, refetch } = useAllowance(currency, spender, account, chainId);
|
|
83449
83480
|
const { writeContractAsync } = useWriteContract();
|
|
83450
|
-
const { isLoading: isConfirming, isSuccess: isConfirmed } =
|
|
83481
|
+
const { isLoading: isConfirming, isSuccess: isConfirmed } = useMonitorTx(txHash, chainId);
|
|
83451
83482
|
const { addToastError } = usePopups();
|
|
83452
83483
|
const confirmingTxOnChain = isConfirming && !isConfirmed;
|
|
83453
83484
|
useEffect(() => {
|
|
@@ -83748,7 +83779,7 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
83748
83779
|
const { switchChain } = useSwitchChain();
|
|
83749
83780
|
const inputToken = useTokenFromZapList(inputTokenString, chainId);
|
|
83750
83781
|
const { data: hash, sendTransactionAsync } = useSendTransaction();
|
|
83751
|
-
const { isLoading: isConfirming } =
|
|
83782
|
+
const { isLoading: isConfirming } = useMonitorTx(hash, chainId);
|
|
83752
83783
|
const { addToastError } = usePopups();
|
|
83753
83784
|
// Modals
|
|
83754
83785
|
const [onOpenSlippageModal] = useModal(jsx$2(SlippageModal, {}));
|
|
@@ -84236,30 +84267,6 @@ const BonusComponent = ({ trueBondPrices, minTier, bonus, airdropTooltip, toolti
|
|
|
84236
84267
|
}, children: [(_a = highestPointsElement === null || highestPointsElement === void 0 ? void 0 : highestPointsElement.bonusWithFee) === null || _a === void 0 ? void 0 : _a.toFixed(2), "%"] })] })] }) })) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : baseTrueBondPrice ? (jsx$2(Flex, { sx: { alignItems: 'center' }, className: `${getDiscountColor(+(baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee))}`, children: (baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) > 0 ? (`${(_b = baseTrueBondPrice === null || baseTrueBondPrice === void 0 ? void 0 : baseTrueBondPrice.bonusWithFee) === null || _b === void 0 ? void 0 : _b.toFixed(2)}%`) : (jsx$2(Flex, { sx: { height: '20px', width: '20px' }, children: jsx$2(TooltipBubble, { body: 'This bond is currently on cooldown and has no bonus. Please check back soon.', width: "205px", placement: "bottomRight", transformTip: "translate(10%, 0%)", children: jsx$2(Svg, { icon: "Timer", width: "20px", color: "#81CFEA" }) }) })) })) : (jsxs(Flex, { sx: { color: bonus && 'success', alignItems: 'center' }, children: [bonus || '-', airdropTooltip && (jsx$2(TooltipBubble, { body: jsx$2(Fragment$1, { children: airdropTooltip }), width: "230px", placement: isMobile ? 'bottomRight' : 'bottomLeft', transformTip: isMobile ? 'translate(9%, 6%)' : 'translate(-3%, 6%)', children: jsx$2(Flex, { sx: { width: '20px', height: '20px', alignItems: 'center', ml: '5px' }, children: jsx$2("img", { src: "https://res.cloudinary.com/dswmrqgwy/image/upload/v1750345773/airdrop_qvh4ow.png", alt: "airdrop-img", style: { width: '20px', height: '20px' } }) }) }))] })) }));
|
|
84237
84268
|
};
|
|
84238
84269
|
|
|
84239
|
-
const ProgressBar = ({ value }) => {
|
|
84240
|
-
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: {
|
|
84241
|
-
width: `${value <= 3 ? 3 : value}%`,
|
|
84242
|
-
} }) }) }));
|
|
84243
|
-
};
|
|
84244
|
-
|
|
84245
|
-
const styles$9 = {
|
|
84246
|
-
titleText: {
|
|
84247
|
-
opacity: 0.6,
|
|
84248
|
-
fontSize: '12px',
|
|
84249
|
-
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
84250
|
-
fontWeight: 400,
|
|
84251
|
-
},
|
|
84252
|
-
skeleton: {
|
|
84253
|
-
width: ['45px', '45px', '60px'],
|
|
84254
|
-
maxHeight: '18px',
|
|
84255
|
-
minHeight: '18px',
|
|
84256
|
-
}};
|
|
84257
|
-
|
|
84258
|
-
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
84259
|
-
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 }) }))] }));
|
|
84260
|
-
};
|
|
84261
|
-
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
84262
|
-
|
|
84263
84270
|
const BondCards = ({ bondData }) => {
|
|
84264
84271
|
var _a, _b, _c;
|
|
84265
84272
|
const isMobile = useIsMobile();
|
|
@@ -84651,7 +84658,7 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
84651
84658
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
84652
84659
|
}, [hasToSwitchChain, hasToApprove, txCallback]);
|
|
84653
84660
|
// Close modal if a hash is found. Final Step
|
|
84654
|
-
const { data: txReceipt, isSuccess, isLoading: verifyingTx } =
|
|
84661
|
+
const { data: txReceipt, isSuccess, isLoading: verifyingTx } = useMonitorTx(buyTxHash, txChain);
|
|
84655
84662
|
useEffect(() => {
|
|
84656
84663
|
if (buyTxHash && txReceipt) {
|
|
84657
84664
|
if (isSuccess) {
|
|
@@ -84762,7 +84769,7 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
|
|
|
84762
84769
|
// Loading State
|
|
84763
84770
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
84764
84771
|
const { addToastError } = usePopups();
|
|
84765
|
-
const { isLoading: isConfirming, isSuccess: isConfirmed } =
|
|
84772
|
+
const { isLoading: isConfirming, isSuccess: isConfirmed } = useMonitorTx(buyTxHash, userChainId);
|
|
84766
84773
|
const load = loadingTx || (isConfirming && !isConfirmed);
|
|
84767
84774
|
// State Handlers
|
|
84768
84775
|
const handleCurrencySelect = useCallback((newInputToken) => {
|
|
@@ -85070,7 +85077,7 @@ const getTokenBalance = (currency, account) => __awaiter$9(void 0, void 0, void
|
|
|
85070
85077
|
}
|
|
85071
85078
|
});
|
|
85072
85079
|
|
|
85073
|
-
const
|
|
85080
|
+
const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId, }) => {
|
|
85074
85081
|
var _a, _b, _c, _d, _e, _f;
|
|
85075
85082
|
const SDKConfig = useSDKConfig();
|
|
85076
85083
|
// Hooks
|
|
@@ -85104,7 +85111,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
85104
85111
|
setInputTokenString(newInputToken);
|
|
85105
85112
|
}, []);
|
|
85106
85113
|
const handleBuyCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
85107
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
85114
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
85108
85115
|
if (!accountSolana || !bondData || !inputValue || !inputToken || !bondData)
|
|
85109
85116
|
return;
|
|
85110
85117
|
track({
|
|
@@ -85195,39 +85202,49 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
85195
85202
|
// Sign tx
|
|
85196
85203
|
transaction.partialSign(nftMint);
|
|
85197
85204
|
const signedTx = yield (signTransaction === null || signTransaction === void 0 ? void 0 : signTransaction(transaction));
|
|
85198
|
-
//
|
|
85205
|
+
// Sends tx, generates hash
|
|
85199
85206
|
const txId = yield connection.sendRawTransaction(signedTx.serialize(), {
|
|
85200
85207
|
skipPreflight: false,
|
|
85201
85208
|
preflightCommitment: 'confirmed',
|
|
85202
85209
|
});
|
|
85210
|
+
// awaits hash confirmation on chain - commitment "confirmed"
|
|
85203
85211
|
yield connection.confirmTransaction({
|
|
85204
85212
|
signature: txId,
|
|
85205
85213
|
blockhash,
|
|
85206
85214
|
lastValidBlockHeight,
|
|
85207
85215
|
}, 'confirmed');
|
|
85208
|
-
|
|
85209
|
-
|
|
85210
|
-
|
|
85211
|
-
}
|
|
85216
|
+
axios
|
|
85217
|
+
.post(`${(_d = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _d === void 0 ? void 0 : _d.apiV2}/bills/solana/ingest`, {
|
|
85218
|
+
signature: txId,
|
|
85219
|
+
})
|
|
85220
|
+
.catch((e) => {
|
|
85221
|
+
console.error(e);
|
|
85222
|
+
});
|
|
85212
85223
|
track({
|
|
85213
85224
|
event: 'bond',
|
|
85214
85225
|
chain: bondChain,
|
|
85215
85226
|
data: {
|
|
85216
85227
|
cat: 'lp-buy',
|
|
85217
|
-
type: (
|
|
85228
|
+
type: (_e = bondData === null || bondData === void 0 ? void 0 : bondData.billType) !== null && _e !== void 0 ? _e : '',
|
|
85218
85229
|
typedValue: inputValue,
|
|
85219
|
-
principalToken: (
|
|
85220
|
-
earnToken: (
|
|
85221
|
-
address: remove0xPrefix((
|
|
85222
|
-
usdAmount: parseFloat(inputValue) * ((
|
|
85230
|
+
principalToken: (_f = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken.symbol) !== null && _f !== void 0 ? _f : '',
|
|
85231
|
+
earnToken: (_g = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol) !== null && _g !== void 0 ? _g : '',
|
|
85232
|
+
address: remove0xPrefix((_h = bondData === null || bondData === void 0 ? void 0 : bondData.contractAddress) === null || _h === void 0 ? void 0 : _h[bondData.chainId]),
|
|
85233
|
+
usdAmount: parseFloat(inputValue) * ((_j = inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) !== null && _j !== void 0 ? _j : 0),
|
|
85223
85234
|
},
|
|
85224
85235
|
});
|
|
85236
|
+
console.time('asd');
|
|
85237
|
+
// waits 3 seconds before triggering after-purchase flow
|
|
85238
|
+
yield new Promise((resolve) => setTimeout(resolve, 3000));
|
|
85239
|
+
console.timeEnd('asd');
|
|
85240
|
+
addToastSuccess(txId, bondChain);
|
|
85241
|
+
setBillId === null || setBillId === void 0 ? void 0 : setBillId(nftMint.publicKey.toString());
|
|
85225
85242
|
}
|
|
85226
85243
|
catch (error) {
|
|
85227
85244
|
console.error('Error during bond purchase:', error);
|
|
85228
85245
|
addToastError((error === null || error === void 0 ? void 0 : error.message) || 'Unknown error');
|
|
85229
85246
|
reportError$1({
|
|
85230
|
-
apiUrl: (
|
|
85247
|
+
apiUrl: (_k = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _k === void 0 ? void 0 : _k.apiV2,
|
|
85231
85248
|
error: error.message,
|
|
85232
85249
|
extraInfo: { type: 'solanaBuyBond', error: error.message },
|
|
85233
85250
|
chainId: bondChain,
|
|
@@ -85288,7 +85305,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
85288
85305
|
};
|
|
85289
85306
|
|
|
85290
85307
|
const BuyBondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond, setBillId, }) => {
|
|
85291
|
-
return (jsx$2(Modal, { className: "modal", onDismiss: onDismiss, sx: { width: '400px', maxWidth: '700px', mt: '-10px', p: '0px' }, children: bondChain === types$1.ChainId.SOL ? (jsx$2(
|
|
85308
|
+
return (jsx$2(Modal, { className: "modal", onDismiss: onDismiss, sx: { width: '400px', maxWidth: '700px', mt: '-10px', p: '0px' }, children: bondChain === types$1.ChainId.SOL ? (jsx$2(BuyComponentSolana, { onDismiss: onDismiss, bondAddress: bondAddress, bondChain: bondChain, setBillId: setBillId })) : (jsx$2(BuyComponent, { onDismiss: onDismiss, bondAddress: bondAddress, bondChain: bondChain, handlePurchasedBond: handlePurchasedBond })) }));
|
|
85292
85309
|
};
|
|
85293
85310
|
|
|
85294
85311
|
/*
|
|
@@ -85297,21 +85314,23 @@ const BuyBondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
|
|
|
85297
85314
|
* a monitor of the txhash and the search for a bill Id. Finally, if a billId is found the YourBondModal will be shown.
|
|
85298
85315
|
* */
|
|
85299
85316
|
const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
85300
|
-
var _a, _b
|
|
85301
|
-
|
|
85317
|
+
var _a, _b;
|
|
85318
|
+
// State
|
|
85302
85319
|
const [billId, setBillId] = useState('');
|
|
85303
85320
|
const [buyTxHash, setBuyTxHash] = useState('');
|
|
85304
|
-
|
|
85321
|
+
// Hooks
|
|
85305
85322
|
const { data: bondsData } = useBondsData();
|
|
85306
|
-
const
|
|
85307
|
-
|
|
85308
|
-
|
|
85309
|
-
|
|
85310
|
-
|
|
85311
|
-
})) === null || _a === void 0 ? void 0 : _a.billNnftAddress) === null || _b === void 0 ? void 0 : _b[bondChain]
|
|
85312
|
-
: '';
|
|
85313
|
-
if (txReceipt && billNftAddress) {
|
|
85323
|
+
const { refetch } = useUserBonds(true);
|
|
85324
|
+
const locationPath = window.location.pathname;
|
|
85325
|
+
const { data: txReceipt } = useMonitorTx(buyTxHash, bondChain);
|
|
85326
|
+
// EVM - Look for billId on tx logs
|
|
85327
|
+
if (txReceipt) {
|
|
85314
85328
|
try {
|
|
85329
|
+
const billNftAddress = (_b = (_a = bondsData === null || bondsData === void 0 ? void 0 : bondsData.find((bond) => {
|
|
85330
|
+
var _a, _b;
|
|
85331
|
+
return ((_b = (_a = bond === null || bond === void 0 ? void 0 : bond.contractAddress) === null || _a === void 0 ? void 0 : _a[bond.chainId]) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()) &&
|
|
85332
|
+
bond.chainId === bondChain;
|
|
85333
|
+
})) === null || _a === void 0 ? void 0 : _a.billNnftAddress) === null || _b === void 0 ? void 0 : _b[bondChain];
|
|
85315
85334
|
const { logs } = txReceipt;
|
|
85316
85335
|
const findBillNftLog = logs.find((log) => log.address.toLowerCase() === (billNftAddress === null || billNftAddress === void 0 ? void 0 : billNftAddress.toLowerCase()));
|
|
85317
85336
|
const getBillNftIndex = findBillNftLog === null || findBillNftLog === void 0 ? void 0 : findBillNftLog.topics[findBillNftLog.topics.length - 1];
|
|
@@ -85325,24 +85344,19 @@ const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
85325
85344
|
console.log(e);
|
|
85326
85345
|
}
|
|
85327
85346
|
}
|
|
85328
|
-
|
|
85329
|
-
const
|
|
85330
|
-
var _a, _b, _c, _d, _e;
|
|
85331
|
-
return bond.id === billId &&
|
|
85332
|
-
((_d = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.contractAddress) === null || _b === void 0 ? void 0 : _b[(_c = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _c === void 0 ? void 0 : _c.chainId]) === null || _d === void 0 ? void 0 : _d.toLowerCase()) === bondAddress.toLowerCase() &&
|
|
85333
|
-
((_e = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _e === void 0 ? void 0 : _e.chainId) === bondChain;
|
|
85334
|
-
});
|
|
85347
|
+
// Trigger refetch once txs are confirmed
|
|
85348
|
+
const hasRefetched = useRef(false);
|
|
85335
85349
|
useEffect(() => {
|
|
85336
|
-
if (
|
|
85337
|
-
|
|
85338
|
-
|
|
85339
|
-
console.log('Trigger');
|
|
85350
|
+
if (!hasRefetched.current) {
|
|
85351
|
+
if (billId) {
|
|
85352
|
+
console.log('Trigger user bonds refetch');
|
|
85340
85353
|
refetch();
|
|
85341
|
-
|
|
85354
|
+
hasRefetched.current = true;
|
|
85355
|
+
}
|
|
85342
85356
|
}
|
|
85343
85357
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
85344
85358
|
}, [billId]);
|
|
85345
|
-
return billId ? (
|
|
85359
|
+
return billId ? (bondChain === types$1.ChainId.SOL ? (jsx$2(YourBondsModalSolana, { billId: billId, onDismiss: onDismiss })) : (jsx$2(YourBondsModal, { billId: billId, onDismiss: onDismiss }))) : (jsx$2(BuyBondModal, { bondAddress: bondAddress, bondChain: bondChain, handlePurchasedBond: setBuyTxHash, setBillId: setBillId, onDismiss: () => {
|
|
85346
85360
|
window.history.pushState({}, '', `${locationPath !== '/bonds' ? locationPath : '/bonds'}`);
|
|
85347
85361
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
85348
85362
|
} }));
|
|
@@ -85616,7 +85630,7 @@ const ModalHandlerPreTGE = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
85616
85630
|
const [inputAmount, setInputAmount] = useState('');
|
|
85617
85631
|
const [buyTxHash, setBuyTxHash] = useState('');
|
|
85618
85632
|
const [bond, setBond] = useState();
|
|
85619
|
-
const { data: txReceipt, isSuccess } =
|
|
85633
|
+
const { data: txReceipt, isSuccess } = useMonitorTx(buyTxHash, bondChain);
|
|
85620
85634
|
useEffect(() => {
|
|
85621
85635
|
if (inputAmount && bonds && txReceipt && isSuccess) {
|
|
85622
85636
|
const bond = bonds.find((bond) => {
|
|
@@ -86198,6 +86212,7 @@ const Bonds = () => {
|
|
|
86198
86212
|
useHotBonds();
|
|
86199
86213
|
const { favTokens } = useFavoriteTokens();
|
|
86200
86214
|
const { data: bondData, refetch } = useBondsData();
|
|
86215
|
+
// useUserBonds()
|
|
86201
86216
|
const { data: allBonds } = useBondsList();
|
|
86202
86217
|
const { data: allPreBonds } = useBondsListPreTGE();
|
|
86203
86218
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
@@ -86297,7 +86312,7 @@ const Bonds = () => {
|
|
|
86297
86312
|
}
|
|
86298
86313
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
86299
86314
|
}, [(_a = Object.keys(tokenPrices !== null && tokenPrices !== void 0 ? tokenPrices : {})) === null || _a === void 0 ? void 0 : _a.length, bondData === null || bondData === void 0 ? void 0 : bondData.length, refetch]);
|
|
86300
|
-
return (jsxs(Flex
|
|
86315
|
+
return (jsxs(Flex, { className: "bonds-container", children: [jsx$2(CheckUrl, {}), jsx$2(BondsMenu, { searchQuery: searchQuery, setSearchQuery: setSearchQuery, setChainFilterOption: setChainFilterOption, chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], filterOptions: filterOptions, filterOption: filterOption, setFilterOption: handleChangeFilterOption, onSort: handleSortOptions }), SDKConfig.useHotBonds && !SDKConfig.bondPartner && jsx$2(BuyAgainRow, {}), (billsToRender === null || billsToRender === void 0 ? void 0 : billsToRender.length) > 0 ? (jsx$2(BondRowsByChain, { bonds: billsToRender, hideTitles: searchQuery !== '' || filterOption !== 'ALL', showSolSkeleton: chainFilterOption.includes('All Chains') || chainFilterOption.includes(types$1.ChainId.SOL.toString()) })) : searchQuery || !chainFilterOption.includes('All Chains') ? (jsx$2(PlaceholderMonkey, { text: 'No results' })) : filterOption === 'FAVORITES' ? (jsxs(Flex, { sx: {
|
|
86301
86316
|
width: '100%',
|
|
86302
86317
|
height: '300px',
|
|
86303
86318
|
background: 'white2',
|
|
@@ -86306,7 +86321,7 @@ const Bonds = () => {
|
|
|
86306
86321
|
alignItems: 'center',
|
|
86307
86322
|
flexDirection: 'column',
|
|
86308
86323
|
mt: '10px',
|
|
86309
|
-
}, children: [jsx$2(Svg, { icon: "StarFilled", width: 75, height: 75 }), jsx$2(Flex
|
|
86324
|
+
}, children: [jsx$2(Svg, { icon: "StarFilled", width: 75, height: 75 }), jsx$2(Flex, { sx: { mt: '10px' }, children: `You don't have any Favorite Bonds yet!` }), jsx$2(Flex, { sx: { fontSize: '12px', fontWeight: 400, color: 'textDisabledButton', mt: '10px' }, children: `Click on the 'star' or 'fire' icon to add Bonds to the list.` })] })) : (jsx$2(LoadingSkeleton, {})), SDKConfig.useHotBonds && jsx$2(RecommendationCards$1, {}), jsx$2(Flex, { sx: { width: '100%', justifyContent: 'center', my: '15px' }, children: jsx$2("img", { src: "https://res.cloudinary.com/dswmrqgwy/image/upload/v1741643990/poweredbyapebondsdk_cxiouj.png", alt: "powered-by-apebond", style: { width: '200px', height: 'auto' } }) })] }));
|
|
86310
86325
|
};
|
|
86311
86326
|
|
|
86312
86327
|
var BondsViewOptions$1;
|
|
@@ -103749,4 +103764,4 @@ const SingleBondWithProviders = (props) => {
|
|
|
103749
103764
|
};
|
|
103750
103765
|
|
|
103751
103766
|
var ChainId = types$1.ChainId;
|
|
103752
|
-
export { BLOCK_EXPLORER, BondsWithProviders as Bonds, BuyBondModalWithProviders as BuyBondModal, ChainId, FullBondsViewWithProviders as FullBondsView, ProjectViewWithProviders as ProjectView, SingleBondWithProviders as SingleBond, YourBondsWithProviders as YourBonds, generateImageFromTemplate, useSDKConfig, useTokenPrices };
|
|
103767
|
+
export { BLOCK_EXPLORER, BondsWithProviders as Bonds, BuyBondModalWithProviders as BuyBondModal, ChainId, FullBondsViewWithProviders as FullBondsView, ProjectViewWithProviders as ProjectView, SingleBondWithProviders as SingleBond, YourBondsWithProviders as YourBonds, generateImageFromTemplate, useCurrencyBalance, useSDKConfig, useTokenPrices };
|