@ape.swap/bonds-sdk 4.1.0-test.1 → 4.1.0-test.10
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 +475 -470
- package/dist/state/bonds/useBondNFTData.d.ts +3 -0
- 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,14 +65209,15 @@ 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
65219
|
console.time('PriceGetter');
|
|
65211
|
-
const prices = yield getTokenPrices(priceApi);
|
|
65220
|
+
const prices = yield getTokenPrices(priceApi, apiv2);
|
|
65212
65221
|
console.timeEnd('PriceGetter');
|
|
65213
65222
|
return prices;
|
|
65214
65223
|
}),
|
|
@@ -65217,14 +65226,14 @@ function useTokenPrices() {
|
|
|
65217
65226
|
refetchOnWindowFocus: false,
|
|
65218
65227
|
});
|
|
65219
65228
|
}
|
|
65220
|
-
const getTokenPrices = (priceApi) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
65229
|
+
const getTokenPrices = (priceApi, apiv2) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
65221
65230
|
try {
|
|
65222
65231
|
const response = yield axios.get(`${priceApi}`);
|
|
65223
65232
|
return response.data;
|
|
65224
65233
|
}
|
|
65225
65234
|
catch (error) {
|
|
65226
65235
|
reportError$1({
|
|
65227
|
-
apiUrl:
|
|
65236
|
+
apiUrl: apiv2,
|
|
65228
65237
|
error,
|
|
65229
65238
|
extraInfo: { type: 'getTokenPrices', error },
|
|
65230
65239
|
});
|
|
@@ -65254,7 +65263,7 @@ const BOND_PRICING_DISCRIMINATOR = new Uint8Array([61, 208, 225, 148, 202, 31, 3
|
|
|
65254
65263
|
const BOND_TERM_DISCRIMINATOR = new Uint8Array([45, 207, 18, 171, 171, 222, 242, 107]);
|
|
65255
65264
|
// Instructions discriminators
|
|
65256
65265
|
const DEPOSIT_DISCRIMINATOR = buffer.Buffer.from([242, 35, 198, 137, 82, 225, 242, 182]);
|
|
65257
|
-
const CLAIM_DISCRIMINATOR
|
|
65266
|
+
const CLAIM_DISCRIMINATOR = buffer.Buffer.from([62, 198, 214, 193, 213, 159, 108, 210]);
|
|
65258
65267
|
const CLAIMABLE_PAYOUT_DISCRIMINATOR = buffer.Buffer.from([180, 245, 240, 160, 170, 121, 123, 10]);
|
|
65259
65268
|
buffer.Buffer.from([105, 2, 40, 104, 17, 101, 241, 72]);
|
|
65260
65269
|
// PDA constants
|
|
@@ -65267,11 +65276,11 @@ const FEE_PAYOUT_PDA_PROGRAM = new PublicKey(buffer.Buffer.from([
|
|
|
65267
65276
|
123, 216, 219, 233, 248, 89,
|
|
65268
65277
|
]));
|
|
65269
65278
|
// Common constants
|
|
65270
|
-
const COMMON_CONST_SEED
|
|
65279
|
+
const COMMON_CONST_SEED = buffer.Buffer.from([
|
|
65271
65280
|
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
65281
|
140, 245, 133, 126, 255, 0, 169,
|
|
65273
65282
|
]);
|
|
65274
|
-
const COMMON_PDA_PROGRAM
|
|
65283
|
+
const COMMON_PDA_PROGRAM = new PublicKey(buffer.Buffer.from([
|
|
65275
65284
|
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
65285
|
123, 216, 219, 233, 248, 89,
|
|
65277
65286
|
]));
|
|
@@ -65471,7 +65480,7 @@ function getBondPricingAccountSolana(accountAddresses) {
|
|
|
65471
65480
|
|
|
65472
65481
|
function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
|
|
65473
65482
|
return __awaiter$9(this, void 0, void 0, function* () {
|
|
65474
|
-
var _a, _b, _c, _d, _e;
|
|
65483
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
65475
65484
|
if (!user)
|
|
65476
65485
|
return [];
|
|
65477
65486
|
try {
|
|
@@ -65502,7 +65511,8 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
|
|
|
65502
65511
|
const bondIssuancePda = new PublicKey(bond.contractAddress[types$1.ChainId.SOL]);
|
|
65503
65512
|
const userBills = [];
|
|
65504
65513
|
const collection = bond.billNnftAddress[types$1.ChainId.SOL];
|
|
65505
|
-
const
|
|
65514
|
+
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;
|
|
65515
|
+
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
65516
|
const userAssets = allUserAssets.filter((asset) => {
|
|
65507
65517
|
var _a;
|
|
65508
65518
|
return asset.authorities[0].address.toLowerCase() === ((_a = bond.contractAddress[types$1.ChainId.SOL]) === null || _a === void 0 ? void 0 : _a.toLowerCase());
|
|
@@ -65525,9 +65535,12 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
|
|
|
65525
65535
|
continue;
|
|
65526
65536
|
}
|
|
65527
65537
|
const bondAccount = bondAccounts[0];
|
|
65538
|
+
const id = asset.content.metadata.name;
|
|
65539
|
+
const idTrimmed = (_g = id.split('-')[1]) === null || _g === void 0 ? void 0 : _g.trim();
|
|
65528
65540
|
userBills.push({
|
|
65529
65541
|
address: bondPda.toBase58(),
|
|
65530
|
-
id:
|
|
65542
|
+
id: idTrimmed,
|
|
65543
|
+
asset: nftMint.toBase58(),
|
|
65531
65544
|
vesting: bondAccount.vesting.toString(),
|
|
65532
65545
|
payout: (Number(bondAccount.payout) - Number(bondAccount.payoutClaimed)).toString(),
|
|
65533
65546
|
totalPayout: bondAccount.payout.toString(),
|
|
@@ -65535,12 +65548,11 @@ function fetchUserOwnedSolanaBonds(user, bondData, tokenPrices) {
|
|
|
65535
65548
|
lastBlockTimestamp: bondAccount.lastClaimTimestamp.toString(),
|
|
65536
65549
|
pendingRewards,
|
|
65537
65550
|
billNftAddress: collection,
|
|
65538
|
-
payoutClaimed:
|
|
65539
|
-
|
|
65540
|
-
bond: Object.assign(Object.assign({}, bond), { payoutTokenPrice }),
|
|
65551
|
+
payoutClaimed: bondAccount.payoutClaimed.toString(),
|
|
65552
|
+
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
65553
|
});
|
|
65542
65554
|
// ULTRA HOT FIX :( until we can figure out a multicall strategy
|
|
65543
|
-
yield new Promise((r) => setTimeout(r,
|
|
65555
|
+
yield new Promise((r) => setTimeout(r, 10));
|
|
65544
65556
|
}
|
|
65545
65557
|
catch (e) {
|
|
65546
65558
|
console.log(e);
|
|
@@ -65637,7 +65649,7 @@ function useUserBonds() {
|
|
|
65637
65649
|
return useQuery({
|
|
65638
65650
|
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
65651
|
queryFn: () => getUserBonds(address, solanaAccount, bondList, chains, tokenPrices, apiUrl),
|
|
65640
|
-
refetchInterval:
|
|
65652
|
+
refetchInterval: 120000, // TODO rollback this
|
|
65641
65653
|
enabled: !!bondList && !!(address || solanaAccount) && !!tokenPrices,
|
|
65642
65654
|
refetchOnWindowFocus: false,
|
|
65643
65655
|
refetchOnMount: false,
|
|
@@ -65680,8 +65692,39 @@ const getUserBonds = (account, solanaAccount, bondList, chains, tokenPrices, api
|
|
|
65680
65692
|
const fulfilledResults = results
|
|
65681
65693
|
.filter((result) => result.status === 'fulfilled')
|
|
65682
65694
|
.map((result) => result.value);
|
|
65695
|
+
const onChainData = fulfilledResults.flat().flatMap((result) => result.userOwnedBills);
|
|
65696
|
+
// Prepare body for batch API call
|
|
65697
|
+
const body = Object.values(onChainData.reduce((acc, data) => {
|
|
65698
|
+
var _a, _b, _c;
|
|
65699
|
+
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;
|
|
65700
|
+
const key = `${(_b = data === null || data === void 0 ? void 0 : data.bond) === null || _b === void 0 ? void 0 : _b.chainId}-${contract}`;
|
|
65701
|
+
if (!acc[key]) {
|
|
65702
|
+
acc[key] = {
|
|
65703
|
+
chainId: (_c = data === null || data === void 0 ? void 0 : data.bond) === null || _c === void 0 ? void 0 : _c.chainId,
|
|
65704
|
+
contract: contract,
|
|
65705
|
+
billIds: [],
|
|
65706
|
+
};
|
|
65707
|
+
}
|
|
65708
|
+
acc[key].billIds.push(parseInt(data.id));
|
|
65709
|
+
return acc;
|
|
65710
|
+
}, {}));
|
|
65711
|
+
const response = yield axios.post(`${apiUrl}/bills/multi-batch`, body);
|
|
65712
|
+
// Enrich on-chain data with API data
|
|
65713
|
+
const enrichedData = onChainData.map((userBond) => {
|
|
65714
|
+
var _a, _b;
|
|
65715
|
+
const nftDataResponse = (_a = response.data) === null || _a === void 0 ? void 0 : _a.find((nft) => {
|
|
65716
|
+
var _a, _b;
|
|
65717
|
+
const contract = nft.contract.toLowerCase();
|
|
65718
|
+
const chain = nft.chainId;
|
|
65719
|
+
// API uses contractAddress for Solana bonds instead of NFT Address
|
|
65720
|
+
const contractToCompare = chain === types$1.ChainId.SOL ? (_a = userBond.bond) === null || _a === void 0 ? void 0 : _a.contractAddress[types$1.ChainId.SOL] : userBond.billNftAddress;
|
|
65721
|
+
return (contractToCompare === null || contractToCompare === void 0 ? void 0 : contractToCompare.toLowerCase()) === contract && ((_b = userBond.bond) === null || _b === void 0 ? void 0 : _b.chainId) === chain;
|
|
65722
|
+
});
|
|
65723
|
+
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));
|
|
65724
|
+
return Object.assign(Object.assign({}, userBond), { nftData });
|
|
65725
|
+
});
|
|
65683
65726
|
console.timeEnd('getUserBonds');
|
|
65684
|
-
return
|
|
65727
|
+
return enrichedData;
|
|
65685
65728
|
}
|
|
65686
65729
|
catch (e) {
|
|
65687
65730
|
console.error(e);
|
|
@@ -65691,7 +65734,7 @@ const getUserBonds = (account, solanaAccount, bondList, chains, tokenPrices, api
|
|
|
65691
65734
|
extraInfo: { type: 'getUserBonds', bondList, chains, e },
|
|
65692
65735
|
account,
|
|
65693
65736
|
});
|
|
65694
|
-
|
|
65737
|
+
throw new Error('Failed to fetch user bonds');
|
|
65695
65738
|
}
|
|
65696
65739
|
});
|
|
65697
65740
|
|
|
@@ -67872,7 +67915,7 @@ const ClaimAll = () => {
|
|
|
67872
67915
|
|
|
67873
67916
|
const YourBondsMenu = ({ chainFilterOption, setChainFilterOption, filterOptions, filterOption, setFilterOption, setInputValue, inputValue, handleSort, }) => {
|
|
67874
67917
|
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, {}) })] })] })] }));
|
|
67918
|
+
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
67919
|
};
|
|
67877
67920
|
|
|
67878
67921
|
function useFavoriteTokens() {
|
|
@@ -67991,84 +68034,6 @@ const UserBillTooltipText = {
|
|
|
67991
68034
|
Claimed: 'This is the amount of tokens that you have already claimed.',
|
|
67992
68035
|
};
|
|
67993
68036
|
|
|
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
68037
|
var BOND_NFT_ABI = [
|
|
68073
68038
|
{
|
|
68074
68039
|
anonymous: false,
|
|
@@ -69026,7 +68991,7 @@ var BOND_NFT_ABI = [
|
|
|
69026
68991
|
}
|
|
69027
68992
|
];
|
|
69028
68993
|
|
|
69029
|
-
const
|
|
68994
|
+
const useMonitorTx = (txHash, chainId) => {
|
|
69030
68995
|
const { addToastError, addToastSuccess } = usePopups();
|
|
69031
68996
|
const transactionReceipt = useWaitForTransactionReceipt({
|
|
69032
68997
|
confirmations: 0,
|
|
@@ -69057,7 +69022,7 @@ const TransferAction$1 = ({ userBill, toAddress, disabled, }) => {
|
|
|
69057
69022
|
const [transferTxHash, setTransferTxHash] = useState(null);
|
|
69058
69023
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
69059
69024
|
const { writeContractAsync } = useWriteContract();
|
|
69060
|
-
const { isLoading, isSuccess: isConfirmed } =
|
|
69025
|
+
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
69026
|
const { addToastError } = usePopups();
|
|
69062
69027
|
const load = loadingTx || (isLoading && !isConfirmed);
|
|
69063
69028
|
const handleTransfer = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
@@ -69125,9 +69090,9 @@ const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
|
69125
69090
|
setLoadingTx(true);
|
|
69126
69091
|
const connection = new Connection(getRPC(types$1.ChainId.SOL));
|
|
69127
69092
|
// MPL Core program ID
|
|
69128
|
-
if (!(userBill === null || userBill === void 0 ? void 0 : userBill.id) || !toAddress || !userBill)
|
|
69093
|
+
if (!(userBill === null || userBill === void 0 ? void 0 : userBill.id) || !toAddress || !userBill || !(userBill === null || userBill === void 0 ? void 0 : userBill.asset))
|
|
69129
69094
|
return;
|
|
69130
|
-
const asset = new PublicKey(userBill === null || userBill === void 0 ? void 0 : userBill.
|
|
69095
|
+
const asset = new PublicKey(userBill === null || userBill === void 0 ? void 0 : userBill.asset);
|
|
69131
69096
|
const newOwner = new PublicKey(toAddress);
|
|
69132
69097
|
const collection = new PublicKey(userBill.billNftAddress);
|
|
69133
69098
|
// Create instruction data with discriminator (14) + null compression_proof
|
|
@@ -69179,17 +69144,19 @@ const TransferAction = ({ userBill, toAddress, disabled, }) => {
|
|
|
69179
69144
|
};
|
|
69180
69145
|
|
|
69181
69146
|
const TransferModal = ({ onDismiss, userBill }) => {
|
|
69182
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l
|
|
69147
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
69183
69148
|
// State
|
|
69184
69149
|
const [confirmSend, setConfirmSend] = useState(false);
|
|
69185
69150
|
const [toAddress, setToAddress] = useState('');
|
|
69186
69151
|
// Data
|
|
69187
69152
|
const bond = userBill === null || userBill === void 0 ? void 0 : userBill.bond;
|
|
69188
69153
|
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
69154
|
const pending = chainId &&
|
|
69191
|
-
((_e = getBalanceNumber(new BigNumber$1((
|
|
69192
|
-
return (jsxs(Modal, { onDismiss: onDismiss, title: "Transfer Bond",
|
|
69155
|
+
((_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));
|
|
69156
|
+
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) => {
|
|
69157
|
+
setConfirmSend(!confirmSend);
|
|
69158
|
+
event.stopPropagation();
|
|
69159
|
+
} }), 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
69160
|
};
|
|
69194
69161
|
var TransferBondModal = React__default.memo(TransferModal);
|
|
69195
69162
|
|
|
@@ -74942,29 +74909,30 @@ const SafeHTMLComponent = ({ html }) => {
|
|
|
74942
74909
|
return jsx$2("div", { dangerouslySetInnerHTML: { __html: sanitizedHTML } });
|
|
74943
74910
|
};
|
|
74944
74911
|
|
|
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
|
|
74912
|
+
const YourBondsModal = ({ billId, onDismiss }) => {
|
|
74913
|
+
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;
|
|
74914
|
+
const { data: userBonds, refetch: refetchUserBonds } = useUserBonds();
|
|
74915
|
+
const userBill = userBonds === null || userBonds === void 0 ? void 0 : userBonds.find((bill) => bill.id === billId);
|
|
74947
74916
|
// Hooks
|
|
74948
74917
|
const SDKConfig = useSDKConfig();
|
|
74949
74918
|
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
74919
|
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
74920
|
const { writeContractAsync } = useWriteContract();
|
|
74955
74921
|
const { address: account } = useEVMAccount();
|
|
74922
|
+
const { addToastError } = usePopups();
|
|
74956
74923
|
// State
|
|
74957
74924
|
const [imgLoaded, setImgLoaded] = useState(false);
|
|
74958
74925
|
const [isOpenTraits, setIsOpenTraits] = useState(false);
|
|
74959
74926
|
const [claimTxHash, setClaimTxHash] = useState(null);
|
|
74960
74927
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
74961
|
-
const { isLoading, isSuccess: isConfirmed } =
|
|
74962
|
-
const { addToastError } = usePopups();
|
|
74928
|
+
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
74929
|
const load = loadingTx || (isLoading && !isConfirmed);
|
|
74930
|
+
// Static Data
|
|
74931
|
+
const bondNFTData = userBill === null || userBill === void 0 ? void 0 : userBill.nftData;
|
|
74964
74932
|
// Cliff display info:
|
|
74965
|
-
const vestingCliff = (
|
|
74933
|
+
const vestingCliff = (_b = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _b === void 0 ? void 0 : _b.vestingCliff;
|
|
74966
74934
|
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
74967
|
-
const lastBlockTimestamp = parseInt((
|
|
74935
|
+
const lastBlockTimestamp = parseInt((_c = userBill === null || userBill === void 0 ? void 0 : userBill.lastBlockTimestamp) !== null && _c !== void 0 ? _c : '0');
|
|
74968
74936
|
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
74969
74937
|
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
74970
74938
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
@@ -75009,7 +74977,7 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
75009
74977
|
}
|
|
75010
74978
|
});
|
|
75011
74979
|
const BILL_ATTRIBUTES = ['The Legend', 'The Location', 'The Moment', 'The Trend', 'The Innovation'];
|
|
75012
|
-
const attributes = (
|
|
74980
|
+
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
74981
|
const handleImageLoad = () => {
|
|
75014
74982
|
setImgLoaded(true);
|
|
75015
74983
|
};
|
|
@@ -75017,7 +74985,6 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
75017
74985
|
useEffect(() => {
|
|
75018
74986
|
if (isConfirmed) {
|
|
75019
74987
|
refetchUserBonds();
|
|
75020
|
-
refetch();
|
|
75021
74988
|
}
|
|
75022
74989
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
75023
74990
|
}, [isConfirmed]);
|
|
@@ -75028,11 +74995,11 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
75028
74995
|
justifyContent: 'center',
|
|
75029
74996
|
alignItems: 'center',
|
|
75030
74997
|
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: (
|
|
74998
|
+
}, 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
74999
|
return (jsx$2(Flex$1, { sx: { marginRight: '10px' }, children: jsx$2(ListTag, { text: tag === null || tag === void 0 ? void 0 : tag.toUpperCase() }) }, tag));
|
|
75033
75000
|
}) }), 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
75001
|
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' })] }), ((
|
|
75002
|
+
}, 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
75003
|
p: '5px 10px',
|
|
75037
75004
|
width: '100%',
|
|
75038
75005
|
background: '#8E568F',
|
|
@@ -75046,28 +75013,28 @@ const YourBondsModal = ({ onDismiss, bill }) => {
|
|
|
75046
75013
|
? 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
75014
|
: BILL_ATTRIBUTES.map((attrib) => {
|
|
75048
75015
|
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
|
-
}) }) })) })] }), ((
|
|
75016
|
+
}) }) })) })] }), ((_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
75017
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75051
75018
|
fontWeight: [500, 500, 500, 400],
|
|
75052
75019
|
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: (
|
|
75020
|
+
}, 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
75021
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75055
75022
|
fontWeight: [500, 500, 500, 400],
|
|
75056
75023
|
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: (
|
|
75024
|
+
}, 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
75025
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75059
75026
|
fontWeight: [500, 500, 500, 400],
|
|
75060
75027
|
paddingLeft: '10px',
|
|
75061
|
-
}, children: `($${claimedUSD(userBill).toFixed(2)})` })] })] })] })] }), ((
|
|
75028
|
+
}, 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
75029
|
width: '100%',
|
|
75063
75030
|
background: '#DE62F366',
|
|
75064
75031
|
justifyContent: 'center',
|
|
75065
75032
|
borderRadius: 'normal',
|
|
75066
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (
|
|
75033
|
+
}, 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
75034
|
var _a;
|
|
75068
75035
|
event.stopPropagation();
|
|
75069
75036
|
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[(
|
|
75037
|
+
}, 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
75038
|
event.stopPropagation();
|
|
75072
75039
|
handleClaim(userBill === null || userBill === void 0 ? void 0 : userBill.id, userBill === null || userBill === void 0 ? void 0 : userBill.address);
|
|
75073
75040
|
}, children: isPendingCliff
|
|
@@ -75158,8 +75125,54 @@ const BondInfoTooltip = ({ earnTokenContract, earnTokenSymbol, bondContract, pro
|
|
|
75158
75125
|
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
75126
|
};
|
|
75160
75127
|
|
|
75128
|
+
const ProfitCard = ({ userBond }) => {
|
|
75129
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
75130
|
+
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);
|
|
75131
|
+
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';
|
|
75132
|
+
const totalPayoutUSD = totalPayout * parseFloat(payoutTokenPrice);
|
|
75133
|
+
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;
|
|
75134
|
+
const profit = !depositAmountUSD ? 0 : totalPayoutUSD - depositAmountUSD;
|
|
75135
|
+
return (jsx$2(Flex$1, { sx: { display: ['none', 'none', 'none', 'none', 'none', 'none', 'flex'], width: '125px' }, children: profit > 0.01 ? (jsxs(Flex$1, { sx: {
|
|
75136
|
+
border: '1px solid rgb(56, 166, 17, 0.20)',
|
|
75137
|
+
p: '2px 6px',
|
|
75138
|
+
color: 'success',
|
|
75139
|
+
borderRadius: '5px',
|
|
75140
|
+
background: '#38A6110D',
|
|
75141
|
+
fontWeight: 700,
|
|
75142
|
+
fontSize: '14px',
|
|
75143
|
+
width: '100%',
|
|
75144
|
+
justifyContent: 'center',
|
|
75145
|
+
// I want a background with 5% opacity of this color
|
|
75146
|
+
}, children: ["+$", formatNumberSI(profit, profit > 100 ? 0 : 2), " Profit!"] })) : (jsx$2(Flex$1, { sx: { width: '125px' } })) }));
|
|
75147
|
+
};
|
|
75148
|
+
|
|
75149
|
+
const styles$9 = {
|
|
75150
|
+
titleText: {
|
|
75151
|
+
opacity: 0.6,
|
|
75152
|
+
fontSize: '12px',
|
|
75153
|
+
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
75154
|
+
fontWeight: 400,
|
|
75155
|
+
},
|
|
75156
|
+
skeleton: {
|
|
75157
|
+
width: ['45px', '45px', '60px'],
|
|
75158
|
+
maxHeight: '18px',
|
|
75159
|
+
minHeight: '18px',
|
|
75160
|
+
}};
|
|
75161
|
+
|
|
75162
|
+
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
75163
|
+
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 }) }))] }));
|
|
75164
|
+
};
|
|
75165
|
+
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
75166
|
+
|
|
75167
|
+
const ProgressBar = ({ value }) => {
|
|
75168
|
+
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: {
|
|
75169
|
+
width: `${value <= 3 ? 3 : value}%`,
|
|
75170
|
+
} }) }) }));
|
|
75171
|
+
};
|
|
75172
|
+
|
|
75161
75173
|
const UserBondRow = ({ bill }) => {
|
|
75162
75174
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
75175
|
+
// Hooks
|
|
75163
75176
|
const userChainId = useChainId();
|
|
75164
75177
|
const SDKConfig = useSDKConfig();
|
|
75165
75178
|
const { address: account } = useEVMAccount();
|
|
@@ -75167,11 +75180,12 @@ const UserBondRow = ({ bill }) => {
|
|
|
75167
75180
|
const { writeContractAsync } = useWriteContract();
|
|
75168
75181
|
const { addToastError } = usePopups();
|
|
75169
75182
|
const { refetch: refetchUserBonds } = useUserBonds();
|
|
75183
|
+
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModal, { billId: bill.id }));
|
|
75184
|
+
// State
|
|
75170
75185
|
const [claimTxHash, setClaimTxHash] = useState(null);
|
|
75171
|
-
const { isLoading: isConfirming, isSuccess: isConfirmed } =
|
|
75186
|
+
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
75187
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
75173
75188
|
const load = loadingTx || (isConfirming && !isConfirmed);
|
|
75174
|
-
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModal, { bill: bill }));
|
|
75175
75189
|
const handleClaim = (billId, billAddress) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
75176
75190
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
75177
75191
|
const address = billAddress;
|
|
@@ -75226,9 +75240,17 @@ const UserBondRow = ({ bill }) => {
|
|
|
75226
75240
|
}
|
|
75227
75241
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
75228
75242
|
}, [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: {
|
|
75243
|
+
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
75244
|
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:
|
|
75245
|
+
}, 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: {
|
|
75246
|
+
width: '127px',
|
|
75247
|
+
height: '25px',
|
|
75248
|
+
flexDirection: 'column',
|
|
75249
|
+
justifyContent: 'center',
|
|
75250
|
+
display: ['none', 'none', 'none', 'flex'],
|
|
75251
|
+
}, showTooltip: true, toolTip: getTimeLeftForFullyVested(bill) > 0
|
|
75252
|
+
? `Fully vested in ${getPendingVestingString(bill)}.`
|
|
75253
|
+
: `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
75254
|
var _a;
|
|
75233
75255
|
event.stopPropagation();
|
|
75234
75256
|
// Add your claim logic here
|
|
@@ -75241,28 +75263,21 @@ const UserBondRow = ({ bill }) => {
|
|
|
75241
75263
|
: 'Claim' })) })] })] }));
|
|
75242
75264
|
};
|
|
75243
75265
|
|
|
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;
|
|
75266
|
+
const YourBondsModalSolana = ({ billId, onDismiss }) => {
|
|
75267
|
+
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;
|
|
75255
75268
|
// Hooks
|
|
75256
75269
|
const SDKConfig = useSDKConfig();
|
|
75257
75270
|
const { publicKey: accountSolana, signTransaction } = useSOLAccount();
|
|
75258
75271
|
const { setVisible } = useWalletModal();
|
|
75259
75272
|
const { addToastError, addToastSuccess } = usePopups();
|
|
75260
|
-
const { refetch } = useUserBonds();
|
|
75273
|
+
const { data: userBonds, refetch } = useUserBonds();
|
|
75261
75274
|
const connection = new Connection(getRPC(types$1.ChainId.SOL), 'confirmed');
|
|
75262
75275
|
// State
|
|
75263
75276
|
const [imgLoaded, setImgLoaded] = useState(false);
|
|
75264
75277
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
75265
|
-
|
|
75278
|
+
// Static Data
|
|
75279
|
+
const userBill = userBonds === null || userBonds === void 0 ? void 0 : userBonds.find((bill) => bill.asset === billId);
|
|
75280
|
+
const bondNFTData = userBill === null || userBill === void 0 ? void 0 : userBill.nftData;
|
|
75266
75281
|
// Cliff display info:
|
|
75267
75282
|
const vestingCliff = (_a = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff;
|
|
75268
75283
|
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
@@ -75299,17 +75314,17 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75299
75314
|
return userPayoutAta;
|
|
75300
75315
|
});
|
|
75301
75316
|
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
75302
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
75317
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
75303
75318
|
try {
|
|
75304
75319
|
setLoadingTx(true);
|
|
75305
75320
|
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
|
-
|
|
75321
|
+
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];
|
|
75322
|
+
if (!earnTokenAddress || !userBill.asset || !contractAddress)
|
|
75307
75323
|
return;
|
|
75308
75324
|
const payoutMint = new PublicKey(earnTokenAddress);
|
|
75309
|
-
|
|
75310
|
-
const
|
|
75325
|
+
const bondIssuancePda = new PublicKey(contractAddress);
|
|
75326
|
+
const nftMint = new PublicKey(userBill.asset);
|
|
75311
75327
|
const [bondTermPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond_term'), bondIssuancePda.toBuffer()], PROGRAM_ID);
|
|
75312
|
-
const nftMint = new PublicKey(userBill.id);
|
|
75313
75328
|
const [bondPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond'), bondIssuancePda.toBuffer(), nftMint.toBuffer()], PROGRAM_ID);
|
|
75314
75329
|
const userPayoutAta = yield ensureUserPayoutAtaExists({
|
|
75315
75330
|
connection,
|
|
@@ -75347,26 +75362,28 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75347
75362
|
if (!signTransaction)
|
|
75348
75363
|
return;
|
|
75349
75364
|
const signedTx = yield signTransaction(transaction);
|
|
75350
|
-
const
|
|
75365
|
+
const txHash = yield connection.sendRawTransaction(signedTx.serialize(), {
|
|
75351
75366
|
skipPreflight: false,
|
|
75352
75367
|
preflightCommitment: 'confirmed',
|
|
75353
75368
|
});
|
|
75354
75369
|
yield connection.confirmTransaction({
|
|
75355
|
-
signature:
|
|
75370
|
+
signature: txHash,
|
|
75356
75371
|
blockhash,
|
|
75357
75372
|
lastValidBlockHeight,
|
|
75358
75373
|
}, 'confirmed');
|
|
75359
|
-
|
|
75360
|
-
|
|
75361
|
-
|
|
75374
|
+
const txStatus = yield connection.getSignatureStatus(txHash, { searchTransactionHistory: true });
|
|
75375
|
+
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') {
|
|
75376
|
+
console.log('Tx confirmed on-chain, refetching bonds');
|
|
75362
75377
|
refetch();
|
|
75363
|
-
|
|
75378
|
+
addToastSuccess(txHash, types$1.ChainId.SOL);
|
|
75379
|
+
}
|
|
75380
|
+
setLoadingTx(false);
|
|
75364
75381
|
}
|
|
75365
75382
|
catch (error) {
|
|
75366
75383
|
console.error('Claim failed:', error);
|
|
75367
|
-
addToastError((
|
|
75384
|
+
addToastError((_k = error === null || error === void 0 ? void 0 : error.message) !== null && _k !== void 0 ? _k : 'Unknown error');
|
|
75368
75385
|
reportError({
|
|
75369
|
-
apiUrl: (
|
|
75386
|
+
apiUrl: (_l = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _l === void 0 ? void 0 : _l.apiV2,
|
|
75370
75387
|
error,
|
|
75371
75388
|
extraInfo: { type: 'claim', userBill, error },
|
|
75372
75389
|
});
|
|
@@ -75379,32 +75396,36 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75379
75396
|
setImgLoaded(true);
|
|
75380
75397
|
};
|
|
75381
75398
|
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: [
|
|
75399
|
+
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%' } })), !imgLoaded && (jsx$2(Flex$1, { sx: {
|
|
75383
75400
|
position: 'absolute',
|
|
75384
75401
|
top: 'calc(50% - 24px)',
|
|
75385
75402
|
right: 'calc(50% - 50px)',
|
|
75386
75403
|
justifyContent: 'center',
|
|
75387
75404
|
alignItems: 'center',
|
|
75388
75405
|
zIndex: 1,
|
|
75389
|
-
}, 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: (
|
|
75406
|
+
}, 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: (_d = (_c = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _c === void 0 ? void 0 : _c.showcaseTokenName) !== null && _d !== void 0 ? _d : (_f = (_e = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _e === void 0 ? void 0 : _e.earnToken) === null || _f === void 0 ? void 0 : _f.symbol, size: 40, chain: (_g = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _g === void 0 ? void 0 : _g.chainId })) }), jsx$2(Flex$1, { className: "title-container tokenname", children: (_j = (_h = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _h === void 0 ? void 0 : _h.showcaseTokenName) !== null && _j !== void 0 ? _j : (_k = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _k === void 0 ? void 0 : _k.earnToken.symbol }), jsx$2(Flex$1, { className: "title-container tokentags", children: (_m = (_l = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _l === void 0 ? void 0 : _l.tags) === null || _m === void 0 ? void 0 : _m.slice(0, 1).map((tag) => {
|
|
75390
75407
|
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 # ",
|
|
75408
|
+
}) }), 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: [((_o = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _o === void 0 ? void 0 : _o.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: ["$", (_p = bondNFTData === null || bondNFTData === void 0 ? void 0 : bondNFTData.data) === null || _p === void 0 ? void 0 : _p.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: (_r = (_q = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _q === void 0 ? void 0 : _q.showcaseTokenName) !== null && _r !== void 0 ? _r : (_t = (_s = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _s === void 0 ? void 0 : _s.earnToken) === null || _t === void 0 ? void 0 : _t.symbol, size: 25, chain: (_u = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _u === void 0 ? void 0 : _u.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
75409
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75393
75410
|
fontWeight: [500, 500, 500, 400],
|
|
75394
75411
|
paddingLeft: '10px',
|
|
75395
|
-
}, 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: (
|
|
75412
|
+
}, 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: (_w = (_v = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _v === void 0 ? void 0 : _v.showcaseTokenName) !== null && _w !== void 0 ? _w : (_y = (_x = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _x === void 0 ? void 0 : _x.earnToken) === null || _y === void 0 ? void 0 : _y.symbol, size: 25, chain: (_z = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _z === void 0 ? void 0 : _z.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: {
|
|
75396
75413
|
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75397
75414
|
fontWeight: [500, 500, 500, 400],
|
|
75398
75415
|
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.
|
|
75416
|
+
}, 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: (_1 = (_0 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _0 === void 0 ? void 0 : _0.showcaseTokenName) !== null && _1 !== void 0 ? _1 : (_3 = (_2 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _2 === void 0 ? void 0 : _2.earnToken) === null || _3 === void 0 ? void 0 : _3.symbol, size: 25, chain: (_4 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _4 === void 0 ? void 0 : _4.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: {
|
|
75417
|
+
fontSize: ['10px', '10px', '10px', '12px'],
|
|
75418
|
+
fontWeight: [500, 500, 500, 400],
|
|
75419
|
+
paddingLeft: '10px',
|
|
75420
|
+
}, children: `($${claimedUSD(userBill).toFixed(2)})` })] })] })] })] }), ((_5 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _5 === void 0 ? void 0 : _5.warningCard) && (jsx$2(Flex$1, { sx: {
|
|
75400
75421
|
width: '100%',
|
|
75401
75422
|
background: '#DE62F366',
|
|
75402
75423
|
justifyContent: 'center',
|
|
75403
75424
|
borderRadius: 'normal',
|
|
75404
|
-
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (
|
|
75425
|
+
}, children: jsx$2(Text, { sx: { fontSize: '12px', fontWeight: 400, p: '2px 10px' }, children: jsx$2(SafeHTMLComponent, { html: (_6 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _6 === void 0 ? void 0 : _6.warningCard }) }) })), jsxs(Flex$1, { className: "yourbondinfo button-container", children: [jsx$2(Flex$1, { className: "button-container claim", children: userBill && !accountSolana ? (jsxs(Button, { className: "switch-button", disabled: claimable(userBill) === 0 || loadingTx, onClick: (event) => {
|
|
75405
75426
|
event.stopPropagation();
|
|
75406
75427
|
setVisible(true);
|
|
75407
|
-
}, children: ["Switch to ", NETWORK_LABEL[(
|
|
75428
|
+
}, children: ["Switch to ", NETWORK_LABEL[(_7 = userBill === null || userBill === void 0 ? void 0 : userBill.bond) === null || _7 === void 0 ? void 0 : _7.chainId]] })) : (jsx$2(Button, { className: "claim-button", disabled: claimable(userBill) === 0 || loadingTx || !userBill || isPendingCliff, load: loadingTx, onClick: (event) => {
|
|
75408
75429
|
event.stopPropagation();
|
|
75409
75430
|
handleClaim();
|
|
75410
75431
|
}, children: isPendingCliff
|
|
@@ -75414,14 +75435,22 @@ const YourBondsModalSolana = ({ onDismiss, userBill }) => {
|
|
|
75414
75435
|
|
|
75415
75436
|
const UserBondRowSolana = ({ bill }) => {
|
|
75416
75437
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
75438
|
+
// Hooks
|
|
75417
75439
|
const { setVisible } = useWalletModal();
|
|
75418
75440
|
const { publicKey: accountSolana, signTransaction } = useSOLAccount();
|
|
75419
75441
|
const { addToastError, addToastSuccess } = usePopups();
|
|
75420
75442
|
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
75443
|
const connection = new Connection(getRPC(types$1.ChainId.SOL));
|
|
75444
|
+
// State
|
|
75445
|
+
const [loadingTx, setLoadingTx] = useState(false);
|
|
75446
|
+
// Static Data
|
|
75447
|
+
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');
|
|
75448
|
+
const vestingCliff = (_c = bill === null || bill === void 0 ? void 0 : bill.bond) === null || _c === void 0 ? void 0 : _c.vestingCliff;
|
|
75449
|
+
const currentTime = Math.round(new Date().getTime() / 1000);
|
|
75450
|
+
const lastBlockTimestamp = parseInt((_d = bill === null || bill === void 0 ? void 0 : bill.lastBlockTimestamp) !== null && _d !== void 0 ? _d : '0');
|
|
75451
|
+
const isPendingCliff = vestingCliff ? currentTime - lastBlockTimestamp < vestingCliff : false;
|
|
75452
|
+
const cliffCountdown = getTimePeriods(lastBlockTimestamp + (vestingCliff !== null && vestingCliff !== void 0 ? vestingCliff : 0) - currentTime, true);
|
|
75453
|
+
const [onOpenPurchasedBond] = useModal(jsx$2(YourBondsModalSolana, { billId: bill.asset }));
|
|
75425
75454
|
const ensureUserPayoutAtaExists = (_a) => __awaiter$9(void 0, [_a], void 0, function* ({ connection, payer, payoutMint, user, }) {
|
|
75426
75455
|
const userPayoutAta = yield getAssociatedTokenAddress(payoutMint, user);
|
|
75427
75456
|
try {
|
|
@@ -75452,18 +75481,18 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75452
75481
|
return userPayoutAta;
|
|
75453
75482
|
});
|
|
75454
75483
|
const handleClaim = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
75455
|
-
var _a, _b, _c, _d, _e, _f;
|
|
75484
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
75456
75485
|
try {
|
|
75457
75486
|
setLoadingTx(true);
|
|
75458
75487
|
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];
|
|
75488
|
+
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];
|
|
75489
|
+
if (!earnTokenAddress || !bill.asset || !contractAddress || !accountSolana)
|
|
75490
|
+
return;
|
|
75459
75491
|
const payoutMint = new PublicKey(earnTokenAddress);
|
|
75460
|
-
|
|
75461
|
-
const
|
|
75492
|
+
const bondIssuancePda = new PublicKey(contractAddress);
|
|
75493
|
+
const nftMint = new PublicKey(bill.asset);
|
|
75462
75494
|
const [bondTermPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond_term'), bondIssuancePda.toBuffer()], PROGRAM_ID);
|
|
75463
|
-
const nftMint = new PublicKey(bill.id);
|
|
75464
75495
|
const [bondPda] = PublicKey.findProgramAddressSync([new TextEncoder().encode('bond'), bondIssuancePda.toBuffer(), nftMint.toBuffer()], PROGRAM_ID);
|
|
75465
|
-
if (!accountSolana)
|
|
75466
|
-
return;
|
|
75467
75496
|
const userPayoutAta = yield ensureUserPayoutAtaExists({
|
|
75468
75497
|
connection,
|
|
75469
75498
|
payer: accountSolana,
|
|
@@ -75471,7 +75500,7 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75471
75500
|
user: accountSolana,
|
|
75472
75501
|
});
|
|
75473
75502
|
// treasury_ata = PDA
|
|
75474
|
-
const [treasuryAta] = PublicKey.findProgramAddressSync([bondIssuancePda.toBuffer(), COMMON_CONST_SEED
|
|
75503
|
+
const [treasuryAta] = PublicKey.findProgramAddressSync([bondIssuancePda.toBuffer(), COMMON_CONST_SEED, payoutMint.toBuffer()], COMMON_PDA_PROGRAM);
|
|
75475
75504
|
// Build keys list
|
|
75476
75505
|
const keys = [
|
|
75477
75506
|
{ pubkey: bondPda, isSigner: false, isWritable: true },
|
|
@@ -75484,13 +75513,13 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75484
75513
|
{ pubkey: TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
75485
75514
|
{ pubkey: ASSOCIATED_TOKEN_PROGRAM_ID, isSigner: false, isWritable: false },
|
|
75486
75515
|
{ pubkey: new PublicKey('CoREENxT6tW1HoK8ypY1SxRMZTcVPm7R94rH4PZNhX7d'), isSigner: false, isWritable: false }, // mplCoreProgram
|
|
75487
|
-
{ pubkey: PROGRAM_ID, isSigner: false, isWritable: false,
|
|
75516
|
+
{ pubkey: PROGRAM_ID, isSigner: false, isWritable: false }, // passing programId is the same as passing null
|
|
75488
75517
|
];
|
|
75489
75518
|
// Build Instruction (no args → just discriminator)
|
|
75490
75519
|
const instruction = new TransactionInstruction({
|
|
75491
75520
|
keys,
|
|
75492
75521
|
programId: PROGRAM_ID,
|
|
75493
|
-
data: CLAIM_DISCRIMINATOR
|
|
75522
|
+
data: CLAIM_DISCRIMINATOR,
|
|
75494
75523
|
});
|
|
75495
75524
|
// Build Transaction
|
|
75496
75525
|
const transaction = new Transaction().add(instruction);
|
|
@@ -75500,42 +75529,48 @@ const UserBondRowSolana = ({ bill }) => {
|
|
|
75500
75529
|
if (!signTransaction)
|
|
75501
75530
|
return;
|
|
75502
75531
|
const signedTx = yield signTransaction(transaction);
|
|
75503
|
-
const
|
|
75532
|
+
const txHash = yield connection.sendRawTransaction(signedTx.serialize(), {
|
|
75504
75533
|
skipPreflight: false,
|
|
75505
75534
|
preflightCommitment: 'confirmed',
|
|
75506
75535
|
});
|
|
75507
75536
|
yield connection.confirmTransaction({
|
|
75508
|
-
signature:
|
|
75537
|
+
signature: txHash,
|
|
75509
75538
|
blockhash,
|
|
75510
75539
|
lastValidBlockHeight,
|
|
75511
75540
|
}, 'confirmed');
|
|
75512
|
-
|
|
75513
|
-
|
|
75514
|
-
|
|
75541
|
+
const txStatus = yield connection.getSignatureStatus(txHash, { searchTransactionHistory: true });
|
|
75542
|
+
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') {
|
|
75543
|
+
console.log('Tx confirmed on-chain, refetching bonds');
|
|
75515
75544
|
refetch();
|
|
75516
|
-
|
|
75545
|
+
addToastSuccess(txHash, types$1.ChainId.SOL);
|
|
75546
|
+
}
|
|
75547
|
+
setLoadingTx(false);
|
|
75517
75548
|
}
|
|
75518
75549
|
catch (error) {
|
|
75519
75550
|
console.error('Claim failed:', error);
|
|
75520
|
-
addToastError((
|
|
75551
|
+
addToastError((_k = error === null || error === void 0 ? void 0 : error.message) !== null && _k !== void 0 ? _k : 'Unknown error');
|
|
75521
75552
|
}
|
|
75522
75553
|
finally {
|
|
75523
75554
|
setLoadingTx(false);
|
|
75524
75555
|
}
|
|
75525
75556
|
});
|
|
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: {
|
|
75557
|
+
return (jsxs("div", { className: "your-bonds", onClick: () => {
|
|
75558
|
+
if (bill.asset)
|
|
75559
|
+
onOpenPurchasedBond();
|
|
75560
|
+
}, 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
75561
|
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:
|
|
75562
|
+
}, 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: {
|
|
75563
|
+
width: '127px',
|
|
75564
|
+
height: '25px',
|
|
75565
|
+
flexDirection: 'column',
|
|
75566
|
+
justifyContent: 'center',
|
|
75567
|
+
display: ['none', 'none', 'none', 'flex'],
|
|
75568
|
+
}, showTooltip: true, toolTip: getTimeLeftForFullyVested(bill) > 0
|
|
75569
|
+
? `Fully vested in ${getPendingVestingString(bill)}.`
|
|
75570
|
+
: `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
75571
|
event.stopPropagation();
|
|
75537
75572
|
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 ||
|
|
75573
|
+
}, 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
75574
|
event.stopPropagation();
|
|
75540
75575
|
handleClaim();
|
|
75541
75576
|
}, fullWidth: true, children: isPendingCliff
|
|
@@ -78075,7 +78110,7 @@ const PreTgeActions = ({ userBond }) => {
|
|
|
78075
78110
|
const [loading, setLoading] = useState(false);
|
|
78076
78111
|
const [hash, setHash] = useState('');
|
|
78077
78112
|
// Data
|
|
78078
|
-
const { isLoading: isLoadingOnChain, isSuccess } =
|
|
78113
|
+
const { isLoading: isLoadingOnChain, isSuccess } = useMonitorTx(hash, userBond === null || userBond === void 0 ? void 0 : userBond.chainId);
|
|
78079
78114
|
const hasRedeemed = (_a = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _a === void 0 ? void 0 : _a.hasRedeemed;
|
|
78080
78115
|
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
78116
|
const saleFinalized = userBond === null || userBond === void 0 ? void 0 : userBond.finalized;
|
|
@@ -78178,189 +78213,7 @@ const UserBondRowPreTGE = ({ userBond }) => {
|
|
|
78178
78213
|
const pendingUSD = pendingAmount * ((_x = userBond === null || userBond === void 0 ? void 0 : userBond.earnTokenPrice) !== null && _x !== void 0 ? _x : 0);
|
|
78179
78214
|
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
78215
|
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]);
|
|
78216
|
+
}, 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
78217
|
};
|
|
78365
78218
|
|
|
78366
78219
|
/**
|
|
@@ -81459,6 +81312,179 @@ const calculateBondsData = (queryClient) => __awaiter$9(void 0, void 0, void 0,
|
|
|
81459
81312
|
}
|
|
81460
81313
|
});
|
|
81461
81314
|
|
|
81315
|
+
const YourBonds = ({ showOnly }) => {
|
|
81316
|
+
useTokenPrices();
|
|
81317
|
+
useBondsData();
|
|
81318
|
+
// Hooks
|
|
81319
|
+
const SDKConfig = useSDKConfig();
|
|
81320
|
+
const { address: account } = useEVMAccount();
|
|
81321
|
+
const { publicKey: solanaAccount } = useSOLAccount();
|
|
81322
|
+
const { data: userBonds, isFetched: userBondsFetched } = useUserBonds();
|
|
81323
|
+
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
81324
|
+
const { data: preTGEUserBonds, isFetched: preTGEFetched } = useUserBondsPreTGE();
|
|
81325
|
+
const hasFetched = userBondsFetched && (preTGEFetched || !account);
|
|
81326
|
+
const preTGEBondsToRender = preTGEUserBonds === null || preTGEUserBonds === void 0 ? void 0 : preTGEUserBonds.filter((userBond) => {
|
|
81327
|
+
var _a, _b, _c, _d;
|
|
81328
|
+
if (!((_a = userBond === null || userBond === void 0 ? void 0 : userBond.accountInfo) === null || _a === void 0 ? void 0 : _a.hasRedeemed)) {
|
|
81329
|
+
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;
|
|
81330
|
+
}
|
|
81331
|
+
else {
|
|
81332
|
+
return ((_d = userBond === null || userBond === void 0 ? void 0 : userBond.userOwnedBillsData) === null || _d === void 0 ? void 0 : _d.payout) !== '0';
|
|
81333
|
+
}
|
|
81334
|
+
});
|
|
81335
|
+
// State
|
|
81336
|
+
const [sortConfig, setSortConfig] = useState({
|
|
81337
|
+
key: 'claimable',
|
|
81338
|
+
direction: 'desc',
|
|
81339
|
+
});
|
|
81340
|
+
const [inputValue, setInputValue] = useState('');
|
|
81341
|
+
const filterOptions = ['CLAIMABLE', 'ALL'];
|
|
81342
|
+
const [filterOption, setFilterOption] = useState(filterOptions[0]);
|
|
81343
|
+
const handleSort = (key) => {
|
|
81344
|
+
let direction = 'desc';
|
|
81345
|
+
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === key && (sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.direction) === 'desc') {
|
|
81346
|
+
direction = 'asc';
|
|
81347
|
+
}
|
|
81348
|
+
setSortConfig({ key, direction });
|
|
81349
|
+
};
|
|
81350
|
+
const bondsToRender = useMemo(() => {
|
|
81351
|
+
if (!userBonds)
|
|
81352
|
+
return [];
|
|
81353
|
+
let bondsToReturn = userBonds;
|
|
81354
|
+
// Handle Filtering //
|
|
81355
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81356
|
+
var _a;
|
|
81357
|
+
return ((_a = bond.bond) === null || _a === void 0 ? void 0 : _a.onlyPartner) ? bond.bond.bondPartner === SDKConfig.bondPartner : true;
|
|
81358
|
+
});
|
|
81359
|
+
if (SDKConfig.bondPartner) {
|
|
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.bondPartner) === SDKConfig.bondPartner;
|
|
81363
|
+
});
|
|
81364
|
+
}
|
|
81365
|
+
// Filter Single Token View
|
|
81366
|
+
if (showOnly) {
|
|
81367
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81368
|
+
var _a, _b, _c;
|
|
81369
|
+
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();
|
|
81370
|
+
});
|
|
81371
|
+
}
|
|
81372
|
+
// Filter by search query
|
|
81373
|
+
if (inputValue !== '') {
|
|
81374
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81375
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
81376
|
+
return [
|
|
81377
|
+
(_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(),
|
|
81378
|
+
(_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(),
|
|
81379
|
+
(_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(),
|
|
81380
|
+
].some((property) => property === null || property === void 0 ? void 0 : property.includes(inputValue.toLowerCase()));
|
|
81381
|
+
});
|
|
81382
|
+
}
|
|
81383
|
+
// Filter by chain selector
|
|
81384
|
+
if (!chainFilterOption.includes('All Chains')) {
|
|
81385
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81386
|
+
var _a, _b, _c;
|
|
81387
|
+
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 : '');
|
|
81388
|
+
});
|
|
81389
|
+
}
|
|
81390
|
+
// Filter by filter option (claimable or all buttons)
|
|
81391
|
+
if (filterOption === 'CLAIMABLE') {
|
|
81392
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.filter((bond) => {
|
|
81393
|
+
var _a;
|
|
81394
|
+
if ((_a = bond === null || bond === void 0 ? void 0 : bond.bond) === null || _a === void 0 ? void 0 : _a.vestingCliff) {
|
|
81395
|
+
return bond.payout !== '0';
|
|
81396
|
+
}
|
|
81397
|
+
return bond.pendingRewards !== '0';
|
|
81398
|
+
});
|
|
81399
|
+
}
|
|
81400
|
+
// Handle sorting //
|
|
81401
|
+
if (sortConfig !== null) {
|
|
81402
|
+
bondsToReturn = bondsToReturn === null || bondsToReturn === void 0 ? void 0 : bondsToReturn.sort((a, b) => {
|
|
81403
|
+
let aValue, bValue;
|
|
81404
|
+
if (sortConfig.key === 'claimable') {
|
|
81405
|
+
aValue = claimableUSD(a);
|
|
81406
|
+
bValue = claimableUSD(b);
|
|
81407
|
+
}
|
|
81408
|
+
else if (sortConfig.key === 'pending') {
|
|
81409
|
+
aValue = pendingUSD(a);
|
|
81410
|
+
bValue = pendingUSD(b);
|
|
81411
|
+
}
|
|
81412
|
+
else if (sortConfig.key === 'terms') {
|
|
81413
|
+
const aRemainingTime = vestingTimeRemaining(a).days * 24 * 3600 +
|
|
81414
|
+
vestingTimeRemaining(a).hours * 3600 +
|
|
81415
|
+
vestingTimeRemaining(a).minutes * 60;
|
|
81416
|
+
const bRemainingTime = vestingTimeRemaining(b).days * 24 * 3600 +
|
|
81417
|
+
vestingTimeRemaining(b).hours * 3600 +
|
|
81418
|
+
vestingTimeRemaining(b).minutes * 60;
|
|
81419
|
+
aValue = aRemainingTime;
|
|
81420
|
+
bValue = bRemainingTime;
|
|
81421
|
+
}
|
|
81422
|
+
else {
|
|
81423
|
+
aValue = a[sortConfig.key];
|
|
81424
|
+
bValue = b[sortConfig.key];
|
|
81425
|
+
}
|
|
81426
|
+
if (aValue < bValue) {
|
|
81427
|
+
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
81428
|
+
}
|
|
81429
|
+
if (aValue > bValue) {
|
|
81430
|
+
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
81431
|
+
}
|
|
81432
|
+
return 0;
|
|
81433
|
+
});
|
|
81434
|
+
}
|
|
81435
|
+
return bondsToReturn;
|
|
81436
|
+
/* eslint-disable react-hooks/exhaustive-deps */
|
|
81437
|
+
}, [userBonds, sortConfig, inputValue, chainFilterOption, filterOption, userBondsFetched]);
|
|
81438
|
+
const handleFilterOption = useCallback((newOption) => {
|
|
81439
|
+
setFilterOption(newOption);
|
|
81440
|
+
}, []);
|
|
81441
|
+
const hasBonds = useMemo(() => {
|
|
81442
|
+
return (bondsToRender && bondsToRender.length > 0) || !!(preTGEBondsToRender === null || preTGEBondsToRender === void 0 ? void 0 : preTGEBondsToRender.length);
|
|
81443
|
+
}, [bondsToRender, preTGEBondsToRender]);
|
|
81444
|
+
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) => {
|
|
81445
|
+
var _a;
|
|
81446
|
+
if (((_a = bond.bond) === null || _a === void 0 ? void 0 : _a.chainId) === types$1.ChainId.SOL)
|
|
81447
|
+
return jsx$2(UserBondRowSolana, { bill: bond }, `${bond.billNftAddress}-${bond.id}`);
|
|
81448
|
+
return jsx$2(UserBondRow, { bill: bond }, bond.id);
|
|
81449
|
+
})] })) : 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, {}) }))] }));
|
|
81450
|
+
};
|
|
81451
|
+
|
|
81452
|
+
// This basically returns the 2 tags with the higher active bond count
|
|
81453
|
+
const useTopTags = (initialBondList) => {
|
|
81454
|
+
const SDKConfig = useSDKConfig();
|
|
81455
|
+
const chains = SDKConfig.chains;
|
|
81456
|
+
const bonds = initialBondList;
|
|
81457
|
+
const countTagsInBonds = (bonds) => {
|
|
81458
|
+
const tagCount = {};
|
|
81459
|
+
bonds === null || bonds === void 0 ? void 0 : bonds.forEach((bond) => {
|
|
81460
|
+
var _a;
|
|
81461
|
+
if (bond.soldOut)
|
|
81462
|
+
return;
|
|
81463
|
+
(_a = bond.tags) === null || _a === void 0 ? void 0 : _a.forEach((tag) => {
|
|
81464
|
+
if (tag in tagCount) {
|
|
81465
|
+
tagCount[tag] += 1;
|
|
81466
|
+
}
|
|
81467
|
+
else {
|
|
81468
|
+
tagCount[tag] = 1;
|
|
81469
|
+
}
|
|
81470
|
+
});
|
|
81471
|
+
});
|
|
81472
|
+
return tagCount;
|
|
81473
|
+
};
|
|
81474
|
+
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)));
|
|
81475
|
+
const filteredBonds = activeBonds === null || activeBonds === void 0 ? void 0 : activeBonds.filter((bond) => {
|
|
81476
|
+
var _a, _b;
|
|
81477
|
+
if (SDKConfig.bondPartner) {
|
|
81478
|
+
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());
|
|
81479
|
+
}
|
|
81480
|
+
else
|
|
81481
|
+
return true;
|
|
81482
|
+
});
|
|
81483
|
+
const countedTags = countTagsInBonds(filteredBonds);
|
|
81484
|
+
const sortedTagsArray = Object.entries(countedTags).sort((a, b) => b[1] - a[1]);
|
|
81485
|
+
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
81486
|
+
};
|
|
81487
|
+
|
|
81462
81488
|
function adjustDecimals(numStr) {
|
|
81463
81489
|
const parts = numStr.split('.');
|
|
81464
81490
|
if (parts.length < 2) {
|
|
@@ -83447,7 +83473,7 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
83447
83473
|
const [txHash, setTxHash] = useState('');
|
|
83448
83474
|
const { data: allowance, refetch } = useAllowance(currency, spender, account, chainId);
|
|
83449
83475
|
const { writeContractAsync } = useWriteContract();
|
|
83450
|
-
const { isLoading: isConfirming, isSuccess: isConfirmed } =
|
|
83476
|
+
const { isLoading: isConfirming, isSuccess: isConfirmed } = useMonitorTx(txHash, chainId);
|
|
83451
83477
|
const { addToastError } = usePopups();
|
|
83452
83478
|
const confirmingTxOnChain = isConfirming && !isConfirmed;
|
|
83453
83479
|
useEffect(() => {
|
|
@@ -83748,7 +83774,7 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
83748
83774
|
const { switchChain } = useSwitchChain();
|
|
83749
83775
|
const inputToken = useTokenFromZapList(inputTokenString, chainId);
|
|
83750
83776
|
const { data: hash, sendTransactionAsync } = useSendTransaction();
|
|
83751
|
-
const { isLoading: isConfirming } =
|
|
83777
|
+
const { isLoading: isConfirming } = useMonitorTx(hash, chainId);
|
|
83752
83778
|
const { addToastError } = usePopups();
|
|
83753
83779
|
// Modals
|
|
83754
83780
|
const [onOpenSlippageModal] = useModal(jsx$2(SlippageModal, {}));
|
|
@@ -84236,30 +84262,6 @@ const BonusComponent = ({ trueBondPrices, minTier, bonus, airdropTooltip, toolti
|
|
|
84236
84262
|
}, 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
84263
|
};
|
|
84238
84264
|
|
|
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
84265
|
const BondCards = ({ bondData }) => {
|
|
84264
84266
|
var _a, _b, _c;
|
|
84265
84267
|
const isMobile = useIsMobile();
|
|
@@ -84651,7 +84653,7 @@ const TransactionModal = ({ onDismiss, txChain, approvalState, approveCallback,
|
|
|
84651
84653
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
84652
84654
|
}, [hasToSwitchChain, hasToApprove, txCallback]);
|
|
84653
84655
|
// Close modal if a hash is found. Final Step
|
|
84654
|
-
const { data: txReceipt, isSuccess, isLoading: verifyingTx } =
|
|
84656
|
+
const { data: txReceipt, isSuccess, isLoading: verifyingTx } = useMonitorTx(buyTxHash, txChain);
|
|
84655
84657
|
useEffect(() => {
|
|
84656
84658
|
if (buyTxHash && txReceipt) {
|
|
84657
84659
|
if (isSuccess) {
|
|
@@ -84762,7 +84764,7 @@ const BuyComponent = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
|
|
|
84762
84764
|
// Loading State
|
|
84763
84765
|
const [loadingTx, setLoadingTx] = useState(false);
|
|
84764
84766
|
const { addToastError } = usePopups();
|
|
84765
|
-
const { isLoading: isConfirming, isSuccess: isConfirmed } =
|
|
84767
|
+
const { isLoading: isConfirming, isSuccess: isConfirmed } = useMonitorTx(buyTxHash, userChainId);
|
|
84766
84768
|
const load = loadingTx || (isConfirming && !isConfirmed);
|
|
84767
84769
|
// State Handlers
|
|
84768
84770
|
const handleCurrencySelect = useCallback((newInputToken) => {
|
|
@@ -85070,7 +85072,7 @@ const getTokenBalance = (currency, account) => __awaiter$9(void 0, void 0, void
|
|
|
85070
85072
|
}
|
|
85071
85073
|
});
|
|
85072
85074
|
|
|
85073
|
-
const
|
|
85075
|
+
const BuyComponentSolana = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId, }) => {
|
|
85074
85076
|
var _a, _b, _c, _d, _e, _f;
|
|
85075
85077
|
const SDKConfig = useSDKConfig();
|
|
85076
85078
|
// Hooks
|
|
@@ -85104,7 +85106,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
85104
85106
|
setInputTokenString(newInputToken);
|
|
85105
85107
|
}, []);
|
|
85106
85108
|
const handleBuyCallback = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
85107
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
85109
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
85108
85110
|
if (!accountSolana || !bondData || !inputValue || !inputToken || !bondData)
|
|
85109
85111
|
return;
|
|
85110
85112
|
track({
|
|
@@ -85205,29 +85207,34 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
85205
85207
|
blockhash,
|
|
85206
85208
|
lastValidBlockHeight,
|
|
85207
85209
|
}, 'confirmed');
|
|
85208
|
-
|
|
85209
|
-
if (
|
|
85210
|
+
const txStatus = yield connection.getSignatureStatus(txId, { searchTransactionHistory: true });
|
|
85211
|
+
if (((_d = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _d === void 0 ? void 0 : _d.confirmationStatus) === 'confirmed' || ((_e = txStatus === null || txStatus === void 0 ? void 0 : txStatus.value) === null || _e === void 0 ? void 0 : _e.confirmationStatus) === 'finalized') {
|
|
85212
|
+
console.log('success!');
|
|
85213
|
+
addToastSuccess(txId, bondChain);
|
|
85210
85214
|
setBillId === null || setBillId === void 0 ? void 0 : setBillId(nftMint.publicKey.toString());
|
|
85215
|
+
axios.post(`${(_f = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _f === void 0 ? void 0 : _f.apiV2}/bills/solana/ingest`, {
|
|
85216
|
+
signature: txId,
|
|
85217
|
+
});
|
|
85218
|
+
track({
|
|
85219
|
+
event: 'bond',
|
|
85220
|
+
chain: bondChain,
|
|
85221
|
+
data: {
|
|
85222
|
+
cat: 'lp-buy',
|
|
85223
|
+
type: (_g = bondData === null || bondData === void 0 ? void 0 : bondData.billType) !== null && _g !== void 0 ? _g : '',
|
|
85224
|
+
typedValue: inputValue,
|
|
85225
|
+
principalToken: (_h = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken.symbol) !== null && _h !== void 0 ? _h : '',
|
|
85226
|
+
earnToken: (_j = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol) !== null && _j !== void 0 ? _j : '',
|
|
85227
|
+
address: remove0xPrefix((_k = bondData === null || bondData === void 0 ? void 0 : bondData.contractAddress) === null || _k === void 0 ? void 0 : _k[bondData.chainId]),
|
|
85228
|
+
usdAmount: parseFloat(inputValue) * ((_l = inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) !== null && _l !== void 0 ? _l : 0),
|
|
85229
|
+
},
|
|
85230
|
+
});
|
|
85211
85231
|
}
|
|
85212
|
-
track({
|
|
85213
|
-
event: 'bond',
|
|
85214
|
-
chain: bondChain,
|
|
85215
|
-
data: {
|
|
85216
|
-
cat: 'lp-buy',
|
|
85217
|
-
type: (_d = bondData === null || bondData === void 0 ? void 0 : bondData.billType) !== null && _d !== void 0 ? _d : '',
|
|
85218
|
-
typedValue: inputValue,
|
|
85219
|
-
principalToken: (_e = bondData === null || bondData === void 0 ? void 0 : bondData.lpToken.symbol) !== null && _e !== void 0 ? _e : '',
|
|
85220
|
-
earnToken: (_f = bondData === null || bondData === void 0 ? void 0 : bondData.earnToken.symbol) !== null && _f !== void 0 ? _f : '',
|
|
85221
|
-
address: remove0xPrefix((_g = bondData === null || bondData === void 0 ? void 0 : bondData.contractAddress) === null || _g === void 0 ? void 0 : _g[bondData.chainId]),
|
|
85222
|
-
usdAmount: parseFloat(inputValue) * ((_h = inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price) !== null && _h !== void 0 ? _h : 0),
|
|
85223
|
-
},
|
|
85224
|
-
});
|
|
85225
85232
|
}
|
|
85226
85233
|
catch (error) {
|
|
85227
85234
|
console.error('Error during bond purchase:', error);
|
|
85228
85235
|
addToastError((error === null || error === void 0 ? void 0 : error.message) || 'Unknown error');
|
|
85229
85236
|
reportError$1({
|
|
85230
|
-
apiUrl: (
|
|
85237
|
+
apiUrl: (_m = SDKConfig === null || SDKConfig === void 0 ? void 0 : SDKConfig.urls) === null || _m === void 0 ? void 0 : _m.apiV2,
|
|
85231
85238
|
error: error.message,
|
|
85232
85239
|
extraInfo: { type: 'solanaBuyBond', error: error.message },
|
|
85233
85240
|
chainId: bondChain,
|
|
@@ -85288,7 +85295,7 @@ const BuyBond = ({ onDismiss, bondAddress, bondChain, isProjectView, setBillId }
|
|
|
85288
85295
|
};
|
|
85289
85296
|
|
|
85290
85297
|
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(
|
|
85298
|
+
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
85299
|
};
|
|
85293
85300
|
|
|
85294
85301
|
/*
|
|
@@ -85297,21 +85304,23 @@ const BuyBondModal = ({ onDismiss, bondAddress, bondChain, handlePurchasedBond,
|
|
|
85297
85304
|
* a monitor of the txhash and the search for a bill Id. Finally, if a billId is found the YourBondModal will be shown.
|
|
85298
85305
|
* */
|
|
85299
85306
|
const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
85300
|
-
var _a, _b
|
|
85301
|
-
|
|
85307
|
+
var _a, _b;
|
|
85308
|
+
// State
|
|
85302
85309
|
const [billId, setBillId] = useState('');
|
|
85303
85310
|
const [buyTxHash, setBuyTxHash] = useState('');
|
|
85304
|
-
|
|
85311
|
+
// Hooks
|
|
85305
85312
|
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) {
|
|
85313
|
+
const { refetch } = useUserBonds();
|
|
85314
|
+
const locationPath = window.location.pathname;
|
|
85315
|
+
const { data: txReceipt } = useMonitorTx(buyTxHash, bondChain);
|
|
85316
|
+
// EVM - Look for billId on tx logs
|
|
85317
|
+
if (txReceipt) {
|
|
85314
85318
|
try {
|
|
85319
|
+
const billNftAddress = (_b = (_a = bondsData === null || bondsData === void 0 ? void 0 : bondsData.find((bond) => {
|
|
85320
|
+
var _a, _b;
|
|
85321
|
+
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()) &&
|
|
85322
|
+
bond.chainId === bondChain;
|
|
85323
|
+
})) === null || _a === void 0 ? void 0 : _a.billNnftAddress) === null || _b === void 0 ? void 0 : _b[bondChain];
|
|
85315
85324
|
const { logs } = txReceipt;
|
|
85316
85325
|
const findBillNftLog = logs.find((log) => log.address.toLowerCase() === (billNftAddress === null || billNftAddress === void 0 ? void 0 : billNftAddress.toLowerCase()));
|
|
85317
85326
|
const getBillNftIndex = findBillNftLog === null || findBillNftLog === void 0 ? void 0 : findBillNftLog.topics[findBillNftLog.topics.length - 1];
|
|
@@ -85325,24 +85334,19 @@ const ModalHandler = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
85325
85334
|
console.log(e);
|
|
85326
85335
|
}
|
|
85327
85336
|
}
|
|
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
|
-
});
|
|
85337
|
+
// Trigger refetch once txs are confirmed
|
|
85338
|
+
const hasRefetched = useRef(false);
|
|
85335
85339
|
useEffect(() => {
|
|
85336
|
-
if (
|
|
85337
|
-
|
|
85338
|
-
|
|
85339
|
-
console.log('Trigger');
|
|
85340
|
+
if (!hasRefetched.current) {
|
|
85341
|
+
if (billId) {
|
|
85342
|
+
console.log('Trigger user bonds refetch');
|
|
85340
85343
|
refetch();
|
|
85341
|
-
|
|
85344
|
+
hasRefetched.current = true;
|
|
85345
|
+
}
|
|
85342
85346
|
}
|
|
85343
85347
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
85344
85348
|
}, [billId]);
|
|
85345
|
-
return billId ? (
|
|
85349
|
+
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
85350
|
window.history.pushState({}, '', `${locationPath !== '/bonds' ? locationPath : '/bonds'}`);
|
|
85347
85351
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
85348
85352
|
} }));
|
|
@@ -85616,7 +85620,7 @@ const ModalHandlerPreTGE = ({ onDismiss, bondAddress, bondChain, }) => {
|
|
|
85616
85620
|
const [inputAmount, setInputAmount] = useState('');
|
|
85617
85621
|
const [buyTxHash, setBuyTxHash] = useState('');
|
|
85618
85622
|
const [bond, setBond] = useState();
|
|
85619
|
-
const { data: txReceipt, isSuccess } =
|
|
85623
|
+
const { data: txReceipt, isSuccess } = useMonitorTx(buyTxHash, bondChain);
|
|
85620
85624
|
useEffect(() => {
|
|
85621
85625
|
if (inputAmount && bonds && txReceipt && isSuccess) {
|
|
85622
85626
|
const bond = bonds.find((bond) => {
|
|
@@ -86198,6 +86202,7 @@ const Bonds = () => {
|
|
|
86198
86202
|
useHotBonds();
|
|
86199
86203
|
const { favTokens } = useFavoriteTokens();
|
|
86200
86204
|
const { data: bondData, refetch } = useBondsData();
|
|
86205
|
+
useUserBonds();
|
|
86201
86206
|
const { data: allBonds } = useBondsList();
|
|
86202
86207
|
const { data: allPreBonds } = useBondsListPreTGE();
|
|
86203
86208
|
const { data: chainFilterOption, setChainFilterOption } = useChainFilterOption();
|
|
@@ -86297,7 +86302,7 @@ const Bonds = () => {
|
|
|
86297
86302
|
}
|
|
86298
86303
|
/* eslint-disable react-hooks/exhaustive-deps */
|
|
86299
86304
|
}, [(_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
|
|
86305
|
+
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
86306
|
width: '100%',
|
|
86302
86307
|
height: '300px',
|
|
86303
86308
|
background: 'white2',
|
|
@@ -86306,7 +86311,7 @@ const Bonds = () => {
|
|
|
86306
86311
|
alignItems: 'center',
|
|
86307
86312
|
flexDirection: 'column',
|
|
86308
86313
|
mt: '10px',
|
|
86309
|
-
}, children: [jsx$2(Svg, { icon: "StarFilled", width: 75, height: 75 }), jsx$2(Flex
|
|
86314
|
+
}, 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
86315
|
};
|
|
86311
86316
|
|
|
86312
86317
|
var BondsViewOptions$1;
|
|
@@ -103749,4 +103754,4 @@ const SingleBondWithProviders = (props) => {
|
|
|
103749
103754
|
};
|
|
103750
103755
|
|
|
103751
103756
|
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 };
|
|
103757
|
+
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 };
|