import Description from '../description'; import { AffectedNode } from '../types/Metadata'; import { Explanation } from './Explanation'; /** * Stores the different kinds of affected nodes. * * @enum {number} */ declare enum AffectedNodeType { CreatedNode = "CreatedNode", DeletedNode = "DeletedNode", ModifiedNode = "ModifiedNode" } /** * Base type for explanations on affected nodes. * * @property type - How the node was changed (either created, deleted, or modified). * @property ledgerEntryType - An explanation on the ledgerEntryType. * @property ledgerIndex - An explanation on the ledgerIndex. */ interface AffectedNodeBaseExplanation { readonly type: AffectedNodeType; readonly ledgerEntryType: Explanation; readonly ledgerIndex: Explanation; } /** * Explains a created node. * * @extends AffectedNodeBaseExplanation * * @property newFields - An explanation of the new fields of the node. */ interface CreatedNodeExplanation extends AffectedNodeBaseExplanation { readonly type: AffectedNodeType.CreatedNode; readonly newFields: Explanation<{ [key: string]: unknown; }>; } /** * Explains a deleted node. * * @extends AffectedNodeBaseExplanation * * @property finalFields - The fields of the node prior to deletion. */ interface DeletedNodeExplanation extends AffectedNodeBaseExplanation { readonly type: AffectedNodeType.DeletedNode; readonly finalFields: Explanation<{ [key: string]: unknown; }>; } /** * Explains a modified node. * * @extends AffectedNodeBaseExplanation * * @property modifiedFields - The fields of the node that the transaction modified. * @property newFields - The fields of the node that the transaction created. * @property previousTxnID - The previous transaction to change this node. * @property previousTxnLgrSeq - The ledger containing the previous transaction to change this node. */ interface ModifiedNodeExplanation extends AffectedNodeBaseExplanation { readonly type: AffectedNodeType.ModifiedNode; readonly modifiedFields: Explanation<{ [key: string]: { old: unknown; new: unknown; description: Description; }; }>; readonly newFields: Explanation<{ [key: string]: { new: unknown; description: Description; }; }>; readonly previousTxnID?: Explanation; readonly previousTxnLgrSeq?: Explanation; } /** * Combined type for all possible node explanations. * */ declare type AffectedNodeExplanation = CreatedNodeExplanation | DeletedNodeExplanation | ModifiedNodeExplanation; export { AffectedNodeExplanation, AffectedNodeType }; /** * Creates an explanation on any type of affected node. * * @throws Throws an error if the node doesn't a CreatedNode, DeletedNode, and ModifiedNode property. * * @param node - The node to be explained. * @returns The explanation of the node. */ export declare function createAffectedNodeExplanation(node: AffectedNode): AffectedNodeExplanation; //# sourceMappingURL=ExplainAffectedNode.d.ts.map