import { address as parseAddress } from '@solana/kit';
import { HookType } from '@hyperlane-xyz/provider-sdk/altvm';
import { ArtifactState, } from '@hyperlane-xyz/provider-sdk/artifact';
export class SvmMerkleTreeHookReader {
    _rpc;
    constructor(_rpc) {
        this._rpc = _rpc;
    }
    async read(address) {
        // On SVM the Merkle tree hook is the mailbox program itself.
        const programId = parseAddress(address);
        return {
            artifactState: ArtifactState.DEPLOYED,
            config: { type: HookType.MERKLE_TREE },
            deployed: { address: programId, programId },
        };
    }
}
export class SvmMerkleTreeHookWriter extends SvmMerkleTreeHookReader {
    config;
    _signer;
    constructor(config, rpc, _signer) {
        super(rpc);
        this.config = config;
        this._signer = _signer;
    }
    async create(_artifact) {
        const programId = parseAddress(this.config.mailboxAddress);
        return [
            {
                artifactState: ArtifactState.DEPLOYED,
                config: { type: HookType.MERKLE_TREE },
                deployed: { address: programId, programId },
            },
            [],
        ];
    }
    async update(_artifact) {
        return [];
    }
}
//# sourceMappingURL=merkle-tree-hook.js.map