-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: add new operations and improve start (#93)
* featimprove start, types, import/export, add checks for netwrok, shortcuts for decoder encoder * fix type issue * update tests * provide ability to use Keystore as a seed for credentials * fix types * up test * initialize keystore by default * add keys operation to Keystore
- Loading branch information
Showing
9 changed files
with
262 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { Keystore } from "./keystore.js"; | ||
import type { DecryptedCredentials, EncryptedCredentials } from "./types.js"; | ||
|
||
export { Keystore }; | ||
export type { EncryptedCredentials, DecryptedCredentials }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
import { ethers } from "ethers"; | ||
|
||
export const extractMetaMaskAccount = | ||
async (): Promise<ethers.providers.Web3Provider> => { | ||
const ethereum = (window as any).ethereum; | ||
|
||
if (!ethereum) { | ||
throw Error( | ||
"Missing or invalid Ethereum provider. Please install a Web3 wallet such as MetaMask." | ||
); | ||
} | ||
|
||
await ethereum.request({ method: "eth_requestAccounts" }); | ||
return new ethers.providers.Web3Provider(ethereum, "any"); | ||
}; | ||
export const extractMetaMaskSigner = async (): Promise<ethers.Signer> => { | ||
const ethereum = (window as any).ethereum; | ||
|
||
if (!ethereum) { | ||
throw Error( | ||
"Missing or invalid Ethereum provider. Please install a Web3 wallet such as MetaMask." | ||
); | ||
} | ||
|
||
await ethereum.request({ method: "eth_requestAccounts" }); | ||
const provider = new ethers.providers.Web3Provider(ethereum, "any"); | ||
|
||
return provider.getSigner(); | ||
}; |
Oops, something went wrong.