Skip to content

Commit

Permalink
feat: begin hooking up shielded keys import
Browse files Browse the repository at this point in the history
  • Loading branch information
jurevans committed Jan 7, 2025
1 parent fa92da2 commit 55db48b
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 42 deletions.
1 change: 0 additions & 1 deletion apps/extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@cosmjs/encoding": "^0.29.0",
"@dao-xyz/borsh": "^5.1.5",
"@ledgerhq/hw-transport": "^6.31.4",
"@ledgerhq/hw-transport-webhid": "^6.30.0",
"@ledgerhq/hw-transport-webusb": "^6.29.4",
"@zondax/ledger-namada": "^2.0.0",
"bignumber.js": "^9.1.1",
Expand Down
10 changes: 9 additions & 1 deletion apps/extension/src/Setup/Ledger/LedgerConnect.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { chains } from "@namada/chains";
import { ActionButton, Alert, Image, Stack } from "@namada/components";
import { Ledger as LedgerApp, makeBip44Path } from "@namada/sdk/web";
import {
Ledger as LedgerApp,
makeBip44Path,
makeSaplingPath,
} from "@namada/sdk/web";
import { Bip44Path } from "@namada/types";
import { LedgerError } from "@zondax/ledger-namada";
import { LedgerStep } from "Setup/Common";
Expand Down Expand Up @@ -36,6 +40,10 @@ export const LedgerConnect: React.FC<Props> = ({ path, setPath }) => {
const { address, publicKey } = await ledger.showAddressAndPublicKey(
makeBip44Path(chains.namada.bip44.coinType, path)
);
const { viewingKey, proofGenerationKey } = await ledger.getShieldedKeys(
makeSaplingPath(chains.namada.bip44.coinType, path)
);
console.log("TODO", { viewingKey, proofGenerationKey });
setIsLedgerConnecting(false);
navigate(routes.ledgerImport(), {
state: {
Expand Down
1 change: 0 additions & 1 deletion packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@cosmjs/encoding": "^0.29.0",
"@dao-xyz/borsh": "^5.1.5",
"@ledgerhq/hw-transport": "^6.31.4",
"@ledgerhq/hw-transport-webhid": "^6.30.0",
"@ledgerhq/hw-transport-webusb": "^6.29.4",
"@zondax/ledger-namada": "^2.0.0",
"bignumber.js": "^9.1.1",
Expand Down
6 changes: 1 addition & 5 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
// Make Ledger available for direct-import as it is not dependent on Sdk initialization
export {
Ledger,
initLedgerHIDTransport,
initLedgerUSBTransport,
} from "./ledger";
export { Ledger, initLedgerUSBTransport } from "./ledger";
export type {
LedgerAddressAndPublicKey,
LedgerShieldedKeys,
Expand Down
10 changes: 0 additions & 10 deletions packages/sdk/src/ledger.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Transport from "@ledgerhq/hw-transport";
import TransportHID from "@ledgerhq/hw-transport-webhid";
import TransportUSB from "@ledgerhq/hw-transport-webusb";
import { chains } from "@namada/chains";
import {
Expand Down Expand Up @@ -41,15 +40,6 @@ export const initLedgerUSBTransport = async (): Promise<Transport> => {
return await TransportUSB.create();
};

/**
* Initialize HID transport
* @async
* @returns Transport object
*/
export const initLedgerHIDTransport = async (): Promise<Transport> => {
return await TransportHID.create();
};

export const DEFAULT_LEDGER_BIP44_PATH = makeBip44Path(coinType, {
account: 0,
change: 0,
Expand Down
34 changes: 10 additions & 24 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3221,27 +3221,27 @@ __metadata:
languageName: node
linkType: hard

"@ledgerhq/devices@npm:8.4.4, @ledgerhq/devices@npm:^8.4.4":
version: 8.4.4
resolution: "@ledgerhq/devices@npm:8.4.4"
"@ledgerhq/devices@npm:^8.4.2":
version: 8.4.2
resolution: "@ledgerhq/devices@npm:8.4.2"
dependencies:
"@ledgerhq/errors": "npm:^6.19.1"
"@ledgerhq/errors": "npm:^6.18.0"
"@ledgerhq/logs": "npm:^6.12.0"
rxjs: "npm:^7.8.1"
semver: "npm:^7.3.5"
checksum: ea4c3dada124c5c0aad59837e1c399bf2f41f8b4da5c996aaf73bbf8719082598808947c505dc728266ff83fc5fea71170d3f0d18a9b5d59e6e2737ae8a38f39
checksum: b7149c6302d23928fd2d3622d9018af10a56f6960732de0d72e881d19b75b0036f6248ca0845cfe9dfeda32ecb52c352423e79e109c7decf8437948fed7843cd
languageName: node
linkType: hard

"@ledgerhq/devices@npm:^8.4.2":
version: 8.4.2
resolution: "@ledgerhq/devices@npm:8.4.2"
"@ledgerhq/devices@npm:^8.4.4":
version: 8.4.4
resolution: "@ledgerhq/devices@npm:8.4.4"
dependencies:
"@ledgerhq/errors": "npm:^6.18.0"
"@ledgerhq/errors": "npm:^6.19.1"
"@ledgerhq/logs": "npm:^6.12.0"
rxjs: "npm:^7.8.1"
semver: "npm:^7.3.5"
checksum: b7149c6302d23928fd2d3622d9018af10a56f6960732de0d72e881d19b75b0036f6248ca0845cfe9dfeda32ecb52c352423e79e109c7decf8437948fed7843cd
checksum: ea4c3dada124c5c0aad59837e1c399bf2f41f8b4da5c996aaf73bbf8719082598808947c505dc728266ff83fc5fea71170d3f0d18a9b5d59e6e2737ae8a38f39
languageName: node
linkType: hard

Expand All @@ -3259,18 +3259,6 @@ __metadata:
languageName: node
linkType: hard

"@ledgerhq/hw-transport-webhid@npm:^6.30.0":
version: 6.30.0
resolution: "@ledgerhq/hw-transport-webhid@npm:6.30.0"
dependencies:
"@ledgerhq/devices": "npm:8.4.4"
"@ledgerhq/errors": "npm:^6.19.1"
"@ledgerhq/hw-transport": "npm:^6.31.4"
"@ledgerhq/logs": "npm:^6.12.0"
checksum: 1cb6ddb50127d6cb73d80259e10da687a2b7aa87ebbac8cc3e770ac5b95a3ef0001bdaf77109da0eb62509cb8668a9642858b59cb0ff355c1adb0fe2114c532c
languageName: node
linkType: hard

"@ledgerhq/hw-transport-webusb@npm:^6.29.4":
version: 6.29.4
resolution: "@ledgerhq/hw-transport-webusb@npm:6.29.4"
Expand Down Expand Up @@ -3473,7 +3461,6 @@ __metadata:
"@cosmjs/encoding": "npm:^0.29.0"
"@dao-xyz/borsh": "npm:^5.1.5"
"@ledgerhq/hw-transport": "npm:^6.31.4"
"@ledgerhq/hw-transport-webhid": "npm:^6.30.0"
"@ledgerhq/hw-transport-webusb": "npm:^6.29.4"
"@svgr/webpack": "npm:^6.3.1"
"@types/chrome": "npm:^0.0.237"
Expand Down Expand Up @@ -3754,7 +3741,6 @@ __metadata:
"@cosmjs/encoding": "npm:^0.29.0"
"@dao-xyz/borsh": "npm:^5.1.5"
"@ledgerhq/hw-transport": "npm:^6.31.4"
"@ledgerhq/hw-transport-webhid": "npm:^6.30.0"
"@ledgerhq/hw-transport-webusb": "npm:^6.29.4"
"@release-it/conventional-changelog": "npm:^8.0.1"
"@types/jest": "npm:^29.5.12"
Expand Down

0 comments on commit 55db48b

Please sign in to comment.