@@ -41,29 +41,26 @@ const DEFAULT_APP_VERSION = 'unknown'
4141const DEFAULT_SYSTEM = 'ethereum'
4242
4343class Blocknative {
44- private _storageKey : string
45- private _connectionId : string | undefined
46- private _dappId : string
47- private _system : string
48- private _networkId : number
49- private _appName : string
50- private _appVersion : string
51- private _transactionHandlers : TransactionHandler [ ]
52- private _socket : any
53- private _connected : boolean
54- private _sendMessage : ( msg : EventObject ) => void
55- private _watchedTransactions : Tx [ ]
56- private _watchedAccounts : Ac [ ]
57- private _configurations : Map < string , EnhancedConfig >
58- private _pingTimeout ?: NodeJS . Timeout
59- private _heartbeat ?: ( ) => void
60- private _destroyed : boolean
61- private _onerror : ( ( error : SDKError ) => void ) | undefined
62- private _queuedMessages : EventObject [ ]
63- private _limitRules : LimitRules
64- private _waitToRetry : null | Promise < void >
65- private _processingQueue : boolean
66- private _processQueue : ( ) => Promise < void >
44+ protected _storageKey : string
45+ protected _connectionId : string | undefined
46+ protected _dappId : string
47+ protected _system : string
48+ protected _networkId : number
49+ protected _appName : string
50+ protected _appVersion : string
51+ protected _transactionHandlers : TransactionHandler [ ]
52+ protected _socket : any
53+ protected _connected : boolean
54+ protected _sendMessage : ( msg : EventObject ) => void
55+ protected _pingTimeout ?: NodeJS . Timeout
56+ protected _heartbeat ?: ( ) => void
57+ protected _destroyed : boolean
58+ protected _onerror : ( ( error : SDKError ) => void ) | undefined
59+ protected _queuedMessages : EventObject [ ]
60+ protected _limitRules : LimitRules
61+ protected _waitToRetry : null | Promise < void >
62+ protected _processingQueue : boolean
63+ protected _processQueue : ( ) => Promise < void >
6764
6865 public transaction : Transaction
6966 public account : Account
@@ -72,6 +69,9 @@ class Blocknative {
7269 public unsubscribe : Unsubscribe
7370 public destroy : Destroy
7471 public configuration : Configuration
72+ public watchedTransactions : Tx [ ]
73+ public watchedAccounts : Ac [ ]
74+ public configurations : Map < string , EnhancedConfig >
7575
7676 constructor ( options : InitializationOptions ) {
7777 validateOptions ( options )
@@ -131,9 +131,6 @@ class Blocknative {
131131 this . _socket = socket
132132 this . _connected = false
133133 this . _sendMessage = sendMessage . bind ( this )
134- this . _watchedTransactions = [ ]
135- this . _watchedAccounts = [ ]
136- this . _configurations = new Map ( )
137134 this . _pingTimeout = undefined
138135 this . _destroyed = false
139136 this . _onerror = onerror
@@ -160,6 +157,9 @@ class Blocknative {
160157 }
161158
162159 // public API
160+ this . watchedTransactions = [ ]
161+ this . watchedAccounts = [ ]
162+ this . configurations = new Map ( )
163163 this . transaction = transaction . bind ( this )
164164 this . account = account . bind ( this )
165165 this . event = event . bind ( this )
@@ -219,11 +219,11 @@ async function onReopen(this: any, handler: (() => void) | undefined) {
219219
220220 // re-register all configurations on re-connection
221221 const configurations : EnhancedConfig [ ] = Array . from (
222- this . _configurations . values ( )
222+ this . configurations . values ( )
223223 )
224224
225225 // register global config first and wait for it to complete
226- const globalConfiguration = this . _configurations . get ( 'global' )
226+ const globalConfiguration = this . configurations . get ( 'global' )
227227
228228 if ( globalConfiguration ) {
229229 try {
@@ -256,7 +256,7 @@ async function onReopen(this: any, handler: (() => void) | undefined) {
256256 // re-register all accounts to be watched by server upon
257257 // re-connection as they don't get transferred over automatically
258258 // to the new connection like tx hashes do
259- this . _watchedAccounts . forEach ( ( account : Ac ) => {
259+ this . watchedAccounts . forEach ( ( account : Ac ) => {
260260 this . _sendMessage ( {
261261 eventCode : 'accountAddress' ,
262262 categoryCode : 'watch' ,
0 commit comments