talking to the nodes now...

This commit is contained in:
Chris Cassano 2022-11-08 16:32:07 -08:00
parent 515ff13d45
commit cdfb5c2be6
5 changed files with 34 additions and 7 deletions

2
.gitignore vendored
View File

@ -21,3 +21,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.yalc

View File

@ -9,7 +9,7 @@
"@testing-library/user-event": "^13.5.0",
"ethers": "^5.7.2",
"js-base64": "^3.7.2",
"lit-js-sdk": "^1.1.234",
"lit-js-sdk": "file:.yalc/lit-js-sdk",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",

View File

@ -3,6 +3,7 @@ import "./App.css";
import { GoogleLogin } from "@react-oauth/google";
import { ethers } from "ethers";
import { Base64 } from "js-base64";
import LitJsSdk from "lit-js-sdk";
import PKPHelper from "./abis/PKPHelper.json";
import PKPNFT from "./abis/PKPNFT.json";
@ -61,11 +62,27 @@ function App() {
console.log("mintingReceipt: ", mintingReceipt);
const tokenIdFromEvent = mintingReceipt.events[2].topics[3];
const ethAddress = await pkpContract.getEthAddress(tokenIdFromEvent);
console.log("minted PKP with eth address: ", ethAddress);
setPkpEthAddress(ethAddress);
console.log("minted PKP with eth address: ", ethAddress);
const pkpPublicKey = await pkpContract.getPubkey(tokenIdFromEvent);
// get the user a session with it
const fakeSessionKey = "0x1234567890";
const litNodeClient = new LitJsSdk.LitNodeClient();
await litNodeClient.connect();
const fakeSessionKey = "lit:session:0x1234567890";
const sessionSig = await litNodeClient.signSessionKey({
sessionKey: fakeSessionKey,
authMethods: [
{
authMethodType: 6,
accessToken: credentialResponse.credential,
},
],
pkpPublicKey,
});
console.log("sessionSig: ", sessionSig);
};
return (
<div className="App">

10
yalc.lock Normal file
View File

@ -0,0 +1,10 @@
{
"version": "v1",
"packages": {
"lit-js-sdk": {
"signature": "24bc7659933f393b3330aee609498caf",
"file": true,
"replaced": "^1.1.234"
}
}
}

View File

@ -6884,10 +6884,8 @@ lit-connect-modal@^0.1.10:
dependencies:
micromodal "^0.4.10"
lit-js-sdk@^1.1.234:
version "1.1.234"
resolved "https://registry.yarnpkg.com/lit-js-sdk/-/lit-js-sdk-1.1.234.tgz#1bdd9985b09078e816fe242930d98e618e8f76e5"
integrity sha512-jriua+Igavu5kbGYxMuUxmNrd4TfMXGNoG3hNoBA0+FyTYvYo9assYegWkP8w8vTW2FGC5qJDhNvFf0pOAfgWQ==
"lit-js-sdk@file:.yalc/lit-js-sdk":
version "1.2.25"
dependencies:
"@ethersproject/bytes" "^5.5.0"
"@ethersproject/contracts" "^5.2.0"