Hidden1

For protocol teams

Nothing to change in your program. A hook is a public record, on chain, of one instruction you already ship.

What a hook pins

  • Your program id and the first bytes of the instruction's data (its discriminator).
  • The instruction's accounts in order: fixed addresses, the stage PDA where your user signs, and the stage's output account.
  • The account where the output lands, which the run measures.

A record is written once and cannot be edited. Registration is open to anyone: the author's wallet signs and pays, and its key is stored in the record. The program still refuses forbidden targets and protected accounts, and these lints run before anything is signed.

What your program sees

  • A normal call from another program (a cross-program invocation), signed by the stage PDA as the user.
  • The amount arrives in the stage's account before the call; your instruction moves it like any user's.
  • Instructions that refuse cross-program calls cannot be hooks. Instructions that need more than one signer cannot either: the stage is the only signer inside a run.

Draft a hook from your IDL

Paste a program id. The server reads the program's Anchor IDL account from mainnet, and for the instruction you pick shows where each argument sits in the data, which argument is the amount, which accounts the stage fills, and what would block it. These are real reads; errors are shown as they come back.

Try: Kamino LendJupiterMarinade

Read from chain: jupiter IDL (0.1.0), 21 instructions.

Program JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4 Instruction route Data prefix e517cb977ae3ad2a Publishable yes

Arguments

NameTypeSizeOffsetRole
route_planVec<RoutePlanStep>varies8caller
in_amountu648variesamountIn
quoted_out_amountu648variesminOut
slippage_bpsu162variesfixed
platform_fee_bpsu81variesfixed

Accounts

#NameWritableSignerRole in a run
0token_programnonoprogram
1user_transfer_authoritynoyesstage-signer
2user_source_token_accountyesnostage-in
3user_destination_token_accountyesnostage-out
4destination_token_accountyesnostage-out
5destination_mintnonofixed
6platform_fee_accountyesnofixed
7event_authority D8cy…oitfnonofixed
8programnonoprogram

Lints

  • warnoffset-after-variable in_amount sits after a variable-size argument, so its offset is set per run from the caller's arguments. The program re-encodes the data and checks the value at run time.
  • warnoffset-after-variable quoted_out_amount sits after a variable-size argument, so its offset is set per run from the caller's arguments. The program re-encodes the data and checks the value at run time.
  • infocaller-args Filled per run by the caller: route_plan.