@solana/rpc-subscriptions-api
Advanced tools
Comparing version 2.0.0-canary-20241011161636 to 2.0.0-canary-20241011164625
{ | ||
"name": "@solana/rpc-subscriptions-api", | ||
"version": "2.0.0-canary-20241011161636", | ||
"version": "2.0.0-canary-20241011164625", | ||
"description": "Defines all default Solana RPC subscriptions as types", | ||
@@ -57,9 +57,10 @@ "exports": { | ||
"dependencies": { | ||
"@solana/keys": "2.0.0-canary-20241011161636", | ||
"@solana/addresses": "2.0.0-canary-20241011161636", | ||
"@solana/rpc-subscriptions-spec": "2.0.0-canary-20241011161636", | ||
"@solana/rpc-transformers": "2.0.0-canary-20241011161636", | ||
"@solana/rpc-types": "2.0.0-canary-20241011161636", | ||
"@solana/transaction-messages": "2.0.0-canary-20241011161636", | ||
"@solana/transactions": "2.0.0-canary-20241011161636" | ||
"@solana/rpc-subscriptions-spec": "2.0.0-canary-20241011164625", | ||
"@solana/addresses": "2.0.0-canary-20241011164625", | ||
"@solana/rpc-transformers": "2.0.0-canary-20241011164625", | ||
"@solana/keys": "2.0.0-canary-20241011164625", | ||
"@solana/fast-stable-stringify": "2.0.0-canary-20241011164625", | ||
"@solana/rpc-types": "2.0.0-canary-20241011164625", | ||
"@solana/transactions": "2.0.0-canary-20241011164625", | ||
"@solana/transaction-messages": "2.0.0-canary-20241011164625" | ||
}, | ||
@@ -66,0 +67,0 @@ "peerDependencies": { |
@@ -17,2 +17,53 @@ [![npm][npm-image]][npm-url] | ||
TODO | ||
This package contains types that describe the [methods](https://solana.com/docs/rpc/websocket) of the Solana 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 the Solana JavaScript SDK [`@solana/web3.js@rc`](https://github.com/solana-labs/solana-web3.js/tree/master/packages/library). | ||
Each RPC subscriptions method is described in terms of a TypeScript type of the following form: | ||
```ts | ||
type ExampleApi = { | ||
thingNotifications(address: Address): Thing; | ||
}; | ||
``` | ||
A `RpcSubscriptionsApi` that implements `ExampleApi` will ultimately expose its defined methods on any `RpcSubscriptions` that uses it. | ||
```ts | ||
const rpcSubscriptions: RpcSubscriptions<ExampleApi> = createExampleRpcSubscriptions(/* ... */); | ||
const thingNotifications = await rpc | ||
.thingNotifications(address('95DpK3y3GF7U8s1k4EvZ7xqyeCkhsHeZaE97iZpHUGMN')) | ||
.subscribe({ abortSignal: AbortSignal.timeout(5_000) }); | ||
try { | ||
for await (const thing of thingNotifications) { | ||
console.log('Got a thing', thing); | ||
} | ||
} catch (e) { | ||
console.error('Our subscription to `Thing` notifications has failed', e); | ||
} finally { | ||
console.log('We are done listening for `Thing` notifications'); | ||
} | ||
``` | ||
## Types | ||
### `SolanaRpcSubscriptionsApi{Devnet|Testnet|Mainnet}` | ||
These types represent the RPC subscription methods available on a specific Solana cluster. | ||
## Functions | ||
### `createSolanaRpcSubscriptionsApi(config)` | ||
Creates a `RpcSubscriptionsApi` implementation of the Solana JSON RPC Subscriptions API with some default behaviours. | ||
The default behaviours include: | ||
- A transform that converts `bigint` inputs to `number` for compatiblity with version 1.0 of the Solana JSON RPC. | ||
- 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/solana-labs/solana-web3.js/issues/1116) GitHub issue for more information. | ||
- A transform that applies a default commitment wherever not specified | ||
#### Arguments | ||
A config object with the following properties: | ||
- `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. | ||
- `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 `SolanaRpcSubscriptionsApi` to throw an exception rather than to allow truncated values to propagate through a program. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
153094
1487
69
9
+ Added@solana/fast-stable-stringify@2.0.0-canary-20241011164625
+ Added@solana/addresses@2.0.0-canary-20241011164625(transitive)
+ Added@solana/assertions@2.0.0-canary-20241011164625(transitive)
+ Added@solana/codecs-core@2.0.0-canary-20241011164625(transitive)
+ Added@solana/codecs-data-structures@2.0.0-canary-20241011164625(transitive)
+ Added@solana/codecs-numbers@2.0.0-canary-20241011164625(transitive)
+ Added@solana/codecs-strings@2.0.0-canary-20241011164625(transitive)
+ Added@solana/errors@2.0.0-canary-20241011164625(transitive)
+ Added@solana/fast-stable-stringify@2.0.0-canary-20241011164625(transitive)
+ Added@solana/functional@2.0.0-canary-20241011164625(transitive)
+ Added@solana/instructions@2.0.0-canary-20241011164625(transitive)
+ Added@solana/keys@2.0.0-canary-20241011164625(transitive)
+ Added@solana/promises@2.0.0-canary-20241011164625(transitive)
+ Added@solana/rpc-spec@2.0.0-canary-20241011164625(transitive)
+ Added@solana/rpc-spec-types@2.0.0-canary-20241011164625(transitive)
+ Added@solana/rpc-subscriptions-spec@2.0.0-canary-20241011164625(transitive)
+ Added@solana/rpc-transformers@2.0.0-canary-20241011164625(transitive)
+ Added@solana/rpc-types@2.0.0-canary-20241011164625(transitive)
+ Added@solana/subscribable@2.0.0-canary-20241011164625(transitive)
+ Added@solana/transaction-messages@2.0.0-canary-20241011164625(transitive)
+ Added@solana/transactions@2.0.0-canary-20241011164625(transitive)
- Removed@solana/addresses@2.0.0-canary-20241011161636(transitive)
- Removed@solana/assertions@2.0.0-canary-20241011161636(transitive)
- Removed@solana/codecs-core@2.0.0-canary-20241011161636(transitive)
- Removed@solana/codecs-data-structures@2.0.0-canary-20241011161636(transitive)
- Removed@solana/codecs-numbers@2.0.0-canary-20241011161636(transitive)
- Removed@solana/codecs-strings@2.0.0-canary-20241011161636(transitive)
- Removed@solana/errors@2.0.0-canary-20241011161636(transitive)
- Removed@solana/functional@2.0.0-canary-20241011161636(transitive)
- Removed@solana/instructions@2.0.0-canary-20241011161636(transitive)
- Removed@solana/keys@2.0.0-canary-20241011161636(transitive)
- Removed@solana/promises@2.0.0-canary-20241011161636(transitive)
- Removed@solana/rpc-spec@2.0.0-canary-20241011161636(transitive)
- Removed@solana/rpc-spec-types@2.0.0-canary-20241011161636(transitive)
- Removed@solana/rpc-subscriptions-spec@2.0.0-canary-20241011161636(transitive)
- Removed@solana/rpc-transformers@2.0.0-canary-20241011161636(transitive)
- Removed@solana/rpc-types@2.0.0-canary-20241011161636(transitive)
- Removed@solana/subscribable@2.0.0-canary-20241011161636(transitive)
- Removed@solana/transaction-messages@2.0.0-canary-20241011161636(transitive)
- Removed@solana/transactions@2.0.0-canary-20241011161636(transitive)
Updated@solana/rpc-subscriptions-spec@2.0.0-canary-20241011164625
Updated@solana/transaction-messages@2.0.0-canary-20241011164625