import { BalanceOf } from '@polkadot/types/interfaces';
import { HexString } from '@polkadot/util/types';
import { ISubmittableResult } from '@polkadot/types/types';
import { SubmittableExtrinsic } from '@polkadot/api/types';
import { ICallOptions, IUpdateVoucherParams, IVoucherDetails } from '../types';
import { GearTransaction } from './Transaction';
export declare class GearVoucher extends GearTransaction {
    /**
     * ### Issue a new voucher for a `user` to be used to pay for sending messages to `program_id` program.
     * @param spender The voucher holder account id.
     * @param value The voucher amount.
     * @param duration (optional) The number of the block until which the voucher is valid. If not specified, the voucher is valid in `api.voucher.minDuration` blocks.
     * @param programs (optional) The list of programs that the voucher can be used for. If not specified, the voucher can be used for any program.
     * @param codeUploading (optional) Whether the voucher can be used for uploading code.
     * @returns The voucher id and the extrinsic to submit.
     *
     * @example
     * ```javascript
     * import { VoucherIssued } from '@gear-js/api';
     * const programId = '0x..';
     * const account = '0x...';
     * const { extrinsic } = await api.voucher.issue(account, programId, 10000);
     * extrinsic.signAndSend(account, ({ events, status }) => {
     *   if (status.isInBlock) {
     *     const voucherIssuedEvent = events.find(({event: { method }}) => method === 'VoucherIssued')?.event as VoucherIssued;
     *
     *     if (voucherIssuedEvent) {
     *       console.log('voucherId:', voucherIssuedEvent.data.voucherId);
     *     }
     *   }
     * })
     * ```
     */
    issue(spender: HexString, value: number | bigint | BalanceOf | string, duration?: number, programs?: HexString[], codeUploading?: boolean): Promise<{
        extrinsic: SubmittableExtrinsic<'promise', ISubmittableResult>;
        voucherId: HexString;
    }>;
    /**
     * Issue a new voucher. This method is available only for runtime versions < 1100.
     * @deprecated
     * @param to
     * @param program
     * @param value
     * @returns
     */
    issueDeprecated(to: HexString, program: HexString, value: number | bigint | string): {
        extrinsic: SubmittableExtrinsic<'promise', ISubmittableResult>;
        voucherId: HexString;
    };
    /**
     * ### Use a voucher to send a message to a program.
     * @param voucherId The id of the voucher to be used.
     * @param params Either `SendMessage` or `SendReply` call options.
     * @returns Extrinsic to submit
     * @example
     * ```javascript
     * const programId = '0x..';
     * const voucherId = '0x...';
     * const msgTx = api.message.send(...);
     * const tx = api.voucher.call(voucherId, { SendMessage: msgTx });
     * tx.signAndSend(account, (events) => {
     *  events.forEach(({ event }) => console.log(event.toHuman()));
     * })
     * ```
     */
    call(voucherId: string, params: ICallOptions): SubmittableExtrinsic<'promise', ISubmittableResult>;
    /**
     * Use a voucher to send a message to a program. This method is available only for runtime versions < 1100.
     * @deprecated
     * @param params
     * @returns
     */
    callDeprecated(params: ICallOptions): SubmittableExtrinsic<'promise', ISubmittableResult>;
    /**
     * ### Revoke a voucher.
     * @param spender The voucher holder account id.
     * @param voucherId The id of the voucher to be revoked.
     * @returns Extrinsic to submit
     * @example
     * ```javascript
     * const spenderId = '0x...'
     * api.voucher.revoke(spenderId, voucherId).signAndSend(account, (events) => {
     *   events.forEach(({event}) => console.log(event.toHuman()));
     * });
     * ```
     */
    revoke(spender: string, voucherId: string): SubmittableExtrinsic<'promise', ISubmittableResult>;
    /**
     * ### Update a voucher.
     * @param spender The voucher holder account id.
     * @param voucherId The id of the voucher to be updated.
     * @param params The update parameters.
     * @returns Extrinsic to submit
     *
     * @example
     * ```javascript
     * const spenderId = '0x...'
     * api.voucher.update(spenderId, voucherId, { balanceTopUp: 100 * 10 ** 12 }).signAndSend(account, (events) => {
     *  events.forEach(({event}) => console.log(event.toHuman()));
     * });
     * ```
     */
    update(spender: string, voucherId: string, params: IUpdateVoucherParams): SubmittableExtrinsic<'promise', ISubmittableResult>;
    /**
     * ### Decline existing and not expired voucher.
     * @param voucherId The id of the voucher to be declined
     * @returns Extrinsic to submit
     */
    decline(voucherId: string): SubmittableExtrinsic<'promise', ISubmittableResult>;
    /**
     * ### Check if a voucher exists.
     * @param accountId
     * @param programId
     * @returns
     */
    exists(accountId: string, programId: HexString): Promise<boolean>;
    /**
     * ### Get all vouchers for account.
     * @param accountId
     * @returns
     */
    getAllForAccount(accountId: string, programId?: HexString): Promise<Record<string, IVoucherDetails>>;
    /**
     * ### Get all vouchers issued by an account.
     * If many voucher are issued, this may take a while.
     * @param accountId - The account id of the owner of the vouchers.
     * @returns - An array of voucher ids.
     */
    getAllIssuedByAccount(accountId: string): Promise<string[]>;
    /**
     * ### Get voucher details.
     * @param accountId
     * @param voucherId
     * @returns
     */
    getDetails(accountId: string, voucherId: string): Promise<IVoucherDetails>;
    /**
     * ### Minimum duration in blocks voucher could be issued/prolonged for.
     */
    get minDuration(): number;
    /**
     * ### Maximum duration in blocks voucher could be issued/prolonged for.
     */
    get maxDuration(): number;
    /**
     * ### Maximum amount of programs to be specified to interact with.
     */
    get maxProgramsAmount(): number;
}
