Skip to content

Add clear signing display metadata to the IDL - #90

Merged
lorisleiva merged 2 commits into
mainfrom
loris/clear-signing-idl
Aug 12, 2026
Merged

Add clear signing display metadata to the IDL#90
lorisleiva merged 2 commits into
mainfrom
loris/clear-signing-idl

Conversation

@lorisleiva

Copy link
Copy Markdown
Member

This PR enriches the Codama IDL with display metadata for clear signing, per sRFC 39, and bumps codama to ^1.10.0 (the display node types shipped in 1.9). All 14 instructions gain intents and interpolated intents; accounts and arguments gain labels; lamport amounts render as SOL (decimals: 9), sizes as bytes; discriminators and fixed sysvar accounts (rent, recent blockhashes) are hidden from the fallback list. The nonce account's lamportsPerSignature field also renders as SOL.

Sample renders via @codama/dynamic-instructions:

Transfer 1.5 SOL from 3Wnd5…PxJX to 9WzDX…AWWM
Create account Fg6Pa…sLnS with 0.00203928 SOL
Withdraw 0.5 SOL from DRpbC…21hy to 9WzDX…AWWM

Clients were regenerated and are unaffected: renderers pass display metadata through untouched.

@lorisleiva

Copy link
Copy Markdown
Member Author

Retrofit: labels identical to the renderer's derived titleCase(name) are redundant; keeping only genuine renames makes the IDL smaller and the convention self-documenting. Kept labels are now Title Case to match the derived casing.

@lorisleiva

Copy link
Copy Markdown
Member Author

Rendered output for review

To make this JSON diff easier to review, every instruction below is rendered end-to-end through @codama/dynamic-instructions#getInstructionDisplay using synthetic sample data. Each collapsed line shows the interpolated intent at a glance (addresses abridged); expand for the full render showing both presentation modes a wallet chooses between — the interpolated sentence, or the intent-with-fields fallback screen. Address formatting (truncation, .sol names, token symbols) is left to the consuming wallet, so raw base58 appears in the full renders.

createAccount — Create account Fg6Pa…sLnS with 0.00203928 SOL
Interpolated intent:
│ Create account Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS with 0.00203928 SOL

Intent + fields (fallback):
│ Create account
│   Funding Amount: 0.00203928 SOL
│   Space: 165 bytes
│   Owner Program: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
│   Payer: 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX
│   New Account: Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
assign — Assign DRpbC…21hy to program 9WzDX…AWWM
Interpolated intent:
│ Assign DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy to program 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM

Intent + fields (fallback):
│ Assign account
│   Owner Program: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
│   Account: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
transferSol (1.5 SOL transfer) — Transfer 1.5 SOL from 3Wnd5…PxJX to 9WzDX…AWWM
Interpolated intent:
│ Transfer 1.5 SOL from 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX to 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM

Intent + fields (fallback):
│ Transfer SOL
│   Amount: 1.5 SOL
│   From: 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX
│   To: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
createAccountWithSeed — Create account Fg6Pa…sLnS with 0.01 SOL
Interpolated intent:
│ Create account Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS with 0.01 SOL

Intent + fields (fallback):
│ Create account with seed
│   Base Address: 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX
│   Seed: stake:0
│   Funding Amount: 0.01 SOL
│   Space: 200 bytes
│   Owner Program: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
│   Payer: 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX
│   New Account: Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
│   Base Account: 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX
advanceNonceAccount — Advance nonce account DRpbC…21hy
Interpolated intent:
│ Advance nonce account DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy

Intent + fields (fallback):
│ Advance nonce account
│   Nonce Account: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
│   Nonce Authority: 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX
withdrawNonceAccount (sysvars should be hidden) — Withdraw 0.5 SOL from DRpbC…21hy to 9WzDX…AWWM
Interpolated intent:
│ Withdraw 0.5 SOL from DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy to 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM

Intent + fields (fallback):
│ Withdraw from nonce account
│   Amount: 0.5 SOL
│   Nonce Account: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
│   Recipient: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
│   Nonce Authority: 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX
initializeNonceAccount — Initialize nonce account 6QuXb…rgSm with authority 4Nd1m…DB4T
Interpolated intent:
│ Initialize nonce account 6QuXb6mB6WmRASP2y8AavXh6aabBXEH5ZzrSH5xRrgSm with authority 4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T

Intent + fields (fallback):
│ Initialize nonce account
│   Nonce Authority: 4Nd1mBQtrMJVYVfKf2PJy9NZUZdTAsp7D4xWLs4gDB4T
│   Nonce Account: 6QuXb6mB6WmRASP2y8AavXh6aabBXEH5ZzrSH5xRrgSm
authorizeNonceAccount — Set the authority of nonce account DRpbC…21hy to 9WzDX…AWWM
Interpolated intent:
│ Set the authority of nonce account DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy to 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM

Intent + fields (fallback):
│ Authorize nonce account
│   New Nonce Authority: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
│   Nonce Account: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
│   Nonce Authority: 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX
allocate — Allocate 1024 bytes for Fg6Pa…sLnS
Interpolated intent:
│ Allocate 1024 bytes for Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS

Intent + fields (fallback):
│ Allocate space
│   Space: 1024 bytes
│   Account: Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
allocateWithSeed — Allocate 165 bytes for DRpbC…21hy
Interpolated intent:
│ Allocate 165 bytes for DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy

Intent + fields (fallback):
│ Allocate space with seed
│   Base Address: BPFLoaderUpgradeab1e11111111111111111111111
│   Seed: example seed
│   Space: 165 bytes
│   Owner Program: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
│   Account: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
│   Base Account: 6QuXb6mB6WmRASP2y8AavXh6aabBXEH5ZzrSH5xRrgSm
assignWithSeed — Assign DRpbC…21hy to program 9WzDX…AWWM
Interpolated intent:
│ Assign DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy to program 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM

Intent + fields (fallback):
│ Assign account with seed
│   Base Address: BPFLoaderUpgradeab1e11111111111111111111111
│   Seed: example seed
│   Owner Program: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
│   Account: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
│   Base Account: 6QuXb6mB6WmRASP2y8AavXh6aabBXEH5ZzrSH5xRrgSm
transferSolWithSeed — Transfer 0.25 SOL from Fg6Pa…sLnS to 9WzDX…AWWM
Interpolated intent:
│ Transfer 0.25 SOL from Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS to 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM

Intent + fields (fallback):
│ Transfer SOL with seed
│   Amount: 0.25 SOL
│   From Seed: vault
│   From Owner: TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA
│   From: Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS
│   Base Account: 3Wnd5Df69KitZfUoPYZU438eFRNwGHkhLnSAWL65PxJX
│   To: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
upgradeNonceAccount — Upgrade nonce account 6QuXb…rgSm
Interpolated intent:
│ Upgrade nonce account 6QuXb6mB6WmRASP2y8AavXh6aabBXEH5ZzrSH5xRrgSm

Intent + fields (fallback):
│ Upgrade nonce account
│   Nonce Account: 6QuXb6mB6WmRASP2y8AavXh6aabBXEH5ZzrSH5xRrgSm
createAccountAllowPrefund — Create account DRpbC…21hy with 0.00203928 SOL
Interpolated intent:
│ Create account DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy with 0.00203928 SOL

Intent + fields (fallback):
│ Create account
│   Funding Amount: 0.00203928 SOL
│   Space: 165 bytes
│   Owner Program: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
│   New Account: DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy
│   Payer: HN7cABqLq46Es1jh92dQQisAq662SmxELLLsHHe4YWrH

@lorisleiva
lorisleiva requested a review from joncinque August 11, 2026 09:36

@joncinque joncinque left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@lorisleiva
lorisleiva merged commit f61ddfe into main Aug 12, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants