@myx-trade/sdk 0.1.238 → 0.1.239-beta.10

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
  }
34
36
 
35
37
  interface CreatePoolRequest {
@@ -1358,8 +1360,8 @@ declare class Utils {
1358
1360
  constructor(configManager: ConfigManager, logger: Logger);
1359
1361
  getOrderIdFromTransaction(receipt: any): string | null;
1360
1362
  private getApproveQuoteAmount;
1361
- needsApproval(address: string, chainId: number, quoteAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
1362
- approveAuthorization({ chainId, quoteAddress, amount, spenderAddress, signer }: {
1363
+ needsApproval(account: string, chainId: number, tokenAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
1364
+ approveAuthorization({ chainId, quoteAddress, amount, spenderAddress, signer, }: {
1363
1365
  chainId: number;
1364
1366
  quoteAddress: string;
1365
1367
  amount?: string;
@@ -1391,17 +1393,20 @@ declare class Utils {
1391
1393
  publishTime: number;
1392
1394
  oracleType: OracleType;
1393
1395
  vaa: string;
1394
- } | {
1395
- price: string;
1396
- vaa: string;
1397
- publishTime: number;
1398
- poolId: string;
1399
- value: number;
1400
1396
  }>;
1397
+ buildUpdatePriceParams(poolId: string, chainId: number): Promise<{
1398
+ poolId: string;
1399
+ referencePrice: bigint;
1400
+ oracleUpdateData: string;
1401
+ publishTime: number;
1402
+ oracleType: OracleType;
1403
+ value: bigint;
1404
+ price: string;
1405
+ }[]>;
1401
1406
  transferKlineResolutionToInterval(resolution: KlineResolution): HttpKlineIntervalEnum;
1402
1407
  getErrorMessage(error: any, fallbackErrorMessage?: string): Promise<any>;
1403
1408
  checkSeamlessGas(userAddress: string, chainId: number): Promise<boolean>;
1404
- getLiquidityInfo({ chainId, poolId, marketPrice }: {
1409
+ getLiquidityInfo({ chainId, poolId, marketPrice, }: {
1405
1410
  chainId: number;
1406
1411
  poolId: string;
1407
1412
  marketPrice: string;
@@ -1476,6 +1481,8 @@ declare class Utils {
1476
1481
  data?: undefined;
1477
1482
  }>;
1478
1483
  formatErrorMessage(error: any): any;
1484
+ getGasPriceByRatio(): Promise<bigint>;
1485
+ getGasLimitByRatio(gasLimit: bigint): Promise<bigint>;
1479
1486
  }
1480
1487
 
1481
1488
  declare class Api {
@@ -3346,6 +3353,66 @@ declare class BaseMyxClient {
3346
3353
  protected getAddressConfig(): ContractAddress;
3347
3354
  protected connectContract<T extends Record<string, any>>(contract: T): Promise<T>;
3348
3355
  protected getBrokerContract(): Promise<Broker>;
3356
+ protected get config(): MyxClientConfig;
3357
+ }
3358
+
3359
+ interface AppealVoteParams {
3360
+ caseId: number;
3361
+ validator: Address$2;
3362
+ isFor: boolean;
3363
+ deadline: number;
3364
+ v: number;
3365
+ r: string;
3366
+ s: string;
3367
+ }
3368
+
3369
+ declare class Appeal extends BaseMyxClient {
3370
+ constructor(client: MyxClient);
3371
+ private getDisputeCourtContract;
3372
+ private getReimbursementContract;
3373
+ /**
3374
+ * submit appeal
3375
+ * @param poolId - the pool id
3376
+ * @param poolToken - the pool token
3377
+ * @returns the transaction receipt
3378
+ */
3379
+ submitAppeal(poolId: string, lpToken: Address$2, lpAmount: string): Promise<ethers.ContractTransactionReceipt | null>;
3380
+ /**
3381
+ * vote for appeal
3382
+ * @param caseId - the case id
3383
+ * @param isFor - true if for the appeal, false if against the appeal
3384
+ * @returns the transaction receipt
3385
+ */
3386
+ voteForAppeal({ caseId, validator, isFor, deadline, v, r, s, }: AppealVoteParams): Promise<ethers.ContractTransactionReceipt | null>;
3387
+ /**
3388
+ * claim appeal margin
3389
+ * @param caseId - the case id
3390
+ * @returns the transaction receipt
3391
+ */
3392
+ claimAppealMargin(caseId: number): Promise<ethers.ContractTransactionReceipt | null>;
3393
+ /**
3394
+ * claim reimbursement
3395
+ * @param caseId - the case id
3396
+ * @param baseAmount - the base amount
3397
+ * @param quoteAmount - the quote amount
3398
+ * @param merkleProof - the merkle proof
3399
+ * @returns the transaction receipt
3400
+ */
3401
+ claimReimbursement(caseId: number, baseAmount: number, quoteAmount: number, merkleProof: BytesLike[]): Promise<ethers.ContractTransactionReceipt | null>;
3402
+ /**
3403
+ * get dispute configuration
3404
+ */
3405
+ getDisputeConfiguration(): Promise<[string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] & {
3406
+ appealToken: string;
3407
+ disputeBondUsd: bigint;
3408
+ appealBondUsd: bigint;
3409
+ disputeThresholdUsd: bigint;
3410
+ caseDuration: bigint;
3411
+ voteDuration: bigint;
3412
+ resolveDuration: bigint;
3413
+ voteCountRate: bigint;
3414
+ effectiveVoteRate: bigint;
3415
+ }>;
3349
3416
  }
3350
3417
 
3351
3418
  declare class Referrals extends BaseMyxClient {
@@ -3358,7 +3425,7 @@ declare class MyxClient {
3358
3425
  * private properties
3359
3426
  */
3360
3427
  private configManager;
3361
- private logger;
3428
+ logger: Logger;
3362
3429
  /**
3363
3430
  * public properties
3364
3431
  */
@@ -3370,6 +3437,7 @@ declare class MyxClient {
3370
3437
  account: Account;
3371
3438
  seamless: Seamless;
3372
3439
  api: Api;
3440
+ appeal: Appeal;
3373
3441
  referrals: Referrals;
3374
3442
  /**
3375
3443
  * 获取配置管理器(用于访问 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
  }
34
36
 
35
37
  interface CreatePoolRequest {
@@ -1358,8 +1360,8 @@ declare class Utils {
1358
1360
  constructor(configManager: ConfigManager, logger: Logger);
1359
1361
  getOrderIdFromTransaction(receipt: any): string | null;
1360
1362
  private getApproveQuoteAmount;
1361
- needsApproval(address: string, chainId: number, quoteAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
1362
- approveAuthorization({ chainId, quoteAddress, amount, spenderAddress, signer }: {
1363
+ needsApproval(account: string, chainId: number, tokenAddress: string, requiredAmount: string, spenderAddress?: string): Promise<boolean>;
1364
+ approveAuthorization({ chainId, quoteAddress, amount, spenderAddress, signer, }: {
1363
1365
  chainId: number;
1364
1366
  quoteAddress: string;
1365
1367
  amount?: string;
@@ -1391,17 +1393,20 @@ declare class Utils {
1391
1393
  publishTime: number;
1392
1394
  oracleType: OracleType;
1393
1395
  vaa: string;
1394
- } | {
1395
- price: string;
1396
- vaa: string;
1397
- publishTime: number;
1398
- poolId: string;
1399
- value: number;
1400
1396
  }>;
1397
+ buildUpdatePriceParams(poolId: string, chainId: number): Promise<{
1398
+ poolId: string;
1399
+ referencePrice: bigint;
1400
+ oracleUpdateData: string;
1401
+ publishTime: number;
1402
+ oracleType: OracleType;
1403
+ value: bigint;
1404
+ price: string;
1405
+ }[]>;
1401
1406
  transferKlineResolutionToInterval(resolution: KlineResolution): HttpKlineIntervalEnum;
1402
1407
  getErrorMessage(error: any, fallbackErrorMessage?: string): Promise<any>;
1403
1408
  checkSeamlessGas(userAddress: string, chainId: number): Promise<boolean>;
1404
- getLiquidityInfo({ chainId, poolId, marketPrice }: {
1409
+ getLiquidityInfo({ chainId, poolId, marketPrice, }: {
1405
1410
  chainId: number;
1406
1411
  poolId: string;
1407
1412
  marketPrice: string;
@@ -1476,6 +1481,8 @@ declare class Utils {
1476
1481
  data?: undefined;
1477
1482
  }>;
1478
1483
  formatErrorMessage(error: any): any;
1484
+ getGasPriceByRatio(): Promise<bigint>;
1485
+ getGasLimitByRatio(gasLimit: bigint): Promise<bigint>;
1479
1486
  }
1480
1487
 
1481
1488
  declare class Api {
@@ -3346,6 +3353,66 @@ declare class BaseMyxClient {
3346
3353
  protected getAddressConfig(): ContractAddress;
3347
3354
  protected connectContract<T extends Record<string, any>>(contract: T): Promise<T>;
3348
3355
  protected getBrokerContract(): Promise<Broker>;
3356
+ protected get config(): MyxClientConfig;
3357
+ }
3358
+
3359
+ interface AppealVoteParams {
3360
+ caseId: number;
3361
+ validator: Address$2;
3362
+ isFor: boolean;
3363
+ deadline: number;
3364
+ v: number;
3365
+ r: string;
3366
+ s: string;
3367
+ }
3368
+
3369
+ declare class Appeal extends BaseMyxClient {
3370
+ constructor(client: MyxClient);
3371
+ private getDisputeCourtContract;
3372
+ private getReimbursementContract;
3373
+ /**
3374
+ * submit appeal
3375
+ * @param poolId - the pool id
3376
+ * @param poolToken - the pool token
3377
+ * @returns the transaction receipt
3378
+ */
3379
+ submitAppeal(poolId: string, lpToken: Address$2, lpAmount: string): Promise<ethers.ContractTransactionReceipt | null>;
3380
+ /**
3381
+ * vote for appeal
3382
+ * @param caseId - the case id
3383
+ * @param isFor - true if for the appeal, false if against the appeal
3384
+ * @returns the transaction receipt
3385
+ */
3386
+ voteForAppeal({ caseId, validator, isFor, deadline, v, r, s, }: AppealVoteParams): Promise<ethers.ContractTransactionReceipt | null>;
3387
+ /**
3388
+ * claim appeal margin
3389
+ * @param caseId - the case id
3390
+ * @returns the transaction receipt
3391
+ */
3392
+ claimAppealMargin(caseId: number): Promise<ethers.ContractTransactionReceipt | null>;
3393
+ /**
3394
+ * claim reimbursement
3395
+ * @param caseId - the case id
3396
+ * @param baseAmount - the base amount
3397
+ * @param quoteAmount - the quote amount
3398
+ * @param merkleProof - the merkle proof
3399
+ * @returns the transaction receipt
3400
+ */
3401
+ claimReimbursement(caseId: number, baseAmount: number, quoteAmount: number, merkleProof: BytesLike[]): Promise<ethers.ContractTransactionReceipt | null>;
3402
+ /**
3403
+ * get dispute configuration
3404
+ */
3405
+ getDisputeConfiguration(): Promise<[string, bigint, bigint, bigint, bigint, bigint, bigint, bigint, bigint] & {
3406
+ appealToken: string;
3407
+ disputeBondUsd: bigint;
3408
+ appealBondUsd: bigint;
3409
+ disputeThresholdUsd: bigint;
3410
+ caseDuration: bigint;
3411
+ voteDuration: bigint;
3412
+ resolveDuration: bigint;
3413
+ voteCountRate: bigint;
3414
+ effectiveVoteRate: bigint;
3415
+ }>;
3349
3416
  }
3350
3417
 
3351
3418
  declare class Referrals extends BaseMyxClient {
@@ -3358,7 +3425,7 @@ declare class MyxClient {
3358
3425
  * private properties
3359
3426
  */
3360
3427
  private configManager;
3361
- private logger;
3428
+ logger: Logger;
3362
3429
  /**
3363
3430
  * public properties
3364
3431
  */
@@ -3370,6 +3437,7 @@ declare class MyxClient {
3370
3437
  account: Account;
3371
3438
  seamless: Seamless;
3372
3439
  api: Api;
3440
+ appeal: Appeal;
3373
3441
  referrals: Referrals;
3374
3442
  /**
3375
3443
  * 获取配置管理器(用于访问 accessToken 相关方法)