coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.69k stars 1.35k forks source link

Mismatch between IDL and the JSON #723

Closed vivaviche closed 8 months ago

vivaviche commented 3 years ago

The IDL type mismatches with the JSON dumped.

The IDL is defined here https://github.com/project-serum/anchor/blob/8fa867fbd695722b4cc592efd6f7ce462fc18f9b/ts/src/idl.ts#L4-L13

However, the JSON has one additional field called metadata: {address: string}

This means that we cannot just directly load the json IDL.

Not a big deal, but would be convenient if we add the metadata field to the IDL type.

Henry-E commented 1 year ago

Was this ever fixed?

billythedummy commented 1 year ago

Was this ever fixed?

It appears that metadata: {address: string} was removed from the IDL json file in 0.26.0. Can't find where that change was introduced. Not sure if that was meant to fix this or if other options were considered e.g. adding metadata: {address: string} to the idl definition

Side note, this seems related: https://github.com/coral-xyz/anchor/issues/298

acheroncrypto commented 8 months ago

Was this ever fixed?

It appears that metadata: {address: string} was removed from the IDL json file in 0.26.0. Can't find where that change was introduced. Not sure if that was meant to fix this or if other options were considered e.g. adding metadata: {address: string} to the idl definition

Side note, this seems related: #298

metadata.address field was never removed, but it was only getting populated after the deploy command, so if you rebuild your program without redeploying, you'd lose this field.

Fixed in https://github.com/coral-xyz/anchor/pull/2824.