@myx-trade/sdk 0.1.200 → 0.1.202
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 +17 -2
- package/dist/index.d.ts +17 -2
- package/dist/index.js +32 -6
- package/dist/index.mjs +32 -6
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1486,9 +1486,10 @@ 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 }: {
|
|
1489
|
+
getAccountVipInfo({ address, accessToken, chainId }: {
|
|
1490
1490
|
address: string;
|
|
1491
1491
|
accessToken: string;
|
|
1492
|
+
chainId: number;
|
|
1492
1493
|
}): Promise<ApiResponse<any>>;
|
|
1493
1494
|
}
|
|
1494
1495
|
|
|
@@ -1625,7 +1626,21 @@ declare class Account {
|
|
|
1625
1626
|
message: string;
|
|
1626
1627
|
data?: undefined;
|
|
1627
1628
|
}>;
|
|
1628
|
-
getAccountVipInfoByBackend(address: string): Promise<{
|
|
1629
|
+
getAccountVipInfoByBackend(address: string, chainId: number): Promise<{
|
|
1630
|
+
code: number;
|
|
1631
|
+
data: any;
|
|
1632
|
+
message?: undefined;
|
|
1633
|
+
} | {
|
|
1634
|
+
code: number;
|
|
1635
|
+
message: string;
|
|
1636
|
+
data?: undefined;
|
|
1637
|
+
}>;
|
|
1638
|
+
setUserFeeData(address: string, params: {
|
|
1639
|
+
tier: number;
|
|
1640
|
+
referrer: string;
|
|
1641
|
+
totalReferralRebatePct: number;
|
|
1642
|
+
referrerRebatePct: number;
|
|
1643
|
+
}, signature: string): Promise<{
|
|
1629
1644
|
code: number;
|
|
1630
1645
|
data: any;
|
|
1631
1646
|
message?: undefined;
|
package/dist/index.d.ts
CHANGED
|
@@ -1486,9 +1486,10 @@ 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 }: {
|
|
1489
|
+
getAccountVipInfo({ address, accessToken, chainId }: {
|
|
1490
1490
|
address: string;
|
|
1491
1491
|
accessToken: string;
|
|
1492
|
+
chainId: number;
|
|
1492
1493
|
}): Promise<ApiResponse<any>>;
|
|
1493
1494
|
}
|
|
1494
1495
|
|
|
@@ -1625,7 +1626,21 @@ declare class Account {
|
|
|
1625
1626
|
message: string;
|
|
1626
1627
|
data?: undefined;
|
|
1627
1628
|
}>;
|
|
1628
|
-
getAccountVipInfoByBackend(address: string): Promise<{
|
|
1629
|
+
getAccountVipInfoByBackend(address: string, chainId: number): Promise<{
|
|
1630
|
+
code: number;
|
|
1631
|
+
data: any;
|
|
1632
|
+
message?: undefined;
|
|
1633
|
+
} | {
|
|
1634
|
+
code: number;
|
|
1635
|
+
message: string;
|
|
1636
|
+
data?: undefined;
|
|
1637
|
+
}>;
|
|
1638
|
+
setUserFeeData(address: string, params: {
|
|
1639
|
+
tier: number;
|
|
1640
|
+
referrer: string;
|
|
1641
|
+
totalReferralRebatePct: number;
|
|
1642
|
+
referrerRebatePct: number;
|
|
1643
|
+
}, signature: string): Promise<{
|
|
1629
1644
|
code: number;
|
|
1630
1645
|
data: any;
|
|
1631
1646
|
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.202",
|
|
1811
1811
|
private: false,
|
|
1812
1812
|
publishConfig: {
|
|
1813
1813
|
access: "public"
|
|
@@ -21313,9 +21313,8 @@ var Account = class {
|
|
|
21313
21313
|
};
|
|
21314
21314
|
}
|
|
21315
21315
|
}
|
|
21316
|
-
async getAccountVipInfoByBackend(address) {
|
|
21316
|
+
async getAccountVipInfoByBackend(address, chainId) {
|
|
21317
21317
|
const accessToken = await this.configManager.getAccessToken();
|
|
21318
|
-
console.log("accessToken-->", accessToken);
|
|
21319
21318
|
if (!accessToken) {
|
|
21320
21319
|
throw new MyxSDKError(
|
|
21321
21320
|
"INVALID_ACCESS_TOKEN" /* InvalidAccessToken */,
|
|
@@ -21323,7 +21322,7 @@ var Account = class {
|
|
|
21323
21322
|
);
|
|
21324
21323
|
}
|
|
21325
21324
|
try {
|
|
21326
|
-
const res = await this.client.api.getAccountVipInfo({ address, accessToken });
|
|
21325
|
+
const res = await this.client.api.getAccountVipInfo({ address, accessToken, chainId });
|
|
21327
21326
|
if (res.code !== 9200) {
|
|
21328
21327
|
throw new MyxSDKError(
|
|
21329
21328
|
"REQUEST_FAILED" /* RequestFailed */,
|
|
@@ -21341,6 +21340,33 @@ var Account = class {
|
|
|
21341
21340
|
};
|
|
21342
21341
|
}
|
|
21343
21342
|
}
|
|
21343
|
+
async setUserFeeData(address, params, signature) {
|
|
21344
|
+
const config = this.configManager.getConfig();
|
|
21345
|
+
const brokerContract = new import_ethers26.ethers.Contract(
|
|
21346
|
+
config.brokerAddress,
|
|
21347
|
+
Broker_default,
|
|
21348
|
+
config.signer
|
|
21349
|
+
);
|
|
21350
|
+
try {
|
|
21351
|
+
const nonce = await brokerContract.nonces(address);
|
|
21352
|
+
const rs = await brokerContract.setUserFeeData([address, nonce, (0, import_dayjs3.default)().add(60, "minute").unix(), [
|
|
21353
|
+
params.tier,
|
|
21354
|
+
params.referrer,
|
|
21355
|
+
params.totalReferralRebatePct,
|
|
21356
|
+
params.referrerRebatePct
|
|
21357
|
+
]], signature);
|
|
21358
|
+
const receipt = await rs?.wait(1);
|
|
21359
|
+
return {
|
|
21360
|
+
code: 0,
|
|
21361
|
+
data: receipt
|
|
21362
|
+
};
|
|
21363
|
+
} catch (error) {
|
|
21364
|
+
return {
|
|
21365
|
+
code: -1,
|
|
21366
|
+
message: error.message
|
|
21367
|
+
};
|
|
21368
|
+
}
|
|
21369
|
+
}
|
|
21344
21370
|
};
|
|
21345
21371
|
|
|
21346
21372
|
// src/api/utils.ts
|
|
@@ -21617,10 +21643,10 @@ var Api = class {
|
|
|
21617
21643
|
`${this.getHost()}/openapi/gateway/scan/market`
|
|
21618
21644
|
);
|
|
21619
21645
|
}
|
|
21620
|
-
async getAccountVipInfo({ address, accessToken }) {
|
|
21646
|
+
async getAccountVipInfo({ address, accessToken, chainId }) {
|
|
21621
21647
|
return http.get(
|
|
21622
21648
|
`${this.getHost()}/openapi/gateway/vip/trade_config`,
|
|
21623
|
-
|
|
21649
|
+
{ chainId },
|
|
21624
21650
|
{
|
|
21625
21651
|
headers: {
|
|
21626
21652
|
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.202",
|
|
1735
1735
|
private: false,
|
|
1736
1736
|
publishConfig: {
|
|
1737
1737
|
access: "public"
|
|
@@ -21237,9 +21237,8 @@ var Account = class {
|
|
|
21237
21237
|
};
|
|
21238
21238
|
}
|
|
21239
21239
|
}
|
|
21240
|
-
async getAccountVipInfoByBackend(address) {
|
|
21240
|
+
async getAccountVipInfoByBackend(address, chainId) {
|
|
21241
21241
|
const accessToken = await this.configManager.getAccessToken();
|
|
21242
|
-
console.log("accessToken-->", accessToken);
|
|
21243
21242
|
if (!accessToken) {
|
|
21244
21243
|
throw new MyxSDKError(
|
|
21245
21244
|
"INVALID_ACCESS_TOKEN" /* InvalidAccessToken */,
|
|
@@ -21247,7 +21246,7 @@ var Account = class {
|
|
|
21247
21246
|
);
|
|
21248
21247
|
}
|
|
21249
21248
|
try {
|
|
21250
|
-
const res = await this.client.api.getAccountVipInfo({ address, accessToken });
|
|
21249
|
+
const res = await this.client.api.getAccountVipInfo({ address, accessToken, chainId });
|
|
21251
21250
|
if (res.code !== 9200) {
|
|
21252
21251
|
throw new MyxSDKError(
|
|
21253
21252
|
"REQUEST_FAILED" /* RequestFailed */,
|
|
@@ -21265,6 +21264,33 @@ var Account = class {
|
|
|
21265
21264
|
};
|
|
21266
21265
|
}
|
|
21267
21266
|
}
|
|
21267
|
+
async setUserFeeData(address, params, signature) {
|
|
21268
|
+
const config = this.configManager.getConfig();
|
|
21269
|
+
const brokerContract = new ethers8.Contract(
|
|
21270
|
+
config.brokerAddress,
|
|
21271
|
+
Broker_default,
|
|
21272
|
+
config.signer
|
|
21273
|
+
);
|
|
21274
|
+
try {
|
|
21275
|
+
const nonce = await brokerContract.nonces(address);
|
|
21276
|
+
const rs = await brokerContract.setUserFeeData([address, nonce, dayjs3().add(60, "minute").unix(), [
|
|
21277
|
+
params.tier,
|
|
21278
|
+
params.referrer,
|
|
21279
|
+
params.totalReferralRebatePct,
|
|
21280
|
+
params.referrerRebatePct
|
|
21281
|
+
]], signature);
|
|
21282
|
+
const receipt = await rs?.wait(1);
|
|
21283
|
+
return {
|
|
21284
|
+
code: 0,
|
|
21285
|
+
data: receipt
|
|
21286
|
+
};
|
|
21287
|
+
} catch (error) {
|
|
21288
|
+
return {
|
|
21289
|
+
code: -1,
|
|
21290
|
+
message: error.message
|
|
21291
|
+
};
|
|
21292
|
+
}
|
|
21293
|
+
}
|
|
21268
21294
|
};
|
|
21269
21295
|
|
|
21270
21296
|
// src/api/utils.ts
|
|
@@ -21541,10 +21567,10 @@ var Api = class {
|
|
|
21541
21567
|
`${this.getHost()}/openapi/gateway/scan/market`
|
|
21542
21568
|
);
|
|
21543
21569
|
}
|
|
21544
|
-
async getAccountVipInfo({ address, accessToken }) {
|
|
21570
|
+
async getAccountVipInfo({ address, accessToken, chainId }) {
|
|
21545
21571
|
return http.get(
|
|
21546
21572
|
`${this.getHost()}/openapi/gateway/vip/trade_config`,
|
|
21547
|
-
|
|
21573
|
+
{ chainId },
|
|
21548
21574
|
{
|
|
21549
21575
|
headers: {
|
|
21550
21576
|
myx_openapi_account: address,
|