reservation: add SDK module with instruction builders and account parsers#275
Merged
martinsander00 merged 3 commits intomainfrom Mar 5, 2026
Merged
reservation: add SDK module with instruction builders and account parsers#275martinsander00 merged 3 commits intomainfrom
martinsander00 merged 3 commits intomainfrom
Conversation
This was referenced Mar 2, 2026
snormore
reviewed
Mar 3, 2026
65255ab to
7af7ba9
Compare
snormore
approved these changes
Mar 5, 2026
…sers Add reservation SDK with PDA helpers, instruction builders (InitializeClientSeat, InitializePaymentEscrow, ClosePaymentEscrow), and raw-byte parsers for ClientSeat, PaymentEscrow, DeviceHistory, and MetroHistory on-chain accounts. Part 1 of #274
… and ClientSeat layout - Add FundPaymentEscrowUsdc(u64) instruction variant with discriminator - Add FundPaymentEscrowUsdcAccounts (10 accounts) for funding escrows - Fix ClosePaymentEscrowAccounts: insert execution_controller at index 1 (now 8 accounts) - Update ClientSeat parse offsets for new on-chain layout: flags at 48, funded_epoch at 56, active_epoch at 64, funding_index at 72 - parse_client_seat now returns (device_key, client_ip, tenure, funded_epoch, active_epoch)
3a32f83 to
7e02670
Compare
karl-dz
pushed a commit
that referenced
this pull request
Mar 6, 2026
#276) ## Summary of Changes - Add `reservation` subcommand behind the `experimental` feature gate with: - `initialize-seat`: create a client seat and payment escrow for a (device, client_ip) pair; skips seat creation if it already exists - `fund`: deposit USDC into a per-seat payment escrow; validates positive amount and checks on-chain minimum price - `withdraw`: close a payment escrow and reclaim USDC; pre-flight check for escrow existence - `list`: show all client seats with optional device, client-ip, and withdraw-authority filters - `price`: show current device pricing (metro base + device premium) - Simplify `ClosePaymentEscrowAccounts` SDK constructor to accept `Option<&Pubkey>` for refund account ## Diff Breakdown | Category | Files | Lines (+/-) | Net | |-------------------|-------|-------------|-------| | CLI commands | 7 | +798 / -0 | +798 | | SDK (constructor) | 1 | +10 / -13 | -3 | | Build / changelog | 2 | +5 / -0 | +5 | ~800 net lines — 5 new CLI commands, subcommand scaffold, and SDK cleanup. <details> <summary>Key files (click to expand)</summary> - `crates/solana-cli/src/command/reservation/mod.rs` — subcommand enum, `DeviceArgs` (shared `--device` / `--device-code` resolution), feature gate - `crates/solana-cli/src/command/reservation/initialize_seat.rs` — sends `InitializeClientSeat` + `InitializePaymentEscrow` in one transaction; skips seat ix if already exists - `crates/solana-cli/src/command/reservation/fund.rs` — sends `FundPaymentEscrowUsdc`, derives exchange key from on-chain DeviceHistory, validates amount against current price - `crates/solana-cli/src/command/reservation/withdraw.rs` — sends `ClosePaymentEscrow`, pre-flight escrow existence check - `crates/solana-cli/src/command/reservation/price.rs` — read-only, joins MetroHistory + DeviceHistory to show per-device pricing - `crates/solana-cli/src/command/reservation/list.rs` — read-only, fetches ClientSeat accounts with discriminator memcmp filter, supports `--withdraw-authority` and `--client-ip` filters - `crates/solana-cli/src/command/mod.rs` — wires `Reservation` variant into top-level CLI - `crates/solana-sdk/src/reservation/instruction/account.rs` — merged `new` / `new_with_ata_refund` into single constructor </details> ## Related PRs - **#275 (SDK)**: merged — this PR builds on it - **#277 (Mock + tests)**: depends on this — adds mock program and integration tests Part 2 of #274
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Lines of code
Related PRs
reservationCLI commandsPart 1 of #274