parseInstructionOrTransactionPlanInput

function parseInstructionOrTransactionPlanInput(
    input,
): InstructionPlan | TransactionPlan;

Parses an InstructionPlanInput or TransactionPlanInput and returns the appropriate plan type.

This function automatically detects whether the input represents instructions or transactions and delegates to the appropriate parser:

Parameters

ParameterTypeDescription
input| InstructionPlanInput | TransactionPlanInputThe input to parse, which can be either an instruction-based or transaction-based input.

Returns

| InstructionPlan | TransactionPlan

The parsed plan, either an InstructionPlan or a TransactionPlan.

Examples

Parsing an instruction input.

const plan = parseInstructionOrTransactionPlanInput(myInstruction);
// Returns an InstructionPlan

Parsing a transaction message input.

const plan = parseInstructionOrTransactionPlanInput(myTransactionMessage);
// Returns a TransactionPlan

See

On this page