{"_id":"@atlaschain/rpc-subscriptions-api","name":"@atlaschain/rpc-subscriptions-api","dist-tags":{"latest":"3.0.0"},"versions":{"3.0.0":{"name":"@atlaschain/rpc-subscriptions-api","version":"3.0.0","description":"Defines all default Atlas RPC subscriptions as types","exports":{"edge-light":{"import":"./dist/index.node.mjs","require":"./dist/index.node.cjs"},"workerd":{"import":"./dist/index.node.mjs","require":"./dist/index.node.cjs"},"browser":{"import":"./dist/index.browser.mjs","require":"./dist/index.browser.cjs"},"node":{"import":"./dist/index.node.mjs","require":"./dist/index.node.cjs"},"react-native":"./dist/index.native.mjs","types":"./dist/types/index.d.ts"},"browser":{"./dist/index.node.cjs":"./dist/index.browser.cjs","./dist/index.node.mjs":"./dist/index.browser.mjs"},"main":"./dist/index.node.cjs","module":"./dist/index.node.mjs","react-native":"./dist/index.native.mjs","types":"./dist/types/index.d.ts","type":"commonjs","sideEffects":false,"keywords":["blockchain","atlas","web3"],"author":{"name":"Atlas Chain Foundation"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/anza-xyz/kit.git"},"bugs":{"url":"https://github.com/anza-xyz/kit/issues"},"browserslist":["supports bigint and not dead","maintained node versions"],"dependencies":{"@atlaschain/addresses":"3.0.0","@atlaschain/rpc-transformers":"3.0.0","@atlaschain/rpc-types":"3.0.0","@atlaschain/transaction-messages":"3.0.0","@atlaschain/rpc-subscriptions-spec":"3.0.0","@atlaschain/keys":"3.0.0","@atlaschain/transactions":"3.0.0"},"peerDependencies":{"typescript":">=5.3.3"},"engines":{"node":">=20.18.0"},"scripts":{"compile:docs":"typedoc","compile:js":"tsup --config build-scripts/tsup.config.package.ts","compile:typedefs":"tsc -p ./tsconfig.declarations.json","dev":"jest -c ../../node_modules/@atlaschain/test-config/jest-dev.config.ts --globalSetup @atlaschain/test-config/test-validator-setup.js --globalTeardown @atlaschain/test-config/test-validator-teardown.js --rootDir . --watch","publish-impl":"npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || (pnpm publish --tag ${PUBLISH_TAG:-canary} --access public --no-git-checks && (([ -n \"${GITHUB_OUTPUT:-}\" ] && echo 'published=true' >> \"$GITHUB_OUTPUT\") || true) && (([ \"$PUBLISH_TAG\" != \"canary\" ] && ../build-scripts/maybe-tag-latest.ts $npm_package_name@$npm_package_version) || true))","publish-packages":"pnpm prepublishOnly && pnpm publish-impl","style:fix":"pnpm eslint --fix src && pnpm prettier --log-level warn --ignore-unknown --write ./*","test:lint":"TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@atlaschain/test-config/jest-lint.config.ts --rootDir . --silent","test:prettier":"TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@atlaschain/test-config/jest-prettier.config.ts --rootDir . --silent","test:treeshakability:browser":"agadoo dist/index.browser.mjs","test:treeshakability:native":"agadoo dist/index.native.mjs","test:treeshakability:node":"agadoo dist/index.node.mjs","test:typecheck":"tsc --noEmit","test:unit:browser":"TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@atlaschain/test-config/jest-unit.config.browser.ts --globalSetup @atlaschain/test-config/test-validator-setup.js --globalTeardown @atlaschain/test-config/test-validator-teardown.js --rootDir . --silent","test:unit:node":"TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@atlaschain/test-config/jest-unit.config.node.ts --globalSetup @atlaschain/test-config/test-validator-setup.js --globalTeardown @atlaschain/test-config/test-validator-teardown.js --rootDir . --silent"},"_id":"@atlaschain/rpc-subscriptions-api@3.0.0","homepage":"https://github.com/anza-xyz/kit#readme","_integrity":"sha512-1xXG2HeSxUpFAdbOO4x1yjWLrDkTNH3Zx04qwMu3xOmZTrsUFB//azorHEDbv7f8X7jlirs5CGaX7FK7hfsLPQ==","_resolved":"/private/var/folders/q8/nr55p0wd491c6fjmbky17kd00000gn/T/13db4b4d71fcb016ba8a27dcb2e6ade6/atlaschain-rpc-subscriptions-api-3.0.0.tgz","_from":"file:atlaschain-rpc-subscriptions-api-3.0.0.tgz","_nodeVersion":"22.12.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-1xXG2HeSxUpFAdbOO4x1yjWLrDkTNH3Zx04qwMu3xOmZTrsUFB//azorHEDbv7f8X7jlirs5CGaX7FK7hfsLPQ==","shasum":"b9a8bf18be2e9adcdbc53ec0b72e711345551429","tarball":"https://registry.npmjs.org/@atlaschain/rpc-subscriptions-api/-/rpc-subscriptions-api-3.0.0.tgz","fileCount":5,"unpackedSize":12662,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHOK2XEzjACuoifeW5baTqzUYUUXDuTi5BHGIr1MJNSCAiBkZy7i6Fn30FgjiGThACb7LjjsCoL6CvfFQOGKG5I+Tw=="}]},"_npmUser":{"name":"atlaschain","email":"jq@atlaschain.org"},"directories":{},"maintainers":[{"name":"atlaschain","email":"jq@atlaschain.org"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rpc-subscriptions-api_3.0.0_1764611562707_0.16581776617650035"},"_hasShrinkwrap":false}},"time":{"created":"2025-12-01T17:52:42.615Z","3.0.0":"2025-12-01T17:52:42.887Z","modified":"2025-12-01T17:52:43.258Z"},"maintainers":[{"name":"atlaschain","email":"jq@atlaschain.org"}],"description":"Defines all default Atlas RPC subscriptions as types","homepage":"https://github.com/anza-xyz/kit#readme","keywords":["blockchain","atlas","web3"],"repository":{"type":"git","url":"git+https://github.com/anza-xyz/kit.git"},"author":{"name":"Atlas Chain Foundation"},"bugs":{"url":"https://github.com/anza-xyz/kit/issues"},"license":"MIT","readme":"[![npm][npm-image]][npm-url]\n[![npm-downloads][npm-downloads-image]][npm-url]\n<br />\n[![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]\n\n[code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square\n[code-style-prettier-url]: https://github.com/prettier/prettier\n[npm-downloads-image]: https://img.shields.io/npm/dm/@atlas/rpc-subscriptions-api?style=flat\n[npm-image]: https://img.shields.io/npm/v/@atlas/rpc-subscriptions-api?style=flat\n[npm-url]: https://www.npmjs.com/package/@atlas/rpc-subscriptions-api\n\n# @atlas/rpc-subscriptions-api\n\nThis package contains types that describe the [methods](https://atlas.com/docs/rpc/websocket) of the Atlas JSON RPC Subscriptions API, and utilities for creating a `RpcSubscriptionsApi` implementation with sensible defaults. It can be used standalone, but it is also exported as part of Kit [`@atlas/kit`](https://github.com/anza-xyz/kit/tree/main/packages/kit).\n\nEach RPC subscriptions method is described in terms of a TypeScript type of the following form:\n\n```ts\ntype ExampleApi = {\n    thingNotifications(address: Address): Thing;\n};\n```\n\nA `RpcSubscriptionsApi` that implements `ExampleApi` will ultimately expose its defined methods on any `RpcSubscriptions` that uses it.\n\n```ts\nconst rpcSubscriptions: RpcSubscriptions<ExampleApi> = createExampleRpcSubscriptions(/* ... */);\nconst thingNotifications = await rpc\n    .thingNotifications(address('95DpK3y3GF7U8s1k4EvZ7xqyeCkhsHeZaE97iZpHUGMN'))\n    .subscribe({ abortSignal: AbortSignal.timeout(5_000) });\ntry {\n    for await (const thing of thingNotifications) {\n        console.log('Got a thing', thing);\n    }\n} catch (e) {\n    console.error('Our subscription to `Thing` notifications has failed', e);\n} finally {\n    console.log('We are done listening for `Thing` notifications');\n}\n```\n\n## Types\n\n### `AtlasRpcSubscriptionsApi{Devnet|Testnet|Mainnet}`\n\nThese types represent the RPC subscription methods available on a specific Atlas cluster.\n\n## Functions\n\n### `createAtlasRpcSubscriptionsApi(config)`\n\nCreates a `RpcSubscriptionsApi` implementation of the Atlas JSON RPC Subscriptions API with some default behaviours.\n\nThe default behaviours include:\n\n- A transform that converts `bigint` inputs to `number` for compatibility with version 1.0 of the Atlas JSON RPC.\n- A transform that calls the config's `onIntegerOverflow` handler whenever a `bigint` input would overflow a JavaScript IEEE 754 number. See [this](https://github.com/atlas-labs/atlas-web3.js/issues/1116) GitHub issue for more information.\n- A transform that applies a default commitment wherever not specified\n\n#### Arguments\n\nA config object with the following properties:\n\n- `defaultCommitment`: An optional default `Commitment` value. Given an RPC method that takes `commitment` as a parameter, this value will be used when the caller does not supply one.\n- `onIntegerOverflow(request, keyPath, value): void`: An optional function that will be called whenever a `bigint` input exceeds that which can be expressed using JavaScript numbers. This is used in the default `AtlasRpcSubscriptionsApi` to throw an exception rather than to allow truncated values to propagate through a program.\n","readmeFilename":"README.md","_rev":"1-bb3c39cdb27ddde4afccf21449b7fe9c"}