diff --git a/src/consts.ts b/src/consts.ts index 0cbce3e..6998d39 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -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 diff --git a/src/index.ts b/src/index.ts index 3f632b7..ae2129d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -34,6 +34,7 @@ import { SAPLING_NK_LEN, SAPLING_OVK_LEN, TRANSPARENT_PK_LEN, + VERSION_LEN, } from './consts' import { AddressResponse, @@ -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) @@ -114,6 +116,7 @@ export default class ZCashApp extends GenericApp { chainCode, depth, index, + version, } } catch (error) { throw processErrorResponse(error) diff --git a/src/types.ts b/src/types.ts index 27a4245..56b7e67 100644 --- a/src/types.ts +++ b/src/types.ts @@ -22,6 +22,7 @@ export type AddressResponse = { export type AddressExtendedResponse = { chainCode: Buffer publicKey: Buffer + version: number index: number depth: number }