Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: wormhole-foundation/native-token-transfers
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 133f58099db2234938bf2a6ccd42ac94d82949c3
Choose a base ref
..
head repository: wormhole-foundation/native-token-transfers
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 88ade33971bd371ca56be3cc31dce1be3c12172b
Choose a head ref
Showing with 11 additions and 3 deletions.
  1. +11 −3 solana/scripts/regenerateIdl.ts
14 changes: 11 additions & 3 deletions solana/scripts/regenerateIdl.ts
Original file line number Diff line number Diff line change
@@ -20,9 +20,17 @@ const idl: Idl = JSON.parse(fs.readFileSync(jsonPath, "utf8"));
const name = titleCase(idl["name"]);

idl.accounts?.forEach((account) => {
account.name = account.name.replace(/^[A-Z]+/, (match) =>
match.toLowerCase()
);
// NOTE: here we translate PascalCase to camelCase, with the exception of all
// uppercase account names, such as 'LUT', which we want to preserve.
//
// The translation needs to be done because anchor generates an invalid IDL file, so we patch it.
// Anchor handles all uppercase account names specially (when generating the account discriminator),
// so we need to preserve them.
if (!account.name.match(/^[A-Z]+$/)) {
account.name = account.name.replace(/^[A-Z]+/, (match) =>
match.toLowerCase()
);
}
});

// heredoc