import { Buff } from '@cmdcode/buff';
import * as schema from '../schema/index.js';
export function parse_network(network) {
    return schema.base.network.parse(network);
}
export function parse_payments(payments) {
    return schema.base.payment.array().parse(payments);
}
export function parse_contract(contract) {
    return schema.contract.data.parse(contract);
}
export function parse_covenant(covenant) {
    return schema.deposit.covenant.parse(covenant);
}
export function parse_deposit(deposit) {
    return schema.deposit.data.parse(deposit);
}
export function parse_program(terms) {
    const parsed = schema.proposal.terms.parse(terms);
    const [method, actions, paths, ...params] = parsed;
    const prog_id = Buff.json([method, ...params]).digest.hex;
    return { prog_id, method, actions, paths, params };
}
export function parse_proposal(proposal) {
    return schema.proposal.data.parse(proposal);
}
export function parse_witness(witness) {
    return schema.vm.witness.parse(witness);
}
