A Jest mock for @triton-one/yellowstone-grpc that emits real serialized on-chain data, including SPL token account layouts and Metaplex metadata. v0.1.4 enables integration tests that exercise the full deserialization pipeline, not just business logic after parsing. It serializes byte layouts using runtime libraries (@solana/spl-token, @metaplex-foundation/mpl-token-metadata) and wraps them in valid SubscribeUpdate protobufs streamed via a Duplex. The mock starts playback on the first SubscribeRequest, mirroring real Geyser stream behavior. Key differentiators: tests edge cases like self-transfers, zero-amount mints, and frozen states; ships TypeScript types; requires peer deps be installed separately.
npm install yellowstone-grpc-mockNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic mock setup: create YellowStoneMock, push action factories for mint and transfer, end stream, and use with mock client.
Use ESM imports (import { YellowStoneMock } from 'yellowstone-grpc-mock') or configure your test runner to support ESM (e.g., --experimental-vm-modules in Node).Run npm install @solana/spl-token @metaplex-foundation/mpl-token-metadata bs58
Use import { mintedNFT } from 'yellowstone-grpc-mock/actions'Use jest.mock('@triton-one/yellowstone-grpc', () => { const { MockClient } = require('yellowstone-grpc-mock'); return { __esModule: true, default: MockClient }; })Run npm install --save-dev yellowstone-grpc-mock
Replace require('yellowstone-grpc-mock') with import ... from 'yellowstone-grpc-mock'Run npm install @solana/spl-token