@@ -31,8 +31,10 @@ import { randomAddress } from '../utils/stark';
3131import { ProviderInterface } from './interface' ;
3232import { Block , BlockIdentifier } from './utils' ;
3333
34- export type RpcProviderOptions = { nodeUrl : string } ;
35- type Options = { retries : number } ;
34+ export type RpcProviderOptions = {
35+ nodeUrl : string ;
36+ retries ?: number ;
37+ } ;
3638
3739export class RpcProvider implements ProviderInterface {
3840 public nodeUrl : string ;
@@ -42,12 +44,12 @@ export class RpcProvider implements ProviderInterface {
4244
4345 private responseParser = new RPCResponseParser ( ) ;
4446
45- private options : Options ;
47+ private retries : number ;
4648
47- constructor ( optionsOrProvider : RpcProviderOptions , options : Options ) {
48- const { nodeUrl } = optionsOrProvider ;
49+ constructor ( optionsOrProvider : RpcProviderOptions ) {
50+ const { nodeUrl, retries } = optionsOrProvider ;
4951 this . nodeUrl = nodeUrl ;
50- this . options = options ;
52+ this . retries = retries || 200 ;
5153
5254 this . getChainId ( ) . then ( ( chainId ) => {
5355 this . chainId = chainId ;
@@ -298,7 +300,7 @@ export class RpcProvider implements ProviderInterface {
298300 }
299301
300302 public async waitForTransaction ( txHash : string , retryInterval : number = 8000 ) {
301- let retries = this . options ?. retries || 200 ;
303+ let { retries } = this ;
302304 let onchain = false ;
303305
304306 while ( ! onchain ) {
0 commit comments