@lab11/anchorgen
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

ANCHORGEN

Publish Status npm version Known Vulnerabilities Code Style: Google

This is a work-in-progress. Use at your own risk.

Reverse engineers an Anchor program's interface from its IDL.

This could be useful when invoking CPIs on a closed-source Anchor program.

Try it

anchor init jupiter

anchor idl fetch --provider.cluster mainnet JUP2jxvXaqu7NQY1GmNF4m1vodw12LVXYxbFL2uJvfo | \
npx @lab11/anchorgen JUP2jxvXaqu7NQY1GmNF4m1vodw12LVXYxbFL2uJvfo > jupiter/programs/jupiter/src/lib.rs

anchor build

Now you can use reference it in your program's Cargo.toml as a depedency:

[dependencies]
jupiter = { path = "../../../jupiter/programs/jupiter", features = ["cpi", "no-entrypoint"] }

See npx @lab11/anchorgen --help for more info.

Features

Tested with Anchor 0.24.x.

  • [x] Instrcutions
  • [x] Accounts
  • [ ] Accounts: Nested
  • [x] Types: Primitives
  • [x] Types: Struct
  • [x] Types: Enum
  • [x] Types: Option & COption
  • [x] Types: Vector & Array
  • [x] Errors
  • [ ] Constants
  • [ ] State
  • [ ] Events
  • [ ] Metadata
  • [ ] Docs (waiting for https://github.com/project-serum/anchor/pull/1561 to make it to a canonical release)

Contributing

Pull requests and GitHub Issues are welcome.

Readme

Keywords

Package Sidebar

Install

npm i @lab11/anchorgen

Weekly Downloads

3

Version

1.1.0

License

MIT

Unpacked Size

25.3 kB

Total Files

21

Last publish

Collaborators

  • labeleven
  • sohrab-