File tree Expand file tree Collapse file tree 5 files changed +151
-84
lines changed Expand file tree Collapse file tree 5 files changed +151
-84
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ export interface Initialization {
7
7
darkMode ?: boolean
8
8
apiUrl ?: string
9
9
hideBranding ?: boolean
10
+ pollingInterval ?: number
10
11
}
11
12
12
13
export interface Subscriptions {
@@ -181,6 +182,7 @@ export interface WalletConnectOptions extends CommonWalletOptions {
181
182
[ key : string ] : string
182
183
}
183
184
bridge : string
185
+ pollingInterval : number
184
186
}
185
187
186
188
export interface TrezorOptions extends CommonWalletOptions {
Original file line number Diff line number Diff line change @@ -12,9 +12,12 @@ function createProvider(config: any) {
12
12
processMessage,
13
13
processPersonalMessage,
14
14
signMessage,
15
- signPersonalMessage
15
+ signPersonalMessage,
16
+ pollingInterval
16
17
} = config
17
18
19
+ console . log ( "from inside provider engine : " , { pollingInterval} )
20
+
18
21
const idMgmt =
19
22
getAccounts &&
20
23
new HookedWalletSubprovider ( {
@@ -30,7 +33,7 @@ function createProvider(config: any) {
30
33
rpcUrl : rpcUrl . includes ( 'http' ) ? rpcUrl : `https://${ rpcUrl } `
31
34
} )
32
35
33
- const provider = new Web3ProviderEngine ( )
36
+ const provider = new Web3ProviderEngine ( { pollingInterval } )
34
37
35
38
provider . addProvider ( new SubscriptionSubprovider ( ) )
36
39
provider . addProvider ( new FilterSubprovider ( ) )
Original file line number Diff line number Diff line change @@ -17,9 +17,12 @@ function walletConnect(
17
17
label,
18
18
iconSrc,
19
19
svg,
20
- networkId
20
+ networkId,
21
+ pollingInterval
21
22
} = options
22
23
24
+ console . log ( { pollingInterval} )
25
+
23
26
if ( ! infuraKey ) {
24
27
if ( ! rpc || ! rpc [ networkId ] ) {
25
28
throw new Error (
@@ -45,12 +48,16 @@ function walletConnect(
45
48
? rpc [ networkId ]
46
49
: `https://${ networkName ( networkId ) } .infura.io/v3/${ infuraKey } `
47
50
48
- const balanceProvider = createProvider ( { rpcUrl } )
51
+ const balanceProvider = createProvider ( {
52
+ rpcUrl,
53
+ pollingInterval
54
+ } )
49
55
50
56
const provider = new WalletConnectProvider ( {
51
57
infuraId : infuraKey ,
52
58
rpc,
53
- bridge
59
+ bridge,
60
+ pollingInterval
54
61
} )
55
62
56
63
provider . autoRefreshOnNetworkChange = false
Original file line number Diff line number Diff line change @@ -64,6 +64,7 @@ export function validateInit(init: Initialization): never | void {
64
64
darkMode,
65
65
apiUrl,
66
66
hideBranding,
67
+ pollingInterval,
67
68
...otherParams
68
69
} = init
69
70
@@ -77,7 +78,8 @@ export function validateInit(init: Initialization): never | void {
77
78
'walletCheck' ,
78
79
'darkMode' ,
79
80
'apiUrl' ,
80
- 'hideBranding'
81
+ 'hideBranding' ,
82
+ 'pollingInterval'
81
83
] ,
82
84
'init'
83
85
)
@@ -107,6 +109,12 @@ export function validateInit(init: Initialization): never | void {
107
109
type : 'boolean' ,
108
110
optional : true
109
111
} )
112
+ validateType ( {
113
+ name : 'pollingInterval' ,
114
+ value : pollingInterval ,
115
+ type : 'number' ,
116
+ optional : true
117
+ } )
110
118
111
119
validateType ( {
112
120
name : 'subscriptions' ,
@@ -640,7 +648,8 @@ export function validateWalletInit(
640
648
'rpcUri' ,
641
649
'webUri' ,
642
650
'xsUri' ,
643
- 'blockedPopupRedirect'
651
+ 'blockedPopupRedirect' ,
652
+ 'pollingInterval'
644
653
] ,
645
654
'walletInitObject'
646
655
)
You can’t perform that action at this time.
0 commit comments