Skip to content

Commit 275fd35

Browse files
committed
Edit fortmatic module to take networkId
1 parent 1853d74 commit 275fd35

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/modules/select/wallets/fortmatic.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Fortmatic from "fortmatic"
2-
import { networkToId } from "../../../utilities"
32
import fortmaticIcon from "../wallet-icons/icon-fortmatic.svg"
3+
import { networkName } from "../../../utilities"
44

55
function fortmatic(options) {
66
if (!options || typeof options !== "object") {
@@ -9,25 +9,28 @@ function fortmatic(options) {
99
)
1010
}
1111

12-
const { apiKey, network } = options
12+
const { apiKey, networkId } = options
1313

1414
if (!apiKey || typeof apiKey !== "string") {
1515
throw new Error(
1616
"A apiKey of type string is required to initialize fortmatic module"
1717
)
1818
}
1919

20-
if (!network || typeof network !== "string") {
20+
if (!networkId || typeof networkId !== "number") {
2121
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"
2323
)
2424
}
2525

2626
return {
2727
name: "Fortmatic",
2828
iconSrc: fortmaticIcon,
2929
wallet: ({ BigNumber }) => {
30-
const fortmatic = new Fortmatic(apiKey, network)
30+
const fortmatic = new Fortmatic(
31+
apiKey,
32+
networkId === 1 ? undefined : networkName(networkId)
33+
)
3134
const provider = fortmatic.getProvider()
3235

3336
return {
@@ -39,7 +42,7 @@ function fortmatic(options) {
3942
get: () => Promise.resolve(provider.account)
4043
},
4144
network: {
42-
get: () => Promise.resolve(networkToId(network))
45+
get: () => Promise.resolve(networkId)
4346
},
4447
balance: {
4548
get: () =>

0 commit comments

Comments
 (0)