import { Address } from './encoding/address.js'; import { SignedTransaction } from './signedTransaction.js'; import { Transaction } from './transaction.js'; import { LogicSig, LogicSigAccount } from './logicsig.js'; import type { TransactionSigner } from './signer.js'; /** * The domain-separation prefix prepended to arbitrary bytes before signing them * with {@link signBytes}, so that such a signature can never be mistaken for a * signature over a transaction or a program. */ export declare const SIGN_BYTES_PREFIX: Uint8Array; /** * @deprecated Use signTransactionWithSigner * * signTransaction takes an object with either payment or key registration fields and * a secret key and returns a signed blob. * * Payment transaction fields: from, to, amount, fee, firstValid, lastValid, genesisHash, * note(optional), GenesisID(optional), closeRemainderTo(optional) * * Key registration fields: fee, firstValid, lastValid, voteKey, selectionKey, voteFirst, * voteLast, voteKeyDilution, genesisHash, note(optional), GenesisID(optional) * * If flatFee is not set and the final calculated fee is lower than the protocol minimum fee, the fee will be increased to match the minimum. * @param txn - object with either payment or key registration fields * @param sk - Algorand Secret Key * @returns object contains the binary signed transaction and its txID */ export declare function signTransaction(txn: Transaction, sk: Uint8Array): { txID: string; blob: Uint8Array; }; /** * signTransactionWithSigner signs a single transaction with the given signer. * * @remarks * This is the replacement for the deprecated {@link signTransaction}, which can * only sign with a raw ed25519 secret key. Because a `TransactionSigner` signs * a group, the transaction is passed as a one-element group and the single * result is returned. * * The decoded `stxn` is returned alongside the blob so callers can read what * the signer produced — its `sig`, `pqsig` or `msig` field, and the `sgnr` field * naming the key that signed when it is not the transaction sender. * * @param txn - the transaction to sign * @param signer - the signer to sign with * @returns an object with blob, txID and stxn properties */ export declare function signTransactionWithSigner(txn: Transaction, signer: TransactionSigner): Promise & { stxn: SignedTransaction; }>; /** * signBytes takes arbitrary bytes and a secret key, prepends the bytes with "MX" for domain separation, signs the bytes * with the private key, and returns the signature. * @param bytes - Uint8array * @param sk - Algorand secret key * @returns binary signature */ export declare function signBytes(bytes: Uint8Array, sk: Uint8Array): Uint8Array; /** * verifyBytes takes array of bytes, an address, and a signature and verifies if the signature is correct for the public * key and the bytes (the bytes should have been signed with "MX" prepended for domain separation). * @param bytes - Uint8Array * @param signature - binary signature * @param addr - string address * @returns bool */ export declare function verifyBytes(bytes: Uint8Array, signature: Uint8Array, addr: string | Address): boolean; /** * signLogicSigTransactionObject takes a transaction and a LogicSig object and * returns a signed transaction. * * @param txn - The transaction to sign. * @param lsigObject - The LogicSig object that will sign the transaction. * * @returns Object containing txID and blob representing signed transaction. */ export declare function signLogicSigTransactionObject(txn: Transaction, lsigObject: LogicSig | LogicSigAccount): { txID: string; blob: Uint8Array; }; /** * signLogicSigTransaction takes a transaction and a LogicSig object and returns * a signed transaction. * * @param txn - The transaction to sign. * @param lsigObject - The LogicSig object that will sign the transaction. * * @returns Object containing txID and blob representing signed transaction. * @throws error on failure */ export declare function signLogicSigTransaction(txn: Transaction, lsigObject: LogicSig | LogicSigAccount): { txID: string; blob: Uint8Array; };