///
import BN from 'bn.js';
import { AccountInfo, BlockhashWithExpiryBlockHeight, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SimulatedTransactionResponse, Transaction, TransactionConfirmationStatus, TransactionInstruction, TransactionSignature } from '@solana/web3.js';
import { OpenOrders } from '@project-serum/serum';
import { I80F48 } from './fixednum';
import MangoGroup from '../MangoGroup';
import { HealthType } from '../MangoAccount';
/**
* If transaction is not confirmed by validators in 152 blocks
* from signing by the wallet
* it will never reach blockchain and is considered a timeout
*
* (e.g. transaction is signed at 121398019 block
* if its not confirmed by the time blockchain reach 121398171 (121398019 + 152)
* it will never reach blockchain)
*/
export declare const MAXIMUM_NUMBER_OF_BLOCKS_FOR_TRANSACTION = 152;
/** @internal */
export declare const ZERO_BN: BN;
/** @internal */
export declare const ONE_BN: BN;
/** @internal */
export declare const U64_MAX_BN: BN;
/** @internal */
export declare const I64_MAX_BN: BN;
/** @internal */
export declare const zeroKey: PublicKey;
/** @internal */
export declare function promiseUndef(): Promise;
/** @internal */
export declare function promiseNull(): Promise;
export declare function optionalBNFromString(x?: string): BN | undefined;
export declare function uiToNative(amount: number, decimals: number): BN;
export declare function nativeToUi(amount: number, decimals: number): number;
export declare function nativeI80F48ToUi(amount: I80F48, decimals: number): I80F48;
export declare class TimeoutError extends Error {
message: string;
txid: string;
constructor({ txid }: {
txid: any;
});
}
export declare class MangoError extends Error {
message: string;
txid: string;
constructor({ txid, message }: {
txid: any;
message: any;
});
}
/**
* Return weights corresponding to health type;
* Weights are all 1 if no healthType provided
*/
export declare function getWeights(mangoGroup: MangoGroup, marketIndex: number, healthType?: HealthType): {
spotAssetWeight: I80F48;
spotLiabWeight: I80F48;
perpAssetWeight: I80F48;
perpLiabWeight: I80F48;
};
export declare function splitOpenOrders(openOrders: OpenOrders): {
quoteFree: I80F48;
quoteLocked: I80F48;
baseFree: I80F48;
baseLocked: I80F48;
};
export declare function awaitTransactionSignatureConfirmation(txid: TransactionSignature, timeout: number, connection: Connection, confirmLevel: TransactionConfirmationStatus, signedAtBlock?: BlockhashWithExpiryBlockHeight): Promise;
export declare function sleep(ms: any): Promise;
export declare function simulateTransaction(connection: Connection, transaction: Transaction, commitment: Commitment): Promise>;
export declare function createAccountInstruction(connection: Connection, payer: PublicKey, space: number, owner: PublicKey, lamports?: number): Promise<{
account: Keypair;
instruction: TransactionInstruction;
}>;
export declare function createTokenAccountInstructions(connection: Connection, payer: PublicKey, account: PublicKey, mint: PublicKey, owner: PublicKey): Promise;
export declare function createSignerKeyAndNonce(programId: PublicKey, accountKey: PublicKey): Promise<{
signerKey: PublicKey;
signerNonce: number;
}>;
export declare function getFilteredProgramAccounts(connection: Connection, programId: PublicKey, filters: any): Promise<{
publicKey: PublicKey;
accountInfo: AccountInfo;
}[]>;
export declare function clamp(x: number, min: number, max: number): number;
export declare function getMultipleAccounts(connection: Connection, publicKeys: PublicKey[], commitment?: Commitment): Promise<{
publicKey: PublicKey;
context: {
slot: number;
};
accountInfo: AccountInfo;
}[]>;
/**
* Throw if undefined; return value otherwise
* @internal
*/
export declare function throwUndefined(x: T | undefined): T;
/**
* Calculate the base lot size and quote lot size given a desired min tick and min size in the UI
*/
export declare function calculateLotSizes(baseDecimals: number, quoteDecimals: number, minTick: number, minSize: number): {
baseLotSize: BN;
quoteLotSize: BN;
};
/**
* Return some standard params for a new perp market
* oraclePrice is the current oracle price for the perp market being added
* Assumes a rate 1000 MNGO per hour for 500k liquidity rewarded
* `nativeBaseDecimals` are the decimals for the asset on the native chain
*/
export declare function findPerpMarketParams(nativeBaseDecimals: number, quoteDecimals: number, oraclePrice: number, leverage: number, mngoPerHour: number): {
maintLeverage: number;
initLeverage: number;
liquidationFee: number;
makerFee: number;
takerFee: number;
baseLotSize: number;
quoteLotSize: number;
rate: number;
maxDepthBps: number;
exp: number;
maxNumEvents: number;
targetPeriodLength: number;
mngoPerPeriod: number;
version: number;
lmSizeShift: number;
decimals: number;
minTick: number;
minSize: number;
baseDecimals: number;
};
export declare const prependFeePrioritizationIx: (transaction: any, prioritizationFee: any) => any;
//# sourceMappingURL=utils.d.ts.map