@myx-trade/sdk 0.1.267-beta.8 → 0.1.267-beta.80

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/index.d.mts CHANGED
@@ -82,12 +82,16 @@ declare const getPoolInfo$1: (chainId: ChainId, poolId: string, marketPrice?: bi
82
82
  exchangeRate: bigint;
83
83
  poolTokenPrice: bigint;
84
84
  poolTokenSupply: bigint;
85
+ totalDebt: bigint;
86
+ baseCollateral: bigint;
85
87
  };
86
88
  basePool: {
87
89
  poolToken: string;
88
90
  exchangeRate: bigint;
89
91
  poolTokenPrice: bigint;
90
92
  poolTokenSupply: bigint;
93
+ totalDebt: bigint;
94
+ baseCollateral: bigint;
91
95
  };
92
96
  reserveInfo: {
93
97
  baseTotalAmount: bigint;
@@ -106,6 +110,10 @@ declare const getPoolInfo$1: (chainId: ChainId, poolId: string, marketPrice?: bi
106
110
  shortSize: bigint;
107
111
  poolEntryPrice: bigint;
108
112
  };
113
+ liquidityInfo: {
114
+ windowCaps: bigint;
115
+ openInterest: bigint;
116
+ };
109
117
  }>;
110
118
 
111
119
  declare const getUserGenesisShare: (chainId: ChainId, tokenAddress: string, account: string) => Promise<bigint>;
@@ -225,6 +233,7 @@ interface PositionTpSlOrderParams {
225
233
  tpPrice?: string;
226
234
  slSize?: string;
227
235
  slPrice?: string;
236
+ slippagePct: string;
228
237
  }
229
238
  interface TradingResult {
230
239
  success: boolean;
@@ -293,10 +302,10 @@ interface AccessTokenResponse$1 extends BaseResponse {
293
302
  data: AccessTokenType;
294
303
  }
295
304
  declare enum MarketPoolState {
296
- Cook = 0,// 市场建立
297
- Primed = 1,// 扣款手续费,等待准备oracle
298
- Trench = 2,// 上架交易
299
- PreBench = 3,// 预下架
305
+ Cook = 0,// Market created
306
+ Primed = 1,// Fee deducted, waiting for oracle to be ready
307
+ Trench = 2,// Trading enabled
308
+ PreBench = 3,// Pre-delisting
300
309
  Bench = 4
301
310
  }
302
311
  type MarketPool = {
@@ -617,7 +626,8 @@ declare enum DirectionEnum {
617
626
  declare enum OrderStatusEnum {
618
627
  Cancelled = 1,
619
628
  Expired = 2,
620
- Successful = 9
629
+ Successful = 9,
630
+ PartialFilled = 8
621
631
  }
622
632
  declare enum ExecTypeEnum {
623
633
  Market = 1,// market order
@@ -921,9 +931,17 @@ declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<ethe
921
931
 
922
932
  declare const deposit$1: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
923
933
 
934
+ declare const withdrawableLpAmount$1: (params: {
935
+ chainId: ChainId;
936
+ poolId: string;
937
+ price?: bigint;
938
+ }) => Promise<bigint>;
924
939
  declare const withdraw$1: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
925
940
 
926
- declare const getRewards$1: (params: RewardsParams) => Promise<bigint | undefined>;
941
+ declare const getRewards$1: (params: RewardsParams) => Promise<{
942
+ rebates: bigint;
943
+ genesisRebates: bigint;
944
+ } | undefined>;
927
945
 
928
946
  declare const previewUserWithdrawData: ({ chainId, account, poolId, amount }: PreviewWithdrawDataParams) => Promise<{
929
947
  baseAmountOut: bigint;
@@ -936,11 +954,16 @@ declare const index$2_claimBasePoolRebate: typeof claimBasePoolRebate;
936
954
  declare const index$2_claimBasePoolRebates: typeof claimBasePoolRebates;
937
955
  declare const index$2_previewUserWithdrawData: typeof previewUserWithdrawData;
938
956
  declare namespace index$2 {
939
- export { index$2_claimBasePoolRebate as claimBasePoolRebate, index$2_claimBasePoolRebates as claimBasePoolRebates, deposit$1 as deposit, getLpPrice$1 as getLpPrice, getRewards$1 as getRewards, index$2_previewUserWithdrawData as previewUserWithdrawData, withdraw$1 as withdraw };
957
+ export { index$2_claimBasePoolRebate as claimBasePoolRebate, index$2_claimBasePoolRebates as claimBasePoolRebates, deposit$1 as deposit, getLpPrice$1 as getLpPrice, getRewards$1 as getRewards, index$2_previewUserWithdrawData as previewUserWithdrawData, withdraw$1 as withdraw, withdrawableLpAmount$1 as withdrawableLpAmount };
940
958
  }
941
959
 
942
960
  declare const deposit: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
943
961
 
962
+ declare const withdrawableLpAmount: (params: {
963
+ chainId: ChainId;
964
+ poolId: string;
965
+ price?: bigint;
966
+ }) => Promise<bigint>;
944
967
  declare const withdraw: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
945
968
 
946
969
  declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<ethers.ContractTransactionResponse | null>;
@@ -959,16 +982,16 @@ declare const index$1_getLpPrice: typeof getLpPrice;
959
982
  declare const index$1_getRewards: typeof getRewards;
960
983
  declare const index$1_transfer: typeof transfer;
961
984
  declare const index$1_withdraw: typeof withdraw;
985
+ declare const index$1_withdrawableLpAmount: typeof withdrawableLpAmount;
962
986
  declare namespace index$1 {
963
- export { index$1_claimQuotePoolRebate as claimQuotePoolRebate, index$1_claimQuotePoolRebates as claimQuotePoolRebates, index$1_deposit as deposit, index$1_getLpPrice as getLpPrice, index$1_getRewards as getRewards, index$1_transfer as transfer, index$1_withdraw as withdraw };
987
+ export { index$1_claimQuotePoolRebate as claimQuotePoolRebate, index$1_claimQuotePoolRebates as claimQuotePoolRebates, index$1_deposit as deposit, index$1_getLpPrice as getLpPrice, index$1_getRewards as getRewards, index$1_transfer as transfer, index$1_withdraw as withdraw, index$1_withdrawableLpAmount as withdrawableLpAmount };
964
988
  }
965
989
 
966
- declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] & {
990
+ declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] & {
967
991
  quoteToken: string;
968
992
  baseReserveRatio: bigint;
969
993
  quoteReserveRatio: bigint;
970
994
  oracleFeeUsd: bigint;
971
- oracleRefundFeeUsd: bigint;
972
995
  poolPrimeThreshold: bigint;
973
996
  executionFee: bigint;
974
997
  maxExecutionFee: bigint;
@@ -1220,7 +1243,7 @@ interface AccessTokenResponse {
1220
1243
  }
1221
1244
  interface MyxClientConfig {
1222
1245
  /**
1223
- * @deprecated 为了更灵活的执行操作应该在具体方法中由外部传入chainId,这个字段将在未来版本中废弃
1246
+ * @deprecated Pass chainId from outside in each method for flexibility; this field will be removed in a future version
1224
1247
  */
1225
1248
  chainId: number;
1226
1249
  signer?: Signer;
@@ -1255,29 +1278,34 @@ declare class ConfigManager {
1255
1278
  auth(params: Pick<MyxClientConfig, "signer" | "getAccessToken">): void;
1256
1279
  private validateConfig;
1257
1280
  /**
1258
- * 获取有效的 accessToken,自动处理获取和刷新
1259
- * @param forceRefresh 是否强制刷新
1260
- * @returns Promise<string | null> 有效的 accessToken 或 null
1281
+ * Get currently stored accessToken (does not auto-refresh)
1282
+ * @returns Promise<string | null> Current accessToken or null
1283
+ */
1284
+ getAccessToken(): Promise<string | null>;
1285
+ /**
1286
+ * Manually refresh accessToken (must be called explicitly by the client)
1287
+ * @param forceRefresh Whether to force refresh
1288
+ * @returns Promise<string | null> Refreshed accessToken or null
1261
1289
  */
1262
1290
  private _getAccessTokenQueue;
1263
1291
  private _isGettingAccessToken;
1264
- getAccessToken(forceRefresh?: boolean): Promise<string | null>;
1292
+ refreshAccessToken(forceRefresh?: boolean): Promise<string | null>;
1265
1293
  private _processAccessTokenQueue;
1266
- private _getAccessToken;
1294
+ private _refreshAccessToken;
1267
1295
  /**
1268
- * 设置 accessToken 和过期时间
1296
+ * Set accessToken and expiry
1269
1297
  * @param token accessToken
1270
- * @param expiryInSeconds token 有效期(秒),默认1小时
1298
+ * @param expiryInSeconds Token validity in seconds, default 1 hour
1271
1299
  */
1272
1300
  setAccessToken(token: string, expiryInSeconds?: number): void;
1273
1301
  /**
1274
- * 获取当前存储的 accessToken(不会触发刷新)
1275
- * @returns string | undefined 当前的 accessToken
1302
+ * Get currently stored accessToken (does not trigger refresh)
1303
+ * @returns string | undefined Current accessToken
1276
1304
  */
1277
1305
  getCurrentAccessToken(): string | undefined;
1278
1306
  isAccessTokenValid(): boolean;
1279
1307
  /**
1280
- * 清除 accessToken
1308
+ * Clear accessToken
1281
1309
  */
1282
1310
  clearAccessToken(): void;
1283
1311
  getConfig(): MyxClientConfig;
@@ -1405,7 +1433,6 @@ declare class Utils {
1405
1433
  }>;
1406
1434
  buildUpdatePriceParams(poolId: string, chainId: number): Promise<{
1407
1435
  poolId: string;
1408
- referencePrice: bigint;
1409
1436
  oracleUpdateData: string;
1410
1437
  publishTime: number;
1411
1438
  oracleType: OracleType;
@@ -1421,16 +1448,20 @@ declare class Utils {
1421
1448
  marketPrice: string;
1422
1449
  }): Promise<{
1423
1450
  code: number;
1424
- data: [[string, bigint, bigint, bigint] & {
1451
+ data: [[string, bigint, bigint, bigint, bigint, bigint] & {
1425
1452
  poolToken: string;
1426
1453
  exchangeRate: bigint;
1427
1454
  poolTokenPrice: bigint;
1428
1455
  poolTokenSupply: bigint;
1429
- }, [string, bigint, bigint, bigint] & {
1456
+ totalDebt: bigint;
1457
+ baseCollateral: bigint;
1458
+ }, [string, bigint, bigint, bigint, bigint, bigint] & {
1430
1459
  poolToken: string;
1431
1460
  exchangeRate: bigint;
1432
1461
  poolTokenPrice: bigint;
1433
1462
  poolTokenSupply: bigint;
1463
+ totalDebt: bigint;
1464
+ baseCollateral: bigint;
1434
1465
  }, [bigint, bigint, bigint, bigint] & {
1435
1466
  baseTotalAmount: bigint;
1436
1467
  baseReservedAmount: bigint;
@@ -1449,17 +1480,21 @@ declare class Utils {
1449
1480
  windowCaps: bigint;
1450
1481
  openInterest: bigint;
1451
1482
  }] & {
1452
- basePool: [string, bigint, bigint, bigint] & {
1483
+ basePool: [string, bigint, bigint, bigint, bigint, bigint] & {
1453
1484
  poolToken: string;
1454
1485
  exchangeRate: bigint;
1455
1486
  poolTokenPrice: bigint;
1456
1487
  poolTokenSupply: bigint;
1488
+ totalDebt: bigint;
1489
+ baseCollateral: bigint;
1457
1490
  };
1458
- quotePool: [string, bigint, bigint, bigint] & {
1491
+ quotePool: [string, bigint, bigint, bigint, bigint, bigint] & {
1459
1492
  poolToken: string;
1460
1493
  exchangeRate: bigint;
1461
1494
  poolTokenPrice: bigint;
1462
1495
  poolTokenSupply: bigint;
1496
+ totalDebt: bigint;
1497
+ baseCollateral: bigint;
1463
1498
  };
1464
1499
  reserveInfo: [bigint, bigint, bigint, bigint] & {
1465
1500
  baseTotalAmount: bigint;
@@ -1512,7 +1547,9 @@ declare enum AppealReconsiderationType {
1512
1547
  Failed = 4,
1513
1548
  PlatformRuling = 6,
1514
1549
  PlatformRevoked = 7,
1515
- ReconsiderationVoting = 8
1550
+ ReconsiderationVoting = 8,
1551
+ AppealRevert = 9,
1552
+ NotAppealFailed = 10
1516
1553
  }
1517
1554
  declare enum AppealStage {
1518
1555
  UnderReview = 1,
@@ -1550,6 +1587,7 @@ interface AppealListItem {
1550
1587
  claimStatus: AppealClaimStatusEnum;
1551
1588
  baseAmount?: string;
1552
1589
  quoteAmount?: string;
1590
+ successVoteCount: number;
1553
1591
  }
1554
1592
  interface GetAppealDetailParams {
1555
1593
  caseId: number;
@@ -1603,6 +1641,7 @@ interface AppealDetail {
1603
1641
  claimStatus: AppealClaimStatusEnum;
1604
1642
  baseAmount?: string;
1605
1643
  quoteAmount?: string;
1644
+ successVoteCount: number;
1606
1645
  }
1607
1646
  interface AppealUploadEvidenceParams {
1608
1647
  caseId: number;
@@ -1634,7 +1673,11 @@ interface AppealReconsiderationListItem {
1634
1673
  publicNoticeEndTime: number;
1635
1674
  updateTime: number;
1636
1675
  appealCaseId?: number;
1637
- aappealBondClaimTime?: number;
1676
+ appealBondClaimTime?: number;
1677
+ successVoteCount: number;
1678
+ appealSuccessVoteCount?: number;
1679
+ appealTotalVoteCount?: number;
1680
+ appealVotedCount?: number;
1638
1681
  }
1639
1682
  interface GetAppealReconsiderationDetailParams {
1640
1683
  caseId: number;
@@ -1668,6 +1711,11 @@ interface AppealReconsiderationDetail {
1668
1711
  appealStage: AppealStage;
1669
1712
  appealBondState: AppealClaimStatusEnum;
1670
1713
  appealBondClaimTime?: number;
1714
+ txHash: string;
1715
+ appealStartTime: number;
1716
+ appealEndTime: number;
1717
+ appealSuccessVoteCount?: number;
1718
+ successVoteCount: number;
1671
1719
  }
1672
1720
  interface AppealReimbursementParams {
1673
1721
  before?: number;
@@ -1689,6 +1737,7 @@ interface AppealReimbursementItem {
1689
1737
  claimTime: number;
1690
1738
  expireTime: number;
1691
1739
  createTime: number;
1740
+ proof: string;
1692
1741
  }
1693
1742
  interface GetAppealNodeVoteListParams {
1694
1743
  before?: number;
@@ -1839,6 +1888,9 @@ declare class Api extends Request {
1839
1888
  getPedingVoteCount(): Promise<ApiResponse<number>>;
1840
1889
  getMyAppealCount(): Promise<ApiResponse<number>>;
1841
1890
  getWarmholeSign(params: GetWarmholeSignParams): Promise<ApiResponse<GetWarmholeSignResponse>>;
1891
+ getDisputeTotalCount(): Promise<ApiResponse<number>>;
1892
+ getAppealTotalCount(): Promise<ApiResponse<number>>;
1893
+ getReimbursementTotalCount(): Promise<ApiResponse<number>>;
1842
1894
  /**
1843
1895
  * appeal module end ------>
1844
1896
  */
@@ -2134,12 +2186,11 @@ declare class Position {
2134
2186
  code: number;
2135
2187
  data: PositionHistoryItem[];
2136
2188
  }>;
2137
- adjustCollateral({ poolId, positionId, adjustAmount, quoteToken, poolOracleType, chainId, address, }: {
2189
+ adjustCollateral({ poolId, positionId, adjustAmount, quoteToken, chainId, address, }: {
2138
2190
  poolId: string;
2139
2191
  positionId: string;
2140
2192
  adjustAmount: string;
2141
2193
  quoteToken: string;
2142
- poolOracleType: OracleType;
2143
2194
  chainId: number;
2144
2195
  address: string;
2145
2196
  }): Promise<{
@@ -2310,7 +2361,7 @@ declare class Order {
2310
2361
  message: any;
2311
2362
  data?: undefined;
2312
2363
  }>;
2313
- updateOrderTpSl(params: UpdateOrderParams, quoteAddress: string, chainId: number, address: string, marketId: string): Promise<{
2364
+ updateOrderTpSl(params: UpdateOrderParams, quoteAddress: string, chainId: number, address: string, marketId: string, isTpSlOrder?: boolean): Promise<{
2314
2365
  code: number;
2315
2366
  message: string;
2316
2367
  data: ApiResponse<any>;
@@ -2628,9 +2679,8 @@ interface BrokerInterface extends Interface {
2628
2679
  {
2629
2680
  poolId: BytesLike;
2630
2681
  oracleType: BigNumberish;
2631
- referencePrice: BigNumberish;
2632
- oracleUpdateData: BytesLike;
2633
2682
  publishTime: BigNumberish;
2683
+ oracleUpdateData: BytesLike;
2634
2684
  }[],
2635
2685
  {
2636
2686
  token: AddressLike;
@@ -3263,9 +3313,8 @@ interface Broker extends BaseContract {
3263
3313
  prices: {
3264
3314
  poolId: BytesLike;
3265
3315
  oracleType: BigNumberish;
3266
- referencePrice: BigNumberish;
3267
- oracleUpdateData: BytesLike;
3268
3316
  publishTime: BigNumberish;
3317
+ oracleUpdateData: BytesLike;
3269
3318
  }[],
3270
3319
  depositParams: {
3271
3320
  token: AddressLike;
@@ -3691,9 +3740,8 @@ interface Broker extends BaseContract {
3691
3740
  prices: {
3692
3741
  poolId: BytesLike;
3693
3742
  oracleType: BigNumberish;
3694
- referencePrice: BigNumberish;
3695
- oracleUpdateData: BytesLike;
3696
3743
  publishTime: BigNumberish;
3744
+ oracleUpdateData: BytesLike;
3697
3745
  }[],
3698
3746
  depositParams: {
3699
3747
  token: AddressLike;
@@ -3884,6 +3932,9 @@ declare class Appeal extends BaseMyxClient {
3884
3932
  getPedingVoteCount(): Promise<ApiResponse<number>>;
3885
3933
  getMyAppealCount(): Promise<ApiResponse<number>>;
3886
3934
  getWarmholeSign(params: GetWarmholeSignParams): Promise<ApiResponse<GetWarmholeSignResponse>>;
3935
+ getDisputeTotalCount(): Promise<ApiResponse<number>>;
3936
+ getAppealTotalCount(): Promise<ApiResponse<number>>;
3937
+ getReimbursementTotalCount(): Promise<ApiResponse<number>>;
3887
3938
  }
3888
3939
 
3889
3940
  declare class Referrals extends BaseMyxClient {
@@ -3911,7 +3962,7 @@ declare class MyxClient {
3911
3962
  appeal: Appeal;
3912
3963
  referrals: Referrals;
3913
3964
  /**
3914
- * 获取配置管理器(用于访问 accessToken 相关方法)
3965
+ * Get config manager (for accessToken-related methods)
3915
3966
  */
3916
3967
  getConfigManager(): ConfigManager;
3917
3968
  constructor(options: MyxClientConfig);
@@ -3925,9 +3976,14 @@ declare class MyxClient {
3925
3976
  */
3926
3977
  close(): void;
3927
3978
  /**
3928
- * get access token
3979
+ * Get currently stored access token (does not auto-refresh)
3929
3980
  */
3930
3981
  getAccessToken(): Promise<string | null>;
3982
+ /**
3983
+ * Manually refresh access token (must be called explicitly by the client)
3984
+ * @param forceRefresh Whether to force refresh
3985
+ */
3986
+ refreshAccessToken(forceRefresh?: boolean): Promise<string | null>;
3931
3987
  }
3932
3988
 
3933
3989
  export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type Address, type ApiResponse, AppealCaseTypeEnum, AppealClaimStatusEnum, type AppealDetail, type AppealListItem, AppealNodeStateEnum, type AppealNodeVoteItem, type AppealNodeVoteListItem, AppealNodeVotedStateEnum, type AppealReconsiderationDetail, type AppealReconsiderationItem, type AppealReconsiderationListItem, AppealReconsiderationType, type AppealReimbursementItem, type AppealReimbursementParams, AppealStage, AppealType, type AppealUploadEvidenceParams, type AppealVoteItem, type BaseDetailResponse, type BaseResponse, COMMON_LP_AMOUNT_DECIMALS, COMMON_PRICE_DECIMALS, ChainId, type ChainIdRequest, CloseTypeEnum, type DashboardType, Direction, DirectionEnum, ErrorCode, ExecTypeEnum, type FavoritesListItem, type FavoritesListParams, type FavoritesTimeInterval, type FavoritesType, type FetchForwarderGetParams, type FetchForwarderGetResponse, type FetchForwarderGetResponseData, ForwarderGetStatus, type ForwarderTxParams, type GetAppealDetailParams, type GetAppealListParams, type GetAppealNodeVoteListParams, type GetAppealReconsiderationDetailParams, type GetAppealReconsiderationListParams, type GetAppealVoteNodeDetailParams, type GetBaseDetailParams, type GetHistoryOrdersParams, type GetIsVoteNodeParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type GetWarmholeSignParams, type GetWarmholeSignResponse, type GuardianSignatureItem, type HistoryOrderItem, type HttpEnvParams, HttpKlineIntervalEnum, IsVoteNodeEnum, type KlineDataItemType, type KlineDataResponse, type KlineResolution, type LevelConfig, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketPool, type MarketPoolResponse, MarketPoolState, MarketType, MxSDK, MyxClient, type MyxClientConfig, type MyxSubscriptionOptions, type NetWorkFee, NodeTypeEnum, type ObjectType, type OnKlineCallback, type OnOrderCallback, type OnPositionCallback, type OnTickersAllCallback, type OnTickersCallback, OperationEnum, OperationType, OracleType, type Order$1 as Order, OrderStatus, OrderStatusEnum, OrderType, OrderTypeEnum, type PlaceOrderParams, type PoolLevelConfig, type PoolOpenOrder, type PoolOpenOrdersResponse, type PoolResponse, type PoolSymbolAllResponse, type Position$1 as Position, type PositionHistoryItem, type PositionResponse, type PositionTpSlOrderParams, type PositionType, type PostVoteResponse, type PostVoteSignatureParams, type PriceResponse, type PriceType, type RemoveFavoriteParams, type SearchMarketParams, type SearchResultContractItem, type SearchResultCookItem, type SearchResultEarnItem, type SearchResultResponse, SearchSecondTypeEnum, SearchTypeEnum, type StatDashBoardResponse, type TickerDataItem, type TickersDataResponse, TimeInForce, TradeFlowAccountTypeEnum, type TradeFlowItem, TradeFlowTypeEnum, type TradingResult, TriggerType, TriggerTypeEnum, type UpdateOrderTpSlParams, VoteTypeEnum, approve, index$2 as base, bigintAmountSlipperCalculator, bigintTradingGasPriceWithRatio, bigintTradingGasToRatioCalculator, getAllowanceApproved, getBalanceOf, getBaseDetail, getBaseUrlByEnv, getMarketDetail, getMarketList, getOraclePrice, getPoolDetail, getPoolList, getPoolOpenOrders, getPriceData, getPricesData, getTickerData, getTokenInfo, index as market, index$3 as pool, index$1 as quote };