File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -12,15 +12,16 @@ import { IConfigData } from '@dequanto/config/interface/IConfigData';
12
12
export namespace Web3ClientFactory {
13
13
14
14
export function get ( platform : TPlatform | number , opts ?: IWeb3EndpointOptions ) {
15
- let options = $config . getWeb3Options ( platform ) ;
16
- if ( options . platform === 'hardhat' || options . platform . startsWith ( 'hh:' ) ) {
15
+ if ( typeof platform === 'string' && ( platform === 'hardhat' || platform . startsWith ( 'hh:' ) ) ) {
17
16
let client = di . resolve ( HardhatProvider ) . client ( 'localhost' , opts ) ;
18
- if ( options . platform . startsWith ( 'hh:' ) ) {
19
- client . configureFork ( options . platform . slice ( 3 ) ) ;
17
+ if ( platform . startsWith ( 'hh:' ) ) {
18
+ client . configureFork ( platform . slice ( 3 ) ) ;
20
19
}
21
20
return client ;
22
21
}
23
22
23
+
24
+ let options = $config . getWeb3Options ( platform ) ;
24
25
$require . notNull ( options , `Unsupported platform ${ platform } for web3 client` )
25
26
return new EvmWeb3Client ( {
26
27
...options ,
Original file line number Diff line number Diff line change @@ -48,6 +48,10 @@ export namespace $config {
48
48
} else {
49
49
platform = mix ;
50
50
}
51
+ if ( platform . startsWith ( 'hh:' ) ) {
52
+ // Hardhat fork
53
+ return { platform } as any ;
54
+ }
51
55
52
56
let web3Config = web3 [ platform ] ;
53
57
if ( web3Config == null ) {
Original file line number Diff line number Diff line change 1
- import { Bscscan } from '@dequanto/explorer/Bscscan' ;
2
1
import { $http } from '@dequanto/utils/$http' ;
3
2
import { File } from 'atma-io'
3
+ import { BlockchainExplorerFactory } from '@dequanto/explorer/BlockchainExplorerFactory' ;
4
4
5
5
UTest ( {
6
6
async $before ( ) {
@@ -16,7 +16,7 @@ UTest({
16
16
} ,
17
17
18
18
async 'should fetch ABI by similar ByteCode' ( ) {
19
- let bscscan = new Bscscan ( ) ;
19
+ let bscscan = BlockchainExplorerFactory . get ( 'bsc' ) ;
20
20
let { abi } = await bscscan . getContractAbi ( '0xfbD2aa7efA2B46Ce3c58D7ab0D92C176c71499C0' ) ;
21
21
eq_ ( typeof abi , 'string' ) ;
22
22
has_ ( abi , 'uint256' ) ;
You can’t perform that action at this time.
0 commit comments