@solana/rpc-transport-http
Advanced tools
Comparing version 2.0.0-experimental.2df278c to 2.0.0-experimental.2e0ae95
{ | ||
"name": "@solana/rpc-transport-http", | ||
"version": "2.0.0-experimental.2df278c", | ||
"version": "2.0.0-experimental.2e0ae95", | ||
"description": "An RPC transport that uses HTTP requests", | ||
@@ -50,3 +50,3 @@ "exports": { | ||
"undici": "^6.6.2", | ||
"@solana/rpc-spec": "2.0.0-experimental.2df278c" | ||
"@solana/rpc-spec": "2.0.0-experimental.2e0ae95" | ||
}, | ||
@@ -53,0 +53,0 @@ "bundlewatch": { |
@@ -219,3 +219,27 @@ [![npm][npm-image]][npm-url] | ||
```ts | ||
// TODO: Your turn; send us a pull request with an example. | ||
import { RpcTransport } from '@solana/rpc-spec'; | ||
import { createHttpTransport } from '@solana/rpc-transport-http'; | ||
// Create a transport for each RPC server | ||
const transports = [ | ||
createHttpTransport({ url: 'https://mainnet-beta.my-server-1.com' }), | ||
createHttpTransport({ url: 'https://mainnet-beta.my-server-2.com' }), | ||
createHttpTransport({ url: 'https://mainnet-beta.my-server-2.com' }), | ||
]; | ||
// A failover transport that will try each transport in order until one succeeds before failing | ||
async function failoverTransport<TResponse>(...args: Parameters<RpcTransport>): Promise<TResponse> { | ||
let requestError; | ||
for (const transport of transports) { | ||
try { | ||
return await transport(...args); | ||
} catch (err) { | ||
requestError = err; | ||
console.error(err); | ||
} | ||
} | ||
throw requestError; | ||
} | ||
``` |
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
85429
245
+ Added@solana/rpc-spec@2.0.0-experimental.2e0ae95(transitive)
+ Added@solana/rpc-spec-types@2.0.0-experimental.2e0ae95(transitive)
- Removed@solana/rpc-spec@2.0.0-experimental.2df278c(transitive)
- Removed@solana/rpc-spec-types@2.0.0-experimental.2df278c(transitive)