@ape.swap/bonds-sdk 1.0.1-seedify → 1.0.2-seedify
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/main.js +476 -639
- package/dist/scss/BondModal.scss +0 -1
- package/dist/{components → views/Bonds/components}/BondRows/BondRow.d.ts +2 -2
- package/dist/{components → views/Bonds/components}/BondRows/BondRowHeader.d.ts +1 -1
- package/dist/{components → views/Bonds/components}/BondRows/BondRowsByChain.d.ts +2 -2
- package/dist/{components → views/Bonds/components}/BondRows/BondRowsWithTitle.d.ts +3 -2
- package/package.json +4 -4
- /package/dist/{components → views/Bonds/components}/BondRows/ChainTitle.d.ts +0 -0
package/dist/main.js
CHANGED
|
@@ -3,6 +3,7 @@ import React__default, { forwardRef, useContext, useState, useEffect, useCallbac
|
|
|
3
3
|
import { useChainId, useSwitchChain, useWriteContract, useWaitForTransactionReceipt, useAccount, useSendTransaction } from 'wagmi';
|
|
4
4
|
import { useQuery, useQueryClient } from '@tanstack/react-query';
|
|
5
5
|
import axios from 'axios';
|
|
6
|
+
import { parseEther } from 'viem';
|
|
6
7
|
|
|
7
8
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
8
9
|
|
|
@@ -5340,7 +5341,7 @@ var cjs = deepmerge_1;
|
|
|
5340
5341
|
var deepmerge$1 = /*@__PURE__*/getDefaultExportFromCjs(cjs);
|
|
5341
5342
|
|
|
5342
5343
|
var name = "@emotion/react";
|
|
5343
|
-
var version$
|
|
5344
|
+
var version$i = "11.13.3";
|
|
5344
5345
|
var main = "dist/emotion-react.cjs.js";
|
|
5345
5346
|
var module = "dist/emotion-react.esm.js";
|
|
5346
5347
|
var exports = {
|
|
@@ -5655,7 +5656,7 @@ var preconstruct = {
|
|
|
5655
5656
|
};
|
|
5656
5657
|
var packageInfo = {
|
|
5657
5658
|
name: name,
|
|
5658
|
-
version: version$
|
|
5659
|
+
version: version$i,
|
|
5659
5660
|
main: main,
|
|
5660
5661
|
module: module,
|
|
5661
5662
|
exports: exports,
|
|
@@ -25174,9 +25175,9 @@ function useBondNFTData(id, billNftAddress, chainId) {
|
|
|
25174
25175
|
}
|
|
25175
25176
|
const getBondNFTData = (id, billNftAddress, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
25176
25177
|
try {
|
|
25177
|
-
console.log('Bond NFT Data: Started')
|
|
25178
|
+
// console.log('Bond NFT Data: Started')
|
|
25178
25179
|
const billNFTData = yield getBillNftBatchData([id], billNftAddress, chainId);
|
|
25179
|
-
console.log('Bond NFT Data: Finished')
|
|
25180
|
+
// console.log('Bond NFT Data: Finished')
|
|
25180
25181
|
return billNFTData[0];
|
|
25181
25182
|
}
|
|
25182
25183
|
catch (e) {
|
|
@@ -45989,7 +45990,7 @@ bn.exports;
|
|
|
45989
45990
|
var bnExports = bn.exports;
|
|
45990
45991
|
var BN$1 = /*@__PURE__*/getDefaultExportFromCjs(bnExports);
|
|
45991
45992
|
|
|
45992
|
-
const version$
|
|
45993
|
+
const version$h = "logger/5.7.0";
|
|
45993
45994
|
|
|
45994
45995
|
let _permanentCensorErrors = false;
|
|
45995
45996
|
let _censorErrors = false;
|
|
@@ -46304,7 +46305,7 @@ class Logger {
|
|
|
46304
46305
|
}
|
|
46305
46306
|
static globalLogger() {
|
|
46306
46307
|
if (!_globalLogger) {
|
|
46307
|
-
_globalLogger = new Logger(version$
|
|
46308
|
+
_globalLogger = new Logger(version$h);
|
|
46308
46309
|
}
|
|
46309
46310
|
return _globalLogger;
|
|
46310
46311
|
}
|
|
@@ -46340,9 +46341,9 @@ class Logger {
|
|
|
46340
46341
|
Logger.errors = ErrorCode;
|
|
46341
46342
|
Logger.levels = LogLevel;
|
|
46342
46343
|
|
|
46343
|
-
const version$
|
|
46344
|
+
const version$g = "bytes/5.7.0";
|
|
46344
46345
|
|
|
46345
|
-
const logger$o = new Logger(version$
|
|
46346
|
+
const logger$o = new Logger(version$g);
|
|
46346
46347
|
///////////////////////////////
|
|
46347
46348
|
function isHexable(value) {
|
|
46348
46349
|
return !!(value.toHexString);
|
|
@@ -46740,10 +46741,10 @@ function splitSignature(signature) {
|
|
|
46740
46741
|
return result;
|
|
46741
46742
|
}
|
|
46742
46743
|
|
|
46743
|
-
const version$
|
|
46744
|
+
const version$f = "bignumber/5.7.0";
|
|
46744
46745
|
|
|
46745
46746
|
var BN = BN$1.BN;
|
|
46746
|
-
const logger$n = new Logger(version$
|
|
46747
|
+
const logger$n = new Logger(version$f);
|
|
46747
46748
|
const _constructorGuard$3 = {};
|
|
46748
46749
|
const MAX_SAFE = 0x1fffffffffffff;
|
|
46749
46750
|
function isBigNumberish(value) {
|
|
@@ -47031,7 +47032,7 @@ function _base36To16(value) {
|
|
|
47031
47032
|
return (new BN(value, 36)).toString(16);
|
|
47032
47033
|
}
|
|
47033
47034
|
|
|
47034
|
-
const logger$m = new Logger(version$
|
|
47035
|
+
const logger$m = new Logger(version$f);
|
|
47035
47036
|
const _constructorGuard$2 = {};
|
|
47036
47037
|
const Zero$2 = BigNumber.from(0);
|
|
47037
47038
|
const NegativeOne$2 = BigNumber.from(-1);
|
|
@@ -47385,7 +47386,7 @@ class FixedNumber {
|
|
|
47385
47386
|
const ONE = FixedNumber.from(1);
|
|
47386
47387
|
const BUMP = FixedNumber.from("0.5");
|
|
47387
47388
|
|
|
47388
|
-
const version$
|
|
47389
|
+
const version$e = "properties/5.7.0";
|
|
47389
47390
|
|
|
47390
47391
|
var __awaiter$8 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
47391
47392
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -47396,7 +47397,7 @@ var __awaiter$8 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
47396
47397
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47397
47398
|
});
|
|
47398
47399
|
};
|
|
47399
|
-
const logger$l = new Logger(version$
|
|
47400
|
+
const logger$l = new Logger(version$e);
|
|
47400
47401
|
function defineReadOnly(object, name, value) {
|
|
47401
47402
|
Object.defineProperty(object, name, {
|
|
47402
47403
|
enumerable: true,
|
|
@@ -47510,9 +47511,9 @@ class Description {
|
|
|
47510
47511
|
}
|
|
47511
47512
|
}
|
|
47512
47513
|
|
|
47513
|
-
const version$
|
|
47514
|
+
const version$d = "abi/5.7.0";
|
|
47514
47515
|
|
|
47515
|
-
const logger$k = new Logger(version$
|
|
47516
|
+
const logger$k = new Logger(version$d);
|
|
47516
47517
|
const _constructorGuard$1 = {};
|
|
47517
47518
|
let ModifiersBytes = { calldata: true, memory: true, storage: true };
|
|
47518
47519
|
let ModifiersNest = { calldata: true, memory: true };
|
|
@@ -48360,7 +48361,7 @@ function splitNesting(value) {
|
|
|
48360
48361
|
return result;
|
|
48361
48362
|
}
|
|
48362
48363
|
|
|
48363
|
-
const logger$j = new Logger(version$
|
|
48364
|
+
const logger$j = new Logger(version$d);
|
|
48364
48365
|
function checkResultErrors(result) {
|
|
48365
48366
|
// Find the first error (if any)
|
|
48366
48367
|
const errors = [];
|
|
@@ -49163,9 +49164,9 @@ function keccak256(data) {
|
|
|
49163
49164
|
return '0x' + sha3.keccak_256(arrayify(data));
|
|
49164
49165
|
}
|
|
49165
49166
|
|
|
49166
|
-
const version$
|
|
49167
|
+
const version$c = "rlp/5.7.0";
|
|
49167
49168
|
|
|
49168
|
-
const logger$i = new Logger(version$
|
|
49169
|
+
const logger$i = new Logger(version$c);
|
|
49169
49170
|
function arrayifyInteger(value) {
|
|
49170
49171
|
const result = [];
|
|
49171
49172
|
while (value) {
|
|
@@ -49280,9 +49281,9 @@ function decode$2(data) {
|
|
|
49280
49281
|
return decoded.result;
|
|
49281
49282
|
}
|
|
49282
49283
|
|
|
49283
|
-
const version$
|
|
49284
|
+
const version$b = "address/5.7.0";
|
|
49284
49285
|
|
|
49285
|
-
const logger$h = new Logger(version$
|
|
49286
|
+
const logger$h = new Logger(version$b);
|
|
49286
49287
|
function getChecksumAddress(address) {
|
|
49287
49288
|
if (!isHexString(address, 20)) {
|
|
49288
49289
|
logger$h.throwArgumentError("invalid address", "address", address);
|
|
@@ -49422,7 +49423,7 @@ class AnonymousCoder extends Coder {
|
|
|
49422
49423
|
}
|
|
49423
49424
|
}
|
|
49424
49425
|
|
|
49425
|
-
const logger$g = new Logger(version$
|
|
49426
|
+
const logger$g = new Logger(version$d);
|
|
49426
49427
|
function pack(writer, coders, values) {
|
|
49427
49428
|
let arrayValues = null;
|
|
49428
49429
|
if (Array.isArray(values)) {
|
|
@@ -49755,9 +49756,9 @@ class NumberCoder extends Coder {
|
|
|
49755
49756
|
}
|
|
49756
49757
|
}
|
|
49757
49758
|
|
|
49758
|
-
const version$
|
|
49759
|
+
const version$a = "strings/5.7.0";
|
|
49759
49760
|
|
|
49760
|
-
const logger$f = new Logger(version$
|
|
49761
|
+
const logger$f = new Logger(version$a);
|
|
49761
49762
|
///////////////////////////////
|
|
49762
49763
|
var UnicodeNormalizationForm;
|
|
49763
49764
|
(function (UnicodeNormalizationForm) {
|
|
@@ -50040,7 +50041,7 @@ class TupleCoder extends Coder {
|
|
|
50040
50041
|
}
|
|
50041
50042
|
}
|
|
50042
50043
|
|
|
50043
|
-
const logger$e = new Logger(version$
|
|
50044
|
+
const logger$e = new Logger(version$d);
|
|
50044
50045
|
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
|
|
50045
50046
|
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
|
|
50046
50047
|
class AbiCoder {
|
|
@@ -50123,7 +50124,7 @@ function id(text) {
|
|
|
50123
50124
|
return keccak256(toUtf8Bytes(text));
|
|
50124
50125
|
}
|
|
50125
50126
|
|
|
50126
|
-
const version$
|
|
50127
|
+
const version$9 = "hash/5.7.0";
|
|
50127
50128
|
|
|
50128
50129
|
function decode$1(textData) {
|
|
50129
50130
|
textData = atob(textData);
|
|
@@ -50559,7 +50560,7 @@ function consume_emoji_reversed(cps, eaten) {
|
|
|
50559
50560
|
return emoji;
|
|
50560
50561
|
}
|
|
50561
50562
|
|
|
50562
|
-
const logger$d = new Logger(version$
|
|
50563
|
+
const logger$d = new Logger(version$9);
|
|
50563
50564
|
const Zeros = new Uint8Array(32);
|
|
50564
50565
|
Zeros.fill(0);
|
|
50565
50566
|
function checkComponent(comp) {
|
|
@@ -50624,7 +50625,7 @@ var __awaiter$7 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
50624
50625
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50625
50626
|
});
|
|
50626
50627
|
};
|
|
50627
|
-
const logger$c = new Logger(version$
|
|
50628
|
+
const logger$c = new Logger(version$9);
|
|
50628
50629
|
const padding = new Uint8Array(32);
|
|
50629
50630
|
padding.fill(0);
|
|
50630
50631
|
const NegativeOne = BigNumber.from(-1);
|
|
@@ -51048,7 +51049,7 @@ class TypedDataEncoder {
|
|
|
51048
51049
|
}
|
|
51049
51050
|
}
|
|
51050
51051
|
|
|
51051
|
-
const logger$b = new Logger(version$
|
|
51052
|
+
const logger$b = new Logger(version$d);
|
|
51052
51053
|
class LogDescription extends Description {
|
|
51053
51054
|
}
|
|
51054
51055
|
class TransactionDescription extends Description {
|
|
@@ -51794,7 +51795,7 @@ var multicallV2Abi = [
|
|
|
51794
51795
|
}
|
|
51795
51796
|
];
|
|
51796
51797
|
|
|
51797
|
-
const version$
|
|
51798
|
+
const version$8 = "abstract-provider/5.7.0";
|
|
51798
51799
|
|
|
51799
51800
|
var __awaiter$6 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
51800
51801
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -51805,7 +51806,7 @@ var __awaiter$6 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
51805
51806
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
51806
51807
|
});
|
|
51807
51808
|
};
|
|
51808
|
-
const logger$a = new Logger(version$
|
|
51809
|
+
const logger$a = new Logger(version$8);
|
|
51809
51810
|
//export type CallTransactionable = {
|
|
51810
51811
|
// call(transaction: TransactionRequest): Promise<TransactionResponse>;
|
|
51811
51812
|
//};
|
|
@@ -51856,7 +51857,7 @@ class Provider {
|
|
|
51856
51857
|
}
|
|
51857
51858
|
}
|
|
51858
51859
|
|
|
51859
|
-
const version$
|
|
51860
|
+
const version$7 = "abstract-signer/5.7.0";
|
|
51860
51861
|
|
|
51861
51862
|
var __awaiter$5 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
51862
51863
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -51867,7 +51868,7 @@ var __awaiter$5 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
51867
51868
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
51868
51869
|
});
|
|
51869
51870
|
};
|
|
51870
|
-
const logger$9 = new Logger(version$
|
|
51871
|
+
const logger$9 = new Logger(version$7);
|
|
51871
51872
|
const allowedTransactionKeys$1 = [
|
|
51872
51873
|
"accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value"
|
|
51873
51874
|
];
|
|
@@ -55857,9 +55858,9 @@ elliptic.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/(null);
|
|
|
55857
55858
|
|
|
55858
55859
|
var EC$1 = elliptic_1.ec;
|
|
55859
55860
|
|
|
55860
|
-
const version$
|
|
55861
|
+
const version$6 = "signing-key/5.7.0";
|
|
55861
55862
|
|
|
55862
|
-
const logger$8 = new Logger(version$
|
|
55863
|
+
const logger$8 = new Logger(version$6);
|
|
55863
55864
|
let _curve = null;
|
|
55864
55865
|
function getCurve() {
|
|
55865
55866
|
if (!_curve) {
|
|
@@ -55928,9 +55929,9 @@ function computePublicKey(key, compressed) {
|
|
|
55928
55929
|
return logger$8.throwArgumentError("invalid public or private key", "key", "[REDACTED]");
|
|
55929
55930
|
}
|
|
55930
55931
|
|
|
55931
|
-
const version$
|
|
55932
|
+
const version$5 = "transactions/5.7.0";
|
|
55932
55933
|
|
|
55933
|
-
const logger$7 = new Logger(version$
|
|
55934
|
+
const logger$7 = new Logger(version$5);
|
|
55934
55935
|
var TransactionTypes;
|
|
55935
55936
|
(function (TransactionTypes) {
|
|
55936
55937
|
TransactionTypes[TransactionTypes["legacy"] = 0] = "legacy";
|
|
@@ -56198,7 +56199,7 @@ function parse(rawTransaction) {
|
|
|
56198
56199
|
});
|
|
56199
56200
|
}
|
|
56200
56201
|
|
|
56201
|
-
const version$
|
|
56202
|
+
const version$4 = "contracts/5.7.0";
|
|
56202
56203
|
|
|
56203
56204
|
var __awaiter$4 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
56204
56205
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -56209,7 +56210,7 @@ var __awaiter$4 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
56209
56210
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
56210
56211
|
});
|
|
56211
56212
|
};
|
|
56212
|
-
const logger$6 = new Logger(version$
|
|
56213
|
+
const logger$6 = new Logger(version$4);
|
|
56213
56214
|
function resolveName(resolver, nameOrPromise) {
|
|
56214
56215
|
return __awaiter$4(this, void 0, void 0, function* () {
|
|
56215
56216
|
const name = yield nameOrPromise;
|
|
@@ -57200,9 +57201,9 @@ function sha256(data) {
|
|
|
57200
57201
|
return "0x" + (hash.sha256().update(arrayify(data)).digest("hex"));
|
|
57201
57202
|
}
|
|
57202
57203
|
|
|
57203
|
-
const version$
|
|
57204
|
+
const version$3 = "networks/5.7.1";
|
|
57204
57205
|
|
|
57205
|
-
const logger$5 = new Logger(version$
|
|
57206
|
+
const logger$5 = new Logger(version$3);
|
|
57206
57207
|
function isRenetworkable(value) {
|
|
57207
57208
|
return (value && typeof (value.renetwork) === "function");
|
|
57208
57209
|
}
|
|
@@ -57446,7 +57447,7 @@ function getNetwork(network) {
|
|
|
57446
57447
|
};
|
|
57447
57448
|
}
|
|
57448
57449
|
|
|
57449
|
-
const version$
|
|
57450
|
+
const version$2 = "web/5.7.1";
|
|
57450
57451
|
|
|
57451
57452
|
var __awaiter$3 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
57452
57453
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -57523,7 +57524,7 @@ var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
57523
57524
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
57524
57525
|
});
|
|
57525
57526
|
};
|
|
57526
|
-
const logger$4 = new Logger(version$
|
|
57527
|
+
const logger$4 = new Logger(version$2);
|
|
57527
57528
|
function staller(duration) {
|
|
57528
57529
|
return new Promise((resolve) => {
|
|
57529
57530
|
setTimeout(resolve, duration);
|
|
@@ -58093,9 +58094,9 @@ var bech32 = {
|
|
|
58093
58094
|
|
|
58094
58095
|
var bech32$1 = /*@__PURE__*/getDefaultExportFromCjs(bech32);
|
|
58095
58096
|
|
|
58096
|
-
const version$
|
|
58097
|
+
const version$1 = "providers/5.7.2";
|
|
58097
58098
|
|
|
58098
|
-
const logger$3 = new Logger(version$
|
|
58099
|
+
const logger$3 = new Logger(version$1);
|
|
58099
58100
|
class Formatter {
|
|
58100
58101
|
constructor() {
|
|
58101
58102
|
this.formats = this.getDefaultFormats();
|
|
@@ -58516,7 +58517,7 @@ var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
58516
58517
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
58517
58518
|
});
|
|
58518
58519
|
};
|
|
58519
|
-
const logger$2 = new Logger(version$
|
|
58520
|
+
const logger$2 = new Logger(version$1);
|
|
58520
58521
|
const MAX_CCIP_REDIRECTS = 10;
|
|
58521
58522
|
//////////////////////////////
|
|
58522
58523
|
// Event Serializeing
|
|
@@ -60505,7 +60506,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
60505
60506
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
60506
60507
|
});
|
|
60507
60508
|
};
|
|
60508
|
-
const logger$1 = new Logger(version$
|
|
60509
|
+
const logger$1 = new Logger(version$1);
|
|
60509
60510
|
const errorGas = ["call", "estimateGas"];
|
|
60510
60511
|
function spelunk(value, requireData) {
|
|
60511
60512
|
if (value == null) {
|
|
@@ -61157,9 +61158,9 @@ class JsonRpcProvider extends BaseProvider {
|
|
|
61157
61158
|
}
|
|
61158
61159
|
}
|
|
61159
61160
|
|
|
61160
|
-
const version
|
|
61161
|
+
const version = "units/5.7.0";
|
|
61161
61162
|
|
|
61162
|
-
const logger = new Logger(version
|
|
61163
|
+
const logger = new Logger(version);
|
|
61163
61164
|
const names = [
|
|
61164
61165
|
"wei",
|
|
61165
61166
|
"kwei",
|
|
@@ -61169,7 +61170,7 @@ const names = [
|
|
|
61169
61170
|
"finney",
|
|
61170
61171
|
"ether",
|
|
61171
61172
|
];
|
|
61172
|
-
function parseUnits
|
|
61173
|
+
function parseUnits(value, unitName) {
|
|
61173
61174
|
if (typeof (value) !== "string") {
|
|
61174
61175
|
logger.throwArgumentError("value must be a string", "value", value);
|
|
61175
61176
|
}
|
|
@@ -64301,7 +64302,7 @@ function useTokenPrices() {
|
|
|
64301
64302
|
}
|
|
64302
64303
|
const getTokenPrices = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
64303
64304
|
try {
|
|
64304
|
-
console.log('Token Prices: Started')
|
|
64305
|
+
// console.log('Token Prices: Started')
|
|
64305
64306
|
const response = yield axios.get('https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/staging/config/tokens.json');
|
|
64306
64307
|
const tokenList = response.data;
|
|
64307
64308
|
const prices = [];
|
|
@@ -64313,7 +64314,7 @@ const getTokenPrices = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
|
64313
64314
|
// Keep only successfully fulfilled promises and discard the rest
|
|
64314
64315
|
const successfulPromises = all === null || all === void 0 ? void 0 : all.filter((result) => result.status === 'fulfilled');
|
|
64315
64316
|
const successfulPrices = successfulPromises.map((result) => result.value);
|
|
64316
|
-
console.log('Token Prices: Finished')
|
|
64317
|
+
// console.log('Token Prices: Finished')
|
|
64317
64318
|
return successfulPrices.flat();
|
|
64318
64319
|
}
|
|
64319
64320
|
catch (_a) {
|
|
@@ -64570,7 +64571,7 @@ supportedChainId, lpTokens) {
|
|
|
64570
64571
|
if (lpTokens && protocol == types.Protocols.Algebra) {
|
|
64571
64572
|
protocol = types.Protocols.Gamma;
|
|
64572
64573
|
}
|
|
64573
|
-
if (lpTokens && protocol == types.Protocols.V3
|
|
64574
|
+
if (lpTokens && protocol == types.Protocols.V3) {
|
|
64574
64575
|
protocol = types.Protocols.Steer;
|
|
64575
64576
|
}
|
|
64576
64577
|
if ([types.ChainId.LINEA, types.ChainId.LIGHTLINK, types.ChainId.IOTA, types.ChainId.BASE, types.ChainId.ARBITRUM].includes(supportedChainId) &&
|
|
@@ -64669,7 +64670,7 @@ function useBondsList() {
|
|
|
64669
64670
|
}
|
|
64670
64671
|
const getBondsList = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
64671
64672
|
try {
|
|
64672
|
-
console.log('
|
|
64673
|
+
// console.log('Bond List: Fetching')
|
|
64673
64674
|
const response = yield axios.get('https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/staging/config/bills.json');
|
|
64674
64675
|
return response.data;
|
|
64675
64676
|
}
|
|
@@ -64787,9 +64788,9 @@ function useUserBonds() {
|
|
|
64787
64788
|
}
|
|
64788
64789
|
const getUserBonds = (account, bondList) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
64789
64790
|
try {
|
|
64790
|
-
console.log('User Bonds: Started')
|
|
64791
|
+
// console.log('User Bonds: Started')
|
|
64791
64792
|
const results = yield Promise.all(MAINNET_CHAINS.map((chain) => fetchUserOwnedBillsDataAsync(chain, account, bondList)));
|
|
64792
|
-
console.log('User Bonds: Finished')
|
|
64793
|
+
// console.log('User Bonds: Finished')
|
|
64793
64794
|
return results.flat().flatMap((results) => results.userOwnedBills);
|
|
64794
64795
|
}
|
|
64795
64796
|
catch (_a) {
|
|
@@ -64879,259 +64880,141 @@ const YourBonds = () => {
|
|
|
64879
64880
|
return (jsx$2(Fragment$1, { children: jsxs(Flex$1, { className: "yourbonds table-container", children: [jsx$2(Flex$1, { className: "bondrow-header filters", children: jsx$2(BondMenu, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setInputValue('') }) }), jsxs(Flex$1, { className: "yourbonds header-container", children: [jsx$2(Flex$1, { className: "yourbonds column-tokens", children: jsx$2(Flex$1, { className: "yourbonds column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] }, children: jsx$2(Input, { value: inputValue, onChange: handleInputChange, variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }) }), jsxs(Flex$1, { className: "yourbonds column-bondinfo", children: [jsxs(Flex$1, { className: "yourbonds header-claimable", children: ["CLAIMABLE", jsx$2(Flex$1, { className: "yourbonds header-icon", onClick: () => handleSort('claimable'), children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs(Flex$1, { className: "yourbonds header-pending", children: ["PENDING", jsx$2(Flex$1, { className: "yourbonds header-icon", onClick: () => handleSort('pending'), children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs(Flex$1, { className: "yourbonds header-terms", children: ["TERMS", jsx$2(Flex$1, { className: "yourbonds header-icon", onClick: () => handleSort('terms'), children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2(Flex$1, { className: "yourbonds header-claimall" })] })] }), !account ? (jsx$2(DisconnectedPlaceholder, {})) : filteredBonds && (filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.length) > 0 ? (filteredBonds === null || filteredBonds === void 0 ? void 0 : filteredBonds.map((bill) => jsx$2(UserBondRow, { bill: bill }, bill.id))) : (jsx$2(Flex$1, { className: "yourbonds-spinner", children: jsx$2(Spinner, { size: 100 }) }))] }) }));
|
|
64880
64881
|
};
|
|
64881
64882
|
|
|
64882
|
-
|
|
64883
|
-
|
|
64884
|
-
|
|
64885
|
-
|
|
64886
|
-
const
|
|
64887
|
-
|
|
64888
|
-
|
|
64889
|
-
|
|
64890
|
-
|
|
64891
|
-
|
|
64892
|
-
|
|
64893
|
-
|
|
64894
|
-
|
|
64895
|
-
|
|
64896
|
-
|
|
64897
|
-
|
|
64898
|
-
};
|
|
64899
|
-
|
|
64900
|
-
|
|
64901
|
-
|
|
64902
|
-
|
|
64903
|
-
|
|
64904
|
-
|
|
64905
|
-
|
|
64906
|
-
const styles$4 = {
|
|
64907
|
-
listCardContainer: {
|
|
64908
|
-
borderRadius: 0,
|
|
64909
|
-
flexDirection: ['column', 'column', 'column', 'row'],
|
|
64910
|
-
alignItems: 'center',
|
|
64911
|
-
justifyContent: 'space-between',
|
|
64912
|
-
background: 'white2',
|
|
64913
|
-
borderBottom: '1px solid rgba(226, 226, 226, .2)',
|
|
64914
|
-
padding: ['10px 20px 10px 20px', '10px 20px 10px 20px', '10px 20px 10px 20px', '0 30px 0 30px'],
|
|
64915
|
-
margin: '0 10px 0 10px',
|
|
64916
|
-
maxWidth: ['500px', '500px', '500px', '100%'],
|
|
64917
|
-
minWidth: '300px',
|
|
64918
|
-
width: '100%',
|
|
64919
|
-
height: ['unset', 'unset', 'unset', '86px'],
|
|
64920
|
-
},
|
|
64921
|
-
listViewContainer: {
|
|
64922
|
-
display: 'flex',
|
|
64923
|
-
flexDirection: 'column',
|
|
64924
|
-
alignItems: 'center',
|
|
64925
|
-
width: '100%',
|
|
64926
|
-
},
|
|
64927
|
-
titleContainer: {
|
|
64928
|
-
width: '100%',
|
|
64929
|
-
justifyContent: 'space-between',
|
|
64930
|
-
my: '5px',
|
|
64931
|
-
},
|
|
64932
|
-
infoContentMobile: {
|
|
64933
|
-
display: ['flex', 'flex', 'flex', 'none'],
|
|
64934
|
-
alignItems: 'center',
|
|
64935
|
-
},
|
|
64936
|
-
tokensContainer: {
|
|
64937
|
-
alignItems: 'center',
|
|
64938
|
-
height: '100%',
|
|
64939
|
-
width: '100%',
|
|
64940
|
-
},
|
|
64941
|
-
titleText: {
|
|
64942
|
-
opacity: 0.6,
|
|
64943
|
-
fontSize: '12px',
|
|
64944
|
-
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
64945
|
-
fontWeight: 400,
|
|
64946
|
-
},
|
|
64947
|
-
skeleton: {
|
|
64948
|
-
width: ['45px', '45px', '60px'],
|
|
64949
|
-
maxHeight: '18px',
|
|
64950
|
-
minHeight: '18px',
|
|
64951
|
-
},
|
|
64952
|
-
valueText: {
|
|
64953
|
-
fontSize: ['12px', '12px', '12px', '14px'],
|
|
64954
|
-
color: 'primaryBright',
|
|
64955
|
-
lineHeight: '16px',
|
|
64956
|
-
fontWeight: 700,
|
|
64957
|
-
mr: '5px',
|
|
64958
|
-
display: 'flex',
|
|
64959
|
-
alignItems: 'center',
|
|
64960
|
-
},
|
|
64961
|
-
secondaryText: {
|
|
64962
|
-
fontSize: '12px',
|
|
64963
|
-
color: 'gray',
|
|
64964
|
-
lineHeight: '16px',
|
|
64965
|
-
fontWeight: 400,
|
|
64966
|
-
},
|
|
64967
|
-
cardContentContainer: {
|
|
64968
|
-
width: '100%',
|
|
64969
|
-
height: '100%',
|
|
64970
|
-
alignItems: 'center',
|
|
64971
|
-
justifyContent: 'flex-end',
|
|
64972
|
-
},
|
|
64973
|
-
animationDiv: {
|
|
64974
|
-
position: 'relative',
|
|
64975
|
-
width: '100%',
|
|
64976
|
-
maxWidth: ['500px', '500px', '500px', '100%'],
|
|
64977
|
-
minWidth: '300px',
|
|
64978
|
-
},
|
|
64979
|
-
expandedWrapper: {
|
|
64980
|
-
background: 'white3',
|
|
64981
|
-
flexDirection: 'column',
|
|
64982
|
-
justifyContent: 'space-between',
|
|
64983
|
-
padding: '15px 10px',
|
|
64984
|
-
flexWrap: 'wrap',
|
|
64985
|
-
alignItems: 'center',
|
|
64986
|
-
},
|
|
64987
|
-
};
|
|
64988
|
-
|
|
64989
|
-
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
64990
|
-
return (jsxs(Flex, { sx: style, children: [jsx$2(Flex, { sx: { alignItems: 'center' }, children: jsx$2(Text, { sx: styles$4.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$4.skeleton }) }) }) })) : (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center' }, children: value ? value : jsx$2(Skeleton, { sx: styles$4.skeleton }) }))] }));
|
|
64991
|
-
};
|
|
64992
|
-
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
64993
|
-
|
|
64994
|
-
const styles$3 = {
|
|
64995
|
-
infoRow: {
|
|
64996
|
-
justifyContent: 'space-between',
|
|
64997
|
-
width: '100%',
|
|
64998
|
-
marginBottom: '5px',
|
|
64999
|
-
},
|
|
65000
|
-
linkRow: {
|
|
65001
|
-
width: '100%',
|
|
65002
|
-
marginTop: '5px',
|
|
65003
|
-
justifyContent: 'flex-end',
|
|
65004
|
-
'& svg': { width: '11px' },
|
|
65005
|
-
},
|
|
65006
|
-
titleText: {
|
|
65007
|
-
fontSize: '12px',
|
|
65008
|
-
lineHeight: '14px',
|
|
65009
|
-
fontWeight: 500,
|
|
65010
|
-
},
|
|
65011
|
-
contentText: {
|
|
65012
|
-
fontSize: '12px',
|
|
65013
|
-
lineHeight: '14px',
|
|
65014
|
-
fontWeight: 700,
|
|
65015
|
-
},
|
|
65016
|
-
iconButton: {
|
|
65017
|
-
background: 'white3',
|
|
65018
|
-
textDecoration: 'none',
|
|
65019
|
-
alignItems: 'center',
|
|
65020
|
-
justifyContent: 'center',
|
|
65021
|
-
width: 'fit-content',
|
|
65022
|
-
height: '30px',
|
|
65023
|
-
padding: '2px 5px',
|
|
65024
|
-
borderRadius: '8px',
|
|
65025
|
-
margin: '0 5px 5px 0',
|
|
65026
|
-
'&:hover': {
|
|
65027
|
-
cursor: 'pointer',
|
|
65028
|
-
},
|
|
65029
|
-
},
|
|
65030
|
-
link: {
|
|
65031
|
-
fontSize: '12px',
|
|
65032
|
-
lineHeight: '14px',
|
|
65033
|
-
display: 'flex',
|
|
65034
|
-
textDecoration: 'none',
|
|
65035
|
-
'&: hover': { textDecoration: 'underline' },
|
|
65036
|
-
},
|
|
65037
|
-
};
|
|
65038
|
-
|
|
65039
|
-
const ButtonsRow = ({ projectLink, twitter, bubble, audit, }) => {
|
|
65040
|
-
const bubbleURL = `https://app.bubblemaps.io/bsc/token/${bubble}`;
|
|
65041
|
-
return (jsxs(Flex, { sx: { justifyContent: 'center' }, children: [jsx$2(Flex, { sx: styles$3.iconButton, as: Link, href: projectLink, target: "_blank", children: jsx$2(Svg, { icon: "URL", width: 18 }) }), jsx$2(Flex, { sx: styles$3.iconButton, as: Link, href: twitter, target: "_blank", children: jsx$2(Svg, { icon: "twitter", width: 18, color: "text" }) }), bubble && (jsx$2(Flex, { sx: styles$3.iconButton, as: Link, href: bubbleURL, target: "_blank", children: jsx$2(Svg, { icon: "bubble", width: 18, color: "text" }) })), audit && (jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$3.iconButton), { margin: '0 0 5px 0', '& svg': { marginRight: '5px' } }), as: Link, href: audit, target: "_blank", children: [jsx$2(Svg, { icon: "audit", width: 18, color: "text" }), jsx$2(Text, { sx: { paddingRight: '5px' }, children: 'Audit' })] }))] }));
|
|
64883
|
+
// This basically returns the 2 tags with the higher active bond count
|
|
64884
|
+
const useTopTags = (initialBondList) => {
|
|
64885
|
+
const bonds = initialBondList;
|
|
64886
|
+
const countTagsInBonds = (bonds) => {
|
|
64887
|
+
const tagCount = {};
|
|
64888
|
+
bonds === null || bonds === void 0 ? void 0 : bonds.forEach((bond) => {
|
|
64889
|
+
var _a;
|
|
64890
|
+
if (bond.soldOut)
|
|
64891
|
+
return;
|
|
64892
|
+
(_a = bond.tags) === null || _a === void 0 ? void 0 : _a.forEach((tag) => {
|
|
64893
|
+
if (tag in tagCount) {
|
|
64894
|
+
tagCount[tag] += 1;
|
|
64895
|
+
}
|
|
64896
|
+
else {
|
|
64897
|
+
tagCount[tag] = 1;
|
|
64898
|
+
}
|
|
64899
|
+
});
|
|
64900
|
+
});
|
|
64901
|
+
return tagCount;
|
|
64902
|
+
};
|
|
64903
|
+
const activeBonds = bonds === null || bonds === void 0 ? void 0 : bonds.filter((bond) => !bond.soldOut);
|
|
64904
|
+
const countedTags = countTagsInBonds(activeBonds);
|
|
64905
|
+
const sortedTagsArray = Object.entries(countedTags).sort((a, b) => b[1] - a[1]);
|
|
64906
|
+
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
65042
64907
|
};
|
|
65043
64908
|
|
|
65044
|
-
const
|
|
65045
|
-
|
|
65046
|
-
const
|
|
65047
|
-
|
|
64909
|
+
const isBondSoldOut = (bill) => {
|
|
64910
|
+
var _a;
|
|
64911
|
+
const { tokensRemaining, discount, payoutTokenPrice, billAddress } = bill;
|
|
64912
|
+
if (bill.soldOut)
|
|
64913
|
+
return true;
|
|
64914
|
+
if (bill.inactive)
|
|
64915
|
+
return true;
|
|
64916
|
+
if (!tokensRemaining)
|
|
64917
|
+
return false;
|
|
64918
|
+
const thresholdToHide = new BigNumber$1(100).div(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : 0);
|
|
64919
|
+
if (discount && discount > 50) {
|
|
64920
|
+
// If discount is over 50% it will be hidden
|
|
64921
|
+
// console.log('Soldout contract:', billAddress)
|
|
64922
|
+
return true;
|
|
64923
|
+
}
|
|
64924
|
+
if (((_a = new BigNumber$1(tokensRemaining)) === null || _a === void 0 ? void 0 : _a.lte(thresholdToHide)) || discount === 100) {
|
|
64925
|
+
// If there's less than 100 usd bond will be hidden
|
|
64926
|
+
// console.log('Soldout contract: ', billAddress)
|
|
64927
|
+
return true;
|
|
64928
|
+
}
|
|
64929
|
+
else
|
|
64930
|
+
return false;
|
|
65048
64931
|
};
|
|
65049
|
-
|
|
65050
|
-
|
|
65051
|
-
|
|
65052
|
-
|
|
65053
|
-
|
|
65054
|
-
|
|
65055
|
-
|
|
65056
|
-
|
|
65057
|
-
|
|
65058
|
-
|
|
65059
|
-
* stablecoins (around 1$ in value always) for the sake of readability
|
|
65060
|
-
* @param digits number of digits after the decimal for non-price amounts
|
|
65061
|
-
* @param round whether or not to round up non-price amounts
|
|
65062
|
-
*/
|
|
65063
|
-
const formatDollar = ({ num, isPrice = false, lessPreciseStablecoinValues = false, digits = 2, round = true, }) => {
|
|
65064
|
-
// For USD dollar denominated prices.
|
|
65065
|
-
if (isPrice) {
|
|
65066
|
-
if (num === 0)
|
|
65067
|
-
return '$0.00';
|
|
65068
|
-
if (!num)
|
|
65069
|
-
return '-';
|
|
65070
|
-
if (num < 0.000001) {
|
|
65071
|
-
return `$${num.toExponential(2)}`;
|
|
64932
|
+
const sortBonds = (sortConfig, bonds) => {
|
|
64933
|
+
const bondsToSort = bonds !== null && bonds !== void 0 ? bonds : [];
|
|
64934
|
+
if (!sortConfig) {
|
|
64935
|
+
return bondsToSort;
|
|
64936
|
+
}
|
|
64937
|
+
return [...bondsToSort].sort((a, b) => {
|
|
64938
|
+
let aValue, bValue;
|
|
64939
|
+
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === 'arr') {
|
|
64940
|
+
aValue = calculateARR(a);
|
|
64941
|
+
bValue = calculateARR(b);
|
|
65072
64942
|
}
|
|
65073
|
-
if (
|
|
65074
|
-
|
|
64943
|
+
else if (sortConfig.key === 'tokensRemaining') {
|
|
64944
|
+
aValue = remainingPercentage(a);
|
|
64945
|
+
bValue = remainingPercentage(b);
|
|
65075
64946
|
}
|
|
65076
|
-
|
|
65077
|
-
|
|
65078
|
-
|
|
65079
|
-
return `$${num.toFixed(3)}`;
|
|
64947
|
+
else if (sortConfig.key === 'terms') {
|
|
64948
|
+
aValue = vestingTime(a.vestingTerm).days;
|
|
64949
|
+
bValue = vestingTime(b.vestingTerm).days;
|
|
65080
64950
|
}
|
|
65081
|
-
|
|
65082
|
-
|
|
65083
|
-
|
|
65084
|
-
else {
|
|
65085
|
-
if (num === 0)
|
|
65086
|
-
return '$0.00';
|
|
65087
|
-
if (!num)
|
|
65088
|
-
return '-';
|
|
65089
|
-
if (num < 0.000001) {
|
|
65090
|
-
return '$<0.000001';
|
|
64951
|
+
else {
|
|
64952
|
+
aValue = a[sortConfig.key];
|
|
64953
|
+
bValue = b[sortConfig.key];
|
|
65091
64954
|
}
|
|
65092
|
-
if (
|
|
65093
|
-
return
|
|
64955
|
+
if (aValue < bValue) {
|
|
64956
|
+
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
65094
64957
|
}
|
|
65095
|
-
if (
|
|
65096
|
-
return
|
|
64958
|
+
if (aValue > bValue) {
|
|
64959
|
+
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
65097
64960
|
}
|
|
65098
|
-
return
|
|
65099
|
-
|
|
65100
|
-
average: round,
|
|
65101
|
-
mantissa: num > 1000 ? 2 : digits,
|
|
65102
|
-
abbreviations: {
|
|
65103
|
-
million: 'M',
|
|
65104
|
-
billion: 'B',
|
|
65105
|
-
},
|
|
65106
|
-
})
|
|
65107
|
-
.toUpperCase();
|
|
65108
|
-
}
|
|
64961
|
+
return 0;
|
|
64962
|
+
});
|
|
65109
64963
|
};
|
|
65110
|
-
const
|
|
65111
|
-
|
|
65112
|
-
|
|
65113
|
-
|
|
65114
|
-
|
|
65115
|
-
|
|
65116
|
-
|
|
64964
|
+
const calculateARR = (bond) => {
|
|
64965
|
+
var _a;
|
|
64966
|
+
const discount = (_a = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _a !== void 0 ? _a : 0;
|
|
64967
|
+
const vestingDays = vestingTime(bond.vestingTerm).days;
|
|
64968
|
+
return parseFloat(((discount * 365) / vestingDays).toFixed(2));
|
|
64969
|
+
};
|
|
64970
|
+
const vestingTime = (vestingTerm) => {
|
|
64971
|
+
return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
|
|
64972
|
+
};
|
|
64973
|
+
const remainingPercentage = (bond) => {
|
|
64974
|
+
var _a, _b, _c, _d;
|
|
64975
|
+
const totalMaxPayout = new BigNumber$1((_a = bond.maxTotalPayout) !== null && _a !== void 0 ? _a : '0').div(new BigNumber$1(10).pow((_c = (_b = bond.earnToken.decimals) === null || _b === void 0 ? void 0 : _b[bond.chainId]) !== null && _c !== void 0 ? _c : 18));
|
|
64976
|
+
const remainingTokens = new BigNumber$1((_d = bond.tokensRemaining) !== null && _d !== void 0 ? _d : '0');
|
|
64977
|
+
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
64978
|
+
};
|
|
64979
|
+
|
|
64980
|
+
function useBondsData() {
|
|
64981
|
+
return useQuery({
|
|
64982
|
+
queryKey: [QUERY_KEYS.BONDS_DATA],
|
|
64983
|
+
queryFn: getBondsData,
|
|
64984
|
+
refetchInterval: 30000, // i.e. 30 sec
|
|
64985
|
+
refetchOnWindowFocus: false,
|
|
64986
|
+
retry: 1,
|
|
64987
|
+
initialData: [],
|
|
64988
|
+
});
|
|
64989
|
+
}
|
|
64990
|
+
const getBondsData = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
64991
|
+
try {
|
|
64992
|
+
const response = yield axios.get('https://realtime-api.ape.bond/bonds');
|
|
64993
|
+
return response.data.bonds;
|
|
65117
64994
|
}
|
|
65118
|
-
|
|
65119
|
-
return
|
|
64995
|
+
catch (_a) {
|
|
64996
|
+
return [];
|
|
65120
64997
|
}
|
|
65121
|
-
|
|
65122
|
-
|
|
64998
|
+
});
|
|
64999
|
+
|
|
65000
|
+
function useHotBonds() {
|
|
65001
|
+
return useQuery({
|
|
65002
|
+
queryKey: [QUERY_KEYS.HOT_BONDS],
|
|
65003
|
+
queryFn: getHotBonds,
|
|
65004
|
+
refetchOnWindowFocus: false,
|
|
65005
|
+
retry: 1,
|
|
65006
|
+
initialData: [],
|
|
65007
|
+
});
|
|
65008
|
+
}
|
|
65009
|
+
const getHotBonds = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
65010
|
+
try {
|
|
65011
|
+
const response = yield axios.get('https://apeswap-strapi.herokuapp.com/hot-bonds');
|
|
65012
|
+
return response.data.map((bond) => bond.BondAddress.toLowerCase());
|
|
65123
65013
|
}
|
|
65124
|
-
|
|
65125
|
-
|
|
65126
|
-
|
|
65127
|
-
|
|
65128
|
-
abbreviations: {
|
|
65129
|
-
million: 'M',
|
|
65130
|
-
billion: 'B',
|
|
65131
|
-
},
|
|
65132
|
-
})
|
|
65133
|
-
.toUpperCase();
|
|
65134
|
-
};
|
|
65014
|
+
catch (_a) {
|
|
65015
|
+
return [];
|
|
65016
|
+
}
|
|
65017
|
+
});
|
|
65135
65018
|
|
|
65136
65019
|
function adjustDecimals(numStr) {
|
|
65137
65020
|
const parts = numStr.split('.');
|
|
@@ -65150,9 +65033,9 @@ function adjustDecimals(numStr) {
|
|
|
65150
65033
|
const convertToTokenValue = (numberString, decimals) => {
|
|
65151
65034
|
if (isNaN(parseFloat(numberString))) {
|
|
65152
65035
|
console.error('Error: numberString to parse is not a number');
|
|
65153
|
-
return parseUnits
|
|
65036
|
+
return parseUnits('0', decimals);
|
|
65154
65037
|
}
|
|
65155
|
-
const tokenValue = parseUnits
|
|
65038
|
+
const tokenValue = parseUnits(adjustDecimals(numberString), decimals);
|
|
65156
65039
|
return tokenValue;
|
|
65157
65040
|
};
|
|
65158
65041
|
|
|
@@ -65208,7 +65091,7 @@ const getPremiumColor = (bond, inputValue) => {
|
|
|
65208
65091
|
return parseFloat(getPremium) < 0 ? 'premium-negative' : 'premium-positive';
|
|
65209
65092
|
};
|
|
65210
65093
|
|
|
65211
|
-
const styles$
|
|
65094
|
+
const styles$4 = {
|
|
65212
65095
|
toPanelContainer: {
|
|
65213
65096
|
position: 'relative',
|
|
65214
65097
|
width: '100%',
|
|
@@ -66039,170 +65922,6 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
66039
65922
|
return [approvalState !== null && approvalState !== void 0 ? approvalState : ApprovalState.NOT_APPROVED, handleApprove];
|
|
66040
65923
|
};
|
|
66041
65924
|
|
|
66042
|
-
const version = '2.21.17';
|
|
66043
|
-
|
|
66044
|
-
let errorConfig = {
|
|
66045
|
-
getDocsUrl: ({ docsBaseUrl, docsPath = '', docsSlug, }) => docsPath
|
|
66046
|
-
? `${docsBaseUrl ?? 'https://viem.sh'}${docsPath}${docsSlug ? `#${docsSlug}` : ''}`
|
|
66047
|
-
: undefined,
|
|
66048
|
-
version,
|
|
66049
|
-
};
|
|
66050
|
-
class BaseError extends Error {
|
|
66051
|
-
constructor(shortMessage, args = {}) {
|
|
66052
|
-
const details = (() => {
|
|
66053
|
-
if (args.cause instanceof BaseError)
|
|
66054
|
-
return args.cause.details;
|
|
66055
|
-
if (args.cause?.message)
|
|
66056
|
-
return args.cause.message;
|
|
66057
|
-
return args.details;
|
|
66058
|
-
})();
|
|
66059
|
-
const docsPath = (() => {
|
|
66060
|
-
if (args.cause instanceof BaseError)
|
|
66061
|
-
return args.cause.docsPath || args.docsPath;
|
|
66062
|
-
return args.docsPath;
|
|
66063
|
-
})();
|
|
66064
|
-
const docsUrl = errorConfig.getDocsUrl?.({ ...args, docsPath });
|
|
66065
|
-
const message = [
|
|
66066
|
-
shortMessage || 'An error occurred.',
|
|
66067
|
-
'',
|
|
66068
|
-
...(args.metaMessages ? [...args.metaMessages, ''] : []),
|
|
66069
|
-
...(docsUrl ? [`Docs: ${docsUrl}`] : []),
|
|
66070
|
-
...(details ? [`Details: ${details}`] : []),
|
|
66071
|
-
...([`Version: ${errorConfig.version}`] ),
|
|
66072
|
-
].join('\n');
|
|
66073
|
-
super(message, args.cause ? { cause: args.cause } : undefined);
|
|
66074
|
-
Object.defineProperty(this, "details", {
|
|
66075
|
-
enumerable: true,
|
|
66076
|
-
configurable: true,
|
|
66077
|
-
writable: true,
|
|
66078
|
-
value: void 0
|
|
66079
|
-
});
|
|
66080
|
-
Object.defineProperty(this, "docsPath", {
|
|
66081
|
-
enumerable: true,
|
|
66082
|
-
configurable: true,
|
|
66083
|
-
writable: true,
|
|
66084
|
-
value: void 0
|
|
66085
|
-
});
|
|
66086
|
-
Object.defineProperty(this, "metaMessages", {
|
|
66087
|
-
enumerable: true,
|
|
66088
|
-
configurable: true,
|
|
66089
|
-
writable: true,
|
|
66090
|
-
value: void 0
|
|
66091
|
-
});
|
|
66092
|
-
Object.defineProperty(this, "shortMessage", {
|
|
66093
|
-
enumerable: true,
|
|
66094
|
-
configurable: true,
|
|
66095
|
-
writable: true,
|
|
66096
|
-
value: void 0
|
|
66097
|
-
});
|
|
66098
|
-
Object.defineProperty(this, "version", {
|
|
66099
|
-
enumerable: true,
|
|
66100
|
-
configurable: true,
|
|
66101
|
-
writable: true,
|
|
66102
|
-
value: void 0
|
|
66103
|
-
});
|
|
66104
|
-
Object.defineProperty(this, "name", {
|
|
66105
|
-
enumerable: true,
|
|
66106
|
-
configurable: true,
|
|
66107
|
-
writable: true,
|
|
66108
|
-
value: 'BaseError'
|
|
66109
|
-
});
|
|
66110
|
-
this.details = details;
|
|
66111
|
-
this.docsPath = docsPath;
|
|
66112
|
-
this.metaMessages = args.metaMessages;
|
|
66113
|
-
this.name = args.name ?? this.name;
|
|
66114
|
-
this.shortMessage = shortMessage;
|
|
66115
|
-
this.version = version;
|
|
66116
|
-
}
|
|
66117
|
-
walk(fn) {
|
|
66118
|
-
return walk(this, fn);
|
|
66119
|
-
}
|
|
66120
|
-
}
|
|
66121
|
-
function walk(err, fn) {
|
|
66122
|
-
if (fn?.(err))
|
|
66123
|
-
return err;
|
|
66124
|
-
if (err && typeof err === 'object' && 'cause' in err)
|
|
66125
|
-
return walk(err.cause, fn);
|
|
66126
|
-
return fn ? null : err;
|
|
66127
|
-
}
|
|
66128
|
-
|
|
66129
|
-
const etherUnits = {
|
|
66130
|
-
gwei: 9,
|
|
66131
|
-
wei: 18,
|
|
66132
|
-
};
|
|
66133
|
-
|
|
66134
|
-
class InvalidDecimalNumberError extends BaseError {
|
|
66135
|
-
constructor({ value }) {
|
|
66136
|
-
super(`Number \`${value}\` is not a valid decimal number.`, {
|
|
66137
|
-
name: 'InvalidDecimalNumberError',
|
|
66138
|
-
});
|
|
66139
|
-
}
|
|
66140
|
-
}
|
|
66141
|
-
|
|
66142
|
-
/**
|
|
66143
|
-
* Multiplies a string representation of a number by a given exponent of base 10 (10exponent).
|
|
66144
|
-
*
|
|
66145
|
-
* - Docs: https://viem.sh/docs/utilities/parseUnits
|
|
66146
|
-
*
|
|
66147
|
-
* @example
|
|
66148
|
-
* import { parseUnits } from 'viem'
|
|
66149
|
-
*
|
|
66150
|
-
* parseUnits('420', 9)
|
|
66151
|
-
* // 420000000000n
|
|
66152
|
-
*/
|
|
66153
|
-
function parseUnits(value, decimals) {
|
|
66154
|
-
if (!/^(-?)([0-9]*)\.?([0-9]*)$/.test(value))
|
|
66155
|
-
throw new InvalidDecimalNumberError({ value });
|
|
66156
|
-
let [integer, fraction = '0'] = value.split('.');
|
|
66157
|
-
const negative = integer.startsWith('-');
|
|
66158
|
-
if (negative)
|
|
66159
|
-
integer = integer.slice(1);
|
|
66160
|
-
// trim trailing zeros.
|
|
66161
|
-
fraction = fraction.replace(/(0+)$/, '');
|
|
66162
|
-
// round off if the fraction is larger than the number of decimals.
|
|
66163
|
-
if (decimals === 0) {
|
|
66164
|
-
if (Math.round(Number(`.${fraction}`)) === 1)
|
|
66165
|
-
integer = `${BigInt(integer) + 1n}`;
|
|
66166
|
-
fraction = '';
|
|
66167
|
-
}
|
|
66168
|
-
else if (fraction.length > decimals) {
|
|
66169
|
-
const [left, unit, right] = [
|
|
66170
|
-
fraction.slice(0, decimals - 1),
|
|
66171
|
-
fraction.slice(decimals - 1, decimals),
|
|
66172
|
-
fraction.slice(decimals),
|
|
66173
|
-
];
|
|
66174
|
-
const rounded = Math.round(Number(`${unit}.${right}`));
|
|
66175
|
-
if (rounded > 9)
|
|
66176
|
-
fraction = `${BigInt(left) + BigInt(1)}0`.padStart(left.length + 1, '0');
|
|
66177
|
-
else
|
|
66178
|
-
fraction = `${left}${rounded}`;
|
|
66179
|
-
if (fraction.length > decimals) {
|
|
66180
|
-
fraction = fraction.slice(1);
|
|
66181
|
-
integer = `${BigInt(integer) + 1n}`;
|
|
66182
|
-
}
|
|
66183
|
-
fraction = fraction.slice(0, decimals);
|
|
66184
|
-
}
|
|
66185
|
-
else {
|
|
66186
|
-
fraction = fraction.padEnd(decimals, '0');
|
|
66187
|
-
}
|
|
66188
|
-
return BigInt(`${negative ? '-' : ''}${integer}${fraction}`);
|
|
66189
|
-
}
|
|
66190
|
-
|
|
66191
|
-
/**
|
|
66192
|
-
* Converts a string representation of ether to numerical wei.
|
|
66193
|
-
*
|
|
66194
|
-
* - Docs: https://viem.sh/docs/utilities/parseEther
|
|
66195
|
-
*
|
|
66196
|
-
* @example
|
|
66197
|
-
* import { parseEther } from 'viem'
|
|
66198
|
-
*
|
|
66199
|
-
* parseEther('420')
|
|
66200
|
-
* // 420000000000000000000n
|
|
66201
|
-
*/
|
|
66202
|
-
function parseEther(ether, unit = 'wei') {
|
|
66203
|
-
return parseUnits(ether, etherUnits[unit]);
|
|
66204
|
-
}
|
|
66205
|
-
|
|
66206
65925
|
const useTokenFromZapList = (tokenString, chainId, principalToken) => {
|
|
66207
65926
|
var _a;
|
|
66208
65927
|
if (tokenString === 'NATIVE')
|
|
@@ -66325,7 +66044,7 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
66325
66044
|
setPendingTx(true);
|
|
66326
66045
|
yield approveCallback().finally(() => setPendingTx(false));
|
|
66327
66046
|
}), []);
|
|
66328
|
-
return (jsxs(Modal, { children: [jsx$2(ModalHeader, { onDismiss: onDismiss, children: jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: [jsxs(Text, { sx: { fontSize: '22px', fontWeight: 700, lineHeight: '30px' }, children: ["Zap ", jsx$2(Svg, { icon: "ZapIcon" })] }), jsx$2(Flex, { onClick: onOpenSlippageModal, sx: { mr: '15px' }, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })] }) }), jsxs(Flex, { sx: { flexDirection: 'column', pt: '10px', gap: '10px' }, children: [jsx$2(Flex, { sx: { position: 'relative' }, children: jsx$2(Text, { children: "From:" }) }), jsx$2(Flex, { sx: { width: '100%', height: 'auto', justifyContent: 'space-between' }, children: jsx$2(TokenSelectorPanel, { typedValue: typedValue, setTypedValue: setTypedValue, selectedToken: inputToken, handleMaxBtn: handleMaxInput, handleCurrencySelect: handleCurrencySelect, chainId: chainId, enableZap: true, tokenBalance: inputTokenBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }) }), jsxs(Flex, { sx: { position: 'relative', mt: '10px' }, children: [jsx$2(Text, { children: "To:" }), jsx$2(Box$1, { sx: { position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)' }, children: jsx$2(Svg, { icon: "ZapArrow" }) })] }), jsxs(Flex, { sx: styles$
|
|
66047
|
+
return (jsxs(Modal, { children: [jsx$2(ModalHeader, { onDismiss: onDismiss, children: jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: [jsxs(Text, { sx: { fontSize: '22px', fontWeight: 700, lineHeight: '30px' }, children: ["Zap ", jsx$2(Svg, { icon: "ZapIcon" })] }), jsx$2(Flex, { onClick: onOpenSlippageModal, sx: { mr: '15px' }, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })] }) }), jsxs(Flex, { sx: { flexDirection: 'column', pt: '10px', gap: '10px' }, children: [jsx$2(Flex, { sx: { position: 'relative' }, children: jsx$2(Text, { children: "From:" }) }), jsx$2(Flex, { sx: { width: '100%', height: 'auto', justifyContent: 'space-between' }, children: jsx$2(TokenSelectorPanel, { typedValue: typedValue, setTypedValue: setTypedValue, selectedToken: inputToken, handleMaxBtn: handleMaxInput, handleCurrencySelect: handleCurrencySelect, chainId: chainId, enableZap: true, tokenBalance: inputTokenBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }) }), jsxs(Flex, { sx: { position: 'relative', mt: '10px' }, children: [jsx$2(Text, { children: "To:" }), jsx$2(Box$1, { sx: { position: 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)' }, children: jsx$2(Svg, { icon: "ZapArrow" }) })] }), jsxs(Flex, { sx: styles$4.toPanelContainer, children: [jsxs(Flex, { sx: styles$4.cont, children: [jsx$2(NumericInput, { value: parseFloat(outputValue) === 0 ? '' : outputValue, onUserInput: () => null }), jsxs(Flex, { sx: styles$4.tokensContainer, children: [lodashExports.isArray(splited) && jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 28 }), jsx$2(Text, { sx: styles$4.tokenSymbolText, children: outputToken === null || outputToken === void 0 ? void 0 : outputToken.symbol })] })] }), jsxs(Flex, { sx: { width: '100%', justifyContent: 'space-between' }, children: [jsx$2(Flex, { sx: { alignItems: 'center', justifyContent: 'center' }, children: jsx$2(Text, { size: "12px", sx: { opacity: 0.8 }, children: outputTokenPrice &&
|
|
66329
66048
|
(outputTokenPrice === null || outputTokenPrice === void 0 ? void 0 : outputTokenPrice.price) &&
|
|
66330
66049
|
outputValue &&
|
|
66331
66050
|
parseFloat(outputValue) !== 0 &&
|
|
@@ -72151,40 +71870,20 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
|
|
|
72151
71870
|
return [isLoading, response, estimateOutput];
|
|
72152
71871
|
};
|
|
72153
71872
|
|
|
72154
|
-
function useBondsData() {
|
|
72155
|
-
return useQuery({
|
|
72156
|
-
queryKey: [QUERY_KEYS.BONDS_DATA],
|
|
72157
|
-
queryFn: getBondsData,
|
|
72158
|
-
refetchInterval: 30000, // i.e. 30 sec
|
|
72159
|
-
refetchOnWindowFocus: false,
|
|
72160
|
-
retry: 1,
|
|
72161
|
-
initialData: [],
|
|
72162
|
-
});
|
|
72163
|
-
}
|
|
72164
|
-
const getBondsData = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
72165
|
-
try {
|
|
72166
|
-
const response = yield axios.get('https://realtime-api.ape.bond/bonds');
|
|
72167
|
-
return response.data.bonds;
|
|
72168
|
-
}
|
|
72169
|
-
catch (_a) {
|
|
72170
|
-
return [];
|
|
72171
|
-
}
|
|
72172
|
-
});
|
|
72173
|
-
|
|
72174
71873
|
const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?', accordionBody = 'Body', accordionVisible = false, variant = 'standard', onDismiss, }) => {
|
|
72175
71874
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
72176
71875
|
// Hooks
|
|
72177
71876
|
const userChainId = useChainId();
|
|
72178
71877
|
const { address: account } = useAccount();
|
|
72179
71878
|
const { switchChain } = useSwitchChain();
|
|
72180
|
-
const { writeContractAsync } = useWriteContract();
|
|
71879
|
+
const { writeContractAsync, isPending, isSuccess, submittedAt } = useWriteContract();
|
|
72181
71880
|
const { sendTransactionAsync } = useSendTransaction();
|
|
72182
71881
|
const { data: bonds } = useBondsData();
|
|
72183
71882
|
// State
|
|
72184
71883
|
const [modalVariant, setModalVariant] = useState(variant);
|
|
72185
71884
|
const [bondData, setBondData] = useState();
|
|
72186
71885
|
const [toastMessage, setToastMessage] = useState(null);
|
|
72187
|
-
const [buyTxHash, setBuyTxHash] = useState(
|
|
71886
|
+
const [buyTxHash, setBuyTxHash] = useState();
|
|
72188
71887
|
const [inputValue, setInputValue] = useState('');
|
|
72189
71888
|
const [inputTokenString, setInputTokenString] = useState('NATIVE');
|
|
72190
71889
|
// Data
|
|
@@ -72209,7 +71908,7 @@ const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?',
|
|
|
72209
71908
|
}, []);
|
|
72210
71909
|
const handleClose = () => {
|
|
72211
71910
|
if (typeof window !== 'undefined') {
|
|
72212
|
-
window.history.pushState({}, '',
|
|
71911
|
+
window.history.pushState({}, '', `/bonds`);
|
|
72213
71912
|
}
|
|
72214
71913
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
72215
71914
|
};
|
|
@@ -72321,9 +72020,9 @@ const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?',
|
|
|
72321
72020
|
setBondData(bond);
|
|
72322
72021
|
setInputTokenString((_c = (_b = (_a = bond === null || bond === void 0 ? void 0 : bond.lpToken) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b[bond.chainId]) !== null && _c !== void 0 ? _c : 'NATIVE');
|
|
72323
72022
|
}, [bondAddress]);
|
|
72324
|
-
return (jsxs(Modal, { className: "modal", children: [jsx$2(ModalHeader, { hideDivider: true, onDismiss: handleClose }), bondData && (jsx$2(Fragment$1, { children: modalVariant === 'standard' ? (
|
|
72023
|
+
return (jsxs(Modal, { className: "modal", sx: { width: 'fit-content', maxWidth: '100%' }, children: [jsx$2(ModalHeader, { hideDivider: true, onDismiss: handleClose }), bondData && (jsx$2(Fragment$1, { children: modalVariant === 'standard' ? (
|
|
72325
72024
|
// <Flex className="modal-backdrop" onClick={handleClose}>
|
|
72326
|
-
jsxs(Flex, { className: "modal-content", children: [window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white' }, children: ["Dev mode - Current view: \"", modalVariant, "\"", jsx$2(Text, { onClick: () => setModalVariant('alt'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), toastMessage && jsx$2(Flex, { className: "toast", children: toastMessage }), jsxs(Flex, { className: "modaltable-container", children: [jsxs(Flex, { className: "modaltable-container title-container", children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: (_g = bondData.showcaseTokenName) !== null && _g !== void 0 ? _g : bondData.earnToken.symbol, size: 50, chain: bondData.chainId }) }), jsx$2(Flex, { className: "title-container bondname", children: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), jsxs(Flex, { className: "title-container price-container", children: [jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bondData)] }), jsxs(Flex, { className: "price-container discounted", children: ["$", discountEarnTokenPrice(bondData)] })] }), jsx$2(Flex, { className: "title-container tokentags", children: jsx$2(ListTag, { text: (_h = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _h === void 0 ? void 0 : _h[0], variant: ((_j = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _j === void 0 ? void 0 : _j[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) }), jsx$2(Flex, { className: "slippage-cog", onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })] }), jsx$2(Flex, { className: "modaltable-container description-container", children: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription }), jsxs(Flex, { className: "modaltable-container blocks-container", children: [jsxs(Flex, { className: `modal-block block-discount ${getDiscountColor(bondData === null || bondData === void 0 ? void 0 : bondData.discount)}`, children: [jsxs(Flex, { className: "block-header", children: ["Discount", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(Flex, { className: "block-content", children: `${(_k = bondData === null || bondData === void 0 ? void 0 : bondData.discount) === null || _k === void 0 ? void 0 : _k.toFixed(2)}%` })] }), jsxs(Flex, { className: "modal-block block-arr", children: [jsxs(Flex, { className: "block-header", children: ["ARR", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(Flex, { className: "block-content", children: `${((((_l = bondData === null || bondData === void 0 ? void 0 : bondData.discount) !== null && _l !== void 0 ? _l : 0) * 365) / vestingTime((_m = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _m !== void 0 ? _m : 0).days).toFixed(2)}%` })] }), jsxs(Flex, { className: "modal-block block-term", children: [jsxs(Flex, { className: "block-header", children: ["Terms", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(Flex, { className: "block-content", children: vestingTime((_o = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _o !== void 0 ? _o : 0).days
|
|
72025
|
+
jsxs(Flex, { className: "modal-content", sx: { width: 'fit-content' }, children: [window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white' }, children: ["Dev mode - Current view: \"", modalVariant, "\"", jsx$2(Text, { onClick: () => setModalVariant('alt'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), toastMessage && jsx$2(Flex, { className: "toast", children: toastMessage }), jsxs(Flex, { className: "modaltable-container", children: [jsxs(Flex, { className: "modaltable-container title-container", children: [jsx$2(Flex, { className: "title-container bondicon", children: jsx$2(TokenImage, { symbol: (_g = bondData.showcaseTokenName) !== null && _g !== void 0 ? _g : bondData.earnToken.symbol, size: 50, chain: bondData.chainId }) }), jsx$2(Flex, { className: "title-container bondname", children: bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName }), jsxs(Flex, { className: "title-container price-container", children: [jsxs(Flex, { className: "price-container price", children: ["$", earnTokenPrice(bondData)] }), jsxs(Flex, { className: "price-container discounted", children: ["$", discountEarnTokenPrice(bondData)] })] }), jsx$2(Flex, { className: "title-container tokentags", children: jsx$2(ListTag, { text: (_h = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _h === void 0 ? void 0 : _h[0], variant: ((_j = bondData === null || bondData === void 0 ? void 0 : bondData.tags) === null || _j === void 0 ? void 0 : _j[0]) === 'Cex Fund' ? 'cex_fund' : 'liquidity' }) }), jsx$2(Flex, { className: "slippage-cog", onClick: onOpenSlippageModal, children: jsx$2(Svg, { icon: "cog", width: "16px" }) })] }), jsx$2(Flex, { className: "modaltable-container description-container", children: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription }), jsxs(Flex, { className: "modaltable-container blocks-container", children: [jsxs(Flex, { className: `modal-block block-discount ${getDiscountColor(bondData === null || bondData === void 0 ? void 0 : bondData.discount)}`, children: [jsxs(Flex, { className: "block-header", children: ["Discount", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(Flex, { className: "block-content", children: `${(_k = bondData === null || bondData === void 0 ? void 0 : bondData.discount) === null || _k === void 0 ? void 0 : _k.toFixed(2)}%` })] }), jsxs(Flex, { className: "modal-block block-arr", children: [jsxs(Flex, { className: "block-header", children: ["ARR", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(Flex, { className: "block-content", children: `${((((_l = bondData === null || bondData === void 0 ? void 0 : bondData.discount) !== null && _l !== void 0 ? _l : 0) * 365) / vestingTime((_m = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _m !== void 0 ? _m : 0).days).toFixed(2)}%` })] }), jsxs(Flex, { className: "modal-block block-term", children: [jsxs(Flex, { className: "block-header", children: ["Terms", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Terms }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(Flex, { className: "block-content", children: vestingTime((_o = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _o !== void 0 ? _o : 0).days
|
|
72327
72026
|
? `${vestingTime((_p = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _p !== void 0 ? _p : 0).days} D`
|
|
72328
72027
|
: '-' })] }), jsxs(Flex, { className: "modal-block block-maxbuy", children: [jsxs(Flex, { className: "block-header", children: ["Max Buy", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.MaxBuy(bondData.earnToken.symbol) }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsx$2(Flex, { className: "block-content", children: (_q = parseFloat(maxBuy(bondData).toFixed(0))) === null || _q === void 0 ? void 0 : _q.toLocaleString('en-US') })] })] }), jsxs(Flex, { className: "modaltable-container text-container", children: [jsxs(Flex, { className: "text-container row", children: [jsx$2(Flex, { className: "row-container spend", children: "You spend:" }), jsxs(Flex, { className: "row-container spend-val", children: [youSpend(inputValue), " ", bondData.lpToken.symbol, " = $", ' ', formatUSDNumber(youSpendUSD(bondData, inputValue))] })] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container premium", children: ["Premium:", jsx$2(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex, { children: TooltipText.Premium }), width: "230px", placement: "bottomLeft", transformTip: "translate(-5%, -5%)", children: jsx$2(Flex, { className: "row-container premium-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px" }) }) })] }), jsxs(Flex, { className: `row-container premium-val ${getPremiumColor(bondData, inputValue)}`, children: ["$ ", premium(bondData, inputValue)] })] }), jsxs(Flex, { className: "text-container row", children: [jsxs(Flex, { className: "row-container get", children: ["You get (over ", vestingTime((_r = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _r !== void 0 ? _r : 0).days, " days):"] }), jsxs(Flex, { className: "row-container get-val", children: [youGet(bondData, inputValue), " ", bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, " = $", ' ', formatUSDNumber(youGetUSD(bondData, inputValue))] })] })] }), jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: (bondData === null || bondData === void 0 ? void 0 : bondData.chainId) !== types.ChainId.IOTA, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { className: "modaltable-container button-container", children: [jsx$2(Flex, { className: "button-container get", children: jsxs(Button, { className: "action-button", onClick: () => notSupportedByLIFI.includes(bondData === null || bondData === void 0 ? void 0 : bondData.chainId) ? openExternal() : onOpenZapModal(), variant: "secondary", children: ["Get ", bondData === null || bondData === void 0 ? void 0 : bondData.lpToken.symbol] }) }), jsx$2(Flex, { className: "button-container buy", children: userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) || !account, onClick: (event) => {
|
|
72329
72028
|
event.stopPropagation();
|
|
@@ -72340,7 +72039,7 @@ const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?',
|
|
|
72340
72039
|
//
|
|
72341
72040
|
//
|
|
72342
72041
|
// <Flex className="modal-backdrop" onClick={handleClose}>
|
|
72343
|
-
jsxs(Flex, { className: "modal-content font-small gpt", children: [window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white' }, children: ["Dev Mode - Current view: \"", modalVariant, "\"", jsx$2(Text, { onClick: () => setModalVariant('standard'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), toastMessage && jsx$2(Flex, { className: "toast", children: toastMessage }), jsx$2(Flex, { className: "modal-header" }), jsxs(Flex, { className: "modaltable-container", sx: { flexDirection: 'row', gap: '20px' }, children: [jsxs(Flex, { sx: { width: '500px', flexDirection: 'column' }, children: [jsx$2("img", { src: "https://placehold.co/400x200" }), jsx$2(Flex, { className: "modaltable-container description-container paragraph-spaced", sx: { marginTop: '20px' }, children: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription })] }), jsxs(Flex, { sx: { flexDirection: 'column', width: '600px' }, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: { minWidth: '300px' }, children: jsxs("h2", { sx: { margin: '0px' }, children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, ' ', jsx$2(Svg, { width: 20, height: 20, icon: (_s = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bondData.chainId]) !== null && _s !== void 0 ? _s : 'question' })] }) }), jsxs(Flex, { sx: { justifyContent: 'space-between', flexGrow: 1 }, children: [jsx$2(TokenImage, { symbol: (_t = bondData.showcaseTokenName) !== null && _t !== void 0 ? _t : bondData.earnToken.symbol, size: 20 }), jsx$2("span", { children: bondData.earnToken.symbol }), " ", jsx$2("span", { children: "|" }), ' ', jsxs("span", { children: ["Market Price: $", earnTokenPrice(bondData)] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', marginTop: '20px' }, children: [jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: true, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { sx: { justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { children: ["You will receive:", jsx$2(Flex, { sx: { marginLeft: '15px', marginRight: '5px' }, children: jsx$2(TokenImage, { symbol: (_u = bondData.showcaseTokenName) !== null && _u !== void 0 ? _u : bondData.earnToken.symbol, size: 20 }) }), (lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), ' ', bondData.earnToken.symbol, " + \u00A0", (youGet(bondData, inputValue) -
|
|
72042
|
+
jsxs(Flex, { className: "modal-content font-small gpt", sx: { width: 'fit-content' }, children: [window.location.origin === 'http://localhost:5173' && (jsxs(Text, { sx: { borderBottom: '1px solid white' }, children: ["Dev Mode - Current view: \"", modalVariant, "\"", jsx$2(Text, { onClick: () => setModalVariant('standard'), sx: { ml: '15px', textDecoration: 'underline', cursor: 'pointer' }, children: "Switch view" })] })), toastMessage && jsx$2(Flex, { className: "toast", children: toastMessage }), jsx$2(Flex, { className: "modal-header" }), jsxs(Flex, { className: "modaltable-container", sx: { flexDirection: 'row', gap: '20px' }, children: [jsxs(Flex, { sx: { width: '500px', flexDirection: 'column' }, children: [jsx$2("img", { src: "https://placehold.co/400x200" }), jsx$2(Flex, { className: "modaltable-container description-container paragraph-spaced", sx: { marginTop: '20px' }, children: bondData === null || bondData === void 0 ? void 0 : bondData.shortDescription })] }), jsxs(Flex, { sx: { flexDirection: 'column', width: '600px' }, children: [jsxs(Flex, { sx: { alignItems: 'center' }, children: [jsx$2(Flex, { sx: { minWidth: '300px' }, children: jsxs("h2", { sx: { margin: '0px' }, children: [bondData === null || bondData === void 0 ? void 0 : bondData.showcaseTokenName, ' ', jsx$2(Svg, { width: 20, height: 20, icon: (_s = NETWORK_ICONS === null || NETWORK_ICONS === void 0 ? void 0 : NETWORK_ICONS[bondData.chainId]) !== null && _s !== void 0 ? _s : 'question' })] }) }), jsxs(Flex, { sx: { justifyContent: 'space-between', flexGrow: 1 }, children: [jsx$2(TokenImage, { symbol: (_t = bondData.showcaseTokenName) !== null && _t !== void 0 ? _t : bondData.earnToken.symbol, size: 20 }), jsx$2("span", { children: bondData.earnToken.symbol }), " ", jsx$2("span", { children: "|" }), ' ', jsxs("span", { children: ["Market Price: $", earnTokenPrice(bondData)] })] })] }), jsxs(Flex, { sx: { flexDirection: 'column', marginTop: '20px' }, children: [jsx$2(TokenSelectorPanel, { typedValue: inputValue, setTypedValue: setInputValue, selectedToken: inputToken, handleMaxBtn: () => { var _a; return setInputValue((_a = new BigNumber$1(inputCurrencyBalance !== null && inputCurrencyBalance !== void 0 ? inputCurrencyBalance : '0')) === null || _a === void 0 ? void 0 : _a.toString()); }, handleCurrencySelect: handleCurrencySelect, chainId: bondData === null || bondData === void 0 ? void 0 : bondData.chainId, enableZap: true, bondPrincipalToken: bondData === null || bondData === void 0 ? void 0 : bondData.lpToken, tokenBalance: inputCurrencyBalance, selectedTokenPrice: inputTokenPrice === null || inputTokenPrice === void 0 ? void 0 : inputTokenPrice.price }), jsxs(Flex, { sx: { justifyContent: 'space-between', alignItems: 'center' }, children: [jsxs(Flex, { children: ["You will receive:", jsx$2(Flex, { sx: { marginLeft: '15px', marginRight: '5px' }, children: jsx$2(TokenImage, { symbol: (_u = bondData.showcaseTokenName) !== null && _u !== void 0 ? _u : bondData.earnToken.symbol, size: 20 }) }), (lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), ' ', bondData.earnToken.symbol, " + \u00A0", (youGet(bondData, inputValue) -
|
|
72344
72043
|
lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), jsx$2("span", { className: "text-highlight", children: "\u00A0additional" })] }), jsx$2(Flex, { className: "button-container buy", sx: { justifyContent: 'end' }, children: userChainId !== bondData.chainId ? (jsx$2(Button, { className: "switch-button button-narrow", disabled: loadingTx || isConfirming || (bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) || !account, onClick: (event) => {
|
|
72345
72044
|
event.stopPropagation();
|
|
72346
72045
|
switchChain({ chainId: bondData.chainId });
|
|
@@ -72348,13 +72047,300 @@ const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?',
|
|
|
72348
72047
|
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
72349
72048
|
!account ||
|
|
72350
72049
|
!inputValue ||
|
|
72351
|
-
parseFloat(inputValue) === 0, onClick: approveCallback, children: ["approve ", isZap ? 'zap' : 'normal'] })) })] }), jsx$2(Flex, { sx: { width: '100%', marginTop: '10px', marginBottom: '10px' }, children: jsx$2("hr", { className: "fading-hr" }) }), jsxs(Flex, { sx: { width: '100%' }, children: [jsxs(Flex, { sx: { width: '50%', flexDirection: 'column' }, children: ["Market Price: $", formatUSDNumber((youGet(bondData, inputValue) * lodashExports.toNumber(earnTokenPrice(bondData))).toString()), jsx$2("hr", { className: "fading-hr" }), jsx$2("span", { className: "text-highlight flex-inline", children: "Our price: " }), jsxs("span", { className: "flex-inline", children: ["$", formatUSDNumber((lodashExports.toNumber(inputValue) * lodashExports.toNumber(bondData.principalTokenPrice)).toString()), ' '] }), jsxs("span", { className: "text-highlight flex-inline", children: ["(discount rate ", bondData === null || bondData === void 0 ? void 0 : bondData.discount.toFixed(2), "%)"] })] }), jsx$2(Flex, { sx: { width: '50px', alignItems: 'center', justifyContent: 'center' }, children: "vs." }), jsxs(Flex, { sx: { width: '50%', flexDirection: 'column' }, children: ["If purchased from market:", ' ', (lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), ' ', bondData.earnToken.symbol, jsx$2("hr", { className: "fading-hr" }), jsx$2("span", { className: "text-highlight flex-inline", children: "Amount you will get:" }), ' ', youGet(bondData, inputValue).toFixed(0),
|
|
72050
|
+
parseFloat(inputValue) === 0, onClick: approveCallback, children: ["approve ", isZap ? 'zap' : 'normal'] })) })] }), jsx$2(Flex, { sx: { width: '100%', marginTop: '10px', marginBottom: '10px' }, children: jsx$2("hr", { className: "fading-hr" }) }), jsxs(Flex, { sx: { width: '100%' }, children: [jsxs(Flex, { sx: { width: '50%', flexDirection: 'column' }, children: ["Market Price: $", formatUSDNumber((youGet(bondData, inputValue) * lodashExports.toNumber(earnTokenPrice(bondData))).toString()), jsx$2("hr", { className: "fading-hr" }), jsx$2("span", { className: "text-highlight flex-inline", children: "Our price: " }), jsxs("span", { className: "flex-inline", children: ["$", formatUSDNumber((lodashExports.toNumber(inputValue) * lodashExports.toNumber(bondData.principalTokenPrice)).toString()), ' '] }), jsxs("span", { className: "text-highlight flex-inline", children: ["(discount rate ", bondData === null || bondData === void 0 ? void 0 : bondData.discount.toFixed(2), "%)"] })] }), jsx$2(Flex, { sx: { width: '50px', alignItems: 'center', justifyContent: 'center' }, children: "vs." }), jsxs(Flex, { sx: { width: '50%', flexDirection: 'column' }, children: ["If purchased from market:", ' ', (lodashExports.toNumber(inputValue) / lodashExports.toNumber(earnTokenPrice(bondData))).toFixed(0), ' ', bondData.earnToken.symbol, jsx$2("hr", { className: "fading-hr" }), jsx$2("span", { className: "text-highlight flex-inline", children: "Amount you will get:" }), ' ', youGet(bondData, inputValue).toFixed(0), ' ', jsx$2("span", { className: "flex-inline", children: bondData.earnToken.symbol })] })] })] })] })] }), jsxs(Flex, { className: "footer-details", children: [jsxs(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: ["Vesting start date: ", moment().format('DD-MMM-YYYY')] }), jsxs(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: ["Vesting end date:", ' ', moment()
|
|
72352
72051
|
.add(vestingTime((_v = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _v !== void 0 ? _v : 0).days, 'days')
|
|
72353
72052
|
.format('DD-MMM-YYYY')] }), jsx$2(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: "Vesting type: Linear" }), jsx$2(Flex, { sx: { width: '25%', justifyContent: 'center' }, children: "What are bonds?" })] }), accordionVisible && (jsx$2(Flex, { className: "modaltable-container accordion-container", children: jsx$2(AccordionText, { title: accordionTitle, body: accordionBody, isVisible: accordionVisible }) }))] })
|
|
72354
72053
|
// </Flex>
|
|
72355
72054
|
) }))] }));
|
|
72356
72055
|
};
|
|
72357
72056
|
|
|
72057
|
+
/** CheckURL purpose is to open the buy bond modal ONLY IF a user has opened the site with a custom URL */
|
|
72058
|
+
const CheckUrl = () => {
|
|
72059
|
+
var _a, _b;
|
|
72060
|
+
if (typeof window === 'undefined')
|
|
72061
|
+
return null;
|
|
72062
|
+
const { data: bonds } = useBondsData();
|
|
72063
|
+
const asPath = window.location.search;
|
|
72064
|
+
const urlParams = new URLSearchParams(new URL(asPath, window.location.origin).search);
|
|
72065
|
+
const bondAddress = (_a = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondAddress')) !== null && _a !== void 0 ? _a : '';
|
|
72066
|
+
const bondChain = (_b = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondChain')) !== null && _b !== void 0 ? _b : '';
|
|
72067
|
+
const bond = useMemo(() => {
|
|
72068
|
+
if (!bondAddress)
|
|
72069
|
+
return undefined;
|
|
72070
|
+
return bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => { var _a; return ((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
|
|
72071
|
+
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
72072
|
+
const [onPresentBuyBillsModal] = useModal(jsx$2(BondModal, { bondAddress: bondAddress, bondChain: parseInt(bondChain) }), true, true, `BuyBondModal:${bondAddress.toLowerCase()}-${bondChain}-${bond === null || bond === void 0 ? void 0 : bond.index}`);
|
|
72073
|
+
useEffect(() => {
|
|
72074
|
+
if (bond && bondChain && bondAddress) {
|
|
72075
|
+
onPresentBuyBillsModal();
|
|
72076
|
+
// track({
|
|
72077
|
+
// event: 'buyModalOpen',
|
|
72078
|
+
// chain: bondChain,
|
|
72079
|
+
// data: {
|
|
72080
|
+
// cat: 'Row', // Row: clicked by user or custom URL. CTA add this to buy button on future A/B testing.
|
|
72081
|
+
// bond: bond.payoutTokenName,
|
|
72082
|
+
// bondChain: bondChain,
|
|
72083
|
+
// },
|
|
72084
|
+
// })
|
|
72085
|
+
}
|
|
72086
|
+
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
72087
|
+
return jsx$2(Fragment$1, {});
|
|
72088
|
+
};
|
|
72089
|
+
|
|
72090
|
+
const BondRowHeader = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFilterOption, filterOptions, filterOption, setFilterOption, onSort, }) => {
|
|
72091
|
+
return (jsxs(Flex$1, { className: "bondrow-header", children: [jsx$2(Flex$1, { className: "bondrow-header filters", children: jsx$2(BondMenu, { chainFilterOption: chainFilterOption !== null && chainFilterOption !== void 0 ? chainFilterOption : ['All Chains'], setChainFilterOption: setChainFilterOption, filterOptions: filterOptions, filterOption: filterOption, setFilterOption: setFilterOption, onHandleQueryChange: () => setSearchQuery('') }) }), jsxs(Flex$1, { className: "bondrow-header rows", children: [jsxs(Flex$1, { className: "column column-tokens header", children: [jsx$2(Flex$1, { className: "column column-search", sx: { width: '100%', maxWidth: ['200px', '200px', '200px', '340px'] }, children: jsx$2(Input, { value: searchQuery, onChange: (event) => setSearchQuery(event.target.value), variant: "search", sx: { fontWeight: 400, background: 'white2', height: '30px', fontSize: '14px', color: 'white' }, width: '100%', placeholder: 'Search...' }) }), jsx$2(Flex$1, { className: "column column-tokenicons header" })] }), jsxs(Flex$1, { className: "column column-bondinfo header", children: [jsxs(Flex$1, { className: "column column-discount header", children: [jsx$2(Flex$1, { className: "column tooltip", children: jsxs(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: TooltipText.Discount }), width: "230px", placement: "bottomLeft", transformTip: "translate(18%, -4%)", children: ["DISCOUNT", jsx$2(Flex$1, { className: "column header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), jsx$2(Flex$1, { className: "column header-icon", onClick: () => onSort('discount'), children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs(Flex$1, { className: "column column-arr header", children: [jsx$2(Flex$1, { className: "column tooltip", children: jsxs(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: TooltipText.ARR }), width: "230px", placement: "bottomLeft", transformTip: "translate(8%, -5%)", children: ["ARR", jsx$2(Flex$1, { className: "column header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), jsx$2(Flex$1, { className: "column header-icon", onClick: () => onSort('arr'), children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs(Flex$1, { className: "column column-terms header", children: [jsx$2(Flex$1, { className: "column tooltip", children: jsxs(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: TooltipText.Terms }), width: "230px", placement: "bottomRight", transformTip: "translate(11%, -5%)", children: ["TERMS", jsx$2(Flex$1, { className: "column header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), jsx$2(Flex$1, { className: "column header-icon", onClick: () => onSort('terms'), children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsxs(Flex$1, { className: "column column-tokensremaining header", children: [jsx$2(Flex$1, { className: "column tooltip", children: jsxs(TooltipBubble, { className: "tooltip-bubble", body: jsx$2(Flex$1, { children: TooltipText.TokensRemaining }), width: "230px", placement: "bottomRight", transformTip: "translate(12%, -4%)", children: ["TOKENS REMAINING", jsx$2(Flex$1, { className: "column header-icon", children: jsx$2(Svg, { icon: "questionCircle", width: "12px", color: "textDisabledButton" }) })] }) }), jsx$2(Flex$1, { className: "column header-icon", onClick: () => onSort('tokensRemaining'), children: jsx$2(Svg, { icon: "sort", width: "12px", color: "textDisabledButton" }) })] }), jsx$2(Flex$1, { className: "column column-hotbond header" })] })] })] }));
|
|
72092
|
+
};
|
|
72093
|
+
|
|
72094
|
+
const ChainTitle = ({ chain, pt, hideTitles, isOpen, }) => {
|
|
72095
|
+
return (jsxs(Flex, { className: "chaintitle", sx: {
|
|
72096
|
+
pt,
|
|
72097
|
+
pb: '10px',
|
|
72098
|
+
color: 'textDisabledButton',
|
|
72099
|
+
fontSize: '13px',
|
|
72100
|
+
fontWeight: 500,
|
|
72101
|
+
cursor: 'pointer',
|
|
72102
|
+
textTransform: 'uppercase',
|
|
72103
|
+
display: hideTitles ? 'none' : 'flex',
|
|
72104
|
+
width: '200px',
|
|
72105
|
+
}, children: [NETWORK_LABEL[chain], " Bonds", jsx$2(Flex, { sx: { ml: '7px' }, children: jsx$2(Svg, { icon: "caret", direction: isOpen ? 'down' : 'up', width: 8, color: "textDisabledButton" }) })] }));
|
|
72106
|
+
};
|
|
72107
|
+
|
|
72108
|
+
const ProgressBar = ({ value, color = 'text' }) => {
|
|
72109
|
+
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: {
|
|
72110
|
+
width: `${value <= 3 ? 3 : value}%`,
|
|
72111
|
+
} }) }) }));
|
|
72112
|
+
};
|
|
72113
|
+
|
|
72114
|
+
const styles$3 = {
|
|
72115
|
+
listCardContainer: {
|
|
72116
|
+
borderRadius: 0,
|
|
72117
|
+
flexDirection: ['column', 'column', 'column', 'row'],
|
|
72118
|
+
alignItems: 'center',
|
|
72119
|
+
justifyContent: 'space-between',
|
|
72120
|
+
background: 'white2',
|
|
72121
|
+
borderBottom: '1px solid rgba(226, 226, 226, .2)',
|
|
72122
|
+
padding: ['10px 20px 10px 20px', '10px 20px 10px 20px', '10px 20px 10px 20px', '0 30px 0 30px'],
|
|
72123
|
+
margin: '0 10px 0 10px',
|
|
72124
|
+
maxWidth: ['500px', '500px', '500px', '100%'],
|
|
72125
|
+
minWidth: '300px',
|
|
72126
|
+
width: '100%',
|
|
72127
|
+
height: ['unset', 'unset', 'unset', '86px'],
|
|
72128
|
+
},
|
|
72129
|
+
listViewContainer: {
|
|
72130
|
+
display: 'flex',
|
|
72131
|
+
flexDirection: 'column',
|
|
72132
|
+
alignItems: 'center',
|
|
72133
|
+
width: '100%',
|
|
72134
|
+
},
|
|
72135
|
+
titleContainer: {
|
|
72136
|
+
width: '100%',
|
|
72137
|
+
justifyContent: 'space-between',
|
|
72138
|
+
my: '5px',
|
|
72139
|
+
},
|
|
72140
|
+
infoContentMobile: {
|
|
72141
|
+
display: ['flex', 'flex', 'flex', 'none'],
|
|
72142
|
+
alignItems: 'center',
|
|
72143
|
+
},
|
|
72144
|
+
tokensContainer: {
|
|
72145
|
+
alignItems: 'center',
|
|
72146
|
+
height: '100%',
|
|
72147
|
+
width: '100%',
|
|
72148
|
+
},
|
|
72149
|
+
titleText: {
|
|
72150
|
+
opacity: 0.6,
|
|
72151
|
+
fontSize: '12px',
|
|
72152
|
+
lineHeight: ['16px', '16px', '16px', '24px'],
|
|
72153
|
+
fontWeight: 400,
|
|
72154
|
+
},
|
|
72155
|
+
skeleton: {
|
|
72156
|
+
width: ['45px', '45px', '60px'],
|
|
72157
|
+
maxHeight: '18px',
|
|
72158
|
+
minHeight: '18px',
|
|
72159
|
+
},
|
|
72160
|
+
valueText: {
|
|
72161
|
+
fontSize: ['12px', '12px', '12px', '14px'],
|
|
72162
|
+
color: 'primaryBright',
|
|
72163
|
+
lineHeight: '16px',
|
|
72164
|
+
fontWeight: 700,
|
|
72165
|
+
mr: '5px',
|
|
72166
|
+
display: 'flex',
|
|
72167
|
+
alignItems: 'center',
|
|
72168
|
+
},
|
|
72169
|
+
secondaryText: {
|
|
72170
|
+
fontSize: '12px',
|
|
72171
|
+
color: 'gray',
|
|
72172
|
+
lineHeight: '16px',
|
|
72173
|
+
fontWeight: 400,
|
|
72174
|
+
},
|
|
72175
|
+
cardContentContainer: {
|
|
72176
|
+
width: '100%',
|
|
72177
|
+
height: '100%',
|
|
72178
|
+
alignItems: 'center',
|
|
72179
|
+
justifyContent: 'flex-end',
|
|
72180
|
+
},
|
|
72181
|
+
animationDiv: {
|
|
72182
|
+
position: 'relative',
|
|
72183
|
+
width: '100%',
|
|
72184
|
+
maxWidth: ['500px', '500px', '500px', '100%'],
|
|
72185
|
+
minWidth: '300px',
|
|
72186
|
+
},
|
|
72187
|
+
expandedWrapper: {
|
|
72188
|
+
background: 'white3',
|
|
72189
|
+
flexDirection: 'column',
|
|
72190
|
+
justifyContent: 'space-between',
|
|
72191
|
+
padding: '15px 10px',
|
|
72192
|
+
flexWrap: 'wrap',
|
|
72193
|
+
alignItems: 'center',
|
|
72194
|
+
},
|
|
72195
|
+
};
|
|
72196
|
+
|
|
72197
|
+
const ProgressBarWrapper = ({ title, value, style, showTooltip, toolTipPlacement, toolTipTransform, toolTip, }) => {
|
|
72198
|
+
return (jsxs(Flex, { sx: style, children: [jsx$2(Flex, { sx: { alignItems: 'center' }, children: jsx$2(Text, { sx: styles$3.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$3.skeleton }) }) }) })) : (jsx$2(Flex, { sx: { justifyContent: 'center', alignItems: 'center' }, children: value ? value : jsx$2(Skeleton, { sx: styles$3.skeleton }) }))] }));
|
|
72199
|
+
};
|
|
72200
|
+
var ProgressBarWrapper$1 = React__default.memo(ProgressBarWrapper);
|
|
72201
|
+
|
|
72202
|
+
const styles$2 = {
|
|
72203
|
+
infoRow: {
|
|
72204
|
+
justifyContent: 'space-between',
|
|
72205
|
+
width: '100%',
|
|
72206
|
+
marginBottom: '5px',
|
|
72207
|
+
},
|
|
72208
|
+
linkRow: {
|
|
72209
|
+
width: '100%',
|
|
72210
|
+
marginTop: '5px',
|
|
72211
|
+
justifyContent: 'flex-end',
|
|
72212
|
+
'& svg': { width: '11px' },
|
|
72213
|
+
},
|
|
72214
|
+
titleText: {
|
|
72215
|
+
fontSize: '12px',
|
|
72216
|
+
lineHeight: '14px',
|
|
72217
|
+
fontWeight: 500,
|
|
72218
|
+
},
|
|
72219
|
+
contentText: {
|
|
72220
|
+
fontSize: '12px',
|
|
72221
|
+
lineHeight: '14px',
|
|
72222
|
+
fontWeight: 700,
|
|
72223
|
+
},
|
|
72224
|
+
iconButton: {
|
|
72225
|
+
background: 'white3',
|
|
72226
|
+
textDecoration: 'none',
|
|
72227
|
+
alignItems: 'center',
|
|
72228
|
+
justifyContent: 'center',
|
|
72229
|
+
width: 'fit-content',
|
|
72230
|
+
height: '30px',
|
|
72231
|
+
padding: '2px 5px',
|
|
72232
|
+
borderRadius: '8px',
|
|
72233
|
+
margin: '0 5px 5px 0',
|
|
72234
|
+
'&:hover': {
|
|
72235
|
+
cursor: 'pointer',
|
|
72236
|
+
},
|
|
72237
|
+
},
|
|
72238
|
+
link: {
|
|
72239
|
+
fontSize: '12px',
|
|
72240
|
+
lineHeight: '14px',
|
|
72241
|
+
display: 'flex',
|
|
72242
|
+
textDecoration: 'none',
|
|
72243
|
+
'&: hover': { textDecoration: 'underline' },
|
|
72244
|
+
},
|
|
72245
|
+
};
|
|
72246
|
+
|
|
72247
|
+
const ButtonsRow = ({ projectLink, twitter, bubble, audit, }) => {
|
|
72248
|
+
const bubbleURL = `https://app.bubblemaps.io/bsc/token/${bubble}`;
|
|
72249
|
+
return (jsxs(Flex, { sx: { justifyContent: 'center' }, children: [jsx$2(Flex, { sx: styles$2.iconButton, as: Link, href: projectLink, target: "_blank", children: jsx$2(Svg, { icon: "URL", width: 18 }) }), jsx$2(Flex, { sx: styles$2.iconButton, as: Link, href: twitter, target: "_blank", children: jsx$2(Svg, { icon: "twitter", width: 18, color: "text" }) }), bubble && (jsx$2(Flex, { sx: styles$2.iconButton, as: Link, href: bubbleURL, target: "_blank", children: jsx$2(Svg, { icon: "bubble", width: 18, color: "text" }) })), audit && (jsxs(Flex, { sx: Object.assign(Object.assign({}, styles$2.iconButton), { margin: '0 0 5px 0', '& svg': { marginRight: '5px' } }), as: Link, href: audit, target: "_blank", children: [jsx$2(Svg, { icon: "audit", width: 18, color: "text" }), jsx$2(Text, { sx: { paddingRight: '5px' }, children: 'Audit' })] }))] }));
|
|
72250
|
+
};
|
|
72251
|
+
|
|
72252
|
+
const Tooltip = ({ valueTitle, valueContent, value2Title, value2Content, tokenContract, secondURL, secondURLTitle, projectLink, twitter, audit, thirdURL, thirdURLTitle, chain, }) => {
|
|
72253
|
+
const explorerLink = BLOCK_EXPLORER[chain];
|
|
72254
|
+
const tokenLink = `${explorerLink}/address/${tokenContract}`;
|
|
72255
|
+
return (jsxs(Flex, { sx: { flexDirection: 'column', flexWrap: 'wrap' }, children: [projectLink && twitter && (jsx$2(ButtonsRow, { twitter: twitter, projectLink: projectLink, bubble: tokenContract, audit: audit })), valueTitle && (jsxs(Flex, { sx: styles$2.infoRow, children: [jsxs(Text, { sx: styles$2.titleText, children: [valueTitle, ": "] }), jsx$2(Text, { sx: styles$2.contentText, children: valueContent })] })), value2Title && (jsxs(Flex, { sx: styles$2.infoRow, children: [jsxs(Text, { sx: styles$2.titleText, children: [value2Title, ": "] }), jsx$2(Text, { sx: styles$2.contentText, children: value2Content })] })), jsx$2(Flex, { sx: { justifyContent: 'center' }, children: jsxs(Flex, { sx: { width: '144px', flexDirection: 'column' }, children: [jsx$2(Flex, { sx: styles$2.linkRow, children: jsxs(Link, { href: tokenLink, sx: styles$2.link, target: "_blank", children: ['View Token Contract', jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] }) }), secondURL && (jsx$2(Flex, { sx: styles$2.linkRow, children: jsxs(Link, { href: secondURL, sx: styles$2.link, target: "_blank", children: [secondURLTitle, jsx$2(Flex, { sx: { ml: '5px' }, children: jsx$2(Svg, { icon: "external", color: "text", width: 10 }) })] }) })), thirdURL && (jsx$2(Flex, { sx: styles$2.linkRow, children: jsx$2(Link, { href: thirdURL, sx: styles$2.link, target: "_blank", children: thirdURLTitle }) }))] }) })] }));
|
|
72256
|
+
};
|
|
72257
|
+
|
|
72258
|
+
/**
|
|
72259
|
+
* Returns a USD dollar or equivalent denominated numerical value formatted
|
|
72260
|
+
* in human readable string for use in template.
|
|
72261
|
+
*
|
|
72262
|
+
* Adheres to guidelines for prices and other numbers defined here:
|
|
72263
|
+
* https://www.notion.so/uniswaplabs/Number-standards-fbb9f533f10e4e22820722c2f66d23c0
|
|
72264
|
+
* @param num numerical value denominated in USD or USD equivalent
|
|
72265
|
+
* @param isPrice whether the amount represents a price or not
|
|
72266
|
+
* @param lessPreciseStablecoinValues whether or not we should show less precise values for
|
|
72267
|
+
* stablecoins (around 1$ in value always) for the sake of readability
|
|
72268
|
+
* @param digits number of digits after the decimal for non-price amounts
|
|
72269
|
+
* @param round whether or not to round up non-price amounts
|
|
72270
|
+
*/
|
|
72271
|
+
const formatDollar = ({ num, isPrice = false, lessPreciseStablecoinValues = false, digits = 2, round = true, }) => {
|
|
72272
|
+
// For USD dollar denominated prices.
|
|
72273
|
+
if (isPrice) {
|
|
72274
|
+
if (num === 0)
|
|
72275
|
+
return '$0.00';
|
|
72276
|
+
if (!num)
|
|
72277
|
+
return '-';
|
|
72278
|
+
if (num < 0.000001) {
|
|
72279
|
+
return `$${num.toExponential(2)}`;
|
|
72280
|
+
}
|
|
72281
|
+
if ((num >= 0.000001 && num < 0.1) || num > 1000000) {
|
|
72282
|
+
return `$${Number(num).toPrecision(3)}`;
|
|
72283
|
+
}
|
|
72284
|
+
// We only show 2 decimal places in explore table for stablecoin value ranges
|
|
72285
|
+
// for the sake of readability (as opposed to the usual 3 elsewhere).
|
|
72286
|
+
if (num >= 0.1 && num < (lessPreciseStablecoinValues ? 0.9995 : 1.05)) {
|
|
72287
|
+
return `$${num.toFixed(3)}`;
|
|
72288
|
+
}
|
|
72289
|
+
return `$${Number(num.toFixed(2)).toLocaleString('en-US', { minimumFractionDigits: 2 })}`;
|
|
72290
|
+
}
|
|
72291
|
+
// For volume dollar amounts, like market cap, total value locked, etc.
|
|
72292
|
+
else {
|
|
72293
|
+
if (num === 0)
|
|
72294
|
+
return '$0.00';
|
|
72295
|
+
if (!num)
|
|
72296
|
+
return '-';
|
|
72297
|
+
if (num < 0.000001) {
|
|
72298
|
+
return '$<0.000001';
|
|
72299
|
+
}
|
|
72300
|
+
if (num >= 0.000001 && num < 0.1) {
|
|
72301
|
+
return `$${Number(num).toPrecision(3)}`;
|
|
72302
|
+
}
|
|
72303
|
+
if (num >= 0.1 && num < 1.05) {
|
|
72304
|
+
return `$${num.toFixed(3)}`;
|
|
72305
|
+
}
|
|
72306
|
+
return numbro(num)
|
|
72307
|
+
.formatCurrency({
|
|
72308
|
+
average: round,
|
|
72309
|
+
mantissa: num > 1000 ? 2 : digits,
|
|
72310
|
+
abbreviations: {
|
|
72311
|
+
million: 'M',
|
|
72312
|
+
billion: 'B',
|
|
72313
|
+
},
|
|
72314
|
+
})
|
|
72315
|
+
.toUpperCase();
|
|
72316
|
+
}
|
|
72317
|
+
};
|
|
72318
|
+
const formatValue = ({ num, digits = 2, round = true }) => {
|
|
72319
|
+
if (num === 0)
|
|
72320
|
+
return '0.00';
|
|
72321
|
+
if (!num)
|
|
72322
|
+
return '-';
|
|
72323
|
+
if (num < 0.000001) {
|
|
72324
|
+
return '<0.000001';
|
|
72325
|
+
}
|
|
72326
|
+
if (num >= 0.000001 && num < 0.1) {
|
|
72327
|
+
return `${Number(num).toPrecision(3)}`;
|
|
72328
|
+
}
|
|
72329
|
+
if (num >= 0.1 && num < 1.05) {
|
|
72330
|
+
return `${num.toFixed(3)}`;
|
|
72331
|
+
}
|
|
72332
|
+
return numbro(num)
|
|
72333
|
+
.format({
|
|
72334
|
+
average: round,
|
|
72335
|
+
mantissa: num > 1000 ? 2 : digits,
|
|
72336
|
+
abbreviations: {
|
|
72337
|
+
million: 'M',
|
|
72338
|
+
billion: 'B',
|
|
72339
|
+
},
|
|
72340
|
+
})
|
|
72341
|
+
.toUpperCase();
|
|
72342
|
+
};
|
|
72343
|
+
|
|
72358
72344
|
const BondRow = ({ bond, hotBonds, modalVariant }) => {
|
|
72359
72345
|
var _a, _b, _c;
|
|
72360
72346
|
// Modal
|
|
@@ -72431,155 +72417,6 @@ const BondRowsByChain = ({ bonds, hotBonds, hideTitles, chains, modalVariant })
|
|
|
72431
72417
|
}) }));
|
|
72432
72418
|
};
|
|
72433
72419
|
|
|
72434
|
-
// This basically returns the 2 tags with the higher active bond count
|
|
72435
|
-
const useTopTags = (initialBondList) => {
|
|
72436
|
-
const bonds = initialBondList;
|
|
72437
|
-
const countTagsInBonds = (bonds) => {
|
|
72438
|
-
const tagCount = {};
|
|
72439
|
-
bonds === null || bonds === void 0 ? void 0 : bonds.forEach((bond) => {
|
|
72440
|
-
var _a;
|
|
72441
|
-
if (bond.soldOut)
|
|
72442
|
-
return;
|
|
72443
|
-
(_a = bond.tags) === null || _a === void 0 ? void 0 : _a.forEach((tag) => {
|
|
72444
|
-
if (tag in tagCount) {
|
|
72445
|
-
tagCount[tag] += 1;
|
|
72446
|
-
}
|
|
72447
|
-
else {
|
|
72448
|
-
tagCount[tag] = 1;
|
|
72449
|
-
}
|
|
72450
|
-
});
|
|
72451
|
-
});
|
|
72452
|
-
return tagCount;
|
|
72453
|
-
};
|
|
72454
|
-
const activeBonds = bonds === null || bonds === void 0 ? void 0 : bonds.filter((bond) => !bond.soldOut);
|
|
72455
|
-
const countedTags = countTagsInBonds(activeBonds);
|
|
72456
|
-
const sortedTagsArray = Object.entries(countedTags).sort((a, b) => b[1] - a[1]);
|
|
72457
|
-
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
72458
|
-
};
|
|
72459
|
-
|
|
72460
|
-
const isBondSoldOut = (bill) => {
|
|
72461
|
-
var _a;
|
|
72462
|
-
const { tokensRemaining, discount, payoutTokenPrice, billAddress } = bill;
|
|
72463
|
-
if (bill.soldOut)
|
|
72464
|
-
return true;
|
|
72465
|
-
if (bill.inactive)
|
|
72466
|
-
return true;
|
|
72467
|
-
if (!tokensRemaining)
|
|
72468
|
-
return false;
|
|
72469
|
-
const thresholdToHide = new BigNumber$1(100).div(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : 0);
|
|
72470
|
-
if (discount && discount > 50) {
|
|
72471
|
-
// If discount is over 50% it will be hidden
|
|
72472
|
-
console.log('Soldout contract:', billAddress);
|
|
72473
|
-
return true;
|
|
72474
|
-
}
|
|
72475
|
-
if (((_a = new BigNumber$1(tokensRemaining)) === null || _a === void 0 ? void 0 : _a.lte(thresholdToHide)) || discount === 100) {
|
|
72476
|
-
// If there's less than 100 usd bond will be hidden
|
|
72477
|
-
console.log('Soldout contract: ', billAddress);
|
|
72478
|
-
return true;
|
|
72479
|
-
}
|
|
72480
|
-
else
|
|
72481
|
-
return false;
|
|
72482
|
-
};
|
|
72483
|
-
const sortBonds = (sortConfig, bonds) => {
|
|
72484
|
-
const bondsToSort = bonds !== null && bonds !== void 0 ? bonds : [];
|
|
72485
|
-
if (!sortConfig) {
|
|
72486
|
-
return bondsToSort;
|
|
72487
|
-
}
|
|
72488
|
-
return [...bondsToSort].sort((a, b) => {
|
|
72489
|
-
let aValue, bValue;
|
|
72490
|
-
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === 'arr') {
|
|
72491
|
-
aValue = calculateARR(a);
|
|
72492
|
-
bValue = calculateARR(b);
|
|
72493
|
-
}
|
|
72494
|
-
else if (sortConfig.key === 'tokensRemaining') {
|
|
72495
|
-
aValue = remainingPercentage(a);
|
|
72496
|
-
bValue = remainingPercentage(b);
|
|
72497
|
-
}
|
|
72498
|
-
else if (sortConfig.key === 'terms') {
|
|
72499
|
-
aValue = vestingTime(a.vestingTerm).days;
|
|
72500
|
-
bValue = vestingTime(b.vestingTerm).days;
|
|
72501
|
-
}
|
|
72502
|
-
else {
|
|
72503
|
-
aValue = a[sortConfig.key];
|
|
72504
|
-
bValue = b[sortConfig.key];
|
|
72505
|
-
}
|
|
72506
|
-
if (aValue < bValue) {
|
|
72507
|
-
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
72508
|
-
}
|
|
72509
|
-
if (aValue > bValue) {
|
|
72510
|
-
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
72511
|
-
}
|
|
72512
|
-
return 0;
|
|
72513
|
-
});
|
|
72514
|
-
};
|
|
72515
|
-
const calculateARR = (bond) => {
|
|
72516
|
-
var _a;
|
|
72517
|
-
const discount = (_a = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _a !== void 0 ? _a : 0;
|
|
72518
|
-
const vestingDays = vestingTime(bond.vestingTerm).days;
|
|
72519
|
-
return parseFloat(((discount * 365) / vestingDays).toFixed(2));
|
|
72520
|
-
};
|
|
72521
|
-
const vestingTime = (vestingTerm) => {
|
|
72522
|
-
return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
|
|
72523
|
-
};
|
|
72524
|
-
const remainingPercentage = (bond) => {
|
|
72525
|
-
var _a, _b, _c, _d;
|
|
72526
|
-
const totalMaxPayout = new BigNumber$1((_a = bond.maxTotalPayout) !== null && _a !== void 0 ? _a : '0').div(new BigNumber$1(10).pow((_c = (_b = bond.earnToken.decimals) === null || _b === void 0 ? void 0 : _b[bond.chainId]) !== null && _c !== void 0 ? _c : 18));
|
|
72527
|
-
const remainingTokens = new BigNumber$1((_d = bond.tokensRemaining) !== null && _d !== void 0 ? _d : '0');
|
|
72528
|
-
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
72529
|
-
};
|
|
72530
|
-
|
|
72531
|
-
function useHotBonds() {
|
|
72532
|
-
return useQuery({
|
|
72533
|
-
queryKey: [QUERY_KEYS.HOT_BONDS],
|
|
72534
|
-
queryFn: getHotBonds,
|
|
72535
|
-
refetchOnWindowFocus: false,
|
|
72536
|
-
retry: 1,
|
|
72537
|
-
initialData: [],
|
|
72538
|
-
});
|
|
72539
|
-
}
|
|
72540
|
-
const getHotBonds = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
72541
|
-
try {
|
|
72542
|
-
const response = yield axios.get('https://apeswap-strapi.herokuapp.com/hot-bonds');
|
|
72543
|
-
return response.data.map((bond) => bond.BondAddress.toLowerCase());
|
|
72544
|
-
}
|
|
72545
|
-
catch (_a) {
|
|
72546
|
-
return [];
|
|
72547
|
-
}
|
|
72548
|
-
});
|
|
72549
|
-
|
|
72550
|
-
/** CheckURL purpose is to open the buy bond modal ONLY IF a user has opened the site with a custom URL */
|
|
72551
|
-
const CheckUrl = () => {
|
|
72552
|
-
var _a, _b;
|
|
72553
|
-
if (typeof window === 'undefined')
|
|
72554
|
-
return null;
|
|
72555
|
-
const { data: bonds } = useBondsData();
|
|
72556
|
-
const asPath = window.location.search;
|
|
72557
|
-
const urlParams = new URLSearchParams(new URL(asPath, window.location.origin).search);
|
|
72558
|
-
const bondAddress = (_a = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondAddress')) !== null && _a !== void 0 ? _a : '';
|
|
72559
|
-
const bondChain = (_b = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondChain')) !== null && _b !== void 0 ? _b : '';
|
|
72560
|
-
const bond = useMemo(() => {
|
|
72561
|
-
if (!bondAddress)
|
|
72562
|
-
return undefined;
|
|
72563
|
-
return bonds === null || bonds === void 0 ? void 0 : bonds.find((bond) => { var _a; return ((_a = bond === null || bond === void 0 ? void 0 : bond.billAddress) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === (bondAddress === null || bondAddress === void 0 ? void 0 : bondAddress.toLowerCase()); });
|
|
72564
|
-
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
72565
|
-
const [onPresentBuyBillsModal] = useModal(jsx$2(BondModal, { bondAddress: bondAddress, bondChain: parseInt(bondChain) }), true, true, `BuyBondModal:${bondAddress.toLowerCase()}-${bondChain}-${bond === null || bond === void 0 ? void 0 : bond.index}`);
|
|
72566
|
-
useEffect(() => {
|
|
72567
|
-
if (bond && bondChain && bondAddress) {
|
|
72568
|
-
onPresentBuyBillsModal();
|
|
72569
|
-
// track({
|
|
72570
|
-
// event: 'buyModalOpen',
|
|
72571
|
-
// chain: bondChain,
|
|
72572
|
-
// data: {
|
|
72573
|
-
// cat: 'Row', // Row: clicked by user or custom URL. CTA add this to buy button on future A/B testing.
|
|
72574
|
-
// bond: bond.payoutTokenName,
|
|
72575
|
-
// bondChain: bondChain,
|
|
72576
|
-
// },
|
|
72577
|
-
// })
|
|
72578
|
-
}
|
|
72579
|
-
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
72580
|
-
return jsx$2(Fragment$1, {});
|
|
72581
|
-
};
|
|
72582
|
-
|
|
72583
72420
|
const Bonds = ({ chains = [], modalVariant = 'standard' }) => {
|
|
72584
72421
|
// Fetch data
|
|
72585
72422
|
const { data: bondData } = useBondsData();
|