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

@solana/rpc-transport

Package Overview
Dependencies
Maintainers
13
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.732dc1e to 2.0.0-experimental.73932e0

189

dist/index.browser.js

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

import 'node-fetch';
// ../fetch-impl-browser/dist/index.browser.js
var { fetch } = globalThis;
var src_default = fetch;
// src/http-request-errors.ts

@@ -18,3 +12,8 @@ var SolanaHttpError = class extends Error {

};
async function makeHttpRequest({ payload, url }) {
// ../fetch-impl/dist/index.browser.js
var e = globalThis.fetch;
// src/http-request.ts
async function makeHttpRequest({ abortSignal, payload, url }) {
const requestInfo = {

@@ -25,8 +24,6 @@ body: JSON.stringify(payload),

},
method: "POST"
method: "POST",
signal: abortSignal
};
let response;
{
response = await src_default(url, requestInfo);
}
const response = await e(url, requestInfo);
if (!response.ok) {

@@ -72,90 +69,46 @@ throw new SolanaHttpError({

// src/params-patcher.ts
function visitNode(value, keyPath, onIntegerOverflow) {
if (Array.isArray(value)) {
return value.map(
(element, ii) => visitNode(element, [...keyPath, ii], onIntegerOverflow)
);
} else if (typeof value === "object" && value !== null) {
const out = {};
for (const propName in value) {
if (Object.prototype.hasOwnProperty.call(value, propName)) {
out[propName] = visitNode(value[propName], [...keyPath, propName], onIntegerOverflow);
// src/json-rpc-transport/index.ts
function createArmedJsonRpcTransport(transportConfig, pendingRequest) {
const overrides = {
async send(options) {
const { methodName, params, responseProcessor } = pendingRequest;
const payload = createJsonRpcMessage(methodName, params);
const response = await makeHttpRequest({
abortSignal: options?.abortSignal,
payload,
url: transportConfig.url
});
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
return responseProcessor ? responseProcessor(response.result) : response.result;
}
}
return out;
} else if (typeof value === "bigint") {
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) {
onIntegerOverflow(keyPath, value);
}
return Number(value);
} else {
return value;
}
}
function patchParamsForSolanaLabsRpc(params, onIntegerOverflow) {
return visitNode(params, [], onIntegerOverflow);
}
// src/response-patcher-types.ts
var KEYPATH_WILDCARD = {};
// src/response-patcher-allowed-numeric-values.ts
var ALLOWED_NUMERIC_KEYPATHS = {
getInflationReward: [[KEYPATH_WILDCARD, "commission"]]
};
// src/response-patcher.ts
function getNextAllowedKeypaths(keyPaths, property) {
return keyPaths.filter((keyPath) => keyPath[0] === KEYPATH_WILDCARD && typeof property === "number" || keyPath[0] === property).map((keyPath) => keyPath.slice(1));
}
function visitNode2(value, allowedKeypaths) {
if (Array.isArray(value)) {
return value.map((element, ii) => {
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, ii);
return visitNode2(element, nextAllowedKeypaths);
});
} else if (typeof value === "object" && value !== null) {
const out = {};
for (const propName in value) {
if (Object.prototype.hasOwnProperty.call(value, propName)) {
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, propName);
out[propName] = visitNode2(value[propName], nextAllowedKeypaths);
}
}
return out;
} else if (typeof value === "number" && // The presence of an allowed keypath on the route to this value implies it's allowlisted;
// Upcast the value to `bigint` unless an allowed keypath is present.
allowedKeypaths.length === 0) {
return BigInt(value);
} else {
return value;
}
}
function patchResponseForSolanaLabsRpc(response, methodName) {
return visitNode2(response, (methodName && ALLOWED_NUMERIC_KEYPATHS[methodName]) ?? []);
}
// src/json-rpc-transport/index.ts
function createArmedJsonRpcTransport(transportConfig, pendingMessage) {
const { url } = transportConfig;
const transport = {
async send() {
return await sendPayload(pendingMessage, url);
}
};
return makeProxy(transport, transportConfig, pendingMessage);
return makeProxy(transportConfig, overrides, pendingRequest);
}
function createArmedBatchJsonRpcTransport(transportConfig, pendingMessages) {
const { url } = transportConfig;
const transport = {
async sendBatch() {
return await sendPayload(pendingMessages, url);
function createArmedBatchJsonRpcTransport(transportConfig, pendingRequests) {
const overrides = {
async sendBatch(options) {
const payload = pendingRequests.map(({ methodName, params }) => createJsonRpcMessage(methodName, params));
const responses = await makeHttpRequest({
abortSignal: options?.abortSignal,
payload,
url: transportConfig.url
});
const requestOrder = payload.map((p) => p.id);
return responses.sort((a, b) => requestOrder.indexOf(a.id) - requestOrder.indexOf(b.id)).map((response, ii) => {
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
const { responseProcessor } = pendingRequests[ii];
return responseProcessor ? responseProcessor(response.result) : response.result;
}
});
}
};
return makeProxy(transport, transportConfig, pendingMessages);
return makeProxy(transportConfig, overrides, pendingRequests);
}
function makeProxy(transport, transportConfig, pendingRequestOrRequests) {
const { onIntegerOverflow } = transportConfig;
return new Proxy(transport, {
function makeProxy(transportConfig, overrides, pendingRequestOrRequests) {
return new Proxy(transportConfig.api, {
defineProperty() {

@@ -167,18 +120,15 @@ return false;

},
get(...args) {
const [target, p] = args;
return p in target ? Reflect.get(...args) : function(...params) {
get(target, p, receiver) {
if (overrides && Reflect.has(overrides, p)) {
return Reflect.get(overrides, p, receiver);
}
return function(...rawParams) {
const methodName = p.toString();
const patchedParams = patchParamsForSolanaLabsRpc(
params,
onIntegerOverflow ? (keyPath, value) => {
onIntegerOverflow(methodName, keyPath, value);
} : void 0
);
const newMessage = createJsonRpcMessage(methodName, patchedParams);
const createTransportRequest = Reflect.get(target, methodName, receiver);
const newRequest = createTransportRequest ? createTransportRequest(...rawParams) : { methodName, params: rawParams };
if (pendingRequestOrRequests == null) {
return createArmedJsonRpcTransport(transportConfig, newMessage);
return createArmedJsonRpcTransport(transportConfig, newRequest);
} else {
const nextPendingMessages = Array.isArray(pendingRequestOrRequests) ? [...pendingRequestOrRequests, newMessage] : [pendingRequestOrRequests, newMessage];
return createArmedBatchJsonRpcTransport(transportConfig, nextPendingMessages);
const nextPendingRequests = Array.isArray(pendingRequestOrRequests) ? [...pendingRequestOrRequests, newRequest] : [pendingRequestOrRequests, newRequest];
return createArmedBatchJsonRpcTransport(transportConfig, nextPendingRequests);
}

@@ -189,29 +139,4 @@ };

}
function processResponse(response, methodName) {
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
const patchedResponse = patchResponseForSolanaLabsRpc(
response.result,
methodName
// FIXME: Untangle these types by moving the patcher into `rpc-core`
);
return patchedResponse;
}
}
async function sendPayload(payload, url) {
const responseOrResponses = await makeHttpRequest({
payload,
url
});
if (Array.isArray(responseOrResponses)) {
const requestOrder = payload.map((p) => p.id);
return responseOrResponses.sort((a, b) => requestOrder.indexOf(a.id) - requestOrder.indexOf(b.id)).map((response, ii) => processResponse(response, payload[ii].method));
} else {
return processResponse(responseOrResponses, payload.method);
}
}
function createJsonRpcTransport(transportConfig) {
const transport = {};
return makeProxy(transport, transportConfig);
return makeProxy(transportConfig);
}

@@ -218,0 +143,0 @@

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

import 'node-fetch';
// ../fetch-impl-browser/dist/index.browser.js
var { fetch } = globalThis;
var src_default = fetch;
// src/http-request-errors.ts

@@ -18,3 +12,8 @@ var SolanaHttpError = class extends Error {

};
async function makeHttpRequest({ payload, url }) {
// ../fetch-impl/dist/index.browser.js
var e = globalThis.fetch;
// src/http-request.ts
async function makeHttpRequest({ abortSignal, payload, url }) {
const requestInfo = {

@@ -25,8 +24,6 @@ body: JSON.stringify(payload),

},
method: "POST"
method: "POST",
signal: abortSignal
};
let response;
{
response = await src_default(url, requestInfo);
}
const response = await e(url, requestInfo);
if (!response.ok) {

@@ -72,90 +69,46 @@ throw new SolanaHttpError({

// src/params-patcher.ts
function visitNode(value, keyPath, onIntegerOverflow) {
if (Array.isArray(value)) {
return value.map(
(element, ii) => visitNode(element, [...keyPath, ii], onIntegerOverflow)
);
} else if (typeof value === "object" && value !== null) {
const out = {};
for (const propName in value) {
if (Object.prototype.hasOwnProperty.call(value, propName)) {
out[propName] = visitNode(value[propName], [...keyPath, propName], onIntegerOverflow);
// src/json-rpc-transport/index.ts
function createArmedJsonRpcTransport(transportConfig, pendingRequest) {
const overrides = {
async send(options) {
const { methodName, params, responseProcessor } = pendingRequest;
const payload = createJsonRpcMessage(methodName, params);
const response = await makeHttpRequest({
abortSignal: options?.abortSignal,
payload,
url: transportConfig.url
});
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
return responseProcessor ? responseProcessor(response.result) : response.result;
}
}
return out;
} else if (typeof value === "bigint") {
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) {
onIntegerOverflow(keyPath, value);
}
return Number(value);
} else {
return value;
}
}
function patchParamsForSolanaLabsRpc(params, onIntegerOverflow) {
return visitNode(params, [], onIntegerOverflow);
}
// src/response-patcher-types.ts
var KEYPATH_WILDCARD = {};
// src/response-patcher-allowed-numeric-values.ts
var ALLOWED_NUMERIC_KEYPATHS = {
getInflationReward: [[KEYPATH_WILDCARD, "commission"]]
};
// src/response-patcher.ts
function getNextAllowedKeypaths(keyPaths, property) {
return keyPaths.filter((keyPath) => keyPath[0] === KEYPATH_WILDCARD && typeof property === "number" || keyPath[0] === property).map((keyPath) => keyPath.slice(1));
}
function visitNode2(value, allowedKeypaths) {
if (Array.isArray(value)) {
return value.map((element, ii) => {
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, ii);
return visitNode2(element, nextAllowedKeypaths);
});
} else if (typeof value === "object" && value !== null) {
const out = {};
for (const propName in value) {
if (Object.prototype.hasOwnProperty.call(value, propName)) {
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, propName);
out[propName] = visitNode2(value[propName], nextAllowedKeypaths);
}
}
return out;
} else if (typeof value === "number" && // The presence of an allowed keypath on the route to this value implies it's allowlisted;
// Upcast the value to `bigint` unless an allowed keypath is present.
allowedKeypaths.length === 0) {
return BigInt(value);
} else {
return value;
}
}
function patchResponseForSolanaLabsRpc(response, methodName) {
return visitNode2(response, (methodName && ALLOWED_NUMERIC_KEYPATHS[methodName]) ?? []);
}
// src/json-rpc-transport/index.ts
function createArmedJsonRpcTransport(transportConfig, pendingMessage) {
const { url } = transportConfig;
const transport = {
async send() {
return await sendPayload(pendingMessage, url);
}
};
return makeProxy(transport, transportConfig, pendingMessage);
return makeProxy(transportConfig, overrides, pendingRequest);
}
function createArmedBatchJsonRpcTransport(transportConfig, pendingMessages) {
const { url } = transportConfig;
const transport = {
async sendBatch() {
return await sendPayload(pendingMessages, url);
function createArmedBatchJsonRpcTransport(transportConfig, pendingRequests) {
const overrides = {
async sendBatch(options) {
const payload = pendingRequests.map(({ methodName, params }) => createJsonRpcMessage(methodName, params));
const responses = await makeHttpRequest({
abortSignal: options?.abortSignal,
payload,
url: transportConfig.url
});
const requestOrder = payload.map((p) => p.id);
return responses.sort((a, b) => requestOrder.indexOf(a.id) - requestOrder.indexOf(b.id)).map((response, ii) => {
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
const { responseProcessor } = pendingRequests[ii];
return responseProcessor ? responseProcessor(response.result) : response.result;
}
});
}
};
return makeProxy(transport, transportConfig, pendingMessages);
return makeProxy(transportConfig, overrides, pendingRequests);
}
function makeProxy(transport, transportConfig, pendingRequestOrRequests) {
const { onIntegerOverflow } = transportConfig;
return new Proxy(transport, {
function makeProxy(transportConfig, overrides, pendingRequestOrRequests) {
return new Proxy(transportConfig.api, {
defineProperty() {

@@ -167,18 +120,15 @@ return false;

},
get(...args) {
const [target, p] = args;
return p in target ? Reflect.get(...args) : function(...params) {
get(target, p, receiver) {
if (overrides && Reflect.has(overrides, p)) {
return Reflect.get(overrides, p, receiver);
}
return function(...rawParams) {
const methodName = p.toString();
const patchedParams = patchParamsForSolanaLabsRpc(
params,
onIntegerOverflow ? (keyPath, value) => {
onIntegerOverflow(methodName, keyPath, value);
} : void 0
);
const newMessage = createJsonRpcMessage(methodName, patchedParams);
const createTransportRequest = Reflect.get(target, methodName, receiver);
const newRequest = createTransportRequest ? createTransportRequest(...rawParams) : { methodName, params: rawParams };
if (pendingRequestOrRequests == null) {
return createArmedJsonRpcTransport(transportConfig, newMessage);
return createArmedJsonRpcTransport(transportConfig, newRequest);
} else {
const nextPendingMessages = Array.isArray(pendingRequestOrRequests) ? [...pendingRequestOrRequests, newMessage] : [pendingRequestOrRequests, newMessage];
return createArmedBatchJsonRpcTransport(transportConfig, nextPendingMessages);
const nextPendingRequests = Array.isArray(pendingRequestOrRequests) ? [...pendingRequestOrRequests, newRequest] : [pendingRequestOrRequests, newRequest];
return createArmedBatchJsonRpcTransport(transportConfig, nextPendingRequests);
}

@@ -189,29 +139,4 @@ };

}
function processResponse(response, methodName) {
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
const patchedResponse = patchResponseForSolanaLabsRpc(
response.result,
methodName
// FIXME: Untangle these types by moving the patcher into `rpc-core`
);
return patchedResponse;
}
}
async function sendPayload(payload, url) {
const responseOrResponses = await makeHttpRequest({
payload,
url
});
if (Array.isArray(responseOrResponses)) {
const requestOrder = payload.map((p) => p.id);
return responseOrResponses.sort((a, b) => requestOrder.indexOf(a.id) - requestOrder.indexOf(b.id)).map((response, ii) => processResponse(response, payload[ii].method));
} else {
return processResponse(responseOrResponses, payload.method);
}
}
function createJsonRpcTransport(transportConfig) {
const transport = {};
return makeProxy(transport, transportConfig);
return makeProxy(transportConfig);
}

@@ -218,0 +143,0 @@

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

import fetchImplNode from 'node-fetch';
import t from 'node-fetch';

@@ -14,3 +14,6 @@ // src/http-request-errors.ts

};
async function makeHttpRequest({ payload, url }) {
var f = t;
// src/http-request.ts
async function makeHttpRequest({ abortSignal, payload, url }) {
const requestInfo = {

@@ -21,8 +24,6 @@ body: JSON.stringify(payload),

},
method: "POST"
method: "POST",
signal: abortSignal
};
let response;
{
response = await fetchImplNode(url, requestInfo);
}
const response = await f(url, requestInfo);
if (!response.ok) {

@@ -68,90 +69,46 @@ throw new SolanaHttpError({

// src/params-patcher.ts
function visitNode(value, keyPath, onIntegerOverflow) {
if (Array.isArray(value)) {
return value.map(
(element, ii) => visitNode(element, [...keyPath, ii], onIntegerOverflow)
);
} else if (typeof value === "object" && value !== null) {
const out = {};
for (const propName in value) {
if (Object.prototype.hasOwnProperty.call(value, propName)) {
out[propName] = visitNode(value[propName], [...keyPath, propName], onIntegerOverflow);
// src/json-rpc-transport/index.ts
function createArmedJsonRpcTransport(transportConfig, pendingRequest) {
const overrides = {
async send(options) {
const { methodName, params, responseProcessor } = pendingRequest;
const payload = createJsonRpcMessage(methodName, params);
const response = await makeHttpRequest({
abortSignal: options?.abortSignal,
payload,
url: transportConfig.url
});
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
return responseProcessor ? responseProcessor(response.result) : response.result;
}
}
return out;
} else if (typeof value === "bigint") {
if (onIntegerOverflow && (value > Number.MAX_SAFE_INTEGER || value < -Number.MAX_SAFE_INTEGER)) {
onIntegerOverflow(keyPath, value);
}
return Number(value);
} else {
return value;
}
}
function patchParamsForSolanaLabsRpc(params, onIntegerOverflow) {
return visitNode(params, [], onIntegerOverflow);
}
// src/response-patcher-types.ts
var KEYPATH_WILDCARD = {};
// src/response-patcher-allowed-numeric-values.ts
var ALLOWED_NUMERIC_KEYPATHS = {
getInflationReward: [[KEYPATH_WILDCARD, "commission"]]
};
// src/response-patcher.ts
function getNextAllowedKeypaths(keyPaths, property) {
return keyPaths.filter((keyPath) => keyPath[0] === KEYPATH_WILDCARD && typeof property === "number" || keyPath[0] === property).map((keyPath) => keyPath.slice(1));
}
function visitNode2(value, allowedKeypaths) {
if (Array.isArray(value)) {
return value.map((element, ii) => {
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, ii);
return visitNode2(element, nextAllowedKeypaths);
});
} else if (typeof value === "object" && value !== null) {
const out = {};
for (const propName in value) {
if (Object.prototype.hasOwnProperty.call(value, propName)) {
const nextAllowedKeypaths = getNextAllowedKeypaths(allowedKeypaths, propName);
out[propName] = visitNode2(value[propName], nextAllowedKeypaths);
}
}
return out;
} else if (typeof value === "number" && // The presence of an allowed keypath on the route to this value implies it's allowlisted;
// Upcast the value to `bigint` unless an allowed keypath is present.
allowedKeypaths.length === 0) {
return BigInt(value);
} else {
return value;
}
}
function patchResponseForSolanaLabsRpc(response, methodName) {
return visitNode2(response, (methodName && ALLOWED_NUMERIC_KEYPATHS[methodName]) ?? []);
}
// src/json-rpc-transport/index.ts
function createArmedJsonRpcTransport(transportConfig, pendingMessage) {
const { url } = transportConfig;
const transport = {
async send() {
return await sendPayload(pendingMessage, url);
}
};
return makeProxy(transport, transportConfig, pendingMessage);
return makeProxy(transportConfig, overrides, pendingRequest);
}
function createArmedBatchJsonRpcTransport(transportConfig, pendingMessages) {
const { url } = transportConfig;
const transport = {
async sendBatch() {
return await sendPayload(pendingMessages, url);
function createArmedBatchJsonRpcTransport(transportConfig, pendingRequests) {
const overrides = {
async sendBatch(options) {
const payload = pendingRequests.map(({ methodName, params }) => createJsonRpcMessage(methodName, params));
const responses = await makeHttpRequest({
abortSignal: options?.abortSignal,
payload,
url: transportConfig.url
});
const requestOrder = payload.map((p) => p.id);
return responses.sort((a, b) => requestOrder.indexOf(a.id) - requestOrder.indexOf(b.id)).map((response, ii) => {
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
const { responseProcessor } = pendingRequests[ii];
return responseProcessor ? responseProcessor(response.result) : response.result;
}
});
}
};
return makeProxy(transport, transportConfig, pendingMessages);
return makeProxy(transportConfig, overrides, pendingRequests);
}
function makeProxy(transport, transportConfig, pendingRequestOrRequests) {
const { onIntegerOverflow } = transportConfig;
return new Proxy(transport, {
function makeProxy(transportConfig, overrides, pendingRequestOrRequests) {
return new Proxy(transportConfig.api, {
defineProperty() {

@@ -163,18 +120,15 @@ return false;

},
get(...args) {
const [target, p] = args;
return p in target ? Reflect.get(...args) : function(...params) {
get(target, p, receiver) {
if (overrides && Reflect.has(overrides, p)) {
return Reflect.get(overrides, p, receiver);
}
return function(...rawParams) {
const methodName = p.toString();
const patchedParams = patchParamsForSolanaLabsRpc(
params,
onIntegerOverflow ? (keyPath, value) => {
onIntegerOverflow(methodName, keyPath, value);
} : void 0
);
const newMessage = createJsonRpcMessage(methodName, patchedParams);
const createTransportRequest = Reflect.get(target, methodName, receiver);
const newRequest = createTransportRequest ? createTransportRequest(...rawParams) : { methodName, params: rawParams };
if (pendingRequestOrRequests == null) {
return createArmedJsonRpcTransport(transportConfig, newMessage);
return createArmedJsonRpcTransport(transportConfig, newRequest);
} else {
const nextPendingMessages = Array.isArray(pendingRequestOrRequests) ? [...pendingRequestOrRequests, newMessage] : [pendingRequestOrRequests, newMessage];
return createArmedBatchJsonRpcTransport(transportConfig, nextPendingMessages);
const nextPendingRequests = Array.isArray(pendingRequestOrRequests) ? [...pendingRequestOrRequests, newRequest] : [pendingRequestOrRequests, newRequest];
return createArmedBatchJsonRpcTransport(transportConfig, nextPendingRequests);
}

@@ -185,29 +139,4 @@ };

}
function processResponse(response, methodName) {
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
const patchedResponse = patchResponseForSolanaLabsRpc(
response.result,
methodName
// FIXME: Untangle these types by moving the patcher into `rpc-core`
);
return patchedResponse;
}
}
async function sendPayload(payload, url) {
const responseOrResponses = await makeHttpRequest({
payload,
url
});
if (Array.isArray(responseOrResponses)) {
const requestOrder = payload.map((p) => p.id);
return responseOrResponses.sort((a, b) => requestOrder.indexOf(a.id) - requestOrder.indexOf(b.id)).map((response, ii) => processResponse(response, payload[ii].method));
} else {
return processResponse(responseOrResponses, payload.method);
}
}
function createJsonRpcTransport(transportConfig) {
const transport = {};
return makeProxy(transport, transportConfig);
return makeProxy(transportConfig);
}

@@ -214,0 +143,0 @@

type Config = Readonly<{
abortSignal?: AbortSignal;
payload: unknown;
url: string;
}>;
export declare function makeHttpRequest<TResponse>({ payload, url }: Config): Promise<TResponse>;
export declare function makeHttpRequest<TResponse>({ abortSignal, payload, url }: Config): Promise<TResponse>;
export {};
//# sourceMappingURL=http-request.d.ts.map

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

import { ArmedTransport } from './json-rpc-transport-types';
type TransportConfig = Readonly<{
onIntegerOverflow?: (method: string, keyPath: (number | string)[], value: bigint) => void;
url: string;
}>;
export declare function createJsonRpcTransport<TRpcApi extends object>(transportConfig: TransportConfig): { [TMethodName in keyof TRpcApi]: ((((TRpcApi[TMethodName] extends infer T_1 ? T_1 extends TRpcApi[TMethodName] ? T_1 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_1 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_1 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_1 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_1 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never) extends infer T ? { [P in keyof T]: (TRpcApi[TMethodName] extends infer T_1 ? T_1 extends TRpcApi[TMethodName] ? T_1 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_1 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_1 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_1 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_1 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P] extends (...args: any[]) => any ? (...args: Parameters<(TRpcApi[TMethodName] extends infer T_2 ? T_2 extends TRpcApi[TMethodName] ? T_2 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_2 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_2 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_2 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_2 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P]>) => ArmedTransport<TRpcApi, ReturnType<(TRpcApi[TMethodName] extends infer T_2 ? T_2 extends TRpcApi[TMethodName] ? T_2 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_2 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_2 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_2 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_2 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P]>> : never; } : never) extends infer T_3 ? T_3 extends ((TRpcApi[TMethodName] extends infer T_1 ? T_1 extends TRpcApi[TMethodName] ? T_1 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_1 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_1 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_1 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_1 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never) extends infer T ? { [P in keyof T]: (TRpcApi[TMethodName] extends infer T_1 ? T_1 extends TRpcApi[TMethodName] ? T_1 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_1 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_1 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_1 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_1 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P] extends (...args: any[]) => any ? (...args: Parameters<(TRpcApi[TMethodName] extends infer T_2 ? T_2 extends TRpcApi[TMethodName] ? T_2 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_2 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_2 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_2 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_2 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P]>) => ArmedTransport<TRpcApi, ReturnType<(TRpcApi[TMethodName] extends infer T_2 ? T_2 extends TRpcApi[TMethodName] ? T_2 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_2 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_2 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_2 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_2 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P]>> : never; } : never) ? T_3 extends (infer Item)[] ? Item : never : never : never) extends infer T_4 ? T_4 extends (((TRpcApi[TMethodName] extends infer T_1 ? T_1 extends TRpcApi[TMethodName] ? T_1 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_1 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_1 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_1 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_1 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never) extends infer T ? { [P in keyof T]: (TRpcApi[TMethodName] extends infer T_1 ? T_1 extends TRpcApi[TMethodName] ? T_1 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_1 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_1 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_1 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_1 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P] extends (...args: any[]) => any ? (...args: Parameters<(TRpcApi[TMethodName] extends infer T_2 ? T_2 extends TRpcApi[TMethodName] ? T_2 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_2 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_2 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_2 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_2 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P]>) => ArmedTransport<TRpcApi, ReturnType<(TRpcApi[TMethodName] extends infer T_2 ? T_2 extends TRpcApi[TMethodName] ? T_2 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_2 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_2 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_2 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_2 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P]>> : never; } : never) extends infer T_3 ? T_3 extends ((TRpcApi[TMethodName] extends infer T_1 ? T_1 extends TRpcApi[TMethodName] ? T_1 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_1 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_1 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_1 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_1 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never) extends infer T ? { [P in keyof T]: (TRpcApi[TMethodName] extends infer T_1 ? T_1 extends TRpcApi[TMethodName] ? T_1 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_1 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_1 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_1 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_1 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P] extends (...args: any[]) => any ? (...args: Parameters<(TRpcApi[TMethodName] extends infer T_2 ? T_2 extends TRpcApi[TMethodName] ? T_2 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_2 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_2 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_2 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_2 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P]>) => ArmedTransport<TRpcApi, ReturnType<(TRpcApi[TMethodName] extends infer T_2 ? T_2 extends TRpcApi[TMethodName] ? T_2 extends {
(...args: infer A1): infer R1;
(...args: infer A2): infer R2;
(...args: infer A3): infer R3;
(...args: infer A4): infer R4;
(...args: infer A5): infer R5;
} ? [(...args: A1) => R1, (...args: A2) => R2, (...args: A3) => R3, (...args: A4) => R4, (...args: A5) => R5] : T_2 extends {
(...args: infer A1_1): infer R1_1;
(...args: infer A2_1): infer R2_1;
(...args: infer A3_1): infer R3_1;
(...args: infer A4_1): infer R4_1;
} ? [(...args: A1_1) => R1_1, (...args: A2_1) => R2_1, (...args: A3_1) => R3_1, (...args: A4_1) => R4_1] : T_2 extends {
(...args: infer A1_2): infer R1_2;
(...args: infer A2_2): infer R2_2;
(...args: infer A3_2): infer R3_2;
} ? [(...args: A1_2) => R1_2, (...args: A2_2) => R2_2, (...args: A3_2) => R3_2] : T_2 extends {
(...args: infer A1_3): infer R1_3;
(...args: infer A2_3): infer R2_3;
} ? [(...args: A1_3) => R1_3, (...args: A2_3) => R2_3] : T_2 extends (...args: infer A1_4) => infer R1_4 ? [(...args: A1_4) => R1_4] : unknown : never : never)[P]>> : never; } : never) ? T_3 extends (infer Item)[] ? Item : never : never : never) ? T_4 extends unknown ? (x: T_4) => unknown : never : never : never) extends (x: infer R) => unknown ? R : never; };
export {};
import { Transport, TransportConfig } from './json-rpc-transport-types';
export declare function createJsonRpcTransport<TRpcMethods>(transportConfig: TransportConfig<TRpcMethods>): Transport<TRpcMethods>;
//# sourceMappingURL=index.d.ts.map
/**
* Public API.
*/
export type Transport<TApi> = TransportMethods<TApi>;
export type ArmedTransport<TApi, TResponse> = ArmedTransportMethods<TApi, TResponse> & {
send(): Promise<TResponse>;
export type IRpcApi<TRpcMethods> = {
[MethodName in keyof TRpcMethods]: TRpcMethods[MethodName] extends Callable ? (...rawParams: unknown[]) => TransportRequest<ReturnType<TRpcMethods[MethodName]>> : never;
};
export type ArmedBatchTransport<TApi, TResponses extends unknown[]> = ArmedBatchTransportMethods<TApi, TResponses> & {
sendBatch(): Promise<TResponses>;
export type SendOptions = Readonly<{
abortSignal?: AbortSignal;
}>;
export type Transport<TRpcMethods> = TransportMethods<TRpcMethods>;
export type TransportConfig<TRpcMethods> = Readonly<{
api: IRpcApi<TRpcMethods>;
url: string;
}>;
export type TransportRequest<TResponse> = {
methodName: string;
params: unknown[];
responseProcessor?: (response: unknown) => TResponse;
};
export interface ArmedTransportOwnMethods<TResponse> {
send(options?: SendOptions): Promise<TResponse>;
}
export type ArmedTransport<TRpcMethods, TResponse> = ArmedTransportMethods<TRpcMethods, TResponse> & ArmedTransportOwnMethods<TResponse>;
export interface ArmedBatchTransportOwnMethods<TResponses> {
sendBatch(options?: SendOptions): Promise<TResponses>;
}
export type ArmedBatchTransport<TRpcMethods, TResponses extends unknown[]> = ArmedBatchTransportMethods<TRpcMethods, TResponses> & ArmedBatchTransportOwnMethods<TResponses>;
/**
* Private transport-building types.
*/
type TransportMethods<TApi> = {
[TMethodName in keyof TApi]: ArmedTransportReturner<TApi, ApiMethodImplementations<TApi, TMethodName>>;
type TransportMethods<TRpcMethods> = {
[TMethodName in keyof TRpcMethods]: ArmedTransportReturner<TRpcMethods, ApiMethodImplementations<TRpcMethods, TMethodName>>;
};
type ArmedTransportMethods<TApi, TResponse> = ArmedBatchTransportMethods<TApi, [TResponse]>;
type ArmedBatchTransportMethods<TApi, TResponses extends unknown[]> = {
[TMethodName in keyof TApi]: ArmedBatchTransportReturner<TApi, ApiMethodImplementations<TApi, TMethodName>, TResponses>;
type ArmedTransportMethods<TRpcMethods, TResponse> = ArmedBatchTransportMethods<TRpcMethods, [TResponse]>;
type ArmedBatchTransportMethods<TRpcMethods, TResponses extends unknown[]> = {
[TMethodName in keyof TRpcMethods]: ArmedBatchTransportReturner<TRpcMethods, ApiMethodImplementations<TRpcMethods, TMethodName>, TResponses>;
};
type ApiMethodImplementations<TApi, TMethod extends keyof TApi> = Overloads<TApi[TMethod]>;
type ArmedTransportReturner<TApi, TMethodImplementations> = UnionToIntersection<Flatten<{
[P in keyof TMethodImplementations]: TMethodImplementations[P] extends Callable ? (...args: Parameters<TMethodImplementations[P]>) => ArmedTransport<TApi, ReturnType<TMethodImplementations[P]>> : never;
type ApiMethodImplementations<TRpcMethods, TMethod extends keyof TRpcMethods> = Overloads<TRpcMethods[TMethod]>;
type ArmedTransportReturner<TRpcMethods, TMethodImplementations> = UnionToIntersection<Flatten<{
[P in keyof TMethodImplementations]: TMethodImplementations[P] extends Callable ? (...args: Parameters<TMethodImplementations[P]>) => ArmedTransport<TRpcMethods, ReturnType<TMethodImplementations[P]>> : never;
}>>;
type ArmedBatchTransportReturner<TApi, TMethodImplementations, TResponses extends unknown[]> = UnionToIntersection<Flatten<{
[P in keyof TMethodImplementations]: TMethodImplementations[P] extends Callable ? (...args: Parameters<TMethodImplementations[P]>) => ArmedBatchTransport<TApi, [...TResponses, ReturnType<TMethodImplementations[P]>]> : never;
type ArmedBatchTransportReturner<TRpcMethods, TMethodImplementations, TResponses extends unknown[]> = UnionToIntersection<Flatten<{
[P in keyof TMethodImplementations]: TMethodImplementations[P] extends Callable ? (...args: Parameters<TMethodImplementations[P]>) => ArmedBatchTransport<TRpcMethods, [...TResponses, ReturnType<TMethodImplementations[P]>]> : never;
}>>;

@@ -28,0 +45,0 @@ /**

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

@@ -53,3 +53,2 @@ "exports": {

"@types/jest": "^29.5.0",
"@types/node-fetch": "2",
"@typescript-eslint/eslint-plugin": "^5.57.1",

@@ -64,3 +63,3 @@ "@typescript-eslint/parser": "^5.57.1",

"jest-environment-jsdom": "^29.5.0",
"jest-fetch-mock": "^3.0.3",
"jest-fetch-mock-fork": "^3.0.4",
"jest-runner-eslint": "^2.0.0",

@@ -72,7 +71,6 @@ "jest-runner-prettier": "^1.0.0",

"tsup": "6.7.0",
"turbo": "^1.6.3",
"typescript": "^5.0.3",
"version-from-git": "^1.1.1",
"@solana/fetch-impl-browser": "0.0.0-development",
"build-scripts": "0.0.0",
"fetch-impl": "0.0.0",
"test-config": "0.0.0",

@@ -90,5 +88,3 @@ "tsconfig": "0.0.0"

"dependencies": {
"node-fetch": "^2.6.7",
"@solana/keys": "2.0.0-experimental.732dc1e",
"@solana/rpc-core": "2.0.0-experimental.732dc1e"
"node-fetch": "^3.3.1"
},

@@ -98,3 +94,3 @@ "scripts": {

"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
"dev": "jest -c node_modules/test-config/jest-dev.config.ts --globalSetup test-config/test-validator-setup.js --globalTeardown test-config/test-validator-teardown.js --rootDir . --watch",
"dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
"publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",

@@ -107,5 +103,5 @@ "test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",

"test:typecheck": "tsc --noEmit",
"test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --globalSetup test-config/test-validator-setup.js --globalTeardown test-config/test-validator-teardown.js --rootDir . --silent",
"test:unit:node": "jest -c node_modules/test-config/jest-unit.config.node.ts --globalSetup test-config/test-validator-setup.js --globalTeardown test-config/test-validator-teardown.js --rootDir . --silent"
"test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --rootDir . --silent",
"test:unit:node": "jest -c node_modules/test-config/jest-unit.config.node.ts --rootDir . --silent"
}
}

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

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