@ape.swap/bonds-sdk 1.0.2-seedify → 1.0.3-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/{views/Bonds/components → components}/BondRows/BondRow.d.ts +2 -2
- package/dist/{views/Bonds/components → components}/BondRows/BondRowHeader.d.ts +1 -1
- package/dist/{views/Bonds/components → components}/BondRows/BondRowsByChain.d.ts +2 -2
- package/dist/{views/Bonds/components → components}/BondRows/BondRowsWithTitle.d.ts +2 -3
- package/dist/main.js +648 -489
- package/dist/scss/BondModal.scss +2 -1
- package/package.json +4 -4
- /package/dist/{views/Bonds/components → components}/BondRows/ChainTitle.d.ts +0 -0
package/dist/main.js
CHANGED
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
|
|
8
7
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
9
8
|
|
|
@@ -5341,7 +5340,7 @@ var cjs = deepmerge_1;
|
|
|
5341
5340
|
var deepmerge$1 = /*@__PURE__*/getDefaultExportFromCjs(cjs);
|
|
5342
5341
|
|
|
5343
5342
|
var name = "@emotion/react";
|
|
5344
|
-
var version$
|
|
5343
|
+
var version$j = "11.13.3";
|
|
5345
5344
|
var main = "dist/emotion-react.cjs.js";
|
|
5346
5345
|
var module = "dist/emotion-react.esm.js";
|
|
5347
5346
|
var exports = {
|
|
@@ -5656,7 +5655,7 @@ var preconstruct = {
|
|
|
5656
5655
|
};
|
|
5657
5656
|
var packageInfo = {
|
|
5658
5657
|
name: name,
|
|
5659
|
-
version: version$
|
|
5658
|
+
version: version$j,
|
|
5660
5659
|
main: main,
|
|
5661
5660
|
module: module,
|
|
5662
5661
|
exports: exports,
|
|
@@ -25175,9 +25174,9 @@ function useBondNFTData(id, billNftAddress, chainId) {
|
|
|
25175
25174
|
}
|
|
25176
25175
|
const getBondNFTData = (id, billNftAddress, chainId) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
25177
25176
|
try {
|
|
25178
|
-
|
|
25177
|
+
console.log('Bond NFT Data: Started');
|
|
25179
25178
|
const billNFTData = yield getBillNftBatchData([id], billNftAddress, chainId);
|
|
25180
|
-
|
|
25179
|
+
console.log('Bond NFT Data: Finished');
|
|
25181
25180
|
return billNFTData[0];
|
|
25182
25181
|
}
|
|
25183
25182
|
catch (e) {
|
|
@@ -45990,7 +45989,7 @@ bn.exports;
|
|
|
45990
45989
|
var bnExports = bn.exports;
|
|
45991
45990
|
var BN$1 = /*@__PURE__*/getDefaultExportFromCjs(bnExports);
|
|
45992
45991
|
|
|
45993
|
-
const version$
|
|
45992
|
+
const version$i = "logger/5.7.0";
|
|
45994
45993
|
|
|
45995
45994
|
let _permanentCensorErrors = false;
|
|
45996
45995
|
let _censorErrors = false;
|
|
@@ -46305,7 +46304,7 @@ class Logger {
|
|
|
46305
46304
|
}
|
|
46306
46305
|
static globalLogger() {
|
|
46307
46306
|
if (!_globalLogger) {
|
|
46308
|
-
_globalLogger = new Logger(version$
|
|
46307
|
+
_globalLogger = new Logger(version$i);
|
|
46309
46308
|
}
|
|
46310
46309
|
return _globalLogger;
|
|
46311
46310
|
}
|
|
@@ -46341,9 +46340,9 @@ class Logger {
|
|
|
46341
46340
|
Logger.errors = ErrorCode;
|
|
46342
46341
|
Logger.levels = LogLevel;
|
|
46343
46342
|
|
|
46344
|
-
const version$
|
|
46343
|
+
const version$h = "bytes/5.7.0";
|
|
46345
46344
|
|
|
46346
|
-
const logger$o = new Logger(version$
|
|
46345
|
+
const logger$o = new Logger(version$h);
|
|
46347
46346
|
///////////////////////////////
|
|
46348
46347
|
function isHexable(value) {
|
|
46349
46348
|
return !!(value.toHexString);
|
|
@@ -46741,10 +46740,10 @@ function splitSignature(signature) {
|
|
|
46741
46740
|
return result;
|
|
46742
46741
|
}
|
|
46743
46742
|
|
|
46744
|
-
const version$
|
|
46743
|
+
const version$g = "bignumber/5.7.0";
|
|
46745
46744
|
|
|
46746
46745
|
var BN = BN$1.BN;
|
|
46747
|
-
const logger$n = new Logger(version$
|
|
46746
|
+
const logger$n = new Logger(version$g);
|
|
46748
46747
|
const _constructorGuard$3 = {};
|
|
46749
46748
|
const MAX_SAFE = 0x1fffffffffffff;
|
|
46750
46749
|
function isBigNumberish(value) {
|
|
@@ -47032,7 +47031,7 @@ function _base36To16(value) {
|
|
|
47032
47031
|
return (new BN(value, 36)).toString(16);
|
|
47033
47032
|
}
|
|
47034
47033
|
|
|
47035
|
-
const logger$m = new Logger(version$
|
|
47034
|
+
const logger$m = new Logger(version$g);
|
|
47036
47035
|
const _constructorGuard$2 = {};
|
|
47037
47036
|
const Zero$2 = BigNumber.from(0);
|
|
47038
47037
|
const NegativeOne$2 = BigNumber.from(-1);
|
|
@@ -47386,7 +47385,7 @@ class FixedNumber {
|
|
|
47386
47385
|
const ONE = FixedNumber.from(1);
|
|
47387
47386
|
const BUMP = FixedNumber.from("0.5");
|
|
47388
47387
|
|
|
47389
|
-
const version$
|
|
47388
|
+
const version$f = "properties/5.7.0";
|
|
47390
47389
|
|
|
47391
47390
|
var __awaiter$8 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
47392
47391
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -47397,7 +47396,7 @@ var __awaiter$8 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
47397
47396
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
47398
47397
|
});
|
|
47399
47398
|
};
|
|
47400
|
-
const logger$l = new Logger(version$
|
|
47399
|
+
const logger$l = new Logger(version$f);
|
|
47401
47400
|
function defineReadOnly(object, name, value) {
|
|
47402
47401
|
Object.defineProperty(object, name, {
|
|
47403
47402
|
enumerable: true,
|
|
@@ -47511,9 +47510,9 @@ class Description {
|
|
|
47511
47510
|
}
|
|
47512
47511
|
}
|
|
47513
47512
|
|
|
47514
|
-
const version$
|
|
47513
|
+
const version$e = "abi/5.7.0";
|
|
47515
47514
|
|
|
47516
|
-
const logger$k = new Logger(version$
|
|
47515
|
+
const logger$k = new Logger(version$e);
|
|
47517
47516
|
const _constructorGuard$1 = {};
|
|
47518
47517
|
let ModifiersBytes = { calldata: true, memory: true, storage: true };
|
|
47519
47518
|
let ModifiersNest = { calldata: true, memory: true };
|
|
@@ -48361,7 +48360,7 @@ function splitNesting(value) {
|
|
|
48361
48360
|
return result;
|
|
48362
48361
|
}
|
|
48363
48362
|
|
|
48364
|
-
const logger$j = new Logger(version$
|
|
48363
|
+
const logger$j = new Logger(version$e);
|
|
48365
48364
|
function checkResultErrors(result) {
|
|
48366
48365
|
// Find the first error (if any)
|
|
48367
48366
|
const errors = [];
|
|
@@ -49164,9 +49163,9 @@ function keccak256(data) {
|
|
|
49164
49163
|
return '0x' + sha3.keccak_256(arrayify(data));
|
|
49165
49164
|
}
|
|
49166
49165
|
|
|
49167
|
-
const version$
|
|
49166
|
+
const version$d = "rlp/5.7.0";
|
|
49168
49167
|
|
|
49169
|
-
const logger$i = new Logger(version$
|
|
49168
|
+
const logger$i = new Logger(version$d);
|
|
49170
49169
|
function arrayifyInteger(value) {
|
|
49171
49170
|
const result = [];
|
|
49172
49171
|
while (value) {
|
|
@@ -49281,9 +49280,9 @@ function decode$2(data) {
|
|
|
49281
49280
|
return decoded.result;
|
|
49282
49281
|
}
|
|
49283
49282
|
|
|
49284
|
-
const version$
|
|
49283
|
+
const version$c = "address/5.7.0";
|
|
49285
49284
|
|
|
49286
|
-
const logger$h = new Logger(version$
|
|
49285
|
+
const logger$h = new Logger(version$c);
|
|
49287
49286
|
function getChecksumAddress(address) {
|
|
49288
49287
|
if (!isHexString(address, 20)) {
|
|
49289
49288
|
logger$h.throwArgumentError("invalid address", "address", address);
|
|
@@ -49423,7 +49422,7 @@ class AnonymousCoder extends Coder {
|
|
|
49423
49422
|
}
|
|
49424
49423
|
}
|
|
49425
49424
|
|
|
49426
|
-
const logger$g = new Logger(version$
|
|
49425
|
+
const logger$g = new Logger(version$e);
|
|
49427
49426
|
function pack(writer, coders, values) {
|
|
49428
49427
|
let arrayValues = null;
|
|
49429
49428
|
if (Array.isArray(values)) {
|
|
@@ -49756,9 +49755,9 @@ class NumberCoder extends Coder {
|
|
|
49756
49755
|
}
|
|
49757
49756
|
}
|
|
49758
49757
|
|
|
49759
|
-
const version$
|
|
49758
|
+
const version$b = "strings/5.7.0";
|
|
49760
49759
|
|
|
49761
|
-
const logger$f = new Logger(version$
|
|
49760
|
+
const logger$f = new Logger(version$b);
|
|
49762
49761
|
///////////////////////////////
|
|
49763
49762
|
var UnicodeNormalizationForm;
|
|
49764
49763
|
(function (UnicodeNormalizationForm) {
|
|
@@ -50041,7 +50040,7 @@ class TupleCoder extends Coder {
|
|
|
50041
50040
|
}
|
|
50042
50041
|
}
|
|
50043
50042
|
|
|
50044
|
-
const logger$e = new Logger(version$
|
|
50043
|
+
const logger$e = new Logger(version$e);
|
|
50045
50044
|
const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);
|
|
50046
50045
|
const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
|
|
50047
50046
|
class AbiCoder {
|
|
@@ -50124,7 +50123,7 @@ function id(text) {
|
|
|
50124
50123
|
return keccak256(toUtf8Bytes(text));
|
|
50125
50124
|
}
|
|
50126
50125
|
|
|
50127
|
-
const version$
|
|
50126
|
+
const version$a = "hash/5.7.0";
|
|
50128
50127
|
|
|
50129
50128
|
function decode$1(textData) {
|
|
50130
50129
|
textData = atob(textData);
|
|
@@ -50560,7 +50559,7 @@ function consume_emoji_reversed(cps, eaten) {
|
|
|
50560
50559
|
return emoji;
|
|
50561
50560
|
}
|
|
50562
50561
|
|
|
50563
|
-
const logger$d = new Logger(version$
|
|
50562
|
+
const logger$d = new Logger(version$a);
|
|
50564
50563
|
const Zeros = new Uint8Array(32);
|
|
50565
50564
|
Zeros.fill(0);
|
|
50566
50565
|
function checkComponent(comp) {
|
|
@@ -50625,7 +50624,7 @@ var __awaiter$7 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
50625
50624
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
50626
50625
|
});
|
|
50627
50626
|
};
|
|
50628
|
-
const logger$c = new Logger(version$
|
|
50627
|
+
const logger$c = new Logger(version$a);
|
|
50629
50628
|
const padding = new Uint8Array(32);
|
|
50630
50629
|
padding.fill(0);
|
|
50631
50630
|
const NegativeOne = BigNumber.from(-1);
|
|
@@ -51049,7 +51048,7 @@ class TypedDataEncoder {
|
|
|
51049
51048
|
}
|
|
51050
51049
|
}
|
|
51051
51050
|
|
|
51052
|
-
const logger$b = new Logger(version$
|
|
51051
|
+
const logger$b = new Logger(version$e);
|
|
51053
51052
|
class LogDescription extends Description {
|
|
51054
51053
|
}
|
|
51055
51054
|
class TransactionDescription extends Description {
|
|
@@ -51795,7 +51794,7 @@ var multicallV2Abi = [
|
|
|
51795
51794
|
}
|
|
51796
51795
|
];
|
|
51797
51796
|
|
|
51798
|
-
const version$
|
|
51797
|
+
const version$9 = "abstract-provider/5.7.0";
|
|
51799
51798
|
|
|
51800
51799
|
var __awaiter$6 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
51801
51800
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -51806,7 +51805,7 @@ var __awaiter$6 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
51806
51805
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
51807
51806
|
});
|
|
51808
51807
|
};
|
|
51809
|
-
const logger$a = new Logger(version$
|
|
51808
|
+
const logger$a = new Logger(version$9);
|
|
51810
51809
|
//export type CallTransactionable = {
|
|
51811
51810
|
// call(transaction: TransactionRequest): Promise<TransactionResponse>;
|
|
51812
51811
|
//};
|
|
@@ -51857,7 +51856,7 @@ class Provider {
|
|
|
51857
51856
|
}
|
|
51858
51857
|
}
|
|
51859
51858
|
|
|
51860
|
-
const version$
|
|
51859
|
+
const version$8 = "abstract-signer/5.7.0";
|
|
51861
51860
|
|
|
51862
51861
|
var __awaiter$5 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
51863
51862
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -51868,7 +51867,7 @@ var __awaiter$5 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
51868
51867
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
51869
51868
|
});
|
|
51870
51869
|
};
|
|
51871
|
-
const logger$9 = new Logger(version$
|
|
51870
|
+
const logger$9 = new Logger(version$8);
|
|
51872
51871
|
const allowedTransactionKeys$1 = [
|
|
51873
51872
|
"accessList", "ccipReadEnabled", "chainId", "customData", "data", "from", "gasLimit", "gasPrice", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "to", "type", "value"
|
|
51874
51873
|
];
|
|
@@ -55858,9 +55857,9 @@ elliptic.eddsa = /*RicMoo:ethers:require(./elliptic/eddsa)*/(null);
|
|
|
55858
55857
|
|
|
55859
55858
|
var EC$1 = elliptic_1.ec;
|
|
55860
55859
|
|
|
55861
|
-
const version$
|
|
55860
|
+
const version$7 = "signing-key/5.7.0";
|
|
55862
55861
|
|
|
55863
|
-
const logger$8 = new Logger(version$
|
|
55862
|
+
const logger$8 = new Logger(version$7);
|
|
55864
55863
|
let _curve = null;
|
|
55865
55864
|
function getCurve() {
|
|
55866
55865
|
if (!_curve) {
|
|
@@ -55929,9 +55928,9 @@ function computePublicKey(key, compressed) {
|
|
|
55929
55928
|
return logger$8.throwArgumentError("invalid public or private key", "key", "[REDACTED]");
|
|
55930
55929
|
}
|
|
55931
55930
|
|
|
55932
|
-
const version$
|
|
55931
|
+
const version$6 = "transactions/5.7.0";
|
|
55933
55932
|
|
|
55934
|
-
const logger$7 = new Logger(version$
|
|
55933
|
+
const logger$7 = new Logger(version$6);
|
|
55935
55934
|
var TransactionTypes;
|
|
55936
55935
|
(function (TransactionTypes) {
|
|
55937
55936
|
TransactionTypes[TransactionTypes["legacy"] = 0] = "legacy";
|
|
@@ -56199,7 +56198,7 @@ function parse(rawTransaction) {
|
|
|
56199
56198
|
});
|
|
56200
56199
|
}
|
|
56201
56200
|
|
|
56202
|
-
const version$
|
|
56201
|
+
const version$5 = "contracts/5.7.0";
|
|
56203
56202
|
|
|
56204
56203
|
var __awaiter$4 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
56205
56204
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -56210,7 +56209,7 @@ var __awaiter$4 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
56210
56209
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
56211
56210
|
});
|
|
56212
56211
|
};
|
|
56213
|
-
const logger$6 = new Logger(version$
|
|
56212
|
+
const logger$6 = new Logger(version$5);
|
|
56214
56213
|
function resolveName(resolver, nameOrPromise) {
|
|
56215
56214
|
return __awaiter$4(this, void 0, void 0, function* () {
|
|
56216
56215
|
const name = yield nameOrPromise;
|
|
@@ -57201,9 +57200,9 @@ function sha256(data) {
|
|
|
57201
57200
|
return "0x" + (hash.sha256().update(arrayify(data)).digest("hex"));
|
|
57202
57201
|
}
|
|
57203
57202
|
|
|
57204
|
-
const version$
|
|
57203
|
+
const version$4 = "networks/5.7.1";
|
|
57205
57204
|
|
|
57206
|
-
const logger$5 = new Logger(version$
|
|
57205
|
+
const logger$5 = new Logger(version$4);
|
|
57207
57206
|
function isRenetworkable(value) {
|
|
57208
57207
|
return (value && typeof (value.renetwork) === "function");
|
|
57209
57208
|
}
|
|
@@ -57447,7 +57446,7 @@ function getNetwork(network) {
|
|
|
57447
57446
|
};
|
|
57448
57447
|
}
|
|
57449
57448
|
|
|
57450
|
-
const version$
|
|
57449
|
+
const version$3 = "web/5.7.1";
|
|
57451
57450
|
|
|
57452
57451
|
var __awaiter$3 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
57453
57452
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
@@ -57524,7 +57523,7 @@ var __awaiter$2 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
57524
57523
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
57525
57524
|
});
|
|
57526
57525
|
};
|
|
57527
|
-
const logger$4 = new Logger(version$
|
|
57526
|
+
const logger$4 = new Logger(version$3);
|
|
57528
57527
|
function staller(duration) {
|
|
57529
57528
|
return new Promise((resolve) => {
|
|
57530
57529
|
setTimeout(resolve, duration);
|
|
@@ -58094,9 +58093,9 @@ var bech32 = {
|
|
|
58094
58093
|
|
|
58095
58094
|
var bech32$1 = /*@__PURE__*/getDefaultExportFromCjs(bech32);
|
|
58096
58095
|
|
|
58097
|
-
const version$
|
|
58096
|
+
const version$2 = "providers/5.7.2";
|
|
58098
58097
|
|
|
58099
|
-
const logger$3 = new Logger(version$
|
|
58098
|
+
const logger$3 = new Logger(version$2);
|
|
58100
58099
|
class Formatter {
|
|
58101
58100
|
constructor() {
|
|
58102
58101
|
this.formats = this.getDefaultFormats();
|
|
@@ -58517,7 +58516,7 @@ var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _argu
|
|
|
58517
58516
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
58518
58517
|
});
|
|
58519
58518
|
};
|
|
58520
|
-
const logger$2 = new Logger(version$
|
|
58519
|
+
const logger$2 = new Logger(version$2);
|
|
58521
58520
|
const MAX_CCIP_REDIRECTS = 10;
|
|
58522
58521
|
//////////////////////////////
|
|
58523
58522
|
// Event Serializeing
|
|
@@ -60506,7 +60505,7 @@ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _argume
|
|
|
60506
60505
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
60507
60506
|
});
|
|
60508
60507
|
};
|
|
60509
|
-
const logger$1 = new Logger(version$
|
|
60508
|
+
const logger$1 = new Logger(version$2);
|
|
60510
60509
|
const errorGas = ["call", "estimateGas"];
|
|
60511
60510
|
function spelunk(value, requireData) {
|
|
60512
60511
|
if (value == null) {
|
|
@@ -61158,9 +61157,9 @@ class JsonRpcProvider extends BaseProvider {
|
|
|
61158
61157
|
}
|
|
61159
61158
|
}
|
|
61160
61159
|
|
|
61161
|
-
const version = "units/5.7.0";
|
|
61160
|
+
const version$1 = "units/5.7.0";
|
|
61162
61161
|
|
|
61163
|
-
const logger = new Logger(version);
|
|
61162
|
+
const logger = new Logger(version$1);
|
|
61164
61163
|
const names = [
|
|
61165
61164
|
"wei",
|
|
61166
61165
|
"kwei",
|
|
@@ -61170,7 +61169,7 @@ const names = [
|
|
|
61170
61169
|
"finney",
|
|
61171
61170
|
"ether",
|
|
61172
61171
|
];
|
|
61173
|
-
function parseUnits(value, unitName) {
|
|
61172
|
+
function parseUnits$1(value, unitName) {
|
|
61174
61173
|
if (typeof (value) !== "string") {
|
|
61175
61174
|
logger.throwArgumentError("value must be a string", "value", value);
|
|
61176
61175
|
}
|
|
@@ -64302,7 +64301,7 @@ function useTokenPrices() {
|
|
|
64302
64301
|
}
|
|
64303
64302
|
const getTokenPrices = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
64304
64303
|
try {
|
|
64305
|
-
|
|
64304
|
+
console.log('Token Prices: Started');
|
|
64306
64305
|
const response = yield axios.get('https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/staging/config/tokens.json');
|
|
64307
64306
|
const tokenList = response.data;
|
|
64308
64307
|
const prices = [];
|
|
@@ -64314,7 +64313,7 @@ const getTokenPrices = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
|
64314
64313
|
// Keep only successfully fulfilled promises and discard the rest
|
|
64315
64314
|
const successfulPromises = all === null || all === void 0 ? void 0 : all.filter((result) => result.status === 'fulfilled');
|
|
64316
64315
|
const successfulPrices = successfulPromises.map((result) => result.value);
|
|
64317
|
-
|
|
64316
|
+
console.log('Token Prices: Finished');
|
|
64318
64317
|
return successfulPrices.flat();
|
|
64319
64318
|
}
|
|
64320
64319
|
catch (_a) {
|
|
@@ -64571,7 +64570,7 @@ supportedChainId, lpTokens) {
|
|
|
64571
64570
|
if (lpTokens && protocol == types.Protocols.Algebra) {
|
|
64572
64571
|
protocol = types.Protocols.Gamma;
|
|
64573
64572
|
}
|
|
64574
|
-
if (lpTokens && protocol == types.Protocols.V3) {
|
|
64573
|
+
if (lpTokens && protocol == types.Protocols.V3 && supportedChainId !== types.ChainId.ARBITRUM) {
|
|
64575
64574
|
protocol = types.Protocols.Steer;
|
|
64576
64575
|
}
|
|
64577
64576
|
if ([types.ChainId.LINEA, types.ChainId.LIGHTLINK, types.ChainId.IOTA, types.ChainId.BASE, types.ChainId.ARBITRUM].includes(supportedChainId) &&
|
|
@@ -64670,7 +64669,7 @@ function useBondsList() {
|
|
|
64670
64669
|
}
|
|
64671
64670
|
const getBondsList = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
64672
64671
|
try {
|
|
64673
|
-
|
|
64672
|
+
console.log('fetch bond list');
|
|
64674
64673
|
const response = yield axios.get('https://raw.githubusercontent.com/ApeSwapFinance/apeswap-lists/staging/config/bills.json');
|
|
64675
64674
|
return response.data;
|
|
64676
64675
|
}
|
|
@@ -64788,9 +64787,9 @@ function useUserBonds() {
|
|
|
64788
64787
|
}
|
|
64789
64788
|
const getUserBonds = (account, bondList) => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
64790
64789
|
try {
|
|
64791
|
-
|
|
64790
|
+
console.log('User Bonds: Started');
|
|
64792
64791
|
const results = yield Promise.all(MAINNET_CHAINS.map((chain) => fetchUserOwnedBillsDataAsync(chain, account, bondList)));
|
|
64793
|
-
|
|
64792
|
+
console.log('User Bonds: Finished');
|
|
64794
64793
|
return results.flat().flatMap((results) => results.userOwnedBills);
|
|
64795
64794
|
}
|
|
64796
64795
|
catch (_a) {
|
|
@@ -64880,141 +64879,259 @@ const YourBonds = () => {
|
|
|
64880
64879
|
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 }) }))] }) }));
|
|
64881
64880
|
};
|
|
64882
64881
|
|
|
64883
|
-
|
|
64884
|
-
|
|
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]);
|
|
64882
|
+
const BondRowHeader = ({ searchQuery, setSearchQuery, setChainFilterOption, chainFilterOption, filterOptions, filterOption, setFilterOption, onSort, }) => {
|
|
64883
|
+
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" })] })] })] }));
|
|
64907
64884
|
};
|
|
64908
64885
|
|
|
64909
|
-
const
|
|
64910
|
-
|
|
64911
|
-
|
|
64912
|
-
|
|
64913
|
-
|
|
64914
|
-
|
|
64915
|
-
|
|
64916
|
-
|
|
64917
|
-
|
|
64918
|
-
|
|
64919
|
-
|
|
64920
|
-
|
|
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;
|
|
64886
|
+
const ChainTitle = ({ chain, pt, hideTitles, isOpen, }) => {
|
|
64887
|
+
return (jsxs(Flex, { className: "chaintitle", sx: {
|
|
64888
|
+
pt,
|
|
64889
|
+
pb: '10px',
|
|
64890
|
+
color: 'textDisabledButton',
|
|
64891
|
+
fontSize: '13px',
|
|
64892
|
+
fontWeight: 500,
|
|
64893
|
+
cursor: 'pointer',
|
|
64894
|
+
textTransform: 'uppercase',
|
|
64895
|
+
display: hideTitles ? 'none' : 'flex',
|
|
64896
|
+
width: '200px',
|
|
64897
|
+
}, 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" }) })] }));
|
|
64931
64898
|
};
|
|
64932
|
-
|
|
64933
|
-
|
|
64934
|
-
|
|
64935
|
-
|
|
64936
|
-
|
|
64937
|
-
|
|
64938
|
-
|
|
64939
|
-
|
|
64940
|
-
|
|
64941
|
-
|
|
64899
|
+
|
|
64900
|
+
const ProgressBar = ({ value, color = 'text' }) => {
|
|
64901
|
+
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: {
|
|
64902
|
+
width: `${value <= 3 ? 3 : value}%`,
|
|
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' })] }))] }));
|
|
65042
|
+
};
|
|
65043
|
+
|
|
65044
|
+
const Tooltip = ({ valueTitle, valueContent, value2Title, value2Content, tokenContract, secondURL, secondURLTitle, projectLink, twitter, audit, thirdURL, thirdURLTitle, chain, }) => {
|
|
65045
|
+
const explorerLink = BLOCK_EXPLORER[chain];
|
|
65046
|
+
const tokenLink = `${explorerLink}/address/${tokenContract}`;
|
|
65047
|
+
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$3.infoRow, children: [jsxs(Text, { sx: styles$3.titleText, children: [valueTitle, ": "] }), jsx$2(Text, { sx: styles$3.contentText, children: valueContent })] })), value2Title && (jsxs(Flex, { sx: styles$3.infoRow, children: [jsxs(Text, { sx: styles$3.titleText, children: [value2Title, ": "] }), jsx$2(Text, { sx: styles$3.contentText, children: value2Content })] })), jsx$2(Flex, { sx: { justifyContent: 'center' }, children: jsxs(Flex, { sx: { width: '144px', flexDirection: 'column' }, children: [jsx$2(Flex, { sx: styles$3.linkRow, children: jsxs(Link, { href: tokenLink, sx: styles$3.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$3.linkRow, children: jsxs(Link, { href: secondURL, sx: styles$3.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$3.linkRow, children: jsx$2(Link, { href: thirdURL, sx: styles$3.link, target: "_blank", children: thirdURLTitle }) }))] }) })] }));
|
|
65048
|
+
};
|
|
65049
|
+
|
|
65050
|
+
/**
|
|
65051
|
+
* Returns a USD dollar or equivalent denominated numerical value formatted
|
|
65052
|
+
* in human readable string for use in template.
|
|
65053
|
+
*
|
|
65054
|
+
* Adheres to guidelines for prices and other numbers defined here:
|
|
65055
|
+
* https://www.notion.so/uniswaplabs/Number-standards-fbb9f533f10e4e22820722c2f66d23c0
|
|
65056
|
+
* @param num numerical value denominated in USD or USD equivalent
|
|
65057
|
+
* @param isPrice whether the amount represents a price or not
|
|
65058
|
+
* @param lessPreciseStablecoinValues whether or not we should show less precise values for
|
|
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)}`;
|
|
64942
65072
|
}
|
|
64943
|
-
|
|
64944
|
-
|
|
64945
|
-
bValue = remainingPercentage(b);
|
|
65073
|
+
if ((num >= 0.000001 && num < 0.1) || num > 1000000) {
|
|
65074
|
+
return `$${Number(num).toPrecision(3)}`;
|
|
64946
65075
|
}
|
|
64947
|
-
|
|
64948
|
-
|
|
64949
|
-
|
|
65076
|
+
// We only show 2 decimal places in explore table for stablecoin value ranges
|
|
65077
|
+
// for the sake of readability (as opposed to the usual 3 elsewhere).
|
|
65078
|
+
if (num >= 0.1 && num < (lessPreciseStablecoinValues ? 0.9995 : 1.05)) {
|
|
65079
|
+
return `$${num.toFixed(3)}`;
|
|
64950
65080
|
}
|
|
64951
|
-
|
|
64952
|
-
|
|
64953
|
-
|
|
65081
|
+
return `$${Number(num.toFixed(2)).toLocaleString('en-US', { minimumFractionDigits: 2 })}`;
|
|
65082
|
+
}
|
|
65083
|
+
// For volume dollar amounts, like market cap, total value locked, etc.
|
|
65084
|
+
else {
|
|
65085
|
+
if (num === 0)
|
|
65086
|
+
return '$0.00';
|
|
65087
|
+
if (!num)
|
|
65088
|
+
return '-';
|
|
65089
|
+
if (num < 0.000001) {
|
|
65090
|
+
return '$<0.000001';
|
|
64954
65091
|
}
|
|
64955
|
-
if (
|
|
64956
|
-
return
|
|
65092
|
+
if (num >= 0.000001 && num < 0.1) {
|
|
65093
|
+
return `$${Number(num).toPrecision(3)}`;
|
|
64957
65094
|
}
|
|
64958
|
-
if (
|
|
64959
|
-
return
|
|
65095
|
+
if (num >= 0.1 && num < 1.05) {
|
|
65096
|
+
return `$${num.toFixed(3)}`;
|
|
64960
65097
|
}
|
|
64961
|
-
return
|
|
64962
|
-
|
|
64963
|
-
|
|
64964
|
-
|
|
64965
|
-
|
|
64966
|
-
|
|
64967
|
-
|
|
64968
|
-
|
|
64969
|
-
}
|
|
64970
|
-
|
|
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;
|
|
65098
|
+
return numbro(num)
|
|
65099
|
+
.formatCurrency({
|
|
65100
|
+
average: round,
|
|
65101
|
+
mantissa: num > 1000 ? 2 : digits,
|
|
65102
|
+
abbreviations: {
|
|
65103
|
+
million: 'M',
|
|
65104
|
+
billion: 'B',
|
|
65105
|
+
},
|
|
65106
|
+
})
|
|
65107
|
+
.toUpperCase();
|
|
64994
65108
|
}
|
|
64995
|
-
|
|
64996
|
-
|
|
65109
|
+
};
|
|
65110
|
+
const formatValue = ({ num, digits = 2, round = true }) => {
|
|
65111
|
+
if (num === 0)
|
|
65112
|
+
return '0.00';
|
|
65113
|
+
if (!num)
|
|
65114
|
+
return '-';
|
|
65115
|
+
if (num < 0.000001) {
|
|
65116
|
+
return '<0.000001';
|
|
64997
65117
|
}
|
|
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());
|
|
65118
|
+
if (num >= 0.000001 && num < 0.1) {
|
|
65119
|
+
return `${Number(num).toPrecision(3)}`;
|
|
65013
65120
|
}
|
|
65014
|
-
|
|
65015
|
-
return
|
|
65121
|
+
if (num >= 0.1 && num < 1.05) {
|
|
65122
|
+
return `${num.toFixed(3)}`;
|
|
65016
65123
|
}
|
|
65017
|
-
|
|
65124
|
+
return numbro(num)
|
|
65125
|
+
.format({
|
|
65126
|
+
average: round,
|
|
65127
|
+
mantissa: num > 1000 ? 2 : digits,
|
|
65128
|
+
abbreviations: {
|
|
65129
|
+
million: 'M',
|
|
65130
|
+
billion: 'B',
|
|
65131
|
+
},
|
|
65132
|
+
})
|
|
65133
|
+
.toUpperCase();
|
|
65134
|
+
};
|
|
65018
65135
|
|
|
65019
65136
|
function adjustDecimals(numStr) {
|
|
65020
65137
|
const parts = numStr.split('.');
|
|
@@ -65033,9 +65150,9 @@ function adjustDecimals(numStr) {
|
|
|
65033
65150
|
const convertToTokenValue = (numberString, decimals) => {
|
|
65034
65151
|
if (isNaN(parseFloat(numberString))) {
|
|
65035
65152
|
console.error('Error: numberString to parse is not a number');
|
|
65036
|
-
return parseUnits('0', decimals);
|
|
65153
|
+
return parseUnits$1('0', decimals);
|
|
65037
65154
|
}
|
|
65038
|
-
const tokenValue = parseUnits(adjustDecimals(numberString), decimals);
|
|
65155
|
+
const tokenValue = parseUnits$1(adjustDecimals(numberString), decimals);
|
|
65039
65156
|
return tokenValue;
|
|
65040
65157
|
};
|
|
65041
65158
|
|
|
@@ -65091,7 +65208,7 @@ const getPremiumColor = (bond, inputValue) => {
|
|
|
65091
65208
|
return parseFloat(getPremium) < 0 ? 'premium-negative' : 'premium-positive';
|
|
65092
65209
|
};
|
|
65093
65210
|
|
|
65094
|
-
const styles$
|
|
65211
|
+
const styles$2 = {
|
|
65095
65212
|
toPanelContainer: {
|
|
65096
65213
|
position: 'relative',
|
|
65097
65214
|
width: '100%',
|
|
@@ -65922,6 +66039,170 @@ const useApproval = (amount, currency, spender, account, chainId) => {
|
|
|
65922
66039
|
return [approvalState !== null && approvalState !== void 0 ? approvalState : ApprovalState.NOT_APPROVED, handleApprove];
|
|
65923
66040
|
};
|
|
65924
66041
|
|
|
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
|
+
|
|
65925
66206
|
const useTokenFromZapList = (tokenString, chainId, principalToken) => {
|
|
65926
66207
|
var _a;
|
|
65927
66208
|
if (tokenString === 'NATIVE')
|
|
@@ -66044,7 +66325,7 @@ const ZapModal = ({ onDismiss, outputToken, account, chainId }) => {
|
|
|
66044
66325
|
setPendingTx(true);
|
|
66045
66326
|
yield approveCallback().finally(() => setPendingTx(false));
|
|
66046
66327
|
}), []);
|
|
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$
|
|
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$2.toPanelContainer, children: [jsxs(Flex, { sx: styles$2.cont, children: [jsx$2(NumericInput, { value: parseFloat(outputValue) === 0 ? '' : outputValue, onUserInput: () => null }), jsxs(Flex, { sx: styles$2.tokensContainer, children: [lodashExports.isArray(splited) && jsx$2(TokenImage, { symbol: splited[0], symbol2: splited[1], size: 28 }), jsx$2(Text, { sx: styles$2.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 &&
|
|
66048
66329
|
(outputTokenPrice === null || outputTokenPrice === void 0 ? void 0 : outputTokenPrice.price) &&
|
|
66049
66330
|
outputValue &&
|
|
66050
66331
|
parseFloat(outputValue) !== 0 &&
|
|
@@ -71870,20 +72151,40 @@ const useSoulZapBondQuote = (typedValue, inputCurrency, bond, account) => {
|
|
|
71870
72151
|
return [isLoading, response, estimateOutput];
|
|
71871
72152
|
};
|
|
71872
72153
|
|
|
71873
|
-
|
|
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
|
+
const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?', accordionBody = 'Body', accordionVisible = false, variant = 'alt', onDismiss, }) => {
|
|
71874
72175
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
71875
72176
|
// Hooks
|
|
71876
72177
|
const userChainId = useChainId();
|
|
71877
72178
|
const { address: account } = useAccount();
|
|
71878
72179
|
const { switchChain } = useSwitchChain();
|
|
71879
|
-
const { writeContractAsync
|
|
72180
|
+
const { writeContractAsync } = useWriteContract();
|
|
71880
72181
|
const { sendTransactionAsync } = useSendTransaction();
|
|
71881
72182
|
const { data: bonds } = useBondsData();
|
|
71882
72183
|
// State
|
|
71883
72184
|
const [modalVariant, setModalVariant] = useState(variant);
|
|
71884
72185
|
const [bondData, setBondData] = useState();
|
|
71885
72186
|
const [toastMessage, setToastMessage] = useState(null);
|
|
71886
|
-
const [buyTxHash, setBuyTxHash] = useState();
|
|
72187
|
+
const [buyTxHash, setBuyTxHash] = useState(null);
|
|
71887
72188
|
const [inputValue, setInputValue] = useState('');
|
|
71888
72189
|
const [inputTokenString, setInputTokenString] = useState('NATIVE');
|
|
71889
72190
|
// Data
|
|
@@ -71908,7 +72209,7 @@ const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?',
|
|
|
71908
72209
|
}, []);
|
|
71909
72210
|
const handleClose = () => {
|
|
71910
72211
|
if (typeof window !== 'undefined') {
|
|
71911
|
-
window.history.pushState({}, '',
|
|
72212
|
+
window.history.pushState({}, '', `/`);
|
|
71912
72213
|
}
|
|
71913
72214
|
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
71914
72215
|
};
|
|
@@ -72020,9 +72321,9 @@ const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?',
|
|
|
72020
72321
|
setBondData(bond);
|
|
72021
72322
|
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');
|
|
72022
72323
|
}, [bondAddress]);
|
|
72023
|
-
return (
|
|
72024
|
-
|
|
72025
|
-
|
|
72324
|
+
return (
|
|
72325
|
+
// <Modal className="modal">
|
|
72326
|
+
jsx$2(Fragment$1, { children: bondData && (jsx$2(Fragment$1, { children: modalVariant === 'standard' ? (jsx$2(Flex, { className: "modal-backdrop", onClick: handleClose, children: jsxs(Flex, { className: "modal-content", onClick: (event) => event.stopPropagation(), children: [jsx$2(ModalHeader, { hideDivider: true, onDismiss: handleClose }), 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
|
|
72026
72327
|
? `${vestingTime((_p = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _p !== void 0 ? _p : 0).days} D`
|
|
72027
72328
|
: '-' })] }), 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) => {
|
|
72028
72329
|
event.stopPropagation();
|
|
@@ -72031,15 +72332,13 @@ const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?',
|
|
|
72031
72332
|
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
72032
72333
|
!account ||
|
|
72033
72334
|
!inputValue ||
|
|
72034
|
-
parseFloat(inputValue) === 0, onClick: approveCallback, children: ["approve ", isZap ? 'zap' : 'normal'] })) })] }), accordionVisible && (jsx$2(Flex, { className: "modaltable-container accordion-container", children: jsx$2(AccordionText, { title: accordionTitle, body: accordionBody, isVisible: accordionVisible }) }))] })] })) : (
|
|
72035
|
-
|
|
72036
|
-
|
|
72037
|
-
|
|
72038
|
-
|
|
72039
|
-
|
|
72040
|
-
|
|
72041
|
-
// <Flex className="modal-backdrop" onClick={handleClose}>
|
|
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) -
|
|
72335
|
+
parseFloat(inputValue) === 0, onClick: approveCallback, children: ["approve ", isZap ? 'zap' : 'normal'] })) })] }), accordionVisible && (jsx$2(Flex, { className: "modaltable-container accordion-container", children: jsx$2(AccordionText, { title: accordionTitle, body: accordionBody, isVisible: accordionVisible }) }))] })] }) })) : (
|
|
72336
|
+
//
|
|
72337
|
+
//
|
|
72338
|
+
// ALTERNATIVE VIEW!!
|
|
72339
|
+
//
|
|
72340
|
+
//
|
|
72341
|
+
jsx$2(Flex, { className: "modal-backdrop", onClick: handleClose, children: jsxs(Flex, { className: "modal-content font-small gpt", onClick: (event) => event.stopPropagation(), children: [jsx$2(ModalHeader, { hideDivider: true, onDismiss: handleClose }), 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 }), 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) -
|
|
72043
72342
|
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) => {
|
|
72044
72343
|
event.stopPropagation();
|
|
72045
72344
|
switchChain({ chainId: bondData.chainId });
|
|
@@ -72047,298 +72346,9 @@ const BondModal = ({ bondAddress, bondChain, accordionTitle = 'What are Bonds?',
|
|
|
72047
72346
|
(bondData === null || bondData === void 0 ? void 0 : bondData.soldOut) ||
|
|
72048
72347
|
!account ||
|
|
72049
72348
|
!inputValue ||
|
|
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),
|
|
72349
|
+
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()
|
|
72051
72350
|
.add(vestingTime((_v = bondData === null || bondData === void 0 ? void 0 : bondData.vestingTerm) !== null && _v !== void 0 ? _v : 0).days, 'days')
|
|
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 }) }))] })
|
|
72053
|
-
// </Flex>
|
|
72054
|
-
) }))] }));
|
|
72055
|
-
};
|
|
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();
|
|
72351
|
+
.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 }) }))] }) })) })) }));
|
|
72342
72352
|
};
|
|
72343
72353
|
|
|
72344
72354
|
const BondRow = ({ bond, hotBonds, modalVariant }) => {
|
|
@@ -72417,6 +72427,155 @@ const BondRowsByChain = ({ bonds, hotBonds, hideTitles, chains, modalVariant })
|
|
|
72417
72427
|
}) }));
|
|
72418
72428
|
};
|
|
72419
72429
|
|
|
72430
|
+
// This basically returns the 2 tags with the higher active bond count
|
|
72431
|
+
const useTopTags = (initialBondList) => {
|
|
72432
|
+
const bonds = initialBondList;
|
|
72433
|
+
const countTagsInBonds = (bonds) => {
|
|
72434
|
+
const tagCount = {};
|
|
72435
|
+
bonds === null || bonds === void 0 ? void 0 : bonds.forEach((bond) => {
|
|
72436
|
+
var _a;
|
|
72437
|
+
if (bond.soldOut)
|
|
72438
|
+
return;
|
|
72439
|
+
(_a = bond.tags) === null || _a === void 0 ? void 0 : _a.forEach((tag) => {
|
|
72440
|
+
if (tag in tagCount) {
|
|
72441
|
+
tagCount[tag] += 1;
|
|
72442
|
+
}
|
|
72443
|
+
else {
|
|
72444
|
+
tagCount[tag] = 1;
|
|
72445
|
+
}
|
|
72446
|
+
});
|
|
72447
|
+
});
|
|
72448
|
+
return tagCount;
|
|
72449
|
+
};
|
|
72450
|
+
const activeBonds = bonds === null || bonds === void 0 ? void 0 : bonds.filter((bond) => !bond.soldOut);
|
|
72451
|
+
const countedTags = countTagsInBonds(activeBonds);
|
|
72452
|
+
const sortedTagsArray = Object.entries(countedTags).sort((a, b) => b[1] - a[1]);
|
|
72453
|
+
return sortedTagsArray.slice(0, 2).map((tagCountArray) => tagCountArray[0]);
|
|
72454
|
+
};
|
|
72455
|
+
|
|
72456
|
+
const isBondSoldOut = (bill) => {
|
|
72457
|
+
var _a;
|
|
72458
|
+
const { tokensRemaining, discount, payoutTokenPrice, billAddress } = bill;
|
|
72459
|
+
if (bill.soldOut)
|
|
72460
|
+
return true;
|
|
72461
|
+
if (bill.inactive)
|
|
72462
|
+
return true;
|
|
72463
|
+
if (!tokensRemaining)
|
|
72464
|
+
return false;
|
|
72465
|
+
const thresholdToHide = new BigNumber$1(100).div(payoutTokenPrice !== null && payoutTokenPrice !== void 0 ? payoutTokenPrice : 0);
|
|
72466
|
+
if (discount && discount > 50) {
|
|
72467
|
+
// If discount is over 50% it will be hidden
|
|
72468
|
+
console.log('Soldout contract:', billAddress);
|
|
72469
|
+
return true;
|
|
72470
|
+
}
|
|
72471
|
+
if (((_a = new BigNumber$1(tokensRemaining)) === null || _a === void 0 ? void 0 : _a.lte(thresholdToHide)) || discount === 100) {
|
|
72472
|
+
// If there's less than 100 usd bond will be hidden
|
|
72473
|
+
console.log('Soldout contract: ', billAddress);
|
|
72474
|
+
return true;
|
|
72475
|
+
}
|
|
72476
|
+
else
|
|
72477
|
+
return false;
|
|
72478
|
+
};
|
|
72479
|
+
const sortBonds = (sortConfig, bonds) => {
|
|
72480
|
+
const bondsToSort = bonds !== null && bonds !== void 0 ? bonds : [];
|
|
72481
|
+
if (!sortConfig) {
|
|
72482
|
+
return bondsToSort;
|
|
72483
|
+
}
|
|
72484
|
+
return [...bondsToSort].sort((a, b) => {
|
|
72485
|
+
let aValue, bValue;
|
|
72486
|
+
if ((sortConfig === null || sortConfig === void 0 ? void 0 : sortConfig.key) === 'arr') {
|
|
72487
|
+
aValue = calculateARR(a);
|
|
72488
|
+
bValue = calculateARR(b);
|
|
72489
|
+
}
|
|
72490
|
+
else if (sortConfig.key === 'tokensRemaining') {
|
|
72491
|
+
aValue = remainingPercentage(a);
|
|
72492
|
+
bValue = remainingPercentage(b);
|
|
72493
|
+
}
|
|
72494
|
+
else if (sortConfig.key === 'terms') {
|
|
72495
|
+
aValue = vestingTime(a.vestingTerm).days;
|
|
72496
|
+
bValue = vestingTime(b.vestingTerm).days;
|
|
72497
|
+
}
|
|
72498
|
+
else {
|
|
72499
|
+
aValue = a[sortConfig.key];
|
|
72500
|
+
bValue = b[sortConfig.key];
|
|
72501
|
+
}
|
|
72502
|
+
if (aValue < bValue) {
|
|
72503
|
+
return sortConfig.direction === 'asc' ? -1 : 1;
|
|
72504
|
+
}
|
|
72505
|
+
if (aValue > bValue) {
|
|
72506
|
+
return sortConfig.direction === 'asc' ? 1 : -1;
|
|
72507
|
+
}
|
|
72508
|
+
return 0;
|
|
72509
|
+
});
|
|
72510
|
+
};
|
|
72511
|
+
const calculateARR = (bond) => {
|
|
72512
|
+
var _a;
|
|
72513
|
+
const discount = (_a = bond === null || bond === void 0 ? void 0 : bond.discount) !== null && _a !== void 0 ? _a : 0;
|
|
72514
|
+
const vestingDays = vestingTime(bond.vestingTerm).days;
|
|
72515
|
+
return parseFloat(((discount * 365) / vestingDays).toFixed(2));
|
|
72516
|
+
};
|
|
72517
|
+
const vestingTime = (vestingTerm) => {
|
|
72518
|
+
return getTimePeriods(vestingTerm !== null && vestingTerm !== void 0 ? vestingTerm : 0, true);
|
|
72519
|
+
};
|
|
72520
|
+
const remainingPercentage = (bond) => {
|
|
72521
|
+
var _a, _b, _c, _d;
|
|
72522
|
+
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));
|
|
72523
|
+
const remainingTokens = new BigNumber$1((_d = bond.tokensRemaining) !== null && _d !== void 0 ? _d : '0');
|
|
72524
|
+
return remainingTokens.div(totalMaxPayout).times(100).toNumber();
|
|
72525
|
+
};
|
|
72526
|
+
|
|
72527
|
+
function useHotBonds() {
|
|
72528
|
+
return useQuery({
|
|
72529
|
+
queryKey: [QUERY_KEYS.HOT_BONDS],
|
|
72530
|
+
queryFn: getHotBonds,
|
|
72531
|
+
refetchOnWindowFocus: false,
|
|
72532
|
+
retry: 1,
|
|
72533
|
+
initialData: [],
|
|
72534
|
+
});
|
|
72535
|
+
}
|
|
72536
|
+
const getHotBonds = () => __awaiter$9(void 0, void 0, void 0, function* () {
|
|
72537
|
+
try {
|
|
72538
|
+
const response = yield axios.get('https://apeswap-strapi.herokuapp.com/hot-bonds');
|
|
72539
|
+
return response.data.map((bond) => bond.BondAddress.toLowerCase());
|
|
72540
|
+
}
|
|
72541
|
+
catch (_a) {
|
|
72542
|
+
return [];
|
|
72543
|
+
}
|
|
72544
|
+
});
|
|
72545
|
+
|
|
72546
|
+
/** CheckURL purpose is to open the buy bond modal ONLY IF a user has opened the site with a custom URL */
|
|
72547
|
+
const CheckUrl = () => {
|
|
72548
|
+
var _a, _b;
|
|
72549
|
+
if (typeof window === 'undefined')
|
|
72550
|
+
return null;
|
|
72551
|
+
const { data: bonds } = useBondsData();
|
|
72552
|
+
const asPath = window.location.search;
|
|
72553
|
+
const urlParams = new URLSearchParams(new URL(asPath, window.location.origin).search);
|
|
72554
|
+
const bondAddress = (_a = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondAddress')) !== null && _a !== void 0 ? _a : '';
|
|
72555
|
+
const bondChain = (_b = urlParams === null || urlParams === void 0 ? void 0 : urlParams.get('bondChain')) !== null && _b !== void 0 ? _b : '';
|
|
72556
|
+
const bond = useMemo(() => {
|
|
72557
|
+
if (!bondAddress)
|
|
72558
|
+
return undefined;
|
|
72559
|
+
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()); });
|
|
72560
|
+
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
72561
|
+
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}`);
|
|
72562
|
+
useEffect(() => {
|
|
72563
|
+
if (bond && bondChain && bondAddress) {
|
|
72564
|
+
onPresentBuyBillsModal();
|
|
72565
|
+
// track({
|
|
72566
|
+
// event: 'buyModalOpen',
|
|
72567
|
+
// chain: bondChain,
|
|
72568
|
+
// data: {
|
|
72569
|
+
// cat: 'Row', // Row: clicked by user or custom URL. CTA add this to buy button on future A/B testing.
|
|
72570
|
+
// bond: bond.payoutTokenName,
|
|
72571
|
+
// bondChain: bondChain,
|
|
72572
|
+
// },
|
|
72573
|
+
// })
|
|
72574
|
+
}
|
|
72575
|
+
}, [bonds === null || bonds === void 0 ? void 0 : bonds.length]);
|
|
72576
|
+
return jsx$2(Fragment$1, {});
|
|
72577
|
+
};
|
|
72578
|
+
|
|
72420
72579
|
const Bonds = ({ chains = [], modalVariant = 'standard' }) => {
|
|
72421
72580
|
// Fetch data
|
|
72422
72581
|
const { data: bondData } = useBondsData();
|