File tree Expand file tree Collapse file tree 1 file changed +12
-4
lines changed
Expand file tree Collapse file tree 1 file changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -8,20 +8,25 @@ const batchedProviders = {};
88
99export type ProviderOptions = {
1010 broviderUrl ?: string ;
11+ timeout ?: number ;
1112} ;
1213
1314const DEFAULT_BROVIDER_URL = 'https://rpc.snapshot.org' ;
15+ const DEFAULT_TIMEOUT = 25000 ;
1416
1517export default function getProvider (
1618 network ,
17- { broviderUrl = DEFAULT_BROVIDER_URL } : ProviderOptions = { }
19+ {
20+ broviderUrl = DEFAULT_BROVIDER_URL ,
21+ timeout = DEFAULT_TIMEOUT
22+ } : ProviderOptions = { }
1823) {
1924 const url = `${ broviderUrl } /${ network } ` ;
2025 if ( ! providers [ network ] )
2126 providers [ network ] = new StaticJsonRpcProvider (
2227 {
2328 url,
24- timeout : 25000 ,
29+ timeout,
2530 allowGzip : true
2631 } ,
2732 Number ( network )
@@ -31,13 +36,16 @@ export default function getProvider(
3136
3237export function getBatchedProvider (
3338 network ,
34- { broviderUrl = DEFAULT_BROVIDER_URL } : ProviderOptions = { }
39+ {
40+ broviderUrl = DEFAULT_BROVIDER_URL ,
41+ timeout = DEFAULT_TIMEOUT
42+ } : ProviderOptions = { }
3543) {
3644 const url = `${ broviderUrl } /${ network } ` ;
3745 if ( ! batchedProviders [ network ] )
3846 batchedProviders [ network ] = new JsonRpcBatchProvider ( {
3947 url,
40- timeout : 25000 ,
48+ timeout,
4149 allowGzip : true
4250 } ) ;
4351 return batchedProviders [ network ] ;
You can’t perform that action at this time.
0 commit comments