Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IDLs in target/idl/*.json does not match with target/types/*.ts #2187

Closed
rado0x54 opened this issue Sep 19, 2022 · 1 comment
Closed

IDLs in target/idl/*.json does not match with target/types/*.ts #2187

rado0x54 opened this issue Sep 19, 2022 · 1 comment
Labels
bug or feature? cli idl related to the IDL, either program or client side

Comments

@rado0x54
Copy link
Contributor

rado0x54 commented Sep 19, 2022

Hello,

there is an inconsistency with the IDL generation in target/idl/*.json and target/types/*.ts which breaks implementations that rely on the IDL from the ts version.

We have the following account in our program:

#[account]
pub struct DidAccount {

In target/idl/*.json it generates to

...
  "accounts": [
    {
      "name": "DidAccount",
      "type": {
        "kind": "struct",
...

In target/types/*.ts it generates to

...
export const IDL: SolDid = {
...
  "accounts": [
    {
      "name": "didAccount",
      "type": {
        "kind": "struct",
...

In my opinion, the correct fix would to have the Account Name also capitalized in IDL and type in ``target/types/*.ts. This would additionally require an update to the Program` interface, where currently camelCase is expected:
Current:

program.account.didAccount

New:

program.account.DidAccount

I consider this quite the major inconsistency and projects relying directly on the generated *.ts are likely to run into problems when not using the JSON IDL directly.

@acheroncrypto
Copy link
Collaborator

Fixed by #2824.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug or feature? cli idl related to the IDL, either program or client side
Projects
None yet
Development

No branches or pull requests

3 participants