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 0.0.0-experimental.2 to 2.0.0-experimental.2989216

dist/types/json-rpc-types.d.ts

245

dist/index.browser.js

@@ -1,39 +0,4 @@

import 'node-fetch';
// ../build-scripts/env-shim.ts
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
// ../fetch-impl-browser/dist/index.browser.js
var { fetch } = globalThis;
var src_default = fetch;
// src/http-request-errors.ts
var SolanaHttpError = class extends Error {
constructor(details) {
super(`HTTP error (${details.statusCode}): ${details.message}`);
Error.captureStackTrace(this, this.constructor);
this.statusCode = details.statusCode;
}
get name() {
return "SolanaHttpError";
}
};
async function makeHttpRequest({ payload, url }) {
const requestInfo = {
body: JSON.stringify(payload),
headers: {
"Content-type": "application/json"
},
method: "POST"
};
let response;
{
response = await src_default(url, requestInfo);
}
if (!response.ok) {
throw new SolanaHttpError({
message: response.statusText,
statusCode: response.status
});
}
return await response.json();
}
// src/json-rpc-errors.ts

@@ -70,51 +35,22 @@ var SolanaJsonRpcError = class extends Error {

// 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.ts
function createPendingRpcRequest(rpcConfig, pendingRequest) {
return {
async send(options) {
const { methodName, params, responseProcessor } = pendingRequest;
const payload = createJsonRpcMessage(methodName, params);
const response = await rpcConfig.transport({
payload,
signal: options?.abortSignal
});
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/json-rpc-transport.ts
function createArmedJsonRpcTransport(transportConfig, pendingMessage) {
const { url } = transportConfig;
const transport = {
async send() {
return await sendPayload(pendingMessage, url);
}
};
return makeProxy(transport, transportConfig, pendingMessage);
}
function createArmedBatchJsonRpcTransport(transportConfig, pendingMessages) {
const { url } = transportConfig;
const transport = {
async sendBatch() {
return await sendPayload(pendingMessages, url);
}
};
return makeProxy(transport, transportConfig, pendingMessages);
}
function makeProxy(transport, transportConfig, pendingRequestOrRequests) {
const { onIntegerOverflow } = transportConfig;
return new Proxy(transport, {
function makeProxy(rpcConfig) {
return new Proxy(rpcConfig.api, {
defineProperty() {

@@ -126,19 +62,8 @@ return false;

},
get(...args) {
const [target, p] = args;
return p in target ? Reflect.get(...args) : function(...params) {
get(target, 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);
if (pendingRequestOrRequests == null) {
return createArmedJsonRpcTransport(transportConfig, newMessage);
} else {
const nextPendingMessages = Array.isArray(pendingRequestOrRequests) ? [...pendingRequestOrRequests, newMessage] : [pendingRequestOrRequests, newMessage];
return createArmedBatchJsonRpcTransport(transportConfig, nextPendingMessages);
}
const createRpcRequest = Reflect.get(target, methodName, receiver);
const newRequest = createRpcRequest ? createRpcRequest(...rawParams) : { methodName, params: rawParams };
return createPendingRpcRequest(rpcConfig, newRequest);
};

@@ -148,28 +73,114 @@ }

}
function processResponse(response) {
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
return response.result;
function createJsonRpc(rpcConfig) {
return makeProxy(rpcConfig);
}
// ../fetch-impl/dist/index.browser.js
var e = globalThis.fetch;
// src/transports/http/http-transport-errors.ts
var SolanaHttpError = class extends Error {
constructor(details) {
super(`HTTP error (${details.statusCode}): ${details.message}`);
Error.captureStackTrace(this, this.constructor);
this.statusCode = details.statusCode;
}
}
async function sendPayload(payload, url) {
const responseOrResponses = await makeHttpRequest({
payload,
url
get name() {
return "SolanaHttpError";
}
};
// src/transports/http/http-transport-headers.ts
var DISALLOWED_HEADERS = {
accept: true,
"content-length": true,
"content-type": true
};
var FORBIDDEN_HEADERS = {
"accept-charset": true,
"accept-encoding": true,
"access-control-request-headers": true,
"access-control-request-method": true,
connection: true,
"content-length": true,
cookie: true,
date: true,
dnt: true,
expect: true,
host: true,
"keep-alive": true,
origin: true,
"permissions-policy": true,
// No currently available Typescript technique allows you to match on a prefix.
// 'proxy-':true,
// 'sec-':true,
referer: true,
te: true,
trailer: true,
"transfer-encoding": true,
upgrade: true,
via: true
};
function assertIsAllowedHttpRequestHeaders(headers) {
const badHeaders = Object.keys(headers).filter((headerName) => {
const lowercaseHeaderName = headerName.toLowerCase();
return DISALLOWED_HEADERS[headerName.toLowerCase()] === true || FORBIDDEN_HEADERS[headerName.toLowerCase()] === true || lowercaseHeaderName.startsWith("proxy-") || lowercaseHeaderName.startsWith("sec-");
});
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(processResponse);
} else {
return processResponse(responseOrResponses);
if (badHeaders.length > 0) {
throw new Error(
`${badHeaders.length > 1 ? "These headers are" : "This header is"} forbidden: \`${badHeaders.join("`, `")}\`. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.`
);
}
}
function createJsonRpcTransport(transportConfig) {
const transport = {};
return makeProxy(transport, transportConfig);
function normalizeHeaders(headers) {
const out = {};
for (const headerName in headers) {
out[headerName.toLowerCase()] = headers[headerName];
}
return out;
}
export { createJsonRpcTransport };
// src/transports/http/http-transport.ts
function createHttpTransport({ httpAgentNodeOnly, headers, url }) {
if (__DEV__ && headers) {
assertIsAllowedHttpRequestHeaders(headers);
}
const agent = void 0;
if (__DEV__ && httpAgentNodeOnly != null) {
console.warn(
"createHttpTransport(): The `httpAgentNodeOnly` config you supplied has been ignored; HTTP agents are only usable in Node environments."
);
}
const customHeaders = headers && normalizeHeaders(headers);
return async function makeHttpRequest({
payload,
signal
}) {
const body = JSON.stringify(payload);
const requestInfo = {
agent,
body,
headers: {
...customHeaders,
// Keep these headers lowercase so they will override any user-supplied headers above.
accept: "application/json",
"content-length": body.length.toString(),
"content-type": "application/json; charset=utf-8"
},
method: "POST",
signal
};
const response = await e(url, requestInfo);
if (!response.ok) {
throw new SolanaHttpError({
message: response.statusText,
statusCode: response.status
});
}
return await response.json();
};
}
export { createHttpTransport, createJsonRpc };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.browser.js.map

@@ -1,39 +0,4 @@

import 'node-fetch';
// ../build-scripts/env-shim.ts
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();
// ../fetch-impl-browser/dist/index.browser.js
var { fetch } = globalThis;
var src_default = fetch;
// src/http-request-errors.ts
var SolanaHttpError = class extends Error {
constructor(details) {
super(`HTTP error (${details.statusCode}): ${details.message}`);
Error.captureStackTrace(this, this.constructor);
this.statusCode = details.statusCode;
}
get name() {
return "SolanaHttpError";
}
};
async function makeHttpRequest({ payload, url }) {
const requestInfo = {
body: JSON.stringify(payload),
headers: {
"Content-type": "application/json"
},
method: "POST"
};
let response;
{
response = await src_default(url, requestInfo);
}
if (!response.ok) {
throw new SolanaHttpError({
message: response.statusText,
statusCode: response.status
});
}
return await response.json();
}
// src/json-rpc-errors.ts

@@ -70,51 +35,22 @@ var SolanaJsonRpcError = class extends Error {

// 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.ts
function createPendingRpcRequest(rpcConfig, pendingRequest) {
return {
async send(options) {
const { methodName, params, responseProcessor } = pendingRequest;
const payload = createJsonRpcMessage(methodName, params);
const response = await rpcConfig.transport({
payload,
signal: options?.abortSignal
});
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/json-rpc-transport.ts
function createArmedJsonRpcTransport(transportConfig, pendingMessage) {
const { url } = transportConfig;
const transport = {
async send() {
return await sendPayload(pendingMessage, url);
}
};
return makeProxy(transport, transportConfig, pendingMessage);
}
function createArmedBatchJsonRpcTransport(transportConfig, pendingMessages) {
const { url } = transportConfig;
const transport = {
async sendBatch() {
return await sendPayload(pendingMessages, url);
}
};
return makeProxy(transport, transportConfig, pendingMessages);
}
function makeProxy(transport, transportConfig, pendingRequestOrRequests) {
const { onIntegerOverflow } = transportConfig;
return new Proxy(transport, {
function makeProxy(rpcConfig) {
return new Proxy(rpcConfig.api, {
defineProperty() {

@@ -126,19 +62,8 @@ return false;

},
get(...args) {
const [target, p] = args;
return p in target ? Reflect.get(...args) : function(...params) {
get(target, 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);
if (pendingRequestOrRequests == null) {
return createArmedJsonRpcTransport(transportConfig, newMessage);
} else {
const nextPendingMessages = Array.isArray(pendingRequestOrRequests) ? [...pendingRequestOrRequests, newMessage] : [pendingRequestOrRequests, newMessage];
return createArmedBatchJsonRpcTransport(transportConfig, nextPendingMessages);
}
const createRpcRequest = Reflect.get(target, methodName, receiver);
const newRequest = createRpcRequest ? createRpcRequest(...rawParams) : { methodName, params: rawParams };
return createPendingRpcRequest(rpcConfig, newRequest);
};

@@ -148,28 +73,114 @@ }

}
function processResponse(response) {
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
return response.result;
function createJsonRpc(rpcConfig) {
return makeProxy(rpcConfig);
}
// ../fetch-impl/dist/index.browser.js
var e = globalThis.fetch;
// src/transports/http/http-transport-errors.ts
var SolanaHttpError = class extends Error {
constructor(details) {
super(`HTTP error (${details.statusCode}): ${details.message}`);
Error.captureStackTrace(this, this.constructor);
this.statusCode = details.statusCode;
}
}
async function sendPayload(payload, url) {
const responseOrResponses = await makeHttpRequest({
payload,
url
get name() {
return "SolanaHttpError";
}
};
// src/transports/http/http-transport-headers.ts
var DISALLOWED_HEADERS = {
accept: true,
"content-length": true,
"content-type": true
};
var FORBIDDEN_HEADERS = {
"accept-charset": true,
"accept-encoding": true,
"access-control-request-headers": true,
"access-control-request-method": true,
connection: true,
"content-length": true,
cookie: true,
date: true,
dnt: true,
expect: true,
host: true,
"keep-alive": true,
origin: true,
"permissions-policy": true,
// No currently available Typescript technique allows you to match on a prefix.
// 'proxy-':true,
// 'sec-':true,
referer: true,
te: true,
trailer: true,
"transfer-encoding": true,
upgrade: true,
via: true
};
function assertIsAllowedHttpRequestHeaders(headers) {
const badHeaders = Object.keys(headers).filter((headerName) => {
const lowercaseHeaderName = headerName.toLowerCase();
return DISALLOWED_HEADERS[headerName.toLowerCase()] === true || FORBIDDEN_HEADERS[headerName.toLowerCase()] === true || lowercaseHeaderName.startsWith("proxy-") || lowercaseHeaderName.startsWith("sec-");
});
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(processResponse);
} else {
return processResponse(responseOrResponses);
if (badHeaders.length > 0) {
throw new Error(
`${badHeaders.length > 1 ? "These headers are" : "This header is"} forbidden: \`${badHeaders.join("`, `")}\`. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.`
);
}
}
function createJsonRpcTransport(transportConfig) {
const transport = {};
return makeProxy(transport, transportConfig);
function normalizeHeaders(headers) {
const out = {};
for (const headerName in headers) {
out[headerName.toLowerCase()] = headers[headerName];
}
return out;
}
export { createJsonRpcTransport };
// src/transports/http/http-transport.ts
function createHttpTransport({ httpAgentNodeOnly, headers, url }) {
if (__DEV__ && headers) {
assertIsAllowedHttpRequestHeaders(headers);
}
const agent = void 0;
if (__DEV__ && httpAgentNodeOnly != null) {
console.warn(
"createHttpTransport(): The `httpAgentNodeOnly` config you supplied has been ignored; HTTP agents are only usable in Node environments."
);
}
const customHeaders = headers && normalizeHeaders(headers);
return async function makeHttpRequest({
payload,
signal
}) {
const body = JSON.stringify(payload);
const requestInfo = {
agent,
body,
headers: {
...customHeaders,
// Keep these headers lowercase so they will override any user-supplied headers above.
accept: "application/json",
"content-length": body.length.toString(),
"content-type": "application/json; charset=utf-8"
},
method: "POST",
signal
};
const response = await e(url, requestInfo);
if (!response.ok) {
throw new SolanaHttpError({
message: response.statusText,
statusCode: response.status
});
}
return await response.json();
};
}
export { createHttpTransport, createJsonRpc };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.native.js.map

@@ -1,34 +0,5 @@

import fetchImplNode from 'node-fetch';
import t from 'node-fetch';
// src/http-request-errors.ts
var SolanaHttpError = class extends Error {
constructor(details) {
super(`HTTP error (${details.statusCode}): ${details.message}`);
Error.captureStackTrace(this, this.constructor);
this.statusCode = details.statusCode;
}
get name() {
return "SolanaHttpError";
}
};
async function makeHttpRequest({ payload, url }) {
const requestInfo = {
body: JSON.stringify(payload),
headers: {
"Content-type": "application/json"
},
method: "POST"
};
let response;
{
response = await fetchImplNode(url, requestInfo);
}
if (!response.ok) {
throw new SolanaHttpError({
message: response.statusText,
statusCode: response.status
});
}
return await response.json();
}
// ../build-scripts/env-shim.ts
var __DEV__ = /* @__PURE__ */ (() => process["env"].NODE_ENV === "development")();

@@ -66,51 +37,22 @@ // src/json-rpc-errors.ts

// 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.ts
function createPendingRpcRequest(rpcConfig, pendingRequest) {
return {
async send(options) {
const { methodName, params, responseProcessor } = pendingRequest;
const payload = createJsonRpcMessage(methodName, params);
const response = await rpcConfig.transport({
payload,
signal: options?.abortSignal
});
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/json-rpc-transport.ts
function createArmedJsonRpcTransport(transportConfig, pendingMessage) {
const { url } = transportConfig;
const transport = {
async send() {
return await sendPayload(pendingMessage, url);
}
};
return makeProxy(transport, transportConfig, pendingMessage);
}
function createArmedBatchJsonRpcTransport(transportConfig, pendingMessages) {
const { url } = transportConfig;
const transport = {
async sendBatch() {
return await sendPayload(pendingMessages, url);
}
};
return makeProxy(transport, transportConfig, pendingMessages);
}
function makeProxy(transport, transportConfig, pendingRequestOrRequests) {
const { onIntegerOverflow } = transportConfig;
return new Proxy(transport, {
function makeProxy(rpcConfig) {
return new Proxy(rpcConfig.api, {
defineProperty() {

@@ -122,19 +64,8 @@ return false;

},
get(...args) {
const [target, p] = args;
return p in target ? Reflect.get(...args) : function(...params) {
get(target, 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);
if (pendingRequestOrRequests == null) {
return createArmedJsonRpcTransport(transportConfig, newMessage);
} else {
const nextPendingMessages = Array.isArray(pendingRequestOrRequests) ? [...pendingRequestOrRequests, newMessage] : [pendingRequestOrRequests, newMessage];
return createArmedBatchJsonRpcTransport(transportConfig, nextPendingMessages);
}
const createRpcRequest = Reflect.get(target, methodName, receiver);
const newRequest = createRpcRequest ? createRpcRequest(...rawParams) : { methodName, params: rawParams };
return createPendingRpcRequest(rpcConfig, newRequest);
};

@@ -144,28 +75,112 @@ }

}
function processResponse(response) {
if ("error" in response) {
throw new SolanaJsonRpcError(response.error);
} else {
return response.result;
function createJsonRpc(rpcConfig) {
return makeProxy(rpcConfig);
}
var f = t;
// src/transports/http/http-transport-errors.ts
var SolanaHttpError = class extends Error {
constructor(details) {
super(`HTTP error (${details.statusCode}): ${details.message}`);
Error.captureStackTrace(this, this.constructor);
this.statusCode = details.statusCode;
}
}
async function sendPayload(payload, url) {
const responseOrResponses = await makeHttpRequest({
payload,
url
get name() {
return "SolanaHttpError";
}
};
// src/transports/http/http-transport-headers.ts
var DISALLOWED_HEADERS = {
accept: true,
"content-length": true,
"content-type": true
};
var FORBIDDEN_HEADERS = {
"accept-charset": true,
"accept-encoding": true,
"access-control-request-headers": true,
"access-control-request-method": true,
connection: true,
"content-length": true,
cookie: true,
date: true,
dnt: true,
expect: true,
host: true,
"keep-alive": true,
origin: true,
"permissions-policy": true,
// No currently available Typescript technique allows you to match on a prefix.
// 'proxy-':true,
// 'sec-':true,
referer: true,
te: true,
trailer: true,
"transfer-encoding": true,
upgrade: true,
via: true
};
function assertIsAllowedHttpRequestHeaders(headers) {
const badHeaders = Object.keys(headers).filter((headerName) => {
const lowercaseHeaderName = headerName.toLowerCase();
return DISALLOWED_HEADERS[headerName.toLowerCase()] === true || FORBIDDEN_HEADERS[headerName.toLowerCase()] === true || lowercaseHeaderName.startsWith("proxy-") || lowercaseHeaderName.startsWith("sec-");
});
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(processResponse);
} else {
return processResponse(responseOrResponses);
if (badHeaders.length > 0) {
throw new Error(
`${badHeaders.length > 1 ? "These headers are" : "This header is"} forbidden: \`${badHeaders.join("`, `")}\`. Learn more at https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name.`
);
}
}
function createJsonRpcTransport(transportConfig) {
const transport = {};
return makeProxy(transport, transportConfig);
function normalizeHeaders(headers) {
const out = {};
for (const headerName in headers) {
out[headerName.toLowerCase()] = headers[headerName];
}
return out;
}
export { createJsonRpcTransport };
// src/transports/http/http-transport.ts
function createHttpTransport({ httpAgentNodeOnly, headers, url }) {
if (__DEV__ && headers) {
assertIsAllowedHttpRequestHeaders(headers);
}
const agent = httpAgentNodeOnly ;
if (__DEV__ && httpAgentNodeOnly != null) {
console.warn(
"createHttpTransport(): The `httpAgentNodeOnly` config you supplied has been ignored; HTTP agents are only usable in Node environments."
);
}
const customHeaders = headers && normalizeHeaders(headers);
return async function makeHttpRequest({
payload,
signal
}) {
const body = JSON.stringify(payload);
const requestInfo = {
agent,
body,
headers: {
...customHeaders,
// Keep these headers lowercase so they will override any user-supplied headers above.
accept: "application/json",
"content-length": body.length.toString(),
"content-type": "application/json; charset=utf-8"
},
method: "POST",
signal
};
const response = await f(url, requestInfo);
if (!response.ok) {
throw new SolanaHttpError({
message: response.statusText,
statusCode: response.status
});
}
return await response.json();
};
}
export { createHttpTransport, createJsonRpc };
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.node.js.map

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

export * from './json-rpc-transport';
export * from './json-rpc';
export * from './transports/http/http-transport';
//# sourceMappingURL=index.d.ts.map

@@ -0,1 +1,21 @@

export declare const SolanaJsonRpcErrorCode: {
readonly JSON_RPC_INVALID_PARAMS: -32602;
readonly JSON_RPC_SCAN_ERROR: -32012;
readonly JSON_RPC_SERVER_ERROR_BLOCK_CLEANED_UP: -32001;
readonly JSON_RPC_SERVER_ERROR_BLOCK_NOT_AVAILABLE: -32004;
readonly JSON_RPC_SERVER_ERROR_BLOCK_STATUS_NOT_AVAILABLE_YET: -32014;
readonly JSON_RPC_SERVER_ERROR_KEY_EXCLUDED_FROM_SECONDARY_INDEX: -32010;
readonly JSON_RPC_SERVER_ERROR_LONG_TERM_STORAGE_SLOT_SKIPPED: -32009;
readonly JSON_RPC_SERVER_ERROR_MIN_CONTEXT_SLOT_NOT_REACHED: -32016;
readonly JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY: -32005;
readonly JSON_RPC_SERVER_ERROR_NO_SNAPSHOT: -32008;
readonly JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE: -32002;
readonly JSON_RPC_SERVER_ERROR_SLOT_SKIPPED: -32007;
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_HISTORY_NOT_AVAILABLE: -32011;
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_PRECOMPILE_VERIFICATION_FAILURE: -32006;
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_LEN_MISMATCH: -32013;
readonly JSON_RPC_SERVER_ERROR_TRANSACTION_SIGNATURE_VERIFICATION_FAILURE: -32003;
readonly JSON_RPC_SERVER_ERROR_UNSUPPORTED_TRANSACTION_VERSION: -32015;
};
type SolanaJsonRpcErrorCodeEnum = (typeof SolanaJsonRpcErrorCode)[keyof typeof SolanaJsonRpcErrorCode];
type SolanaJsonRpcErrorDetails = Readonly<{

@@ -7,3 +27,3 @@ code: number;

export declare class SolanaJsonRpcError extends Error {
readonly code: number;
readonly code: SolanaJsonRpcErrorCodeEnum;
readonly data: unknown;

@@ -10,0 +30,0 @@ constructor(details: SolanaJsonRpcErrorDetails);

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

@@ -49,11 +49,11 @@ "exports": {

"devDependencies": {
"@solana/eslint-config-solana": "^0.0.4",
"@solana/eslint-config-solana": "^1.0.1",
"@swc/core": "^1.3.18",
"@swc/jest": "^0.2.23",
"@types/jest": "^29.5.0",
"@types/node-fetch": "2",
"@typescript-eslint/eslint-plugin": "^5.43.0",
"@typescript-eslint/parser": "^5.43.0",
"agadoo": "^2.0.0",
"eslint": "^8.27.0",
"@swc/jest": "^0.2.26",
"@types/jest": "^29.5.1",
"@types/node": "^16",
"@typescript-eslint/eslint-plugin": "^5.57.1",
"@typescript-eslint/parser": "^5.57.1",
"agadoo": "^3.0.0",
"eslint": "^8.37.0",
"eslint-plugin-jest": "^27.1.5",

@@ -64,13 +64,13 @@ "eslint-plugin-react-hooks": "^4.6.0",

"jest-environment-jsdom": "^29.5.0",
"jest-fetch-mock": "^3.0.3",
"jest-runner-eslint": "^1.1.0",
"jest-fetch-mock-fork": "^3.0.4",
"jest-runner-eslint": "^2.1.0",
"jest-runner-prettier": "^1.0.0",
"postcss": "^8.4.12",
"prettier": "^2.7.1",
"prettier": "^2.8.8",
"ts-node": "^10.9.1",
"tsup": "6.5.0",
"turbo": "^1.6.3",
"typescript": "^4.9",
"@solana/fetch-impl-browser": "0.0.0-development",
"tsup": "6.7.0",
"typescript": "^5.0.4",
"version-from-git": "^1.1.1",
"build-scripts": "0.0.0",
"fetch-impl": "0.0.0",
"test-config": "0.0.0",

@@ -87,7 +87,2 @@ "tsconfig": "0.0.0"

},
"dependencies": {
"@solana/keys": "^0.0.0-experimental.1",
"@solana/rpc-core": "^0.0.0-experimental.2",
"node-fetch": "^2.6.7"
},
"scripts": {

@@ -97,2 +92,3 @@ "compile:js": "tsup --config build-scripts/tsup.config.package.ts",

"dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
"publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",
"test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",

@@ -99,0 +95,0 @@ "test:prettier": "jest -c node_modules/test-config/jest-prettier.config.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

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