/** * @module utils/hash * @description Cryptographic hashing utilities. * * @category Utils * @since v0.1.0 */ /** * Compute the SHA-256 hash of a UTF-8 string or byte buffer. * * Returns a 32-byte `Uint8Array` suitable for PDA seeds * and Anchor instruction arguments. * * @name sha256 * @description Hashes the input using Node’s `crypto.createHash("sha256")`. * @param input - A UTF-8 string, `Buffer`, or `Uint8Array` to hash. * @returns {Uint8Array} 32-byte SHA-256 digest. * @category Utils * @since v0.1.0 * @example * ```ts * import { sha256 } from "@synapse-sap/sdk/utils"; * * const hash = sha256("jupiter:swap"); // Uint8Array (32 bytes) * ``` */ export declare const sha256: (input: string | Buffer | Uint8Array) => Uint8Array; /** * Convert a `Uint8Array` hash to a plain `number[]`. * * Anchor instruction argument types expect `number[]` for hash fields * rather than typed arrays. * * @name hashToArray * @description Converts a byte array (typically 32 bytes) to a plain JavaScript `number[]`. * @param hash - The byte array to convert. * @returns {number[]} Shallow copy as a plain array of numbers. * @category Utils * @since v0.1.0 * @example * ```ts * import { sha256, hashToArray } from "@synapse-sap/sdk/utils"; * * const arr = hashToArray(sha256("jupiter:swap")); // number[] * ``` */ export declare const hashToArray: (hash: Uint8Array) => number[]; /** * Compute a deterministic client-side batch root for settlement receipts. * * The on-chain program enforces: * `batch_root == sha256(s_0 || s_1 || ... || s_{N-1})` * where each `s_i` is a 32-byte service hash, in the same order as the * client-side settlement entries. * * Use this helper when callers need a stable aggregate hash for an off-chain * batch receipt. On-chain escrow settlement uses the V2 single-settlement path. * * @name computeBatchRoot * @param serviceHashes - Array of 32-byte service hashes (Buffer/Uint8Array/number[]). * @returns {Uint8Array} 32-byte batch root. * @throws If any `serviceHashes[i]` is not exactly 32 bytes long. * @category Utils * @since v0.10.0 * * @example * ```ts * import { computeBatchRoot, hashToArray } from "@synapse-sap/sdk/utils"; * * const root = computeBatchRoot([h1, h2, h3]); * await client.escrow.settle(depositor, calls, serviceHash); * ``` */ export declare const computeBatchRoot: (serviceHashes: ReadonlyArray) => Uint8Array; //# sourceMappingURL=hash.d.ts.map