import { SolanaBaseProcessor } from "../index.js";
export class SPLTokenProcessor extends SolanaBaseProcessor {
    static bind(options) {
        if (options && !options.name) {
            options.name = 'SPL Token Program';
        }
        return new SPLTokenProcessor(options);
    }
    fromParsedInstruction = (instruction) => {
        const instructionType = instruction.type;
        if (!instructionType) {
            return null;
        }
        return {
            name: instruction.type,
            data: {
                ...instruction.info,
            },
        };
    };
    onInitializeMint(handler, handlerOptions) {
        this.onInstruction('initializeMint', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onInitializeAccount(handler, handlerOptions) {
        this.onInstruction('initializeAccount', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onInitializeAccount2(handler, handlerOptions) {
        this.onInstruction('initializeAccount2', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onInitializeAccount3(handler, handlerOptions) {
        this.onInstruction('initializeAccount3', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onInitializeMultisig(handler, handlerOptions) {
        this.onInstruction('initializeMultisig', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onTransfer(handler, handlerOptions) {
        this.onInstruction('transfer', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onApprove(handler, handlerOptions) {
        this.onInstruction('approve', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onRevoke(handler, handlerOptions) {
        this.onInstruction('revoke', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onSetAuthority(handler, handlerOptions) {
        this.onInstruction('setAuthority', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onMintTo(handler, handlerOptions) {
        this.onInstruction('mintTo', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onBurn(handler, handlerOptions) {
        this.onInstruction('burn', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onCloseAccount(handler, handlerOptions) {
        this.onInstruction('closeAccount', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onFreezeAccount(handler, handlerOptions) {
        this.onInstruction('freezeAccount', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onThawAccount(handler, handlerOptions) {
        this.onInstruction('thawAccount', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onTransferChecked(handler, handlerOptions) {
        this.onInstruction('transferChecked', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onApproveChecked(handler, handlerOptions) {
        this.onInstruction('approveChecked', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onMintToChecked(handler, handlerOptions) {
        this.onInstruction('mintToChecked', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onBurnChecked(handler, handlerOptions) {
        this.onInstruction('burnChecked', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onSyncNative(handler, handlerOptions) {
        this.onInstruction('syncNative', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onGetAccountDataSize(handler, handlerOptions) {
        this.onInstruction('getAccountDataSize', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onInitializeImmutableOwner(handler, handlerOptions) {
        this.onInstruction('initializeImmutableOwner', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onAmountToUiAmount(handler, handlerOptions) {
        this.onInstruction('amountToUiAmount', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onUiAmountToAmount(handler, handlerOptions) {
        this.onInstruction('uiAmountToAmount', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onInitializeMintCloseAuthority(handler, handlerOptions) {
        this.onInstruction('initializeMintCloseAuthority', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onTransferFeeExtension(handler, handlerOptions) {
        this.onInstruction('transferFeeExtension', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onDefaultAccountStateExtension(handler, handlerOptions) {
        this.onInstruction('defaultAccountStateExtension', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onReallocate(handler, handlerOptions) {
        this.onInstruction('reallocate', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onMemoTransferExtension(handler, handlerOptions) {
        this.onInstruction('memoTransferExtension', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
    onCreateNativeMint(handler, handlerOptions) {
        this.onInstruction('createNativeMint', (ins, ctx) => {
            if (ins) {
                handler(ins.data, ctx);
            }
        }, handlerOptions);
        return this;
    }
}
//# sourceMappingURL=spl-token-processor.js.map