@myx-trade/sdk 0.1.131 → 0.1.133

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
@@ -1,4 +1,5 @@
1
- import { AddressLike, Signer, ethers } from 'ethers';
1
+ import * as ethers from 'ethers';
2
+ import { AddressLike, Signer, ethers as ethers$1 } from 'ethers';
2
3
  export { formatUnits, parseUnits } from 'ethers';
3
4
  import { Options, Event } from 'reconnecting-websocket';
4
5
  import { WalletClient } from 'viem';
@@ -48,49 +49,49 @@ interface CancelTpSLParams {
48
49
  orderId: string;
49
50
  }
50
51
 
51
- declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<any>;
52
+ declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<string | undefined>;
52
53
 
53
- declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<any>;
54
- declare const getMarketPools: (chainId: ChainId) => Promise<any>;
54
+ declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<string | undefined>;
55
+ declare const getMarketPools: (chainId: ChainId) => Promise<string[]>;
55
56
  declare const getPoolInfo$1: (chainId: ChainId, poolId: string, marketPrice?: bigint) => Promise<{
56
57
  quotePool: {
57
- poolToken: any;
58
- exchangeRate: any;
59
- poolTokenPrice: any;
60
- poolTokenSupply: any;
58
+ poolToken: string;
59
+ exchangeRate: bigint;
60
+ poolTokenPrice: bigint;
61
+ poolTokenSupply: bigint;
61
62
  };
62
63
  basePool: {
63
- poolToken: any;
64
- exchangeRate: any;
65
- poolTokenPrice: any;
66
- poolTokenSupply: any;
64
+ poolToken: string;
65
+ exchangeRate: bigint;
66
+ poolTokenPrice: bigint;
67
+ poolTokenSupply: bigint;
67
68
  };
68
69
  reserveInfo: {
69
- baseTotalAmount: any;
70
- baseReservedAmount: any;
71
- quoteTotalAmount: any;
72
- quoteReservedAmount: any;
70
+ baseTotalAmount: bigint;
71
+ baseReservedAmount: bigint;
72
+ quoteTotalAmount: bigint;
73
+ quoteReservedAmount: bigint;
73
74
  };
74
75
  fundingInfo: {
75
- nextFundingRate: any;
76
- lastFundingFeeTracker: any;
77
- nextEpochTime: any;
76
+ nextFundingRate: bigint;
77
+ lastFundingFeeTracker: bigint;
78
+ nextEpochTime: bigint;
78
79
  };
79
80
  ioTracker: {
80
- tracker: any;
81
- longSize: any;
82
- shortSize: any;
83
- poolEntryPrice: any;
81
+ tracker: bigint;
82
+ longSize: bigint;
83
+ shortSize: bigint;
84
+ poolEntryPrice: bigint;
84
85
  };
85
86
  }>;
86
87
 
87
- declare const getUserGenesisShare: (chainId: ChainId, tokenAddress: string, account: string) => Promise<any>;
88
+ declare const getUserGenesisShare: (chainId: ChainId, tokenAddress: string, account: string) => Promise<bigint>;
88
89
 
89
- declare const addTpSl: (params: AddTpSLParams) => Promise<any>;
90
+ declare const addTpSl: (params: AddTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
90
91
 
91
- declare const cancelTpSl: (params: CancelTpSLParams) => Promise<any>;
92
+ declare const cancelTpSl: (params: CancelTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
92
93
 
93
- declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<any>;
94
+ declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<ethers.ContractTransactionReceipt | null>;
94
95
 
95
96
  /**
96
97
  * Trading related types and enums
@@ -887,21 +888,21 @@ interface PreviewWithdrawDataParams {
887
888
  amount: string | number;
888
889
  }
889
890
 
890
- declare const claimBasePoolRebate: (params: ClaimParams) => Promise<any>;
891
- declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<any>;
891
+ declare const claimBasePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
892
+ declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
892
893
 
893
- declare const deposit$1: (params: Deposit) => Promise<any>;
894
+ declare const deposit$1: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
894
895
 
895
- declare const withdraw$1: (params: WithdrawParams) => Promise<any>;
896
+ declare const withdraw$1: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
896
897
 
897
- declare const getRewards$1: (params: RewardsParams) => Promise<any>;
898
+ declare const getRewards$1: (params: RewardsParams) => Promise<bigint | undefined>;
898
899
 
899
900
  declare const previewUserWithdrawData: ({ chainId, account, poolId, amount }: PreviewWithdrawDataParams) => Promise<{
900
- baseAmountOut: any;
901
- rebateAmount: any;
901
+ baseAmountOut: bigint;
902
+ rebateAmount: bigint;
902
903
  } | undefined>;
903
904
 
904
- declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<any>;
905
+ declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
905
906
 
906
907
  declare const index$2_claimBasePoolRebate: typeof claimBasePoolRebate;
907
908
  declare const index$2_claimBasePoolRebates: typeof claimBasePoolRebates;
@@ -910,18 +911,18 @@ declare namespace index$2 {
910
911
  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 };
911
912
  }
912
913
 
913
- declare const deposit: (params: Deposit) => Promise<any>;
914
+ declare const deposit: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
914
915
 
915
- declare const withdraw: (params: WithdrawParams) => Promise<any>;
916
+ declare const withdraw: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
916
917
 
917
- declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<any>;
918
+ declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<ethers.ContractTransactionResponse | null>;
918
919
 
919
- declare const getRewards: (params: RewardsParams) => Promise<any>;
920
+ declare const getRewards: (params: RewardsParams) => Promise<bigint | undefined>;
920
921
 
921
- declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<any>;
922
- declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<any>;
922
+ declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
923
+ declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
923
924
 
924
- declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<any>;
925
+ declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
925
926
 
926
927
  declare const index$1_claimQuotePoolRebate: typeof claimQuotePoolRebate;
927
928
  declare const index$1_claimQuotePoolRebates: typeof claimQuotePoolRebates;
@@ -934,9 +935,16 @@ declare namespace index$1 {
934
935
  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 };
935
936
  }
936
937
 
937
- declare const getMarket: (chainId: ChainId, marketId: string) => Promise<any>;
938
+ declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, bigint, bigint, bigint, bigint, bigint] & {
939
+ quoteToken: string;
940
+ baseReserveRatio: bigint;
941
+ quoteReserveRatio: bigint;
942
+ oracleFeeUsd: bigint;
943
+ oracleRefundFeeUsd: bigint;
944
+ poolPrimeThreshold: bigint;
945
+ }) | undefined>;
938
946
 
939
- declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<any>;
947
+ declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<bigint | undefined>;
940
948
 
941
949
  declare const index_getMarket: typeof getMarket;
942
950
  declare const index_getOracleFee: typeof getOracleFee;
@@ -979,9 +987,9 @@ declare const bigintAmountSlipperCalculator: (amount: bigint, slipper?: Number)
979
987
  declare const getTokenInfo: (chainId: number, tokenAddress: string, account?: string) => Promise<{
980
988
  balance?: number | undefined;
981
989
  address: string;
982
- name: any;
983
- symbol: any;
984
- decimals: any;
990
+ name: string;
991
+ symbol: string;
992
+ decimals: bigint;
985
993
  icon: string;
986
994
  totalSupply: number;
987
995
  }>;
@@ -1195,7 +1203,7 @@ interface MyxClientConfig {
1195
1203
  signer?: Signer;
1196
1204
  seamlessAccount?: {
1197
1205
  masterAddress: string;
1198
- wallet: ethers.Wallet | null;
1206
+ wallet: ethers$1.Wallet | null;
1199
1207
  authorized: boolean;
1200
1208
  };
1201
1209
  walletClient?: WalletClient;
@@ -1215,7 +1223,7 @@ declare class ConfigManager {
1215
1223
  clear(): void;
1216
1224
  startSeamlessMode(open: boolean): MyxClientConfig;
1217
1225
  updateSeamlessWallet({ wallet, authorized, masterAddress }: {
1218
- wallet?: ethers.Wallet;
1226
+ wallet?: ethers$1.Wallet;
1219
1227
  authorized?: boolean;
1220
1228
  masterAddress?: string;
1221
1229
  }): void;
@@ -1323,7 +1331,7 @@ declare class Utils {
1323
1331
  quoteAddress: string;
1324
1332
  amount?: string;
1325
1333
  spenderAddress?: string;
1326
- signer?: ethers.Signer;
1334
+ signer?: ethers$1.Signer;
1327
1335
  }): Promise<{
1328
1336
  code: number;
1329
1337
  message: any;
@@ -1490,9 +1498,9 @@ declare class Seamless {
1490
1498
  private utils;
1491
1499
  private account;
1492
1500
  constructor(configManager: ConfigManager, logger: Logger, utils: Utils, account: Account);
1493
- onCheckRelayer(account: string, relayer: string): Promise<any>;
1501
+ onCheckRelayer(account: string, relayer: string): Promise<boolean>;
1494
1502
  getUSDPermitParams(deadline: number): Promise<{
1495
- token: string | ethers.Addressable;
1503
+ token: string | ethers$1.Addressable;
1496
1504
  owner: Promise<string> | undefined;
1497
1505
  spender: string;
1498
1506
  value: bigint;
@@ -1509,7 +1517,7 @@ declare class Seamless {
1509
1517
  deadline: number;
1510
1518
  data: string;
1511
1519
  nonce: string;
1512
- }, chainId: number, provider?: ethers.Signer): Promise<ApiResponse<any>>;
1520
+ }, chainId: number, provider?: ethers$1.Signer): Promise<ApiResponse<any>>;
1513
1521
  authorizeSeamlessAccount({ approve, seamlessAddress, chainId }: {
1514
1522
  approve: boolean;
1515
1523
  seamlessAddress: string;
@@ -1530,7 +1538,7 @@ declare class Seamless {
1530
1538
  data: {
1531
1539
  masterAddress: string;
1532
1540
  seamlessAccount: string;
1533
- authorized: any;
1541
+ authorized: boolean;
1534
1542
  };
1535
1543
  }>;
1536
1544
  exportSeamlessPrivateKey({ password, apiKey }: {
@@ -1548,9 +1556,9 @@ declare class Seamless {
1548
1556
  }): Promise<{
1549
1557
  code: number;
1550
1558
  data: {
1551
- masterAddress: any;
1559
+ masterAddress: string;
1552
1560
  seamlessAccount: string;
1553
- authorized: any;
1561
+ authorized: boolean;
1554
1562
  apiKey: string;
1555
1563
  };
1556
1564
  }>;
@@ -1570,7 +1578,7 @@ declare class Seamless {
1570
1578
  data: {
1571
1579
  masterAddress: string;
1572
1580
  seamlessAccount: string;
1573
- authorized: any;
1581
+ authorized: boolean;
1574
1582
  apiKey: string;
1575
1583
  };
1576
1584
  message?: undefined;
@@ -1647,7 +1655,7 @@ declare class Order {
1647
1655
  private seamless;
1648
1656
  private account;
1649
1657
  constructor(configManager: ConfigManager, logger: Logger, utils: Utils, seamless: Seamless, account: Account);
1650
- createIncreaseOrder(params: PlaceOrderParams): Promise<{
1658
+ createIncreaseOrder(params: PlaceOrderParams, tradingFee: string): Promise<{
1651
1659
  code: number;
1652
1660
  message: string;
1653
1661
  data: ApiResponse<any>;
@@ -1657,13 +1665,13 @@ declare class Order {
1657
1665
  data: {
1658
1666
  success: boolean;
1659
1667
  orderId: string | null;
1660
- transactionHash: any;
1661
- blockNumber: any;
1662
- gasUsed: any;
1668
+ transactionHash: string;
1669
+ blockNumber: number | undefined;
1670
+ gasUsed: string | undefined;
1663
1671
  status: string;
1664
1672
  confirmations: number;
1665
1673
  timestamp: number;
1666
- receipt: any;
1674
+ receipt: ethers$1.ContractTransactionReceipt | null;
1667
1675
  };
1668
1676
  } | {
1669
1677
  code: number;
@@ -1685,13 +1693,13 @@ declare class Order {
1685
1693
  code: number;
1686
1694
  message: string;
1687
1695
  data: string | null;
1688
- transactionHash: any;
1689
- blockNumber: any;
1690
- gasUsed: any;
1696
+ transactionHash: string;
1697
+ blockNumber: number | undefined;
1698
+ gasUsed: string | undefined;
1691
1699
  status: string;
1692
1700
  confirmations: number;
1693
1701
  timestamp: number;
1694
- receipt: any;
1702
+ receipt: ethers$1.ContractTransactionReceipt | null;
1695
1703
  } | {
1696
1704
  code: number;
1697
1705
  message: any;
@@ -1714,13 +1722,13 @@ declare class Order {
1714
1722
  data: {
1715
1723
  success: boolean;
1716
1724
  orderId: string | null;
1717
- transactionHash: any;
1718
- blockNumber: any;
1719
- gasUsed: any;
1725
+ transactionHash: string;
1726
+ blockNumber: number | undefined;
1727
+ gasUsed: string | undefined;
1720
1728
  status: string;
1721
1729
  confirmations: number;
1722
1730
  timestamp: number;
1723
- receipt: any;
1731
+ receipt: ethers$1.ContractTransactionReceipt | null;
1724
1732
  };
1725
1733
  } | {
1726
1734
  code: number;
@@ -1737,13 +1745,13 @@ declare class Order {
1737
1745
  data: {
1738
1746
  success: boolean;
1739
1747
  orderId: string | null;
1740
- transactionHash: any;
1741
- blockNumber: any;
1742
- gasUsed: any;
1748
+ transactionHash: string;
1749
+ blockNumber: number | undefined;
1750
+ gasUsed: string | undefined;
1743
1751
  status: string;
1744
1752
  confirmations: number;
1745
1753
  timestamp: number;
1746
- receipt: any;
1754
+ receipt: ethers$1.ContractTransactionReceipt | null;
1747
1755
  };
1748
1756
  } | {
1749
1757
  code: number;
@@ -1769,7 +1777,7 @@ declare class Order {
1769
1777
  }>;
1770
1778
  updateOrderTpSl(params: UpdateOrderParams, quoteAddress: string, chainId: number): Promise<{
1771
1779
  code: number;
1772
- data: any;
1780
+ data: ethers$1.ContractTransactionReceipt | null;
1773
1781
  message: string;
1774
1782
  } | {
1775
1783
  code: number;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { AddressLike, Signer, ethers } from 'ethers';
1
+ import * as ethers from 'ethers';
2
+ import { AddressLike, Signer, ethers as ethers$1 } from 'ethers';
2
3
  export { formatUnits, parseUnits } from 'ethers';
3
4
  import { Options, Event } from 'reconnecting-websocket';
4
5
  import { WalletClient } from 'viem';
@@ -48,49 +49,49 @@ interface CancelTpSLParams {
48
49
  orderId: string;
49
50
  }
50
51
 
51
- declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<any>;
52
+ declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<string | undefined>;
52
53
 
53
- declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<any>;
54
- declare const getMarketPools: (chainId: ChainId) => Promise<any>;
54
+ declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<string | undefined>;
55
+ declare const getMarketPools: (chainId: ChainId) => Promise<string[]>;
55
56
  declare const getPoolInfo$1: (chainId: ChainId, poolId: string, marketPrice?: bigint) => Promise<{
56
57
  quotePool: {
57
- poolToken: any;
58
- exchangeRate: any;
59
- poolTokenPrice: any;
60
- poolTokenSupply: any;
58
+ poolToken: string;
59
+ exchangeRate: bigint;
60
+ poolTokenPrice: bigint;
61
+ poolTokenSupply: bigint;
61
62
  };
62
63
  basePool: {
63
- poolToken: any;
64
- exchangeRate: any;
65
- poolTokenPrice: any;
66
- poolTokenSupply: any;
64
+ poolToken: string;
65
+ exchangeRate: bigint;
66
+ poolTokenPrice: bigint;
67
+ poolTokenSupply: bigint;
67
68
  };
68
69
  reserveInfo: {
69
- baseTotalAmount: any;
70
- baseReservedAmount: any;
71
- quoteTotalAmount: any;
72
- quoteReservedAmount: any;
70
+ baseTotalAmount: bigint;
71
+ baseReservedAmount: bigint;
72
+ quoteTotalAmount: bigint;
73
+ quoteReservedAmount: bigint;
73
74
  };
74
75
  fundingInfo: {
75
- nextFundingRate: any;
76
- lastFundingFeeTracker: any;
77
- nextEpochTime: any;
76
+ nextFundingRate: bigint;
77
+ lastFundingFeeTracker: bigint;
78
+ nextEpochTime: bigint;
78
79
  };
79
80
  ioTracker: {
80
- tracker: any;
81
- longSize: any;
82
- shortSize: any;
83
- poolEntryPrice: any;
81
+ tracker: bigint;
82
+ longSize: bigint;
83
+ shortSize: bigint;
84
+ poolEntryPrice: bigint;
84
85
  };
85
86
  }>;
86
87
 
87
- declare const getUserGenesisShare: (chainId: ChainId, tokenAddress: string, account: string) => Promise<any>;
88
+ declare const getUserGenesisShare: (chainId: ChainId, tokenAddress: string, account: string) => Promise<bigint>;
88
89
 
89
- declare const addTpSl: (params: AddTpSLParams) => Promise<any>;
90
+ declare const addTpSl: (params: AddTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
90
91
 
91
- declare const cancelTpSl: (params: CancelTpSLParams) => Promise<any>;
92
+ declare const cancelTpSl: (params: CancelTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
92
93
 
93
- declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<any>;
94
+ declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<ethers.ContractTransactionReceipt | null>;
94
95
 
95
96
  /**
96
97
  * Trading related types and enums
@@ -887,21 +888,21 @@ interface PreviewWithdrawDataParams {
887
888
  amount: string | number;
888
889
  }
889
890
 
890
- declare const claimBasePoolRebate: (params: ClaimParams) => Promise<any>;
891
- declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<any>;
891
+ declare const claimBasePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
892
+ declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
892
893
 
893
- declare const deposit$1: (params: Deposit) => Promise<any>;
894
+ declare const deposit$1: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
894
895
 
895
- declare const withdraw$1: (params: WithdrawParams) => Promise<any>;
896
+ declare const withdraw$1: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
896
897
 
897
- declare const getRewards$1: (params: RewardsParams) => Promise<any>;
898
+ declare const getRewards$1: (params: RewardsParams) => Promise<bigint | undefined>;
898
899
 
899
900
  declare const previewUserWithdrawData: ({ chainId, account, poolId, amount }: PreviewWithdrawDataParams) => Promise<{
900
- baseAmountOut: any;
901
- rebateAmount: any;
901
+ baseAmountOut: bigint;
902
+ rebateAmount: bigint;
902
903
  } | undefined>;
903
904
 
904
- declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<any>;
905
+ declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
905
906
 
906
907
  declare const index$2_claimBasePoolRebate: typeof claimBasePoolRebate;
907
908
  declare const index$2_claimBasePoolRebates: typeof claimBasePoolRebates;
@@ -910,18 +911,18 @@ declare namespace index$2 {
910
911
  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 };
911
912
  }
912
913
 
913
- declare const deposit: (params: Deposit) => Promise<any>;
914
+ declare const deposit: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
914
915
 
915
- declare const withdraw: (params: WithdrawParams) => Promise<any>;
916
+ declare const withdraw: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
916
917
 
917
- declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<any>;
918
+ declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<ethers.ContractTransactionResponse | null>;
918
919
 
919
- declare const getRewards: (params: RewardsParams) => Promise<any>;
920
+ declare const getRewards: (params: RewardsParams) => Promise<bigint | undefined>;
920
921
 
921
- declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<any>;
922
- declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<any>;
922
+ declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
923
+ declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
923
924
 
924
- declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<any>;
925
+ declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
925
926
 
926
927
  declare const index$1_claimQuotePoolRebate: typeof claimQuotePoolRebate;
927
928
  declare const index$1_claimQuotePoolRebates: typeof claimQuotePoolRebates;
@@ -934,9 +935,16 @@ declare namespace index$1 {
934
935
  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 };
935
936
  }
936
937
 
937
- declare const getMarket: (chainId: ChainId, marketId: string) => Promise<any>;
938
+ declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, bigint, bigint, bigint, bigint, bigint] & {
939
+ quoteToken: string;
940
+ baseReserveRatio: bigint;
941
+ quoteReserveRatio: bigint;
942
+ oracleFeeUsd: bigint;
943
+ oracleRefundFeeUsd: bigint;
944
+ poolPrimeThreshold: bigint;
945
+ }) | undefined>;
938
946
 
939
- declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<any>;
947
+ declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<bigint | undefined>;
940
948
 
941
949
  declare const index_getMarket: typeof getMarket;
942
950
  declare const index_getOracleFee: typeof getOracleFee;
@@ -979,9 +987,9 @@ declare const bigintAmountSlipperCalculator: (amount: bigint, slipper?: Number)
979
987
  declare const getTokenInfo: (chainId: number, tokenAddress: string, account?: string) => Promise<{
980
988
  balance?: number | undefined;
981
989
  address: string;
982
- name: any;
983
- symbol: any;
984
- decimals: any;
990
+ name: string;
991
+ symbol: string;
992
+ decimals: bigint;
985
993
  icon: string;
986
994
  totalSupply: number;
987
995
  }>;
@@ -1195,7 +1203,7 @@ interface MyxClientConfig {
1195
1203
  signer?: Signer;
1196
1204
  seamlessAccount?: {
1197
1205
  masterAddress: string;
1198
- wallet: ethers.Wallet | null;
1206
+ wallet: ethers$1.Wallet | null;
1199
1207
  authorized: boolean;
1200
1208
  };
1201
1209
  walletClient?: WalletClient;
@@ -1215,7 +1223,7 @@ declare class ConfigManager {
1215
1223
  clear(): void;
1216
1224
  startSeamlessMode(open: boolean): MyxClientConfig;
1217
1225
  updateSeamlessWallet({ wallet, authorized, masterAddress }: {
1218
- wallet?: ethers.Wallet;
1226
+ wallet?: ethers$1.Wallet;
1219
1227
  authorized?: boolean;
1220
1228
  masterAddress?: string;
1221
1229
  }): void;
@@ -1323,7 +1331,7 @@ declare class Utils {
1323
1331
  quoteAddress: string;
1324
1332
  amount?: string;
1325
1333
  spenderAddress?: string;
1326
- signer?: ethers.Signer;
1334
+ signer?: ethers$1.Signer;
1327
1335
  }): Promise<{
1328
1336
  code: number;
1329
1337
  message: any;
@@ -1490,9 +1498,9 @@ declare class Seamless {
1490
1498
  private utils;
1491
1499
  private account;
1492
1500
  constructor(configManager: ConfigManager, logger: Logger, utils: Utils, account: Account);
1493
- onCheckRelayer(account: string, relayer: string): Promise<any>;
1501
+ onCheckRelayer(account: string, relayer: string): Promise<boolean>;
1494
1502
  getUSDPermitParams(deadline: number): Promise<{
1495
- token: string | ethers.Addressable;
1503
+ token: string | ethers$1.Addressable;
1496
1504
  owner: Promise<string> | undefined;
1497
1505
  spender: string;
1498
1506
  value: bigint;
@@ -1509,7 +1517,7 @@ declare class Seamless {
1509
1517
  deadline: number;
1510
1518
  data: string;
1511
1519
  nonce: string;
1512
- }, chainId: number, provider?: ethers.Signer): Promise<ApiResponse<any>>;
1520
+ }, chainId: number, provider?: ethers$1.Signer): Promise<ApiResponse<any>>;
1513
1521
  authorizeSeamlessAccount({ approve, seamlessAddress, chainId }: {
1514
1522
  approve: boolean;
1515
1523
  seamlessAddress: string;
@@ -1530,7 +1538,7 @@ declare class Seamless {
1530
1538
  data: {
1531
1539
  masterAddress: string;
1532
1540
  seamlessAccount: string;
1533
- authorized: any;
1541
+ authorized: boolean;
1534
1542
  };
1535
1543
  }>;
1536
1544
  exportSeamlessPrivateKey({ password, apiKey }: {
@@ -1548,9 +1556,9 @@ declare class Seamless {
1548
1556
  }): Promise<{
1549
1557
  code: number;
1550
1558
  data: {
1551
- masterAddress: any;
1559
+ masterAddress: string;
1552
1560
  seamlessAccount: string;
1553
- authorized: any;
1561
+ authorized: boolean;
1554
1562
  apiKey: string;
1555
1563
  };
1556
1564
  }>;
@@ -1570,7 +1578,7 @@ declare class Seamless {
1570
1578
  data: {
1571
1579
  masterAddress: string;
1572
1580
  seamlessAccount: string;
1573
- authorized: any;
1581
+ authorized: boolean;
1574
1582
  apiKey: string;
1575
1583
  };
1576
1584
  message?: undefined;
@@ -1647,7 +1655,7 @@ declare class Order {
1647
1655
  private seamless;
1648
1656
  private account;
1649
1657
  constructor(configManager: ConfigManager, logger: Logger, utils: Utils, seamless: Seamless, account: Account);
1650
- createIncreaseOrder(params: PlaceOrderParams): Promise<{
1658
+ createIncreaseOrder(params: PlaceOrderParams, tradingFee: string): Promise<{
1651
1659
  code: number;
1652
1660
  message: string;
1653
1661
  data: ApiResponse<any>;
@@ -1657,13 +1665,13 @@ declare class Order {
1657
1665
  data: {
1658
1666
  success: boolean;
1659
1667
  orderId: string | null;
1660
- transactionHash: any;
1661
- blockNumber: any;
1662
- gasUsed: any;
1668
+ transactionHash: string;
1669
+ blockNumber: number | undefined;
1670
+ gasUsed: string | undefined;
1663
1671
  status: string;
1664
1672
  confirmations: number;
1665
1673
  timestamp: number;
1666
- receipt: any;
1674
+ receipt: ethers$1.ContractTransactionReceipt | null;
1667
1675
  };
1668
1676
  } | {
1669
1677
  code: number;
@@ -1685,13 +1693,13 @@ declare class Order {
1685
1693
  code: number;
1686
1694
  message: string;
1687
1695
  data: string | null;
1688
- transactionHash: any;
1689
- blockNumber: any;
1690
- gasUsed: any;
1696
+ transactionHash: string;
1697
+ blockNumber: number | undefined;
1698
+ gasUsed: string | undefined;
1691
1699
  status: string;
1692
1700
  confirmations: number;
1693
1701
  timestamp: number;
1694
- receipt: any;
1702
+ receipt: ethers$1.ContractTransactionReceipt | null;
1695
1703
  } | {
1696
1704
  code: number;
1697
1705
  message: any;
@@ -1714,13 +1722,13 @@ declare class Order {
1714
1722
  data: {
1715
1723
  success: boolean;
1716
1724
  orderId: string | null;
1717
- transactionHash: any;
1718
- blockNumber: any;
1719
- gasUsed: any;
1725
+ transactionHash: string;
1726
+ blockNumber: number | undefined;
1727
+ gasUsed: string | undefined;
1720
1728
  status: string;
1721
1729
  confirmations: number;
1722
1730
  timestamp: number;
1723
- receipt: any;
1731
+ receipt: ethers$1.ContractTransactionReceipt | null;
1724
1732
  };
1725
1733
  } | {
1726
1734
  code: number;
@@ -1737,13 +1745,13 @@ declare class Order {
1737
1745
  data: {
1738
1746
  success: boolean;
1739
1747
  orderId: string | null;
1740
- transactionHash: any;
1741
- blockNumber: any;
1742
- gasUsed: any;
1748
+ transactionHash: string;
1749
+ blockNumber: number | undefined;
1750
+ gasUsed: string | undefined;
1743
1751
  status: string;
1744
1752
  confirmations: number;
1745
1753
  timestamp: number;
1746
- receipt: any;
1754
+ receipt: ethers$1.ContractTransactionReceipt | null;
1747
1755
  };
1748
1756
  } | {
1749
1757
  code: number;
@@ -1769,7 +1777,7 @@ declare class Order {
1769
1777
  }>;
1770
1778
  updateOrderTpSl(params: UpdateOrderParams, quoteAddress: string, chainId: number): Promise<{
1771
1779
  code: number;
1772
- data: any;
1780
+ data: ethers$1.ContractTransactionReceipt | null;
1773
1781
  message: string;
1774
1782
  } | {
1775
1783
  code: number;
package/dist/index.js CHANGED
@@ -1822,7 +1822,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
1822
1822
  // package.json
1823
1823
  var package_default = {
1824
1824
  name: "@myx-trade/sdk",
1825
- version: "0.1.131",
1825
+ version: "0.1.133",
1826
1826
  private: false,
1827
1827
  publishConfig: {
1828
1828
  access: "public"
@@ -13135,7 +13135,7 @@ var DEFAULT_CONFIG = {
13135
13135
  heartbeatInterval: 1e4,
13136
13136
  heartbeatMessage: "ping",
13137
13137
  noMessageTimeout: 5e3,
13138
- connectionTimeout: 1e3
13138
+ connectionTimeout: 1e4
13139
13139
  };
13140
13140
  var MyxWebSocketClient = class {
13141
13141
  constructor(config) {
@@ -14292,13 +14292,20 @@ var Order = class {
14292
14292
  this.seamless = seamless;
14293
14293
  this.account = account;
14294
14294
  }
14295
- async createIncreaseOrder(params) {
14295
+ async createIncreaseOrder(params, tradingFee) {
14296
14296
  try {
14297
14297
  const config = this.configManager.getConfig();
14298
14298
  const networkFee = await this.utils.getNetworkFee(
14299
14299
  params.executionFeeToken,
14300
14300
  params.chainId
14301
14301
  );
14302
+ let totalNetWorkFee = BigInt(networkFee);
14303
+ if (params.tpSize) {
14304
+ totalNetWorkFee += BigInt(networkFee);
14305
+ }
14306
+ if (params.slSize) {
14307
+ totalNetWorkFee += BigInt(networkFee);
14308
+ }
14302
14309
  const needsApproval = await this.utils.needsApproval(
14303
14310
  params.chainId,
14304
14311
  params.executionFeeToken,
@@ -14312,14 +14319,16 @@ var Order = class {
14312
14319
  message: "Failed to get tradable amount or wallet balance"
14313
14320
  };
14314
14321
  }
14315
- const totalBalance = BigInt(marginAccountBalance?.freeAmount.toString() ?? 0) + (!marginAccountBalance?.tradeableProfit ? BigInt(marginAccountBalance?.tradeableProfit) : BigInt(0));
14316
- let depositAmount = BigInt(networkFee) + BigInt(params.collateralAmount);
14317
- if (totalBalance > 0) {
14318
- depositAmount = depositAmount - totalBalance;
14322
+ const availableAccountMarginBalance = BigInt(marginAccountBalance?.freeAmount.toString() ?? 0) + (!marginAccountBalance?.tradeableProfit ? BigInt(marginAccountBalance?.tradeableProfit) : BigInt(0));
14323
+ const needAmount = BigInt(tradingFee) + BigInt(params.collateralAmount) + totalNetWorkFee;
14324
+ let depositAmount = BigInt(0);
14325
+ const diff = needAmount - availableAccountMarginBalance;
14326
+ if (diff > BigInt(0)) {
14327
+ depositAmount = diff;
14319
14328
  }
14320
14329
  const depositData = {
14321
14330
  token: params.executionFeeToken,
14322
- amount: depositAmount > BigInt(0) ? (depositAmount + BigInt(networkFee)).toString() : networkFee
14331
+ amount: depositAmount.toString()
14323
14332
  };
14324
14333
  const data = {
14325
14334
  user: params.address,
package/dist/index.mjs CHANGED
@@ -1732,7 +1732,7 @@ var RotationProvider = class extends BaseProvider {
1732
1732
  // package.json
1733
1733
  var package_default = {
1734
1734
  name: "@myx-trade/sdk",
1735
- version: "0.1.131",
1735
+ version: "0.1.133",
1736
1736
  private: false,
1737
1737
  publishConfig: {
1738
1738
  access: "public"
@@ -13045,7 +13045,7 @@ var DEFAULT_CONFIG = {
13045
13045
  heartbeatInterval: 1e4,
13046
13046
  heartbeatMessage: "ping",
13047
13047
  noMessageTimeout: 5e3,
13048
- connectionTimeout: 1e3
13048
+ connectionTimeout: 1e4
13049
13049
  };
13050
13050
  var MyxWebSocketClient = class {
13051
13051
  constructor(config) {
@@ -14202,13 +14202,20 @@ var Order = class {
14202
14202
  this.seamless = seamless;
14203
14203
  this.account = account;
14204
14204
  }
14205
- async createIncreaseOrder(params) {
14205
+ async createIncreaseOrder(params, tradingFee) {
14206
14206
  try {
14207
14207
  const config = this.configManager.getConfig();
14208
14208
  const networkFee = await this.utils.getNetworkFee(
14209
14209
  params.executionFeeToken,
14210
14210
  params.chainId
14211
14211
  );
14212
+ let totalNetWorkFee = BigInt(networkFee);
14213
+ if (params.tpSize) {
14214
+ totalNetWorkFee += BigInt(networkFee);
14215
+ }
14216
+ if (params.slSize) {
14217
+ totalNetWorkFee += BigInt(networkFee);
14218
+ }
14212
14219
  const needsApproval = await this.utils.needsApproval(
14213
14220
  params.chainId,
14214
14221
  params.executionFeeToken,
@@ -14222,14 +14229,16 @@ var Order = class {
14222
14229
  message: "Failed to get tradable amount or wallet balance"
14223
14230
  };
14224
14231
  }
14225
- const totalBalance = BigInt(marginAccountBalance?.freeAmount.toString() ?? 0) + (!marginAccountBalance?.tradeableProfit ? BigInt(marginAccountBalance?.tradeableProfit) : BigInt(0));
14226
- let depositAmount = BigInt(networkFee) + BigInt(params.collateralAmount);
14227
- if (totalBalance > 0) {
14228
- depositAmount = depositAmount - totalBalance;
14232
+ const availableAccountMarginBalance = BigInt(marginAccountBalance?.freeAmount.toString() ?? 0) + (!marginAccountBalance?.tradeableProfit ? BigInt(marginAccountBalance?.tradeableProfit) : BigInt(0));
14233
+ const needAmount = BigInt(tradingFee) + BigInt(params.collateralAmount) + totalNetWorkFee;
14234
+ let depositAmount = BigInt(0);
14235
+ const diff = needAmount - availableAccountMarginBalance;
14236
+ if (diff > BigInt(0)) {
14237
+ depositAmount = diff;
14229
14238
  }
14230
14239
  const depositData = {
14231
14240
  token: params.executionFeeToken,
14232
- amount: depositAmount > BigInt(0) ? (depositAmount + BigInt(networkFee)).toString() : networkFee
14241
+ amount: depositAmount.toString()
14233
14242
  };
14234
14243
  const data = {
14235
14244
  user: params.address,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myx-trade/sdk",
3
- "version": "0.1.131",
3
+ "version": "0.1.133",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"