New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rpch/sdk

Package Overview
Dependencies
Maintainers
2
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rpch/sdk - npm Package Compare versions

Comparing version 1.12.2 to 2.0.3

25

build/index.js

@@ -64,3 +64,3 @@ "use strict";

timeout: 10e3,
provider: 'https://gnosis-provider.rpch.tech',
provider: 'https://gnosis.rpc-provider.prod.hoprnet.link',
disableMevProtection: false,

@@ -149,2 +149,3 @@ mevProtectionProvider: RPC_PROPELLORHEADS,

const id = RequestCache.generateId(this.requestCache);
const cId = this.chainIds.get(provider);
const resReq = Request.create({

@@ -164,2 +165,5 @@ id,

respRelayPeerId,
chainId: cId,
// give the network 3s to deliver this request on endpoint timeout
timeout: reqOps.timeout - 3e3,
});

@@ -381,4 +385,5 @@ if (Res.isErr(resReq)) {

status: resp.status,
text: async () => resp.text ?? '',
json: async () => JSON.parse(resp.text ?? ''), // will fail to parse if no text (as expected)
statusText: resp.statusText,
headers: resp.headers,
text: resp.text,
};

@@ -452,3 +457,3 @@ if (request.measureRPClatency) {

try {
log.warn('unable to resolve chainId for %s: %s', provider, await res.text());
log.warn('unable to resolve chainId for %s: %d[%s] %s', provider, res.status, res.statusText, res.text);
}

@@ -462,3 +467,3 @@ catch (err) {

try {
const jrpc = await res.json();
const jrpc = JSON.parse(res.text);
if (JRPC.isError(jrpc)) {

@@ -501,3 +506,2 @@ if (jrpc.error.code === -32601 ||

// if we provide headers we need to provide all of them
// pHTTP exit app will only set content type application/json if there are no headers
if (provider === RPC_PROPELLORHEADS && mevKickbackAddress) {

@@ -511,2 +515,3 @@ return {

}
// merge headers with provided headers
if (headers || this.ops.headers) {

@@ -519,2 +524,4 @@ return {

}
// default to application/json content type if no headers are provide
return { 'Content-Type': 'application/json' };
};

@@ -527,3 +534,3 @@ this.determineHops = (forceZeroHop) => {

};
this.populateChainIds = (provider, headers) => {
this.populateChainIds = (provider, opsHeaders) => {
if (!provider) {

@@ -535,2 +542,6 @@ return;

}
const headers = {
...this.ops.headers,
...opsHeaders,
};
this.fetchChainId(provider, headers);

@@ -537,0 +548,0 @@ };

@@ -39,3 +39,3 @@ "use strict";

const InfoResponseTimeout = 10e3; // 10s
const RelayNodesCompatVersions = ['2.0.6', '2.0.7', '2.1'];
const RelayNodesCompatVersions = ['2.1'];
function create(entryNode, exitNodes, applicationTag, messageListener, hops, forceManualRelaying) {

@@ -42,0 +42,0 @@ const entryData = EntryData.create();

@@ -8,5 +8,7 @@ import * as Res from './result';

method?: string;
timeout?: number;
hops?: number;
relayPeerId?: string;
withDuration?: boolean;
chainId?: string;
};

@@ -21,4 +23,6 @@ export declare enum RespType {

type: RespType.Resp;
headers: Record<string, string>;
status: number;
text?: string;
statusText: string;
text: string;
callDuration?: number;

@@ -25,0 +29,0 @@ exitAppDuration?: number;

@@ -116,2 +116,5 @@ "use strict";

}
if (r.timeout) {
t.t = r.timeout;
}
if (r.hops) {

@@ -126,2 +129,5 @@ t.n = r.hops;

}
if (r.chainId) {
t.i = r.chainId;
}
return t;

@@ -134,7 +140,7 @@ }

t: RespType.Resp,
h: r.headers,
s: r.status,
a: r.statusText,
x: r.text,
};
if (r.text) {
t.x = r.text;
}
if (r.callDuration) {

@@ -183,5 +189,7 @@ t.f = r.callDuration;

method: t.m,
timeout: t.t,
hops: t.n,
relayPeerId: t.r,
withDuration: t.w,
chainId: t.i,
};

@@ -194,3 +202,5 @@ }

type: RespType.Resp,
headers: t.h,
status: t.s,
statusText: t.a,
text: t.x,

@@ -197,0 +207,0 @@ callDuration: t.f,

@@ -20,2 +20,3 @@ import * as compatCrypto from '@rpch/compat-crypto';

respRelayPeerId?: string;
chainId?: string;
};

@@ -29,3 +30,3 @@ export type UnboxRequest = {

*/
export declare function create({ id, originalId, provider, req, clientId, entryPeerId, exitPeerId, exitPublicKey, counterOffset, measureRPClatency, headers, hops, reqRelayPeerId, respRelayPeerId, }: {
export declare function create({ id, originalId, provider, req, clientId, entryPeerId, exitPeerId, exitPublicKey, counterOffset, measureRPClatency, headers, hops, reqRelayPeerId, respRelayPeerId, chainId, timeout, }: {
id: string;

@@ -45,2 +46,4 @@ originalId?: string;

respRelayPeerId?: string;
chainId?: string;
timeout?: number;
}): Res.Result<{

@@ -47,0 +50,0 @@ request: Request;

@@ -35,3 +35,3 @@ "use strict";

*/
function create({ id, originalId, provider, req, clientId, entryPeerId, exitPeerId, exitPublicKey, counterOffset, measureRPClatency, headers, hops, reqRelayPeerId, respRelayPeerId, }) {
function create({ id, originalId, provider, req, clientId, entryPeerId, exitPeerId, exitPublicKey, counterOffset, measureRPClatency, headers, hops, reqRelayPeerId, respRelayPeerId, chainId, timeout, }) {
const payload = {

@@ -46,2 +46,4 @@ endpoint: provider,

withDuration: measureRPClatency,
chainId,
timeout,
};

@@ -48,0 +50,0 @@ const resEncode = Payload.encodeReq(payload);

import * as compatCrypto from '@rpch/compat-crypto';
import * as JRPC from './jrpc';
import * as Payload from './payload';

@@ -23,5 +22,6 @@ import * as Res from './result';

status: number;
statusText: string;
text: string;
headers: Record<string, string>;
stats?: Stats;
text: () => Promise<string>;
json: () => Promise<JRPC.Response>;
};

@@ -28,0 +28,0 @@ export declare class SendError extends Error {

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

declare const _default: "1.12.2";
declare const _default: "2.0.3";
export default _default;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = '1.12.2';
exports.default = '2.0.3';
# @rpch/sdk
## 2.0.3
### Patch Changes
- 00e3508: Fix default header content-type
## 2.0.2
### Patch Changes
- update compatible node version for manual relaying
## 2.0.1
### Patch Changes
- Update relay versions to currently working 1hop version
## 2.0.0
### Major Changes
- af3a2e8: Changes SDK send function return response.
No longer offers async resolvers for json and text.
Response contains attributes for server status, statusCode and headers.
Text property can now be used to parse as JSON.
### Minor Changes
- af3a2e8: Consolidated latency metrics env vars.
RPC server now only exposes `RPCH_LATENCY_STATS` to retrieve additional metrics from the logs.
## 1.14.0
### Minor Changes
- 3066770: Update default RPC provider on Gnosis chain
## 1.13.0
### Minor Changes
- 26ff588: Report chainId for provider with request payload
## 1.12.2

@@ -4,0 +48,0 @@

{
"name": "@rpch/sdk",
"version": "1.12.2",
"version": "2.0.3",
"license": "LGPL-3.0",

@@ -5,0 +5,0 @@ "main": "./build/index.js",

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