-
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
1 parent
c023487
commit ec0789b
Showing
15 changed files
with
196 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { redirect } from 'react-router-dom'; | ||
import { PopupPath } from './paths'; | ||
import { localExtStorage, sessionExtStorage } from '@penumbra-zone/storage'; | ||
|
||
export const needsLogin = async (): Promise<Response | undefined> => { | ||
const password = await sessionExtStorage.get('passwordKey'); | ||
if (password) return; | ||
|
||
return redirect(PopupPath.LOGIN); | ||
}; | ||
|
||
export const needsOnboard = async () => { | ||
const wallets = await localExtStorage.get('wallets'); | ||
if (wallets.length) return; | ||
|
||
void chrome.runtime.openOptionsPage(); | ||
window.close(); | ||
}; |
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
10 changes: 8 additions & 2 deletions
10
packages/router/src/grpc/view-protocol-server/app-parameters.ts
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,10 +1,16 @@ | ||
import { AppParameters } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/app/v1/app_pb'; | ||
import type { Impl } from '.'; | ||
import { servicesCtx } from '../../ctx'; | ||
|
||
export const appParameters: Impl['appParameters'] = async (_, ctx) => { | ||
const services = ctx.values.get(servicesCtx); | ||
const { indexedDb } = await services.getWalletServices(); | ||
|
||
const subscription = indexedDb.subscribe('APP_PARAMETERS'); | ||
const parameters = await indexedDb.getAppParams(); | ||
if (!parameters) throw new Error('App parameters not available'); | ||
return { parameters }; | ||
if (parameters) return { parameters }; | ||
for await (const update of subscription) | ||
return { parameters: AppParameters.fromJson(update.value) }; | ||
|
||
throw new Error('App parameters not available'); | ||
}; |
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
Oops, something went wrong.