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

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