-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
152 additions
and
129 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
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
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,47 +1,26 @@ | ||
import WalletConnectProvider from '@walletconnect/web3-provider' | ||
import { ThreeIdConnect, EthereumAuthProvider } from '@3id/connect' | ||
import Authereum from 'authereum' | ||
import type { DIDProvider } from 'dids' | ||
import Fortmatic from 'fortmatic' | ||
import Web3Modal from 'web3modal' | ||
import WalletConnectProvider from "@walletconnect/web3-provider"; | ||
import { ThreeIdConnect, EthereumAuthProvider } from "@3id/connect"; | ||
import Authereum from "authereum"; | ||
import type { DIDProvider } from "dids"; | ||
import Fortmatic from "fortmatic"; | ||
import Web3Modal from "web3modal"; | ||
import LitJsSdk from "lit-js-sdk"; | ||
|
||
// @ts-ignore | ||
export const threeID = new ThreeIdConnect() | ||
|
||
export const web3Modal = new Web3Modal({ | ||
network: 'mainnet', | ||
disableInjectedProvider: false, | ||
cacheProvider: true, | ||
providerOptions: { | ||
walletconnect: { | ||
package: WalletConnectProvider, | ||
options: { | ||
infuraId: 'e87f83fb85bf4aa09bdf6605ebe144b7', | ||
}, | ||
}, | ||
fortmatic: { | ||
package: Fortmatic, | ||
options: { | ||
key: 'pk_live_EC842EEAC7F08995', | ||
}, | ||
}, | ||
authereum: { | ||
package: Authereum, | ||
options: {}, | ||
}, | ||
}, | ||
}) | ||
export const threeID = new ThreeIdConnect(); | ||
|
||
export async function getProvider(): Promise<DIDProvider> { | ||
const ethProvider = await web3Modal.connect() | ||
const addresses = await ethProvider.enable() | ||
await threeID.connect(new EthereumAuthProvider(ethProvider, addresses[0])) | ||
return threeID.getDidProvider() | ||
// const ethProvider = await web3Modal.connect() | ||
// const addresses = await ethProvider.enable() | ||
const { web3, account } = await LitJsSdk.connectWeb3(); | ||
await threeID.connect(new EthereumAuthProvider(web3, account)); | ||
return threeID.getDidProvider(); | ||
} | ||
|
||
export async function getAddress(): Promise<String> { | ||
const ethProvider = await web3Modal.connect() | ||
const addresses = await ethProvider.enable() | ||
const addr = addresses[0] | ||
return addr | ||
// const ethProvider = await web3Modal.connect() | ||
// const addresses = await ethProvider.enable() | ||
// const addr = addresses[0] | ||
const { web3, account } = await LitJsSdk.connectWeb3(); | ||
return account; | ||
} |
Oops, something went wrong.