Skip to content

Commit

Permalink
Merge pull request #217 from blocknative/release/4.6.3
Browse files Browse the repository at this point in the history
Release 4.6.3 (master)
  • Loading branch information
lnbc1QWFyb24 authored Dec 1, 2022
2 parents 71da440 + f0a79e9 commit e915763
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "bnc-sdk",
"version": "4.6.2",
"version": "4.6.3",
"description": "SDK to connect to the blocknative backend via a websocket connection",
"keywords": [
"ethereum",
Expand Down
9 changes: 2 additions & 7 deletions src/defaults.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
export const networks: { [key: string]: { [key: string]: string } } = {
bitcoin: {
'1': 'main',
'2': 'testnet'
},
ethereum: {
'1': 'main',
'3': 'ropsten',
'4': 'rinkeby',
'5': 'goerli',
'42': 'kovan',
'56': 'bsc-main',
'100': 'xdai',
'137': 'matic-main',
'250': 'fantom-main',
'80001': 'matic-mumbai'
}
}

export const DEPRECATED_NETWORK_IDS = [2, 42, 56, 250]

export const DEFAULT_RATE_LIMIT_RULES = {
points: 150,
duration: 1
Expand Down
6 changes: 1 addition & 5 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,15 @@ export interface TransactionEvent {
transaction: TransactionData | TransactionEventLog
}

export type System = 'bitcoin' | 'ethereum'
export type System = 'ethereum'

export type Network =
| 'main'
| 'testnet'
| 'ropsten'
| 'rinkeby'
| 'goerli'
| 'kovan'
| 'xdai'
| 'bsc-main'
| 'matic-main'
| 'fantom-main'
| 'matic-mumbai'
| 'local'

Expand Down
8 changes: 7 additions & 1 deletion src/validation.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TransactionHandler } from './types'
import { networks } from './defaults'
import { DEPRECATED_NETWORK_IDS, networks } from './defaults'

export function validateType(options: {
name: string
Expand Down Expand Up @@ -97,6 +97,12 @@ export function validateOptions(options: any): never | void {

validateType({ name: 'networkId', value: networkId, type: 'number' })

if (DEPRECATED_NETWORK_IDS.includes(networkId)) {
console.error(
`Blocknative SDK: Network with ID: ${networkId} has been deprecated and you will no longer receive transaction events on this network.`
)
}

validateType({
name: 'transactionHandler',
value: transactionHandlers,
Expand Down

0 comments on commit e915763

Please sign in to comment.