File tree Expand file tree Collapse file tree 2 files changed +8
-30
lines changed
src/modules/select/wallets Expand file tree Collapse file tree 2 files changed +8
-30
lines changed Original file line number Diff line number Diff line change 1
1
import Fortmatic from "fortmatic"
2
2
import fortmaticIcon from "../wallet-icons/icon-fortmatic.svg"
3
3
import { networkName } from "../../../utilities"
4
+ import { validateType } from "../../../validation"
4
5
5
6
function fortmatic ( options ) {
6
- if ( ! options || typeof options !== "object" ) {
7
- throw new Error (
8
- "An options object is required to initialize fortmatic module"
9
- )
10
- }
7
+ validateType ( { name : "Fortmatic options" , value : options , type : "object" } )
11
8
12
9
const { apiKey, networkId } = options
13
10
14
- if ( ! apiKey || typeof apiKey !== "string" ) {
15
- throw new Error (
16
- "A apiKey of type string is required to initialize fortmatic module"
17
- )
18
- }
19
-
20
- if ( ! networkId || typeof networkId !== "number" ) {
21
- throw new Error (
22
- "A networkId of type number is required to initialize fortmatic module"
23
- )
24
- }
11
+ validateType ( { name : "apiKey" , value : apiKey , type : "string" } )
12
+ validateType ( { name : "networkId" , value : networkId , type : "number" } )
25
13
26
14
return {
27
15
name : "Fortmatic" ,
Original file line number Diff line number Diff line change 1
1
import Portis from "@portis/web3"
2
2
3
3
import { networkName } from "../../../utilities"
4
+ import { validateType } from "../../../validation"
4
5
import portisIcon from "../wallet-icons/icon-portis.svg"
5
6
6
7
function portis ( options ) {
7
- if ( ! options || typeof options !== "object" ) {
8
- throw new Error ( "An options object is required to initialize portis module" )
9
- }
8
+ validateType ( { name : "Portis options" , value : options , type : "object" } )
10
9
11
10
const { apiKey, networkId } = options
12
11
13
- if ( ! apiKey || typeof apiKey !== "string" ) {
14
- throw new Error (
15
- "A apiKey of type string is required to initialize portis module"
16
- )
17
- }
18
-
19
- if ( ! networkId || typeof networkId !== "number" ) {
20
- throw new Error (
21
- "A network of type number is required to initialize portis module"
22
- )
23
- }
12
+ validateType ( { name : "apiKey" , value : apiKey , type : "string" } )
13
+ validateType ( { name : "networkId" , value : networkId , type : "number" } )
24
14
25
15
return {
26
16
name : "Portis" ,
You can’t perform that action at this time.
0 commit comments