import { PortableRegistry, TypeRegistry } from "@polkadot/types";
import { createCallFunction } from "@polkadot/types/metadata/decorate/extrinsics";
export class LiteRegistry extends TypeRegistry {
    constructor(...args) {
        super(...args);
        this.setLookup(new PortableRegistry(this, {
            types: [
                {
                    id: 0,
                    type: {
                        def: {
                            primitive: "U32",
                        },
                    },
                },
                {
                    id: 1,
                    type: {
                        def: {
                            primitive: "str",
                        },
                    },
                },
                {
                    id: 10,
                    type: {
                        path: ["generic", "Call"],
                        params: [
                            {
                                name: "T",
                                type: null,
                            },
                        ],
                        def: {
                            variant: {
                                variants: [
                                    {
                                        name: "generic",
                                        fields: [
                                            {
                                                name: "p1",
                                                type: 0,
                                                typeName: "U32",
                                                docs: [],
                                            },
                                            {
                                                name: "p2",
                                                type: 0,
                                                typeName: "U32",
                                                docs: [],
                                            },
                                            {
                                                name: "p3",
                                                type: 0,
                                                typeName: "U32",
                                                docs: [],
                                            },
                                            {
                                                name: "p4",
                                                type: 0,
                                                typeName: "U32",
                                                docs: [],
                                            },
                                            {
                                                name: "p5",
                                                type: 0,
                                                typeName: "U32",
                                                docs: [],
                                            },
                                            {
                                                name: "p6",
                                                type: 0,
                                                typeName: "U32",
                                                docs: [],
                                            },
                                            {
                                                name: "p7",
                                                type: 0,
                                                typeName: "U32",
                                                docs: [],
                                            },
                                            {
                                                name: "p8",
                                                type: 0,
                                                typeName: "U32",
                                                docs: [],
                                            },
                                        ],
                                        index: 0,
                                        docs: ["some line"],
                                    },
                                ],
                            },
                        },
                        docs: [
                            "Contains one variant per dispatchable that can be called by an extrinsic.",
                        ],
                    },
                },
            ],
        }));
    }
    getFallback = (arr) => {
        return Object.assign(this.createType("Vec<u8>", arr), {
            section: `0x${arr[0]}`,
            method: `0x${arr[0]}`,
        });
    };
    findMetaCall(callIndex) {
        try {
            return super.findMetaCall(callIndex);
        }
        catch (e) {
            if (e instanceof Error) {
                console.log(e.stack);
            }
            return createCallFunction(this, this.lookup, this.lookup.getSiType(10).def.asVariant.variants[0], Buffer.from(callIndex).toString("hex"), 1);
        }
    }
}
//# sourceMappingURL=registry.js.map