-
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
f5ed0c8
commit ae2b745
Showing
18 changed files
with
184 additions
and
93 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
13 changes: 11 additions & 2 deletions
13
packages/router/src/grpc/view-protocol-server/address-by-index.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,13 +1,22 @@ | ||
import type { Impl } from '.'; | ||
import { servicesCtx } from '../../ctx'; | ||
|
||
import { getAddressByIndex } from '@penumbra-zone/wasm-ts'; | ||
import * as wasm from '@penumbra-zone/wasm-ts'; | ||
|
||
import { ConnectError, Code } from '@connectrpc/connect'; | ||
|
||
export const addressByIndex: Impl['addressByIndex'] = async (req, ctx) => { | ||
const services = ctx.values.get(servicesCtx); | ||
const { | ||
viewServer: { fullViewingKey }, | ||
} = await services.getWalletServices(); | ||
const address = getAddressByIndex(fullViewingKey, req.addressIndex?.account ?? 0); | ||
|
||
let address; | ||
try { | ||
address = wasm.getAddressByIndex(fullViewingKey, req.addressIndex?.account ?? 0); | ||
} catch (wasmErr) { | ||
throw new ConnectError('WASM failed to get address by index', Code.Internal); | ||
} | ||
|
||
return { address }; | ||
}; |
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
16 changes: 12 additions & 4 deletions
16
packages/router/src/grpc/view-protocol-server/broadcast-transaction.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
13 changes: 11 additions & 2 deletions
13
packages/router/src/grpc/view-protocol-server/ephemeral-address.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,13 +1,22 @@ | ||
import type { Impl } from '.'; | ||
import { servicesCtx } from '../../ctx'; | ||
|
||
import { getEphemeralByIndex } from '@penumbra-zone/wasm-ts'; | ||
import * as wasm from '@penumbra-zone/wasm-ts'; | ||
|
||
import { ConnectError, Code } from '@connectrpc/connect'; | ||
|
||
export const ephemeralAddress: Impl['ephemeralAddress'] = async (req, ctx) => { | ||
const services = ctx.values.get(servicesCtx); | ||
const { | ||
viewServer: { fullViewingKey }, | ||
} = await services.getWalletServices(); | ||
const address = getEphemeralByIndex(fullViewingKey, req.addressIndex?.account ?? 0); | ||
|
||
let address; | ||
try { | ||
address = wasm.getEphemeralByIndex(fullViewingKey, req.addressIndex?.account ?? 0); | ||
} catch (wasmErr) { | ||
throw new ConnectError('WASM failed to generate address', Code.Internal); | ||
} | ||
|
||
return { address }; | ||
}; |
4 changes: 3 additions & 1 deletion
4
packages/router/src/grpc/view-protocol-server/fmd-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,12 @@ | ||
import type { Impl } from '.'; | ||
import { servicesCtx } from '../../ctx'; | ||
|
||
import { ConnectError, Code } from '@connectrpc/connect'; | ||
|
||
export const fMDParameters: Impl['fMDParameters'] = async (_, ctx) => { | ||
const services = ctx.values.get(servicesCtx); | ||
const { indexedDb } = await services.getWalletServices(); | ||
const parameters = await indexedDb.getFmdParams(); | ||
if (!parameters) throw new Error('No FMD parameters'); | ||
if (!parameters) throw new ConnectError('No FMD parameters', Code.FailedPrecondition); | ||
return { parameters }; | ||
}; |
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
Oops, something went wrong.