codama-idl / codama

Generate clients, CLIs, documentation and more from your Solana programs
MIT License
73 stars 16 forks source link

Use ReadonlyUint8Array for identifying accounts/instructions by data #138

Closed mcintyre94 closed 2 months ago

mcintyre94 commented 2 months ago

The identifyXInstruction and identifyXAccount already accept a Uint8Array that can be used to identify an instruction given just the data byte array. But if this comes from a web3js encoder (eg encoding base64 data from somewhere else), then the datatype will be ReadonlyUint8Array instead.

This PR updates these identify functions to allow an input of ReadonlyUint8Array instead. This doesn't require any further changes, as everything being done with data is already compatible with ReadonlyUint8Array. It's also backward compatible, you can still pass a Uint8Array in.

This means that output from our encoders can now be passed directly to these generated instructions.

changeset-bot[bot] commented 2 months ago

🦋 Changeset detected

Latest commit: f69eed11119dbb51318b2456d0a69baa3d9d9f01

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages | Name | Type | | ----------------------- | ----- | | @kinobi-so/renderers-js | Patch | | @kinobi-so/renderers | Patch |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR