Skip to content

Commit

Permalink
Allow connect() to provide the network; v1.1.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuck LeDuc Díaz committed Apr 29, 2020
1 parent b59c2b2 commit daa7f77
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "@lorena-ssi/lorena-sdk",
"version": "1.1.13",
"version": "1.1.14",
"description": "Lorena SDK",
"author": "Alex Puig <alex@caelumlabs.com>",
"license": "MIT",
Expand Down
11 changes: 7 additions & 4 deletions src/index.js
Expand Up @@ -148,8 +148,11 @@ export default class Lorena extends EventEmitter {

/**
* Connect to Lorena IDspace.
*
* @param {string=} network The network to which we will connect
* @returns {boolean} success (or errors thrown)
*/
async connect () {
async connect (network = undefined) {
if (this.ready === true) return true
else if (this.wallet.info.matrixUser) {
try {
Expand All @@ -161,9 +164,9 @@ export default class Lorena extends EventEmitter {
// If we know the DID, get the info for the network of the did
if (this.wallet.info.did && this.wallet.info.did !== '') {
info = LorenaDidResolver.getInfoForDid(this.wallet.info.did)
// If we don't know the did, get it for the network
} else if (this.wallet.info.network) {
info = LorenaDidResolver.getInfoForNetwork(this.wallet.info.network)
// If we don't know the did, get it for the network already specified (or in arguments)
} else if (this.wallet.info.network || network) {
info = LorenaDidResolver.getInfoForNetwork(this.wallet.info.network || network)
// old wallets don't have a network, but they do have a blockchain
} else if (this.wallet.info.blockchainServer) {
// Take the network name from the first position in the hostname
Expand Down

0 comments on commit daa7f77

Please sign in to comment.