Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@solana/rpc-transport-http

Package Overview
Dependencies
Maintainers
15
Versions
936
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/rpc-transport-http - npm Package Compare versions

Comparing version 2.0.0-experimental.61f4b59 to 2.0.0-experimental.97527f4

24

dist/index.browser.js

@@ -41,5 +41,5 @@ // ../build-scripts/env-shim.ts

"permissions-policy": true,
// No currently available Typescript technique allows you to match on a prefix.
// 'proxy-':true,
// 'sec-':true,
// Prefix matching is implemented in code, below.
// 'proxy-': true,
// 'sec-': true,
referer: true,

@@ -72,6 +72,21 @@ te: true,

// src/http-transport.ts
function createHttpTransport({ headers, url }) {
var didWarnDispatcherWasSuppliedInNonNodeEnvironment = false;
function warnDispatcherWasSuppliedInNonNodeEnvironment() {
if (didWarnDispatcherWasSuppliedInNonNodeEnvironment) {
return;
}
didWarnDispatcherWasSuppliedInNonNodeEnvironment = true;
console.warn(
"You have supplied a `Dispatcher` to `createHttpTransport()`. It has been ignored because Undici dispatchers only work in Node environments. To eliminate this warning, omit the `dispatcher_NODE_ONLY` property from your config when running in a non-Node environment."
);
}
function createHttpTransport(config) {
if (__DEV__ && true && "dispatcher_NODE_ONLY" in config) {
warnDispatcherWasSuppliedInNonNodeEnvironment();
}
const { headers, url } = config;
if (__DEV__ && headers) {
assertIsAllowedHttpRequestHeaders(headers);
}
let dispatcherConfig;
const customHeaders = headers && normalizeHeaders(headers);

@@ -84,2 +99,3 @@ return async function makeHttpRequest({

const requestInfo = {
...dispatcherConfig,
body,

@@ -86,0 +102,0 @@ headers: {

@@ -41,5 +41,5 @@ // ../build-scripts/env-shim.ts

"permissions-policy": true,
// No currently available Typescript technique allows you to match on a prefix.
// 'proxy-':true,
// 'sec-':true,
// Prefix matching is implemented in code, below.
// 'proxy-': true,
// 'sec-': true,
referer: true,

@@ -72,6 +72,21 @@ te: true,

// src/http-transport.ts
function createHttpTransport({ headers, url }) {
var didWarnDispatcherWasSuppliedInNonNodeEnvironment = false;
function warnDispatcherWasSuppliedInNonNodeEnvironment() {
if (didWarnDispatcherWasSuppliedInNonNodeEnvironment) {
return;
}
didWarnDispatcherWasSuppliedInNonNodeEnvironment = true;
console.warn(
"You have supplied a `Dispatcher` to `createHttpTransport()`. It has been ignored because Undici dispatchers only work in Node environments. To eliminate this warning, omit the `dispatcher_NODE_ONLY` property from your config when running in a non-Node environment."
);
}
function createHttpTransport(config) {
if (__DEV__ && true && "dispatcher_NODE_ONLY" in config) {
warnDispatcherWasSuppliedInNonNodeEnvironment();
}
const { headers, url } = config;
if (__DEV__ && headers) {
assertIsAllowedHttpRequestHeaders(headers);
}
let dispatcherConfig;
const customHeaders = headers && normalizeHeaders(headers);

@@ -84,2 +99,3 @@ return async function makeHttpRequest({

const requestInfo = {
...dispatcherConfig,
body,

@@ -86,0 +102,0 @@ headers: {

24

dist/index.node.js

@@ -0,7 +1,6 @@

import { fetch } from 'undici';
// ../build-scripts/env-shim.ts
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
// ../fetch-impl/dist/index.node.js
var e = globalThis.fetch;
// src/http-transport-errors.ts

@@ -41,5 +40,5 @@ var SolanaHttpError = class extends Error {

"permissions-policy": true,
// No currently available Typescript technique allows you to match on a prefix.
// 'proxy-':true,
// 'sec-':true,
// Prefix matching is implemented in code, below.
// 'proxy-': true,
// 'sec-': true,
referer: true,

@@ -72,6 +71,14 @@ te: true,

// src/http-transport.ts
function createHttpTransport({ headers, url }) {
function createHttpTransport(config) {
if (__DEV__ && false) {
warnDispatcherWasSuppliedInNonNodeEnvironment();
}
const { headers, url } = config;
if (__DEV__ && headers) {
assertIsAllowedHttpRequestHeaders(headers);
}
let dispatcherConfig;
if ("dispatcher_NODE_ONLY" in config) {
dispatcherConfig = { dispatcher: config.dispatcher_NODE_ONLY };
}
const customHeaders = headers && normalizeHeaders(headers);

@@ -84,2 +91,3 @@ return async function makeHttpRequest({

const requestInfo = {
...dispatcherConfig,
body,

@@ -96,3 +104,3 @@ headers: {

};
const response = await e(url, requestInfo);
const response = await fetch(url, requestInfo);
if (!response.ok) {

@@ -99,0 +107,0 @@ throw new SolanaHttpError({

@@ -7,3 +7,3 @@ export type AllowedHttpRequestHeaders = Readonly<{

type DisallowedHeaders = 'Accept' | 'Content-Length' | 'Content-Type' | 'Solana-Client';
type ForbiddenHeaders = 'Accept-Charset' | 'Accept-Encoding' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Connection' | 'Content-Length' | 'Cookie' | 'Date' | 'DNT' | 'Expect' | 'Host' | 'Keep-Alive' | 'Origin' | 'Permissions-Policy' | 'Referer' | 'TE' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Via';
type ForbiddenHeaders = 'Accept-Charset' | 'Accept-Encoding' | 'Access-Control-Request-Headers' | 'Access-Control-Request-Method' | 'Connection' | 'Content-Length' | 'Cookie' | 'Date' | 'DNT' | 'Expect' | 'Host' | 'Keep-Alive' | 'Origin' | 'Permissions-Policy' | `Proxy-${string}` | `Sec-${string}` | 'Referer' | 'TE' | 'Trailer' | 'Transfer-Encoding' | 'Upgrade' | 'Via';
export declare function assertIsAllowedHttpRequestHeaders(headers: Record<string, string>): asserts headers is AllowedHttpRequestHeaders;

@@ -10,0 +10,0 @@ /**

import { RpcTransport } from '@solana/rpc-spec';
import type Dispatcher from 'undici/types/dispatcher';
import { AllowedHttpRequestHeaders } from './http-transport-headers.js';
type Config = Readonly<{
dispatcher_NODE_ONLY?: Dispatcher;
headers?: AllowedHttpRequestHeaders;
url: string;
}>;
export declare function createHttpTransport({ headers, url }: Config): RpcTransport;
export declare function createHttpTransport(config: Config): RpcTransport;
export {};
//# sourceMappingURL=http-transport.d.ts.map
{
"name": "@solana/rpc-transport-http",
"version": "2.0.0-experimental.61f4b59",
"version": "2.0.0-experimental.97527f4",
"description": "An RPC transport that uses HTTP requests",

@@ -49,3 +49,4 @@ "exports": {

"dependencies": {
"@solana/rpc-spec": "2.0.0-experimental.61f4b59"
"undici": "^6.6.2",
"@solana/rpc-spec": "2.0.0-experimental.97527f4"
},

@@ -52,0 +53,0 @@ "bundlewatch": {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc