@@ -174,49 +174,38 @@ export abstract class BaseProvider {
174174 ) ;
175175 }
176176
177- const wallet = ethers . Wallet . createRandom ( ) ;
178177 const litContracts = new LitContracts ( {
179- signer : wallet ,
180- network : this . litNodeClient . config . litNetwork ,
178+ signer : new ethers . Wallet ( ethers . Wallet . createRandom ( ) . privateKey , new ethers . providers . JsonRpcProvider ( LIT_RPC . CHRONICLE_YELLOWSTONE ) ) ,
179+ network : LIT_NETWORK . DatilDev ,
180+ rpc : LIT_RPC . CHRONICLE_YELLOWSTONE
181181 } ) ;
182- try {
183- await litContracts . connect ( ) ;
184- } catch ( err ) {
185- throw new UnknownError (
186- {
187- cause : err ,
188- } ,
189- 'Unable to connect to LitContracts'
190- ) ;
191- }
192182
183+ console . log ( "🔄 Connecting to Lit Contracts..." ) ;
184+ await litContracts . connect ( ) ;
185+ console . log ( "✅ Connected to Lit Contracts" ) ;
186+
187+ let pkps : IRelayPKP [ ] = [ ] ;
193188 try {
194- const pkpPermissions = litContracts . pkpPermissionsContract ;
195- const tokenIds = await pkpPermissions . read . getTokenIdsForAuthMethod (
196- authMethodType ,
197- authMethodId
198- ) ;
199- const pkps : IRelayPKP [ ] = [ ] ;
200- for ( const tokenId of tokenIds ) {
201- const pubkey = await pkpPermissions . read . getPubkey ( tokenId ) ;
202- if ( pubkey ) {
203- const ethAddress = ethers . utils . computeAddress ( pubkey ) ;
204- pkps . push ( {
205- tokenId : tokenId . toString ( ) ,
206- publicKey : pubkey ,
207- ethAddress : ethAddress ,
208- } ) ;
189+ const pkpPermissions = litContracts . pkpPermissionsContract ;
190+ const tokenIds = await pkpPermissions . read . getTokenIdsForAuthMethod (
191+ authMethod . authMethodType ,
192+ await googleProvider . getAuthMethodId ( authMethod )
193+ ) ;
194+ for ( const tokenId of tokenIds ) {
195+ const pubkey = await pkpPermissions . read . getPubkey ( tokenId ) ;
196+ if ( pubkey ) {
197+ const ethAddress = ethers . utils . computeAddress ( pubkey ) ;
198+ pkps . push ( {
199+ tokenId : tokenId . toString ( ) ,
200+ publicKey : pubkey ,
201+ ethAddress : ethAddress ,
202+ } ) ;
203+ }
209204 }
210- }
211- return pkps ;
212- } catch ( err ) {
213- throw new UnknownError (
214- {
215- cause : err ,
216- } ,
217- 'Unable to get PKPs for auth method'
218- ) ;
205+ } catch ( error ) {
206+ console . error ( "Failed to fetch PKPs from contract:" , error ) ;
219207 }
208+ console . log ( pkps ) ;
220209 }
221210
222211 /**
0 commit comments