@myx-trade/sdk 0.1.121 → 0.1.123
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 +82 -74
- package/dist/index.d.ts +82 -74
- package/dist/index.js +3 -17
- package/dist/index.mjs +3 -17
- 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
|
|
@@ -885,21 +886,21 @@ interface PreviewWithdrawDataParams {
|
|
|
885
886
|
amount: string | number;
|
|
886
887
|
}
|
|
887
888
|
|
|
888
|
-
declare const claimBasePoolRebate: (params: ClaimParams) => Promise<
|
|
889
|
-
declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
889
|
+
declare const claimBasePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
890
|
+
declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
890
891
|
|
|
891
|
-
declare const deposit$1: (params: Deposit) => Promise<
|
|
892
|
+
declare const deposit$1: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
892
893
|
|
|
893
|
-
declare const withdraw$1: (params: WithdrawParams) => Promise<
|
|
894
|
+
declare const withdraw$1: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
|
|
894
895
|
|
|
895
|
-
declare const getRewards$1: (params: RewardsParams) => Promise<
|
|
896
|
+
declare const getRewards$1: (params: RewardsParams) => Promise<bigint | undefined>;
|
|
896
897
|
|
|
897
898
|
declare const previewUserWithdrawData: ({ chainId, account, poolId, amount }: PreviewWithdrawDataParams) => Promise<{
|
|
898
|
-
baseAmountOut:
|
|
899
|
-
rebateAmount:
|
|
899
|
+
baseAmountOut: bigint;
|
|
900
|
+
rebateAmount: bigint;
|
|
900
901
|
} | undefined>;
|
|
901
902
|
|
|
902
|
-
declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<
|
|
903
|
+
declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
|
|
903
904
|
|
|
904
905
|
declare const index$2_claimBasePoolRebate: typeof claimBasePoolRebate;
|
|
905
906
|
declare const index$2_claimBasePoolRebates: typeof claimBasePoolRebates;
|
|
@@ -908,18 +909,18 @@ declare namespace index$2 {
|
|
|
908
909
|
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 };
|
|
909
910
|
}
|
|
910
911
|
|
|
911
|
-
declare const deposit: (params: Deposit) => Promise<
|
|
912
|
+
declare const deposit: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
912
913
|
|
|
913
|
-
declare const withdraw: (params: WithdrawParams) => Promise<
|
|
914
|
+
declare const withdraw: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
|
|
914
915
|
|
|
915
|
-
declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<
|
|
916
|
+
declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<ethers.ContractTransactionResponse | null>;
|
|
916
917
|
|
|
917
|
-
declare const getRewards: (params: RewardsParams) => Promise<
|
|
918
|
+
declare const getRewards: (params: RewardsParams) => Promise<bigint | undefined>;
|
|
918
919
|
|
|
919
|
-
declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<
|
|
920
|
-
declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
920
|
+
declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
921
|
+
declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
921
922
|
|
|
922
|
-
declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<
|
|
923
|
+
declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
|
|
923
924
|
|
|
924
925
|
declare const index$1_claimQuotePoolRebate: typeof claimQuotePoolRebate;
|
|
925
926
|
declare const index$1_claimQuotePoolRebates: typeof claimQuotePoolRebates;
|
|
@@ -932,9 +933,16 @@ declare namespace index$1 {
|
|
|
932
933
|
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 };
|
|
933
934
|
}
|
|
934
935
|
|
|
935
|
-
declare const getMarket: (chainId: ChainId, marketId: string) => Promise<
|
|
936
|
+
declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, bigint, bigint, bigint, bigint, bigint] & {
|
|
937
|
+
quoteToken: string;
|
|
938
|
+
baseReserveRatio: bigint;
|
|
939
|
+
quoteReserveRatio: bigint;
|
|
940
|
+
oracleFeeUsd: bigint;
|
|
941
|
+
oracleRefundFeeUsd: bigint;
|
|
942
|
+
poolPrimeThreshold: bigint;
|
|
943
|
+
}) | undefined>;
|
|
936
944
|
|
|
937
|
-
declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<
|
|
945
|
+
declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<bigint | undefined>;
|
|
938
946
|
|
|
939
947
|
declare const index_getMarket: typeof getMarket;
|
|
940
948
|
declare const index_getOracleFee: typeof getOracleFee;
|
|
@@ -977,9 +985,9 @@ declare const bigintAmountSlipperCalculator: (amount: bigint, slipper?: Number)
|
|
|
977
985
|
declare const getTokenInfo: (chainId: number, tokenAddress: string, account?: string) => Promise<{
|
|
978
986
|
balance?: number | undefined;
|
|
979
987
|
address: string;
|
|
980
|
-
name:
|
|
981
|
-
symbol:
|
|
982
|
-
decimals:
|
|
988
|
+
name: string;
|
|
989
|
+
symbol: string;
|
|
990
|
+
decimals: bigint;
|
|
983
991
|
icon: string;
|
|
984
992
|
totalSupply: number;
|
|
985
993
|
}>;
|
|
@@ -1193,7 +1201,7 @@ interface MyxClientConfig {
|
|
|
1193
1201
|
signer?: Signer;
|
|
1194
1202
|
seamlessAccount?: {
|
|
1195
1203
|
masterAddress: string;
|
|
1196
|
-
wallet: ethers.Wallet | null;
|
|
1204
|
+
wallet: ethers$1.Wallet | null;
|
|
1197
1205
|
authorized: boolean;
|
|
1198
1206
|
};
|
|
1199
1207
|
walletClient?: WalletClient;
|
|
@@ -1213,7 +1221,7 @@ declare class ConfigManager {
|
|
|
1213
1221
|
clear(): void;
|
|
1214
1222
|
startSeamlessMode(open: boolean): MyxClientConfig;
|
|
1215
1223
|
updateSeamlessWallet({ wallet, authorized, masterAddress }: {
|
|
1216
|
-
wallet?: ethers.Wallet;
|
|
1224
|
+
wallet?: ethers$1.Wallet;
|
|
1217
1225
|
authorized?: boolean;
|
|
1218
1226
|
masterAddress?: string;
|
|
1219
1227
|
}): void;
|
|
@@ -1321,7 +1329,7 @@ declare class Utils {
|
|
|
1321
1329
|
quoteAddress: string;
|
|
1322
1330
|
amount?: string;
|
|
1323
1331
|
spenderAddress?: string;
|
|
1324
|
-
signer?: ethers.Signer;
|
|
1332
|
+
signer?: ethers$1.Signer;
|
|
1325
1333
|
}): Promise<{
|
|
1326
1334
|
code: number;
|
|
1327
1335
|
message: any;
|
|
@@ -1488,9 +1496,9 @@ declare class Seamless {
|
|
|
1488
1496
|
private utils;
|
|
1489
1497
|
private account;
|
|
1490
1498
|
constructor(configManager: ConfigManager, logger: Logger, utils: Utils, account: Account);
|
|
1491
|
-
onCheckRelayer(account: string, relayer: string): Promise<
|
|
1499
|
+
onCheckRelayer(account: string, relayer: string): Promise<boolean>;
|
|
1492
1500
|
getUSDPermitParams(deadline: number): Promise<{
|
|
1493
|
-
token: string | ethers.Addressable;
|
|
1501
|
+
token: string | ethers$1.Addressable;
|
|
1494
1502
|
owner: Promise<string> | undefined;
|
|
1495
1503
|
spender: string;
|
|
1496
1504
|
value: bigint;
|
|
@@ -1507,7 +1515,7 @@ declare class Seamless {
|
|
|
1507
1515
|
deadline: number;
|
|
1508
1516
|
data: string;
|
|
1509
1517
|
nonce: string;
|
|
1510
|
-
}, chainId: number, provider?: ethers.Signer): Promise<ApiResponse<any>>;
|
|
1518
|
+
}, chainId: number, provider?: ethers$1.Signer): Promise<ApiResponse<any>>;
|
|
1511
1519
|
authorizeSeamlessAccount({ approve, seamlessAddress, chainId }: {
|
|
1512
1520
|
approve: boolean;
|
|
1513
1521
|
seamlessAddress: string;
|
|
@@ -1528,7 +1536,7 @@ declare class Seamless {
|
|
|
1528
1536
|
data: {
|
|
1529
1537
|
masterAddress: string;
|
|
1530
1538
|
seamlessAccount: string;
|
|
1531
|
-
authorized:
|
|
1539
|
+
authorized: boolean;
|
|
1532
1540
|
};
|
|
1533
1541
|
}>;
|
|
1534
1542
|
exportSeamlessPrivateKey({ password, apiKey }: {
|
|
@@ -1546,9 +1554,9 @@ declare class Seamless {
|
|
|
1546
1554
|
}): Promise<{
|
|
1547
1555
|
code: number;
|
|
1548
1556
|
data: {
|
|
1549
|
-
masterAddress:
|
|
1557
|
+
masterAddress: string;
|
|
1550
1558
|
seamlessAccount: string;
|
|
1551
|
-
authorized:
|
|
1559
|
+
authorized: boolean;
|
|
1552
1560
|
apiKey: string;
|
|
1553
1561
|
};
|
|
1554
1562
|
}>;
|
|
@@ -1568,7 +1576,7 @@ declare class Seamless {
|
|
|
1568
1576
|
data: {
|
|
1569
1577
|
masterAddress: string;
|
|
1570
1578
|
seamlessAccount: string;
|
|
1571
|
-
authorized:
|
|
1579
|
+
authorized: boolean;
|
|
1572
1580
|
apiKey: string;
|
|
1573
1581
|
};
|
|
1574
1582
|
message?: undefined;
|
|
@@ -1655,13 +1663,13 @@ declare class Order {
|
|
|
1655
1663
|
data: {
|
|
1656
1664
|
success: boolean;
|
|
1657
1665
|
orderId: string | null;
|
|
1658
|
-
transactionHash:
|
|
1659
|
-
blockNumber:
|
|
1660
|
-
gasUsed:
|
|
1666
|
+
transactionHash: string;
|
|
1667
|
+
blockNumber: number | undefined;
|
|
1668
|
+
gasUsed: string | undefined;
|
|
1661
1669
|
status: string;
|
|
1662
1670
|
confirmations: number;
|
|
1663
1671
|
timestamp: number;
|
|
1664
|
-
receipt:
|
|
1672
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1665
1673
|
};
|
|
1666
1674
|
} | {
|
|
1667
1675
|
code: number;
|
|
@@ -1683,13 +1691,13 @@ declare class Order {
|
|
|
1683
1691
|
code: number;
|
|
1684
1692
|
message: string;
|
|
1685
1693
|
data: string | null;
|
|
1686
|
-
transactionHash:
|
|
1687
|
-
blockNumber:
|
|
1688
|
-
gasUsed:
|
|
1694
|
+
transactionHash: string;
|
|
1695
|
+
blockNumber: number | undefined;
|
|
1696
|
+
gasUsed: string | undefined;
|
|
1689
1697
|
status: string;
|
|
1690
1698
|
confirmations: number;
|
|
1691
1699
|
timestamp: number;
|
|
1692
|
-
receipt:
|
|
1700
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1693
1701
|
} | {
|
|
1694
1702
|
code: number;
|
|
1695
1703
|
message: any;
|
|
@@ -1712,13 +1720,13 @@ declare class Order {
|
|
|
1712
1720
|
data: {
|
|
1713
1721
|
success: boolean;
|
|
1714
1722
|
orderId: string | null;
|
|
1715
|
-
transactionHash:
|
|
1716
|
-
blockNumber:
|
|
1717
|
-
gasUsed:
|
|
1723
|
+
transactionHash: string;
|
|
1724
|
+
blockNumber: number | undefined;
|
|
1725
|
+
gasUsed: string | undefined;
|
|
1718
1726
|
status: string;
|
|
1719
1727
|
confirmations: number;
|
|
1720
1728
|
timestamp: number;
|
|
1721
|
-
receipt:
|
|
1729
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1722
1730
|
};
|
|
1723
1731
|
} | {
|
|
1724
1732
|
code: number;
|
|
@@ -1735,13 +1743,13 @@ declare class Order {
|
|
|
1735
1743
|
data: {
|
|
1736
1744
|
success: boolean;
|
|
1737
1745
|
orderId: string | null;
|
|
1738
|
-
transactionHash:
|
|
1739
|
-
blockNumber:
|
|
1740
|
-
gasUsed:
|
|
1746
|
+
transactionHash: string;
|
|
1747
|
+
blockNumber: number | undefined;
|
|
1748
|
+
gasUsed: string | undefined;
|
|
1741
1749
|
status: string;
|
|
1742
1750
|
confirmations: number;
|
|
1743
1751
|
timestamp: number;
|
|
1744
|
-
receipt:
|
|
1752
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1745
1753
|
};
|
|
1746
1754
|
} | {
|
|
1747
1755
|
code: number;
|
|
@@ -1767,7 +1775,7 @@ declare class Order {
|
|
|
1767
1775
|
}>;
|
|
1768
1776
|
updateOrderTpSl(params: UpdateOrderParams, quoteAddress: string, chainId: number): Promise<{
|
|
1769
1777
|
code: number;
|
|
1770
|
-
data:
|
|
1778
|
+
data: ethers$1.ContractTransactionReceipt | null;
|
|
1771
1779
|
message: string;
|
|
1772
1780
|
} | {
|
|
1773
1781
|
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
|
|
@@ -885,21 +886,21 @@ interface PreviewWithdrawDataParams {
|
|
|
885
886
|
amount: string | number;
|
|
886
887
|
}
|
|
887
888
|
|
|
888
|
-
declare const claimBasePoolRebate: (params: ClaimParams) => Promise<
|
|
889
|
-
declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
889
|
+
declare const claimBasePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
890
|
+
declare const claimBasePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
890
891
|
|
|
891
|
-
declare const deposit$1: (params: Deposit) => Promise<
|
|
892
|
+
declare const deposit$1: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
892
893
|
|
|
893
|
-
declare const withdraw$1: (params: WithdrawParams) => Promise<
|
|
894
|
+
declare const withdraw$1: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
|
|
894
895
|
|
|
895
|
-
declare const getRewards$1: (params: RewardsParams) => Promise<
|
|
896
|
+
declare const getRewards$1: (params: RewardsParams) => Promise<bigint | undefined>;
|
|
896
897
|
|
|
897
898
|
declare const previewUserWithdrawData: ({ chainId, account, poolId, amount }: PreviewWithdrawDataParams) => Promise<{
|
|
898
|
-
baseAmountOut:
|
|
899
|
-
rebateAmount:
|
|
899
|
+
baseAmountOut: bigint;
|
|
900
|
+
rebateAmount: bigint;
|
|
900
901
|
} | undefined>;
|
|
901
902
|
|
|
902
|
-
declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<
|
|
903
|
+
declare const getLpPrice$1: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
|
|
903
904
|
|
|
904
905
|
declare const index$2_claimBasePoolRebate: typeof claimBasePoolRebate;
|
|
905
906
|
declare const index$2_claimBasePoolRebates: typeof claimBasePoolRebates;
|
|
@@ -908,18 +909,18 @@ declare namespace index$2 {
|
|
|
908
909
|
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 };
|
|
909
910
|
}
|
|
910
911
|
|
|
911
|
-
declare const deposit: (params: Deposit) => Promise<
|
|
912
|
+
declare const deposit: (params: Deposit) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
912
913
|
|
|
913
|
-
declare const withdraw: (params: WithdrawParams) => Promise<
|
|
914
|
+
declare const withdraw: (params: WithdrawParams) => Promise<ethers.ContractTransactionReceipt | null | undefined>;
|
|
914
915
|
|
|
915
|
-
declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<
|
|
916
|
+
declare const transfer: (chainId: ChainId, fromPoolId: string, toPoolId: string, amount: number) => Promise<ethers.ContractTransactionResponse | null>;
|
|
916
917
|
|
|
917
|
-
declare const getRewards: (params: RewardsParams) => Promise<
|
|
918
|
+
declare const getRewards: (params: RewardsParams) => Promise<bigint | undefined>;
|
|
918
919
|
|
|
919
|
-
declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<
|
|
920
|
-
declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<
|
|
920
|
+
declare const claimQuotePoolRebate: (params: ClaimParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
921
|
+
declare const claimQuotePoolRebates: (params: ClaimRebatesParams) => Promise<ethers.ContractTransactionResponse | undefined>;
|
|
921
922
|
|
|
922
|
-
declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<
|
|
923
|
+
declare const getLpPrice: (chainId: ChainId, poolId: string) => Promise<bigint | undefined>;
|
|
923
924
|
|
|
924
925
|
declare const index$1_claimQuotePoolRebate: typeof claimQuotePoolRebate;
|
|
925
926
|
declare const index$1_claimQuotePoolRebates: typeof claimQuotePoolRebates;
|
|
@@ -932,9 +933,16 @@ declare namespace index$1 {
|
|
|
932
933
|
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 };
|
|
933
934
|
}
|
|
934
935
|
|
|
935
|
-
declare const getMarket: (chainId: ChainId, marketId: string) => Promise<
|
|
936
|
+
declare const getMarket: (chainId: ChainId, marketId: string) => Promise<([string, bigint, bigint, bigint, bigint, bigint] & {
|
|
937
|
+
quoteToken: string;
|
|
938
|
+
baseReserveRatio: bigint;
|
|
939
|
+
quoteReserveRatio: bigint;
|
|
940
|
+
oracleFeeUsd: bigint;
|
|
941
|
+
oracleRefundFeeUsd: bigint;
|
|
942
|
+
poolPrimeThreshold: bigint;
|
|
943
|
+
}) | undefined>;
|
|
936
944
|
|
|
937
|
-
declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<
|
|
945
|
+
declare const getOracleFee: (chainId: ChainId, marketId: string) => Promise<bigint | undefined>;
|
|
938
946
|
|
|
939
947
|
declare const index_getMarket: typeof getMarket;
|
|
940
948
|
declare const index_getOracleFee: typeof getOracleFee;
|
|
@@ -977,9 +985,9 @@ declare const bigintAmountSlipperCalculator: (amount: bigint, slipper?: Number)
|
|
|
977
985
|
declare const getTokenInfo: (chainId: number, tokenAddress: string, account?: string) => Promise<{
|
|
978
986
|
balance?: number | undefined;
|
|
979
987
|
address: string;
|
|
980
|
-
name:
|
|
981
|
-
symbol:
|
|
982
|
-
decimals:
|
|
988
|
+
name: string;
|
|
989
|
+
symbol: string;
|
|
990
|
+
decimals: bigint;
|
|
983
991
|
icon: string;
|
|
984
992
|
totalSupply: number;
|
|
985
993
|
}>;
|
|
@@ -1193,7 +1201,7 @@ interface MyxClientConfig {
|
|
|
1193
1201
|
signer?: Signer;
|
|
1194
1202
|
seamlessAccount?: {
|
|
1195
1203
|
masterAddress: string;
|
|
1196
|
-
wallet: ethers.Wallet | null;
|
|
1204
|
+
wallet: ethers$1.Wallet | null;
|
|
1197
1205
|
authorized: boolean;
|
|
1198
1206
|
};
|
|
1199
1207
|
walletClient?: WalletClient;
|
|
@@ -1213,7 +1221,7 @@ declare class ConfigManager {
|
|
|
1213
1221
|
clear(): void;
|
|
1214
1222
|
startSeamlessMode(open: boolean): MyxClientConfig;
|
|
1215
1223
|
updateSeamlessWallet({ wallet, authorized, masterAddress }: {
|
|
1216
|
-
wallet?: ethers.Wallet;
|
|
1224
|
+
wallet?: ethers$1.Wallet;
|
|
1217
1225
|
authorized?: boolean;
|
|
1218
1226
|
masterAddress?: string;
|
|
1219
1227
|
}): void;
|
|
@@ -1321,7 +1329,7 @@ declare class Utils {
|
|
|
1321
1329
|
quoteAddress: string;
|
|
1322
1330
|
amount?: string;
|
|
1323
1331
|
spenderAddress?: string;
|
|
1324
|
-
signer?: ethers.Signer;
|
|
1332
|
+
signer?: ethers$1.Signer;
|
|
1325
1333
|
}): Promise<{
|
|
1326
1334
|
code: number;
|
|
1327
1335
|
message: any;
|
|
@@ -1488,9 +1496,9 @@ declare class Seamless {
|
|
|
1488
1496
|
private utils;
|
|
1489
1497
|
private account;
|
|
1490
1498
|
constructor(configManager: ConfigManager, logger: Logger, utils: Utils, account: Account);
|
|
1491
|
-
onCheckRelayer(account: string, relayer: string): Promise<
|
|
1499
|
+
onCheckRelayer(account: string, relayer: string): Promise<boolean>;
|
|
1492
1500
|
getUSDPermitParams(deadline: number): Promise<{
|
|
1493
|
-
token: string | ethers.Addressable;
|
|
1501
|
+
token: string | ethers$1.Addressable;
|
|
1494
1502
|
owner: Promise<string> | undefined;
|
|
1495
1503
|
spender: string;
|
|
1496
1504
|
value: bigint;
|
|
@@ -1507,7 +1515,7 @@ declare class Seamless {
|
|
|
1507
1515
|
deadline: number;
|
|
1508
1516
|
data: string;
|
|
1509
1517
|
nonce: string;
|
|
1510
|
-
}, chainId: number, provider?: ethers.Signer): Promise<ApiResponse<any>>;
|
|
1518
|
+
}, chainId: number, provider?: ethers$1.Signer): Promise<ApiResponse<any>>;
|
|
1511
1519
|
authorizeSeamlessAccount({ approve, seamlessAddress, chainId }: {
|
|
1512
1520
|
approve: boolean;
|
|
1513
1521
|
seamlessAddress: string;
|
|
@@ -1528,7 +1536,7 @@ declare class Seamless {
|
|
|
1528
1536
|
data: {
|
|
1529
1537
|
masterAddress: string;
|
|
1530
1538
|
seamlessAccount: string;
|
|
1531
|
-
authorized:
|
|
1539
|
+
authorized: boolean;
|
|
1532
1540
|
};
|
|
1533
1541
|
}>;
|
|
1534
1542
|
exportSeamlessPrivateKey({ password, apiKey }: {
|
|
@@ -1546,9 +1554,9 @@ declare class Seamless {
|
|
|
1546
1554
|
}): Promise<{
|
|
1547
1555
|
code: number;
|
|
1548
1556
|
data: {
|
|
1549
|
-
masterAddress:
|
|
1557
|
+
masterAddress: string;
|
|
1550
1558
|
seamlessAccount: string;
|
|
1551
|
-
authorized:
|
|
1559
|
+
authorized: boolean;
|
|
1552
1560
|
apiKey: string;
|
|
1553
1561
|
};
|
|
1554
1562
|
}>;
|
|
@@ -1568,7 +1576,7 @@ declare class Seamless {
|
|
|
1568
1576
|
data: {
|
|
1569
1577
|
masterAddress: string;
|
|
1570
1578
|
seamlessAccount: string;
|
|
1571
|
-
authorized:
|
|
1579
|
+
authorized: boolean;
|
|
1572
1580
|
apiKey: string;
|
|
1573
1581
|
};
|
|
1574
1582
|
message?: undefined;
|
|
@@ -1655,13 +1663,13 @@ declare class Order {
|
|
|
1655
1663
|
data: {
|
|
1656
1664
|
success: boolean;
|
|
1657
1665
|
orderId: string | null;
|
|
1658
|
-
transactionHash:
|
|
1659
|
-
blockNumber:
|
|
1660
|
-
gasUsed:
|
|
1666
|
+
transactionHash: string;
|
|
1667
|
+
blockNumber: number | undefined;
|
|
1668
|
+
gasUsed: string | undefined;
|
|
1661
1669
|
status: string;
|
|
1662
1670
|
confirmations: number;
|
|
1663
1671
|
timestamp: number;
|
|
1664
|
-
receipt:
|
|
1672
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1665
1673
|
};
|
|
1666
1674
|
} | {
|
|
1667
1675
|
code: number;
|
|
@@ -1683,13 +1691,13 @@ declare class Order {
|
|
|
1683
1691
|
code: number;
|
|
1684
1692
|
message: string;
|
|
1685
1693
|
data: string | null;
|
|
1686
|
-
transactionHash:
|
|
1687
|
-
blockNumber:
|
|
1688
|
-
gasUsed:
|
|
1694
|
+
transactionHash: string;
|
|
1695
|
+
blockNumber: number | undefined;
|
|
1696
|
+
gasUsed: string | undefined;
|
|
1689
1697
|
status: string;
|
|
1690
1698
|
confirmations: number;
|
|
1691
1699
|
timestamp: number;
|
|
1692
|
-
receipt:
|
|
1700
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1693
1701
|
} | {
|
|
1694
1702
|
code: number;
|
|
1695
1703
|
message: any;
|
|
@@ -1712,13 +1720,13 @@ declare class Order {
|
|
|
1712
1720
|
data: {
|
|
1713
1721
|
success: boolean;
|
|
1714
1722
|
orderId: string | null;
|
|
1715
|
-
transactionHash:
|
|
1716
|
-
blockNumber:
|
|
1717
|
-
gasUsed:
|
|
1723
|
+
transactionHash: string;
|
|
1724
|
+
blockNumber: number | undefined;
|
|
1725
|
+
gasUsed: string | undefined;
|
|
1718
1726
|
status: string;
|
|
1719
1727
|
confirmations: number;
|
|
1720
1728
|
timestamp: number;
|
|
1721
|
-
receipt:
|
|
1729
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1722
1730
|
};
|
|
1723
1731
|
} | {
|
|
1724
1732
|
code: number;
|
|
@@ -1735,13 +1743,13 @@ declare class Order {
|
|
|
1735
1743
|
data: {
|
|
1736
1744
|
success: boolean;
|
|
1737
1745
|
orderId: string | null;
|
|
1738
|
-
transactionHash:
|
|
1739
|
-
blockNumber:
|
|
1740
|
-
gasUsed:
|
|
1746
|
+
transactionHash: string;
|
|
1747
|
+
blockNumber: number | undefined;
|
|
1748
|
+
gasUsed: string | undefined;
|
|
1741
1749
|
status: string;
|
|
1742
1750
|
confirmations: number;
|
|
1743
1751
|
timestamp: number;
|
|
1744
|
-
receipt:
|
|
1752
|
+
receipt: ethers$1.ContractTransactionReceipt | null;
|
|
1745
1753
|
};
|
|
1746
1754
|
} | {
|
|
1747
1755
|
code: number;
|
|
@@ -1767,7 +1775,7 @@ declare class Order {
|
|
|
1767
1775
|
}>;
|
|
1768
1776
|
updateOrderTpSl(params: UpdateOrderParams, quoteAddress: string, chainId: number): Promise<{
|
|
1769
1777
|
code: number;
|
|
1770
|
-
data:
|
|
1778
|
+
data: ethers$1.ContractTransactionReceipt | null;
|
|
1771
1779
|
message: string;
|
|
1772
1780
|
} | {
|
|
1773
1781
|
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.123",
|
|
1826
1826
|
private: false,
|
|
1827
1827
|
publishConfig: {
|
|
1828
1828
|
access: "public"
|
|
@@ -14142,17 +14142,13 @@ var Position = class {
|
|
|
14142
14142
|
depositData,
|
|
14143
14143
|
positionId,
|
|
14144
14144
|
adjustAmount
|
|
14145
|
-
// {
|
|
14146
|
-
// value: BigInt(priceData?.value ?? "1"),
|
|
14147
|
-
// gas: 10000000n,
|
|
14148
|
-
// }
|
|
14149
14145
|
]);
|
|
14150
14146
|
const nonce = await forwarderContract.nonces(seamlessWallet.address);
|
|
14151
14147
|
const forwardTxParams = {
|
|
14152
14148
|
from: seamlessWallet.address ?? "",
|
|
14153
14149
|
to: this.configManager.getConfig().brokerAddress,
|
|
14154
|
-
value: "
|
|
14155
|
-
gas: "
|
|
14150
|
+
value: (priceData?.value ?? "1").toString(),
|
|
14151
|
+
gas: "10000000",
|
|
14156
14152
|
deadline: (0, import_dayjs.default)().add(60, "minute").unix(),
|
|
14157
14153
|
data: functionHash,
|
|
14158
14154
|
nonce: nonce.toString()
|
|
@@ -14291,16 +14287,6 @@ var Order = class {
|
|
|
14291
14287
|
params.executionFeeToken,
|
|
14292
14288
|
params.collateralAmount
|
|
14293
14289
|
);
|
|
14294
|
-
if (needsApproval) {
|
|
14295
|
-
const approvalResult = await this.utils.approveAuthorization({
|
|
14296
|
-
chainId: params.chainId,
|
|
14297
|
-
quoteAddress: params.executionFeeToken,
|
|
14298
|
-
amount: import_ethers24.ethers.MaxUint256.toString()
|
|
14299
|
-
});
|
|
14300
|
-
if (approvalResult.code !== 0) {
|
|
14301
|
-
throw new Error(approvalResult.message);
|
|
14302
|
-
}
|
|
14303
|
-
}
|
|
14304
14290
|
const marginAccountBalanceRes = await this.account.getTradableAmount({ poolId: params.poolId });
|
|
14305
14291
|
const marginAccountBalance = marginAccountBalanceRes?.data;
|
|
14306
14292
|
if (marginAccountBalanceRes.code !== 0) {
|
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.123",
|
|
1736
1736
|
private: false,
|
|
1737
1737
|
publishConfig: {
|
|
1738
1738
|
access: "public"
|
|
@@ -14052,17 +14052,13 @@ var Position = class {
|
|
|
14052
14052
|
depositData,
|
|
14053
14053
|
positionId,
|
|
14054
14054
|
adjustAmount
|
|
14055
|
-
// {
|
|
14056
|
-
// value: BigInt(priceData?.value ?? "1"),
|
|
14057
|
-
// gas: 10000000n,
|
|
14058
|
-
// }
|
|
14059
14055
|
]);
|
|
14060
14056
|
const nonce = await forwarderContract.nonces(seamlessWallet.address);
|
|
14061
14057
|
const forwardTxParams = {
|
|
14062
14058
|
from: seamlessWallet.address ?? "",
|
|
14063
14059
|
to: this.configManager.getConfig().brokerAddress,
|
|
14064
|
-
value: "
|
|
14065
|
-
gas: "
|
|
14060
|
+
value: (priceData?.value ?? "1").toString(),
|
|
14061
|
+
gas: "10000000",
|
|
14066
14062
|
deadline: dayjs().add(60, "minute").unix(),
|
|
14067
14063
|
data: functionHash,
|
|
14068
14064
|
nonce: nonce.toString()
|
|
@@ -14201,16 +14197,6 @@ var Order = class {
|
|
|
14201
14197
|
params.executionFeeToken,
|
|
14202
14198
|
params.collateralAmount
|
|
14203
14199
|
);
|
|
14204
|
-
if (needsApproval) {
|
|
14205
|
-
const approvalResult = await this.utils.approveAuthorization({
|
|
14206
|
-
chainId: params.chainId,
|
|
14207
|
-
quoteAddress: params.executionFeeToken,
|
|
14208
|
-
amount: ethers6.MaxUint256.toString()
|
|
14209
|
-
});
|
|
14210
|
-
if (approvalResult.code !== 0) {
|
|
14211
|
-
throw new Error(approvalResult.message);
|
|
14212
|
-
}
|
|
14213
|
-
}
|
|
14214
14200
|
const marginAccountBalanceRes = await this.account.getTradableAmount({ poolId: params.poolId });
|
|
14215
14201
|
const marginAccountBalance = marginAccountBalanceRes?.data;
|
|
14216
14202
|
if (marginAccountBalanceRes.code !== 0) {
|