UNPKG

@bronlabs/intents-sdk

Version:
80 lines (79 loc) 3.31 kB
import { ethers } from 'ethers'; export declare enum OrderStatus { NOT_EXIST = 0, USER_INITIATED = 1, AUCTION_IN_PROGRESS = 2, WAIT_FOR_USER_TX = 3, WAIT_FOR_ORACLE_CONFIRM_USER_TX = 4, WAIT_FOR_SOLVER_TX = 5, WAIT_FOR_ORACLE_CONFIRM_SOLVER_TX = 6, COMPLETED = 7, LIQUIDATED = 8, CANCELLED = 9 } interface BaseParams { networkId: string; tokenAddress: string; solverAddress: string; userTxHash: string; } interface QuoteParams { networkId: string; tokenAddress: string; userAddress: string; solverTxHash: string; } interface PricingParams { baseAmount: bigint; quoteAmount: bigint; price_e18: bigint; maxPrice_e18: bigint; auctionDuration: bigint; orderValueInUSD_e18: bigint; liquidationReceiver: string; } export interface Order { status: bigint; user: string; solver: string; baseParams: BaseParams; quoteParams: QuoteParams; pricingParams: PricingParams; updatedAt: bigint; createdAt: bigint; } interface NetworkParams { gasLimit: number; } export interface OrderEngineContract { createOrder(params: { orderId: string; baseNetworkId: string; baseTokenAddress: string; quoteNetworkId: string; quoteTokenAddress: string; userAddress: string; baseAmount: bigint; quoteAmount: bigint; orderValueInUSD_e18: bigint; maxPrice_e18: bigint; auctionDuration: bigint; liquidationReceiver: string; }, networkParams?: NetworkParams): Promise<ethers.ContractTransactionResponse>; getOrder(orderId: string): Promise<Order>; solverReact(orderId: string, solverAddressOnBaseChain: string, price: bigint, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>; setUserTxOnBaseNetwork(orderId: string, txHash: string, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>; setSolverTxOnQuoteNetwork(orderId: string, txHash: string, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>; setOracleConfirmUserTx(orderId: string, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>; setOracleConfirmSolverTx(orderId: string, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>; executeUserTimeout(orderId: string, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>; executeSolverTimeout(orderId: string, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>; } export interface OracleAggregatorContract { oracleConfirmUserTx(orderId: string, isConfirmed: boolean, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>; oracleConfirmSolverTx(orderId: string, isConfirmed: boolean, params?: NetworkParams): Promise<ethers.ContractTransactionResponse>; } export declare function initOrderEngine(orderEngineAddress: string, provider: ethers.JsonRpcProvider | ethers.Signer): OrderEngineContract & ethers.Contract; export declare function initOracleAggregator(oracleAggregatorAddress: string, provider: ethers.JsonRpcProvider | ethers.Signer): OracleAggregatorContract & ethers.Contract; export declare function printOrder(baseParams: BaseParams, quoteParams: QuoteParams, pricingParams: PricingParams): string; export {};