@solana/rpc-transport-http 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.
- package/LICENSE +20 -0
- package/README.md +261 -0
- package/dist/index.browser.cjs +265 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.mjs +262 -0
- package/dist/index.browser.mjs.map +1 -0
- package/dist/index.native.mjs +262 -0
- package/dist/index.native.mjs.map +1 -0
- package/dist/index.node.cjs +258 -0
- package/dist/index.node.cjs.map +1 -0
- package/dist/index.node.mjs +255 -0
- package/dist/index.node.mjs.map +1 -0
- package/dist/types/http-transport-for-solana-rpc.d.ts +11 -0
- package/dist/types/http-transport-for-solana-rpc.d.ts.map +1 -0
- package/dist/types/http-transport-headers.d.ts +24 -0
- package/dist/types/http-transport-headers.d.ts.map +1 -0
- package/dist/types/http-transport.d.ts +13 -0
- package/dist/types/http-transport.d.ts.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/is-solana-request.d.ts +11 -0
- package/dist/types/is-solana-request.d.ts.map +1 -0
- package/dist/types/parse-json-with-bigints.d.ts +7 -0
- package/dist/types/parse-json-with-bigints.d.ts.map +1 -0
- package/dist/types/stringify-json-with-bigints.d.ts +5 -0
- package/dist/types/stringify-json-with-bigints.d.ts.map +1 -0
- package/package.json +89 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RpcResponse, RpcTransport } from '@solana/rpc-spec';
|
|
2
|
+
import type Dispatcher from 'undici-types/dispatcher';
|
|
3
|
+
import { AllowedHttpRequestHeaders } from './http-transport-headers';
|
|
4
|
+
type Config = Readonly<{
|
|
5
|
+
dispatcher_NODE_ONLY?: Dispatcher;
|
|
6
|
+
fromJson?: (rawResponse: string, payload: unknown) => RpcResponse;
|
|
7
|
+
headers?: AllowedHttpRequestHeaders;
|
|
8
|
+
toJson?: (payload: unknown) => string;
|
|
9
|
+
url: string;
|
|
10
|
+
}>;
|
|
11
|
+
export declare function createHttpTransport(config: Config): RpcTransport;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=http-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-transport.d.ts","sourceRoot":"","sources":["../../src/http-transport.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,KAAK,UAAU,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EACH,yBAAyB,EAG5B,MAAM,0BAA0B,CAAC;AAElC,KAAK,MAAM,GAAG,QAAQ,CAAC;IACnB,oBAAoB,CAAC,EAAE,UAAU,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,WAAW,CAAC;IAClE,OAAO,CAAC,EAAE,yBAAyB,CAAC;IACpC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,CAAC;IACtC,GAAG,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAgBH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CA2ChE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const SOLANA_RPC_METHODS: readonly ["getAccountInfo", "getBalance", "getBlock", "getBlockCommitment", "getBlockHeight", "getBlockProduction", "getBlocks", "getBlocksWithLimit", "getBlockTime", "getClusterNodes", "getEpochInfo", "getEpochSchedule", "getFeeForMessage", "getFirstAvailableBlock", "getGenesisHash", "getHealth", "getHighestSnapshotSlot", "getIdentity", "getInflationGovernor", "getInflationRate", "getInflationReward", "getLargestAccounts", "getLatestBlockhash", "getLeaderSchedule", "getMaxRetransmitSlot", "getMaxShredInsertSlot", "getMinimumBalanceForRentExemption", "getMultipleAccounts", "getProgramAccounts", "getRecentPerformanceSamples", "getRecentPrioritizationFees", "getSignaturesForAddress", "getSignatureStatuses", "getSlot", "getSlotLeader", "getSlotLeaders", "getStakeActivation", "getStakeMinimumDelegation", "getSupply", "getTokenAccountBalance", "getTokenAccountsByDelegate", "getTokenAccountsByOwner", "getTokenLargestAccounts", "getTokenSupply", "getTransaction", "getTransactionCount", "getVersion", "getVoteAccounts", "index", "isBlockhashValid", "minimumLedgerSlot", "requestAirdrop", "sendTransaction", "simulateTransaction"];
|
|
2
|
+
/**
|
|
3
|
+
* Helper function that checks if a given `RpcRequest` comes from the Solana RPC API.
|
|
4
|
+
*/
|
|
5
|
+
export declare function isSolanaRequest(payload: unknown): payload is Readonly<{
|
|
6
|
+
jsonrpc: '2.0';
|
|
7
|
+
method: (typeof SOLANA_RPC_METHODS)[number];
|
|
8
|
+
params: unknown;
|
|
9
|
+
}>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=is-solana-request.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-solana-request.d.ts","sourceRoot":"","sources":["../../src/is-solana-request.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,kBAAkB,knCAuDd,CAAC;AAEX;;GAEG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,QAAQ,CAAC;IACnE,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,EAAE,OAAO,CAAC;CACnB,CAAC,CAED"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This function is a replacement for `JSON.parse` that can handle large
|
|
3
|
+
* unsafe integers by parsing them as BigInts. It transforms every
|
|
4
|
+
* numerical value into a BigInt without loss of precision.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseJsonWithBigInts(json: string): unknown;
|
|
7
|
+
//# sourceMappingURL=parse-json-with-bigints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse-json-with-bigints.d.ts","sourceRoot":"","sources":["../../src/parse-json-with-bigints.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAI1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stringify-json-with-bigints.d.ts","sourceRoot":"","sources":["../../src/stringify-json-with-bigints.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAIxF"}
|
package/package.json
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@solana/rpc-transport-http",
|
|
3
|
+
"version": "2.0.0-20241006045741",
|
|
4
|
+
"description": "An RPC transport that uses HTTP requests",
|
|
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
|
+
"undici-types": "^6.19.8",
|
|
58
|
+
"@solana/errors": "2.0.0-20241006045741",
|
|
59
|
+
"@solana/rpc-spec": "2.0.0-20241006045741"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"typescript": ">=5"
|
|
63
|
+
},
|
|
64
|
+
"bundlewatch": {
|
|
65
|
+
"defaultCompression": "gzip",
|
|
66
|
+
"files": [
|
|
67
|
+
{
|
|
68
|
+
"path": "./dist/index*.js"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
},
|
|
72
|
+
"scripts": {
|
|
73
|
+
"benchmark": "./src/__benchmarks__/run.ts",
|
|
74
|
+
"compile:js": "tsup --config build-scripts/tsup.config.package.ts",
|
|
75
|
+
"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
|
|
76
|
+
"dev": "jest -c ../../node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch",
|
|
77
|
+
"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",
|
|
78
|
+
"publish-packages": "pnpm prepublishOnly && pnpm publish-impl",
|
|
79
|
+
"style:fix": "pnpm eslint --fix src && pnpm prettier --log-level warn --ignore-unknown --write ./*",
|
|
80
|
+
"test:lint": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent",
|
|
81
|
+
"test:prettier": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent",
|
|
82
|
+
"test:treeshakability:browser": "agadoo dist/index.browser.mjs",
|
|
83
|
+
"test:treeshakability:native": "agadoo dist/index.native.mjs",
|
|
84
|
+
"test:treeshakability:node": "agadoo dist/index.node.mjs",
|
|
85
|
+
"test:typecheck": "tsc --noEmit",
|
|
86
|
+
"test:unit:browser": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --rootDir . --silent",
|
|
87
|
+
"test:unit:node": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --rootDir . --silent"
|
|
88
|
+
}
|
|
89
|
+
}
|