Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelm41 committed Jan 16, 2025
1 parent a233514 commit 2b416a6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const P2_VALUES = {
}

export const DEPTH_LEN = 1
export const VERSION_LEN = 4
export const INDEX_LEN = 4
export const TRANSPARENT_PK_LEN = 33
export const CHAIN_CODE_LEN = 32
Expand Down
3 changes: 3 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
SAPLING_NK_LEN,
SAPLING_OVK_LEN,
TRANSPARENT_PK_LEN,
VERSION_LEN,
} from './consts'
import {
AddressResponse,
Expand Down Expand Up @@ -104,6 +105,7 @@ export default class ZCashApp extends GenericApp {
const responseBuffer = await this.transport.send(CLA, INS.GET_ADDR_SECP256K1_EXT, p1, 0, sentToDevice)
const response = processResponse(responseBuffer)

const version = response.readBytes(VERSION_LEN).readUint32LE()
const depth = response.readBytes(DEPTH_LEN).readUInt8()
const index = response.readBytes(INDEX_LEN).readUint32LE()
const publicKey = response.readBytes(TRANSPARENT_PK_LEN)
Expand All @@ -114,6 +116,7 @@ export default class ZCashApp extends GenericApp {
chainCode,
depth,
index,
version,
}
} catch (error) {
throw processErrorResponse(error)
Expand Down
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type AddressResponse = {
export type AddressExtendedResponse = {
chainCode: Buffer
publicKey: Buffer
version: number
index: number
depth: number
}
Expand Down

0 comments on commit 2b416a6

Please sign in to comment.