@solana/rpc-transport
Advanced tools
Comparing version 2.0.0-experimental.d575f09 to 2.0.0-experimental.d603013
// ../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,3 +298,6 @@ super(`HTTP error (${details.statusCode}): ${details.message}`); | ||
// src/transports/http/http-transport.ts | ||
function createHttpTransport({ headers, url }) { | ||
function createHttpTransport({ | ||
headers, | ||
url | ||
}) { | ||
if (__DEV__ && headers) { | ||
@@ -281,3 +340,3 @@ assertIsAllowedHttpRequestHeaders(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 | ||
); | ||
@@ -426,3 +485,6 @@ async function createWebSocketConnection({ | ||
// src/transports/websocket/websocket-transport.ts | ||
function createWebSocketTransport({ sendBufferHighWatermark, url }) { | ||
function createWebSocketTransport({ | ||
sendBufferHighWatermark, | ||
url | ||
}) { | ||
if (/^wss?:/i.test(url) === false) { | ||
@@ -450,4 +512,4 @@ const protocolMatch = url.match(/^([^:]+):/); | ||
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,3 +298,6 @@ super(`HTTP error (${details.statusCode}): ${details.message}`); | ||
// src/transports/http/http-transport.ts | ||
function createHttpTransport({ headers, url }) { | ||
function createHttpTransport({ | ||
headers, | ||
url | ||
}) { | ||
if (__DEV__ && headers) { | ||
@@ -281,3 +340,3 @@ assertIsAllowedHttpRequestHeaders(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 | ||
); | ||
@@ -426,3 +485,6 @@ async function createWebSocketConnection({ | ||
// src/transports/websocket/websocket-transport.ts | ||
function createWebSocketTransport({ sendBufferHighWatermark, url }) { | ||
function createWebSocketTransport({ | ||
sendBufferHighWatermark, | ||
url | ||
}) { | ||
if (/^wss?:/i.test(url) === false) { | ||
@@ -450,4 +512,4 @@ const protocolMatch = url.match(/^([^:]+):/); | ||
export { createHttpTransport, createJsonRpc, createJsonSubscriptionRpc, createWebSocketTransport }; | ||
export { createHttpTransport, createJsonRpc, createJsonRpcApi, createJsonRpcSubscriptionsApi, createJsonSubscriptionRpc, createWebSocketTransport }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.native.js.map |
@@ -6,4 +6,59 @@ import e2 from 'ws'; | ||
// 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) { | ||
@@ -42,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); | ||
@@ -52,3 +107,3 @@ const response = await rpcConfig.transport({ | ||
} else { | ||
return responseProcessor ? responseProcessor(response.result) : response.result; | ||
return responseTransformer ? responseTransformer(response.result, methodName) : response.result; | ||
} | ||
@@ -92,3 +147,3 @@ } | ||
} | ||
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseProcessor }) { | ||
function createPendingRpcSubscription(rpcConfig, { params, subscribeMethodName, unsubscribeMethodName, responseTransformer }) { | ||
return { | ||
@@ -139,3 +194,3 @@ async subscribe({ abortSignal }) { | ||
const notification = message.params.result; | ||
yield responseProcessor ? responseProcessor(notification) : notification; | ||
yield responseTransformer ? responseTransformer(notification, subscribeMethodName) : notification; | ||
} | ||
@@ -183,2 +238,3 @@ } | ||
var SolanaHttpError = class extends Error { | ||
statusCode; | ||
constructor(details) { | ||
@@ -245,3 +301,6 @@ super(`HTTP error (${details.statusCode}): ${details.message}`); | ||
// src/transports/http/http-transport.ts | ||
function createHttpTransport({ headers, url }) { | ||
function createHttpTransport({ | ||
headers, | ||
url | ||
}) { | ||
if (__DEV__ && headers) { | ||
@@ -282,3 +341,3 @@ assertIsAllowedHttpRequestHeaders(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 | ||
); | ||
@@ -427,3 +486,6 @@ async function createWebSocketConnection({ | ||
// src/transports/websocket/websocket-transport.ts | ||
function createWebSocketTransport({ sendBufferHighWatermark, url }) { | ||
function createWebSocketTransport({ | ||
sendBufferHighWatermark, | ||
url | ||
}) { | ||
if (/^wss?:/i.test(url) === false) { | ||
@@ -451,4 +513,4 @@ const protocolMatch = url.match(/^([^:]+):/); | ||
export { createHttpTransport, createJsonRpc, createJsonSubscriptionRpc, createWebSocketTransport }; | ||
export { createHttpTransport, createJsonRpc, createJsonRpcApi, createJsonRpcSubscriptionsApi, createJsonSubscriptionRpc, createWebSocketTransport }; | ||
//# sourceMappingURL=out.js.map | ||
//# sourceMappingURL=index.node.js.map |
@@ -1,5 +0,11 @@ | ||
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 * from './json-rpc-types.js'; | ||
export * from './transports/http/http-transport.js'; | ||
export * from './transports/transport-types.js'; | ||
export * from './transports/websocket/websocket-transport.js'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,20 @@ | ||
import { RpcSubscriptionConfig, RpcSubscriptions } from './json-rpc-types'; | ||
export declare function createJsonSubscriptionRpc<TRpcSubscriptionMethods>(rpcConfig: RpcSubscriptionConfig<TRpcSubscriptionMethods>): RpcSubscriptions<TRpcSubscriptionMethods>; | ||
import { IRpcSubscriptionsApi, RpcSubscriptions } from '@solana/rpc-types'; | ||
import { RpcSubscriptionsDevnet, RpcSubscriptionsMainnet, RpcSubscriptionsTestnet } from './json-rpc-types.js'; | ||
import { IRpcWebSocketTransport, IRpcWebSocketTransportDevnet, IRpcWebSocketTransportMainnet, IRpcWebSocketTransportTestnet } from './transports/transport-types.js'; | ||
export declare function createJsonSubscriptionRpc<TRpcSubscriptionMethods>(rpcConfig: Readonly<{ | ||
api: IRpcSubscriptionsApi<TRpcSubscriptionMethods>; | ||
transport: IRpcWebSocketTransportDevnet; | ||
}>): RpcSubscriptionsDevnet<TRpcSubscriptionMethods>; | ||
export declare function createJsonSubscriptionRpc<TRpcSubscriptionMethods>(rpcConfig: Readonly<{ | ||
api: IRpcSubscriptionsApi<TRpcSubscriptionMethods>; | ||
transport: IRpcWebSocketTransportTestnet; | ||
}>): RpcSubscriptionsTestnet<TRpcSubscriptionMethods>; | ||
export declare function createJsonSubscriptionRpc<TRpcSubscriptionMethods>(rpcConfig: Readonly<{ | ||
api: IRpcSubscriptionsApi<TRpcSubscriptionMethods>; | ||
transport: IRpcWebSocketTransportMainnet; | ||
}>): RpcSubscriptionsMainnet<TRpcSubscriptionMethods>; | ||
export declare function createJsonSubscriptionRpc<TRpcSubscriptionMethods>(rpcConfig: Readonly<{ | ||
api: IRpcSubscriptionsApi<TRpcSubscriptionMethods>; | ||
transport: IRpcWebSocketTransport; | ||
}>): RpcSubscriptions<TRpcSubscriptionMethods>; | ||
//# sourceMappingURL=json-rpc-subscription.d.ts.map |
@@ -1,727 +0,23 @@ | ||
import { IRpcTransport, IRpcWebSocketTransport } from './transports/transport-types'; | ||
/** | ||
* Public RPC API. | ||
*/ | ||
export type IRpcApi<TRpcMethods> = { | ||
[MethodName in keyof TRpcMethods]: RpcReturnTypeMapper<TRpcMethods[MethodName]>; | ||
import { Rpc, RpcSubscriptions } from '@solana/rpc-types'; | ||
import { IRpcTransport, IRpcTransportDevnet, IRpcTransportMainnet, IRpcTransportTestnet, IRpcTransportWithCluster, IRpcWebSocketTransport, IRpcWebSocketTransportDevnet, IRpcWebSocketTransportMainnet, IRpcWebSocketTransportTestnet, IRpcWebSocketTransportWithCluster } from './transports/transport-types.js'; | ||
export type RpcDevnet<TRpcMethods> = Rpc<TRpcMethods> & { | ||
'~cluster': 'devnet'; | ||
}; | ||
export type IRpcSubscriptionsApi<TRpcSubscriptionMethods> = { | ||
[MethodName in keyof TRpcSubscriptionMethods]: RpcSubscriptionReturnTypeMapper<TRpcSubscriptionMethods[MethodName]>; | ||
export type RpcTestnet<TRpcMethods> = Rpc<TRpcMethods> & { | ||
'~cluster': 'testnet'; | ||
}; | ||
export type Rpc<TRpcMethods> = RpcMethods<TRpcMethods>; | ||
export type RpcSubscriptions<TRpcSubscriptionMethods> = RpcSubscriptionMethods<TRpcSubscriptionMethods>; | ||
export type RpcConfig<TRpcMethods> = Readonly<{ | ||
api: IRpcApi<TRpcMethods>; | ||
transport: IRpcTransport; | ||
}>; | ||
export type RpcSubscriptionConfig<TRpcMethods> = Readonly<{ | ||
api: IRpcSubscriptionsApi<TRpcMethods>; | ||
transport: IRpcWebSocketTransport; | ||
}>; | ||
/** | ||
* Public pending RPC request API. | ||
*/ | ||
export type RpcRequest<TResponse> = { | ||
methodName: string; | ||
params: unknown[]; | ||
responseProcessor?: (response: unknown) => TResponse; | ||
export type RpcMainnet<TRpcMethods> = Rpc<TRpcMethods> & { | ||
'~cluster': 'mainnet'; | ||
}; | ||
export type RpcSubscription<TResponse> = { | ||
params: unknown[]; | ||
responseProcessor?: (response: unknown) => TResponse; | ||
subscribeMethodName: string; | ||
unsubscribeMethodName: string; | ||
export type RpcFromTransport<TRpcMethods, TRpcTransport extends IRpcTransport | IRpcTransportWithCluster> = TRpcTransport extends IRpcTransportDevnet ? RpcDevnet<TRpcMethods> : TRpcTransport extends IRpcTransportTestnet ? RpcTestnet<TRpcMethods> : TRpcTransport extends IRpcTransportMainnet ? RpcMainnet<TRpcMethods> : Rpc<TRpcMethods>; | ||
export type RpcSubscriptionsDevnet<TRpcSubscriptionMethods> = RpcSubscriptions<TRpcSubscriptionMethods> & { | ||
'~cluster': 'devnet'; | ||
}; | ||
export type PendingRpcRequest<TResponse> = { | ||
send(options?: SendOptions): Promise<TResponse>; | ||
export type RpcSubscriptionsTestnet<TRpcSubscriptionMethods> = RpcSubscriptions<TRpcSubscriptionMethods> & { | ||
'~cluster': 'testnet'; | ||
}; | ||
export type PendingRpcSubscription<TNotification> = { | ||
subscribe(options: SubscribeOptions): Promise<AsyncIterable<TNotification>>; | ||
export type RpcSubscriptionsMainnet<TRpcSubscriptionMethods> = RpcSubscriptions<TRpcSubscriptionMethods> & { | ||
'~cluster': 'mainnet'; | ||
}; | ||
export type SendOptions = Readonly<{ | ||
abortSignal?: AbortSignal; | ||
}>; | ||
export type SubscribeOptions = Readonly<{ | ||
abortSignal: AbortSignal; | ||
}>; | ||
/** | ||
* Private RPC-building types. | ||
*/ | ||
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> = { | ||
[TMethodName in keyof TRpcMethods]: PendingRpcRequestBuilder<ApiMethodImplementations<TRpcMethods, TMethodName>>; | ||
}; | ||
type RpcSubscriptionMethods<TRpcSubscriptionMethods> = { | ||
[TMethodName in keyof TRpcSubscriptionMethods]: PendingRpcSubscriptionBuilder<ApiMethodImplementations<TRpcSubscriptionMethods, 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]: 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]: PendingRpcSubscriptionReturnTypeMapper<TSubscriptionMethodImplementations[P]>; | ||
}>>; | ||
/** | ||
* Utility types that do terrible, awful things. | ||
*/ | ||
type Callable = (...args: any[]) => any; | ||
type Flatten<T> = T extends (infer Item)[] ? Item : never; | ||
type Overloads<T> = Overloads24<T>; | ||
type Overloads24<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
(...args: infer A16): infer R16; | ||
(...args: infer A17): infer R17; | ||
(...args: infer A18): infer R18; | ||
(...args: infer A19): infer R19; | ||
(...args: infer A20): infer R20; | ||
(...args: infer A21): infer R21; | ||
(...args: infer A22): infer R22; | ||
(...args: infer A23): infer R23; | ||
(...args: infer A24): infer R24; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15, | ||
(...args: A16) => R16, | ||
(...args: A17) => R17, | ||
(...args: A18) => R18, | ||
(...args: A19) => R19, | ||
(...args: A20) => R20, | ||
(...args: A21) => R21, | ||
(...args: A22) => R22, | ||
(...args: A23) => R23, | ||
(...args: A24) => R24 | ||
] : Overloads23<T>; | ||
type Overloads23<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
(...args: infer A16): infer R16; | ||
(...args: infer A17): infer R17; | ||
(...args: infer A18): infer R18; | ||
(...args: infer A19): infer R19; | ||
(...args: infer A20): infer R20; | ||
(...args: infer A21): infer R21; | ||
(...args: infer A22): infer R22; | ||
(...args: infer A23): infer R23; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15, | ||
(...args: A16) => R16, | ||
(...args: A17) => R17, | ||
(...args: A18) => R18, | ||
(...args: A19) => R19, | ||
(...args: A20) => R20, | ||
(...args: A21) => R21, | ||
(...args: A22) => R22, | ||
(...args: A23) => R23 | ||
] : Overloads22<T>; | ||
type Overloads22<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
(...args: infer A16): infer R16; | ||
(...args: infer A17): infer R17; | ||
(...args: infer A18): infer R18; | ||
(...args: infer A19): infer R19; | ||
(...args: infer A20): infer R20; | ||
(...args: infer A21): infer R21; | ||
(...args: infer A22): infer R22; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15, | ||
(...args: A16) => R16, | ||
(...args: A17) => R17, | ||
(...args: A18) => R18, | ||
(...args: A19) => R19, | ||
(...args: A20) => R20, | ||
(...args: A21) => R21, | ||
(...args: A22) => R22 | ||
] : Overloads21<T>; | ||
type Overloads21<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
(...args: infer A16): infer R16; | ||
(...args: infer A17): infer R17; | ||
(...args: infer A18): infer R18; | ||
(...args: infer A19): infer R19; | ||
(...args: infer A20): infer R20; | ||
(...args: infer A21): infer R21; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15, | ||
(...args: A16) => R16, | ||
(...args: A17) => R17, | ||
(...args: A18) => R18, | ||
(...args: A19) => R19, | ||
(...args: A20) => R20, | ||
(...args: A21) => R21 | ||
] : Overloads20<T>; | ||
type Overloads20<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
(...args: infer A16): infer R16; | ||
(...args: infer A17): infer R17; | ||
(...args: infer A18): infer R18; | ||
(...args: infer A19): infer R19; | ||
(...args: infer A20): infer R20; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15, | ||
(...args: A16) => R16, | ||
(...args: A17) => R17, | ||
(...args: A18) => R18, | ||
(...args: A19) => R19, | ||
(...args: A20) => R20 | ||
] : Overloads19<T>; | ||
type Overloads19<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
(...args: infer A16): infer R16; | ||
(...args: infer A17): infer R17; | ||
(...args: infer A18): infer R18; | ||
(...args: infer A19): infer R19; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15, | ||
(...args: A16) => R16, | ||
(...args: A17) => R17, | ||
(...args: A18) => R18, | ||
(...args: A19) => R19 | ||
] : Overloads18<T>; | ||
type Overloads18<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
(...args: infer A16): infer R16; | ||
(...args: infer A17): infer R17; | ||
(...args: infer A18): infer R18; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15, | ||
(...args: A16) => R16, | ||
(...args: A17) => R17, | ||
(...args: A18) => R18 | ||
] : Overloads17<T>; | ||
type Overloads17<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
(...args: infer A16): infer R16; | ||
(...args: infer A17): infer R17; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15, | ||
(...args: A16) => R16, | ||
(...args: A17) => R17 | ||
] : Overloads16<T>; | ||
type Overloads16<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
(...args: infer A16): infer R16; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15, | ||
(...args: A16) => R16 | ||
] : Overloads15<T>; | ||
type Overloads15<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
(...args: infer A15): infer R15; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14, | ||
(...args: A15) => R15 | ||
] : Overloads14<T>; | ||
type Overloads14<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
(...args: infer A14): infer R14; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13, | ||
(...args: A14) => R14 | ||
] : Overloads13<T>; | ||
type Overloads13<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
(...args: infer A13): infer R13; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12, | ||
(...args: A13) => R13 | ||
] : Overloads12<T>; | ||
type Overloads12<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
(...args: infer A12): infer R12; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11, | ||
(...args: A12) => R12 | ||
] : Overloads11<T>; | ||
type Overloads11<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
(...args: infer A11): infer R11; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10, | ||
(...args: A11) => R11 | ||
] : Overloads10<T>; | ||
type Overloads10<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
(...args: infer A10): infer R10; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9, | ||
(...args: A10) => R10 | ||
] : Overloads9<T>; | ||
type Overloads9<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
(...args: infer A9): infer R9; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8, | ||
(...args: A9) => R9 | ||
] : Overloads8<T>; | ||
type Overloads8<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
(...args: infer A8): infer R8; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7, | ||
(...args: A8) => R8 | ||
] : Overloads7<T>; | ||
type Overloads7<T> = T 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: infer A6): infer R6; | ||
(...args: infer A7): infer R7; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6, | ||
(...args: A7) => R7 | ||
] : Overloads6<T>; | ||
type Overloads6<T> = T 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: infer A6): infer R6; | ||
} ? [ | ||
(...args: A1) => R1, | ||
(...args: A2) => R2, | ||
(...args: A3) => R3, | ||
(...args: A4) => R4, | ||
(...args: A5) => R5, | ||
(...args: A6) => R6 | ||
] : Overloads5<T>; | ||
type Overloads5<T> = T 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] : Overloads4<T>; | ||
type Overloads4<T> = T extends { | ||
(...args: infer A1): infer R1; | ||
(...args: infer A2): infer R2; | ||
(...args: infer A3): infer R3; | ||
(...args: infer A4): infer R4; | ||
} ? [(...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] : Overloads2<T>; | ||
type Overloads2<T> = T extends { | ||
(...args: infer A1): infer R1; | ||
(...args: infer A2): infer R2; | ||
} ? [(...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 RpcSubscriptionsFromTransport<TRpcSubscriptionMethods, TRpcTransport extends IRpcWebSocketTransport | IRpcWebSocketTransportWithCluster> = TRpcTransport extends IRpcWebSocketTransportDevnet ? RpcSubscriptionsDevnet<TRpcSubscriptionMethods> : TRpcTransport extends IRpcWebSocketTransportTestnet ? RpcSubscriptionsTestnet<TRpcSubscriptionMethods> : TRpcTransport extends IRpcWebSocketTransportMainnet ? RpcSubscriptionsMainnet<TRpcSubscriptionMethods> : RpcSubscriptions<TRpcSubscriptionMethods>; | ||
//# sourceMappingURL=json-rpc-types.d.ts.map |
@@ -1,2 +0,4 @@ | ||
import { Rpc, RpcConfig } from './json-rpc-types'; | ||
import { IRpcApi, Rpc } from '@solana/rpc-types'; | ||
import { RpcDevnet, RpcMainnet, RpcTestnet } from './json-rpc-types.js'; | ||
import { IRpcTransport, IRpcTransportDevnet, IRpcTransportMainnet, IRpcTransportTestnet } from './transports/transport-types.js'; | ||
interface IHasIdentifier { | ||
@@ -14,4 +16,19 @@ readonly id: number; | ||
}>; | ||
export declare function createJsonRpc<TRpcMethods>(rpcConfig: RpcConfig<TRpcMethods>): Rpc<TRpcMethods>; | ||
export declare function createJsonRpc<TRpcMethods>(rpcConfig: Readonly<{ | ||
api: IRpcApi<TRpcMethods>; | ||
transport: IRpcTransportDevnet; | ||
}>): RpcDevnet<TRpcMethods>; | ||
export declare function createJsonRpc<TRpcMethods>(rpcConfig: Readonly<{ | ||
api: IRpcApi<TRpcMethods>; | ||
transport: IRpcTransportTestnet; | ||
}>): RpcTestnet<TRpcMethods>; | ||
export declare function createJsonRpc<TRpcMethods>(rpcConfig: Readonly<{ | ||
api: IRpcApi<TRpcMethods>; | ||
transport: IRpcTransportMainnet; | ||
}>): RpcMainnet<TRpcMethods>; | ||
export declare function createJsonRpc<TRpcMethods>(rpcConfig: Readonly<{ | ||
api: IRpcApi<TRpcMethods>; | ||
transport: IRpcTransport; | ||
}>): Rpc<TRpcMethods>; | ||
export {}; | ||
//# sourceMappingURL=json-rpc.d.ts.map |
@@ -1,9 +0,10 @@ | ||
import { IRpcTransport } from '../transport-types'; | ||
import { AllowedHttpRequestHeaders } from './http-transport-headers'; | ||
type Config = Readonly<{ | ||
import { ClusterUrl } from '@solana/rpc-types'; | ||
import { IRpcTransportFromClusterUrl } from '../transport-types.js'; | ||
import { AllowedHttpRequestHeaders } from './http-transport-headers.js'; | ||
type Config<TClusterUrl extends ClusterUrl> = Readonly<{ | ||
headers?: AllowedHttpRequestHeaders; | ||
url: string; | ||
url: TClusterUrl; | ||
}>; | ||
export declare function createHttpTransport({ headers, url }: Config): IRpcTransport; | ||
export declare function createHttpTransport<TClusterUrl extends ClusterUrl>({ headers, url, }: Config<TClusterUrl>): IRpcTransportFromClusterUrl<TClusterUrl>; | ||
export {}; | ||
//# sourceMappingURL=http-transport.d.ts.map |
@@ -1,2 +0,3 @@ | ||
import { RpcWebSocketConnection } from './websocket/websocket-connection'; | ||
import { ClusterUrl, DevnetUrl, MainnetUrl, TestnetUrl } from '@solana/rpc-types'; | ||
import { RpcWebSocketConnection } from './websocket/websocket-connection.js'; | ||
type RpcTransportConfig = Readonly<{ | ||
@@ -9,2 +10,13 @@ payload: unknown; | ||
} | ||
export type IRpcTransportDevnet = IRpcTransport & { | ||
'~cluster': 'devnet'; | ||
}; | ||
export type IRpcTransportTestnet = IRpcTransport & { | ||
'~cluster': 'testnet'; | ||
}; | ||
export type IRpcTransportMainnet = IRpcTransport & { | ||
'~cluster': 'mainnet'; | ||
}; | ||
export type IRpcTransportWithCluster = IRpcTransportDevnet | IRpcTransportTestnet | IRpcTransportMainnet; | ||
export type IRpcTransportFromClusterUrl<TClusterUrl extends ClusterUrl> = TClusterUrl extends DevnetUrl ? IRpcTransportDevnet : TClusterUrl extends TestnetUrl ? IRpcTransportTestnet : TClusterUrl extends MainnetUrl ? IRpcTransportMainnet : IRpcTransport; | ||
type RpcWebSocketTransportConfig = Readonly<{ | ||
@@ -19,3 +31,14 @@ payload: unknown; | ||
} | ||
export type IRpcWebSocketTransportDevnet = IRpcWebSocketTransport & { | ||
'~cluster': 'devnet'; | ||
}; | ||
export type IRpcWebSocketTransportTestnet = IRpcWebSocketTransport & { | ||
'~cluster': 'testnet'; | ||
}; | ||
export type IRpcWebSocketTransportMainnet = IRpcWebSocketTransport & { | ||
'~cluster': 'mainnet'; | ||
}; | ||
export type IRpcWebSocketTransportWithCluster = IRpcWebSocketTransportDevnet | IRpcWebSocketTransportTestnet | IRpcWebSocketTransportMainnet; | ||
export type IRpcWebSocketTransportFromClusterUrl<TClusterUrl extends ClusterUrl> = TClusterUrl extends DevnetUrl ? IRpcWebSocketTransportDevnet : TClusterUrl extends TestnetUrl ? IRpcWebSocketTransportTestnet : TClusterUrl extends MainnetUrl ? IRpcWebSocketTransportMainnet : IRpcWebSocketTransport; | ||
export {}; | ||
//# sourceMappingURL=transport-types.d.ts.map |
@@ -1,8 +0,9 @@ | ||
import { IRpcWebSocketTransport } from '../transport-types'; | ||
type Config = Readonly<{ | ||
import { ClusterUrl } from '@solana/rpc-types'; | ||
import { IRpcWebSocketTransportFromClusterUrl } from '../transport-types.js'; | ||
type Config<TClusterUrl extends ClusterUrl> = Readonly<{ | ||
sendBufferHighWatermark: number; | ||
url: string; | ||
url: TClusterUrl; | ||
}>; | ||
export declare function createWebSocketTransport({ sendBufferHighWatermark, url }: Config): IRpcWebSocketTransport; | ||
export declare function createWebSocketTransport<TClusterUrl extends ClusterUrl>({ sendBufferHighWatermark, url, }: Config<TClusterUrl>): IRpcWebSocketTransportFromClusterUrl<TClusterUrl>; | ||
export {}; | ||
//# sourceMappingURL=websocket-transport.d.ts.map |
{ | ||
"name": "@solana/rpc-transport", | ||
"version": "2.0.0-experimental.d575f09", | ||
"version": "2.0.0-experimental.d603013", | ||
"description": "Network transports for accessing the Solana JSON RPC API", | ||
@@ -48,8 +48,11 @@ "exports": { | ||
], | ||
"dependencies": { | ||
"@solana/rpc-types": "2.0.0-experimental.d603013" | ||
}, | ||
"devDependencies": { | ||
"@solana/eslint-config-solana": "^1.0.2", | ||
"@swc/jest": "^0.2.29", | ||
"@types/jest": "^29.5.6", | ||
"@types/node": "^20", | ||
"@typescript-eslint/eslint-plugin": "^6.7.0", | ||
"@types/jest": "^29.5.11", | ||
"@types/node": "18.11.19", | ||
"@typescript-eslint/eslint-plugin": "^6.13.2", | ||
"@typescript-eslint/parser": "^6.3.0", | ||
@@ -66,5 +69,5 @@ "agadoo": "^3.0.0", | ||
"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", | ||
@@ -91,3 +94,3 @@ "version-from-git": "^1.1.1", | ||
"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", | ||
@@ -94,0 +97,0 @@ "publish-packages": "pnpm publish --tag experimental --access public --no-git-checks", |
@@ -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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
356489
48
0
2
3210
+ Added@solana/codecs-core@2.0.0-experimental.d603013(transitive)
+ Added@solana/codecs-numbers@2.0.0-experimental.d603013(transitive)
+ Added@solana/codecs-strings@2.0.0-experimental.d603013(transitive)
+ Added@solana/rpc-types@2.0.0-experimental.d603013(transitive)
+ Addedfastestsmallesttextencoderdecoder@1.0.22(transitive)