Skip to content

Commit

Permalink
Fix conversion of legacy idl seeds (#399)
Browse files Browse the repository at this point in the history
Fixes pages like
https://explorer.solana.com/address/EH8hpNpwfDHxYYoFnF3AXWZMzm7hJLh3KmS6WGkRibFf/anchor-account?cluster=devnet

And any tx/account pages for programs using anchor idls with PDA seeds
  • Loading branch information
ngundotra authored Oct 29, 2024
1 parent 341465e commit d5568ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/utils/convertLegacyIdl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ function convertInstructionAccounts(accounts: LegacyIdlAccounts): IdlInstruction

function convertPda(pda: LegacyIdlPda): { seeds: any[]; programId?: any } {
return {
programId: pda.programId ? convertSeed(pda.programId) : undefined,
...(pda.programId ? { programId: convertSeed(pda.programId) } : {}),
seeds: pda.seeds.map(convertSeed),
};
}
Expand All @@ -374,7 +374,7 @@ function convertSeed(seed: LegacyIdlSeed): any {
return { kind: 'arg', path: seed.path, type: convertType(seed.type) };
case 'account':
return {
account: seed.account,
...(seed.account ? { account: seed.account } : {}),
kind: 'account',
path: seed.path,
type: convertType(seed.type),
Expand Down

0 comments on commit d5568ef

Please sign in to comment.