feat(wasm-solana): complete Jito stake/unstake and sign generated key…#160
Merged
feat(wasm-solana): complete Jito stake/unstake and sign generated key…#160
Conversation
…pairs in Rust Jito staking: - Add ATA creation support (createAssociatedTokenAccount field) - Derive withdraw authority PDA, destination/source pool accounts, and referral pool account when not explicitly provided - Use validatorAddress as fallback for stakePoolAddress Jito unstaking: - Build full 4-instruction pattern: Approve, CreateAccount, WithdrawStake, Deactivate (matches legacy SDK behavior) - Build SPL Token Approve instruction manually to avoid spl-token v6/v3 type incompatibility Generated keypair signing: - Sign generated keypairs (stake/unstake accounts) in Rust inside build_from_intent before returning to JS - Signatures survive the wasm-bindgen boundary because WasmTransaction is a heap-allocated Rust object that JS holds a handle to - Add sign_with_secret_key to WasmTransaction and sign to WasmKeypair for use by other callers BTC-3025
| * | ||
| * @param secretKeyBase58 - The Ed25519 secret key (32-byte seed) as base58 | ||
| */ | ||
| signWithSecretKey(secretKeyBase58: string): void { |
Contributor
There was a problem hiding this comment.
@copilot explain how public keys are typed in wasm-utxo
|
@OttoAllmendinger I've opened a new pull request, #161, to work on those changes. Once the pull request is ready, I'll request review from you. |
OttoAllmendinger
approved these changes
Feb 13, 2026
Comment on lines
+149
to
+152
| let secret_bytes: Vec<u8> = bs58::decode(secret_key_base58) | ||
| .into_vec() | ||
| .map_err(|e| WasmSolanaError::new(&format!("Failed to decode secret key: {}", e)))?; | ||
| let keypair = Keypair::from_secret_key_bytes(&secret_bytes)?; |
Contributor
There was a problem hiding this comment.
the wasm interface is still pretty stringly typed
you could use the existing Keypair type instead here
- more type safety at the callsite
- no needless repeated decoding of the key here => faster tests
The callsite could still be backwards compatible and convert from string when necessary
Comment on lines
+21
to
+23
| StakingType::Native => "NATIVE", | ||
| StakingType::Jito => "JITO", | ||
| StakingType::Marinade => "MARINADE", |
Contributor
There was a problem hiding this comment.
uppercase here and regular case for the others? I'm guessing this is due to some external interface
| * Get the Solana address (base58-encoded public key) | ||
| * @returns The address as a base58 string | ||
| */ | ||
| getAddress(): string { |
Contributor
There was a problem hiding this comment.
do we actually need this anywhere?
| * A keypair consists of a 32-byte secret key and a 32-byte public key. | ||
| * The public key (base58-encoded) is the Solana address. | ||
| */ | ||
| export class Keypair { |
Contributor
There was a problem hiding this comment.
so we already have one!
lcovar
added a commit
that referenced
this pull request
Feb 13, 2026
- Replace signWithSecretKey(string) with signWithKeypair(Keypair) for type safety and to avoid needless base58 decoding at the call site - Remove duplicate toBase58() from Keypair (identical to getAddress()) - Add comments explaining casing conventions in enum JS conversions BTC-3025
lcovar
added a commit
that referenced
this pull request
Feb 13, 2026
refactor: address PR #160 review feedback
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.
…pairs in Rust
Jito staking:
Jito unstaking:
Generated keypair signing:
BTC-3025