import { AccountInfo, Connection, Finality, Keypair, ParsedTransactionWithMeta, PublicKey, TransactionInstruction } from '@solana/web3.js';
import { BN, IdlAccounts, Program, ProgramAccount } from '@project-serum/anchor';
import { Category, ACTION_CODES, PaymentStreamingAccount, Stream, StreamActivity, StreamEventData, StreamTemplate, SubCategory, TransactionFees, AccountActivity, ActivityRaw, STREAM_STATUS_CODE } from './types';
import { Msp as Ps } from './msp_idl_005';
type RawStream = IdlAccounts<Ps>['stream'];
type RawTreasury = IdlAccounts<Ps>['treasury'];
type RawStreamTemplate = IdlAccounts<Ps>['streamTemplate'];
export declare const createProgram: (connection: Connection, programId: string | PublicKey) => Program<Ps>;
export declare const getStream: (program: Program<Ps>, address: PublicKey) => Promise<Stream | null>;
export declare function getStreamEventData(program: Program<Ps>, address: PublicKey): Promise<StreamEventData | null>;
export declare const getStreamCached: (streamInfo: Stream) => Promise<Stream>;
export declare const listStreams: (program: Program<Ps>, psAccountOwner?: PublicKey | undefined, psAccount?: PublicKey | undefined, beneficiary?: PublicKey | undefined, category?: Category, subCategory?: SubCategory) => Promise<Stream[]>;
export declare const listStreamsCached: (streamInfoList: Stream[]) => Promise<Stream[]>;
export declare const listStreamActivity: (program: Program<Ps>, address: PublicKey, before?: string, limit?: number, commitment?: Finality | undefined) => Promise<StreamActivity[]>;
export declare const getAccount: (program: Program<Ps>, address: PublicKey) => Promise<PaymentStreamingAccount>;
export declare const getStreamTemplate: (program: Program<Ps>, address: PublicKey) => Promise<StreamTemplate>;
export declare const findStreamTemplateAddress: (psAccount: PublicKey, programId: PublicKey) => [PublicKey, number];
export declare const listAccounts: (program: Program<Ps>, owner?: PublicKey | undefined, excludeAutoClose?: boolean, category?: Category, subCategory?: SubCategory) => Promise<PaymentStreamingAccount[]>;
export declare const calculateFeesForAction: (action: ACTION_CODES) => Promise<TransactionFees>;
export declare const calculateAllocationAmount: (connection: Connection, psAccount: PaymentStreamingAccount, allocation: string | number) => Promise<BN>;
export declare const getFilteredStreamAccounts: (program: Program<Ps>, psAccountOwner?: PublicKey | undefined, psAccount?: PublicKey | undefined, beneficiary?: PublicKey | undefined, category?: Category, subCategory?: SubCategory) => Promise<ProgramAccount<import("@project-serum/anchor/dist/cjs/program/namespace/types").TypeDef<{
    name: "stream";
    type: {
        "kind": "struct";
        "fields": [{
            "name": "version";
            "type": "u8";
        }, {
            "name": "initialized";
            "type": "bool";
        }, {
            "name": "name";
            "type": {
                "array": ["u8", 32];
            };
        }, {
            "name": "treasurerAddress";
            "type": "publicKey";
        }, {
            "name": "rateAmountUnits";
            "type": "u64";
        }, {
            "name": "rateIntervalInSeconds";
            "type": "u64";
        }, {
            "name": "startUtc";
            "docs": ["The start timestamp in seconds"];
            "type": "u64";
        }, {
            "name": "cliffVestAmountUnits";
            "docs": ["The amount availaible to withdraw inmidiately (without streaming)", "once the money stream starts.", "If both 'cliff_vest_amount_units' and 'cliff_vest_percent' are provided, the former will be used."];
            "type": "u64";
        }, {
            "name": "cliffVestPercent";
            "docs": ["The percent of the allocation assigned that is availaible to withdraw", "inmidiately (without streaming) once the money stream starts.", "If both 'cliff_vest_amount_units' and 'cliff_vest_percent' are provided, the second (this field) will be used."];
            "type": "u64";
        }, {
            "name": "beneficiaryAddress";
            "type": "publicKey";
        }, {
            "name": "beneficiaryAssociatedToken";
            "type": "publicKey";
        }, {
            "name": "treasuryAddress";
            "type": "publicKey";
        }, {
            "name": "allocationAssignedUnits";
            "docs": ["Amount of tokens allocated to the stream on creation or top up. If the", "treasurer decides to close the stream, the vested amount will be sent", "to the benefifiary and the unvested amount will be sent to the", "treasurer", "", "The allocation assigned will be affected by the following instructions:", "`addFunds`"];
            "type": "u64";
        }, {
            "name": "allocationReservedUnits";
            "docs": ["Amount of tokens reserved to the stream. If the treasurer decides to", "close the stream, the total amount (vested and unvested) WILL be sent", "to the beneficiary", "", "[deprecated] The allocation reserved will be affected by the following instructions:", "`addFunds`"];
            "type": "u64";
        }, {
            "name": "totalWithdrawalsUnits";
            "docs": ["Withdrawal tracking", "The total amount that has been withdrawn by the beneficiary"];
            "type": "u64";
        }, {
            "name": "lastWithdrawalUnits";
            "docs": ["The last amount withdrew by the beneficiary"];
            "type": "u64";
        }, {
            "name": "lastWithdrawalSlot";
            "docs": ["The slot number when the last withdrawal was executed"];
            "type": "u64";
        }, {
            "name": "lastWithdrawalBlockTime";
            "docs": ["The blocktime value when the last withdrawal was executed"];
            "type": "u64";
        }, {
            "name": "lastManualStopWithdrawableUnitsSnap";
            "docs": ["How can a stream STOP? -> There are 2 ways:", "1) by a Manual Action (recordable when it happens) or", "2) by Running Out Of Funds (not recordable when it happens, needs to be calculated)"];
            "type": "u64";
        }, {
            "name": "lastManualStopSlot";
            "type": "u64";
        }, {
            "name": "lastManualStopBlockTime";
            "type": "u64";
        }, {
            "name": "lastManualResumeRemainingAllocationUnitsSnap";
            "docs": ["The remaining allocation units at the moment of the last manual resume", "must be set when calling the Resume Stream"];
            "type": "u64";
        }, {
            "name": "lastManualResumeSlot";
            "type": "u64";
        }, {
            "name": "lastManualResumeBlockTime";
            "type": "u64";
        }, {
            "name": "lastKnownTotalSecondsInPausedStatus";
            "docs": ["The total seconds that have been paused since the start_utc", "increment when resume is called manually"];
            "type": "u64";
        }, {
            "name": "lastAutoStopBlockTime";
            "docs": ["The last blocktime when the stream was stopped", "either manually or automaticaly (run out of funds)"];
            "type": "u64";
        }, {
            "name": "feePayedByTreasurer";
            "type": "bool";
        }, {
            "name": "startUtcInSeconds";
            "docs": ["The start timestamp blocktime"];
            "type": "u64";
        }, {
            "name": "createdOnUtc";
            "docs": ["Unix timestamp (in seconds) when the stream was created"];
            "type": "u64";
        }, {
            "name": "category";
            "docs": ["Indicates the main product category such as `Vesting(1)`", "The default value is set to a `Default(0)` cateogry."];
            "type": "u8";
        }, {
            "name": "subCategory";
            "docs": ["Indicates the sub product category such as `Advisor(1)`, Development(2)", "The default value is set to a `Default(0)` sub_cateogry."];
            "type": "u8";
        }];
    };
} & {
    name: "stream";
}, Record<string, never>>>[]>;
/**
 * Parses program account items
 * @param rawStream
 * @param address
 * @param blockTime
 * @returns Stream
 */
export declare const parseRawStreamAccount: (rawStream: RawStream, address: PublicKey, blockTime: number) => Stream;
export declare function parseProgramTransactions(transactions: ParsedTransactionWithMeta[], programId: PublicKey, psAccountAddress?: PublicKey, streamAddress?: PublicKey): Promise<ActivityRaw[]>;
export declare const parseAccountData: (rawAccount: RawTreasury, accountAddress: PublicKey) => PaymentStreamingAccount;
export declare const parseStreamTemplateData: (template: RawStreamTemplate, address: PublicKey) => StreamTemplate;
export declare const getStreamEstDepletionDate: (stream: RawStream) => Date;
export declare const getStreamCliffAmount: (stream: RawStream) => BN;
export declare const getFundsLeftInStream: (stream: RawStream, timeDiff?: number) => BN;
export declare const getFundsSentToBeneficiary: (stream: RawStream, timeDiff?: number) => BN;
export declare const getStreamRemainingAllocation: (stream: RawStream) => BN;
export declare const getStreamWithdrawableAmount: (stream: RawStream, timeDiff?: number) => BN;
/**
 * Mimics msp program -> `stream.get_status()`
 * @param stream Raw stream as defined in IDL
 * @param timeDiff
 */
export declare const getStreamStatusCode: (stream: RawStream, timeDiff: number) => STREAM_STATUS_CODE;
export declare const isStreamManuallyPaused: (stream: RawStream) => boolean;
export declare const getStreamUnitsPerSecond: (rateAmountUnits: number | string | BN, rateIntervalInSeconds: number | string | BN) => number;
export declare const getStreamStartUtcInSeconds: (stream: RawStream) => number;
export declare const getStreamWithdrawableUnitsWhilePaused: (stream: RawStream) => BN;
export declare const getStreamedUnits: (rawStream: RawStream, seconds: BN) => BN;
export declare function fundExistingWSolAccountInstructions(connection: Connection, owner: PublicKey, ownerWSolTokenAccount: PublicKey, payer: PublicKey, amountToWrapInLamports: number): Promise<[TransactionInstruction[], Keypair]>;
export declare function createAtaCreateInstructionIfNotExists(ataAddress: PublicKey, mintAddress: PublicKey, ownerAccountAddress: PublicKey, payerAddress: PublicKey, connection: Connection): Promise<TransactionInstruction | null>;
export declare function createAtaCreateInstruction(ataAddress: PublicKey, mintAddress: PublicKey, ownerAccountAddress: PublicKey, payerAddress: PublicKey): Promise<[PublicKey, TransactionInstruction]>;
export declare function createWrapSolInstructions(connection: Connection, wSolAmountInLamports: number | BN | string, owner: PublicKey, ownerWSolTokenAccount: PublicKey, ownerWSolTokenAccountInfo: AccountInfo<Buffer> | null): Promise<[TransactionInstruction[], Keypair[]]>;
export declare function sleep(ms: number): Promise<unknown>;
export declare const listAccountActivity: (program: Program<Ps>, address: PublicKey, before?: string, limit?: number, commitment?: Finality | undefined) => Promise<AccountActivity[]>;
export declare function toUnixTimestamp(date: Date): number;
export {};
