import { Context, TransactionQueue } from "../internal"; import { ProcedureAuthorizationStatus, ProcedureOpts } from "../types"; import { AddBatchTransactionArgs, AddTransactionArgs, MaybePostTransactionValue, PostTransactionValueArray, ProcedureAuthorization } from "../types/internal"; /** * @hidden * * Represents an operation performed on the Polymesh blockchain. * A Procedure can be prepared to yield a {@link TransactionQueue} that can be run */ export declare class Procedure> { private prepareTransactions; private getAuthorization; private prepareStorage; private transactions; private _storage; private _context; /** * @hidden * * @param prepareTransactions - function that prepares the transaction queue * @param getAuthorization - can be a ProcedureAuthorization object or a function that returns a ProcedureAuthorization object */ constructor(prepareTransactions: (this: Procedure, args: Args) => Promise>, getAuthorization?: ProcedureAuthorization | ((this: Procedure, args: Args) => Promise | ProcedureAuthorization), prepareStorage?: (this: Procedure, args: Args) => Promise | Storage); /** * @hidden * Set the context and storage (if not already set), return the Context */ private setup; /** * @hidden * Reset the procedure */ private cleanup; /** * @hidden */ private _checkAuthorization; /** * Check if the current user has sufficient authorization to run the procedure * * @param args - procedure arguments */ checkAuthorization(args: Args, context: Context, opts?: ProcedureOpts): Promise; /** * Build a {@link TransactionQueue} that can be run * * @param args.args - arguments required to prepare the queue * @param args.transformer - optional function that transforms the Procedure result * @param context - context in which the resulting queue will run * @param opts.signer - address that will be used as a signer for this procedure */ prepare(args: { args: Args; transformer?: (value: ReturnValue) => QueueReturnType | Promise; }, context: Context, opts?: ProcedureOpts): Promise>; /** * Appends a transaction into this Procedure's queue. This defines * what will be run by the TransactionQueue when it is started * * @returns an array of {@link PostTransactionValue}. Each element corresponds to whatever is returned by one of the resolver functions passed as options */ addTransaction(args: AddTransactionArgs): PostTransactionValueArray; /** * Appends a Procedure into this Procedure's queue. This defines * what will be run by the TransactionQueue when it is started * * @param proc - a Procedure that will be run as part of this Procedure's Transaction Queue * @param args - arguments to be passed to the procedure * * @returns whichever value is returned by the passed Procedure */ addProcedure(procedure: Procedure, args: ProcArgs): Promise>; addProcedure(procedure: Procedure): Promise>; /** * Appends a batch of transactions into this Procedure's queue. This defines * what will be run by the TransactionQueue when it is started * * @returns an array of {@link PostTransactionValue}. Each element corresponds to whatever is returned by one of the resolver functions passed as options */ addBatchTransaction(args: AddBatchTransactionArgs): PostTransactionValueArray; /** * internal data container. Used to store common fetched/processed data that is * used by both `prepareTransactions` and `checkAuthorization` */ get storage(): Storage; /** * contains the data services, signing Account, etc. In short, the *context* in which * the Procedure is being run */ get context(): Context; } //# sourceMappingURL=Procedure.d.ts.map