@myx-trade/sdk 0.1.132 → 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 +83 -75
- package/dist/index.d.ts +83 -75
- package/dist/index.js +16 -7
- package/dist/index.mjs +16 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
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<
|
|
52
|
+
declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<string | undefined>;
|
|
52
53
|
|
|
53
|
-
declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<
|
|
54
|
-
declare const getMarketPools: (chainId: ChainId) => Promise<
|
|
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:
|
|
58
|
-
exchangeRate:
|
|
59
|
-
poolTokenPrice:
|
|
60
|
-
poolTokenSupply:
|
|
58
|
+
poolToken: string;
|
|
59
|
+
exchangeRate: bigint;
|
|
60
|
+
poolTokenPrice: bigint;
|
|
61
|
+
poolTokenSupply: bigint;
|
|
61
62
|
};
|
|
62
63
|
basePool: {
|
|
63
|
-
poolToken:
|
|
64
|
-
exchangeRate:
|
|
65
|
-
poolTokenPrice:
|
|
66
|
-
poolTokenSupply:
|
|
64
|
+
poolToken: string;
|
|
65
|
+
exchangeRate: bigint;
|
|
66
|
+
poolTokenPrice: bigint;
|
|
67
|
+
poolTokenSupply: bigint;
|
|
67
68
|
};
|
|
68
69
|
reserveInfo: {
|
|
69
|
-
baseTotalAmount:
|
|
70
|
-
baseReservedAmount:
|
|
71
|
-
quoteTotalAmount:
|
|
72
|
-
quoteReservedAmount:
|
|
70
|
+
baseTotalAmount: bigint;
|
|
71
|
+
baseReservedAmount: bigint;
|
|
72
|
+
quoteTotalAmount: bigint;
|
|
73
|
+
quoteReservedAmount: bigint;
|
|
73
74
|
};
|
|
74
75
|
fundingInfo: {
|
|
75
|
-
nextFundingRate:
|
|
76
|
-
lastFundingFeeTracker:
|
|
77
|
-
nextEpochTime:
|
|
76
|
+
nextFundingRate: bigint;
|
|
77
|
+
lastFundingFeeTracker: bigint;
|
|
78
|
+
nextEpochTime: bigint;
|
|
78
79
|
};
|
|
79
80
|
ioTracker: {
|
|
80
|
-
tracker:
|
|
81
|
-
longSize:
|
|
82
|
-
shortSize:
|
|
83
|
-
poolEntryPrice:
|
|
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<
|
|
88
|
+
declare const getUserGenesisShare: (chainId: ChainId, tokenAddress: string, account: string) => Promise<bigint>;
|
|
88
89
|
|
|
89
|
-
declare const addTpSl: (params: AddTpSLParams) => Promise<
|
|
90
|
+
declare const addTpSl: (params: AddTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
90
91
|
|
|
91
|
-
declare const cancelTpSl: (params: CancelTpSLParams) => Promise<
|
|
92
|
+
declare const cancelTpSl: (params: CancelTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
92
93
|
|
|
93
|
-
declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<
|
|
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<
|
|
891
|
-
declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
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<
|
|
894
|
+
declare const deposit$1: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
894
895
|
|
|
895
|
-
declare const withdraw$1: (params: WithdrawParams) => Promise<
|
|
896
|
+
declare const withdraw$1: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
|
|
896
897
|
|
|
897
|
-
declare const getRewards$1: (params: RewardsParams) => Promise<
|
|
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:
|
|
901
|
-
rebateAmount:
|
|
901
|
+
baseAmountOut: bigint;
|
|
902
|
+
rebateAmount: bigint;
|
|
902
903
|
} | undefined>;
|
|
903
904
|
|
|
904
|
-
declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<
|
|
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<
|
|
914
|
+
declare const deposit: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
914
915
|
|
|
915
|
-
declare const withdraw: (params: WithdrawParams) => Promise<
|
|
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<
|
|
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<
|
|
920
|
+
declare const getRewards: (params: RewardsParams) => Promise<bigint | undefined>;
|
|
920
921
|
|
|
921
|
-
declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<
|
|
922
|
-
declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
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<
|
|
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<
|
|
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<
|
|
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:
|
|
983
|
-
symbol:
|
|
984
|
-
decimals:
|
|
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<
|
|
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:
|
|
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:
|
|
1559
|
+
masterAddress: string;
|
|
1552
1560
|
seamlessAccount: string;
|
|
1553
|
-
authorized:
|
|
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:
|
|
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:
|
|
1661
|
-
blockNumber:
|
|
1662
|
-
gasUsed:
|
|
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:
|
|
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:
|
|
1689
|
-
blockNumber:
|
|
1690
|
-
gasUsed:
|
|
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:
|
|
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:
|
|
1718
|
-
blockNumber:
|
|
1719
|
-
gasUsed:
|
|
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:
|
|
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:
|
|
1741
|
-
blockNumber:
|
|
1742
|
-
gasUsed:
|
|
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:
|
|
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:
|
|
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
|
|
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<
|
|
52
|
+
declare const createPool: ({ chainId, baseToken, marketId }: CreatePoolRequest) => Promise<string | undefined>;
|
|
52
53
|
|
|
53
|
-
declare const getMarketPoolId: ({ chainId, baseToken, marketId, }: CreatePoolRequest) => Promise<
|
|
54
|
-
declare const getMarketPools: (chainId: ChainId) => Promise<
|
|
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:
|
|
58
|
-
exchangeRate:
|
|
59
|
-
poolTokenPrice:
|
|
60
|
-
poolTokenSupply:
|
|
58
|
+
poolToken: string;
|
|
59
|
+
exchangeRate: bigint;
|
|
60
|
+
poolTokenPrice: bigint;
|
|
61
|
+
poolTokenSupply: bigint;
|
|
61
62
|
};
|
|
62
63
|
basePool: {
|
|
63
|
-
poolToken:
|
|
64
|
-
exchangeRate:
|
|
65
|
-
poolTokenPrice:
|
|
66
|
-
poolTokenSupply:
|
|
64
|
+
poolToken: string;
|
|
65
|
+
exchangeRate: bigint;
|
|
66
|
+
poolTokenPrice: bigint;
|
|
67
|
+
poolTokenSupply: bigint;
|
|
67
68
|
};
|
|
68
69
|
reserveInfo: {
|
|
69
|
-
baseTotalAmount:
|
|
70
|
-
baseReservedAmount:
|
|
71
|
-
quoteTotalAmount:
|
|
72
|
-
quoteReservedAmount:
|
|
70
|
+
baseTotalAmount: bigint;
|
|
71
|
+
baseReservedAmount: bigint;
|
|
72
|
+
quoteTotalAmount: bigint;
|
|
73
|
+
quoteReservedAmount: bigint;
|
|
73
74
|
};
|
|
74
75
|
fundingInfo: {
|
|
75
|
-
nextFundingRate:
|
|
76
|
-
lastFundingFeeTracker:
|
|
77
|
-
nextEpochTime:
|
|
76
|
+
nextFundingRate: bigint;
|
|
77
|
+
lastFundingFeeTracker: bigint;
|
|
78
|
+
nextEpochTime: bigint;
|
|
78
79
|
};
|
|
79
80
|
ioTracker: {
|
|
80
|
-
tracker:
|
|
81
|
-
longSize:
|
|
82
|
-
shortSize:
|
|
83
|
-
poolEntryPrice:
|
|
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<
|
|
88
|
+
declare const getUserGenesisShare: (chainId: ChainId, tokenAddress: string, account: string) => Promise<bigint>;
|
|
88
89
|
|
|
89
|
-
declare const addTpSl: (params: AddTpSLParams) => Promise<
|
|
90
|
+
declare const addTpSl: (params: AddTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
90
91
|
|
|
91
|
-
declare const cancelTpSl: (params: CancelTpSLParams) => Promise<
|
|
92
|
+
declare const cancelTpSl: (params: CancelTpSLParams) => Promise<ethers.ContractTransactionReceipt | null>;
|
|
92
93
|
|
|
93
|
-
declare const reprime: (chainId: ChainId, poolId: string, marketId: string) => Promise<
|
|
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<
|
|
891
|
-
declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
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<
|
|
894
|
+
declare const deposit$1: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
894
895
|
|
|
895
|
-
declare const withdraw$1: (params: WithdrawParams) => Promise<
|
|
896
|
+
declare const withdraw$1: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
|
|
896
897
|
|
|
897
|
-
declare const getRewards$1: (params: RewardsParams) => Promise<
|
|
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:
|
|
901
|
-
rebateAmount:
|
|
901
|
+
baseAmountOut: bigint;
|
|
902
|
+
rebateAmount: bigint;
|
|
902
903
|
} | undefined>;
|
|
903
904
|
|
|
904
|
-
declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<
|
|
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<
|
|
914
|
+
declare const deposit: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
914
915
|
|
|
915
|
-
declare const withdraw: (params: WithdrawParams) => Promise<
|
|
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<
|
|
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<
|
|
920
|
+
declare const getRewards: (params: RewardsParams) => Promise<bigint | undefined>;
|
|
920
921
|
|
|
921
|
-
declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<
|
|
922
|
-
declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
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<
|
|
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<
|
|
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<
|
|
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:
|
|
983
|
-
symbol:
|
|
984
|
-
decimals:
|
|
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<
|
|
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:
|
|
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:
|
|
1559
|
+
masterAddress: string;
|
|
1552
1560
|
seamlessAccount: string;
|
|
1553
|
-
authorized:
|
|
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:
|
|
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:
|
|
1661
|
-
blockNumber:
|
|
1662
|
-
gasUsed:
|
|
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:
|
|
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:
|
|
1689
|
-
blockNumber:
|
|
1690
|
-
gasUsed:
|
|
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:
|
|
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:
|
|
1718
|
-
blockNumber:
|
|
1719
|
-
gasUsed:
|
|
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:
|
|
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:
|
|
1741
|
-
blockNumber:
|
|
1742
|
-
gasUsed:
|
|
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:
|
|
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:
|
|
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.
|
|
1825
|
+
version: "0.1.133",
|
|
1826
1826
|
private: false,
|
|
1827
1827
|
publishConfig: {
|
|
1828
1828
|
access: "public"
|
|
@@ -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
|
|
14316
|
-
|
|
14317
|
-
|
|
14318
|
-
|
|
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
|
|
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.
|
|
1735
|
+
version: "0.1.133",
|
|
1736
1736
|
private: false,
|
|
1737
1737
|
publishConfig: {
|
|
1738
1738
|
access: "public"
|
|
@@ -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
|
|
14226
|
-
|
|
14227
|
-
|
|
14228
|
-
|
|
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
|
|
14241
|
+
amount: depositAmount.toString()
|
|
14233
14242
|
};
|
|
14234
14243
|
const data = {
|
|
14235
14244
|
user: params.address,
|