bitski-provider
Advanced tools
Comparing version 2.0.0-beta.8 to 2.0.0-beta.9
# bitski-provider | ||
## 2.0.0-beta.9 | ||
### Patch Changes | ||
- [#322](https://github.com/BitskiCo/bitski-js/pull/322) [`788ef37`](https://github.com/BitskiCo/bitski-js/commit/788ef373342c8558ee3ed18f4d1f8eefa4b23324) Thanks [@chronicIntrovert](https://github.com/chronicIntrovert)! - Append extras if available to final request through requestWithChain | ||
## 2.0.0-beta.8 | ||
@@ -4,0 +10,0 @@ |
@@ -1,20 +0,20 @@ | ||
import { createAsyncMiddleware, JsonRpcEngine, } from 'json-rpc-engine'; | ||
import { EthMethod, EthEvent, } from 'eth-provider-types'; | ||
import { createFixtureMiddleware } from './middleware/fixture'; | ||
import { createTypedDataSanitizerMiddleware } from './middleware/typed-data-sanitizer'; | ||
import { createTransactionValidatorMiddleware } from './middleware/transaction-validator'; | ||
import SafeEventEmitter from '@metamask/safe-event-emitter'; | ||
import { createInflightCacheMiddleware } from 'eth-json-rpc-middleware/dist/inflight-cache'; | ||
import { EthEvent, EthMethod, } from 'eth-provider-types'; | ||
import { JsonRpcEngine, createAsyncMiddleware, } from 'json-rpc-engine'; | ||
import { BITSKI_API_BASE_URL, BITSKI_SIGNER_BASE_URL, UNAUTHORIZED_ERRORS } from './constants'; | ||
import { createBlockCacheMiddleware } from './middleware/block-cache'; | ||
import { createSubscriptionMiddleware } from './middleware/subscription'; | ||
import { createFilterMiddleware } from './middleware/filter'; | ||
import { createInflightCacheMiddleware } from 'eth-json-rpc-middleware/dist/inflight-cache'; | ||
import { createChainManagementMiddleware } from './middleware/chain-management'; | ||
import { createEthAccountsMiddleware } from './middleware/eth-accounts'; | ||
import { createSignatureMiddleware } from './middleware/signature'; | ||
import { createFetchRestMiddleware } from './middleware/fetch-rest'; | ||
import { createFetchRpcMiddleware } from './middleware/fetch-rpc'; | ||
import SafeEventEmitter from '@metamask/safe-event-emitter'; | ||
import { BITSKI_API_BASE_URL, BITSKI_SIGNER_BASE_URL, UNAUTHORIZED_ERRORS } from './constants'; | ||
import { createFilterMiddleware } from './middleware/filter'; | ||
import { createFixtureMiddleware } from './middleware/fixture'; | ||
import { createSignatureMiddleware } from './middleware/signature'; | ||
import { createSubscriptionMiddleware } from './middleware/subscription'; | ||
import { createTransactionValidatorMiddleware } from './middleware/transaction-validator'; | ||
import { createTypedDataSanitizerMiddleware } from './middleware/typed-data-sanitizer'; | ||
import createBrowserSigner from './signers/browser'; | ||
import { BitskiProviderStateStore, LocalStorageStore } from './store'; | ||
import { assert, expect } from './utils/type-utils'; | ||
import { createChainManagementMiddleware } from './middleware/chain-management'; | ||
// Some eth methods result in a subscription being created, and return the id of that subscription. | ||
@@ -43,3 +43,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.8" }, ((_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.9" }, ((_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); | ||
@@ -146,2 +146,3 @@ // Setup the engine | ||
emit: this.events.emit.bind(this.events), | ||
extra: opts === null || opts === void 0 ? void 0 : opts.extra, | ||
request: (req, opts) => this.requestWithChain(chainId, req, opts), | ||
@@ -148,0 +149,0 @@ addDestructor: (destroy) => this.destructors.push(destroy), |
@@ -1,2 +0,2 @@ | ||
import { EthProvider, EthMethod, EthRequest, EthResult, EthEvent, EthEventListener } from 'eth-provider-types'; | ||
import { EthEvent, EthEventListener, EthMethod, EthProvider, EthRequest, EthResult } from 'eth-provider-types'; | ||
import { BitskiProviderConfig } from './types'; | ||
@@ -3,0 +3,0 @@ export declare class BitskiProvider<Extra = unknown> implements EthProvider { |
@@ -7,21 +7,21 @@ "use strict"; | ||
exports.createBitskiProvider = exports.BitskiProvider = void 0; | ||
const safe_event_emitter_1 = __importDefault(require("@metamask/safe-event-emitter")); | ||
const inflight_cache_1 = require("eth-json-rpc-middleware/dist/inflight-cache"); | ||
const eth_provider_types_1 = require("eth-provider-types"); | ||
const json_rpc_engine_1 = require("json-rpc-engine"); | ||
const eth_provider_types_1 = require("eth-provider-types"); | ||
const fixture_1 = require("./middleware/fixture"); | ||
const typed_data_sanitizer_1 = require("./middleware/typed-data-sanitizer"); | ||
const transaction_validator_1 = require("./middleware/transaction-validator"); | ||
const constants_1 = require("./constants"); | ||
const block_cache_1 = require("./middleware/block-cache"); | ||
const subscription_1 = require("./middleware/subscription"); | ||
const filter_1 = require("./middleware/filter"); | ||
const inflight_cache_1 = require("eth-json-rpc-middleware/dist/inflight-cache"); | ||
const chain_management_1 = require("./middleware/chain-management"); | ||
const eth_accounts_1 = require("./middleware/eth-accounts"); | ||
const signature_1 = require("./middleware/signature"); | ||
const fetch_rest_1 = require("./middleware/fetch-rest"); | ||
const fetch_rpc_1 = require("./middleware/fetch-rpc"); | ||
const safe_event_emitter_1 = __importDefault(require("@metamask/safe-event-emitter")); | ||
const constants_1 = require("./constants"); | ||
const filter_1 = require("./middleware/filter"); | ||
const fixture_1 = require("./middleware/fixture"); | ||
const signature_1 = require("./middleware/signature"); | ||
const subscription_1 = require("./middleware/subscription"); | ||
const transaction_validator_1 = require("./middleware/transaction-validator"); | ||
const typed_data_sanitizer_1 = require("./middleware/typed-data-sanitizer"); | ||
const browser_1 = __importDefault(require("./signers/browser")); | ||
const store_1 = require("./store"); | ||
const type_utils_1 = require("./utils/type-utils"); | ||
const chain_management_1 = require("./middleware/chain-management"); | ||
// Some eth methods result in a subscription being created, and return the id of that subscription. | ||
@@ -50,3 +50,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.8" }, ((_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.9" }, ((_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); | ||
@@ -153,2 +153,3 @@ // Setup the engine | ||
emit: this.events.emit.bind(this.events), | ||
extra: opts === null || opts === void 0 ? void 0 : opts.extra, | ||
request: (req, opts) => this.requestWithChain(chainId, req, opts), | ||
@@ -155,0 +156,0 @@ addDestructor: (destroy) => this.destructors.push(destroy), |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "2.0.0-beta.8", | ||
"version": "2.0.0-beta.9", | ||
"scripts": { | ||
@@ -15,0 +15,0 @@ "test": "jest", |
@@ -0,3 +1,12 @@ | ||
import SafeEventEmitter from '@metamask/safe-event-emitter'; | ||
import { createInflightCacheMiddleware } from 'eth-json-rpc-middleware/dist/inflight-cache'; | ||
import { | ||
createAsyncMiddleware, | ||
EthEvent, | ||
EthEventListener, | ||
EthMethod, | ||
EthProvider, | ||
EthRequest, | ||
EthResult, | ||
} from 'eth-provider-types'; | ||
import { | ||
JsonRpcEngine, | ||
@@ -7,30 +16,21 @@ JsonRpcFailure, | ||
JsonRpcVersion, | ||
createAsyncMiddleware, | ||
} from 'json-rpc-engine'; | ||
import { | ||
EthProvider, | ||
EthMethod, | ||
EthRequest, | ||
EthResult, | ||
EthEvent, | ||
EthEventListener, | ||
} from 'eth-provider-types'; | ||
import { createFixtureMiddleware } from './middleware/fixture'; | ||
import { createTypedDataSanitizerMiddleware } from './middleware/typed-data-sanitizer'; | ||
import { createTransactionValidatorMiddleware } from './middleware/transaction-validator'; | ||
import { BITSKI_API_BASE_URL, BITSKI_SIGNER_BASE_URL, UNAUTHORIZED_ERRORS } from './constants'; | ||
import { createBlockCacheMiddleware } from './middleware/block-cache'; | ||
import { createSubscriptionMiddleware } from './middleware/subscription'; | ||
import { createFilterMiddleware } from './middleware/filter'; | ||
import { createInflightCacheMiddleware } from 'eth-json-rpc-middleware/dist/inflight-cache'; | ||
import { createChainManagementMiddleware } from './middleware/chain-management'; | ||
import { createEthAccountsMiddleware } from './middleware/eth-accounts'; | ||
import { createSignatureMiddleware } from './middleware/signature'; | ||
import { createFetchRestMiddleware } from './middleware/fetch-rest'; | ||
import { createFetchRpcMiddleware } from './middleware/fetch-rpc'; | ||
import { BitskiProviderConfig, InternalBitskiProviderConfig, RequestContext } from './types'; | ||
import SafeEventEmitter from '@metamask/safe-event-emitter'; | ||
import { BITSKI_API_BASE_URL, BITSKI_SIGNER_BASE_URL, UNAUTHORIZED_ERRORS } from './constants'; | ||
import { createFilterMiddleware } from './middleware/filter'; | ||
import { createFixtureMiddleware } from './middleware/fixture'; | ||
import { createSignatureMiddleware } from './middleware/signature'; | ||
import { createSubscriptionMiddleware } from './middleware/subscription'; | ||
import { createTransactionValidatorMiddleware } from './middleware/transaction-validator'; | ||
import { createTypedDataSanitizerMiddleware } from './middleware/typed-data-sanitizer'; | ||
import createBrowserSigner from './signers/browser'; | ||
import { BitskiProviderStateStore, LocalStorageStore } from './store'; | ||
import { BitskiProviderConfig, InternalBitskiProviderConfig, RequestContext } from './types'; | ||
import { assert, expect } from './utils/type-utils'; | ||
import { createChainManagementMiddleware } from './middleware/chain-management'; | ||
@@ -217,2 +217,3 @@ // global value provided by scripts/insert-package-version.mjs | ||
emit: this.events.emit.bind(this.events), | ||
extra: opts?.extra, | ||
request: (req, opts) => this.requestWithChain(chainId, req, opts), | ||
@@ -219,0 +220,0 @@ addDestructor: (destroy) => this.destructors.push(destroy), |
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
354212
7613