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

@solana/rpc-transport

Package Overview
Dependencies
Maintainers
14
Versions
602
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@solana/rpc-transport - npm Package Compare versions

Comparing version 2.0.0-experimental.db42a99 to 2.0.0-experimental.dbe6a73

dist/types/apis/api-types.d.ts

77

dist/index.browser.js
// ../build-scripts/env-shim.ts
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
// src/apis/methods/methods-api.ts
function createJsonRpcApi(config) {
return new Proxy({}, {
defineProperty() {
return false;
},
deleteProperty() {
return false;
},
get(...args) {
const [_, p] = args;
const methodName = p.toString();
return function(...rawParams) {
const params = config?.parametersTransformer ? config?.parametersTransformer(rawParams, methodName) : rawParams;
const responseTransformer = config?.responseTransformer ? config?.responseTransformer : (rawResponse) => rawResponse;
return {
methodName,
params,
responseTransformer
};
};
}
});
}
// src/apis/subscriptions/subscriptions-api.ts
function createJsonRpcSubscriptionsApi(config) {
return new Proxy({}, {
defineProperty() {
return false;
},
deleteProperty() {
return false;
},
get(...args) {
const [_, p] = args;
const notificationName = p.toString();
return function(...rawParams) {
const params = config?.parametersTransformer ? config?.parametersTransformer(rawParams, notificationName) : rawParams;
const responseTransformer = config?.responseTransformer ? config?.responseTransformer : (rawResponse) => rawResponse;
const subscribeMethodName = config?.subscribeNotificationNameTransformer ? config?.subscribeNotificationNameTransformer(notificationName) : notificationName;
const unsubscribeMethodName = config?.unsubscribeNotificationNameTransformer ? config?.unsubscribeNotificationNameTransformer(notificationName) : notificationName;
return {
params,
responseTransformer,
subscribeMethodName,
unsubscribeMethodName
};
};
}
});
}
// src/json-rpc-errors.ts
var SolanaJsonRpcError = class extends Error {
code;
data;
constructor(details) {

@@ -39,3 +94,3 @@ super(`JSON-RPC 2.0 error (${details.code}): ${details.message}`);

async send(options) {
const { methodName, params, responseProcessor } = pendingRequest;
const { methodName, params, responseTransformer } = pendingRequest;
const payload = createJsonRpcMessage(methodName, params);

@@ -49,3 +104,3 @@ const response = await rpcConfig.transport({

} else {
return responseProcessor ? responseProcessor(response.result) : response.result;
return responseTransformer ? responseTransformer(response.result, methodName) : response.result;
}

@@ -89,3 +144,3 @@ }

}
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseProcessor }) {
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseTransformer }) {
return {

@@ -136,3 +191,3 @@ async subscribe({ abortSignal }) {

const notification = message.params.result;
yield responseProcessor ? responseProcessor(notification) : notification;
yield responseTransformer ? responseTransformer(notification, subscribeMethodName) : notification;
}

@@ -180,2 +235,3 @@ }

var SolanaHttpError = class extends Error {
statusCode;
constructor(details) {

@@ -242,12 +298,6 @@ super(`HTTP error (${details.statusCode}): ${details.message}`);

// src/transports/http/http-transport.ts
function createHttpTransport({ httpAgentNodeOnly, headers, url }) {
function createHttpTransport({ headers, url }) {
if (__DEV__ && headers) {
assertIsAllowedHttpRequestHeaders(headers);
}
const agent = void 0;
if (__DEV__ && httpAgentNodeOnly != null) {
console.warn(
"createHttpTransport(): The `httpAgentNodeOnly` config you supplied has been ignored; HTTP agents are only usable in Node environments."
);
}
const customHeaders = headers && normalizeHeaders(headers);

@@ -260,3 +310,2 @@ return async function makeHttpRequest({

const requestInfo = {
agent,
body,

@@ -289,3 +338,3 @@ headers: {

var EXPLICIT_ABORT_TOKEN = Symbol(
__DEV__ ? "This symbol is thrown from a socket's iterator when the connection is explicity aborted by the user" : void 0
__DEV__ ? "This symbol is thrown from a socket's iterator when the connection is explicitly aborted by the user" : void 0
);

@@ -457,4 +506,4 @@ async function createWebSocketConnection({

export { createHttpTransport, createJsonRpc, createJsonSubscriptionRpc, createWebSocketTransport };
export { createHttpTransport, createJsonRpc, createJsonRpcApi, createJsonRpcSubscriptionsApi, createJsonSubscriptionRpc, createWebSocketTransport };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.browser.js.map
// ../build-scripts/env-shim.ts
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
// src/apis/methods/methods-api.ts
function createJsonRpcApi(config) {
return new Proxy({}, {
defineProperty() {
return false;
},
deleteProperty() {
return false;
},
get(...args) {
const [_, p] = args;
const methodName = p.toString();
return function(...rawParams) {
const params = config?.parametersTransformer ? config?.parametersTransformer(rawParams, methodName) : rawParams;
const responseTransformer = config?.responseTransformer ? config?.responseTransformer : (rawResponse) => rawResponse;
return {
methodName,
params,
responseTransformer
};
};
}
});
}
// src/apis/subscriptions/subscriptions-api.ts
function createJsonRpcSubscriptionsApi(config) {
return new Proxy({}, {
defineProperty() {
return false;
},
deleteProperty() {
return false;
},
get(...args) {
const [_, p] = args;
const notificationName = p.toString();
return function(...rawParams) {
const params = config?.parametersTransformer ? config?.parametersTransformer(rawParams, notificationName) : rawParams;
const responseTransformer = config?.responseTransformer ? config?.responseTransformer : (rawResponse) => rawResponse;
const subscribeMethodName = config?.subscribeNotificationNameTransformer ? config?.subscribeNotificationNameTransformer(notificationName) : notificationName;
const unsubscribeMethodName = config?.unsubscribeNotificationNameTransformer ? config?.unsubscribeNotificationNameTransformer(notificationName) : notificationName;
return {
params,
responseTransformer,
subscribeMethodName,
unsubscribeMethodName
};
};
}
});
}
// src/json-rpc-errors.ts
var SolanaJsonRpcError = class extends Error {
code;
data;
constructor(details) {

@@ -39,3 +94,3 @@ super(`JSON-RPC 2.0 error (${details.code}): ${details.message}`);

async send(options) {
const { methodName, params, responseProcessor } = pendingRequest;
const { methodName, params, responseTransformer } = pendingRequest;
const payload = createJsonRpcMessage(methodName, params);

@@ -49,3 +104,3 @@ const response = await rpcConfig.transport({

} else {
return responseProcessor ? responseProcessor(response.result) : response.result;
return responseTransformer ? responseTransformer(response.result, methodName) : response.result;
}

@@ -89,3 +144,3 @@ }

}
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseProcessor }) {
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseTransformer }) {
return {

@@ -136,3 +191,3 @@ async subscribe({ abortSignal }) {

const notification = message.params.result;
yield responseProcessor ? responseProcessor(notification) : notification;
yield responseTransformer ? responseTransformer(notification, subscribeMethodName) : notification;
}

@@ -180,2 +235,3 @@ }

var SolanaHttpError = class extends Error {
statusCode;
constructor(details) {

@@ -242,12 +298,6 @@ super(`HTTP error (${details.statusCode}): ${details.message}`);

// src/transports/http/http-transport.ts
function createHttpTransport({ httpAgentNodeOnly, headers, url }) {
function createHttpTransport({ headers, url }) {
if (__DEV__ && headers) {
assertIsAllowedHttpRequestHeaders(headers);
}
const agent = void 0;
if (__DEV__ && httpAgentNodeOnly != null) {
console.warn(
"createHttpTransport(): The `httpAgentNodeOnly` config you supplied has been ignored; HTTP agents are only usable in Node environments."
);
}
const customHeaders = headers && normalizeHeaders(headers);

@@ -260,3 +310,2 @@ return async function makeHttpRequest({

const requestInfo = {
agent,
body,

@@ -289,3 +338,3 @@ headers: {

var EXPLICIT_ABORT_TOKEN = Symbol(
__DEV__ ? "This symbol is thrown from a socket's iterator when the connection is explicity aborted by the user" : void 0
__DEV__ ? "This symbol is thrown from a socket's iterator when the connection is explicitly aborted by the user" : void 0
);

@@ -457,4 +506,4 @@ async function createWebSocketConnection({

export { createHttpTransport, createJsonRpc, createJsonSubscriptionRpc, createWebSocketTransport };
export { createHttpTransport, createJsonRpc, createJsonRpcApi, createJsonRpcSubscriptionsApi, createJsonSubscriptionRpc, createWebSocketTransport };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.native.js.map

102

dist/index.node.js

@@ -1,3 +0,2 @@

import t from 'node-fetch';
import e from 'ws';
import e2 from 'ws';

@@ -7,4 +6,59 @@ // ../build-scripts/env-shim.ts

// src/apis/methods/methods-api.ts
function createJsonRpcApi(config) {
return new Proxy({}, {
defineProperty() {
return false;
},
deleteProperty() {
return false;
},
get(...args) {
const [_, p] = args;
const methodName = p.toString();
return function(...rawParams) {
const params = config?.parametersTransformer ? config?.parametersTransformer(rawParams, methodName) : rawParams;
const responseTransformer = config?.responseTransformer ? config?.responseTransformer : (rawResponse) => rawResponse;
return {
methodName,
params,
responseTransformer
};
};
}
});
}
// src/apis/subscriptions/subscriptions-api.ts
function createJsonRpcSubscriptionsApi(config) {
return new Proxy({}, {
defineProperty() {
return false;
},
deleteProperty() {
return false;
},
get(...args) {
const [_, p] = args;
const notificationName = p.toString();
return function(...rawParams) {
const params = config?.parametersTransformer ? config?.parametersTransformer(rawParams, notificationName) : rawParams;
const responseTransformer = config?.responseTransformer ? config?.responseTransformer : (rawResponse) => rawResponse;
const subscribeMethodName = config?.subscribeNotificationNameTransformer ? config?.subscribeNotificationNameTransformer(notificationName) : notificationName;
const unsubscribeMethodName = config?.unsubscribeNotificationNameTransformer ? config?.unsubscribeNotificationNameTransformer(notificationName) : notificationName;
return {
params,
responseTransformer,
subscribeMethodName,
unsubscribeMethodName
};
};
}
});
}
// src/json-rpc-errors.ts
var SolanaJsonRpcError = class extends Error {
code;
data;
constructor(details) {

@@ -43,3 +97,3 @@ super(`JSON-RPC 2.0 error (${details.code}): ${details.message}`);

async send(options) {
const { methodName, params, responseProcessor } = pendingRequest;
const { methodName, params, responseTransformer } = pendingRequest;
const payload = createJsonRpcMessage(methodName, params);

@@ -53,3 +107,3 @@ const response = await rpcConfig.transport({

} else {
return responseProcessor ? responseProcessor(response.result) : response.result;
return responseTransformer ? responseTransformer(response.result, methodName) : response.result;
}

@@ -93,3 +147,3 @@ }

}
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseProcessor }) {
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseTransformer }) {
return {

@@ -140,3 +194,3 @@ async subscribe({ abortSignal }) {

const notification = message.params.result;
yield responseProcessor ? responseProcessor(notification) : notification;
yield responseTransformer ? responseTransformer(notification, subscribeMethodName) : notification;
}

@@ -178,6 +232,9 @@ }

}
var o = typeof globalThis.fetch == "function" ? globalThis.fetch : t;
// ../fetch-impl/dist/index.node.js
var e = globalThis.fetch;
// src/transports/http/http-transport-errors.ts
var SolanaHttpError = class extends Error {
statusCode;
constructor(details) {

@@ -244,12 +301,6 @@ super(`HTTP error (${details.statusCode}): ${details.message}`);

// src/transports/http/http-transport.ts
function createHttpTransport({ httpAgentNodeOnly, headers, url }) {
function createHttpTransport({ headers, url }) {
if (__DEV__ && headers) {
assertIsAllowedHttpRequestHeaders(headers);
}
const agent = httpAgentNodeOnly ;
if (__DEV__ && httpAgentNodeOnly != null) {
console.warn(
"createHttpTransport(): The `httpAgentNodeOnly` config you supplied has been ignored; HTTP agents are only usable in Node environments."
);
}
const customHeaders = headers && normalizeHeaders(headers);

@@ -262,3 +313,2 @@ return async function makeHttpRequest({

const requestInfo = {
agent,
body,

@@ -275,3 +325,3 @@ headers: {

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

@@ -286,7 +336,7 @@ throw new SolanaHttpError({

}
var t2 = e;
var t = e2;
// src/transports/websocket/websocket-connection.ts
var EXPLICIT_ABORT_TOKEN = Symbol(
__DEV__ ? "This symbol is thrown from a socket's iterator when the connection is explicity aborted by the user" : void 0
__DEV__ ? "This symbol is thrown from a socket's iterator when the connection is explicitly aborted by the user" : void 0
);

@@ -313,3 +363,3 @@ async function createWebSocketConnection({

errorAndClearAllIteratorStates(EXPLICIT_ABORT_TOKEN);
if (webSocket.readyState !== t2.CLOSED && webSocket.readyState !== t2.CLOSING) {
if (webSocket.readyState !== t.CLOSED && webSocket.readyState !== t.CLOSING) {
webSocket.close(1e3);

@@ -342,7 +392,7 @@ }

const message = JSON.stringify(payload);
if (!bufferDrainWatcher && webSocket.readyState === t2.OPEN && webSocket.bufferedAmount > sendBufferHighWatermark) {
if (!bufferDrainWatcher && webSocket.readyState === t.OPEN && webSocket.bufferedAmount > sendBufferHighWatermark) {
let onCancel;
const promise = new Promise((resolve2, reject2) => {
const intervalId = setInterval(() => {
if (webSocket.readyState !== t2.OPEN || !(webSocket.bufferedAmount > sendBufferHighWatermark)) {
if (webSocket.readyState !== t.OPEN || !(webSocket.bufferedAmount > sendBufferHighWatermark)) {
clearInterval(intervalId);

@@ -401,7 +451,7 @@ bufferDrainWatcher = void 0;

});
} catch (e2) {
if (e2 === EXPLICIT_ABORT_TOKEN) {
} catch (e3) {
if (e3 === EXPLICIT_ABORT_TOKEN) {
return;
} else {
throw new Error("WebSocket connection closed", { cause: e2 });
throw new Error("WebSocket connection closed", { cause: e3 });
}

@@ -429,3 +479,3 @@ }

}
const webSocket = new t2(url);
const webSocket = new t(url);
webSocket.addEventListener("close", handleClose);

@@ -462,4 +512,4 @@ webSocket.addEventListener("error", handleError);

export { createHttpTransport, createJsonRpc, createJsonSubscriptionRpc, createWebSocketTransport };
export { createHttpTransport, createJsonRpc, createJsonRpcApi, createJsonRpcSubscriptionsApi, createJsonSubscriptionRpc, createWebSocketTransport };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.node.js.map

@@ -1,5 +0,12 @@

export * from './json-rpc';
export * from './json-rpc-subscription';
export * from './transports/http/http-transport';
export * from './transports/websocket/websocket-transport';
export * from './apis/api-types.js';
export * from './apis/methods/methods-api.js';
export * from './apis/subscriptions/subscriptions-api.js';
export * from './json-rpc.js';
export type { SolanaJsonRpcErrorCode } from './json-rpc-errors.js';
export * from './json-rpc-subscription.js';
export type { IRpcApi, IRpcSubscriptionsApi, IRpcWebSocketTransport, PendingRpcSubscription, Rpc, RpcRequest, RpcSubscription, RpcSubscriptions, } from './json-rpc-types.js';
export * from './transports/http/http-transport.js';
export * from './transports/websocket/websocket-transport.js';
export type { IRpcTransport } from './transports/transport-types.js';
export * from './transports/websocket/websocket-transport.js';
//# sourceMappingURL=index.d.ts.map

@@ -1,3 +0,3 @@

import { RpcSubscriptionConfig, RpcSubscriptions } from './json-rpc-types';
import { RpcSubscriptionConfig, RpcSubscriptions } from './json-rpc-types.js';
export declare function createJsonSubscriptionRpc<TRpcSubscriptionMethods>(rpcConfig: RpcSubscriptionConfig<TRpcSubscriptionMethods>): RpcSubscriptions<TRpcSubscriptionMethods>;
//# sourceMappingURL=json-rpc-subscription.d.ts.map

@@ -1,2 +0,2 @@

import { IRpcTransport, IRpcWebSocketTransport } from './transports/transport-types';
import { IRpcTransport, IRpcWebSocketTransport } from './transports/transport-types.js';
/**

@@ -6,6 +6,6 @@ * Public RPC API.

export type IRpcApi<TRpcMethods> = {
[MethodName in keyof TRpcMethods]: TRpcMethods[MethodName] extends Callable ? (...rawParams: unknown[]) => RpcRequest<ReturnType<TRpcMethods[MethodName]>> : never;
[MethodName in keyof TRpcMethods]: RpcReturnTypeMapper<TRpcMethods[MethodName]>;
};
export type IRpcSubscriptionsApi<TRpcMethods> = {
[MethodName in keyof TRpcMethods]: TRpcMethods[MethodName] extends Callable ? (...rawParams: unknown[]) => RpcSubscription<ReturnType<TRpcMethods[MethodName]>> : never;
export type IRpcSubscriptionsApi<TRpcSubscriptionMethods> = {
[MethodName in keyof TRpcSubscriptionMethods]: RpcSubscriptionReturnTypeMapper<TRpcSubscriptionMethods[MethodName]>;
};

@@ -28,7 +28,7 @@ export type Rpc<TRpcMethods> = RpcMethods<TRpcMethods>;

params: unknown[];
responseProcessor?: (response: unknown) => TResponse;
responseTransformer?: (response: unknown, methodName: string) => TResponse;
};
export type RpcSubscription<TResponse> = {
params: unknown[];
responseProcessor?: (response: unknown) => TResponse;
responseTransformer?: (response: unknown, notificationName: string) => TResponse;
subscribeMethodName: string;

@@ -52,2 +52,4 @@ unsubscribeMethodName: string;

*/
type RpcReturnTypeMapper<TRpcMethod> = TRpcMethod extends Callable ? (...rawParams: unknown[]) => RpcRequest<ReturnType<TRpcMethod>> : never;
type RpcSubscriptionReturnTypeMapper<TRpcMethod> = TRpcMethod extends Callable ? (...rawParams: unknown[]) => RpcSubscription<ReturnType<TRpcMethod>> : never;
type RpcMethods<TRpcMethods> = {

@@ -60,7 +62,9 @@ [TMethodName in keyof TRpcMethods]: PendingRpcRequestBuilder<ApiMethodImplementations<TRpcMethods, TMethodName>>;

type ApiMethodImplementations<TRpcMethods, TMethod extends keyof TRpcMethods> = Overloads<TRpcMethods[TMethod]>;
type PendingRpcRequestReturnTypeMapper<TMethodImplementation> = TMethodImplementation extends Callable ? (...args: Parameters<TMethodImplementation>) => PendingRpcRequest<ReturnType<TMethodImplementation>> : never;
type PendingRpcRequestBuilder<TMethodImplementations> = UnionToIntersection<Flatten<{
[P in keyof TMethodImplementations]: TMethodImplementations[P] extends Callable ? (...args: Parameters<TMethodImplementations[P]>) => PendingRpcRequest<ReturnType<TMethodImplementations[P]>> : never;
[P in keyof TMethodImplementations]: PendingRpcRequestReturnTypeMapper<TMethodImplementations[P]>;
}>>;
type PendingRpcSubscriptionReturnTypeMapper<TSubscriptionMethodImplementation> = TSubscriptionMethodImplementation extends Callable ? (...args: Parameters<TSubscriptionMethodImplementation>) => PendingRpcSubscription<ReturnType<TSubscriptionMethodImplementation>> : never;
type PendingRpcSubscriptionBuilder<TSubscriptionMethodImplementations> = UnionToIntersection<Flatten<{
[P in keyof TSubscriptionMethodImplementations]: TSubscriptionMethodImplementations[P] extends Callable ? (...args: Parameters<TSubscriptionMethodImplementations[P]>) => PendingRpcSubscription<ReturnType<TSubscriptionMethodImplementations[P]>> : never;
[P in keyof TSubscriptionMethodImplementations]: PendingRpcSubscriptionReturnTypeMapper<TSubscriptionMethodImplementations[P]>;
}>>;

@@ -72,3 +76,4 @@ /**

type Flatten<T> = T extends (infer Item)[] ? Item : never;
type Overloads<T> = T extends {
type Overloads<T> = Overloads24<T>;
type Overloads24<T> = T extends {
(...args: infer A1): infer R1;

@@ -123,3 +128,4 @@ (...args: infer A2): infer R2;

(...args: A24) => R24
] : T extends {
] : Overloads23<T>;
type Overloads23<T> = T extends {
(...args: infer A1): infer R1;

@@ -172,3 +178,4 @@ (...args: infer A2): infer R2;

(...args: A23) => R23
] : T extends {
] : Overloads22<T>;
type Overloads22<T> = T extends {
(...args: infer A1): infer R1;

@@ -219,3 +226,4 @@ (...args: infer A2): infer R2;

(...args: A22) => R22
] : T extends {
] : Overloads21<T>;
type Overloads21<T> = T extends {
(...args: infer A1): infer R1;

@@ -264,3 +272,4 @@ (...args: infer A2): infer R2;

(...args: A21) => R21
] : T extends {
] : Overloads20<T>;
type Overloads20<T> = T extends {
(...args: infer A1): infer R1;

@@ -307,3 +316,4 @@ (...args: infer A2): infer R2;

(...args: A20) => R20
] : T extends {
] : Overloads19<T>;
type Overloads19<T> = T extends {
(...args: infer A1): infer R1;

@@ -348,3 +358,4 @@ (...args: infer A2): infer R2;

(...args: A19) => R19
] : T extends {
] : Overloads18<T>;
type Overloads18<T> = T extends {
(...args: infer A1): infer R1;

@@ -387,3 +398,4 @@ (...args: infer A2): infer R2;

(...args: A18) => R18
] : T extends {
] : Overloads17<T>;
type Overloads17<T> = T extends {
(...args: infer A1): infer R1;

@@ -424,3 +436,4 @@ (...args: infer A2): infer R2;

(...args: A17) => R17
] : T extends {
] : Overloads16<T>;
type Overloads16<T> = T extends {
(...args: infer A1): infer R1;

@@ -459,3 +472,4 @@ (...args: infer A2): infer R2;

(...args: A16) => R16
] : T extends {
] : Overloads15<T>;
type Overloads15<T> = T extends {
(...args: infer A1): infer R1;

@@ -492,3 +506,4 @@ (...args: infer A2): infer R2;

(...args: A15) => R15
] : T extends {
] : Overloads14<T>;
type Overloads14<T> = T extends {
(...args: infer A1): infer R1;

@@ -523,3 +538,4 @@ (...args: infer A2): infer R2;

(...args: A14) => R14
] : T extends {
] : Overloads13<T>;
type Overloads13<T> = T extends {
(...args: infer A1): infer R1;

@@ -552,3 +568,4 @@ (...args: infer A2): infer R2;

(...args: A13) => R13
] : T extends {
] : Overloads12<T>;
type Overloads12<T> = T extends {
(...args: infer A1): infer R1;

@@ -579,3 +596,4 @@ (...args: infer A2): infer R2;

(...args: A12) => R12
] : T extends {
] : Overloads11<T>;
type Overloads11<T> = T extends {
(...args: infer A1): infer R1;

@@ -604,3 +622,4 @@ (...args: infer A2): infer R2;

(...args: A11) => R11
] : T extends {
] : Overloads10<T>;
type Overloads10<T> = T extends {
(...args: infer A1): infer R1;

@@ -627,3 +646,4 @@ (...args: infer A2): infer R2;

(...args: A10) => R10
] : T extends {
] : Overloads9<T>;
type Overloads9<T> = T extends {
(...args: infer A1): infer R1;

@@ -648,3 +668,4 @@ (...args: infer A2): infer R2;

(...args: A9) => R9
] : T extends {
] : Overloads8<T>;
type Overloads8<T> = T extends {
(...args: infer A1): infer R1;

@@ -667,3 +688,4 @@ (...args: infer A2): infer R2;

(...args: A8) => R8
] : T extends {
] : Overloads7<T>;
type Overloads7<T> = T extends {
(...args: infer A1): infer R1;

@@ -684,3 +706,4 @@ (...args: infer A2): infer R2;

(...args: A7) => R7
] : T extends {
] : Overloads6<T>;
type Overloads6<T> = T extends {
(...args: infer A1): infer R1;

@@ -699,3 +722,4 @@ (...args: infer A2): infer R2;

(...args: A6) => R6
] : T extends {
] : Overloads5<T>;
type Overloads5<T> = T extends {
(...args: infer A1): infer R1;

@@ -706,3 +730,4 @@ (...args: infer A2): infer R2;

(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T extends {
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : Overloads4<T>;
type Overloads4<T> = T extends {
(...args: infer A1): infer R1;

@@ -712,14 +737,17 @@ (...args: infer A2): infer R2;

(...args: infer A4): infer R4;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4] : T extends {
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4] : Overloads3<T>;
type Overloads3<T> = T extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3] : T extends {
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3] : Overloads2<T>;
type Overloads2<T> = T extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
} ? [(...args: A1) => R1, (...args: A2) => R2] : T extends {
} ? [(...args: A1) => R1, (...args: A2) => R2] : Overloads1<T>;
type Overloads1<T> = T extends {
(...args: infer A1): infer R1;
} ? [(...args: A1) => R1] : unknown;
type UnionToIntersection<T> = (T extends unknown ? (x: T) => unknown : never) extends (x: infer R) => unknown ? R : never;
export {};
export type { IRpcWebSocketTransport };
//# sourceMappingURL=json-rpc-types.d.ts.map

@@ -1,2 +0,2 @@

import { Rpc, RpcConfig } from './json-rpc-types';
import { Rpc, RpcConfig } from './json-rpc-types.js';
interface IHasIdentifier {

@@ -3,0 +3,0 @@ readonly id: number;

@@ -1,14 +0,9 @@

/// <reference types="node" />
/// <reference types="node" />
import type { Agent as NodeHttpAgent } from 'node:http';
import type { Agent as NodeHttpsAgent } from 'node:https';
import { IRpcTransport } from '../transport-types';
import { AllowedHttpRequestHeaders } from './http-transport-headers';
import { IRpcTransport } from '../transport-types.js';
import { AllowedHttpRequestHeaders } from './http-transport-headers.js';
type Config = Readonly<{
headers?: AllowedHttpRequestHeaders;
httpAgentNodeOnly?: NodeHttpAgent | NodeHttpsAgent | ((parsedUrl: URL) => NodeHttpAgent | NodeHttpsAgent);
url: string;
}>;
export declare function createHttpTransport({ httpAgentNodeOnly, headers, url }: Config): IRpcTransport;
export declare function createHttpTransport({ headers, url }: Config): IRpcTransport;
export {};
//# sourceMappingURL=http-transport.d.ts.map

@@ -1,2 +0,2 @@

import { RpcWebSocketConnection } from './websocket/websocket-connection';
import { RpcWebSocketConnection } from './websocket/websocket-connection.js';
type RpcTransportConfig = Readonly<{

@@ -3,0 +3,0 @@ payload: unknown;

@@ -1,2 +0,2 @@

import { IRpcWebSocketTransport } from '../transport-types';
import { IRpcWebSocketTransport } from '../transport-types.js';
type Config = Readonly<{

@@ -3,0 +3,0 @@ sendBufferHighWatermark: number;

{
"name": "@solana/rpc-transport",
"version": "2.0.0-experimental.db42a99",
"version": "2.0.0-experimental.dbe6a73",
"description": "Network transports for accessing the Solana JSON RPC API",

@@ -50,20 +50,20 @@ "exports": {

"@solana/eslint-config-solana": "^1.0.2",
"@swc/jest": "^0.2.28",
"@types/jest": "^29.5.5",
"@types/node": "^20",
"@typescript-eslint/eslint-plugin": "^6.7.0",
"@swc/jest": "^0.2.29",
"@types/jest": "^29.5.11",
"@types/node": "18.11.19",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.3.0",
"agadoo": "^3.0.0",
"eslint": "^8.45.0",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jest": "^27.4.2",
"eslint-plugin-sort-keys-fix": "^1.1.2",
"fast-stable-stringify": "^1.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.6.4",
"jest-environment-jsdom": "^29.7.0",
"jest-fetch-mock-fork": "^3.0.4",
"jest-runner-eslint": "^2.1.0",
"jest-runner-eslint": "^2.1.2",
"jest-runner-prettier": "^1.0.0",
"jest-websocket-mock": "^2.4.1",
"prettier": "^2.8",
"tsup": "7.2.0",
"jest-websocket-mock": "^2.5.0",
"prettier": "^3.1",
"tsup": "^8.0.1",
"typescript": "^5.2.2",

@@ -78,3 +78,2 @@ "version-from-git": "^1.1.1",

"peerDependencies": {
"node-fetch": "^2.6.7",
"ws": "^8.14.0"

@@ -92,6 +91,6 @@ },

"compile:js": "tsup --config build-scripts/tsup.config.package.ts",
"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/build-scripts/add-js-extension-to-types.mjs",
"dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
"publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/*",
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",
"test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",

@@ -98,0 +97,0 @@ "test:prettier": "jest -c node_modules/test-config/jest-prettier.config.ts --rootDir . --silent",

@@ -58,3 +58,3 @@ [![npm][npm-image]][npm-url]

// Provide an optional function to modify the response.
responseProcessor: response => ({
responseTransformer: response => ({
confirmedBlocks: response,

@@ -61,0 +61,0 @@ queryRange: [startSlot, endSlot],

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