import { AddressHashMode, AddressVersion, ClarityValue, StacksTransaction } from '@stacks/transactions'; import { AddressDetails, SendParams, TokenTransferParams } from './iface'; import { KeyPair } from '.'; import { StacksNetwork as BitgoStacksNetwork } from '@bitgo/statics'; /** * Encodes a buffer as a "0x" prefixed lower-case hex string. * * @param {Buffer} buff - a buffer with a hexadecimal string * @returns {string} - the hexadecimal string prefixed with "0x" */ export declare function bufferToHexPrefixString(buff: Buffer): string; /** * Remove the "0x" prefix from the given string, if present. * * @param {string} hex - a hexadecimal string * @returns {string} - the hexadecimal string without a leading "0x" */ export declare function removeHexPrefix(hex: string): string; /** * @param tx */ export declare function getTxSenderAddress(tx: StacksTransaction): string; /** * Returns whether or not the string is a valid amount number * * @param {string} amount - the string to validate * @returns {boolean} - the validation result */ export declare function isValidAmount(amount: string): boolean; /** * Returns whether or not the string is a valid protocol address * * @param {string} address - the address to be validated * @returns {boolean} - the validation result */ export declare function isValidAddress(address: string): boolean; /** * Returns whether or not the string is a valid protocol transaction id or not. * * A valid transaction id is a SHA-512/256 hash of a serialized transaction; see * the txidFromData function in @stacks/transaction: * https://github.com/blockstack/stacks.js/blob/master/packages/transactions/src/utils.ts#L97 * * @param {string} txId - the transaction id to be validated * @returns {boolean} - the validation result */ export declare function isValidTransactionId(txId: string): boolean; /** * Returns whether or not the string is a valid protocol public key or * extended public key. * * The key format is documented at * https://github.com/stacksgov/sips/blob/main/sips/sip-005/sip-005-blocks-and-transactions.md#transaction-authorization * * @param {string} pub - the public key to be validated * @returns {boolean} - the validation result */ export declare function isValidPublicKey(pub: string): boolean; /** * Returns whether or not the string is a valid protocol private key, or extended * private key. * * The protocol key format is described in the @stacks/transactions npm package, in the * createStacksPrivateKey function: * https://github.com/blockstack/stacks.js/blob/master/packages/transactions/src/keys.ts#L125 * * @param {string} prv - the private key (or extended private key) to be validated * @returns {boolean} - the validation result */ export declare function isValidPrivateKey(prv: string): boolean; /** * Checks if raw transaction can be deserialized * * @param {unknown} rawTransaction - transaction in raw hex format * @returns {boolean} - the validation result */ export declare function isValidRawTransaction(rawTransaction: unknown): boolean; /** * Returns whether or not the memo string is valid * * @param {string} memo - the string to be validated * @returns {boolean} - the validation result */ export declare function isValidMemo(memo: string): boolean; /** * Checks for valid contract address * * @param {string} addr - contract deployer address * @param {BitgoStacksNetwork} network - network object * @returns {boolean} - the validation result */ export declare function isValidContractAddress(addr: string, network: BitgoStacksNetwork): boolean; /** * Check if the name is one of valid contract names * * @param {string} name - function name * @returns {boolean} - validation result */ export declare function isValidContractFunctionName(name: string): boolean; /** * Unpads a memo string, so it removes nulls. * * Useful when memo is fill up the length. Result is becomes readable. * * @param {string} memo - the string to be validated * @returns {boolean} - the validation result */ export declare function unpadMemo(memo: string): string; /** * Generate a multisig address from multiple STX public keys * * @param {string[]} pubKeys - list of public keys as strings * @param {AddressVersion} addressVersion - MainnetMultiSig, TestnetMultiSig * @param {AddressHashMode} addressHashMode - SerializeP2SH * @param {number} [signaturesRequired] - number of signatures required, default value its 2 * @returns {address: string, hash160: string} - a multisig address */ export declare function getSTXAddressFromPubKeys(pubKeys: string[], addressVersion?: AddressVersion, addressHashMode?: AddressHashMode, signaturesRequired?: number): { address: string; hash160: string; }; /** * signs a string message * * @param keyPair * @param data - message to be signed * @returns signed message string */ export declare function signMessage(keyPair: KeyPair, data: string): string; /** * Verifies a signed message * * The signature must be 130 bytes long -- see RECOVERABLE_ECDSA_SIG_LENGTH_BYTES * in @stacks/transactions/src/constants.ts * * @param {string} message - message to verify the signature * @param {string} signature - signature to verify * @param {string} publicKey - public key as hex string used to verify the signature * @returns {boolean} - verification result */ export declare function verifySignature(message: string, signature: string, publicKey: string): boolean; /** * Process address into address and memo id * * @param {string} address the address to process * @returns {Object} object containing address and memo id */ export declare function getAddressDetails(address: string): AddressDetails; /** * Validate and return address with appended memo id * * @param {AddressDetails} addressDetails * @returns {string} address with memo id */ export declare function normalizeAddress({ address, memoId }: AddressDetails): string; /** * Return boolean indicating whether input is a valid address with memo id * * @param {string} address address in the form
?memoId=