@myx-trade/sdk 0.1.206 → 0.1.208
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 +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -11
- package/dist/index.mjs +6 -11
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1486,10 +1486,12 @@ declare class Api {
|
|
|
1486
1486
|
getHistoryOrders({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest): Promise<ApiResponse<HistoryOrderItem[]>>;
|
|
1487
1487
|
getPositionHistory({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest): Promise<ApiResponse<PositionHistoryItem[]>>;
|
|
1488
1488
|
getMarketList(): Promise<ApiResponse<MarketInfo[]>>;
|
|
1489
|
-
getAccountVipInfo({ address, accessToken, chainId }: {
|
|
1489
|
+
getAccountVipInfo({ address, accessToken, chainId, deadline, nonce }: {
|
|
1490
1490
|
address: string;
|
|
1491
1491
|
accessToken: string;
|
|
1492
1492
|
chainId: number;
|
|
1493
|
+
deadline: number;
|
|
1494
|
+
nonce: string;
|
|
1493
1495
|
}): Promise<ApiResponse<any>>;
|
|
1494
1496
|
}
|
|
1495
1497
|
|
|
@@ -1626,7 +1628,7 @@ declare class Account {
|
|
|
1626
1628
|
message: string;
|
|
1627
1629
|
data?: undefined;
|
|
1628
1630
|
}>;
|
|
1629
|
-
getAccountVipInfoByBackend(address: string, chainId: number): Promise<{
|
|
1631
|
+
getAccountVipInfoByBackend(address: string, chainId: number, deadline: number, nonce: string): Promise<{
|
|
1630
1632
|
code: number;
|
|
1631
1633
|
data: any;
|
|
1632
1634
|
message?: undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1486,10 +1486,12 @@ declare class Api {
|
|
|
1486
1486
|
getHistoryOrders({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest): Promise<ApiResponse<HistoryOrderItem[]>>;
|
|
1487
1487
|
getPositionHistory({ accessToken, address, ...params }: GetHistoryOrdersParams & AccessTokenRequest): Promise<ApiResponse<PositionHistoryItem[]>>;
|
|
1488
1488
|
getMarketList(): Promise<ApiResponse<MarketInfo[]>>;
|
|
1489
|
-
getAccountVipInfo({ address, accessToken, chainId }: {
|
|
1489
|
+
getAccountVipInfo({ address, accessToken, chainId, deadline, nonce }: {
|
|
1490
1490
|
address: string;
|
|
1491
1491
|
accessToken: string;
|
|
1492
1492
|
chainId: number;
|
|
1493
|
+
deadline: number;
|
|
1494
|
+
nonce: string;
|
|
1493
1495
|
}): Promise<ApiResponse<any>>;
|
|
1494
1496
|
}
|
|
1495
1497
|
|
|
@@ -1626,7 +1628,7 @@ declare class Account {
|
|
|
1626
1628
|
message: string;
|
|
1627
1629
|
data?: undefined;
|
|
1628
1630
|
}>;
|
|
1629
|
-
getAccountVipInfoByBackend(address: string, chainId: number): Promise<{
|
|
1631
|
+
getAccountVipInfoByBackend(address: string, chainId: number, deadline: number, nonce: string): Promise<{
|
|
1630
1632
|
code: number;
|
|
1631
1633
|
data: any;
|
|
1632
1634
|
message?: undefined;
|
package/dist/index.js
CHANGED
|
@@ -1807,7 +1807,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1807
1807
|
// package.json
|
|
1808
1808
|
var package_default = {
|
|
1809
1809
|
name: "@myx-trade/sdk",
|
|
1810
|
-
version: "0.1.
|
|
1810
|
+
version: "0.1.208",
|
|
1811
1811
|
private: false,
|
|
1812
1812
|
publishConfig: {
|
|
1813
1813
|
access: "public"
|
|
@@ -21296,11 +21296,6 @@ var Account = class {
|
|
|
21296
21296
|
const config = this.configManager.getConfig();
|
|
21297
21297
|
const contractAddress = getContractAddressByChainId(chainId);
|
|
21298
21298
|
const provider = await getJSONProvider(chainId);
|
|
21299
|
-
const dataProviderContract = new import_ethers26.ethers.Contract(
|
|
21300
|
-
contractAddress.DATA_PROVIDER,
|
|
21301
|
-
DataProvider_default,
|
|
21302
|
-
provider
|
|
21303
|
-
);
|
|
21304
21299
|
const brokerContract = new import_ethers26.ethers.Contract(
|
|
21305
21300
|
config.brokerAddress,
|
|
21306
21301
|
Broker_default,
|
|
@@ -21309,7 +21304,7 @@ var Account = class {
|
|
|
21309
21304
|
const latestBlock = await provider.getBlock("latest");
|
|
21310
21305
|
const deadline = (latestBlock?.timestamp ?? (0, import_dayjs3.default)().unix()) + 60 * 5;
|
|
21311
21306
|
try {
|
|
21312
|
-
const accountVipInfo = await
|
|
21307
|
+
const accountVipInfo = await brokerContract.userFeeData(address);
|
|
21313
21308
|
const nonce = await brokerContract.userNonces(address);
|
|
21314
21309
|
return {
|
|
21315
21310
|
code: 0,
|
|
@@ -21322,7 +21317,7 @@ var Account = class {
|
|
|
21322
21317
|
};
|
|
21323
21318
|
}
|
|
21324
21319
|
}
|
|
21325
|
-
async getAccountVipInfoByBackend(address, chainId) {
|
|
21320
|
+
async getAccountVipInfoByBackend(address, chainId, deadline, nonce) {
|
|
21326
21321
|
const accessToken = await this.configManager.getAccessToken();
|
|
21327
21322
|
if (!accessToken) {
|
|
21328
21323
|
throw new MyxSDKError(
|
|
@@ -21331,7 +21326,7 @@ var Account = class {
|
|
|
21331
21326
|
);
|
|
21332
21327
|
}
|
|
21333
21328
|
try {
|
|
21334
|
-
const res = await this.client.api.getAccountVipInfo({ address, accessToken, chainId });
|
|
21329
|
+
const res = await this.client.api.getAccountVipInfo({ address, accessToken, chainId, deadline, nonce });
|
|
21335
21330
|
if (res.code !== 9200) {
|
|
21336
21331
|
throw new MyxSDKError(
|
|
21337
21332
|
"REQUEST_FAILED" /* RequestFailed */,
|
|
@@ -21664,10 +21659,10 @@ var Api = class {
|
|
|
21664
21659
|
`${this.getHost()}/openapi/gateway/scan/market`
|
|
21665
21660
|
);
|
|
21666
21661
|
}
|
|
21667
|
-
async getAccountVipInfo({ address, accessToken, chainId }) {
|
|
21662
|
+
async getAccountVipInfo({ address, accessToken, chainId, deadline, nonce }) {
|
|
21668
21663
|
return http.get(
|
|
21669
21664
|
`${this.getHost()}/openapi/gateway/vip/trade_config`,
|
|
21670
|
-
{ chainId },
|
|
21665
|
+
{ chainId, deadline, nonce },
|
|
21671
21666
|
{
|
|
21672
21667
|
headers: {
|
|
21673
21668
|
myx_openapi_account: address,
|
package/dist/index.mjs
CHANGED
|
@@ -1731,7 +1731,7 @@ var RotationProvider = class extends BaseProvider {
|
|
|
1731
1731
|
// package.json
|
|
1732
1732
|
var package_default = {
|
|
1733
1733
|
name: "@myx-trade/sdk",
|
|
1734
|
-
version: "0.1.
|
|
1734
|
+
version: "0.1.208",
|
|
1735
1735
|
private: false,
|
|
1736
1736
|
publishConfig: {
|
|
1737
1737
|
access: "public"
|
|
@@ -21220,11 +21220,6 @@ var Account = class {
|
|
|
21220
21220
|
const config = this.configManager.getConfig();
|
|
21221
21221
|
const contractAddress = getContractAddressByChainId(chainId);
|
|
21222
21222
|
const provider = await getJSONProvider(chainId);
|
|
21223
|
-
const dataProviderContract = new ethers8.Contract(
|
|
21224
|
-
contractAddress.DATA_PROVIDER,
|
|
21225
|
-
DataProvider_default,
|
|
21226
|
-
provider
|
|
21227
|
-
);
|
|
21228
21223
|
const brokerContract = new ethers8.Contract(
|
|
21229
21224
|
config.brokerAddress,
|
|
21230
21225
|
Broker_default,
|
|
@@ -21233,7 +21228,7 @@ var Account = class {
|
|
|
21233
21228
|
const latestBlock = await provider.getBlock("latest");
|
|
21234
21229
|
const deadline = (latestBlock?.timestamp ?? dayjs3().unix()) + 60 * 5;
|
|
21235
21230
|
try {
|
|
21236
|
-
const accountVipInfo = await
|
|
21231
|
+
const accountVipInfo = await brokerContract.userFeeData(address);
|
|
21237
21232
|
const nonce = await brokerContract.userNonces(address);
|
|
21238
21233
|
return {
|
|
21239
21234
|
code: 0,
|
|
@@ -21246,7 +21241,7 @@ var Account = class {
|
|
|
21246
21241
|
};
|
|
21247
21242
|
}
|
|
21248
21243
|
}
|
|
21249
|
-
async getAccountVipInfoByBackend(address, chainId) {
|
|
21244
|
+
async getAccountVipInfoByBackend(address, chainId, deadline, nonce) {
|
|
21250
21245
|
const accessToken = await this.configManager.getAccessToken();
|
|
21251
21246
|
if (!accessToken) {
|
|
21252
21247
|
throw new MyxSDKError(
|
|
@@ -21255,7 +21250,7 @@ var Account = class {
|
|
|
21255
21250
|
);
|
|
21256
21251
|
}
|
|
21257
21252
|
try {
|
|
21258
|
-
const res = await this.client.api.getAccountVipInfo({ address, accessToken, chainId });
|
|
21253
|
+
const res = await this.client.api.getAccountVipInfo({ address, accessToken, chainId, deadline, nonce });
|
|
21259
21254
|
if (res.code !== 9200) {
|
|
21260
21255
|
throw new MyxSDKError(
|
|
21261
21256
|
"REQUEST_FAILED" /* RequestFailed */,
|
|
@@ -21588,10 +21583,10 @@ var Api = class {
|
|
|
21588
21583
|
`${this.getHost()}/openapi/gateway/scan/market`
|
|
21589
21584
|
);
|
|
21590
21585
|
}
|
|
21591
|
-
async getAccountVipInfo({ address, accessToken, chainId }) {
|
|
21586
|
+
async getAccountVipInfo({ address, accessToken, chainId, deadline, nonce }) {
|
|
21592
21587
|
return http.get(
|
|
21593
21588
|
`${this.getHost()}/openapi/gateway/vip/trade_config`,
|
|
21594
|
-
{ chainId },
|
|
21589
|
+
{ chainId, deadline, nonce },
|
|
21595
21590
|
{
|
|
21596
21591
|
headers: {
|
|
21597
21592
|
myx_openapi_account: address,
|