Skip to content

Commit

Permalink
allow network params to be customized for Torus
Browse files Browse the repository at this point in the history
  • Loading branch information
pedrouid committed May 4, 2020
1 parent dfba926 commit 9c418b5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/providers/connectors/torus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IAbstractConnectorOptions } from "../../helpers";

interface NetworkInterface {
interface NetworkParams {
host:
| "mainnet"
| "rinkeby"
Expand Down Expand Up @@ -37,6 +37,7 @@ export interface IOptions {
export interface ITorusConnectorOptions extends IAbstractConnectorOptions {
config?: IOptions;
loginParams?: LoginParams;
networkParams?: NetworkParams;
}

// Supports Torus package versions 0.2.*
Expand All @@ -49,11 +50,12 @@ const ConnectToTorus = async (Torus: any, opts: ITorusConnectorOptions) => {
let enableLogging = true;
let showTorusButton = false;
let enabledVerifiers = {};
let network: NetworkInterface = { host: "mainnet" };
let network: NetworkParams = { host: "mainnet" };
let defaultVerifier = undefined;

// parsing to Torus interfaces
network = opts.network ? { host: opts.network } : network;
network =
opts.networkParams || opts.network ? { host: opts.network } : network;

if (opts.config) {
buttonPosition = opts.config.buttonPosition || buttonPosition;
Expand Down

0 comments on commit 9c418b5

Please sign in to comment.