/// import { PublicKey } from "@solana/web3.js"; import { IOfferDataInfo, ITradeDataInfo, Version } from "../types"; import { BN, Wallet } from "@project-serum/anchor"; import Decimal from "decimal.js"; import { TransactionBuilder } from "@orca-so/common-sdk"; /** * @dev An Escrow router instance should be able to handle all tokens / markets * * @propose @constructor * constructor( connection: Connection, pubkey: PublicKey, configId: string, pubkeyOld?: PublicKey, configIdOld?: string ) * */ /** * @dev General note on how function should behave * @type ITradeDataInfo: should specify the version of the trade * @type IOfferDataInfo: should specify the version of the offer * * @function getTradesByStatus should return all trades in the unified format: ITradeDataInfo * @function getOffersByStatus should return all offers in the unified format: IOfferDataInfo * @function getTradesByBuyerAddress should return all trades in the unified format: ITradeDataInfo * @function getTradesBySellerAddress should return all trades in the unified format: ITradeDataInfo * * @function makeOffer should allow create offer in latest version (matching-engine) * @function requestCreateTrade should allow create trade in both version * @function cancelOffer should allow cancel offer in both version * @function release should allow release trade in both version * @function callArbitrator should allow callArbitrator trade in both version * @function resolveDispute should allow resolveDispute trade in both version */ export interface EscrowRouterInterface { getTradesByStatus(tradeStatus: object, side?: object): Promise; getOffersByStatus(offerStatus: object, side?: object): Promise; getTradesByBuyerAddress(buyerAddress: PublicKey): Promise<(ITradeDataInfo | null)[]>; getTradesBySellerAddress(sellerAddress: PublicKey): Promise<(ITradeDataInfo | null)[]>; getTradeDataByID(tradeId: BN, version?: Version, refresh?: boolean): Promise; getOfferDataByID(offerId: BN, version?: Version, refresh?: boolean): Promise; makeOffer(wallet: Wallet, tokenMint: PublicKey, side: object, bondType: object, minTradeSize: Decimal, tokenAmount: BN, fiatAmount: BN, encryptedBankName: string | null, encryptedAccountNumber: string | null, encryptedAccountName: string | null, nonce: string | null): Promise<{ tx: TransactionBuilder; id: BN; }>; /** * @dev @maket_instance can be find, based on the combination of config and token mint * @param offerInfo: Should contain which Version we are */ requestCreateTrade(user: PublicKey, offerInfo: IOfferDataInfo, tradeAmount: BN, tokenMint?: PublicKey): Promise<{ tx: TransactionBuilder; id: BN; }>; cancelOffer(wallet: Wallet, offerInfo: IOfferDataInfo): Promise; release(wallet: Wallet, tradeData: ITradeDataInfo): Promise; callArbitrator(wallet: Wallet, tradeData: ITradeDataInfo): Promise; resolveDispute(wallet: Wallet, tradeData: ITradeDataInfo, disputeAction: object, compensationAction: object): Promise; }