GitHub Repository
Dependencies
- java.net.http
- software.sava.json.iterator
- software.sava.core
- software.sava.rpc
Features With Examples
Instructions
- (De)Serialization:
- Discriminators
- Convenient auto-wiring of common accounts and optional account defaults.
Defined Types
- (De)Serialization
- Structs:
- Accounts:
- Discriminators with corresponding RPC memory compare filters:
- PDA helpers:
- Enums:
- Simple:
- With arbitrary associated data structures:
- Constants:
- Events:
- Errors:
- RPC Filters:
- Memory compare filters:
- Data size filters
Generate Source
Build Configuration
GitHub Access Token: Generate a classic token with the
read:packages
scope to access
dependencies hosted on GitHub Package Repository..gradle/gradle.properties
Compile & Run
Generated code will be placed under thebasePackageName
in the sourceDirectory
.
Onchain IDL’s configured in the programs
JSON file will be fetched in a single request. Other remote IDL’s for
programs will be fetched concurrently in numThreads
with a baseDelayMillis
between requests.
Program Configuration
name
(required)- Human-readable program name. Also used to derive defaults for other fields.
package
(optional)- Java package suffix for this specific program. If omitted, it defaults to the lower-case form of
name
. - Final Java package for generated code:
<basePackageName>.<package>.anchor
- Example: with
--basePackageName=software.sava.anchor.gen
and"package": "pyth.receiver"
, classes go undersoftware.sava.anchor.gen.pyth.receiver.anchor
.
- Java package suffix for this specific program. If omitted, it defaults to the lower-case form of
program
(required unlessidlURL
oridlFile
is provided)- Base58-encoded Solana program address. Used to compute the onchain IDL address and to fetch the IDL
when not using
idlURL
oridlFile
.
- Base58-encoded Solana program address. Used to compute the onchain IDL address and to fetch the IDL
when not using
idlURL
(optional)- HTTP(S) URL to fetch the program’s IDL JSON. When provided, the generator fetches the IDL from this URL instead of the chain or file.
idlFile
(optional)- Path to a local IDL JSON file on disk. When provided (and
idlURL
is absent), the generator reads the IDL from this file.
- Path to a local IDL JSON file on disk. When provided (and
exportPackages
(boolean, optional)- Whether to export this program’s packages in the generated
module-info.java
. Overrides the global--exportPackages
for this entry only. If omitted, the global value applies.
- Whether to export this program’s packages in the generated