Skip to content

Commit

Permalink
feat(browser-extension-signing-manager): add getCurrentNetwork method
Browse files Browse the repository at this point in the history
Returns the details of the current network to which the extension is connected.
Returns `null` for network agnostic extensions
  • Loading branch information
prashantasdeveloper committed Mar 27, 2023
1 parent 7a64a98 commit b5bf260
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,4 +154,17 @@ export class BrowserExtensionSigningManager implements SigningManager {
const extensions = getExtensions();
return Object.keys(extensions);
}

/**
* Returns the details of current network to which the extension is connected. Returns `null` for network agnostic extensions
*/
public async getCurrentNetwork(): Promise<NetworkInfo | null> {
if (this.extension.network) {
return this.extension.network.get();
}

console.log(`The '${this.extension.name}' extension is network agnostic`);

return null;
}
}

0 comments on commit b5bf260

Please sign in to comment.