@myx-trade/sdk 0.1.34 → 0.1.36
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 +10 -5
- package/dist/index.d.ts +10 -5
- package/dist/index.js +470 -98
- package/dist/index.mjs +471 -99
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -2,7 +2,7 @@ import * as ethers from 'ethers';
|
|
|
2
2
|
import { ZeroAddress, AddressLike, Signer, ethers as ethers$1 } from 'ethers';
|
|
3
3
|
export { formatUnits, parseUnits } from 'ethers';
|
|
4
4
|
import { Options, Event } from 'reconnecting-websocket';
|
|
5
|
-
import { WalletClient } from 'viem';
|
|
5
|
+
import { WalletClient, Address as Address$3 } from 'viem';
|
|
6
6
|
|
|
7
7
|
type Address$2 = `0x${string}` | typeof ZeroAddress;
|
|
8
8
|
declare enum ChainId {
|
|
@@ -128,7 +128,7 @@ declare const TimeInForce: {
|
|
|
128
128
|
};
|
|
129
129
|
type TimeInForce = (typeof TimeInForce)[keyof typeof TimeInForce];
|
|
130
130
|
interface Position$1 {
|
|
131
|
-
|
|
131
|
+
positionId: string;
|
|
132
132
|
poolId: string;
|
|
133
133
|
direction: Direction;
|
|
134
134
|
size: string;
|
|
@@ -145,7 +145,7 @@ interface Position$1 {
|
|
|
145
145
|
interface Order$1 {
|
|
146
146
|
orderId: string;
|
|
147
147
|
poolId: string;
|
|
148
|
-
|
|
148
|
+
positionId: string;
|
|
149
149
|
orderType: OrderType;
|
|
150
150
|
triggerType: TriggerType;
|
|
151
151
|
operation: OperationType;
|
|
@@ -175,7 +175,7 @@ interface PlaceOrderParams {
|
|
|
175
175
|
chainId: number;
|
|
176
176
|
address: string;
|
|
177
177
|
poolId: string;
|
|
178
|
-
|
|
178
|
+
positionId: number;
|
|
179
179
|
orderType: OrderType;
|
|
180
180
|
triggerType: TriggerType;
|
|
181
181
|
direction: Direction;
|
|
@@ -196,7 +196,7 @@ interface PositionTpSlOrderParams {
|
|
|
196
196
|
chainId: number;
|
|
197
197
|
address: string;
|
|
198
198
|
poolId: string;
|
|
199
|
-
|
|
199
|
+
positionId: number;
|
|
200
200
|
executionFeeToken: string;
|
|
201
201
|
tpTriggerType: TriggerType;
|
|
202
202
|
slTriggerType: TriggerType;
|
|
@@ -1180,7 +1180,11 @@ declare class ConfigManager {
|
|
|
1180
1180
|
* @param forceRefresh 是否强制刷新
|
|
1181
1181
|
* @returns Promise<string | null> 有效的 accessToken 或 null
|
|
1182
1182
|
*/
|
|
1183
|
+
private _getAccessTokenQueue;
|
|
1184
|
+
private _isGettingAccessToken;
|
|
1183
1185
|
getAccessToken(forceRefresh?: boolean): Promise<string | null>;
|
|
1186
|
+
private _processAccessTokenQueue;
|
|
1187
|
+
private _getAccessToken;
|
|
1184
1188
|
/**
|
|
1185
1189
|
* 设置 accessToken 和过期时间
|
|
1186
1190
|
* @param token accessToken
|
|
@@ -1425,6 +1429,7 @@ declare class Order {
|
|
|
1425
1429
|
private logger;
|
|
1426
1430
|
private utils;
|
|
1427
1431
|
constructor(configManager: ConfigManager, logger: Logger, utils: Utils);
|
|
1432
|
+
createPositionId(poolId: string, user: Address$3, direction: Direction, salt: bigint): Promise<string>;
|
|
1428
1433
|
createIncreaseOrder(params: PlaceOrderParams): Promise<{
|
|
1429
1434
|
code: number;
|
|
1430
1435
|
message: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as ethers from 'ethers';
|
|
|
2
2
|
import { ZeroAddress, AddressLike, Signer, ethers as ethers$1 } from 'ethers';
|
|
3
3
|
export { formatUnits, parseUnits } from 'ethers';
|
|
4
4
|
import { Options, Event } from 'reconnecting-websocket';
|
|
5
|
-
import { WalletClient } from 'viem';
|
|
5
|
+
import { WalletClient, Address as Address$3 } from 'viem';
|
|
6
6
|
|
|
7
7
|
type Address$2 = `0x${string}` | typeof ZeroAddress;
|
|
8
8
|
declare enum ChainId {
|
|
@@ -128,7 +128,7 @@ declare const TimeInForce: {
|
|
|
128
128
|
};
|
|
129
129
|
type TimeInForce = (typeof TimeInForce)[keyof typeof TimeInForce];
|
|
130
130
|
interface Position$1 {
|
|
131
|
-
|
|
131
|
+
positionId: string;
|
|
132
132
|
poolId: string;
|
|
133
133
|
direction: Direction;
|
|
134
134
|
size: string;
|
|
@@ -145,7 +145,7 @@ interface Position$1 {
|
|
|
145
145
|
interface Order$1 {
|
|
146
146
|
orderId: string;
|
|
147
147
|
poolId: string;
|
|
148
|
-
|
|
148
|
+
positionId: string;
|
|
149
149
|
orderType: OrderType;
|
|
150
150
|
triggerType: TriggerType;
|
|
151
151
|
operation: OperationType;
|
|
@@ -175,7 +175,7 @@ interface PlaceOrderParams {
|
|
|
175
175
|
chainId: number;
|
|
176
176
|
address: string;
|
|
177
177
|
poolId: string;
|
|
178
|
-
|
|
178
|
+
positionId: number;
|
|
179
179
|
orderType: OrderType;
|
|
180
180
|
triggerType: TriggerType;
|
|
181
181
|
direction: Direction;
|
|
@@ -196,7 +196,7 @@ interface PositionTpSlOrderParams {
|
|
|
196
196
|
chainId: number;
|
|
197
197
|
address: string;
|
|
198
198
|
poolId: string;
|
|
199
|
-
|
|
199
|
+
positionId: number;
|
|
200
200
|
executionFeeToken: string;
|
|
201
201
|
tpTriggerType: TriggerType;
|
|
202
202
|
slTriggerType: TriggerType;
|
|
@@ -1180,7 +1180,11 @@ declare class ConfigManager {
|
|
|
1180
1180
|
* @param forceRefresh 是否强制刷新
|
|
1181
1181
|
* @returns Promise<string | null> 有效的 accessToken 或 null
|
|
1182
1182
|
*/
|
|
1183
|
+
private _getAccessTokenQueue;
|
|
1184
|
+
private _isGettingAccessToken;
|
|
1183
1185
|
getAccessToken(forceRefresh?: boolean): Promise<string | null>;
|
|
1186
|
+
private _processAccessTokenQueue;
|
|
1187
|
+
private _getAccessToken;
|
|
1184
1188
|
/**
|
|
1185
1189
|
* 设置 accessToken 和过期时间
|
|
1186
1190
|
* @param token accessToken
|
|
@@ -1425,6 +1429,7 @@ declare class Order {
|
|
|
1425
1429
|
private logger;
|
|
1426
1430
|
private utils;
|
|
1427
1431
|
constructor(configManager: ConfigManager, logger: Logger, utils: Utils);
|
|
1432
|
+
createPositionId(poolId: string, user: Address$3, direction: Direction, salt: bigint): Promise<string>;
|
|
1428
1433
|
createIncreaseOrder(params: PlaceOrderParams): Promise<{
|
|
1429
1434
|
code: number;
|
|
1430
1435
|
message: string;
|