@gmx-io/sdk 2.0.0 → 2.1.2
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/build/cjs/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +0 -48
- package/build/cjs/src/codegen/prebuilt/hashedMarketConfigKeys.json +0 -408
- package/build/cjs/src/codegen/prebuilt/hashedMarketValuesKeys.json +0 -90
- package/build/cjs/src/configs/api.js +1 -1
- package/build/cjs/src/configs/markets.js +0 -42
- package/build/cjs/src/configs/tokens.js +0 -57
- package/build/cjs/src/test/fixtures/arbitrumMarkets.json +0 -45
- package/build/cjs/src/test/fixtures/arbitrumTickers.json +0 -40
- package/build/cjs/src/test/fixtures/arbitrumTokens.json +0 -5
- package/build/cjs/src/utils/__tests__/numbers.spec.js +51 -0
- package/build/cjs/src/utils/gmxAccountApi/api.js +4 -7
- package/build/cjs/src/utils/http/__tests__/chainPins.spec.js +76 -0
- package/build/cjs/src/utils/http/chainPins.js +81 -0
- package/build/cjs/src/utils/http/http.js +3 -0
- package/build/cjs/src/utils/http/httpFallback.js +9 -1
- package/build/cjs/src/utils/numbers/utils.js +4 -3
- package/build/cjs/src/utils/orderTransactions/api.js +11 -6
- package/build/esm/src/codegen/prebuilt/hashedKinkModelMarketRatesKeys.json +0 -48
- package/build/esm/src/codegen/prebuilt/hashedMarketConfigKeys.json +0 -408
- package/build/esm/src/codegen/prebuilt/hashedMarketValuesKeys.json +0 -90
- package/build/esm/src/configs/api.js +1 -1
- package/build/esm/src/configs/markets.js +0 -42
- package/build/esm/src/configs/tokens.js +0 -57
- package/build/esm/src/test/fixtures/arbitrumMarkets.json +0 -45
- package/build/esm/src/test/fixtures/arbitrumTickers.json +0 -40
- package/build/esm/src/test/fixtures/arbitrumTokens.json +0 -5
- package/build/esm/src/utils/__tests__/numbers.spec.js +52 -1
- package/build/esm/src/utils/gmxAccountApi/api.js +4 -7
- package/build/esm/src/utils/http/__tests__/chainPins.spec.js +74 -0
- package/build/esm/src/utils/http/chainPins.js +76 -0
- package/build/esm/src/utils/http/http.js +3 -0
- package/build/esm/src/utils/http/httpFallback.js +9 -1
- package/build/esm/src/utils/numbers/utils.js +4 -3
- package/build/esm/src/utils/orderTransactions/api.js +11 -6
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/types/src/codegen/prebuilt/index.d.ts +42 -588
- package/build/types/src/utils/http/__tests__/chainPins.spec.d.ts +1 -0
- package/build/types/src/utils/http/chainPins.d.ts +9 -0
- package/build/types/src/utils/http/http.d.ts +4 -1
- package/build/types/src/utils/http/httpFallback.d.ts +4 -1
- package/build/types/src/utils/http/types.d.ts +7 -0
- package/package.json +1 -1
|
@@ -225,13 +225,6 @@ export const MARKETS = {
|
|
|
225
225
|
longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
226
226
|
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
227
227
|
},
|
|
228
|
-
// SATS/USD [WBTC-USDC]
|
|
229
|
-
"0x8ea4Fb801493DaD8724F90Fb2e279534fa591366": {
|
|
230
|
-
marketTokenAddress: "0x8ea4Fb801493DaD8724F90Fb2e279534fa591366",
|
|
231
|
-
indexTokenAddress: "0x2cD2eB61D17b78239Fcd19aafF72981B5D5eF319",
|
|
232
|
-
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
233
|
-
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
234
|
-
},
|
|
235
228
|
// POL/USD [ETH-USDC]
|
|
236
229
|
"0xD0a1AFDDE31Eb51e8b53bdCE989EB8C2404828a4": {
|
|
237
230
|
marketTokenAddress: "0xD0a1AFDDE31Eb51e8b53bdCE989EB8C2404828a4",
|
|
@@ -323,13 +316,6 @@ export const MARKETS = {
|
|
|
323
316
|
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
324
317
|
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
325
318
|
},
|
|
326
|
-
// BOME/USD [WBTC/USDC]
|
|
327
|
-
"0x71237F8C3d1484495A136022E16840b70fF84a69": {
|
|
328
|
-
marketTokenAddress: "0x71237F8C3d1484495A136022E16840b70fF84a69",
|
|
329
|
-
indexTokenAddress: "0x3Eea56A1ccCdbfB70A26aD381C71Ee17E4c8A15F",
|
|
330
|
-
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
331
|
-
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
332
|
-
},
|
|
333
319
|
// FLOKI/USD [WBTC/USDC]
|
|
334
320
|
"0xfD46a5702D4d97cE0164375744c65F0c31A3901b": {
|
|
335
321
|
marketTokenAddress: "0xfD46a5702D4d97cE0164375744c65F0c31A3901b",
|
|
@@ -337,20 +323,6 @@ export const MARKETS = {
|
|
|
337
323
|
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
338
324
|
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
339
325
|
},
|
|
340
|
-
// MEME/USD [WBTC/USDC]
|
|
341
|
-
"0x6CB901Cc64c024C3Fe4404c940FF9a3Acc229D2C": {
|
|
342
|
-
marketTokenAddress: "0x6CB901Cc64c024C3Fe4404c940FF9a3Acc229D2C",
|
|
343
|
-
indexTokenAddress: "0xaF770F03518686a365300ab35AD860e99967B2f0",
|
|
344
|
-
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
345
|
-
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
346
|
-
},
|
|
347
|
-
// MEW/USD [WBTC/USDC]
|
|
348
|
-
"0x71B7fF592a974e2B501D8A7a11f5c42DcD365244": {
|
|
349
|
-
marketTokenAddress: "0x71B7fF592a974e2B501D8A7a11f5c42DcD365244",
|
|
350
|
-
indexTokenAddress: "0x5503CF72f54b6d692d36BBCD391516A7dE068687",
|
|
351
|
-
longTokenAddress: "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
352
|
-
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
353
|
-
},
|
|
354
326
|
// GMX [GMX]
|
|
355
327
|
"0xbD48149673724f9cAeE647bb4e9D9dDaF896Efeb": {
|
|
356
328
|
marketTokenAddress: "0xbD48149673724f9cAeE647bb4e9D9dDaF896Efeb",
|
|
@@ -659,13 +631,6 @@ export const MARKETS = {
|
|
|
659
631
|
longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
660
632
|
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
661
633
|
},
|
|
662
|
-
// BRETT/USD [WETH-USDC]
|
|
663
|
-
"0x6EeE8098dBC106aEde99763FA5F955A5bBc42C50": {
|
|
664
|
-
marketTokenAddress: "0x6EeE8098dBC106aEde99763FA5F955A5bBc42C50",
|
|
665
|
-
indexTokenAddress: "0x4249F6e0808bEfF7368AaAD3F7A3Fd511F61Ee60",
|
|
666
|
-
longTokenAddress: "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
667
|
-
shortTokenAddress: "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
668
|
-
},
|
|
669
634
|
// WLFI/USD [WETH-USDC]
|
|
670
635
|
"0xb3588455858a49D3244237CEe00880CcB84b91Dd": {
|
|
671
636
|
marketTokenAddress: "0xb3588455858a49D3244237CEe00880CcB84b91Dd",
|
|
@@ -997,13 +962,6 @@ export const MARKETS = {
|
|
|
997
962
|
longTokenAddress: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
|
|
998
963
|
shortTokenAddress: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
999
964
|
},
|
|
1000
|
-
// MELANIA/USD [WAVAX-USDC]
|
|
1001
|
-
"0xe19da27Bf9733c429445E289B662bECDCa6ce10b": {
|
|
1002
|
-
marketTokenAddress: "0xe19da27Bf9733c429445E289B662bECDCa6ce10b",
|
|
1003
|
-
indexTokenAddress: "0xd42C991a4FAb293C57a7bf25C2E2ec5aE1dB1714",
|
|
1004
|
-
longTokenAddress: "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",
|
|
1005
|
-
shortTokenAddress: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",
|
|
1006
|
-
},
|
|
1007
965
|
// PUMP/USD [WAVAX-USDC]
|
|
1008
966
|
"0x94cE6F65188a92F297C7f0A5A7B3cAd9013450F8": {
|
|
1009
967
|
marketTokenAddress: "0x94cE6F65188a92F297C7f0A5A7B3cAd9013450F8",
|
|
@@ -374,17 +374,6 @@ export const TOKENS = {
|
|
|
374
374
|
isPermitSupported: false,
|
|
375
375
|
contractVersion: "1",
|
|
376
376
|
},
|
|
377
|
-
{
|
|
378
|
-
name: "Sats",
|
|
379
|
-
symbol: "SATS",
|
|
380
|
-
address: "0x2cD2eB61D17b78239Fcd19aafF72981B5D5eF319",
|
|
381
|
-
decimals: 6,
|
|
382
|
-
categories: ["meme"],
|
|
383
|
-
imageUrl: "https://assets.coingecko.com/coins/images/30666/standard/_dD8qr3M_400x400.png?1702913020",
|
|
384
|
-
isSynthetic: true,
|
|
385
|
-
visualMultiplier: 1000000,
|
|
386
|
-
visualPrefix: "m",
|
|
387
|
-
},
|
|
388
377
|
{
|
|
389
378
|
name: "Polygon",
|
|
390
379
|
symbol: "POL",
|
|
@@ -476,15 +465,6 @@ export const TOKENS = {
|
|
|
476
465
|
imageUrl: "https://assets.coingecko.com/coins/images/28452/standard/ARUsPeNQ_400x400.jpeg?1696527447",
|
|
477
466
|
isSynthetic: true,
|
|
478
467
|
},
|
|
479
|
-
{
|
|
480
|
-
name: "BOME",
|
|
481
|
-
symbol: "BOME",
|
|
482
|
-
address: "0x3Eea56A1ccCdbfB70A26aD381C71Ee17E4c8A15F",
|
|
483
|
-
decimals: 6,
|
|
484
|
-
categories: ["meme"],
|
|
485
|
-
imageUrl: "https://assets.coingecko.com/coins/images/36071/standard/bome.png?1710407255",
|
|
486
|
-
isSynthetic: true,
|
|
487
|
-
},
|
|
488
468
|
{
|
|
489
469
|
name: "FLOKI",
|
|
490
470
|
symbol: "FLOKI",
|
|
@@ -496,24 +476,6 @@ export const TOKENS = {
|
|
|
496
476
|
visualMultiplier: 1000,
|
|
497
477
|
visualPrefix: "k",
|
|
498
478
|
},
|
|
499
|
-
{
|
|
500
|
-
name: "MEME",
|
|
501
|
-
symbol: "MEME",
|
|
502
|
-
address: "0xaF770F03518686a365300ab35AD860e99967B2f0",
|
|
503
|
-
decimals: 18,
|
|
504
|
-
categories: ["meme"],
|
|
505
|
-
imageUrl: "https://assets.coingecko.com/coins/images/32528/standard/memecoin_%282%29.png?1698912168",
|
|
506
|
-
isSynthetic: true,
|
|
507
|
-
},
|
|
508
|
-
{
|
|
509
|
-
name: "MEW",
|
|
510
|
-
symbol: "MEW",
|
|
511
|
-
address: "0x5503CF72f54b6d692d36BBCD391516A7dE068687",
|
|
512
|
-
decimals: 5,
|
|
513
|
-
categories: ["meme"],
|
|
514
|
-
imageUrl: "https://assets.coingecko.com/coins/images/36440/standard/MEW.png?1711442286",
|
|
515
|
-
isSynthetic: true,
|
|
516
|
-
},
|
|
517
479
|
{
|
|
518
480
|
name: "PENDLE",
|
|
519
481
|
symbol: "PENDLE",
|
|
@@ -893,15 +855,6 @@ export const TOKENS = {
|
|
|
893
855
|
categories: ["defi"],
|
|
894
856
|
imageUrl: "https://assets.coingecko.com/coins/images/31745/standard/token.png?1696530564",
|
|
895
857
|
},
|
|
896
|
-
{
|
|
897
|
-
name: "Brett",
|
|
898
|
-
symbol: "BRETT",
|
|
899
|
-
address: "0x4249F6e0808bEfF7368AaAD3F7A3Fd511F61Ee60",
|
|
900
|
-
decimals: 18,
|
|
901
|
-
isSynthetic: true,
|
|
902
|
-
categories: ["meme"],
|
|
903
|
-
imageUrl: "https://assets.coingecko.com/coins/images/54317/standard/AERO.png?1728309870",
|
|
904
|
-
},
|
|
905
858
|
{
|
|
906
859
|
name: "World Liberty Financial",
|
|
907
860
|
symbol: "WLFI",
|
|
@@ -1392,15 +1345,6 @@ export const TOKENS = {
|
|
|
1392
1345
|
imageUrl: "https://assets.coingecko.com/coins/images/53746/standard/trump.png?1737171561",
|
|
1393
1346
|
isSynthetic: true,
|
|
1394
1347
|
},
|
|
1395
|
-
{
|
|
1396
|
-
name: "Melania Meme",
|
|
1397
|
-
symbol: "MELANIA",
|
|
1398
|
-
address: "0xd42C991a4FAb293C57a7bf25C2E2ec5aE1dB1714",
|
|
1399
|
-
decimals: 6,
|
|
1400
|
-
categories: ["meme"],
|
|
1401
|
-
imageUrl: "https://assets.coingecko.com/coins/images/53775/standard/melania-meme.png?1737329885",
|
|
1402
|
-
isSynthetic: true,
|
|
1403
|
-
},
|
|
1404
1348
|
{
|
|
1405
1349
|
name: "Pump",
|
|
1406
1350
|
symbol: "PUMP",
|
|
@@ -1919,7 +1863,6 @@ export const TOKEN_COLOR_MAP = {
|
|
|
1919
1863
|
ORDI: "#000000",
|
|
1920
1864
|
MATIC: "#6f41d8",
|
|
1921
1865
|
EIGEN: "#1A0C6D",
|
|
1922
|
-
SATS: "#F7931A",
|
|
1923
1866
|
XAU: "#D69A00",
|
|
1924
1867
|
XAG: "#ADABB8",
|
|
1925
1868
|
GOLD: "#D69A00",
|
|
@@ -342,15 +342,6 @@
|
|
|
342
342
|
"isListed": true,
|
|
343
343
|
"listingDate": "2023-08-08T00:00:00.000Z"
|
|
344
344
|
},
|
|
345
|
-
{
|
|
346
|
-
"name": "MEME/USD [WBTC.b-USDC]",
|
|
347
|
-
"marketToken": "0x6CB901Cc64c024C3Fe4404c940FF9a3Acc229D2C",
|
|
348
|
-
"indexToken": "0xaF770F03518686a365300ab35AD860e99967B2f0",
|
|
349
|
-
"longToken": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
350
|
-
"shortToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
351
|
-
"isListed": true,
|
|
352
|
-
"listingDate": "2024-11-21T00:00:00.000Z"
|
|
353
|
-
},
|
|
354
345
|
{
|
|
355
346
|
"name": "UNI/USD [UNI-USDC]",
|
|
356
347
|
"marketToken": "0xc7Abb2C5f3BF3CEB389dF0Eecd6120D451170B50",
|
|
@@ -639,15 +630,6 @@
|
|
|
639
630
|
"isListed": true,
|
|
640
631
|
"listingDate": "2025-08-21T00:00:00.000Z"
|
|
641
632
|
},
|
|
642
|
-
{
|
|
643
|
-
"name": "MEW/USD [WBTC.b-USDC]",
|
|
644
|
-
"marketToken": "0x71B7fF592a974e2B501D8A7a11f5c42DcD365244",
|
|
645
|
-
"indexToken": "0x5503CF72f54b6d692d36BBCD391516A7dE068687",
|
|
646
|
-
"longToken": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
647
|
-
"shortToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
648
|
-
"isListed": true,
|
|
649
|
-
"listingDate": "2024-11-21T00:00:00.000Z"
|
|
650
|
-
},
|
|
651
633
|
{
|
|
652
634
|
"name": "CHZ/USD [ETH-USDC]",
|
|
653
635
|
"marketToken": "0x3600592DdEd7e6E0B05029DfB637fFc5A85D6f6B",
|
|
@@ -882,15 +864,6 @@
|
|
|
882
864
|
"isListed": true,
|
|
883
865
|
"listingDate": "2024-11-07T00:00:00.000Z"
|
|
884
866
|
},
|
|
885
|
-
{
|
|
886
|
-
"name": "BOME/USD [WBTC.b-USDC]",
|
|
887
|
-
"marketToken": "0x71237F8C3d1484495A136022E16840b70fF84a69",
|
|
888
|
-
"indexToken": "0x3Eea56A1ccCdbfB70A26aD381C71Ee17E4c8A15F",
|
|
889
|
-
"longToken": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
890
|
-
"shortToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
891
|
-
"isListed": true,
|
|
892
|
-
"listingDate": "2024-11-21T00:00:00.000Z"
|
|
893
|
-
},
|
|
894
867
|
{
|
|
895
868
|
"name": "MOODENG/USD [WBTC.b-USDC]",
|
|
896
869
|
"marketToken": "0x2523B89298908FEf4c5e5bd6F55F20926e22058f",
|
|
@@ -1044,15 +1017,6 @@
|
|
|
1044
1017
|
"isListed": true,
|
|
1045
1018
|
"listingDate": "2024-03-20T00:00:00.000Z"
|
|
1046
1019
|
},
|
|
1047
|
-
{
|
|
1048
|
-
"name": "BRETT/USD [ETH-USDC]",
|
|
1049
|
-
"marketToken": "0x6EeE8098dBC106aEde99763FA5F955A5bBc42C50",
|
|
1050
|
-
"indexToken": "0x4249F6e0808bEfF7368AaAD3F7A3Fd511F61Ee60",
|
|
1051
|
-
"longToken": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
1052
|
-
"shortToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
1053
|
-
"isListed": true,
|
|
1054
|
-
"listingDate": "2025-08-27T00:00:00.000Z"
|
|
1055
|
-
},
|
|
1056
1020
|
{
|
|
1057
1021
|
"name": "LDO/USD [ETH-USDC]",
|
|
1058
1022
|
"marketToken": "0xE61e608Ba010fF48A7dcE8eDd8B906744263d33E",
|
|
@@ -1116,15 +1080,6 @@
|
|
|
1116
1080
|
"isListed": true,
|
|
1117
1081
|
"listingDate": "2023-08-08T00:00:00.000Z"
|
|
1118
1082
|
},
|
|
1119
|
-
{
|
|
1120
|
-
"name": "SATS/USD [WBTC.b-USDC]",
|
|
1121
|
-
"marketToken": "0x8ea4Fb801493DaD8724F90Fb2e279534fa591366",
|
|
1122
|
-
"indexToken": "0x2cD2eB61D17b78239Fcd19aafF72981B5D5eF319",
|
|
1123
|
-
"longToken": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
|
|
1124
|
-
"shortToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
|
|
1125
|
-
"isListed": true,
|
|
1126
|
-
"listingDate": "2024-10-10T00:00:00.000Z"
|
|
1127
|
-
},
|
|
1128
1083
|
{
|
|
1129
1084
|
"name": "SWAP-ONLY [wstETH-ETH]",
|
|
1130
1085
|
"marketToken": "0xb56E5E2eB50cf5383342914b0C85Fe62DbD861C8",
|
|
@@ -23,22 +23,6 @@
|
|
|
23
23
|
"updatedAt": 1783345314888,
|
|
24
24
|
"timestamp": 1783345314
|
|
25
25
|
},
|
|
26
|
-
{
|
|
27
|
-
"tokenAddress": "0x3Eea56A1ccCdbfB70A26aD381C71Ee17E4c8A15F",
|
|
28
|
-
"tokenSymbol": "BOME",
|
|
29
|
-
"minPrice": "432090385071025750000",
|
|
30
|
-
"maxPrice": "432348055213077250000",
|
|
31
|
-
"updatedAt": 1783345314888,
|
|
32
|
-
"timestamp": 1783345314
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
"tokenAddress": "0xaF770F03518686a365300ab35AD860e99967B2f0",
|
|
36
|
-
"tokenSymbol": "MEME",
|
|
37
|
-
"minPrice": "586602668",
|
|
38
|
-
"maxPrice": "587128946",
|
|
39
|
-
"updatedAt": 1783345314888,
|
|
40
|
-
"timestamp": 1783345314
|
|
41
|
-
},
|
|
42
26
|
{
|
|
43
27
|
"tokenAddress": "0x6792c5B8962ffbDD020c6b6FD0Be7b182e0e33a3",
|
|
44
28
|
"tokenSymbol": "FLOKI",
|
|
@@ -47,14 +31,6 @@
|
|
|
47
31
|
"updatedAt": 1783345314888,
|
|
48
32
|
"timestamp": 1783345314
|
|
49
33
|
},
|
|
50
|
-
{
|
|
51
|
-
"tokenAddress": "0x5503CF72f54b6d692d36BBCD391516A7dE068687",
|
|
52
|
-
"tokenSymbol": "MEW",
|
|
53
|
-
"minPrice": "3783586749507750000000",
|
|
54
|
-
"maxPrice": "3786285876407250000000",
|
|
55
|
-
"updatedAt": 1783345314988,
|
|
56
|
-
"timestamp": 1783345314
|
|
57
|
-
},
|
|
58
34
|
{
|
|
59
35
|
"tokenAddress": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
|
|
60
36
|
"tokenSymbol": "ETH",
|
|
@@ -367,14 +343,6 @@
|
|
|
367
343
|
"updatedAt": 1783345314988,
|
|
368
344
|
"timestamp": 1783345314
|
|
369
345
|
},
|
|
370
|
-
{
|
|
371
|
-
"tokenAddress": "0x2cD2eB61D17b78239Fcd19aafF72981B5D5eF319",
|
|
372
|
-
"tokenSymbol": "SATS",
|
|
373
|
-
"minPrice": "9371077957250000",
|
|
374
|
-
"maxPrice": "9373464871750000",
|
|
375
|
-
"updatedAt": 1783345314888,
|
|
376
|
-
"timestamp": 1783345314
|
|
377
|
-
},
|
|
378
346
|
{
|
|
379
347
|
"tokenAddress": "0x9c74772b713a1B032aEB173E28683D937E51921c",
|
|
380
348
|
"tokenSymbol": "POL",
|
|
@@ -727,14 +695,6 @@
|
|
|
727
695
|
"updatedAt": 1783345314988,
|
|
728
696
|
"timestamp": 1783345314
|
|
729
697
|
},
|
|
730
|
-
{
|
|
731
|
-
"tokenAddress": "0x4249F6e0808bEfF7368AaAD3F7A3Fd511F61Ee60",
|
|
732
|
-
"tokenSymbol": "BRETT",
|
|
733
|
-
"minPrice": "5478890912",
|
|
734
|
-
"maxPrice": "5482609279",
|
|
735
|
-
"updatedAt": 1783345314888,
|
|
736
|
-
"timestamp": 1783345314
|
|
737
|
-
},
|
|
738
698
|
{
|
|
739
699
|
"tokenAddress": "0xC5799ab6E2818fD8d0788dB8D156B0c5db1Bf97b",
|
|
740
700
|
"tokenSymbol": "WLFI",
|
|
@@ -3,10 +3,7 @@
|
|
|
3
3
|
{ "symbol": "APE", "address": "0x7f9FBf9bDd3F4105C478b996B648FE6e828a1e98", "decimals": 18 },
|
|
4
4
|
{ "symbol": "APE_deprecated", "address": "0x74885b4D524d497261259B38900f54e6dbAd2210", "decimals": 18 },
|
|
5
5
|
{ "symbol": "APT", "address": "0x3f8f0dCE4dCE4d0D1d0871941e79CDA82cA50d0B", "decimals": 8, "synthetic": true },
|
|
6
|
-
{ "symbol": "BOME", "address": "0x3Eea56A1ccCdbfB70A26aD381C71Ee17E4c8A15F", "decimals": 6, "synthetic": true },
|
|
7
|
-
{ "symbol": "MEME", "address": "0xaF770F03518686a365300ab35AD860e99967B2f0", "decimals": 18, "synthetic": true },
|
|
8
6
|
{ "symbol": "FLOKI", "address": "0x6792c5B8962ffbDD020c6b6FD0Be7b182e0e33a3", "decimals": 9, "synthetic": true },
|
|
9
|
-
{ "symbol": "MEW", "address": "0x5503CF72f54b6d692d36BBCD391516A7dE068687", "decimals": 5, "synthetic": true },
|
|
10
7
|
{ "symbol": "ETH", "address": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1", "decimals": 18 },
|
|
11
8
|
{ "symbol": "TAO", "address": "0x938aef36CAaFbcB37815251B602168087eC14648", "decimals": 9, "synthetic": true },
|
|
12
9
|
{ "symbol": "BONK", "address": "0x1FD10E767187A92f0AB2ABDEEF4505e319cA06B2", "decimals": 5, "synthetic": true },
|
|
@@ -46,7 +43,6 @@
|
|
|
46
43
|
{ "symbol": "PENDLE", "address": "0x0c880f6761F1af8d9Aa9C466984b80DAb9a8c9e8", "decimals": 18 },
|
|
47
44
|
{ "symbol": "wstETH", "address": "0x5979D7b546E38E414F7E9822514be443A4800529", "decimals": 18 },
|
|
48
45
|
{ "symbol": "USDe", "address": "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34", "decimals": 18 },
|
|
49
|
-
{ "symbol": "SATS", "address": "0x2cD2eB61D17b78239Fcd19aafF72981B5D5eF319", "decimals": 6, "synthetic": true },
|
|
50
46
|
{ "symbol": "POL", "address": "0x9c74772b713a1B032aEB173E28683D937E51921c", "decimals": 18, "synthetic": true },
|
|
51
47
|
{ "symbol": "ADA", "address": "0x53186c8419BEB83fE4Da74F7875041a1287337ED", "decimals": 6, "synthetic": true },
|
|
52
48
|
{ "symbol": "XLM", "address": "0xc5dbD52Ae5a927Cf585B884011d0C7631C9974c6", "decimals": 7, "synthetic": true },
|
|
@@ -92,7 +88,6 @@
|
|
|
92
88
|
{ "symbol": "CVX", "address": "0x3B6f801C0052Dfe0Ac80287D611F31B7c47B9A6b", "decimals": 18, "synthetic": true },
|
|
93
89
|
{ "symbol": "KAS", "address": "0x91c6a8F6aFAC036F4ABf1bA55f4E76892E865E4a", "decimals": 8, "synthetic": true },
|
|
94
90
|
{ "symbol": "AERO", "address": "0xEcc5eb985Ddbb8335b175b0A2A1144E4c978F1f6", "decimals": 18, "synthetic": true },
|
|
95
|
-
{ "symbol": "BRETT", "address": "0x4249F6e0808bEfF7368AaAD3F7A3Fd511F61Ee60", "decimals": 18, "synthetic": true },
|
|
96
91
|
{ "symbol": "WLFI", "address": "0xC5799ab6E2818fD8d0788dB8D156B0c5db1Bf97b", "decimals": 18, "synthetic": true },
|
|
97
92
|
{ "symbol": "WELL", "address": "0x465A31E5bA29b8EAcC860d499D714a6f07e56E85", "decimals": 18, "synthetic": true },
|
|
98
93
|
{ "symbol": "VVV", "address": "0xB79Eb5BA64A167676694bB41bc1640F95d309a2F", "decimals": 18, "synthetic": true },
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { BASIS_POINTS_DIVISOR_BIGINT, USD_DECIMALS } from "../../configs/factors";
|
|
3
|
-
import { applyFactor, basisPointsToFloat, bigintToNumber, BN_NEGATIVE_ONE, BN_ONE, BN_ZERO, expandDecimals, formatAmount, formatAmountHuman, formatBalanceAmount, formatBasisPoints, formatPriceImpactBps, formatFactor, formatPercentage, formatTokenAmount, formatUsdPrice, getBasisPoints, isUint256, MaxUint256, numberToBigint, parseUint256DecimalString, PERCENT_PRECISION_DECIMALS, PRECISION, PRECISION_DECIMALS, parseValue, removeTrailingZeros, trimZeroDecimals, roundWithDecimals, roundUpMagnitudeDivision, roundsToZero, toBigNumberWithDecimals, } from "../numbers";
|
|
3
|
+
import { applyFactor, basisPointsToFloat, bigintToNumber, BN_NEGATIVE_ONE, BN_ONE, BN_ZERO, expandDecimals, formatAmount, formatAmountHuman, formatBalanceAmount, formatBasisPoints, formatPriceImpactBps, formatFactor, formatNumberHuman, formatPercentage, formatTokenAmount, formatUsdPrice, getBasisPoints, isUint256, MaxUint256, numberToBigint, parseUint256DecimalString, PERCENT_PRECISION_DECIMALS, PRECISION, PRECISION_DECIMALS, parseValue, removeTrailingZeros, trimZeroDecimals, roundWithDecimals, roundUpMagnitudeDivision, roundsToZero, toBigNumberWithDecimals, } from "../numbers";
|
|
4
4
|
const ONE_USD = 1000000000000000000000000000000n;
|
|
5
5
|
describe("numbers utils", () => {
|
|
6
6
|
it("constants", () => {
|
|
@@ -257,7 +257,58 @@ describe("formatUsdPrice", () => {
|
|
|
257
257
|
expect(formatUsdPrice(ONE_USD / 10000000000n)).toBe("<\u00a0$\u200a0.000000001");
|
|
258
258
|
});
|
|
259
259
|
});
|
|
260
|
+
describe("formatNumberHuman", () => {
|
|
261
|
+
it.each([
|
|
262
|
+
[999.94, 1, "999.9"],
|
|
263
|
+
[999.96, 1, "1.0k"],
|
|
264
|
+
[1000, 1, "1.0k"],
|
|
265
|
+
[999940, 1, "999.9k"],
|
|
266
|
+
[999960, 1, "1.0m"],
|
|
267
|
+
[999996, 1, "1.0m"],
|
|
268
|
+
[1000000, 1, "1.0m"],
|
|
269
|
+
[999940000, 1, "999.9m"],
|
|
270
|
+
[999960000, 1, "1.0b"],
|
|
271
|
+
[1000000000, 1, "1.0b"],
|
|
272
|
+
[999.4, 0, "999"],
|
|
273
|
+
[999.6, 0, "1k"],
|
|
274
|
+
[999400, 0, "999k"],
|
|
275
|
+
[999600, 0, "1m"],
|
|
276
|
+
[999400000, 0, "999m"],
|
|
277
|
+
[999600000, 0, "1b"],
|
|
278
|
+
[999.994, 2, "999.99"],
|
|
279
|
+
[999.996, 2, "1.00k"],
|
|
280
|
+
[999994, 2, "999.99k"],
|
|
281
|
+
[999996, 2, "1.00m"],
|
|
282
|
+
[999994000, 2, "999.99m"],
|
|
283
|
+
[999996000, 2, "1.00b"],
|
|
284
|
+
])("formats %s at %s decimal places as %s", (value, displayDecimals, expected) => {
|
|
285
|
+
expect(formatNumberHuman(value, false, displayDecimals)).toBe(expected);
|
|
286
|
+
expect(formatNumberHuman(-value, false, displayDecimals)).toBe(`-${expected}`);
|
|
287
|
+
expect(formatNumberHuman(value, true, displayDecimals)).toBe(`$\u200a${expected}`);
|
|
288
|
+
expect(formatNumberHuman(-value, true, displayDecimals)).toBe(`-$\u200a${expected}`);
|
|
289
|
+
});
|
|
290
|
+
it("preserves zero and small values", () => {
|
|
291
|
+
expect(formatNumberHuman(0)).toBe("0.0");
|
|
292
|
+
expect(formatNumberHuman(0, true, 2)).toBe("$\u200a0.00");
|
|
293
|
+
expect(formatNumberHuman(0.04)).toBe("0.0");
|
|
294
|
+
expect(formatNumberHuman(-0.04)).toBe("-0.0");
|
|
295
|
+
});
|
|
296
|
+
});
|
|
260
297
|
describe("formatAmountHuman", () => {
|
|
298
|
+
it.each([
|
|
299
|
+
["999.94", "$\u200a999.9"],
|
|
300
|
+
["999.96", "$\u200a1.0k"],
|
|
301
|
+
["999996", "$\u200a1.0m"],
|
|
302
|
+
["999996000", "$\u200a1.0b"],
|
|
303
|
+
])("formats the USD amount %s as %s", (value, expected) => {
|
|
304
|
+
const amount = toBigNumberWithDecimals(value, USD_DECIMALS);
|
|
305
|
+
expect(formatAmountHuman(amount, USD_DECIMALS, true, 1)).toBe(expected);
|
|
306
|
+
expect(formatAmountHuman(-amount, USD_DECIMALS, true, 1)).toBe(`-${expected}`);
|
|
307
|
+
});
|
|
308
|
+
it("preserves loading and zero values", () => {
|
|
309
|
+
expect(formatAmountHuman(undefined, USD_DECIMALS, true)).toBe("...");
|
|
310
|
+
expect(formatAmountHuman(0n, USD_DECIMALS, true)).toBe("$\u200a0.0");
|
|
311
|
+
});
|
|
261
312
|
it("positive", () => {
|
|
262
313
|
expect(formatAmountHuman(ONE_USD, USD_DECIMALS)).toBe("1.0");
|
|
263
314
|
expect(formatAmountHuman(ONE_USD * 1000n, USD_DECIMALS)).toBe("1.0k");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { postJsonPinned, postJsonPinning } from "../http/chainPins";
|
|
1
2
|
function parseDepositPrepareResponse(raw) {
|
|
2
3
|
return {
|
|
3
4
|
payloadType: "transaction",
|
|
@@ -52,12 +53,10 @@ export async function executeCrossChainDeposit(ctx, signer, request) {
|
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
55
|
export async function prepareCrossChainWithdraw(ctx, request) {
|
|
55
|
-
return ctx.api
|
|
56
|
-
transform: parseWithdrawPrepareResponse,
|
|
57
|
-
});
|
|
56
|
+
return postJsonPinning(ctx.api, "/v1/gmx-account/withdraw/cross-chain/prepare", request, (prepared) => [prepared.requestId], { transform: parseWithdrawPrepareResponse });
|
|
58
57
|
}
|
|
59
58
|
export async function submitCrossChainWithdraw(ctx, request) {
|
|
60
|
-
return ctx.api.
|
|
59
|
+
return postJsonPinned(ctx.api, [request.requestId], "/v1/gmx-account/withdraw/cross-chain/submit", request);
|
|
61
60
|
}
|
|
62
61
|
export async function signCrossChainWithdrawPrepared(prepared, signer) {
|
|
63
62
|
const td = prepared.payload.typedData;
|
|
@@ -78,7 +77,5 @@ export async function executeCrossChainWithdraw(ctx, signer, request) {
|
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
export async function getCrossChainWithdrawStatus(ctx, requestId) {
|
|
81
|
-
return ctx.api
|
|
82
|
-
requestId,
|
|
83
|
-
});
|
|
80
|
+
return postJsonPinned(ctx.api, [requestId], "/v1/gmx-account/withdraw/cross-chain/status", { requestId });
|
|
84
81
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
2
|
+
import { HttpClientWithFallback } from "../httpFallback";
|
|
3
|
+
import { fetchOrderStatus, prepareOrder, submitOrder } from "../../orderTransactions/api";
|
|
4
|
+
const fetchMock = vi.hoisted(() => vi.fn());
|
|
5
|
+
vi.mock("cross-fetch", () => ({ default: fetchMock }));
|
|
6
|
+
const PREPARE = "/v1/orders/txns/prepare";
|
|
7
|
+
const SUBMIT = "/v1/orders/txns/submit";
|
|
8
|
+
const STATUS = "/v1/orders/txns/status";
|
|
9
|
+
function jsonResponse(status, body) {
|
|
10
|
+
return new Response(JSON.stringify(body), { status, headers: { "Content-Type": "application/json" } });
|
|
11
|
+
}
|
|
12
|
+
describe("express chain pinning", () => {
|
|
13
|
+
const calls = [];
|
|
14
|
+
const failingOnA = new Set();
|
|
15
|
+
const notFoundOnce = new Set();
|
|
16
|
+
beforeEach(() => {
|
|
17
|
+
calls.length = 0;
|
|
18
|
+
failingOnA.clear();
|
|
19
|
+
notFoundOnce.clear();
|
|
20
|
+
vi.spyOn(Math, "random").mockReturnValue(0);
|
|
21
|
+
fetchMock.mockImplementation(async (input) => {
|
|
22
|
+
const url = new URL(input);
|
|
23
|
+
calls.push(`${url.origin}${url.pathname}`);
|
|
24
|
+
if (url.origin === "http://a" && failingOnA.has(url.pathname)) {
|
|
25
|
+
return jsonResponse(503, { message: "busy" });
|
|
26
|
+
}
|
|
27
|
+
if (notFoundOnce.delete(url.pathname)) {
|
|
28
|
+
return jsonResponse(404, { message: "not found" });
|
|
29
|
+
}
|
|
30
|
+
if (url.pathname === PREPARE) {
|
|
31
|
+
return jsonResponse(200, { requestId: "req-1", payloadType: "typed-data", mode: "express", payload: {} });
|
|
32
|
+
}
|
|
33
|
+
if (url.pathname === SUBMIT) {
|
|
34
|
+
return jsonResponse(200, { requestId: "req-1", status: "relay_accepted" });
|
|
35
|
+
}
|
|
36
|
+
if (url.pathname === STATUS) {
|
|
37
|
+
return jsonResponse(200, { requestId: "req-1", status: "created" });
|
|
38
|
+
}
|
|
39
|
+
return jsonResponse(404, { message: "not found" });
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
vi.restoreAllMocks();
|
|
44
|
+
});
|
|
45
|
+
function newCtx() {
|
|
46
|
+
return { api: new HttpClientWithFallback(["http://a", "http://b"]) };
|
|
47
|
+
}
|
|
48
|
+
it("sends submit and status to the origin that served prepare", async () => {
|
|
49
|
+
failingOnA.add(PREPARE);
|
|
50
|
+
const ctx = newCtx();
|
|
51
|
+
const prepared = await prepareOrder(ctx, { kind: "increase", orderType: "market", mode: "express", from: "0x1" });
|
|
52
|
+
await submitOrder(ctx, { mode: "express", requestId: prepared.requestId });
|
|
53
|
+
await fetchOrderStatus(ctx, { requestId: prepared.requestId });
|
|
54
|
+
expect(calls).toEqual([`http://a${PREPARE}`, `http://b${PREPARE}`, `http://b${SUBMIT}`, `http://b${STATUS}`]);
|
|
55
|
+
});
|
|
56
|
+
it("pins status to the origin that served an unpinned submit", async () => {
|
|
57
|
+
failingOnA.add(SUBMIT);
|
|
58
|
+
const ctx = newCtx();
|
|
59
|
+
await submitOrder(ctx, { mode: "express", requestId: "req-1" });
|
|
60
|
+
await fetchOrderStatus(ctx, { requestId: "req-1" });
|
|
61
|
+
expect(calls).toEqual([`http://a${SUBMIT}`, `http://b${SUBMIT}`, `http://b${STATUS}`]);
|
|
62
|
+
});
|
|
63
|
+
it("drops the pin when the pinned origin answers 404", async () => {
|
|
64
|
+
failingOnA.add(PREPARE);
|
|
65
|
+
const ctx = newCtx();
|
|
66
|
+
const prepared = await prepareOrder(ctx, { kind: "increase", orderType: "market", mode: "express", from: "0x1" });
|
|
67
|
+
notFoundOnce.add(SUBMIT);
|
|
68
|
+
await expect(submitOrder(ctx, { mode: "express", requestId: prepared.requestId })).rejects.toMatchObject({
|
|
69
|
+
statusCode: 404,
|
|
70
|
+
});
|
|
71
|
+
await fetchOrderStatus(ctx, { requestId: prepared.requestId });
|
|
72
|
+
expect(calls).toEqual([`http://a${PREPARE}`, `http://b${PREPARE}`, `http://b${SUBMIT}`, `http://a${STATUS}`]);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { HttpError } from "./http";
|
|
2
|
+
const MAX_PINS = 256;
|
|
3
|
+
const pinsByApi = new WeakMap();
|
|
4
|
+
function pinsOf(api) {
|
|
5
|
+
let pins = pinsByApi.get(api);
|
|
6
|
+
if (!pins) {
|
|
7
|
+
pins = new Map();
|
|
8
|
+
pinsByApi.set(api, pins);
|
|
9
|
+
}
|
|
10
|
+
return pins;
|
|
11
|
+
}
|
|
12
|
+
function pinClient(api, keys, client) {
|
|
13
|
+
const pins = pinsOf(api);
|
|
14
|
+
for (const key of keys) {
|
|
15
|
+
if (!key)
|
|
16
|
+
continue;
|
|
17
|
+
pins.delete(key);
|
|
18
|
+
pins.set(key, client);
|
|
19
|
+
}
|
|
20
|
+
while (pins.size > MAX_PINS) {
|
|
21
|
+
const oldest = pins.keys().next().value;
|
|
22
|
+
if (oldest === undefined)
|
|
23
|
+
break;
|
|
24
|
+
pins.delete(oldest);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function pinnedClient(api, keys) {
|
|
28
|
+
const pins = pinsByApi.get(api);
|
|
29
|
+
if (!pins)
|
|
30
|
+
return undefined;
|
|
31
|
+
for (const key of keys) {
|
|
32
|
+
if (!key)
|
|
33
|
+
continue;
|
|
34
|
+
const client = pins.get(key);
|
|
35
|
+
if (client) {
|
|
36
|
+
pins.delete(key);
|
|
37
|
+
pins.set(key, client);
|
|
38
|
+
return client;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
43
|
+
function unpinClient(api, keys) {
|
|
44
|
+
const pins = pinsByApi.get(api);
|
|
45
|
+
if (!pins)
|
|
46
|
+
return;
|
|
47
|
+
for (const key of keys) {
|
|
48
|
+
if (key)
|
|
49
|
+
pins.delete(key);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export async function postJsonPinning(api, path, body, keysOf, opts) {
|
|
53
|
+
if (!api.postJsonWith) {
|
|
54
|
+
return api.postJson(path, body, opts);
|
|
55
|
+
}
|
|
56
|
+
const { result, client } = await api.postJsonWith(path, body, opts);
|
|
57
|
+
pinClient(api, keysOf(result), client);
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
export async function postJsonPinned(api, keys, path, body, opts) {
|
|
61
|
+
const client = pinnedClient(api, keys) ?? api;
|
|
62
|
+
try {
|
|
63
|
+
if (!client.postJsonWith) {
|
|
64
|
+
return await client.postJson(path, body, opts);
|
|
65
|
+
}
|
|
66
|
+
const served = await client.postJsonWith(path, body, opts);
|
|
67
|
+
pinClient(api, keys, served.client);
|
|
68
|
+
return served.result;
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
if (error instanceof HttpError && error.statusCode === 404) {
|
|
72
|
+
unpinClient(api, keys);
|
|
73
|
+
}
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -23,7 +23,15 @@ export class HttpClientWithFallback {
|
|
|
23
23
|
return this.withFallback((client) => client.fetchJson(path, opts));
|
|
24
24
|
}
|
|
25
25
|
async postJson(path, body, opts) {
|
|
26
|
-
return
|
|
26
|
+
return (await this.postJsonWith(path, body, opts)).result;
|
|
27
|
+
}
|
|
28
|
+
// transform runs after the fallback loop: a deterministic parse error must not re-post to the next origin
|
|
29
|
+
async postJsonWith(path, body, opts) {
|
|
30
|
+
const served = await this.withFallback(async (client) => ({
|
|
31
|
+
result: await client.postJson(path, body),
|
|
32
|
+
client,
|
|
33
|
+
}));
|
|
34
|
+
return { result: opts?.transform ? opts.transform(served.result) : served.result, client: served.client };
|
|
27
35
|
}
|
|
28
36
|
async withFallback(fn) {
|
|
29
37
|
const order = this.getClientOrder();
|
|
@@ -303,13 +303,14 @@ export function formatNumberHuman(n, showDollar = false, displayDecimals = 1) {
|
|
|
303
303
|
const isNegative = n < 0;
|
|
304
304
|
const absN = Math.abs(n);
|
|
305
305
|
const sign = showDollar ? "$\u200a" : "";
|
|
306
|
-
|
|
306
|
+
// Promote the suffix when the displayed value rounds to 1000 in the smaller unit.
|
|
307
|
+
if (Number((absN / 1000000).toFixed(displayDecimals)) >= 1000) {
|
|
307
308
|
return `${isNegative ? "-" : ""}${sign}${(absN / 1000000000).toFixed(displayDecimals)}b`;
|
|
308
309
|
}
|
|
309
|
-
if (absN >=
|
|
310
|
+
if (Number((absN / 1000).toFixed(displayDecimals)) >= 1000) {
|
|
310
311
|
return `${isNegative ? "-" : ""}${sign}${(absN / 1000000).toFixed(displayDecimals)}m`;
|
|
311
312
|
}
|
|
312
|
-
if (absN >= 1000) {
|
|
313
|
+
if (Number(absN.toFixed(displayDecimals)) >= 1000) {
|
|
313
314
|
return `${isNegative ? "-" : ""}${sign}${(absN / 1000).toFixed(displayDecimals)}k`;
|
|
314
315
|
}
|
|
315
316
|
return `${isNegative ? "-" : ""}${sign}${absN.toFixed(displayDecimals)}`;
|