@myx-trade/sdk 0.1.243 → 0.1.245-0
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 +76 -10
- package/dist/index.d.ts +76 -10
- package/dist/index.js +2311 -246
- package/dist/index.mjs +2311 -246
- package/package.json +18 -21
package/dist/index.d.mts
CHANGED
|
@@ -30,6 +30,9 @@ interface ContractAddress {
|
|
|
30
30
|
readonly DATA_PROVIDER: Address$1;
|
|
31
31
|
readonly ORACLE_RESERVE: Address$1;
|
|
32
32
|
readonly FORWARDER: Address$1;
|
|
33
|
+
readonly REIMBURSEMENT: Address$1;
|
|
34
|
+
readonly DISPUTE_COURT: Address$1;
|
|
35
|
+
readonly TRADING_ROUTER: Address$1;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
interface CreatePoolRequest {
|
|
@@ -1358,7 +1361,7 @@ declare class Utils {
|
|
|
1358
1361
|
constructor(configManager: ConfigManager, logger: Logger);
|
|
1359
1362
|
getOrderIdFromTransaction(receipt: any): string | null;
|
|
1360
1363
|
private getApproveQuoteAmount;
|
|
1361
|
-
needsApproval(
|
|
1364
|
+
needsApproval(account: string, chainId: number, tokenAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
|
|
1362
1365
|
approveAuthorization({ chainId, quoteAddress, amount, spenderAddress, signer, }: {
|
|
1363
1366
|
chainId: number;
|
|
1364
1367
|
quoteAddress: string;
|
|
@@ -1391,13 +1394,16 @@ declare class Utils {
|
|
|
1391
1394
|
publishTime: number;
|
|
1392
1395
|
oracleType: OracleType;
|
|
1393
1396
|
vaa: string;
|
|
1394
|
-
} | {
|
|
1395
|
-
price: string;
|
|
1396
|
-
vaa: string;
|
|
1397
|
-
publishTime: number;
|
|
1398
|
-
poolId: string;
|
|
1399
|
-
value: number;
|
|
1400
1397
|
}>;
|
|
1398
|
+
buildUpdatePriceParams(poolId: string, chainId: number): Promise<{
|
|
1399
|
+
poolId: string;
|
|
1400
|
+
referencePrice: bigint;
|
|
1401
|
+
oracleUpdateData: string;
|
|
1402
|
+
publishTime: number;
|
|
1403
|
+
oracleType: OracleType;
|
|
1404
|
+
value: bigint;
|
|
1405
|
+
price: string;
|
|
1406
|
+
}[]>;
|
|
1401
1407
|
transferKlineResolutionToInterval(resolution: KlineResolution): HttpKlineIntervalEnum;
|
|
1402
1408
|
getErrorMessage(error: any, fallbackErrorMessage?: string): Promise<any>;
|
|
1403
1409
|
checkSeamlessGas(userAddress: string, chainId: number): Promise<boolean>;
|
|
@@ -1476,8 +1482,8 @@ declare class Utils {
|
|
|
1476
1482
|
data?: undefined;
|
|
1477
1483
|
}>;
|
|
1478
1484
|
formatErrorMessage(error: any): any;
|
|
1479
|
-
getGasPriceByRatio(
|
|
1480
|
-
getGasLimitByRatio(
|
|
1485
|
+
getGasPriceByRatio(): Promise<bigint>;
|
|
1486
|
+
getGasLimitByRatio(gasLimit: bigint): Promise<bigint>;
|
|
1481
1487
|
}
|
|
1482
1488
|
|
|
1483
1489
|
declare class Api {
|
|
@@ -3365,6 +3371,65 @@ declare class BaseMyxClient {
|
|
|
3365
3371
|
protected get config(): MyxClientConfig;
|
|
3366
3372
|
}
|
|
3367
3373
|
|
|
3374
|
+
interface AppealVoteParams {
|
|
3375
|
+
caseId: number;
|
|
3376
|
+
validator: Address$2;
|
|
3377
|
+
isFor: boolean;
|
|
3378
|
+
deadline: number;
|
|
3379
|
+
v: number;
|
|
3380
|
+
r: string;
|
|
3381
|
+
s: string;
|
|
3382
|
+
}
|
|
3383
|
+
|
|
3384
|
+
declare class Appeal extends BaseMyxClient {
|
|
3385
|
+
constructor(client: MyxClient);
|
|
3386
|
+
private getDisputeCourtContract;
|
|
3387
|
+
private getReimbursementContract;
|
|
3388
|
+
/**
|
|
3389
|
+
* submit appeal
|
|
3390
|
+
* @param poolId - the pool id
|
|
3391
|
+
* @param poolToken - the pool token
|
|
3392
|
+
* @returns the transaction receipt
|
|
3393
|
+
*/
|
|
3394
|
+
submitAppeal(poolId: string, lpToken: Address$2, lpAmount: string): Promise<ethers.ContractTransactionReceipt | null>;
|
|
3395
|
+
/**
|
|
3396
|
+
* vote for appeal
|
|
3397
|
+
* @param caseId - the case id
|
|
3398
|
+
* @param isFor - true if for the appeal, false if against the appeal
|
|
3399
|
+
* @returns the transaction receipt
|
|
3400
|
+
*/
|
|
3401
|
+
voteForAppeal({ caseId, validator, isFor, deadline, v, r, s, }: AppealVoteParams): Promise<ethers.ContractTransactionReceipt | null>;
|
|
3402
|
+
/**
|
|
3403
|
+
* claim appeal margin
|
|
3404
|
+
* @param caseId - the case id
|
|
3405
|
+
* @returns the transaction receipt
|
|
3406
|
+
*/
|
|
3407
|
+
claimAppealMargin(caseId: number): Promise<ethers.ContractTransactionReceipt | null>;
|
|
3408
|
+
/**
|
|
3409
|
+
* claim reimbursement
|
|
3410
|
+
* @param caseId - the case id
|
|
3411
|
+
* @param baseAmount - the base amount
|
|
3412
|
+
* @param quoteAmount - the quote amount
|
|
3413
|
+
* @param merkleProof - the merkle proof
|
|
3414
|
+
* @returns the transaction receipt
|
|
3415
|
+
*/
|
|
3416
|
+
claimReimbursement(caseId: number, baseAmount: number, quoteAmount: number, merkleProof: BytesLike[]): Promise<ethers.ContractTransactionReceipt | null>;
|
|
3417
|
+
/**
|
|
3418
|
+
* get dispute configuration
|
|
3419
|
+
*/
|
|
3420
|
+
getDisputeConfiguration(): Promise<[string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] & {
|
|
3421
|
+
appealToken: string;
|
|
3422
|
+
disputeBondUsd: bigint;
|
|
3423
|
+
appealBondUsd: bigint;
|
|
3424
|
+
disputeThresholdUsd: bigint;
|
|
3425
|
+
caseDuration: bigint;
|
|
3426
|
+
voteDuration: bigint;
|
|
3427
|
+
resolveDuration: bigint;
|
|
3428
|
+
voteCountRate: bigint;
|
|
3429
|
+
effectiveVoteRate: bigint;
|
|
3430
|
+
}>;
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3368
3433
|
declare class Referrals extends BaseMyxClient {
|
|
3369
3434
|
constructor(client: MyxClient);
|
|
3370
3435
|
claimRebate(tokenAddress: Address$2): Promise<ethers.ContractTransactionReceipt | null>;
|
|
@@ -3375,7 +3440,7 @@ declare class MyxClient {
|
|
|
3375
3440
|
* private properties
|
|
3376
3441
|
*/
|
|
3377
3442
|
private configManager;
|
|
3378
|
-
|
|
3443
|
+
logger: Logger;
|
|
3379
3444
|
/**
|
|
3380
3445
|
* public properties
|
|
3381
3446
|
*/
|
|
@@ -3387,6 +3452,7 @@ declare class MyxClient {
|
|
|
3387
3452
|
account: Account;
|
|
3388
3453
|
seamless: Seamless;
|
|
3389
3454
|
api: Api;
|
|
3455
|
+
appeal: Appeal;
|
|
3390
3456
|
referrals: Referrals;
|
|
3391
3457
|
/**
|
|
3392
3458
|
* 获取配置管理器(用于访问 accessToken 相关方法)
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,9 @@ interface ContractAddress {
|
|
|
30
30
|
readonly DATA_PROVIDER: Address$1;
|
|
31
31
|
readonly ORACLE_RESERVE: Address$1;
|
|
32
32
|
readonly FORWARDER: Address$1;
|
|
33
|
+
readonly REIMBURSEMENT: Address$1;
|
|
34
|
+
readonly DISPUTE_COURT: Address$1;
|
|
35
|
+
readonly TRADING_ROUTER: Address$1;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
38
|
interface CreatePoolRequest {
|
|
@@ -1358,7 +1361,7 @@ declare class Utils {
|
|
|
1358
1361
|
constructor(configManager: ConfigManager, logger: Logger);
|
|
1359
1362
|
getOrderIdFromTransaction(receipt: any): string | null;
|
|
1360
1363
|
private getApproveQuoteAmount;
|
|
1361
|
-
needsApproval(
|
|
1364
|
+
needsApproval(account: string, chainId: number, tokenAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
|
|
1362
1365
|
approveAuthorization({ chainId, quoteAddress, amount, spenderAddress, signer, }: {
|
|
1363
1366
|
chainId: number;
|
|
1364
1367
|
quoteAddress: string;
|
|
@@ -1391,13 +1394,16 @@ declare class Utils {
|
|
|
1391
1394
|
publishTime: number;
|
|
1392
1395
|
oracleType: OracleType;
|
|
1393
1396
|
vaa: string;
|
|
1394
|
-
} | {
|
|
1395
|
-
price: string;
|
|
1396
|
-
vaa: string;
|
|
1397
|
-
publishTime: number;
|
|
1398
|
-
poolId: string;
|
|
1399
|
-
value: number;
|
|
1400
1397
|
}>;
|
|
1398
|
+
buildUpdatePriceParams(poolId: string, chainId: number): Promise<{
|
|
1399
|
+
poolId: string;
|
|
1400
|
+
referencePrice: bigint;
|
|
1401
|
+
oracleUpdateData: string;
|
|
1402
|
+
publishTime: number;
|
|
1403
|
+
oracleType: OracleType;
|
|
1404
|
+
value: bigint;
|
|
1405
|
+
price: string;
|
|
1406
|
+
}[]>;
|
|
1401
1407
|
transferKlineResolutionToInterval(resolution: KlineResolution): HttpKlineIntervalEnum;
|
|
1402
1408
|
getErrorMessage(error: any, fallbackErrorMessage?: string): Promise<any>;
|
|
1403
1409
|
checkSeamlessGas(userAddress: string, chainId: number): Promise<boolean>;
|
|
@@ -1476,8 +1482,8 @@ declare class Utils {
|
|
|
1476
1482
|
data?: undefined;
|
|
1477
1483
|
}>;
|
|
1478
1484
|
formatErrorMessage(error: any): any;
|
|
1479
|
-
getGasPriceByRatio(
|
|
1480
|
-
getGasLimitByRatio(
|
|
1485
|
+
getGasPriceByRatio(): Promise<bigint>;
|
|
1486
|
+
getGasLimitByRatio(gasLimit: bigint): Promise<bigint>;
|
|
1481
1487
|
}
|
|
1482
1488
|
|
|
1483
1489
|
declare class Api {
|
|
@@ -3365,6 +3371,65 @@ declare class BaseMyxClient {
|
|
|
3365
3371
|
protected get config(): MyxClientConfig;
|
|
3366
3372
|
}
|
|
3367
3373
|
|
|
3374
|
+
interface AppealVoteParams {
|
|
3375
|
+
caseId: number;
|
|
3376
|
+
validator: Address$2;
|
|
3377
|
+
isFor: boolean;
|
|
3378
|
+
deadline: number;
|
|
3379
|
+
v: number;
|
|
3380
|
+
r: string;
|
|
3381
|
+
s: string;
|
|
3382
|
+
}
|
|
3383
|
+
|
|
3384
|
+
declare class Appeal extends BaseMyxClient {
|
|
3385
|
+
constructor(client: MyxClient);
|
|
3386
|
+
private getDisputeCourtContract;
|
|
3387
|
+
private getReimbursementContract;
|
|
3388
|
+
/**
|
|
3389
|
+
* submit appeal
|
|
3390
|
+
* @param poolId - the pool id
|
|
3391
|
+
* @param poolToken - the pool token
|
|
3392
|
+
* @returns the transaction receipt
|
|
3393
|
+
*/
|
|
3394
|
+
submitAppeal(poolId: string, lpToken: Address$2, lpAmount: string): Promise<ethers.ContractTransactionReceipt | null>;
|
|
3395
|
+
/**
|
|
3396
|
+
* vote for appeal
|
|
3397
|
+
* @param caseId - the case id
|
|
3398
|
+
* @param isFor - true if for the appeal, false if against the appeal
|
|
3399
|
+
* @returns the transaction receipt
|
|
3400
|
+
*/
|
|
3401
|
+
voteForAppeal({ caseId, validator, isFor, deadline, v, r, s, }: AppealVoteParams): Promise<ethers.ContractTransactionReceipt | null>;
|
|
3402
|
+
/**
|
|
3403
|
+
* claim appeal margin
|
|
3404
|
+
* @param caseId - the case id
|
|
3405
|
+
* @returns the transaction receipt
|
|
3406
|
+
*/
|
|
3407
|
+
claimAppealMargin(caseId: number): Promise<ethers.ContractTransactionReceipt | null>;
|
|
3408
|
+
/**
|
|
3409
|
+
* claim reimbursement
|
|
3410
|
+
* @param caseId - the case id
|
|
3411
|
+
* @param baseAmount - the base amount
|
|
3412
|
+
* @param quoteAmount - the quote amount
|
|
3413
|
+
* @param merkleProof - the merkle proof
|
|
3414
|
+
* @returns the transaction receipt
|
|
3415
|
+
*/
|
|
3416
|
+
claimReimbursement(caseId: number, baseAmount: number, quoteAmount: number, merkleProof: BytesLike[]): Promise<ethers.ContractTransactionReceipt | null>;
|
|
3417
|
+
/**
|
|
3418
|
+
* get dispute configuration
|
|
3419
|
+
*/
|
|
3420
|
+
getDisputeConfiguration(): Promise<[string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] & {
|
|
3421
|
+
appealToken: string;
|
|
3422
|
+
disputeBondUsd: bigint;
|
|
3423
|
+
appealBondUsd: bigint;
|
|
3424
|
+
disputeThresholdUsd: bigint;
|
|
3425
|
+
caseDuration: bigint;
|
|
3426
|
+
voteDuration: bigint;
|
|
3427
|
+
resolveDuration: bigint;
|
|
3428
|
+
voteCountRate: bigint;
|
|
3429
|
+
effectiveVoteRate: bigint;
|
|
3430
|
+
}>;
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3368
3433
|
declare class Referrals extends BaseMyxClient {
|
|
3369
3434
|
constructor(client: MyxClient);
|
|
3370
3435
|
claimRebate(tokenAddress: Address$2): Promise<ethers.ContractTransactionReceipt | null>;
|
|
@@ -3375,7 +3440,7 @@ declare class MyxClient {
|
|
|
3375
3440
|
* private properties
|
|
3376
3441
|
*/
|
|
3377
3442
|
private configManager;
|
|
3378
|
-
|
|
3443
|
+
logger: Logger;
|
|
3379
3444
|
/**
|
|
3380
3445
|
* public properties
|
|
3381
3446
|
*/
|
|
@@ -3387,6 +3452,7 @@ declare class MyxClient {
|
|
|
3387
3452
|
account: Account;
|
|
3388
3453
|
seamless: Seamless;
|
|
3389
3454
|
api: Api;
|
|
3455
|
+
appeal: Appeal;
|
|
3390
3456
|
referrals: Referrals;
|
|
3391
3457
|
/**
|
|
3392
3458
|
* 获取配置管理器(用于访问 accessToken 相关方法)
|