@myx-trade/sdk 0.1.59 → 0.1.62
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 -16
- package/dist/index.d.ts +17 -16
- package/dist/index.js +31 -2
- package/dist/index.mjs +31 -2
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -545,20 +545,6 @@ interface MarketInfo {
|
|
|
545
545
|
poolPrimeThreshold: number;
|
|
546
546
|
decimals: number;
|
|
547
547
|
}
|
|
548
|
-
type SeamlessAccount = {
|
|
549
|
-
/** 登录时间戳 */
|
|
550
|
-
loginTime: number;
|
|
551
|
-
/** 无感账户私钥 */
|
|
552
|
-
apikey: string;
|
|
553
|
-
/** 无感账户地址 */
|
|
554
|
-
address: string;
|
|
555
|
-
/** 主账户地址 */
|
|
556
|
-
masterAddress: string;
|
|
557
|
-
/** 是否开启 */
|
|
558
|
-
enable: boolean;
|
|
559
|
-
/** 授权状态 */
|
|
560
|
-
authorize: Partial<Record<ChainId, boolean>>;
|
|
561
|
-
};
|
|
562
548
|
|
|
563
549
|
declare class Address {
|
|
564
550
|
private _addr;
|
|
@@ -1213,6 +1199,7 @@ declare class ConfigManager {
|
|
|
1213
1199
|
private accessTokenExpiry?;
|
|
1214
1200
|
constructor(config: MyxClientConfig);
|
|
1215
1201
|
clear(): void;
|
|
1202
|
+
startSeamlessMode(open: boolean): void;
|
|
1216
1203
|
auth(params: Pick<MyxClientConfig, "signer" | "getAccessToken">): void;
|
|
1217
1204
|
private validateConfig;
|
|
1218
1205
|
/**
|
|
@@ -1671,7 +1658,13 @@ declare class Seamless {
|
|
|
1671
1658
|
authorizeSeamlessAccount({ approve, seamlessAddress }: {
|
|
1672
1659
|
approve: boolean;
|
|
1673
1660
|
seamlessAddress: string;
|
|
1674
|
-
}): Promise<
|
|
1661
|
+
}): Promise<{
|
|
1662
|
+
code: number;
|
|
1663
|
+
data: {
|
|
1664
|
+
seamlessAccount: string;
|
|
1665
|
+
authorized: boolean;
|
|
1666
|
+
};
|
|
1667
|
+
} | undefined>;
|
|
1675
1668
|
unLockSeamlessWallet({ masterAddress, password, apiKey }: {
|
|
1676
1669
|
masterAddress: string;
|
|
1677
1670
|
password: string;
|
|
@@ -1705,6 +1698,14 @@ declare class Seamless {
|
|
|
1705
1698
|
apiKey: string;
|
|
1706
1699
|
};
|
|
1707
1700
|
}>;
|
|
1701
|
+
startSeamlessMode({ open }: {
|
|
1702
|
+
open: boolean;
|
|
1703
|
+
}): Promise<{
|
|
1704
|
+
code: number;
|
|
1705
|
+
data: {
|
|
1706
|
+
open: boolean;
|
|
1707
|
+
};
|
|
1708
|
+
}>;
|
|
1708
1709
|
createSeamless({ password }: {
|
|
1709
1710
|
password: string;
|
|
1710
1711
|
}): Promise<{
|
|
@@ -1758,4 +1759,4 @@ declare class MyxClient {
|
|
|
1758
1759
|
getAccessToken(): Promise<string | null>;
|
|
1759
1760
|
}
|
|
1760
1761
|
|
|
1761
|
-
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type Address$1 as Address, type ApiResponse, type BaseDetailResponse, type BaseResponse, COMMON_LP_AMOUNT_DECIMALS, COMMON_PRICE_DECIMALS, ChainId, type ChainIdRequest, CloseTypeEnum, type DashboardType, Direction, DirectionEnum, ErrorCode, ExecTypeEnum, type FavoritesListItem, type FavoritesListParams, type FavoritesTimeInterval, type FavoritesType, type FetchForwarderGetParams, type FetchForwarderGetResponse, type FetchForwarderGetResponseData, ForwarderGetStatus, type ForwarderTxParams, type GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, HttpKlineIntervalEnum, type KlineDataItemType, type KlineDataResponse, type KlineResolution, type LevelConfig, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketPool, type MarketPoolResponse, MarketPoolState, MarketType, MyxClient, type MyxClientConfig, type MyxSubscriptionOptions, type NetWorkFee, type ObjectType, type OnKlineCallback, type OnOrderCallback, type OnPositionCallback, type OnTickersAllCallback, type OnTickersCallback, OperationEnum, OperationType, OracleType, type Order$1 as Order, OrderStatus, OrderStatusEnum, OrderType, OrderTypeEnum, type PlaceOrderParams, type PoolLevelConfig, type PoolOpenOrder, type PoolOpenOrdersResponse, type PoolResponse, type Position$1 as Position, type PositionHistoryItem, type PositionResponse, type PositionTpSlOrderParams, type PositionType, type PriceResponse, type PriceType, type RemoveFavoriteParams, type
|
|
1762
|
+
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type Address$1 as Address, type ApiResponse, type BaseDetailResponse, type BaseResponse, COMMON_LP_AMOUNT_DECIMALS, COMMON_PRICE_DECIMALS, ChainId, type ChainIdRequest, CloseTypeEnum, type DashboardType, Direction, DirectionEnum, ErrorCode, ExecTypeEnum, type FavoritesListItem, type FavoritesListParams, type FavoritesTimeInterval, type FavoritesType, type FetchForwarderGetParams, type FetchForwarderGetResponse, type FetchForwarderGetResponseData, ForwarderGetStatus, type ForwarderTxParams, type GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, HttpKlineIntervalEnum, type KlineDataItemType, type KlineDataResponse, type KlineResolution, type LevelConfig, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketPool, type MarketPoolResponse, MarketPoolState, MarketType, MyxClient, type MyxClientConfig, type MyxSubscriptionOptions, type NetWorkFee, type ObjectType, type OnKlineCallback, type OnOrderCallback, type OnPositionCallback, type OnTickersAllCallback, type OnTickersCallback, OperationEnum, OperationType, OracleType, type Order$1 as Order, OrderStatus, OrderStatusEnum, OrderType, OrderTypeEnum, type PlaceOrderParams, type PoolLevelConfig, type PoolOpenOrder, type PoolOpenOrdersResponse, type PoolResponse, type Position$1 as Position, type PositionHistoryItem, type PositionResponse, type PositionTpSlOrderParams, type PositionType, type PriceResponse, type PriceType, type RemoveFavoriteParams, type SearchMarketParams, type SearchResultContractItem, type SearchResultCookItem, type SearchResultEarnItem, type SearchResultResponse, SearchSecondTypeEnum, SearchTypeEnum, type StatDashBoardResponse, type TickerDataItem, type TickersDataResponse, TimeInForce, type TradeFlowItem, type TradingResult, TriggerType, TriggerTypeEnum, type UpdateOrderTpSlParams, addFavorite, approve, index$2 as base, baseUrl, bigintAmountSlipperCalculator, bigintTradingGasPriceWithRatio, bigintTradingGasToRatioCalculator, fetchForwarderGetApi, forwardUrl, forwarderTxApi, getAllTickers, getAllowanceApproved, getBalanceOf, getBaseDetail, getFavoritesList, getHistoryOrders, getKlineData, getKlineLatestBar, getMarketDetail, getMarketList, getOraclePrice, getOrders, getPoolDetail, getPoolLevelConfig, getPoolOpenOrders, getPositionHistory, getPositions, getPriceData, getPricesData, getTickerData, getTokenInfo, getTradeFlow, index as market, index$3 as pool, index$1 as quote, removeFavorite, searchMarket, searchMarketAuth };
|
package/dist/index.d.ts
CHANGED
|
@@ -545,20 +545,6 @@ interface MarketInfo {
|
|
|
545
545
|
poolPrimeThreshold: number;
|
|
546
546
|
decimals: number;
|
|
547
547
|
}
|
|
548
|
-
type SeamlessAccount = {
|
|
549
|
-
/** 登录时间戳 */
|
|
550
|
-
loginTime: number;
|
|
551
|
-
/** 无感账户私钥 */
|
|
552
|
-
apikey: string;
|
|
553
|
-
/** 无感账户地址 */
|
|
554
|
-
address: string;
|
|
555
|
-
/** 主账户地址 */
|
|
556
|
-
masterAddress: string;
|
|
557
|
-
/** 是否开启 */
|
|
558
|
-
enable: boolean;
|
|
559
|
-
/** 授权状态 */
|
|
560
|
-
authorize: Partial<Record<ChainId, boolean>>;
|
|
561
|
-
};
|
|
562
548
|
|
|
563
549
|
declare class Address {
|
|
564
550
|
private _addr;
|
|
@@ -1213,6 +1199,7 @@ declare class ConfigManager {
|
|
|
1213
1199
|
private accessTokenExpiry?;
|
|
1214
1200
|
constructor(config: MyxClientConfig);
|
|
1215
1201
|
clear(): void;
|
|
1202
|
+
startSeamlessMode(open: boolean): void;
|
|
1216
1203
|
auth(params: Pick<MyxClientConfig, "signer" | "getAccessToken">): void;
|
|
1217
1204
|
private validateConfig;
|
|
1218
1205
|
/**
|
|
@@ -1671,7 +1658,13 @@ declare class Seamless {
|
|
|
1671
1658
|
authorizeSeamlessAccount({ approve, seamlessAddress }: {
|
|
1672
1659
|
approve: boolean;
|
|
1673
1660
|
seamlessAddress: string;
|
|
1674
|
-
}): Promise<
|
|
1661
|
+
}): Promise<{
|
|
1662
|
+
code: number;
|
|
1663
|
+
data: {
|
|
1664
|
+
seamlessAccount: string;
|
|
1665
|
+
authorized: boolean;
|
|
1666
|
+
};
|
|
1667
|
+
} | undefined>;
|
|
1675
1668
|
unLockSeamlessWallet({ masterAddress, password, apiKey }: {
|
|
1676
1669
|
masterAddress: string;
|
|
1677
1670
|
password: string;
|
|
@@ -1705,6 +1698,14 @@ declare class Seamless {
|
|
|
1705
1698
|
apiKey: string;
|
|
1706
1699
|
};
|
|
1707
1700
|
}>;
|
|
1701
|
+
startSeamlessMode({ open }: {
|
|
1702
|
+
open: boolean;
|
|
1703
|
+
}): Promise<{
|
|
1704
|
+
code: number;
|
|
1705
|
+
data: {
|
|
1706
|
+
open: boolean;
|
|
1707
|
+
};
|
|
1708
|
+
}>;
|
|
1708
1709
|
createSeamless({ password }: {
|
|
1709
1710
|
password: string;
|
|
1710
1711
|
}): Promise<{
|
|
@@ -1758,4 +1759,4 @@ declare class MyxClient {
|
|
|
1758
1759
|
getAccessToken(): Promise<string | null>;
|
|
1759
1760
|
}
|
|
1760
1761
|
|
|
1761
|
-
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type Address$1 as Address, type ApiResponse, type BaseDetailResponse, type BaseResponse, COMMON_LP_AMOUNT_DECIMALS, COMMON_PRICE_DECIMALS, ChainId, type ChainIdRequest, CloseTypeEnum, type DashboardType, Direction, DirectionEnum, ErrorCode, ExecTypeEnum, type FavoritesListItem, type FavoritesListParams, type FavoritesTimeInterval, type FavoritesType, type FetchForwarderGetParams, type FetchForwarderGetResponse, type FetchForwarderGetResponseData, ForwarderGetStatus, type ForwarderTxParams, type GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, HttpKlineIntervalEnum, type KlineDataItemType, type KlineDataResponse, type KlineResolution, type LevelConfig, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketPool, type MarketPoolResponse, MarketPoolState, MarketType, MyxClient, type MyxClientConfig, type MyxSubscriptionOptions, type NetWorkFee, type ObjectType, type OnKlineCallback, type OnOrderCallback, type OnPositionCallback, type OnTickersAllCallback, type OnTickersCallback, OperationEnum, OperationType, OracleType, type Order$1 as Order, OrderStatus, OrderStatusEnum, OrderType, OrderTypeEnum, type PlaceOrderParams, type PoolLevelConfig, type PoolOpenOrder, type PoolOpenOrdersResponse, type PoolResponse, type Position$1 as Position, type PositionHistoryItem, type PositionResponse, type PositionTpSlOrderParams, type PositionType, type PriceResponse, type PriceType, type RemoveFavoriteParams, type
|
|
1762
|
+
export { type AccessTokenRequest, type AccessTokenResponse$1 as AccessTokenResponse, type AccessTokenType, type AddFavoriteParams, type Address$1 as Address, type ApiResponse, type BaseDetailResponse, type BaseResponse, COMMON_LP_AMOUNT_DECIMALS, COMMON_PRICE_DECIMALS, ChainId, type ChainIdRequest, CloseTypeEnum, type DashboardType, Direction, DirectionEnum, ErrorCode, ExecTypeEnum, type FavoritesListItem, type FavoritesListParams, type FavoritesTimeInterval, type FavoritesType, type FetchForwarderGetParams, type FetchForwarderGetResponse, type FetchForwarderGetResponseData, ForwarderGetStatus, type ForwarderTxParams, type GetBaseDetailParams, type GetHistoryOrdersParams, type GetKlineDataParams, type GetMarketDetailParams, type GetPoolLevelConfigParams, type GetTickerDataParams, type HistoryOrderItem, HttpKlineIntervalEnum, type KlineDataItemType, type KlineDataResponse, type KlineResolution, type LevelConfig, MarketCapType, type MarketDetailResponse, type MarketInfo, type MarketPool, type MarketPoolResponse, MarketPoolState, MarketType, MyxClient, type MyxClientConfig, type MyxSubscriptionOptions, type NetWorkFee, type ObjectType, type OnKlineCallback, type OnOrderCallback, type OnPositionCallback, type OnTickersAllCallback, type OnTickersCallback, OperationEnum, OperationType, OracleType, type Order$1 as Order, OrderStatus, OrderStatusEnum, OrderType, OrderTypeEnum, type PlaceOrderParams, type PoolLevelConfig, type PoolOpenOrder, type PoolOpenOrdersResponse, type PoolResponse, type Position$1 as Position, type PositionHistoryItem, type PositionResponse, type PositionTpSlOrderParams, type PositionType, type PriceResponse, type PriceType, type RemoveFavoriteParams, type SearchMarketParams, type SearchResultContractItem, type SearchResultCookItem, type SearchResultEarnItem, type SearchResultResponse, SearchSecondTypeEnum, SearchTypeEnum, type StatDashBoardResponse, type TickerDataItem, type TickersDataResponse, TimeInForce, type TradeFlowItem, type TradingResult, TriggerType, TriggerTypeEnum, type UpdateOrderTpSlParams, addFavorite, approve, index$2 as base, baseUrl, bigintAmountSlipperCalculator, bigintTradingGasPriceWithRatio, bigintTradingGasToRatioCalculator, fetchForwarderGetApi, forwardUrl, forwarderTxApi, getAllTickers, getAllowanceApproved, getBalanceOf, getBaseDetail, getFavoritesList, getHistoryOrders, getKlineData, getKlineLatestBar, getMarketDetail, getMarketList, getOraclePrice, getOrders, getPoolDetail, getPoolLevelConfig, getPoolOpenOrders, getPositionHistory, getPositions, getPriceData, getPricesData, getTickerData, getTokenInfo, getTradeFlow, index as market, index$3 as pool, index$1 as quote, removeFavorite, searchMarket, searchMarketAuth };
|
package/dist/index.js
CHANGED
|
@@ -1841,7 +1841,7 @@ var RotationProvider = class extends import_providers.BaseProvider {
|
|
|
1841
1841
|
// package.json
|
|
1842
1842
|
var package_default = {
|
|
1843
1843
|
name: "@myx-trade/sdk",
|
|
1844
|
-
version: "0.1.
|
|
1844
|
+
version: "0.1.62",
|
|
1845
1845
|
private: false,
|
|
1846
1846
|
publishConfig: {
|
|
1847
1847
|
access: "public"
|
|
@@ -13660,6 +13660,12 @@ var ConfigManager = class {
|
|
|
13660
13660
|
getAccessToken: void 0
|
|
13661
13661
|
};
|
|
13662
13662
|
}
|
|
13663
|
+
startSeamlessMode(open) {
|
|
13664
|
+
this.config = {
|
|
13665
|
+
...this.config,
|
|
13666
|
+
seamlessMode: open
|
|
13667
|
+
};
|
|
13668
|
+
}
|
|
13663
13669
|
auth(params) {
|
|
13664
13670
|
this.clear();
|
|
13665
13671
|
this.config = {
|
|
@@ -20691,7 +20697,8 @@ var Seamless = class {
|
|
|
20691
20697
|
throw new RetryableError();
|
|
20692
20698
|
}, retryOptions);
|
|
20693
20699
|
try {
|
|
20694
|
-
await promise;
|
|
20700
|
+
const rs = await promise;
|
|
20701
|
+
return rs;
|
|
20695
20702
|
} catch (err) {
|
|
20696
20703
|
if (err instanceof TimeoutError) {
|
|
20697
20704
|
throw new MyxSDKError("TIMEOUT" /* Timeout */, "Your request timed out, please try again");
|
|
@@ -20776,6 +20783,15 @@ var Seamless = class {
|
|
|
20776
20783
|
}
|
|
20777
20784
|
};
|
|
20778
20785
|
}
|
|
20786
|
+
async startSeamlessMode({ open }) {
|
|
20787
|
+
this.configManager.startSeamlessMode(open);
|
|
20788
|
+
return {
|
|
20789
|
+
code: 0,
|
|
20790
|
+
data: {
|
|
20791
|
+
open
|
|
20792
|
+
}
|
|
20793
|
+
};
|
|
20794
|
+
}
|
|
20779
20795
|
async createSeamless({ password }) {
|
|
20780
20796
|
const config = this.configManager.getConfig();
|
|
20781
20797
|
const signer = config.signer;
|
|
@@ -20799,6 +20815,19 @@ var Seamless = class {
|
|
|
20799
20815
|
this.seamlessWallet = wallet;
|
|
20800
20816
|
this.seamlessWalletAuthorized = isAuthorized;
|
|
20801
20817
|
this.seamlessWalletApikey = apiKey;
|
|
20818
|
+
const forwarderContract = await getForwarderContract(config.chainId);
|
|
20819
|
+
const approvalResult = await this.utils.approveAuthorization({
|
|
20820
|
+
quoteAddress: "0x7e248ec1721639413a280d9e82e2862cae2e6e28",
|
|
20821
|
+
amount: import_ethers27.ethers.MaxUint256.toString(),
|
|
20822
|
+
spenderAddress: forwarderContract.target
|
|
20823
|
+
});
|
|
20824
|
+
console.log("approvalResult-->", approvalResult);
|
|
20825
|
+
if (!isAuthorized) {
|
|
20826
|
+
await this.authorizeSeamlessAccount({
|
|
20827
|
+
seamlessAddress: wallet.address,
|
|
20828
|
+
approve: true
|
|
20829
|
+
});
|
|
20830
|
+
}
|
|
20802
20831
|
return {
|
|
20803
20832
|
code: 0,
|
|
20804
20833
|
data: {
|
package/dist/index.mjs
CHANGED
|
@@ -1752,7 +1752,7 @@ var RotationProvider = class extends BaseProvider {
|
|
|
1752
1752
|
// package.json
|
|
1753
1753
|
var package_default = {
|
|
1754
1754
|
name: "@myx-trade/sdk",
|
|
1755
|
-
version: "0.1.
|
|
1755
|
+
version: "0.1.62",
|
|
1756
1756
|
private: false,
|
|
1757
1757
|
publishConfig: {
|
|
1758
1758
|
access: "public"
|
|
@@ -13571,6 +13571,12 @@ var ConfigManager = class {
|
|
|
13571
13571
|
getAccessToken: void 0
|
|
13572
13572
|
};
|
|
13573
13573
|
}
|
|
13574
|
+
startSeamlessMode(open) {
|
|
13575
|
+
this.config = {
|
|
13576
|
+
...this.config,
|
|
13577
|
+
seamlessMode: open
|
|
13578
|
+
};
|
|
13579
|
+
}
|
|
13574
13580
|
auth(params) {
|
|
13575
13581
|
this.clear();
|
|
13576
13582
|
this.config = {
|
|
@@ -20602,7 +20608,8 @@ var Seamless = class {
|
|
|
20602
20608
|
throw new RetryableError();
|
|
20603
20609
|
}, retryOptions);
|
|
20604
20610
|
try {
|
|
20605
|
-
await promise;
|
|
20611
|
+
const rs = await promise;
|
|
20612
|
+
return rs;
|
|
20606
20613
|
} catch (err) {
|
|
20607
20614
|
if (err instanceof TimeoutError) {
|
|
20608
20615
|
throw new MyxSDKError("TIMEOUT" /* Timeout */, "Your request timed out, please try again");
|
|
@@ -20687,6 +20694,15 @@ var Seamless = class {
|
|
|
20687
20694
|
}
|
|
20688
20695
|
};
|
|
20689
20696
|
}
|
|
20697
|
+
async startSeamlessMode({ open }) {
|
|
20698
|
+
this.configManager.startSeamlessMode(open);
|
|
20699
|
+
return {
|
|
20700
|
+
code: 0,
|
|
20701
|
+
data: {
|
|
20702
|
+
open
|
|
20703
|
+
}
|
|
20704
|
+
};
|
|
20705
|
+
}
|
|
20690
20706
|
async createSeamless({ password }) {
|
|
20691
20707
|
const config = this.configManager.getConfig();
|
|
20692
20708
|
const signer = config.signer;
|
|
@@ -20710,6 +20726,19 @@ var Seamless = class {
|
|
|
20710
20726
|
this.seamlessWallet = wallet;
|
|
20711
20727
|
this.seamlessWalletAuthorized = isAuthorized;
|
|
20712
20728
|
this.seamlessWalletApikey = apiKey;
|
|
20729
|
+
const forwarderContract = await getForwarderContract(config.chainId);
|
|
20730
|
+
const approvalResult = await this.utils.approveAuthorization({
|
|
20731
|
+
quoteAddress: "0x7e248ec1721639413a280d9e82e2862cae2e6e28",
|
|
20732
|
+
amount: ethers9.MaxUint256.toString(),
|
|
20733
|
+
spenderAddress: forwarderContract.target
|
|
20734
|
+
});
|
|
20735
|
+
console.log("approvalResult-->", approvalResult);
|
|
20736
|
+
if (!isAuthorized) {
|
|
20737
|
+
await this.authorizeSeamlessAccount({
|
|
20738
|
+
seamlessAddress: wallet.address,
|
|
20739
|
+
approve: true
|
|
20740
|
+
});
|
|
20741
|
+
}
|
|
20713
20742
|
return {
|
|
20714
20743
|
code: 0,
|
|
20715
20744
|
data: {
|