/** * Chain-safe JSON normalization for `account_update` operations. * * Protocol types (steem/libraries/protocol): * - `authority` — weight_threshold (uint32), account_auths / key_auths (fc::flat_map) * - `account_update_operation` — account, optional owner/active/posting, memo_key, json_metadata (string) * * JSON-RPC (`condenser_api.broadcast_transaction` → fc::from_variant): * - `authority` is a variant_object, not a bare key_auths array. * - `fc::flat_map` serializes as an array of [key, weight] pairs (see fc/container/flat.hpp), * not a JSON object `{ "key": weight }` — object maps cause bad_cast_exception. * - `json_metadata` must be a string (protocol `string`), not a parsed JSON object. * * Binary signing (transaction digest) uses the same logical fields; the serializer packs * flat_maps as sorted on-wire maps (see serializeAuthority in serializer/transaction.ts). */ /** One entry in an fc::flat_map after JSON (de)serialization: [key, weight]. */ export type AuthorityWeightPair = [string, number]; /** * `steem::protocol::authority` as returned by condenser / required for broadcast JSON. * account_auths: flat_map * key_auths: flat_map (keys are "STM..." strings in JSON) */ export type ChainAuthority = { weight_threshold: number; /** FC flat_map JSON: `[["account", weight], ...]` */ account_auths: AuthorityWeightPair[]; /** FC flat_map JSON: `[["STM...", weight], ...]` */ key_auths: AuthorityWeightPair[]; }; /** * `steem::protocol::account_update_operation` payload for JSON broadcast and signing. * Operation tuple form: `["account_update", AccountUpdatePayload]`. */ export type AccountUpdatePayload = { account: string; owner: ChainAuthority; active: ChainAuthority; posting: ChainAuthority; memo_key: string; json_metadata: string; }; export type OperationTuple = [string, Record]; /** * Coerce `json_metadata` to protocol `string` (FC string field). * Node rejects object/array variants with bad_cast when broadcasting. */ export declare function normalizeChainJsonMetadata(value: unknown): string; /** Normalize API authority data (get_accounts-style input; accepts pair arrays or object maps). */ export declare function normalizeAuthoritySource(source: unknown): ChainAuthority; /** * Coerce account_update operation payload to protocol JSON shape for signing and broadcast. * Emits fc::flat_map fields as pair arrays, not object maps. */ export declare function sanitizeAccountUpdatePayload(payload: Record): AccountUpdatePayload; /** * Normalize an operation tuple before signing or JSON broadcast. * Only account_update is rewritten; other operations pass through unchanged. */ export declare function normalizeOperationForBroadcast(operation: unknown): unknown; /** Normalize transaction operations/extensions for JSON broadcast after signing. */ export declare function normalizeTransactionForBroadcast(trx: Record): Record; /** * Authority value for binary serialization (fail-fast on array mistaken for object). * Mirrors steem wallet_api::update_account which assigns authority structs, not key_auths arrays. */ export declare function resolveAuthorityForSerialize(auth: unknown, field: string): Record;