@myx-trade/sdk 0.1.244 → 0.1.245-beta.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 CHANGED
@@ -30,6 +30,8 @@ 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;
33
35
  readonly TRADING_ROUTER: Address$1;
34
36
  }
35
37
 
@@ -1359,7 +1361,7 @@ declare class Utils {
1359
1361
  constructor(configManager: ConfigManager, logger: Logger);
1360
1362
  getOrderIdFromTransaction(receipt: any): string | null;
1361
1363
  private getApproveQuoteAmount;
1362
- needsApproval(address: string, chainId: number, quoteAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
1364
+ needsApproval(account: string, chainId: number, tokenAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
1363
1365
  approveAuthorization({ chainId, quoteAddress, amount, spenderAddress, signer, }: {
1364
1366
  chainId: number;
1365
1367
  quoteAddress: string;
@@ -1392,13 +1394,16 @@ declare class Utils {
1392
1394
  publishTime: number;
1393
1395
  oracleType: OracleType;
1394
1396
  vaa: string;
1395
- } | {
1396
- price: string;
1397
- vaa: string;
1398
- publishTime: number;
1399
- poolId: string;
1400
- value: number;
1401
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
+ }[]>;
1402
1407
  transferKlineResolutionToInterval(resolution: KlineResolution): HttpKlineIntervalEnum;
1403
1408
  getErrorMessage(error: any, fallbackErrorMessage?: string): Promise<any>;
1404
1409
  checkSeamlessGas(userAddress: string, chainId: number): Promise<boolean>;
@@ -1477,8 +1482,8 @@ declare class Utils {
1477
1482
  data?: undefined;
1478
1483
  }>;
1479
1484
  formatErrorMessage(error: any): any;
1480
- getGasPriceByRatio(chainId: number): Promise<bigint>;
1481
- getGasLimitByRatio(chainId: number, gasLimit: bigint): Promise<bigint>;
1485
+ getGasPriceByRatio(): Promise<bigint>;
1486
+ getGasLimitByRatio(gasLimit: bigint): Promise<bigint>;
1482
1487
  }
1483
1488
 
1484
1489
  declare class Api {
@@ -3366,6 +3371,65 @@ declare class BaseMyxClient {
3366
3371
  protected get config(): MyxClientConfig;
3367
3372
  }
3368
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
+
3369
3433
  declare class Referrals extends BaseMyxClient {
3370
3434
  constructor(client: MyxClient);
3371
3435
  claimRebate(tokenAddress: Address$2): Promise<ethers.ContractTransactionReceipt | null>;
@@ -3376,7 +3440,7 @@ declare class MyxClient {
3376
3440
  * private properties
3377
3441
  */
3378
3442
  private configManager;
3379
- private logger;
3443
+ logger: Logger;
3380
3444
  /**
3381
3445
  * public properties
3382
3446
  */
@@ -3388,6 +3452,7 @@ declare class MyxClient {
3388
3452
  account: Account;
3389
3453
  seamless: Seamless;
3390
3454
  api: Api;
3455
+ appeal: Appeal;
3391
3456
  referrals: Referrals;
3392
3457
  /**
3393
3458
  * 获取配置管理器(用于访问 accessToken 相关方法)
package/dist/index.d.ts CHANGED
@@ -30,6 +30,8 @@ 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;
33
35
  readonly TRADING_ROUTER: Address$1;
34
36
  }
35
37
 
@@ -1359,7 +1361,7 @@ declare class Utils {
1359
1361
  constructor(configManager: ConfigManager, logger: Logger);
1360
1362
  getOrderIdFromTransaction(receipt: any): string | null;
1361
1363
  private getApproveQuoteAmount;
1362
- needsApproval(address: string, chainId: number, quoteAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
1364
+ needsApproval(account: string, chainId: number, tokenAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
1363
1365
  approveAuthorization({ chainId, quoteAddress, amount, spenderAddress, signer, }: {
1364
1366
  chainId: number;
1365
1367
  quoteAddress: string;
@@ -1392,13 +1394,16 @@ declare class Utils {
1392
1394
  publishTime: number;
1393
1395
  oracleType: OracleType;
1394
1396
  vaa: string;
1395
- } | {
1396
- price: string;
1397
- vaa: string;
1398
- publishTime: number;
1399
- poolId: string;
1400
- value: number;
1401
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
+ }[]>;
1402
1407
  transferKlineResolutionToInterval(resolution: KlineResolution): HttpKlineIntervalEnum;
1403
1408
  getErrorMessage(error: any, fallbackErrorMessage?: string): Promise<any>;
1404
1409
  checkSeamlessGas(userAddress: string, chainId: number): Promise<boolean>;
@@ -1477,8 +1482,8 @@ declare class Utils {
1477
1482
  data?: undefined;
1478
1483
  }>;
1479
1484
  formatErrorMessage(error: any): any;
1480
- getGasPriceByRatio(chainId: number): Promise<bigint>;
1481
- getGasLimitByRatio(chainId: number, gasLimit: bigint): Promise<bigint>;
1485
+ getGasPriceByRatio(): Promise<bigint>;
1486
+ getGasLimitByRatio(gasLimit: bigint): Promise<bigint>;
1482
1487
  }
1483
1488
 
1484
1489
  declare class Api {
@@ -3366,6 +3371,65 @@ declare class BaseMyxClient {
3366
3371
  protected get config(): MyxClientConfig;
3367
3372
  }
3368
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
+
3369
3433
  declare class Referrals extends BaseMyxClient {
3370
3434
  constructor(client: MyxClient);
3371
3435
  claimRebate(tokenAddress: Address$2): Promise<ethers.ContractTransactionReceipt | null>;
@@ -3376,7 +3440,7 @@ declare class MyxClient {
3376
3440
  * private properties
3377
3441
  */
3378
3442
  private configManager;
3379
- private logger;
3443
+ logger: Logger;
3380
3444
  /**
3381
3445
  * public properties
3382
3446
  */
@@ -3388,6 +3452,7 @@ declare class MyxClient {
3388
3452
  account: Account;
3389
3453
  seamless: Seamless;
3390
3454
  api: Api;
3455
+ appeal: Appeal;
3391
3456
  referrals: Referrals;
3392
3457
  /**
3393
3458
  * 获取配置管理器(用于访问 accessToken 相关方法)