@glideco/solana-tx-verify
v0.1.0
Published
Solana sponsored-broadcast verifier — VersionedTransaction v0 deserialization, semantic instruction-equality checks, slot-0 (relayer) fee-payer guard, ed25519 user-signature verification.
Maintainers
Readme
@glideco/solana-tx-verify
Solana sponsored-broadcast verifier.
End-to-end verification of a client-built VersionedTransaction (v0) before
the relayer co-signs and broadcasts. Catches:
- Fee-payer key swap — client substitutes a different relayer in slot 0
- Fee-payer signature theft — client pre-fills slot 0's signature
- Instruction substitution — client swaps the inner instructions for malicious calldata
- Invalid user signature — slot 1+ signatures don't verify against the expected user pubkeys
import { verifySponsoredBroadcastTx } from '@glideco/solana-tx-verify';
const { tx, staticAccountKeys } = verifySponsoredBroadcastTx({
serializedTx: clientSubmittedBase64,
relayerPubkey: 'GLIDE-RELAYER-PUBKEY-IN-BASE58',
expectedUserSlots: [{ slot: 1, pubkey: vaultPda }],
expectedInstructions: [{ programId, accounts, data }],
proposalId: 'mp_xxx',
});
// Sign + broadcast — caller's responsibility from here.Errors
The package throws specific error subclasses (FeePayerKeyMismatch,
FeePayerSignatureStripped, InvalidUserSignature, InstructionSubstitution)
so callers can map to operator-specific HTTP / metric / logging surfaces.
License
MIT
