import { KeyPair } from '@polkadot-labs/hdkd-helpers'; import { Transaction, TypedApi, Binary } from 'polkadot-api'; import { gdev, gdev_local, gtest, MultiAddress } from './descriptors'; export interface TransferParams { to: string | string[]; amount: number | number[]; comment?: string; } /** * Factory for creating blockchain transactions * Follows Single Responsibility Principle (SRP) - only creates transactions */ export declare class TransactionFactory { private api; private cryptoService; private signatureService; constructor(api: TypedApi); /** * Pay with optional comment. * Accepts an array of addresses and amounts. * If `comment` is provided, it will be added to the transaction. * If `to` is a string, but `amount` is an array of numbers, it will perform a transfer with the sum of the amounts. * If `to` is an array, but `amount` is a number, it will perform a transfer for each address with the same amount. * If `to` is an array and the `amount` is an array, it will perform a transfer for each address with the corresponding amount. * @param params - The parameters object * @param params.to - The address to pay * @param params.amount - The amount to pay (in cents) * @param [params.comment] - The comment to add to the transaction * @returns The transaction to pay */ pay({ to, amount, comment }: TransferParams): Transaction<{ value: bigint; dest: MultiAddress; }, "Balances", "transfer_keep_alive", void | undefined> | Transaction<{ calls: import('polkadot-api').TxCallData[]; }, "Utility", "batch_all", void | undefined>; /** * Create a single transfer transaction * @param to - The recipient address * @param amount - The amount to transfer * @returns The transfer transaction */ private _createSingleTransfer; /** * Create a batch transfer with optional comment * @param recipients - Array of recipient addresses * @param amounts - Array of amounts to transfer * @param comment - Optional comment to add * @returns The batch transaction */ private _createBatchTransfer; /** * Create a remark transaction * @param comment - The comment to add * @returns The remark transaction */ private _createRemarkTransaction; /** * Claim UD * @returns The transaction to claim UD */ claimUds(): Transaction; /** * Certify an identity * @param receiver - The index of the identity to certify * @returns The transaction to certify */ certify(receiver: number): Transaction<{ receiver: number; }, "Certification", "add_cert", void | undefined>; /** * Create an identity * @param owner_key - The owner key (ss58 address) * @returns The transaction to create an identity */ createIdentity(owner_key: string): Transaction<{ owner_key: import('polkadot-api').SS58String; }, "Identity", "create_identity", void | undefined>; /** * Confirm an identity * @param idty_name - The name of the identity * - Minimum length: 3 * - Maximum length: 42 * - Accept only ascii alphanumeric or `-` or `_` * @see https://doc-duniter-org.ipns.gyroi.de/src/duniter_primitives/lib.rs.html#22-28 * @returns The transaction to confirm an identity */ confirmIdentity(idty_name: string): Transaction<{ idty_name: Binary; }, "Identity", "confirm_identity", void | undefined>; /** * Transfer all the balance to an address * @param to - The address to transfer the balance to * @returns The transaction to transfer all the balance */ transferAll(to: string): Transaction<{ dest: MultiAddress; keep_alive: boolean; }, "Balances", "transfer_all", void | undefined>; /** * Change the owner key of an identity * @param params - The parameters object * @param params.from - The current owner key * @param params.keyPair - The key pair for signing the message * @returns The transaction to change the owner key */ changeOwnerKey({ from, keyPair }: { from: string; keyPair: KeyPair; }): Promise>; }