import { AugmentedEvents, AugmentedSubmittable, DecoratedRpc, QueryableCalls, QueryableConsts, QueryableStorage, SubmittableExtrinsic, SubmittableExtrinsics } from '@polkadot/api/types'; import { RpcInterface } from '@polkadot/rpc-core/types'; import { Bytes, u32 } from '@polkadot/types'; import { PolymeshPrimitivesAssetAssetId, PolymeshPrimitivesStatisticsStatOpType, PolymeshPrimitivesTicker } from '../../node_modules/@polymeshassociation/polymesh-types/polkadot/types-lookup'; import { ISubmittableResult, Signer as PolkadotSigner } from '@polkadot/types/types'; import BigNumber from 'bignumber.js'; import { Identity, Procedure } from '../internal'; import { CallIdEnum, ModuleIdEnum } from '../middleware/types'; import { ClaimType, FungibleAsset, InputStatClaim, KnownAssetType, KnownNftType, MortalityProcedureOpt, MultiSig, MultiSigProcedureOpt, PermissionGroupType, Role, SignerValue, SimplePermissions, TxData } from '../types'; /** * Polkadot's `tx` submodule */ export type Extrinsics = SubmittableExtrinsics<'promise'>; /** * Parameter list for a specific extrinsic * * @param ModuleName - pallet name (e.g. 'asset') * @param TransactionName - extrinsic name (e.g. 'registerUniqueTicker') */ export type ExtrinsicParams = Parameters; /** * Polkadot's events */ export type Events = AugmentedEvents<'promise'>; /** * Polkadot's `query` submodule */ export type Queries = QueryableStorage<'promise'>; /** * Polkadot's `call` submodule */ export type Calls = QueryableCalls<'promise'>; /** * Polkadot's `consts` submodule */ export type Consts = QueryableConsts<'promise'>; export type Rpcs = DecoratedRpc<'promise', RpcInterface>; /** * Low level transaction method in the polkadot API * * @param Args - arguments of the transaction */ export type PolymeshTx = Readonly> = AugmentedSubmittable<(...args: Args) => SubmittableExtrinsic<'promise'>>; interface BaseTx { /** * underlying polkadot transaction object */ transaction: PolymeshTx; /** * amount by which the protocol fees should be multiplied (only applicable to transactions where the input size impacts the total fees) */ feeMultiplier?: BigNumber | undefined; /** * protocol fees associated with running the transaction (not gas). If not passed, they will be fetched from the chain. This is used for * special cases where the fees aren't trivially derived from the extrinsic type */ fee?: BigNumber | undefined; } /** * Object containing a low level transaction and its respective arguments */ export type TxWithArgs = BaseTx & (Args extends [] ? { args?: undefined; } : { args: Args; }); export type TxDataWithFees = TxData & Omit, 'args'>; /** * Apply the {@link PolymeshTx} type to all args in an array */ export type MapPolymeshTx = { [K in keyof ArgsArray]: ArgsArray[K] extends unknown[] ? PolymeshTx : never; }; /** * Apply the {@link TxWithArgs} type to all args in an array */ export type MapTxWithArgs = { [K in keyof ArgsArray]: ArgsArray[K] extends unknown[] ? TxWithArgs : never; }; /** * Apply the {@link TxDataWithFees} type to all args in an array */ export type MapTxDataWithFees = { [K in keyof ArgsArray]: ArgsArray[K] extends unknown[] ? TxDataWithFees : never; }; /** * Transform a tuple of types into an array of resolver functions. For each type in the tuple, the corresponding resolver function returns that type wrapped in a promise */ export type ResolverFunctionArray = { [K in keyof Values]: (receipt: ISubmittableResult) => Promise | Values[K]; }; /** * Function that returns a value (or promise that resolves to a value) from a transaction receipt */ export type ResolverFunction = (receipt: ISubmittableResult) => Promise | ReturnValue; /** * Representation of the value that will be returned by a Procedure after it is run * * It can be: * - a plain value * - a resolver function that returns either a value or a promise that resolves to a value */ export type MaybeResolverFunction = ResolverFunction | ReturnValue; /** * @hidden */ export declare function isResolverFunction(value: MaybeResolverFunction): value is ResolverFunction; /** * Base Transaction Schema */ export interface BaseTransactionSpec { /** * third party Identity that will pay for the transaction (for example when joining an Identity/multisig as a secondary key). * This is separate from a subsidy, and takes precedence over it. If the signing Account is being subsidized and * they try to execute a transaction with `paidForBy` set, the fees will be paid for by the `paidForBy` Identity */ paidForBy?: Identity | undefined; /** * If present that means the current transaction is a MultiSigProposal and the `signingAccount` is a signer for this MultiSig * * The proposal will be executed on chain after enough signers have approved the transaction */ multiSig?: MultiSig | null | undefined; /** * Optional validation function that runs before the transaction is executed. * Receives an object indicating whether the transaction will run as a MultiSig proposal. * This allows procedures to defer validation logic (like balance checks) until the execution method is known. */ preRunValidation?: ((args: { asProposal: boolean; }) => Promise) | undefined; /** * value that the transaction will return once it has run, or a function that returns that value */ resolver: MaybeResolverFunction; /** * function that transforms the transaction's return value before returning it after it is run */ transformer?: ((result: ReturnValue) => Promise | TransformedReturnValue) | undefined; } /** * Schema of a transaction batch * * @param Args - tuple where each value represents the type of the arguments of one of the transactions * in the batch. There are cases where it is impossible to know this type beforehand. For example, if * the amount (or type) of transactions in the batch depends on an argument or the chain state. For those cases, * `unknown[][]` should be used, and extra care must be taken to ensure the correct transactions (and arguments) * are being returned */ export interface BatchTransactionSpec extends BaseTransactionSpec { /** * transactions in the batch with their respective arguments */ transactions: MapTxWithArgs; } /** * Schema of a specific transaction * * @param Args - arguments of the transaction */ export type TransactionSpec = BaseTransactionSpec & TxWithArgs; /** * Helper type that represents either type of transaction spec */ export type GenericTransactionSpec = BatchTransactionSpec | TransactionSpec; /** * Additional information for constructing the final transaction */ export interface TransactionConstructionData { /** * address of the key that will sign the transaction */ signingAddress: string; /** * object that handles the payload signing logic */ signer?: PolkadotSigner | undefined; /** * how long the transaction should be valid for */ mortality: MortalityProcedureOpt; /** * options that specify details for MultiSig proposals */ multiSigOpts?: MultiSigProcedureOpt | undefined; } export interface AuthTarget { target: SignerValue; authId: BigNumber; } export declare enum TrustedClaimIssuerOperation { Remove = "Remove", Add = "Add", Set = "Set" } export interface ExtrinsicIdentifier { moduleId: ModuleIdEnum; callId: CallIdEnum; } export interface CorporateActionIdentifier { localId: BigNumber; asset: FungibleAsset; } /** * Represents the permissions that a signer must have in order to run a Procedure. In some cases, this must be determined * in a special way for the specific Procedure. In those cases, the resulting value will either be `true` if the signer can * run the procedure, or a string message indicating why the signer *CAN'T* run the Procedure */ export interface ProcedureAuthorization { /** * general permissions that apply to both Secondary Key Accounts and External * Agent Identities. Overridden by `signerPermissions` and `agentPermissions` respectively */ permissions?: SimplePermissions | true | string | undefined; /** * permissions specific to secondary Accounts. This value takes precedence over `permissions` for * secondary Accounts */ signerPermissions?: SimplePermissions | true | string; /** * permissions specific to External Agent Identities. This value takes precedence over `permissions` for * External Agents */ agentPermissions?: Omit | true | string; roles?: Role[] | true | string | undefined; } export type Falsyable = T | null | undefined; export type PermissionsEnum

= 'Whole' | { These: P; } | { Except: P; }; export type PalletPermissions = Map; }>; export declare enum InstructionStatus { Pending = "Pending", Unknown = "Unknown", Failed = "Failed", Success = "Success", Rejected = "Rejected", LockedForExecution = "LockedForExecution" } /** * Determines the subset of permissions an Agent has over an Asset */ export type PermissionGroupIdentifier = PermissionGroupType | { custom: BigNumber; }; export type InternalNftType = KnownNftType | { Custom: u32; }; export type InternalAssetType = KnownAssetType | { Custom: u32; } | { NonFungible: InternalNftType; }; /** * Infer Procedure parameters parameters from a Procedure function */ export type ProcedureParams unknown> = ReturnType extends Procedure ? Params : never; export type ExemptKey = { op: PolymeshPrimitivesStatisticsStatOpType; claimType?: ClaimType | undefined; assetId: PolymeshPrimitivesAssetAssetId; }; export type StatClaimInputType = Omit; export type MeshTickerOrAssetId = { ticker: PolymeshPrimitivesTicker; } | { assetId: PolymeshPrimitivesAssetAssetId; }; export type CustomTypeData = { rawId: u32; rawValue: Bytes; isAlreadyCreated?: boolean; }; /** * Chain v6 and below permission model */ export type MiddlewareV6Extrinsic = Record; }[]>; export type ExtrinsicGroup = { whole: null; } | { these: string[]; }; /** * Chain v7 and above permission model */ export type MiddlewareV7Extrinsic = { extrinsic: { these: { [key: string]: { extrinsics: ExtrinsicGroup; }; }; }; }; export type MiddlewarePermissions = MiddlewareV6Extrinsic | MiddlewareV7Extrinsic; export {}; //# sourceMappingURL=internal.d.ts.map