@solana/rpc-subscriptions-api 2.0.0-20241006045741

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +68 -0
  3. package/dist/index.browser.cjs +217 -0
  4. package/dist/index.browser.cjs.map +1 -0
  5. package/dist/index.browser.mjs +210 -0
  6. package/dist/index.browser.mjs.map +1 -0
  7. package/dist/index.native.mjs +210 -0
  8. package/dist/index.native.mjs.map +1 -0
  9. package/dist/index.node.cjs +217 -0
  10. package/dist/index.node.cjs.map +1 -0
  11. package/dist/index.node.mjs +210 -0
  12. package/dist/index.node.mjs.map +1 -0
  13. package/dist/types/account-notifications.d.ts +29 -0
  14. package/dist/types/account-notifications.d.ts.map +1 -0
  15. package/dist/types/block-notifications.d.ts +236 -0
  16. package/dist/types/block-notifications.d.ts.map +1 -0
  17. package/dist/types/index.d.ts +18 -0
  18. package/dist/types/index.d.ts.map +1 -0
  19. package/dist/types/logs-notifications.d.ts +24 -0
  20. package/dist/types/logs-notifications.d.ts.map +1 -0
  21. package/dist/types/program-notifications.d.ts +46 -0
  22. package/dist/types/program-notifications.d.ts.map +1 -0
  23. package/dist/types/root-notifications.d.ts +10 -0
  24. package/dist/types/root-notifications.d.ts.map +1 -0
  25. package/dist/types/signature-notifications.d.ts +24 -0
  26. package/dist/types/signature-notifications.d.ts.map +1 -0
  27. package/dist/types/slot-notifications.d.ts +14 -0
  28. package/dist/types/slot-notifications.d.ts.map +1 -0
  29. package/dist/types/slots-updates-notifications.d.ts +32 -0
  30. package/dist/types/slots-updates-notifications.d.ts.map +1 -0
  31. package/dist/types/vote-notifications.d.ts +18 -0
  32. package/dist/types/vote-notifications.d.ts.map +1 -0
  33. package/package.json +93 -0
@@ -0,0 +1,10 @@
1
+ import type { Slot } from '@solana/rpc-types';
2
+ type RootNotificationsApiNotification = Slot;
3
+ export type RootNotificationsApi = {
4
+ /**
5
+ * Subscribe to receive notification anytime a new root is set by the validator
6
+ */
7
+ rootNotifications(NO_CONFIG?: Record<string, never>): RootNotificationsApiNotification;
8
+ };
9
+ export {};
10
+ //# sourceMappingURL=root-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-notifications.d.ts","sourceRoot":"","sources":["../../src/root-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,KAAK,gCAAgC,GAAG,IAAI,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG;IAC/B;;OAEG;IACH,iBAAiB,CAEb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAClC,gCAAgC,CAAC;CACvC,CAAC"}
@@ -0,0 +1,24 @@
1
+ import type { Signature } from '@solana/keys';
2
+ import type { Commitment, SolanaRpcResponse, TransactionError } from '@solana/rpc-types';
3
+ type SignatureNotificationsApiNotificationReceived = SolanaRpcResponse<Readonly<string>>;
4
+ type SignatureNotificationsApiNotificationProcessed = SolanaRpcResponse<Readonly<{
5
+ err: TransactionError | null;
6
+ }>>;
7
+ type SignatureNotificationsApiConfigBase = Readonly<{
8
+ commitment?: Commitment;
9
+ }>;
10
+ export type SignatureNotificationsApi = {
11
+ /**
12
+ * Subscribe to a transaction signature to receive notification when a given transaction is committed.
13
+ * On `signatureNotification` - the subscription is automatically cancelled.
14
+ * The signature must be a txid, the first signature of a transaction.
15
+ */
16
+ signatureNotifications(signature: Signature, config: Readonly<{
17
+ enableReceivedNotification: true;
18
+ }> & SignatureNotificationsApiConfigBase): SignatureNotificationsApiNotificationProcessed | SignatureNotificationsApiNotificationReceived;
19
+ signatureNotifications(signature: Signature, config?: Readonly<{
20
+ enableReceivedNotification?: false;
21
+ }> & SignatureNotificationsApiConfigBase): SignatureNotificationsApiNotificationProcessed;
22
+ };
23
+ export {};
24
+ //# sourceMappingURL=signature-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signature-notifications.d.ts","sourceRoot":"","sources":["../../src/signature-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAEzF,KAAK,6CAA6C,GAAG,iBAAiB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAEzF,KAAK,8CAA8C,GAAG,iBAAiB,CACnE,QAAQ,CAAC;IAEL,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAAC;CAChC,CAAC,CACL,CAAC;AAEF,KAAK,mCAAmC,GAAG,QAAQ,CAAC;IAChD,UAAU,CAAC,EAAE,UAAU,CAAC;CAC3B,CAAC,CAAC;AAEH,MAAM,MAAM,yBAAyB,GAAG;IACpC;;;;OAIG;IACH,sBAAsB,CAElB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,QAAQ,CAAC;QAGb,0BAA0B,EAAE,IAAI,CAAC;KACpC,CAAC,GACE,mCAAmC,GACxC,8CAA8C,GAAG,6CAA6C,CAAC;IAClG,sBAAsB,CAClB,SAAS,EAAE,SAAS,EACpB,MAAM,CAAC,EAAE,QAAQ,CAAC;QACd,0BAA0B,CAAC,EAAE,KAAK,CAAC;KACtC,CAAC,GACE,mCAAmC,GACxC,8CAA8C,CAAC;CACrD,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { Slot } from '@solana/rpc-types';
2
+ type SlotNotificationsApiNotification = Readonly<{
3
+ parent: Slot;
4
+ root: Slot;
5
+ slot: Slot;
6
+ }>;
7
+ export type SlotNotificationsApi = {
8
+ /**
9
+ * Subscribe to receive notification anytime a slot is processed by the validator
10
+ */
11
+ slotNotifications(NO_CONFIG?: Record<string, never>): SlotNotificationsApiNotification;
12
+ };
13
+ export {};
14
+ //# sourceMappingURL=slot-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slot-notifications.d.ts","sourceRoot":"","sources":["../../src/slot-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,KAAK,gCAAgC,GAAG,QAAQ,CAAC;IAC7C,MAAM,EAAE,IAAI,CAAC;IACb,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,IAAI,CAAC;CACd,CAAC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG;IAC/B;;OAEG;IACH,iBAAiB,CAEb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAClC,gCAAgC,CAAC;CACvC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { Slot, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';
2
+ type SlotsUpdatesNotificationsApiNotificationBase = Readonly<{
3
+ slot: Slot;
4
+ timestamp: U64UnsafeBeyond2Pow53Minus1;
5
+ type: 'completed' | 'firstShredReceived' | 'optimisticConfirmation' | 'root';
6
+ }>;
7
+ type SlotsUpdatesNotificationsApiNotificationCreatedBank = Readonly<{
8
+ parent: Slot;
9
+ type: 'createdBank';
10
+ }> & SlotsUpdatesNotificationsApiNotificationBase;
11
+ type SlotsUpdatesNotificationsApiNotificationDead = Readonly<{
12
+ err: string;
13
+ type: 'dead';
14
+ }> & SlotsUpdatesNotificationsApiNotificationBase;
15
+ type SlotsUpdatesNotificationsApiNotificationFrozen = Readonly<{
16
+ stats: Readonly<{
17
+ maxTransactionsPerEntry: U64UnsafeBeyond2Pow53Minus1;
18
+ numFailedTransactions: U64UnsafeBeyond2Pow53Minus1;
19
+ numSuccessfulTransactions: U64UnsafeBeyond2Pow53Minus1;
20
+ numTransactionEntries: U64UnsafeBeyond2Pow53Minus1;
21
+ }>;
22
+ type: 'frozen';
23
+ }> & SlotsUpdatesNotificationsApiNotificationBase;
24
+ type SlotsUpdatesNotificationsApiNotification = SlotsUpdatesNotificationsApiNotificationBase | SlotsUpdatesNotificationsApiNotificationCreatedBank | SlotsUpdatesNotificationsApiNotificationDead | SlotsUpdatesNotificationsApiNotificationFrozen;
25
+ export type SlotsUpdatesNotificationsApi = {
26
+ /**
27
+ * Subscribe to receive a notification from the validator on a variety of updates on every slot
28
+ */
29
+ slotsUpdatesNotifications(NO_CONFIG?: Record<string, never>): SlotsUpdatesNotificationsApiNotification;
30
+ };
31
+ export {};
32
+ //# sourceMappingURL=slots-updates-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"slots-updates-notifications.d.ts","sourceRoot":"","sources":["../../src/slots-updates-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAE3E,KAAK,4CAA4C,GAAG,QAAQ,CAAC;IACzD,IAAI,EAAE,IAAI,CAAC;IACX,SAAS,EAAE,2BAA2B,CAAC;IACvC,IAAI,EAAE,WAAW,GAAG,oBAAoB,GAAG,wBAAwB,GAAG,MAAM,CAAC;CAChF,CAAC,CAAC;AAEH,KAAK,mDAAmD,GAAG,QAAQ,CAAC;IAChE,MAAM,EAAE,IAAI,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;CACvB,CAAC,GACE,4CAA4C,CAAC;AAEjD,KAAK,4CAA4C,GAAG,QAAQ,CAAC;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC,GACE,4CAA4C,CAAC;AAEjD,KAAK,8CAA8C,GAAG,QAAQ,CAAC;IAC3D,KAAK,EAAE,QAAQ,CAAC;QACZ,uBAAuB,EAAE,2BAA2B,CAAC;QACrD,qBAAqB,EAAE,2BAA2B,CAAC;QACnD,yBAAyB,EAAE,2BAA2B,CAAC;QACvD,qBAAqB,EAAE,2BAA2B,CAAC;KACtD,CAAC,CAAC;IACH,IAAI,EAAE,QAAQ,CAAC;CAClB,CAAC,GACE,4CAA4C,CAAC;AAEjD,KAAK,wCAAwC,GACvC,4CAA4C,GAC5C,mDAAmD,GACnD,4CAA4C,GAC5C,8CAA8C,CAAC;AAErD,MAAM,MAAM,4BAA4B,GAAG;IACvC;;OAEG;IACH,yBAAyB,CAErB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAClC,wCAAwC,CAAC;CAC/C,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type { Address } from '@solana/addresses';
2
+ import type { Signature } from '@solana/keys';
3
+ import type { Blockhash, Slot, UnixTimestampUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';
4
+ type VoteNotificationsApiNotification = Readonly<{
5
+ hash: Blockhash;
6
+ signature: Signature;
7
+ slots: readonly Slot[];
8
+ timestamp: UnixTimestampUnsafeBeyond2Pow53Minus1 | null;
9
+ votePubkey: Address;
10
+ }>;
11
+ export type VoteNotificationsApi = {
12
+ /**
13
+ * Subscribe to receive a notification from the validator on a variety of updates on every slot
14
+ */
15
+ voteNotifications(NO_CONFIG?: Record<string, never>): VoteNotificationsApiNotification;
16
+ };
17
+ export {};
18
+ //# sourceMappingURL=vote-notifications.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vote-notifications.d.ts","sourceRoot":"","sources":["../../src/vote-notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,qCAAqC,EAAE,MAAM,mBAAmB,CAAC;AAEhG,KAAK,gCAAgC,GAAG,QAAQ,CAAC;IAC7C,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,EAAE,SAAS,IAAI,EAAE,CAAC;IACvB,SAAS,EAAE,qCAAqC,GAAG,IAAI,CAAC;IACxD,UAAU,EAAE,OAAO,CAAC;CACvB,CAAC,CAAC;AAEH,MAAM,MAAM,oBAAoB,GAAG;IAC/B;;OAEG;IACH,iBAAiB,CAEb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,GAClC,gCAAgC,CAAC;CACvC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "@solana/rpc-subscriptions-api",
3
+ "version": "2.0.0-20241006045741",
4
+ "description": "Defines all default Solana RPC subscriptions as types",
5
+ "exports": {
6
+ "edge-light": {
7
+ "import": "./dist/index.node.mjs",
8
+ "require": "./dist/index.node.cjs"
9
+ },
10
+ "workerd": {
11
+ "import": "./dist/index.node.mjs",
12
+ "require": "./dist/index.node.cjs"
13
+ },
14
+ "browser": {
15
+ "import": "./dist/index.browser.mjs",
16
+ "require": "./dist/index.browser.cjs"
17
+ },
18
+ "node": {
19
+ "import": "./dist/index.node.mjs",
20
+ "require": "./dist/index.node.cjs"
21
+ },
22
+ "react-native": "./dist/index.native.mjs",
23
+ "types": "./dist/types/index.d.ts"
24
+ },
25
+ "browser": {
26
+ "./dist/index.node.cjs": "./dist/index.browser.cjs",
27
+ "./dist/index.node.mjs": "./dist/index.browser.mjs"
28
+ },
29
+ "main": "./dist/index.node.cjs",
30
+ "module": "./dist/index.node.mjs",
31
+ "react-native": "./dist/index.native.mjs",
32
+ "types": "./dist/types/index.d.ts",
33
+ "type": "commonjs",
34
+ "files": [
35
+ "./dist/"
36
+ ],
37
+ "sideEffects": false,
38
+ "keywords": [
39
+ "blockchain",
40
+ "solana",
41
+ "web3"
42
+ ],
43
+ "author": "Solana Labs Maintainers <maintainers@solanalabs.com>",
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/solana-labs/solana-web3.js"
48
+ },
49
+ "bugs": {
50
+ "url": "http://github.com/solana-labs/solana-web3.js/issues"
51
+ },
52
+ "browserslist": [
53
+ "supports bigint and not dead",
54
+ "maintained node versions"
55
+ ],
56
+ "dependencies": {
57
+ "@solana/addresses": "2.0.0-20241006045741",
58
+ "@solana/keys": "2.0.0-20241006045741",
59
+ "@solana/rpc-subscriptions-spec": "2.0.0-20241006045741",
60
+ "@solana/fast-stable-stringify": "2.0.0-20241006045741",
61
+ "@solana/rpc-transformers": "2.0.0-20241006045741",
62
+ "@solana/rpc-types": "2.0.0-20241006045741",
63
+ "@solana/transaction-messages": "2.0.0-20241006045741",
64
+ "@solana/transactions": "2.0.0-20241006045741"
65
+ },
66
+ "peerDependencies": {
67
+ "typescript": ">=5"
68
+ },
69
+ "bundlewatch": {
70
+ "defaultCompression": "gzip",
71
+ "files": [
72
+ {
73
+ "path": "./dist/index*.js"
74
+ }
75
+ ]
76
+ },
77
+ "scripts": {
78
+ "compile:js": "tsup --config build-scripts/tsup.config.package.ts",
79
+ "compile:typedefs": "tsc -p ./tsconfig.declarations.json",
80
+ "dev": "jest -c ../../node_modules/@solana/test-config/jest-dev.config.ts --globalSetup @solana/test-config/test-validator-setup.js --globalTeardown @solana/test-config/test-validator-teardown.js --rootDir . --watch",
81
+ "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",
82
+ "publish-packages": "pnpm prepublishOnly && pnpm publish-impl",
83
+ "style:fix": "pnpm eslint --fix src && pnpm prettier --log-level warn --ignore-unknown --write ./*",
84
+ "test:lint": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent",
85
+ "test:prettier": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent",
86
+ "test:treeshakability:browser": "agadoo dist/index.browser.mjs",
87
+ "test:treeshakability:native": "agadoo dist/index.native.mjs",
88
+ "test:treeshakability:node": "agadoo dist/index.node.mjs",
89
+ "test:typecheck": "tsc --noEmit",
90
+ "test:unit:browser": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --globalSetup @solana/test-config/test-validator-setup.js --globalTeardown @solana/test-config/test-validator-teardown.js --rootDir . --silent",
91
+ "test:unit:node": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --globalSetup @solana/test-config/test-validator-setup.js --globalTeardown @solana/test-config/test-validator-teardown.js --rootDir . --silent"
92
+ }
93
+ }