{"id":49815,"library":"yellowstone-grpc-mock","title":"yellowstone-grpc-mock","description":"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.","status":"active","version":"0.1.4","language":"javascript","source_language":"en","source_url":"https://github.com/ic-n/ye","tags":["javascript","typescript"],"install":[{"cmd":"npm install yellowstone-grpc-mock","lang":"bash","label":"npm"},{"cmd":"yarn add yellowstone-grpc-mock","lang":"bash","label":"yarn"},{"cmd":"pnpm add yellowstone-grpc-mock","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for serializing SPL token account layouts","package":"@solana/spl-token","optional":true},{"reason":"Peer dependency for serializing Metaplex metadata","package":"@metaplex-foundation/mpl-token-metadata","optional":true},{"reason":"Peer dependency for base58 encoding/decoding","package":"bs58","optional":true}],"imports":[{"note":"ESM-only; CommonJS require will fail. Use ESM imports or configure tsconfig accordingly.","wrong":"const { YellowStoneMock } = require('yellowstone-grpc-mock')","symbol":"YellowStoneMock","correct":"import { YellowStoneMock } from 'yellowstone-grpc-mock'"},{"note":"MockClient is only accessible inside jest.mock() via require('yellowstone-grpc-mock').MockClient.","wrong":"MockClient is not a named export; it's part of the jest.mock setup","symbol":"MockClient","correct":"import { MockClient } from 'yellowstone-grpc-mock'"},{"note":"Action factories are in a subpath export 'yellowstone-grpc-mock/actions', not the main entry.","wrong":"import { mintedNFT } from 'yellowstone-grpc-mock'","symbol":"mintedNFT","correct":"import { mintedNFT } from 'yellowstone-grpc-mock/actions'"},{"note":"Action factories are in a subpath export 'yellowstone-grpc-mock/actions', not the main entry.","wrong":"import { transferNFT } from 'yellowstone-grpc-mock'","symbol":"transferNFT","correct":"import { transferNFT } from 'yellowstone-grpc-mock/actions'"}],"quickstart":{"code":"import { YellowStoneMock } from 'yellowstone-grpc-mock';\nimport { mintedNFT, transferNFT, transferSPL, slotUpdate } from 'yellowstone-grpc-mock/actions';\n\nconst MINT = 'GkNkuozgNFN7K5AAjmFjMSFnNegpqkwEGbJyEXGq7LYR';\nconst WALLET1 = '5ByhkuHZMH7sU36DhfNMjy78hSMTPKJ1UEdDJqoKkmrU';\nconst WALLET2 = '9nJ7BWiAsNEHzFBtNXLFKFuJJupCdMwZ6xGZZNYPumpE';\n\nit('counts hold slots on transfer', async () => {\n  const ysm = new YellowStoneMock();\n  ysm\n    .push(mintedNFT(MINT, WALLET1))\n    .push(transferNFT(MINT, WALLET1, WALLET2))\n    .push(slotUpdate())\n    .end();\n\n  const client = new (require('@triton-one/yellowstone-grpc').default)('https://mock', 'token');\n  // ... indexer logic\n  expect(client).toBeDefined();\n});","lang":"typescript","description":"Shows basic mock setup: create YellowStoneMock, push action factories for mint and transfer, end stream, and use with mock client."},"warnings":[{"fix":"Use ESM imports (import { YellowStoneMock } from 'yellowstone-grpc-mock') or configure your test runner to support ESM (e.g., --experimental-vm-modules in Node).","message":"ESM only – CommonJS require() will throw ERR_REQUIRE_ESM","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Run npm install @solana/spl-token @metaplex-foundation/mpl-token-metadata bs58","message":"Peer dependencies must be installed separately; not bundled","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use import { mintedNFT } from 'yellowstone-grpc-mock/actions'","message":"Action factory imports must use subpath 'yellowstone-grpc-mock/actions', not main entry","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use jest.mock('@triton-one/yellowstone-grpc', () => { const { MockClient } = require('yellowstone-grpc-mock'); return { __esModule: true, default: MockClient }; })","message":"MockClient is not exported as named export; only accessible via jest.mock and require()","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'/mpl-token-metadata':56 '/yellowstone-grpc':12 'account':24 'amount':92 'behavior':80 'busi':41 'byte':47 'case':85 'chain':19 'data':20 'dep':102 'deseri':37 'differenti':82 'duplex':67 'edg':84 'emit':14 'enabl':30 'exercis':34 'first':74 'foundat':55 'frozen':95 'full':36 'geyser':78 'grpc':3 'includ':21 'instal':104 'integr':31 'javascript':106 'jest':6 'key':81 'layout':25,48 'librari':51 'like':86 'logic':42 'metadata':28 'metaplex':27,54 'metaplex-found':53 'mint':93 'mirror':76 'mock':4,7,69 'on-chain':17 'one':11 'pars':44 'peer':101 'pipelin':38 'playback':71 'protobuf':63 'real':15,77 'requir':100 'runtim':50 'self':88 'self-transf':87 'separ':105 'serial':16,46 'ship':97 'solana/spl-token':52 'spl':22 'start':70 'state':96 'stream':64,79 'subscriberequest':75 'subscribeupd':62 'test':32,83 'token':23 'transfer':89 'triton':10 'triton-on':9 'type':99 'typescript':98,107 'use':49 'v0.1.4':29 'valid':61 'via':65 'wrap':58 'yellowston':2 'yellowstone-grpc-mock':1 'zero':91 'zero-amount':90","created_at":"2026-06-07T17:03:44.738658+00:00","updated_at":"2026-06-07T17:03:44.738658+00:00","problems":[{"fix":"Run npm install --save-dev yellowstone-grpc-mock","cause":"Package not installed or missing from node_modules","error":"Cannot find package 'yellowstone-grpc-mock' imported from ..."},{"fix":"Replace require('yellowstone-grpc-mock') with import ... from 'yellowstone-grpc-mock'","cause":"Using CommonJS require() to import an ESM-only package","error":"ERR_REQUIRE_ESM"},{"fix":"Run npm install @solana/spl-token","cause":"Missing peer dependency","error":"Cannot find module '@solana/spl-token' or its corresponding type declarations."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ic-n/ye#readme","github":"https://github.com/ic-n/ye","docs":null,"changelog":null,"pypi":null,"npm":"yellowstone-grpc-mock","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}