@basedone/core 0.1.5 → 0.1.8

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.
@@ -10387,6 +10387,168 @@ var universe = [
10387
10387
  name: "@1343",
10388
10388
  index: 1343,
10389
10389
  isCanonical: false
10390
+ },
10391
+ {
10392
+ tokens: [
10393
+ 1458,
10394
+ 0
10395
+ ],
10396
+ name: "@1344",
10397
+ index: 1344,
10398
+ isCanonical: false
10399
+ },
10400
+ {
10401
+ tokens: [
10402
+ 1463,
10403
+ 0
10404
+ ],
10405
+ name: "@1345",
10406
+ index: 1345,
10407
+ isCanonical: false
10408
+ },
10409
+ {
10410
+ tokens: [
10411
+ 1464,
10412
+ 0
10413
+ ],
10414
+ name: "@1346",
10415
+ index: 1346,
10416
+ isCanonical: false
10417
+ },
10418
+ {
10419
+ tokens: [
10420
+ 1442,
10421
+ 0
10422
+ ],
10423
+ name: "@1348",
10424
+ index: 1348,
10425
+ isCanonical: false
10426
+ },
10427
+ {
10428
+ tokens: [
10429
+ 1462,
10430
+ 0
10431
+ ],
10432
+ name: "@1349",
10433
+ index: 1349,
10434
+ isCanonical: false
10435
+ },
10436
+ {
10437
+ tokens: [
10438
+ 1467,
10439
+ 0
10440
+ ],
10441
+ name: "@1350",
10442
+ index: 1350,
10443
+ isCanonical: false
10444
+ },
10445
+ {
10446
+ tokens: [
10447
+ 1468,
10448
+ 0
10449
+ ],
10450
+ name: "@1351",
10451
+ index: 1351,
10452
+ isCanonical: false
10453
+ },
10454
+ {
10455
+ tokens: [
10456
+ 1461,
10457
+ 0
10458
+ ],
10459
+ name: "@1352",
10460
+ index: 1352,
10461
+ isCanonical: false
10462
+ },
10463
+ {
10464
+ tokens: [
10465
+ 1470,
10466
+ 1452
10467
+ ],
10468
+ name: "@1354",
10469
+ index: 1354,
10470
+ isCanonical: false
10471
+ },
10472
+ {
10473
+ tokens: [
10474
+ 1474,
10475
+ 0
10476
+ ],
10477
+ name: "@1357",
10478
+ index: 1357,
10479
+ isCanonical: false
10480
+ },
10481
+ {
10482
+ tokens: [
10483
+ 1465,
10484
+ 0
10485
+ ],
10486
+ name: "@1358",
10487
+ index: 1358,
10488
+ isCanonical: false
10489
+ },
10490
+ {
10491
+ tokens: [
10492
+ 1475,
10493
+ 0
10494
+ ],
10495
+ name: "@1359",
10496
+ index: 1359,
10497
+ isCanonical: false
10498
+ },
10499
+ {
10500
+ tokens: [
10501
+ 1105,
10502
+ 1475
10503
+ ],
10504
+ name: "@1360",
10505
+ index: 1360,
10506
+ isCanonical: false
10507
+ },
10508
+ {
10509
+ tokens: [
10510
+ 1476,
10511
+ 0
10512
+ ],
10513
+ name: "@1361",
10514
+ index: 1361,
10515
+ isCanonical: false
10516
+ },
10517
+ {
10518
+ tokens: [
10519
+ 1456,
10520
+ 0
10521
+ ],
10522
+ name: "@1362",
10523
+ index: 1362,
10524
+ isCanonical: false
10525
+ },
10526
+ {
10527
+ tokens: [
10528
+ 1478,
10529
+ 1452
10530
+ ],
10531
+ name: "@1363",
10532
+ index: 1363,
10533
+ isCanonical: false
10534
+ },
10535
+ {
10536
+ tokens: [
10537
+ 1482,
10538
+ 1452
10539
+ ],
10540
+ name: "@1365",
10541
+ index: 1365,
10542
+ isCanonical: false
10543
+ },
10544
+ {
10545
+ tokens: [
10546
+ 1480,
10547
+ 0
10548
+ ],
10549
+ name: "@1366",
10550
+ index: 1366,
10551
+ isCanonical: false
10390
10552
  }
10391
10553
  ];
10392
10554
  var tokens = [
@@ -26583,7 +26745,10 @@ aa aaa\\aaaaaa"aaaa'aaaaa{}`,
26583
26745
  index: 1441,
26584
26746
  tokenId: "0x7015af4219a36cc0c269b5fe83c95429",
26585
26747
  isCanonical: false,
26586
- evmContract: null,
26748
+ evmContract: {
26749
+ address: "0xe5d86e15b4dcd8bfe1d8f02bcb8a74abd7b50fa5",
26750
+ evm_extra_wei_decimals: 10
26751
+ },
26587
26752
  fullName: null,
26588
26753
  deployerTradingFeeShare: "1.0"
26589
26754
  },
@@ -26594,7 +26759,10 @@ aa aaa\\aaaaaa"aaaa'aaaaa{}`,
26594
26759
  index: 1442,
26595
26760
  tokenId: "0x80fcf59b90b99e2ce9ad59c3f95d4b10",
26596
26761
  isCanonical: false,
26597
- evmContract: null,
26762
+ evmContract: {
26763
+ address: "0x63d9f645f0db956f7209dddfee1bbdef67120689",
26764
+ evm_extra_wei_decimals: 4
26765
+ },
26598
26766
  fullName: "Tanssi",
26599
26767
  deployerTradingFeeShare: "0.99"
26600
26768
  },
@@ -26769,7 +26937,10 @@ aa aaa\\aaaaaa"aaaa'aaaaa{}`,
26769
26937
  index: 1456,
26770
26938
  tokenId: "0x9739c25f3a7cec4260360d6c9f14d654",
26771
26939
  isCanonical: false,
26772
- evmContract: null,
26940
+ evmContract: {
26941
+ address: "0xed9fb2b320cc3050f94ba2cd47a3cd8c5af48e69",
26942
+ evm_extra_wei_decimals: 10
26943
+ },
26773
26944
  fullName: "Grilled Cheese",
26774
26945
  deployerTradingFeeShare: "1.0"
26775
26946
  },
@@ -26794,6 +26965,383 @@ aa aaa\\aaaaaa"aaaa'aaaaa{}`,
26794
26965
  evmContract: null,
26795
26966
  fullName: "LMYY",
26796
26967
  deployerTradingFeeShare: "1.0"
26968
+ },
26969
+ {
26970
+ name: "NOAZN",
26971
+ szDecimals: 2,
26972
+ weiDecimals: 8,
26973
+ index: 1459,
26974
+ tokenId: "0xf19d746122233d38caa0f697b5eb101a",
26975
+ isCanonical: false,
26976
+ evmContract: null,
26977
+ fullName: "EAazdazza",
26978
+ deployerTradingFeeShare: "1.0"
26979
+ },
26980
+ {
26981
+ name: "HARMON",
26982
+ szDecimals: 2,
26983
+ weiDecimals: 8,
26984
+ index: 1460,
26985
+ tokenId: "0x98ad7041dc0fded11d4b1b438d921e6a",
26986
+ isCanonical: false,
26987
+ evmContract: null,
26988
+ fullName: null,
26989
+ deployerTradingFeeShare: "1.0"
26990
+ },
26991
+ {
26992
+ name: "XDC",
26993
+ szDecimals: 2,
26994
+ weiDecimals: 8,
26995
+ index: 1461,
26996
+ tokenId: "0x603b85b92159da52c5ec264c3b575e0f",
26997
+ isCanonical: false,
26998
+ evmContract: null,
26999
+ fullName: null,
27000
+ deployerTradingFeeShare: "0.1"
27001
+ },
27002
+ {
27003
+ name: "BZEC",
27004
+ szDecimals: 2,
27005
+ weiDecimals: 8,
27006
+ index: 1462,
27007
+ tokenId: "0x0900e7a24e6cf2ad47b84d35b46595cb",
27008
+ isCanonical: false,
27009
+ evmContract: {
27010
+ address: "0x5b755872103fe90b43e31adc753f0ddd06796805",
27011
+ evm_extra_wei_decimals: 10
27012
+ },
27013
+ fullName: null,
27014
+ deployerTradingFeeShare: "1.0"
27015
+ },
27016
+ {
27017
+ name: "PHAT",
27018
+ szDecimals: 2,
27019
+ weiDecimals: 9,
27020
+ index: 1463,
27021
+ tokenId: "0x3f6f99c13d59b7be581c5031020dbe2e",
27022
+ isCanonical: false,
27023
+ evmContract: null,
27024
+ fullName: "PHAT CAT",
27025
+ deployerTradingFeeShare: "0.0"
27026
+ },
27027
+ {
27028
+ name: "SAM",
27029
+ szDecimals: 2,
27030
+ weiDecimals: 9,
27031
+ index: 1464,
27032
+ tokenId: "0x0d57f359848f7607fdca7ac501bee796",
27033
+ isCanonical: false,
27034
+ evmContract: null,
27035
+ fullName: "Small Autonomous Motherfucker",
27036
+ deployerTradingFeeShare: "0.0"
27037
+ },
27038
+ {
27039
+ name: "HARR",
27040
+ szDecimals: 2,
27041
+ weiDecimals: 8,
27042
+ index: 1465,
27043
+ tokenId: "0xcad0cd8014cedb62424e8a639be45f41",
27044
+ isCanonical: false,
27045
+ evmContract: null,
27046
+ fullName: null,
27047
+ deployerTradingFeeShare: "1.0"
27048
+ },
27049
+ {
27050
+ name: "APEXHL",
27051
+ szDecimals: 2,
27052
+ weiDecimals: 8,
27053
+ index: 1466,
27054
+ tokenId: "0x57affe03885cb0f93eb870df5ac2fccb",
27055
+ isCanonical: false,
27056
+ evmContract: null,
27057
+ fullName: null,
27058
+ deployerTradingFeeShare: "1.0"
27059
+ },
27060
+ {
27061
+ name: "HYBR",
27062
+ szDecimals: 2,
27063
+ weiDecimals: 8,
27064
+ index: 1467,
27065
+ tokenId: "0xf7161131865b78abf5a755e44a9a03f5",
27066
+ isCanonical: false,
27067
+ evmContract: {
27068
+ address: "0xc391834f5090e1094058e332d6c635dc64ca674d",
27069
+ evm_extra_wei_decimals: 10
27070
+ },
27071
+ fullName: "HYBRA",
27072
+ deployerTradingFeeShare: "0.5"
27073
+ },
27074
+ {
27075
+ name: "MORPP",
27076
+ szDecimals: 2,
27077
+ weiDecimals: 8,
27078
+ index: 1468,
27079
+ tokenId: "0xa2617c57227af37fd8f3576ca297c603",
27080
+ isCanonical: false,
27081
+ evmContract: {
27082
+ address: "0xa8ae249dd28709bd25dfc2d886479c1c1a8cf605",
27083
+ evm_extra_wei_decimals: 10
27084
+ },
27085
+ fullName: "Morpho test1",
27086
+ deployerTradingFeeShare: "1.0"
27087
+ },
27088
+ {
27089
+ name: "HARMOX",
27090
+ szDecimals: 2,
27091
+ weiDecimals: 8,
27092
+ index: 1469,
27093
+ tokenId: "0x8e670650571a3ce604ece184eaaf01c0",
27094
+ isCanonical: false,
27095
+ evmContract: null,
27096
+ fullName: null,
27097
+ deployerTradingFeeShare: "1.0"
27098
+ },
27099
+ {
27100
+ name: "STEST",
27101
+ szDecimals: 2,
27102
+ weiDecimals: 8,
27103
+ index: 1470,
27104
+ tokenId: "0xe383b8a1294f88771f2a1793ace35c85",
27105
+ isCanonical: false,
27106
+ evmContract: {
27107
+ address: "0x96ed91fa046387dfff8b942a8c14f5fbde4a161a",
27108
+ evm_extra_wei_decimals: 10
27109
+ },
27110
+ fullName: "TESTSPOT",
27111
+ deployerTradingFeeShare: "1.0"
27112
+ },
27113
+ {
27114
+ name: "USDCC",
27115
+ szDecimals: 2,
27116
+ weiDecimals: 8,
27117
+ index: 1471,
27118
+ tokenId: "0x37371b1c6d6870233e8400c223fc0b1e",
27119
+ isCanonical: false,
27120
+ evmContract: null,
27121
+ fullName: "USDC Coin",
27122
+ deployerTradingFeeShare: "1.0"
27123
+ },
27124
+ {
27125
+ name: "MMOVE",
27126
+ szDecimals: 2,
27127
+ weiDecimals: 8,
27128
+ index: 1472,
27129
+ tokenId: "0x5425d5e77e0119faac1543210688e83b",
27130
+ isCanonical: false,
27131
+ evmContract: {
27132
+ address: "0x431a8f39106dc468dff6ae772c8f121a0443bfa0",
27133
+ evm_extra_wei_decimals: 0
27134
+ },
27135
+ fullName: null,
27136
+ deployerTradingFeeShare: "0.0"
27137
+ },
27138
+ {
27139
+ name: "HYBRA",
27140
+ szDecimals: 2,
27141
+ weiDecimals: 8,
27142
+ index: 1473,
27143
+ tokenId: "0x88461aa7919ce13efef0790fb2b68bc0",
27144
+ isCanonical: false,
27145
+ evmContract: null,
27146
+ fullName: null,
27147
+ deployerTradingFeeShare: "1.0"
27148
+ },
27149
+ {
27150
+ name: "UUENA",
27151
+ szDecimals: 1,
27152
+ weiDecimals: 6,
27153
+ index: 1474,
27154
+ tokenId: "0x8580a30d748007793bae9c6b539c04f7",
27155
+ isCanonical: false,
27156
+ evmContract: {
27157
+ address: "0xf5d30ad8d2daa292604ab944f2ae34fc77bf3398",
27158
+ evm_extra_wei_decimals: 12
27159
+ },
27160
+ fullName: "Unit Ethena",
27161
+ deployerTradingFeeShare: "1.0"
27162
+ },
27163
+ {
27164
+ name: "USDL",
27165
+ szDecimals: 2,
27166
+ weiDecimals: 8,
27167
+ index: 1475,
27168
+ tokenId: "0x326f3a7591cd868512cbf7328212f958",
27169
+ isCanonical: false,
27170
+ evmContract: {
27171
+ address: "0x9a9b73de940674a54dfde5a16325de4424d291af",
27172
+ evm_extra_wei_decimals: -2
27173
+ },
27174
+ fullName: "USDL",
27175
+ deployerTradingFeeShare: "0.0"
27176
+ },
27177
+ {
27178
+ name: "LMA",
27179
+ szDecimals: 2,
27180
+ weiDecimals: 8,
27181
+ index: 1476,
27182
+ tokenId: "0xe9c1bb711a09afb08cd92881faf8badc",
27183
+ isCanonical: false,
27184
+ evmContract: {
27185
+ address: "0x051ac5bfb8e904229acf5d4ce97a2f2aee660e34",
27186
+ evm_extra_wei_decimals: 10
27187
+ },
27188
+ fullName: "LMA",
27189
+ deployerTradingFeeShare: "1.0"
27190
+ },
27191
+ {
27192
+ name: "ASDFS",
27193
+ szDecimals: 2,
27194
+ weiDecimals: 8,
27195
+ index: 1477,
27196
+ tokenId: "0xd0118b629315803111315c0bf03d1869",
27197
+ isCanonical: false,
27198
+ evmContract: {
27199
+ address: "0x4b0d60b5cb0cd733cdd3090fcc8652f3760c7e51",
27200
+ evm_extra_wei_decimals: 10
27201
+ },
27202
+ fullName: "ASDFSDAS",
27203
+ deployerTradingFeeShare: "1.0"
27204
+ },
27205
+ {
27206
+ name: "SLOP",
27207
+ szDecimals: 2,
27208
+ weiDecimals: 8,
27209
+ index: 1478,
27210
+ tokenId: "0xae9fbd688f95b2c9591c89323a587101",
27211
+ isCanonical: false,
27212
+ evmContract: {
27213
+ address: "0xd17ea84b3cebd526aec68368f8154562b23fab14",
27214
+ evm_extra_wei_decimals: 10
27215
+ },
27216
+ fullName: "Test token example",
27217
+ deployerTradingFeeShare: "1.0"
27218
+ },
27219
+ {
27220
+ name: "XTESTA",
27221
+ szDecimals: 2,
27222
+ weiDecimals: 8,
27223
+ index: 1479,
27224
+ tokenId: "0xc994655c02334d84e9cd9d90f8747e1b",
27225
+ isCanonical: false,
27226
+ evmContract: null,
27227
+ fullName: "xxtestxx",
27228
+ deployerTradingFeeShare: "1.0"
27229
+ },
27230
+ {
27231
+ name: "XCHAIN",
27232
+ szDecimals: 2,
27233
+ weiDecimals: 8,
27234
+ index: 1480,
27235
+ tokenId: "0xd26781a908df70a3300ffe6453200731",
27236
+ isCanonical: false,
27237
+ evmContract: {
27238
+ address: "0xa53ea64280dc4e9472f245952e055c7e89de13ef",
27239
+ evm_extra_wei_decimals: -2
27240
+ },
27241
+ fullName: "Cross Chain Test",
27242
+ deployerTradingFeeShare: "1.0"
27243
+ },
27244
+ {
27245
+ name: "DANCE",
27246
+ szDecimals: 2,
27247
+ weiDecimals: 8,
27248
+ index: 1481,
27249
+ tokenId: "0x21a4632b44112fe0593fccbe5400a701",
27250
+ isCanonical: false,
27251
+ evmContract: null,
27252
+ fullName: null,
27253
+ deployerTradingFeeShare: "1.0"
27254
+ },
27255
+ {
27256
+ name: "AXLT",
27257
+ szDecimals: 2,
27258
+ weiDecimals: 8,
27259
+ index: 1482,
27260
+ tokenId: "0x8528c5d57c982d214341e05fd5274fa8",
27261
+ isCanonical: false,
27262
+ evmContract: {
27263
+ address: "0xb832407d3f8b10cd6f94172a9820d6f065b66ad1",
27264
+ evm_extra_wei_decimals: -2
27265
+ },
27266
+ fullName: "Axelar",
27267
+ deployerTradingFeeShare: "1.0"
27268
+ },
27269
+ {
27270
+ name: "HARRR",
27271
+ szDecimals: 2,
27272
+ weiDecimals: 8,
27273
+ index: 1483,
27274
+ tokenId: "0xdba2779d37628efc3967b98adf04172d",
27275
+ isCanonical: false,
27276
+ evmContract: null,
27277
+ fullName: null,
27278
+ deployerTradingFeeShare: "1.0"
27279
+ },
27280
+ {
27281
+ name: "MORPH",
27282
+ szDecimals: 2,
27283
+ weiDecimals: 8,
27284
+ index: 1484,
27285
+ tokenId: "0x57df584e21097424d758b228e842d2ef",
27286
+ isCanonical: false,
27287
+ evmContract: null,
27288
+ fullName: null,
27289
+ deployerTradingFeeShare: "1.0"
27290
+ },
27291
+ {
27292
+ name: "STABLE",
27293
+ szDecimals: 2,
27294
+ weiDecimals: 8,
27295
+ index: 1485,
27296
+ tokenId: "0x797f444bb03c7be19234b94ca29f3410",
27297
+ isCanonical: false,
27298
+ evmContract: null,
27299
+ fullName: "STABLE",
27300
+ deployerTradingFeeShare: "1.0"
27301
+ },
27302
+ {
27303
+ name: "XYZT",
27304
+ szDecimals: 2,
27305
+ weiDecimals: 8,
27306
+ index: 1486,
27307
+ tokenId: "0x56e59167b6e370bc5dab11da80ed8ed2",
27308
+ isCanonical: false,
27309
+ evmContract: null,
27310
+ fullName: "XYZT",
27311
+ deployerTradingFeeShare: "1.0"
27312
+ },
27313
+ {
27314
+ name: "MNRCH",
27315
+ szDecimals: 2,
27316
+ weiDecimals: 8,
27317
+ index: 1487,
27318
+ tokenId: "0xd55b27dcaed90223bfc3c378b98526bb",
27319
+ isCanonical: false,
27320
+ evmContract: null,
27321
+ fullName: "MONARCH TEST 1",
27322
+ deployerTradingFeeShare: "1.0"
27323
+ },
27324
+ {
27325
+ name: "USDXX",
27326
+ szDecimals: 2,
27327
+ weiDecimals: 8,
27328
+ index: 1488,
27329
+ tokenId: "0xca9fd54c63d925b455d6440c02ed29c5",
27330
+ isCanonical: false,
27331
+ evmContract: null,
27332
+ fullName: "USDXX",
27333
+ deployerTradingFeeShare: "1.0"
27334
+ },
27335
+ {
27336
+ name: "BETA",
27337
+ szDecimals: 2,
27338
+ weiDecimals: 8,
27339
+ index: 1489,
27340
+ tokenId: "0x398e2bab402c7f3c9e214d3862d02ada",
27341
+ isCanonical: false,
27342
+ evmContract: null,
27343
+ fullName: "They HYPE beta",
27344
+ deployerTradingFeeShare: "1.0"
26797
27345
  }
26798
27346
  ];
26799
27347
  var spotMeta_default = {
package/lib/fee.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  // Global limits on Hyperliquid
2
2
 
3
+ import Decimal from "decimal.js";
3
4
  import { BASED_FEE_WALLET, BASED_REFERRAL_CODE } from "./constants/fee";
4
5
 
5
6
  // builder fee in 1/10 of a basis point
@@ -16,6 +17,7 @@ export const TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT = `0.1%`;
16
17
  * Get the amount of builder fee to approve for
17
18
  * @param perpetualTradingFee - Perp fee in percentage
18
19
  * @param spotTradingFee - Spot fee in percentage
20
+ * @param feeDiscount - Discount fee in percentage (0.9 means 90% discount)
19
21
  * @returns {
20
22
  * amount: number; - The amount of builder fee to approve in 1/10 of a basis point
21
23
  * percent: string; - eg. String input to approve fee, "0.1%"
@@ -25,10 +27,12 @@ export const getApprovalAmount = ({
25
27
  customFeeEnabled,
26
28
  perpetualTradingFee,
27
29
  spotTradingFee,
30
+ feeDiscount,
28
31
  }: {
29
32
  customFeeEnabled: boolean;
30
33
  perpetualTradingFee?: number;
31
34
  spotTradingFee?: number;
35
+ feeDiscount?: number;
32
36
  }): {
33
37
  approvalAmount: number;
34
38
  approvalPercent: `${string}%`;
@@ -37,20 +41,39 @@ export const getApprovalAmount = ({
37
41
  builder: `0x${string}`;
38
42
  referralCode: string;
39
43
  } => {
44
+ if (feeDiscount !== undefined && (feeDiscount < 0 || feeDiscount > 1)) {
45
+ console.warn("Fee discount is not between 0 and 1, setting to 0");
46
+ feeDiscount = 0;
47
+ }
48
+
49
+ const discountMultiplier = feeDiscount ? new Decimal(1).sub(feeDiscount) : 1;
40
50
  if (!customFeeEnabled) {
41
51
  return {
42
- approvalAmount: TARGET_APPROVED_MAX_BUILDER_FEE,
43
- perpFee: TARGET_FUTURES_BUILDER_FEE,
44
- spotFee: TARGET_SPOT_BUILDER_FEE,
52
+ approvalAmount: new Decimal(TARGET_APPROVED_MAX_BUILDER_FEE)
53
+ .mul(discountMultiplier)
54
+ .floor()
55
+ .toNumber(),
56
+ perpFee: new Decimal(TARGET_FUTURES_BUILDER_FEE)
57
+ .mul(discountMultiplier)
58
+ .floor()
59
+ .toNumber(),
60
+ spotFee: new Decimal(TARGET_SPOT_BUILDER_FEE)
61
+ .mul(discountMultiplier)
62
+ .floor()
63
+ .toNumber(),
45
64
  approvalPercent: TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT,
46
65
  builder: BASED_FEE_WALLET,
47
66
  referralCode: BASED_REFERRAL_CODE,
48
67
  };
49
68
  }
69
+
50
70
  let validatedPerpFeePct = perpetualTradingFee;
51
71
  if (validatedPerpFeePct === undefined) {
52
72
  validatedPerpFeePct = TARGET_FUTURES_BUILDER_FEE / 1000;
53
73
  }
74
+ validatedPerpFeePct = new Decimal(validatedPerpFeePct)
75
+ .mul(discountMultiplier)
76
+ .toNumber();
54
77
 
55
78
  // ensure perp fee is either 0 or between 0.01% and 0.1%
56
79
  if (validatedPerpFeePct > 0 && validatedPerpFeePct < 0.01) {
@@ -71,6 +94,10 @@ export const getApprovalAmount = ({
71
94
  if (validatedSpotFeePct === undefined) {
72
95
  validatedSpotFeePct = TARGET_SPOT_BUILDER_FEE / 1000;
73
96
  }
97
+ validatedSpotFeePct = new Decimal(validatedSpotFeePct)
98
+ .mul(discountMultiplier)
99
+ .toNumber();
100
+
74
101
  if (validatedSpotFeePct > 0 && validatedSpotFeePct < 0.025) {
75
102
  console.warn("Spot fee is less than 0.025%, setting to 0.025%");
76
103
  validatedSpotFeePct = 0.025;
@@ -1,25 +1,17 @@
1
- // static HIP-3 market info
1
+ import { PerpsMeta, InfoClient } from "@nktkas/hyperliquid";
2
2
 
3
- import { SpotToken, PerpDex } from "@nktkas/hyperliquid";
4
- import { TESTNET_USDC_SPOT_TOKEN, USDC_SPOT_TOKEN } from "../constants/tokens";
5
-
6
- // currently /info type: perpDexs doesn't include collateral token
7
- interface HIP3DexInfo extends PerpDex {
8
- collateralToken: SpotToken;
9
- }
10
-
11
- export const HIP3_DEX_INFO: Record<string, HIP3DexInfo> = {};
12
-
13
- const TESTNET_DEX_INFO: Record<string, HIP3DexInfo> = {
14
- vtnls: {
15
- collateralToken: TESTNET_USDC_SPOT_TOKEN,
16
- name: "vntls",
17
- full_name: "Ventuals",
18
- deployer: "0xc65008a70f511ae0407d26022ff1516422acea94",
19
- oracle_updater: null,
20
- },
3
+ export type PerpsMetaWithCollateralToken = PerpsMeta & {
4
+ collateralToken?: number; // spot token index
21
5
  };
22
6
 
23
- function getHIP3DexInfo(dex: string, isTestnet: boolean) {
24
- return isTestnet ? TESTNET_DEX_INFO[dex] : HIP3_DEX_INFO[dex];
7
+ export type AllPerpsMeta = PerpsMetaWithCollateralToken[];
8
+
9
+ export async function getAllPerpsMeta(
10
+ infoClient: InfoClient,
11
+ ): Promise<AllPerpsMeta> {
12
+ return infoClient.transport.request<AllPerpsMeta>("info", {
13
+ action: {
14
+ type: "allPerpMetas",
15
+ },
16
+ });
25
17
  }