88 toPrivateKey ,
99} from "../src" ;
1010import { COMMON_DEPLOY_OPTIONS , findEntropyContract } from "./common" ;
11+ import { demandOption } from "yargs" ;
1112
1213const parser = yargs ( hideBin ( process . argv ) )
1314 . usage (
@@ -16,6 +17,11 @@ const parser = yargs(hideBin(process.argv))
1617 "Usage: $0 --private-key <private-key> --chain <chain-id> | --all-chains <testnet|mainnet>" ,
1718 )
1819 . options ( {
20+ provider : {
21+ type : "string" ,
22+ desc : "Provider address to use for the request. Will use the default provider if not specified" ,
23+ demandOption : false ,
24+ } ,
1925 chain : {
2026 type : "string" ,
2127 desc : "test latency for the contract on this chain" ,
@@ -33,8 +39,9 @@ const parser = yargs(hideBin(process.argv))
3339async function testLatency (
3440 contract : EvmEntropyContract ,
3541 privateKey : PrivateKey ,
42+ provider ?: string ,
3643) {
37- const provider = await contract . getDefaultProvider ( ) ;
44+ provider = provider || await contract . getDefaultProvider ( ) ;
3845 const userRandomNumber = contract . generateUserRandomNumber ( ) ;
3946 const requestResponse = await contract . requestRandomness (
4047 userRandomNumber ,
@@ -109,7 +116,7 @@ async function main() {
109116 } else if ( argv . chain ) {
110117 const chain = DefaultStore . getChainOrThrow ( argv . chain , EvmChain ) ;
111118 const contract = findEntropyContract ( chain ) ;
112- await testLatency ( contract , privateKey ) ;
119+ await testLatency ( contract , privateKey , argv . provider ) ;
113120 }
114121}
115122
0 commit comments