import { Hex } from 'viem'; import { Bytes } from '../common/types/bytes.cjs'; import { Subaccount, SubaccountBytes32, SubaccountNameBytes12 } from '../common/types/subaccountTypes.cjs'; /** * Converts a subaccount object (owner + name) to its bytes32 representation. * @param subaccount subaccount object (owner + name) * @returns bytes32 representation of a subaccount */ declare function subaccountToBytes32(subaccount: Subaccount): SubaccountBytes32; /** * Given a bytes32 representation of a subaccount, returns a subaccount object (owner + name) * @param bytes bytes32 representaion of a subaccount where bytes[0:20]=owner & bytes[20:32]=subaccountName * @returns subaccount object (owner + name) */ declare function subaccountFromBytes32(bytes: SubaccountBytes32): Subaccount; /** * When interacting with the contracts (e.g: deposit collateral); * subaccount name is represented as bytes12. * This util converts a subaccount name to it's bytes12 representation. * @param name subaccount name * @returns bytes12 representation of a subaccount name. */ declare function subaccountNameToBytes12(name: string): SubaccountNameBytes12; /** * When interacting with the engine, we need to send a hex string representation * of the bytes32 of a subaccount for serialization reasons. This util * converts a subaccount object (owner + name) to such hex representation. * @param subaccount subaccount object (owner + name) * @returns hex string representation of a subaccount */ declare function subaccountToHex(subaccount: Subaccount): Hex; /** * Converts a hex string representation of a bytes32 subaccount to a subaccount object (owner + name) * @param subaccount hex string representation of a bytes32 subaccount. * @returns subaccount object (owner + name) */ declare function subaccountFromHex(subaccount: string): Subaccount; /** * Converts Bytes to a string. If the bytes represent a valid UTF-8 string, then a string is returned, if not, * then the hex representation is returned. * * @param input */ declare function subaccountNameBytesToStr(input: Bytes): string; export { subaccountFromBytes32, subaccountFromHex, subaccountNameBytesToStr, subaccountNameToBytes12, subaccountToBytes32, subaccountToHex };