-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #425 from LIT-Protocol/feature/lit-2859-js-sdk-dec…
…ouple-ethwalletprovider-from-relayer feat: decouple eth wallet from provider
- Loading branch information
Showing
3 changed files
with
132 additions
and
24 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
e2e-nodejs/group-pkp-auth-method/test-pkp-eth-wallet-provider.mjs
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Test command: | ||
// DEBUG=true NETWORK=cayenne yarn test:e2e:nodejs --filter=test-pkp-eth-wallet-provider.mjs | ||
|
||
import { client } from '../00-setup.mjs'; | ||
import { LitAuthClient } from '@lit-protocol/lit-auth-client'; | ||
import LITCONFIG from '../../lit.config.json' assert { type: 'json' }; | ||
import { success, fail, testThis } from '../../tools/scripts/utils.mjs'; | ||
import path from 'path'; | ||
import { EthWalletProvider } from '@lit-protocol/lit-auth-client'; | ||
import { ethers } from 'ethers'; | ||
|
||
export async function main() { | ||
const PRIVATE_KEY = LITCONFIG.CONTROLLER_PRIVATE_KEY; | ||
|
||
const provider = new ethers.providers.JsonRpcProvider( | ||
LITCONFIG.CHRONICLE_RPC | ||
); | ||
|
||
const wallet = new ethers.Wallet(PRIVATE_KEY, provider); | ||
|
||
const authMethod = await EthWalletProvider.authenticate({ | ||
signer: wallet, | ||
litNodeClient: client, | ||
}); | ||
|
||
if (!authMethod) { | ||
fail('Unable to authenticate with eth wallet provider'); | ||
} | ||
|
||
return success(`authMethod created: ${JSON.stringify(authMethod)}`); | ||
} | ||
|
||
await testThis({ name: path.basename(import.meta.url), fn: main }); |
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