Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ program/src/event_engine.rs (self-CPI event emission)
```
Rust code with #[codama(...)] attributes
program/build.rs → program/idl/subscriptions.json
program/build.rs → idl/subscriptions.json
scripts/generate-clients.ts
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ subscriptions/
│ │ ├── errors.rs # Error codes
│ │ ├── constants.rs # Program constants
│ │ └── tests/ # Rust unit tests (LiteSVM)
│ └── idl/ # Generated IDL (subscriptions.json)
── idl/ # Generated IDL (subscriptions.json)
├── clients/
│ ├── typescript/ # TypeScript SDK + integration tests
│ └── rust/ # Rust generated client
Expand Down Expand Up @@ -152,7 +152,7 @@ The `justfile` is the main entrypoint for day-to-day development.
|---|---|
| `just build` | Build program + generate IDL + generate clients + build TypeScript client |
| `just build-program` | Compile the SBF program (`.so`) |
| `just generate-idl` | Regenerate `program/idl/subscriptions.json` |
| `just generate-idl` | Regenerate `idl/subscriptions.json` |
| `just generate-clients` | Regenerate TypeScript and Rust clients from IDL via Codama |
| `just build-client` | Build `clients/typescript` into `clients/typescript/dist` |

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set shell := ["bash", "-uc"]
program_dir := "program"
ts_client_dir := "clients/typescript"
webapp_dir := "webapp"
idl_file := program_dir / "idl/subscriptions.json"
idl_file := "idl/subscriptions.json"

# List available recipes
default:
Expand Down
3 changes: 2 additions & 1 deletion program/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ fn generate_idl() -> Result<(), Box<dyn std::error::Error>> {
formatted_json.push('\n');

// Write IDL file to idl directory.
let idl_dir = Path::new(&manifest_dir).join("idl");
let project_root = Path::new(&manifest_dir).parent().unwrap();
let idl_dir = project_root.join("idl");
fs::create_dir_all(&idl_dir)?;
let idl_path = idl_dir.join("subscriptions.json");
fs::write(&idl_path, formatted_json)?;
Expand Down
2 changes: 1 addition & 1 deletion program/src/tests/idl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use serde_json::Value;

const IDL_JSON: &str = include_str!("../../idl/subscriptions.json");
const IDL_JSON: &str = include_str!("../../../idl/subscriptions.json");

/// Account info from the IDL.
pub struct IdlAccount {
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { preserveConfigFiles } from './lib/utils';
const __dirname = path.dirname(fileURLToPath(import.meta.url));

const projectRoot = path.join(__dirname, '..');
const idlPath = path.join(projectRoot, 'program', 'idl', 'subscriptions.json');
const idlPath = path.join(projectRoot, 'idl', 'subscriptions.json');
const idl = JSON.parse(fs.readFileSync(idlPath, 'utf-8')) as AnchorIdl;
const rustClientsDir = path.join(projectRoot, 'clients', 'rust');
const typescriptClientsDir = path.join(projectRoot, 'clients', 'typescript');
Expand Down
2 changes: 1 addition & 1 deletion webapp/tsconfig.app.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"],
"@idl": ["../program/idl/subscriptions.json"]
"@idl": ["../idl/subscriptions.json"]
}
},
"include": ["src"]
Expand Down
2 changes: 1 addition & 1 deletion webapp/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default defineConfig({
resolve: {
alias: {
"@": path.resolve(__dirname, "./src"),
"@idl": path.resolve(__dirname, "../program/idl/subscriptions.json"),
"@idl": path.resolve(__dirname, "../idl/subscriptions.json"),
},
},
build: {
Expand Down
Loading