"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.addChainChangeResolver = addChainChangeResolver;
exports.resolveChainChange = resolveChainChange;
exports.saveChainChangeData = saveChainChangeData;
exports.getChainChangeData = getChainChangeData;
const chainChangeRegistry = new Map();
const chainChangeResolvers = new Map();
function addChainChangeResolver(sessionId, resolver) {
    console.log(`Adding chain change resolver for session ${sessionId}`);
    chainChangeResolvers.set(sessionId, resolver);
}
function resolveChainChange(sessionId, result) {
    const resolver = chainChangeResolvers.get(sessionId);
    if (resolver) {
        resolver(result);
        chainChangeResolvers.delete(sessionId);
        chainChangeRegistry.delete(sessionId); // clean up chain change data
        return true;
    }
    return false;
}
function saveChainChangeData(sessionId, data) {
    console.log(`Saving chain change data for session ${sessionId}`);
    chainChangeRegistry.set(sessionId, data);
}
function getChainChangeData(sessionId) {
    return chainChangeRegistry.get(sessionId);
}
