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

bitski-provider

Package Overview
Dependencies
Maintainers
6
Versions
89
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bitski-provider - npm Package Compare versions

Comparing version 2.0.0-beta.6 to 2.0.0-beta.7

6

CHANGELOG.md
# bitski-provider
## 2.0.0-beta.7
### Patch Changes
- [#317](https://github.com/BitskiCo/bitski-js/pull/317) [`8641004`](https://github.com/BitskiCo/bitski-js/commit/8641004ef308232f2708fc2afaeb8e6bdba0d098) Thanks [@pzuraq](https://github.com/pzuraq)! - Await properly in chain management
## 2.0.0-beta.6

@@ -4,0 +10,0 @@

6

dist/bitski-provider.js

@@ -19,3 +19,3 @@ import { createAsyncMiddleware, JsonRpcEngine, } from 'json-rpc-engine';

import { assert, expect } from './utils/type-utils';
import { createEthChainMiddleware } from './middleware/chain-management';
import { createChainManagementMiddleware } from './middleware/chain-management';
// Some eth methods result in a subscription being created, and return the id of that subscription.

@@ -44,3 +44,3 @@ // We need to keep track of the subscription id and the chain id it was created on, so we can

this.activeSubs = new Set();
this.config = Object.assign(Object.assign({}, config), { fetch: (_a = config.fetch) !== null && _a !== void 0 ? _a : fetch, additionalHeaders: Object.assign({ 'X-API-KEY': config.clientId, 'X-CLIENT-ID': config.clientId, 'X-CLIENT-VERSION': "bitski-provider-v2.0.0-beta.6" }, ((_b = config.additionalHeaders) !== null && _b !== void 0 ? _b : {})), apiBaseUrl: (_c = config.apiBaseUrl) !== null && _c !== void 0 ? _c : BITSKI_API_BASE_URL, signerBaseUrl: (_d = config.signerBaseUrl) !== null && _d !== void 0 ? _d : BITSKI_SIGNER_BASE_URL, store: (_e = config.store) !== null && _e !== void 0 ? _e : new LocalStorageStore(), sign: (_f = config.sign) !== null && _f !== void 0 ? _f : createBrowserSigner() });
this.config = Object.assign(Object.assign({}, config), { fetch: (_a = config.fetch) !== null && _a !== void 0 ? _a : fetch, additionalHeaders: Object.assign({ 'X-API-KEY': config.clientId, 'X-CLIENT-ID': config.clientId, 'X-CLIENT-VERSION': "bitski-provider-v2.0.0-beta.7" }, ((_b = config.additionalHeaders) !== null && _b !== void 0 ? _b : {})), apiBaseUrl: (_c = config.apiBaseUrl) !== null && _c !== void 0 ? _c : BITSKI_API_BASE_URL, signerBaseUrl: (_d = config.signerBaseUrl) !== null && _d !== void 0 ? _d : BITSKI_SIGNER_BASE_URL, store: (_e = config.store) !== null && _e !== void 0 ? _e : new LocalStorageStore(), sign: (_f = config.sign) !== null && _f !== void 0 ? _f : createBrowserSigner() });
this.store = new BitskiProviderStateStore(this.config.store);

@@ -55,3 +55,3 @@ // Setup the engine

engine.push(createFixtureMiddleware());
engine.push(createEthChainMiddleware());
engine.push(createChainManagementMiddleware());
if (!config.disableValidation) {

@@ -58,0 +58,0 @@ // Ensures that transactions are well formed (nonce, gas, gasPrice, from) before they are sent to Bitski

@@ -6,3 +6,3 @@ import { EthEvent, EthMethod, } from 'eth-provider-types';

import { expect } from '../utils/type-utils';
export const createEthChainMiddleware = () => {
export const createChainManagementMiddleware = () => {
return createAsyncMiddleware(async (req, res, next) => {

@@ -18,3 +18,3 @@ var _a, _b;

const definition = expect((_a = req.params) === null || _a === void 0 ? void 0 : _a[0], 'addEthereumChain requires a chain definition parameter');
context.store.addChain(definition);
await context.store.addChain(definition);
res.result = null;

@@ -25,3 +25,3 @@ return;

const chainDetails = expect((_b = req.params) === null || _b === void 0 ? void 0 : _b[0], 'switchEthereumChain requires a chainId');
const chain = context.store.findChain(chainDetails.chainId);
const chain = await context.store.findChain(chainDetails.chainId);
if (!chain) {

@@ -28,0 +28,0 @@ throw ethErrors.provider.userRejectedRequest({ message: 'Chain does not exist' });

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

this.activeSubs = new Set();
this.config = Object.assign(Object.assign({}, config), { fetch: (_a = config.fetch) !== null && _a !== void 0 ? _a : fetch, additionalHeaders: Object.assign({ 'X-API-KEY': config.clientId, 'X-CLIENT-ID': config.clientId, 'X-CLIENT-VERSION': "bitski-provider-v2.0.0-beta.6" }, ((_b = config.additionalHeaders) !== null && _b !== void 0 ? _b : {})), apiBaseUrl: (_c = config.apiBaseUrl) !== null && _c !== void 0 ? _c : constants_1.BITSKI_API_BASE_URL, signerBaseUrl: (_d = config.signerBaseUrl) !== null && _d !== void 0 ? _d : constants_1.BITSKI_SIGNER_BASE_URL, store: (_e = config.store) !== null && _e !== void 0 ? _e : new store_1.LocalStorageStore(), sign: (_f = config.sign) !== null && _f !== void 0 ? _f : (0, browser_1.default)() });
this.config = Object.assign(Object.assign({}, config), { fetch: (_a = config.fetch) !== null && _a !== void 0 ? _a : fetch, additionalHeaders: Object.assign({ 'X-API-KEY': config.clientId, 'X-CLIENT-ID': config.clientId, 'X-CLIENT-VERSION': "bitski-provider-v2.0.0-beta.7" }, ((_b = config.additionalHeaders) !== null && _b !== void 0 ? _b : {})), apiBaseUrl: (_c = config.apiBaseUrl) !== null && _c !== void 0 ? _c : constants_1.BITSKI_API_BASE_URL, signerBaseUrl: (_d = config.signerBaseUrl) !== null && _d !== void 0 ? _d : constants_1.BITSKI_SIGNER_BASE_URL, store: (_e = config.store) !== null && _e !== void 0 ? _e : new store_1.LocalStorageStore(), sign: (_f = config.sign) !== null && _f !== void 0 ? _f : (0, browser_1.default)() });
this.store = new store_1.BitskiProviderStateStore(this.config.store);

@@ -60,3 +60,3 @@ // Setup the engine

engine.push((0, fixture_1.createFixtureMiddleware)());
engine.push((0, chain_management_1.createEthChainMiddleware)());
engine.push((0, chain_management_1.createChainManagementMiddleware)());
if (!config.disableValidation) {

@@ -63,0 +63,0 @@ // Ensures that transactions are well formed (nonce, gas, gasPrice, from) before they are sent to Bitski

import { JsonRpcMiddleware } from 'json-rpc-engine';
export declare const createEthChainMiddleware: () => JsonRpcMiddleware<unknown[], unknown>;
export declare const createChainManagementMiddleware: () => JsonRpcMiddleware<unknown[], unknown>;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createEthChainMiddleware = void 0;
exports.createChainManagementMiddleware = void 0;
const eth_provider_types_1 = require("eth-provider-types");

@@ -9,3 +9,3 @@ const eth_rpc_errors_1 = require("eth-rpc-errors");

const type_utils_1 = require("../utils/type-utils");
const createEthChainMiddleware = () => {
const createChainManagementMiddleware = () => {
return (0, json_rpc_engine_1.createAsyncMiddleware)(async (req, res, next) => {

@@ -21,3 +21,3 @@ var _a, _b;

const definition = (0, type_utils_1.expect)((_a = req.params) === null || _a === void 0 ? void 0 : _a[0], 'addEthereumChain requires a chain definition parameter');
context.store.addChain(definition);
await context.store.addChain(definition);
res.result = null;

@@ -28,3 +28,3 @@ return;

const chainDetails = (0, type_utils_1.expect)((_b = req.params) === null || _b === void 0 ? void 0 : _b[0], 'switchEthereumChain requires a chainId');
const chain = context.store.findChain(chainDetails.chainId);
const chain = await context.store.findChain(chainDetails.chainId);
if (!chain) {

@@ -41,3 +41,3 @@ throw eth_rpc_errors_1.ethErrors.provider.userRejectedRequest({ message: 'Chain does not exist' });

};
exports.createEthChainMiddleware = createEthChainMiddleware;
exports.createChainManagementMiddleware = createChainManagementMiddleware;
//# sourceMappingURL=chain-management.js.map

@@ -12,3 +12,3 @@ {

},
"version": "2.0.0-beta.6",
"version": "2.0.0-beta.7",
"scripts": {

@@ -15,0 +15,0 @@ "test": "jest",

@@ -34,3 +34,3 @@ import {

import { assert, expect } from './utils/type-utils';
import { createEthChainMiddleware } from './middleware/chain-management';
import { createChainManagementMiddleware } from './middleware/chain-management';

@@ -100,3 +100,3 @@ // global value provided by scripts/insert-package-version.mjs

engine.push(createFixtureMiddleware());
engine.push(createEthChainMiddleware());
engine.push(createChainManagementMiddleware());

@@ -103,0 +103,0 @@ if (!config.disableValidation) {

@@ -12,3 +12,3 @@ import {

export const createEthChainMiddleware = (): JsonRpcMiddleware<unknown[], unknown> => {
export const createChainManagementMiddleware = (): JsonRpcMiddleware<unknown[], unknown> => {
return createAsyncMiddleware(async (req, res, next) => {

@@ -30,3 +30,3 @@ const { method } = req;

context.store.addChain(definition);
await context.store.addChain(definition);

@@ -44,3 +44,3 @@ res.result = null;

const chain = context.store.findChain(chainDetails.chainId);
const chain = await context.store.findChain(chainDetails.chainId);

@@ -47,0 +47,0 @@ if (!chain) {

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