bitski-provider
Advanced tools
Comparing version 0.6.0-alpha.1 to 0.6.0
@@ -7,10 +7,20 @@ import { BlockCacheSubprovider, default as Web3ProviderEngine, DefaultFixtureSubprovider, InflightCacheSubprovider, SanitizerSubprovider, SubscriptionSubprovider, } from '@bitski/provider-engine'; | ||
super(options); | ||
// Handles static responses | ||
this.addProvider(new DefaultFixtureSubprovider()); | ||
// Monitors requests to eth_getTransactionCount and eth_sendTransaction to track | ||
// pending transactions | ||
this.addProvider(new NonceTrackerSubprovider()); | ||
this.addProvider(new TransactionValidatorSubprovider()); | ||
// Sanitizes transaction params, removing anything invalid | ||
this.addProvider(new SanitizerSubprovider()); | ||
const enableValidator = !(options && options.disableValidation === true); | ||
if (enableValidator) { | ||
// Ensures that transactions are well formed (nonce, gas, gasPrice, from) before they are sent to Bitski | ||
this.addProvider(new TransactionValidatorSubprovider()); | ||
} | ||
const enableCache = !(options && options.disableCaching === true); | ||
if (enableCache) { | ||
// Block Cache - caches certain requests by their block number | ||
this.addProvider(new BlockCacheSubprovider()); | ||
} | ||
// Handles subscriptions and filters | ||
const filterAndSubsSubprovider = new SubscriptionSubprovider(); | ||
@@ -22,2 +32,3 @@ filterAndSubsSubprovider.on('data', (err, notification) => { | ||
if (enableCache) { | ||
// Debounces duplicate requests that occur at the same time | ||
this.addProvider(new InflightCacheSubprovider()); | ||
@@ -24,0 +35,0 @@ } |
import { default as Web3ProviderEngine } from '@bitski/provider-engine'; | ||
import { JSONRPCRequestPayload } from 'ethereum-protocol'; | ||
export interface BitskiEngineOptions { | ||
pollingInterval?: number; | ||
disableCaching?: boolean; | ||
disableValidation?: boolean; | ||
} | ||
export declare class BitskiEngine extends Web3ProviderEngine { | ||
constructor(options?: any); | ||
constructor(options?: BitskiEngineOptions); | ||
send(payload: JSONRPCRequestPayload): void; | ||
} |
@@ -25,10 +25,20 @@ var __importStar = (this && this.__importStar) || function (mod) { | ||
super(options); | ||
// Handles static responses | ||
this.addProvider(new provider_engine_1.DefaultFixtureSubprovider()); | ||
// Monitors requests to eth_getTransactionCount and eth_sendTransaction to track | ||
// pending transactions | ||
this.addProvider(new nonce_tracker_1.NonceTrackerSubprovider()); | ||
this.addProvider(new transaction_validator_1.TransactionValidatorSubprovider()); | ||
// Sanitizes transaction params, removing anything invalid | ||
this.addProvider(new provider_engine_1.SanitizerSubprovider()); | ||
const enableValidator = !(options && options.disableValidation === true); | ||
if (enableValidator) { | ||
// Ensures that transactions are well formed (nonce, gas, gasPrice, from) before they are sent to Bitski | ||
this.addProvider(new transaction_validator_1.TransactionValidatorSubprovider()); | ||
} | ||
const enableCache = !(options && options.disableCaching === true); | ||
if (enableCache) { | ||
// Block Cache - caches certain requests by their block number | ||
this.addProvider(new provider_engine_1.BlockCacheSubprovider()); | ||
} | ||
// Handles subscriptions and filters | ||
const filterAndSubsSubprovider = new provider_engine_1.SubscriptionSubprovider(); | ||
@@ -40,2 +50,3 @@ filterAndSubsSubprovider.on('data', (err, notification) => { | ||
if (enableCache) { | ||
// Debounces duplicate requests that occur at the same time | ||
this.addProvider(new provider_engine_1.InflightCacheSubprovider()); | ||
@@ -42,0 +53,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export { BitskiEngine } from './bitski-engine'; | ||
export { BitskiEngine, BitskiEngineOptions } from './bitski-engine'; | ||
export { AccessToken } from './auth/access-token'; | ||
@@ -3,0 +3,0 @@ export { AccessTokenProvider } from './auth/access-token-provider'; |
@@ -12,3 +12,3 @@ { | ||
}, | ||
"version": "0.6.0-alpha.1", | ||
"version": "0.6.0", | ||
"scripts": { | ||
@@ -28,3 +28,3 @@ "test": "jest", | ||
}, | ||
"gitHead": "fd59632778769962b3d10a89a608a471d4aeac07" | ||
"gitHead": "6f93c62271a2a35bc43cfc45068fb64b5e571af0" | ||
} |
@@ -14,17 +14,38 @@ import { | ||
export interface BitskiEngineOptions { | ||
// Frequency to check for new blocks | ||
pollingInterval?: number; | ||
// Disable caching subproviders (useful for debugging) | ||
disableCaching?: boolean; | ||
// Disable transaction validation | ||
disableValidation?: boolean; | ||
} | ||
export class BitskiEngine extends Web3ProviderEngine { | ||
constructor(options?: any) { | ||
constructor(options?: BitskiEngineOptions) { | ||
super(options); | ||
// Handles static responses | ||
this.addProvider(new DefaultFixtureSubprovider()); | ||
// Monitors requests to eth_getTransactionCount and eth_sendTransaction to track | ||
// pending transactions | ||
this.addProvider(new NonceTrackerSubprovider()); | ||
this.addProvider(new TransactionValidatorSubprovider()); | ||
// Sanitizes transaction params, removing anything invalid | ||
this.addProvider(new SanitizerSubprovider()); | ||
const enableValidator = !(options && options.disableValidation === true); | ||
if (enableValidator) { | ||
// Ensures that transactions are well formed (nonce, gas, gasPrice, from) before they are sent to Bitski | ||
this.addProvider(new TransactionValidatorSubprovider()); | ||
} | ||
const enableCache = !(options && options.disableCaching === true); | ||
if (enableCache) { | ||
// Block Cache - caches certain requests by their block number | ||
this.addProvider(new BlockCacheSubprovider()); | ||
} | ||
// Handles subscriptions and filters | ||
const filterAndSubsSubprovider = new SubscriptionSubprovider(); | ||
@@ -38,2 +59,3 @@ filterAndSubsSubprovider.on('data', (err, notification) => { | ||
if (enableCache) { | ||
// Debounces duplicate requests that occur at the same time | ||
this.addProvider(new InflightCacheSubprovider()); | ||
@@ -40,0 +62,0 @@ } |
@@ -1,2 +0,2 @@ | ||
export { BitskiEngine } from './bitski-engine'; | ||
export { BitskiEngine, BitskiEngineOptions } from './bitski-engine'; | ||
export { AccessToken } from './auth/access-token'; | ||
@@ -3,0 +3,0 @@ export { AccessTokenProvider } from './auth/access-token-provider'; |
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
259401
2545