@ledgerhq/hw-app-eth
Advanced tools
Comparing version 6.35.7-nightly.2 to 6.36.0-nightly.3
@@ -43,2 +43,3 @@ /// <reference types="node" /> | ||
* @option boolChaincode optionally enable or not the chaincode request | ||
* @option chainId optionally display the network clearly on a Stax device | ||
* @return an object with a publicKey, address and (optionally) chainCode | ||
@@ -48,3 +49,3 @@ * @example | ||
*/ | ||
getAddress(path: string, boolDisplay?: boolean, boolChaincode?: boolean): Promise<{ | ||
getAddress(path: string, boolDisplay?: boolean, boolChaincode?: boolean, chainId?: string): Promise<{ | ||
publicKey: string; | ||
@@ -51,0 +52,0 @@ address: string; |
@@ -10,4 +10,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
}; | ||
import { BigNumber } from "bignumber.js"; | ||
import { log } from "@ledgerhq/logs"; | ||
import { decodeTxInfo, hexBuffer, intAsHexBytes, maybeHexBuffer, splitPath } from "./utils"; | ||
import { decodeTxInfo, hexBuffer, intAsHexBytes, maybeHexBuffer, padHexString, splitPath, } from "./utils"; | ||
import { domainResolutionFlow } from "./modules/Domains"; | ||
@@ -78,2 +79,3 @@ import ledgerService from "./services/ledger"; | ||
* @option boolChaincode optionally enable or not the chaincode request | ||
* @option chainId optionally display the network clearly on a Stax device | ||
* @return an object with a publicKey, address and (optionally) chainCode | ||
@@ -83,5 +85,5 @@ * @example | ||
*/ | ||
getAddress(path, boolDisplay, boolChaincode) { | ||
getAddress(path, boolDisplay, boolChaincode, chainId) { | ||
const paths = splitPath(path); | ||
const buffer = Buffer.alloc(1 + paths.length * 4); | ||
let buffer = Buffer.alloc(1 + paths.length * 4); | ||
buffer[0] = paths.length; | ||
@@ -91,2 +93,8 @@ paths.forEach((element, index) => { | ||
}); | ||
if (chainId) { | ||
const chainIdBufferMask = Buffer.alloc(8, 0); | ||
const chainIdBuffer = Buffer.from(padHexString(new BigNumber(chainId).toString(16)), "hex"); | ||
chainIdBufferMask.write(chainIdBuffer.toString("hex"), chainIdBufferMask.length - chainIdBuffer.length, "hex"); | ||
buffer = Buffer.concat([buffer, chainIdBufferMask]); | ||
} | ||
return this.transport | ||
@@ -93,0 +101,0 @@ .send(0xe0, 0x02, boolDisplay ? 0x01 : 0x00, boolChaincode ? 0x01 : 0x00, buffer) |
@@ -43,2 +43,3 @@ /// <reference types="node" /> | ||
* @option boolChaincode optionally enable or not the chaincode request | ||
* @option chainId optionally display the network clearly on a Stax device | ||
* @return an object with a publicKey, address and (optionally) chainCode | ||
@@ -48,3 +49,3 @@ * @example | ||
*/ | ||
getAddress(path: string, boolDisplay?: boolean, boolChaincode?: boolean): Promise<{ | ||
getAddress(path: string, boolDisplay?: boolean, boolChaincode?: boolean, chainId?: string): Promise<{ | ||
publicKey: string; | ||
@@ -51,0 +52,0 @@ address: string; |
@@ -30,2 +30,3 @@ "use strict"; | ||
exports.ledgerService = void 0; | ||
const bignumber_js_1 = require("bignumber.js"); | ||
const logs_1 = require("@ledgerhq/logs"); | ||
@@ -98,2 +99,3 @@ const utils_1 = require("./utils"); | ||
* @option boolChaincode optionally enable or not the chaincode request | ||
* @option chainId optionally display the network clearly on a Stax device | ||
* @return an object with a publicKey, address and (optionally) chainCode | ||
@@ -103,5 +105,5 @@ * @example | ||
*/ | ||
getAddress(path, boolDisplay, boolChaincode) { | ||
getAddress(path, boolDisplay, boolChaincode, chainId) { | ||
const paths = (0, utils_1.splitPath)(path); | ||
const buffer = Buffer.alloc(1 + paths.length * 4); | ||
let buffer = Buffer.alloc(1 + paths.length * 4); | ||
buffer[0] = paths.length; | ||
@@ -111,2 +113,8 @@ paths.forEach((element, index) => { | ||
}); | ||
if (chainId) { | ||
const chainIdBufferMask = Buffer.alloc(8, 0); | ||
const chainIdBuffer = Buffer.from((0, utils_1.padHexString)(new bignumber_js_1.BigNumber(chainId).toString(16)), "hex"); | ||
chainIdBufferMask.write(chainIdBuffer.toString("hex"), chainIdBufferMask.length - chainIdBuffer.length, "hex"); | ||
buffer = Buffer.concat([buffer, chainIdBufferMask]); | ||
} | ||
return this.transport | ||
@@ -113,0 +121,0 @@ .send(0xe0, 0x02, boolDisplay ? 0x01 : 0x00, boolChaincode ? 0x01 : 0x00, buffer) |
{ | ||
"name": "@ledgerhq/hw-app-eth", | ||
"version": "6.35.7-nightly.2", | ||
"version": "6.36.0-nightly.3", | ||
"description": "Ledger Hardware Wallet Ethereum Application API", | ||
@@ -34,3 +34,3 @@ "keywords": [ | ||
"@ledgerhq/cryptoassets": "^11.5.0-nightly.0", | ||
"@ledgerhq/domain-service": "^1.1.19-nightly.2", | ||
"@ledgerhq/domain-service": "^1.1.19-nightly.3", | ||
"@ledgerhq/errors": "^6.16.3-nightly.1", | ||
@@ -41,3 +41,3 @@ "@ledgerhq/evm-tools": "^1.0.17-nightly.0", | ||
"@ledgerhq/logs": "^6.12.0", | ||
"@ledgerhq/types-live": "^6.45.0-nightly.1" | ||
"@ledgerhq/types-live": "^6.45.0-nightly.2" | ||
}, | ||
@@ -44,0 +44,0 @@ "gitHead": "dd0dea64b58e5a9125c8a422dcffd29e5ef6abec", |
@@ -123,2 +123,3 @@ <img src="https://user-images.githubusercontent.com/4631227/191834116-59cf590e-25cc-4956-ae5c-812ea464f324.png" height="100" /> | ||
* `boolChaincode` **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean)?**  | ||
* `chainId` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)?**  | ||
@@ -125,0 +126,0 @@ ##### Examples |
@@ -24,3 +24,10 @@ /******************************************************************************** | ||
import { log } from "@ledgerhq/logs"; | ||
import { decodeTxInfo, hexBuffer, intAsHexBytes, maybeHexBuffer, splitPath } from "./utils"; | ||
import { | ||
decodeTxInfo, | ||
hexBuffer, | ||
intAsHexBytes, | ||
maybeHexBuffer, | ||
padHexString, | ||
splitPath, | ||
} from "./utils"; | ||
import { domainResolutionFlow } from "./modules/Domains"; | ||
@@ -110,2 +117,3 @@ import ledgerService from "./services/ledger"; | ||
* @option boolChaincode optionally enable or not the chaincode request | ||
* @option chainId optionally display the network clearly on a Stax device | ||
* @return an object with a publicKey, address and (optionally) chainCode | ||
@@ -119,2 +127,3 @@ * @example | ||
boolChaincode?: boolean, | ||
chainId?: string, | ||
): Promise<{ | ||
@@ -126,3 +135,3 @@ publicKey: string; | ||
const paths = splitPath(path); | ||
const buffer = Buffer.alloc(1 + paths.length * 4); | ||
let buffer = Buffer.alloc(1 + paths.length * 4); | ||
buffer[0] = paths.length; | ||
@@ -132,2 +141,14 @@ paths.forEach((element, index) => { | ||
}); | ||
if (chainId) { | ||
const chainIdBufferMask = Buffer.alloc(8, 0); | ||
const chainIdBuffer = Buffer.from(padHexString(new BigNumber(chainId).toString(16)), "hex"); | ||
chainIdBufferMask.write( | ||
chainIdBuffer.toString("hex"), | ||
chainIdBufferMask.length - chainIdBuffer.length, | ||
"hex", | ||
); | ||
buffer = Buffer.concat([buffer, chainIdBufferMask]); | ||
} | ||
return this.transport | ||
@@ -134,0 +155,0 @@ .send(0xe0, 0x02, boolDisplay ? 0x01 : 0x00, boolChaincode ? 0x01 : 0x00, buffer) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1997809
22711
563