1
1
import Fortmatic from "fortmatic"
2
- import { networkToId } from "../../../utilities"
3
2
import fortmaticIcon from "../wallet-icons/icon-fortmatic.svg"
3
+ import { networkName } from "../../../utilities"
4
4
5
5
function fortmatic ( options ) {
6
6
if ( ! options || typeof options !== "object" ) {
@@ -9,25 +9,28 @@ function fortmatic(options) {
9
9
)
10
10
}
11
11
12
- const { apiKey, network } = options
12
+ const { apiKey, networkId } = options
13
13
14
14
if ( ! apiKey || typeof apiKey !== "string" ) {
15
15
throw new Error (
16
16
"A apiKey of type string is required to initialize fortmatic module"
17
17
)
18
18
}
19
19
20
- if ( ! network || typeof network !== "string " ) {
20
+ if ( ! networkId || typeof networkId !== "number " ) {
21
21
throw new Error (
22
- "A network of type string is required to initialize fortmatic module"
22
+ "A networkId of type number is required to initialize fortmatic module"
23
23
)
24
24
}
25
25
26
26
return {
27
27
name : "Fortmatic" ,
28
28
iconSrc : fortmaticIcon ,
29
29
wallet : ( { BigNumber } ) => {
30
- const fortmatic = new Fortmatic ( apiKey , network )
30
+ const fortmatic = new Fortmatic (
31
+ apiKey ,
32
+ networkId === 1 ? undefined : networkName ( networkId )
33
+ )
31
34
const provider = fortmatic . getProvider ( )
32
35
33
36
return {
@@ -39,7 +42,7 @@ function fortmatic(options) {
39
42
get : ( ) => Promise . resolve ( provider . account )
40
43
} ,
41
44
network : {
42
- get : ( ) => Promise . resolve ( networkToId ( network ) )
45
+ get : ( ) => Promise . resolve ( networkId )
43
46
} ,
44
47
balance : {
45
48
get : ( ) =>
0 commit comments