Add clear signing display metadata to the IDL - #171
Conversation
Rendered output for reviewTo make this JSON diff easier to review, every instruction below is rendered end-to-end through
|
joncinque
left a comment
There was a problem hiding this comment.
Looks great!
Sorry for the dumb question, but is there a mechanism for potentially substituting other labels for addresses?
For example, any time you see EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v you render USDC?
Also, up to you, but including the mint in the interpolated string for ATA creation could be nice
|
@joncinque Yes but this is a responsibility we shift to the resolver/"displayer" of these intents. For example, in the Since this can be resolved by anyone (and is usually not information present in the instruction or in accounts used by the instruction) the benefit we get is that the wallet is the one that gets to vet if this mint address should actually be displayed as, say, USDC for the user. (Although technically the program maintainer could hardcode "USDC" in the intent itself but there's not much we can do about that aside from whitelisting/blacklisting IDLs). |
|
Ok great, thanks for the explanation! |
Addresses review feedback by including the mint in the interpolated intent for ATA creation. Since the ATA address is derived from the owner and mint, it adds little value on a signing screen, so the intent now surfaces the owner and mint instead.
Good shout! I went one step further since the ATA is just a derivation of the owner and the mint, it's not particularly useful when reviewing what the instruction does, so the intent now shows those two instead: - Create associated token account ${accounts.ata} for ${accounts.owner}
+ Create the associated token account of ${accounts.owner} for mint ${accounts.mint}With a naming layer this reads something like "Create the associated token account of 7dHbW… for mint USDC". Lmk if you think that's a good move. 🙏 P.S.: I made the same change in the |
This PR enriches the Codama IDL with display metadata for clear signing, per sRFC 39, and bumps
codamato^1.10.0(the display node types shipped in 1.9). All 28 token instructions and the 3 associated-token-account instructions gain intents, interpolated intents and labels.Token amounts scale through the provide/inject graph:
decimalsfrom their owndecimalsargument — fully offline, ideal for hardware wallets; the redundant argument is hidden once consumed (skip: "whenInjected").mintTo/burnprovidedecimalsfrom the mint account (accountFieldValueNode+accountLink), degrading gracefully to raw without account access.transfer,approve) render explicitly asbase units.Sample renders via
@codama/dynamic-instructions(the mint address resolves to a symbol when the renderer names it):Clients were regenerated and are unaffected: renderers pass display metadata through untouched.