Skip to content

modify random wallet generation BaseProvider.ts #821

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
36 changes: 13 additions & 23 deletions packages/lit-auth-client/src/lib/providers/BaseProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,27 +175,22 @@ export abstract class BaseProvider {
}

const litContracts = new LitContracts({
randomPrivatekey: true,
network: this.litNodeClient.config.litNetwork,
signer: new ethers.Wallet(ethers.Wallet.createRandom().privateKey, new ethers.providers.JsonRpcProvider(LIT_RPC.CHRONICLE_YELLOWSTONE)),
network: LIT_NETWORK.DatilDev,
rpc: LIT_RPC.CHRONICLE_YELLOWSTONE
});
try {
await litContracts.connect();
} catch (err) {
throw new UnknownError(
{
cause: err,
},
'Unable to connect to LitContracts'
);
}

console.log("🔄 Connecting to Lit Contracts...");
await litContracts.connect();
console.log("✅ Connected to Lit Contracts");

let pkps: IRelayPKP[] = [];
try {
const pkpPermissions = litContracts.pkpPermissionsContract;
const tokenIds = await pkpPermissions.read.getTokenIdsForAuthMethod(
authMethodType,
authMethodId
authMethod.authMethodType,
await googleProvider.getAuthMethodId(authMethod)
);
const pkps: IRelayPKP[] = [];
for (const tokenId of tokenIds) {
const pubkey = await pkpPermissions.read.getPubkey(tokenId);
if (pubkey) {
Expand All @@ -207,15 +202,10 @@ export abstract class BaseProvider {
});
}
}
return pkps;
} catch (err) {
throw new UnknownError(
{
cause: err,
},
'Unable to get PKPs for auth method'
);
} catch (error) {
console.error("Failed to fetch PKPs from contract:", error);
}
console.log(pkps);
}

/**
Expand Down
Loading