@avalabs/hw-app-avalanche
Advanced tools
Comparing version 0.7.1 to 0.8.0
@@ -1,57 +0,17 @@ | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var _a; | ||
exports.__esModule = true; | ||
exports.getVersion = exports.processErrorResponse = exports.errorCodeToString = exports.ERROR_DESCRIPTION = exports.LedgerError = exports.P1_VALUES = exports.PAYLOAD_TYPE = exports.INS = exports.VERSION_1 = exports.TYPE_1 = exports.CONTRACT_ADDRESS_LEN = exports.CHAIN_ID_SIZE = exports.COLLECTION_NAME_MAX_LEN = exports.HASH_LEN = exports.NEXT_MESSAGE = exports.LAST_MESSAGE = exports.FIRST_MESSAGE = exports.APP_KEY = exports.CHUNK_SIZE = exports.CLA_ETH = exports.CLA = void 0; | ||
exports.CLA = 0x80; | ||
exports.CLA_ETH = 0xe0; | ||
exports.CHUNK_SIZE = 250; | ||
exports.APP_KEY = 'AVAX'; | ||
exports.FIRST_MESSAGE = 0x01; | ||
exports.LAST_MESSAGE = 0x02; | ||
exports.NEXT_MESSAGE = 0x03; | ||
exports.HASH_LEN = 32; | ||
export const CLA = 0x80; | ||
export const CLA_ETH = 0xe0; | ||
export const CHUNK_SIZE = 250; | ||
export const APP_KEY = 'AVAX'; | ||
export const FIRST_MESSAGE = 0x01; | ||
export const LAST_MESSAGE = 0x02; | ||
export const NEXT_MESSAGE = 0x03; | ||
export const HASH_LEN = 32; | ||
// the max collection len is set to 70-bytes | ||
// lets decrease it to 50 to save some stack | ||
exports.COLLECTION_NAME_MAX_LEN = 50; | ||
exports.CHAIN_ID_SIZE = 8; | ||
exports.CONTRACT_ADDRESS_LEN = 20; | ||
exports.TYPE_1 = 1; | ||
exports.VERSION_1 = 1; | ||
exports.INS = { | ||
export const COLLECTION_NAME_MAX_LEN = 50; | ||
export const CHAIN_ID_SIZE = 8; | ||
export const CONTRACT_ADDRESS_LEN = 20; | ||
export const TYPE_1 = 1; | ||
export const VERSION_1 = 1; | ||
export const INS = { | ||
GET_VERSION: 0x00, | ||
@@ -64,14 +24,14 @@ WALLET_ID: 0x01, | ||
SIGN_MSG: 0x06, | ||
ETH_PROVIDE_NFT_INFO: 0x14 | ||
ETH_PROVIDE_NFT_INFO: 0x14, | ||
}; | ||
exports.PAYLOAD_TYPE = { | ||
export const PAYLOAD_TYPE = { | ||
INIT: 0x00, | ||
ADD: 0x01, | ||
LAST: 0x02 | ||
LAST: 0x02, | ||
}; | ||
exports.P1_VALUES = { | ||
export const P1_VALUES = { | ||
ONLY_RETRIEVE: 0x00, | ||
SHOW_ADDRESS_IN_DEVICE: 0x01 | ||
SHOW_ADDRESS_IN_DEVICE: 0x01, | ||
}; | ||
var LedgerError; | ||
export var LedgerError; | ||
(function (LedgerError) { | ||
@@ -100,37 +60,36 @@ LedgerError[LedgerError["U2FUnknown"] = 1] = "U2FUnknown"; | ||
LedgerError[LedgerError["SignVerifyError"] = 28417] = "SignVerifyError"; | ||
})(LedgerError = exports.LedgerError || (exports.LedgerError = {})); | ||
exports.ERROR_DESCRIPTION = (_a = {}, | ||
_a[LedgerError.U2FUnknown] = 'U2F: Unknown', | ||
_a[LedgerError.U2FBadRequest] = 'U2F: Bad request', | ||
_a[LedgerError.U2FConfigurationUnsupported] = 'U2F: Configuration unsupported', | ||
_a[LedgerError.U2FDeviceIneligible] = 'U2F: Device Ineligible', | ||
_a[LedgerError.U2FTimeout] = 'U2F: Timeout', | ||
_a[LedgerError.Timeout] = 'Timeout', | ||
_a[LedgerError.NoErrors] = 'No errors', | ||
_a[LedgerError.DeviceIsBusy] = 'Device is busy', | ||
_a[LedgerError.ErrorDerivingKeys] = 'Error deriving keys', | ||
_a[LedgerError.ExecutionError] = 'Execution Error', | ||
_a[LedgerError.WrongLength] = 'Wrong Length', | ||
_a[LedgerError.EmptyBuffer] = 'Empty Buffer', | ||
_a[LedgerError.OutputBufferTooSmall] = 'Output buffer too small', | ||
_a[LedgerError.DataIsInvalid] = 'Data is invalid', | ||
_a[LedgerError.ConditionsNotSatisfied] = 'Conditions not satisfied', | ||
_a[LedgerError.TransactionRejected] = 'Transaction rejected', | ||
_a[LedgerError.BadKeyHandle] = 'Bad key handle', | ||
_a[LedgerError.InvalidP1P2] = 'Invalid P1/P2', | ||
_a[LedgerError.InstructionNotSupported] = 'Instruction not supported', | ||
_a[LedgerError.AppDoesNotSeemToBeOpen] = 'App does not seem to be open', | ||
_a[LedgerError.UnknownError] = 'Unknown error', | ||
_a[LedgerError.SignVerifyError] = 'Sign/verify error', | ||
_a); | ||
function errorCodeToString(statusCode) { | ||
if (statusCode in exports.ERROR_DESCRIPTION) | ||
return exports.ERROR_DESCRIPTION[statusCode]; | ||
return "Unknown Status Code: ".concat(statusCode); | ||
})(LedgerError || (LedgerError = {})); | ||
export const ERROR_DESCRIPTION = { | ||
[LedgerError.U2FUnknown]: 'U2F: Unknown', | ||
[LedgerError.U2FBadRequest]: 'U2F: Bad request', | ||
[LedgerError.U2FConfigurationUnsupported]: 'U2F: Configuration unsupported', | ||
[LedgerError.U2FDeviceIneligible]: 'U2F: Device Ineligible', | ||
[LedgerError.U2FTimeout]: 'U2F: Timeout', | ||
[LedgerError.Timeout]: 'Timeout', | ||
[LedgerError.NoErrors]: 'No errors', | ||
[LedgerError.DeviceIsBusy]: 'Device is busy', | ||
[LedgerError.ErrorDerivingKeys]: 'Error deriving keys', | ||
[LedgerError.ExecutionError]: 'Execution Error', | ||
[LedgerError.WrongLength]: 'Wrong Length', | ||
[LedgerError.EmptyBuffer]: 'Empty Buffer', | ||
[LedgerError.OutputBufferTooSmall]: 'Output buffer too small', | ||
[LedgerError.DataIsInvalid]: 'Data is invalid', | ||
[LedgerError.ConditionsNotSatisfied]: 'Conditions not satisfied', | ||
[LedgerError.TransactionRejected]: 'Transaction rejected', | ||
[LedgerError.BadKeyHandle]: 'Bad key handle', | ||
[LedgerError.InvalidP1P2]: 'Invalid P1/P2', | ||
[LedgerError.InstructionNotSupported]: 'Instruction not supported', | ||
[LedgerError.AppDoesNotSeemToBeOpen]: 'App does not seem to be open', | ||
[LedgerError.UnknownError]: 'Unknown error', | ||
[LedgerError.SignVerifyError]: 'Sign/verify error', | ||
}; | ||
export function errorCodeToString(statusCode) { | ||
if (statusCode in ERROR_DESCRIPTION) | ||
return ERROR_DESCRIPTION[statusCode]; | ||
return `Unknown Status Code: ${statusCode}`; | ||
} | ||
exports.errorCodeToString = errorCodeToString; | ||
function isDict(v) { | ||
return typeof v === 'object' && v !== null && !(v instanceof Array) && !(v instanceof Date); | ||
} | ||
function processErrorResponse(response) { | ||
export function processErrorResponse(response) { | ||
if (response) { | ||
@@ -141,3 +100,3 @@ if (isDict(response)) { | ||
returnCode: response.statusCode, | ||
errorMessage: errorCodeToString(response.statusCode) | ||
errorMessage: errorCodeToString(response.statusCode), | ||
}; | ||
@@ -151,3 +110,3 @@ } | ||
returnCode: 0xffff, | ||
errorMessage: response.toString() | ||
errorMessage: response.toString(), | ||
}; | ||
@@ -157,32 +116,26 @@ } | ||
returnCode: 0xffff, | ||
errorMessage: response.toString() | ||
errorMessage: response.toString(), | ||
}; | ||
} | ||
exports.processErrorResponse = processErrorResponse; | ||
function getVersion(transport) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, transport.send(exports.CLA, exports.INS.GET_VERSION, 0, 0).then(function (response) { | ||
var errorCodeData = response.slice(-2); | ||
var returnCode = (errorCodeData[0] * 256 + errorCodeData[1]); | ||
var targetId = 0; | ||
if (response.length >= 9) { | ||
/* eslint-disable no-bitwise */ | ||
targetId = (response[5] << 24) + (response[6] << 16) + (response[7] << 8) + (response[8] << 0); | ||
/* eslint-enable no-bitwise */ | ||
} | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: errorCodeToString(returnCode), | ||
testMode: response[0] !== 0, | ||
major: response[1], | ||
minor: response[2], | ||
patch: response[3], | ||
deviceLocked: response[4] === 1, | ||
targetId: targetId.toString(16) | ||
}; | ||
}, processErrorResponse)]; | ||
}); | ||
}); | ||
export async function getVersion(transport) { | ||
return transport.send(CLA, INS.GET_VERSION, 0, 0).then(response => { | ||
const errorCodeData = response.slice(-2); | ||
const returnCode = (errorCodeData[0] * 256 + errorCodeData[1]); | ||
let targetId = 0; | ||
if (response.length >= 9) { | ||
/* eslint-disable no-bitwise */ | ||
targetId = (response[5] << 24) + (response[6] << 16) + (response[7] << 8) + (response[8] << 0); | ||
/* eslint-enable no-bitwise */ | ||
} | ||
return { | ||
returnCode, | ||
errorMessage: errorCodeToString(returnCode), | ||
testMode: response[0] !== 0, | ||
major: response[1], | ||
minor: response[2], | ||
patch: response[3], | ||
deviceLocked: response[4] === 1, | ||
targetId: targetId.toString(16), | ||
}; | ||
}, processErrorResponse); | ||
} | ||
exports.getVersion = getVersion; |
@@ -1,7 +0,4 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
exports.serializeChainID = exports.serializeHrp = exports.serializePathSuffix = exports.serializePath = exports.pathCoinType = void 0; | ||
var bs58_1 = require("bs58"); | ||
var HARDENED = 0x80000000; | ||
function pathCoinType(path) { | ||
import { decode as bs58_decode } from 'bs58'; | ||
const HARDENED = 0x80000000; | ||
export function pathCoinType(path) { | ||
if (!path.startsWith('m')) { | ||
@@ -11,23 +8,22 @@ throw new Error('Path should start with "m" (e.g "m/44\'/5757\'/5\'/0/3")'); | ||
//skip the first element (m) | ||
var pathArray = path.split('/').slice(1); | ||
var maybe44 = Number(pathArray[0].slice(0, -1)); | ||
const pathArray = path.split('/').slice(1); | ||
const maybe44 = Number(pathArray[0].slice(0, -1)); | ||
if (maybe44 != 44) { | ||
throw new Error("Path's first element should be \"44\", got ".concat(maybe44, " (e.g \"m/44'/5757'/5'/0/3\")")); | ||
throw new Error(`Path's first element should be "44", got ${maybe44} (e.g "m/44'/5757'/5'/0/3")`); | ||
} | ||
return pathArray[1]; | ||
} | ||
exports.pathCoinType = pathCoinType; | ||
function serializePath(path) { | ||
export function serializePath(path) { | ||
if (!path.startsWith('m')) { | ||
throw new Error('Path should start with "m" (e.g "m/44\'/5757\'/5\'/0/3")'); | ||
} | ||
var pathArray = path.split('/'); | ||
const pathArray = path.split('/'); | ||
if (pathArray.length !== 6 && pathArray.length !== 5 && pathArray.length !== 4) { | ||
throw new Error("Invalid path. (e.g \"m/44'/5757'/5'/0/3\")"); | ||
} | ||
var buf = Buffer.alloc(1 + (pathArray.length - 1) * 4); | ||
const buf = Buffer.alloc(1 + (pathArray.length - 1) * 4); | ||
buf.writeUInt8(pathArray.length - 1); //first byte is the path length | ||
for (var i = 1; i < pathArray.length; i += 1) { | ||
var value = 0; | ||
var child = pathArray[i]; | ||
for (let i = 1; i < pathArray.length; i += 1) { | ||
let value = 0; | ||
let child = pathArray[i]; | ||
if (child.endsWith("'")) { | ||
@@ -37,5 +33,5 @@ value += HARDENED; | ||
} | ||
var childNumber = Number(child); | ||
const childNumber = Number(child); | ||
if (Number.isNaN(childNumber)) { | ||
throw new Error("Invalid path : ".concat(child, " is not a number. (e.g \"m/44'/461'/5'/0/3\")")); | ||
throw new Error(`Invalid path : ${child} is not a number. (e.g "m/44'/461'/5'/0/3")`); | ||
} | ||
@@ -50,22 +46,21 @@ if (childNumber >= HARDENED) { | ||
} | ||
exports.serializePath = serializePath; | ||
function serializePathSuffix(path) { | ||
export function serializePathSuffix(path) { | ||
if (path.startsWith('m')) { | ||
throw new Error('Path suffix do not start with "m" (e.g "0/3")'); | ||
} | ||
var pathArray = path.split('/'); | ||
const pathArray = path.split('/'); | ||
if (pathArray.length !== 2) { | ||
throw new Error('Invalid path suffix. (e.g "0/3")'); | ||
} | ||
var buf = Buffer.alloc(1 + pathArray.length * 4); | ||
const buf = Buffer.alloc(1 + pathArray.length * 4); | ||
buf.writeUInt8(pathArray.length); //first byte is the path length | ||
for (var i = 0; i < pathArray.length; i += 1) { | ||
var value = 0; | ||
var child = pathArray[i]; | ||
for (let i = 0; i < pathArray.length; i += 1) { | ||
let value = 0; | ||
const child = pathArray[i]; | ||
if (child.endsWith("'")) { | ||
throw new Error('Invalid hardened path suffix. (e.g "0/3")'); | ||
} | ||
var childNumber = Number(child); | ||
const childNumber = Number(child); | ||
if (Number.isNaN(childNumber)) { | ||
throw new Error("Invalid path : ".concat(child, " is not a number. (e.g \"0/3\")")); | ||
throw new Error(`Invalid path : ${child} is not a number. (e.g "0/3")`); | ||
} | ||
@@ -80,6 +75,5 @@ if (childNumber >= HARDENED) { | ||
} | ||
exports.serializePathSuffix = serializePathSuffix; | ||
function serializeHrp(hrp) { | ||
export function serializeHrp(hrp) { | ||
if (hrp) { | ||
var bufHrp = Buffer.from(hrp, 'ascii'); | ||
const bufHrp = Buffer.from(hrp, 'ascii'); | ||
return Buffer.concat([Buffer.alloc(1, bufHrp.length), bufHrp]); | ||
@@ -91,6 +85,5 @@ } | ||
} | ||
exports.serializeHrp = serializeHrp; | ||
function serializeChainID(chainid) { | ||
export function serializeChainID(chainid) { | ||
if (chainid) { | ||
var decoded = (0, bs58_1.decode)(chainid); | ||
let decoded = bs58_decode(chainid); | ||
if (decoded.length == 36) { | ||
@@ -109,2 +102,1 @@ //chop checksum off | ||
} | ||
exports.serializeChainID = serializeChainID; |
@@ -1,129 +0,46 @@ | ||
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); | ||
}; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
exports.__esModule = true; | ||
exports.LedgerError = void 0; | ||
var common_1 = require("./common"); | ||
exports.LedgerError = common_1.LedgerError; | ||
var helper_1 = require("./helper"); | ||
var hw_app_eth_1 = __importDefault(require("@ledgerhq/hw-app-eth")); | ||
__exportStar(require("./types"), exports); | ||
import { CHAIN_ID_SIZE, CHUNK_SIZE, CLA, CLA_ETH, COLLECTION_NAME_MAX_LEN, CONTRACT_ADDRESS_LEN, errorCodeToString, FIRST_MESSAGE, getVersion, HASH_LEN, INS, LAST_MESSAGE, LedgerError, NEXT_MESSAGE, P1_VALUES, PAYLOAD_TYPE, processErrorResponse, TYPE_1, VERSION_1, } from './common'; | ||
import { pathCoinType, serializeChainID, serializeHrp, serializePath, serializePathSuffix } from './helper'; | ||
import Eth from '@ledgerhq/hw-app-eth'; | ||
export * from './types'; | ||
export { LedgerError }; | ||
function processGetAddrResponse(response) { | ||
var partialResponse = response; | ||
var errorCodeData = partialResponse.slice(-2); | ||
var returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
let partialResponse = response; | ||
const errorCodeData = partialResponse.slice(-2); | ||
const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
//get public key len (variable) | ||
var PKLEN = partialResponse[0]; | ||
var publicKey = Buffer.from(partialResponse.slice(1, 1 + PKLEN)); | ||
const PKLEN = partialResponse[0]; | ||
const publicKey = Buffer.from(partialResponse.slice(1, 1 + PKLEN)); | ||
//"advance" buffer | ||
partialResponse = partialResponse.slice(1 + PKLEN); | ||
var hash = Buffer.from(partialResponse.slice(0, 20)); | ||
const hash = Buffer.from(partialResponse.slice(0, 20)); | ||
//"advance" buffer | ||
partialResponse = partialResponse.slice(20); | ||
var address = Buffer.from(partialResponse.subarray(0, -2)).toString(); | ||
const address = Buffer.from(partialResponse.subarray(0, -2)).toString(); | ||
return { | ||
publicKey: publicKey, | ||
hash: hash, | ||
address: address, | ||
returnCode: returnCode, | ||
errorMessage: (0, common_1.errorCodeToString)(returnCode) | ||
publicKey, | ||
hash, | ||
address, | ||
returnCode, | ||
errorMessage: errorCodeToString(returnCode), | ||
}; | ||
} | ||
function processGetXPubResponse(response) { | ||
var partialResponse = response; | ||
var errorCodeData = partialResponse.slice(-2); | ||
var returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
let partialResponse = response; | ||
const errorCodeData = partialResponse.slice(-2); | ||
const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
//get public key len (variable) | ||
var PKLEN = partialResponse[0]; | ||
var publicKey = Buffer.from(partialResponse.slice(1, 1 + PKLEN)); | ||
const PKLEN = partialResponse[0]; | ||
const publicKey = Buffer.from(partialResponse.slice(1, 1 + PKLEN)); | ||
//"advance" buffer | ||
partialResponse = partialResponse.slice(1 + PKLEN); | ||
var chain_code = Buffer.from(partialResponse.slice(0, -2)); | ||
const chain_code = Buffer.from(partialResponse.slice(0, -2)); | ||
return { | ||
publicKey: publicKey, | ||
chain_code: chain_code, | ||
returnCode: returnCode, | ||
errorMessage: (0, common_1.errorCodeToString)(returnCode) | ||
publicKey, | ||
chain_code, | ||
returnCode, | ||
errorMessage: errorCodeToString(returnCode), | ||
}; | ||
} | ||
var AvalancheApp = /** @class */ (function () { | ||
function AvalancheApp(transport, ethScrambleKey, ethLoadConfig) { | ||
if (ethScrambleKey === void 0) { ethScrambleKey = 'w0w'; } | ||
if (ethLoadConfig === void 0) { ethLoadConfig = {}; } | ||
export default class AvalancheApp { | ||
constructor(transport, ethScrambleKey = 'w0w', ethLoadConfig = {}) { | ||
this.transport = transport; | ||
@@ -133,6 +50,6 @@ if (!transport) { | ||
} | ||
this.eth = new hw_app_eth_1["default"](transport, ethScrambleKey, ethLoadConfig); | ||
this.eth = new Eth(transport, ethScrambleKey, ethLoadConfig); | ||
} | ||
AvalancheApp.prepareChunks = function (message, serializedPathBuffer) { | ||
var chunks = []; | ||
static prepareChunks(message, serializedPathBuffer) { | ||
const chunks = []; | ||
// First chunk (only path) | ||
@@ -143,6 +60,6 @@ if (serializedPathBuffer !== undefined) { | ||
} | ||
var messageBuffer = Buffer.from(message); | ||
var buffer = Buffer.concat([messageBuffer]); | ||
for (var i = 0; i < buffer.length; i += common_1.CHUNK_SIZE) { | ||
var end = i + common_1.CHUNK_SIZE; | ||
const messageBuffer = Buffer.from(message); | ||
const buffer = Buffer.concat([messageBuffer]); | ||
for (let i = 0; i < buffer.length; i += CHUNK_SIZE) { | ||
let end = i + CHUNK_SIZE; | ||
if (i > buffer.length) { | ||
@@ -154,22 +71,17 @@ end = buffer.length; | ||
return chunks; | ||
}; | ||
AvalancheApp.prototype.signGetChunks = function (message, path) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
if (path === undefined) { | ||
return [2 /*return*/, AvalancheApp.prepareChunks(message, Buffer.alloc(0))]; | ||
} | ||
else { | ||
return [2 /*return*/, AvalancheApp.prepareChunks(message, (0, helper_1.serializePath)(path))]; | ||
} | ||
return [2 /*return*/]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.concatMessageAndChangePath = function (message, path) { | ||
} | ||
async signGetChunks(message, path) { | ||
if (path === undefined) { | ||
return AvalancheApp.prepareChunks(message, Buffer.alloc(0)); | ||
} | ||
else { | ||
return AvalancheApp.prepareChunks(message, serializePath(path)); | ||
} | ||
} | ||
concatMessageAndChangePath(message, path) { | ||
// data | ||
var msg = Buffer.concat([message]); | ||
const msg = Buffer.concat([message]); | ||
// no change_path | ||
if (path === undefined) { | ||
var buffer = Buffer.alloc(1); | ||
const buffer = Buffer.alloc(1); | ||
buffer.writeUInt8(0); | ||
@@ -179,224 +91,159 @@ return Buffer.concat([buffer, msg]); | ||
else { | ||
var buffer_1 = Buffer.alloc(1); | ||
buffer_1.writeUInt8(path.length); | ||
path.forEach(function (element) { | ||
buffer_1 = Buffer.concat([buffer_1, (0, helper_1.serializePathSuffix)(element)]); | ||
let buffer = Buffer.alloc(1); | ||
buffer.writeUInt8(path.length); | ||
path.forEach(element => { | ||
buffer = Buffer.concat([buffer, serializePathSuffix(element)]); | ||
}); | ||
return Buffer.concat([buffer_1, msg]); | ||
return Buffer.concat([buffer, msg]); | ||
} | ||
}; | ||
AvalancheApp.prototype.signSendChunk = function (chunkIdx, chunkNum, chunk, param, ins) { | ||
if (ins === void 0) { ins = common_1.INS.SIGN; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var payloadType, p2; | ||
return __generator(this, function (_a) { | ||
payloadType = common_1.PAYLOAD_TYPE.ADD; | ||
p2 = 0; | ||
if (chunkIdx === 1) { | ||
payloadType = common_1.PAYLOAD_TYPE.INIT; | ||
if (param === undefined) { | ||
throw Error('number type not given'); | ||
} | ||
p2 = param; | ||
} | ||
async signSendChunk(chunkIdx, chunkNum, chunk, param, ins = INS.SIGN) { | ||
let payloadType = PAYLOAD_TYPE.ADD; | ||
let p2 = 0; | ||
if (chunkIdx === 1) { | ||
payloadType = PAYLOAD_TYPE.INIT; | ||
if (param === undefined) { | ||
throw Error('number type not given'); | ||
} | ||
p2 = param; | ||
} | ||
if (chunkIdx === chunkNum) { | ||
payloadType = PAYLOAD_TYPE.LAST; | ||
} | ||
return this.transport | ||
.send(CLA, ins, payloadType, p2, chunk, [ | ||
LedgerError.NoErrors, | ||
LedgerError.DataIsInvalid, | ||
LedgerError.BadKeyHandle, | ||
LedgerError.SignVerifyError, | ||
]) | ||
.then((response) => { | ||
const errorCodeData = response.slice(-2); | ||
const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
let errorMessage = errorCodeToString(returnCode); | ||
if (returnCode === LedgerError.BadKeyHandle || | ||
returnCode === LedgerError.DataIsInvalid || | ||
returnCode === LedgerError.SignVerifyError) { | ||
errorMessage = `${errorMessage} : ${response.slice(0, response.length - 2).toString('ascii')}`; | ||
} | ||
if (returnCode === LedgerError.NoErrors && response.length > 2) { | ||
return { | ||
hash: null, | ||
signature: null, | ||
returnCode: returnCode, | ||
errorMessage: errorMessage, | ||
}; | ||
} | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: errorMessage, | ||
}; | ||
}, processErrorResponse); | ||
} | ||
async signHash(path_prefix, signing_paths, hash) { | ||
if (hash.length !== HASH_LEN) { | ||
throw new Error('Invalid hash length'); | ||
} | ||
//send hash and path | ||
const first_response = await this.transport | ||
.send(CLA, INS.SIGN_HASH, FIRST_MESSAGE, 0x00, Buffer.concat([serializePath(path_prefix), hash]), [LedgerError.NoErrors]) | ||
.then((response) => { | ||
const errorCodeData = response.slice(-2); | ||
const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
let errorMessage = errorCodeToString(returnCode); | ||
if (returnCode === LedgerError.BadKeyHandle || returnCode === LedgerError.DataIsInvalid) { | ||
errorMessage = `${errorMessage} : ${response.slice(0, response.length - 2).toString('ascii')}`; | ||
} | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: errorMessage, | ||
}; | ||
}, processErrorResponse); | ||
if (first_response.returnCode !== LedgerError.NoErrors) { | ||
return first_response; | ||
} | ||
return this._signAndCollect(signing_paths); | ||
} | ||
async _signAndCollect(signing_paths) { | ||
// base response object to output on each iteration | ||
const result = { | ||
returnCode: LedgerError.NoErrors, | ||
errorMessage: '', | ||
hash: null, | ||
signatures: null, | ||
}; | ||
// where each pair path_suffix, signature are stored | ||
const signatures = new Map(); | ||
for (let idx = 0; idx < signing_paths.length; idx++) { | ||
const suffix = signing_paths[idx]; | ||
const path_buf = serializePathSuffix(suffix); | ||
const p1 = idx >= signing_paths.length - 1 ? LAST_MESSAGE : NEXT_MESSAGE; | ||
// send path to sign hash that should be in device's ram memory | ||
await this.transport | ||
.send(CLA, INS.SIGN_HASH, p1, 0x00, path_buf, [ | ||
LedgerError.NoErrors, | ||
LedgerError.DataIsInvalid, | ||
LedgerError.BadKeyHandle, | ||
LedgerError.SignVerifyError, | ||
]) | ||
.then((response) => { | ||
const errorCodeData = response.slice(-2); | ||
const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
const errorMessage = errorCodeToString(returnCode); | ||
if (returnCode === LedgerError.BadKeyHandle || | ||
returnCode === LedgerError.DataIsInvalid || | ||
returnCode === LedgerError.SignVerifyError) { | ||
result.errorMessage = `${errorMessage} : ${response.slice(0, response.length - 2).toString('ascii')}`; | ||
} | ||
if (chunkIdx === chunkNum) { | ||
payloadType = common_1.PAYLOAD_TYPE.LAST; | ||
if (returnCode === LedgerError.NoErrors && response.length > 2) { | ||
signatures.set(suffix, response.slice(0, -2)); | ||
} | ||
return [2 /*return*/, this.transport | ||
.send(common_1.CLA, ins, payloadType, p2, chunk, [ | ||
common_1.LedgerError.NoErrors, | ||
common_1.LedgerError.DataIsInvalid, | ||
common_1.LedgerError.BadKeyHandle, | ||
common_1.LedgerError.SignVerifyError, | ||
]) | ||
.then(function (response) { | ||
var errorCodeData = response.slice(-2); | ||
var returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
var errorMessage = (0, common_1.errorCodeToString)(returnCode); | ||
if (returnCode === common_1.LedgerError.BadKeyHandle || | ||
returnCode === common_1.LedgerError.DataIsInvalid || | ||
returnCode === common_1.LedgerError.SignVerifyError) { | ||
errorMessage = "".concat(errorMessage, " : ").concat(response.slice(0, response.length - 2).toString('ascii')); | ||
} | ||
if (returnCode === common_1.LedgerError.NoErrors && response.length > 2) { | ||
return { | ||
hash: null, | ||
signature: null, | ||
returnCode: returnCode, | ||
errorMessage: errorMessage | ||
}; | ||
} | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: errorMessage | ||
}; | ||
}, common_1.processErrorResponse)]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.signHash = function (path_prefix, signing_paths, hash) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var first_response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (hash.length !== common_1.HASH_LEN) { | ||
throw new Error('Invalid hash length'); | ||
} | ||
return [4 /*yield*/, this.transport | ||
.send(common_1.CLA, common_1.INS.SIGN_HASH, common_1.FIRST_MESSAGE, 0x00, Buffer.concat([(0, helper_1.serializePath)(path_prefix), hash]), [common_1.LedgerError.NoErrors]) | ||
.then(function (response) { | ||
var errorCodeData = response.slice(-2); | ||
var returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
var errorMessage = (0, common_1.errorCodeToString)(returnCode); | ||
if (returnCode === common_1.LedgerError.BadKeyHandle || returnCode === common_1.LedgerError.DataIsInvalid) { | ||
errorMessage = "".concat(errorMessage, " : ").concat(response.slice(0, response.length - 2).toString('ascii')); | ||
} | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: errorMessage | ||
}; | ||
}, common_1.processErrorResponse)]; | ||
case 1: | ||
first_response = _a.sent(); | ||
if (first_response.returnCode !== common_1.LedgerError.NoErrors) { | ||
return [2 /*return*/, first_response]; | ||
} | ||
return [2 /*return*/, this._signAndCollect(signing_paths)]; | ||
result.returnCode = returnCode; | ||
result.errorMessage = errorMessage; | ||
return; | ||
}, processErrorResponse); | ||
if (result.returnCode !== LedgerError.NoErrors) { | ||
break; | ||
} | ||
} | ||
result.signatures = signatures; | ||
return result; | ||
} | ||
async sign(path_prefix, signing_paths, message, change_paths) { | ||
// Do not show outputs that go to the signers | ||
let paths = signing_paths; | ||
if (change_paths !== undefined) { | ||
// remove duplication just is case | ||
paths = [...new Set([...paths, ...change_paths])]; | ||
} | ||
// Prepend change_paths to the message as the device do set which outputs should be | ||
// shown at parsing | ||
const msg = this.concatMessageAndChangePath(message, paths); | ||
// Send transaction for review | ||
const response = await this.signGetChunks(msg, path_prefix).then(chunks => { | ||
return this.signSendChunk(1, chunks.length, chunks[0], FIRST_MESSAGE, INS.SIGN).then(async (response) => { | ||
// initialize response | ||
let result = { | ||
returnCode: response.returnCode, | ||
errorMessage: response.errorMessage, | ||
signatures: null, | ||
}; | ||
// send chunks | ||
for (let i = 1; i < chunks.length; i += 1) { | ||
// eslint-disable-next-line no-await-in-loop | ||
result = await this.signSendChunk(1 + i, chunks.length, chunks[i], NEXT_MESSAGE, INS.SIGN); | ||
if (result.returnCode !== LedgerError.NoErrors) { | ||
break; | ||
} | ||
} | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype._signAndCollect = function (signing_paths) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var result, signatures, _loop_1, this_1, idx, state_1; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
result = { | ||
returnCode: common_1.LedgerError.NoErrors, | ||
errorMessage: '', | ||
hash: null, | ||
signatures: null | ||
}; | ||
signatures = new Map(); | ||
_loop_1 = function (idx) { | ||
var suffix, path_buf, p1; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
suffix = signing_paths[idx]; | ||
path_buf = (0, helper_1.serializePathSuffix)(suffix); | ||
p1 = idx >= signing_paths.length - 1 ? common_1.LAST_MESSAGE : common_1.NEXT_MESSAGE; | ||
// send path to sign hash that should be in device's ram memory | ||
return [4 /*yield*/, this_1.transport | ||
.send(common_1.CLA, common_1.INS.SIGN_HASH, p1, 0x00, path_buf, [ | ||
common_1.LedgerError.NoErrors, | ||
common_1.LedgerError.DataIsInvalid, | ||
common_1.LedgerError.BadKeyHandle, | ||
common_1.LedgerError.SignVerifyError, | ||
]) | ||
.then(function (response) { | ||
var errorCodeData = response.slice(-2); | ||
var returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
var errorMessage = (0, common_1.errorCodeToString)(returnCode); | ||
if (returnCode === common_1.LedgerError.BadKeyHandle || | ||
returnCode === common_1.LedgerError.DataIsInvalid || | ||
returnCode === common_1.LedgerError.SignVerifyError) { | ||
result.errorMessage = "".concat(errorMessage, " : ").concat(response.slice(0, response.length - 2).toString('ascii')); | ||
} | ||
if (returnCode === common_1.LedgerError.NoErrors && response.length > 2) { | ||
signatures.set(suffix, response.slice(0, -2)); | ||
} | ||
result.returnCode = returnCode; | ||
result.errorMessage = errorMessage; | ||
return; | ||
}, common_1.processErrorResponse)]; | ||
case 1: | ||
// send path to sign hash that should be in device's ram memory | ||
_b.sent(); | ||
if (result.returnCode !== common_1.LedgerError.NoErrors) { | ||
return [2 /*return*/, "break"]; | ||
} | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}; | ||
this_1 = this; | ||
idx = 0; | ||
_a.label = 1; | ||
case 1: | ||
if (!(idx < signing_paths.length)) return [3 /*break*/, 4]; | ||
return [5 /*yield**/, _loop_1(idx)]; | ||
case 2: | ||
state_1 = _a.sent(); | ||
if (state_1 === "break") | ||
return [3 /*break*/, 4]; | ||
_a.label = 3; | ||
case 3: | ||
idx++; | ||
return [3 /*break*/, 1]; | ||
case 4: | ||
result.signatures = signatures; | ||
return [2 /*return*/, result]; | ||
} | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.sign = function (path_prefix, signing_paths, message, change_paths) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var paths, msg, response; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
paths = signing_paths; | ||
if (change_paths !== undefined) { | ||
// remove duplication just is case | ||
paths = __spreadArray([], __read(new Set(__spreadArray(__spreadArray([], __read(paths), false), __read(change_paths), false))), false); | ||
} | ||
msg = this.concatMessageAndChangePath(message, paths); | ||
return [4 /*yield*/, this.signGetChunks(msg, path_prefix).then(function (chunks) { | ||
return _this.signSendChunk(1, chunks.length, chunks[0], common_1.FIRST_MESSAGE, common_1.INS.SIGN).then(function (response) { return __awaiter(_this, void 0, void 0, function () { | ||
var result, i; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
result = { | ||
returnCode: response.returnCode, | ||
errorMessage: response.errorMessage, | ||
signatures: null | ||
}; | ||
i = 1; | ||
_a.label = 1; | ||
case 1: | ||
if (!(i < chunks.length)) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, this.signSendChunk(1 + i, chunks.length, chunks[i], common_1.NEXT_MESSAGE, common_1.INS.SIGN)]; | ||
case 2: | ||
// eslint-disable-next-line no-await-in-loop | ||
result = _a.sent(); | ||
if (result.returnCode !== common_1.LedgerError.NoErrors) { | ||
return [3 /*break*/, 4]; | ||
} | ||
_a.label = 3; | ||
case 3: | ||
i += 1; | ||
return [3 /*break*/, 1]; | ||
case 4: return [2 /*return*/, result]; | ||
} | ||
}); | ||
}); }, common_1.processErrorResponse); | ||
}, common_1.processErrorResponse)]; | ||
case 1: | ||
response = _a.sent(); | ||
if (response.returnCode !== common_1.LedgerError.NoErrors) { | ||
return [2 /*return*/, response]; | ||
} | ||
// Transaction was approved so start iterating over signing_paths to sign | ||
// and collect each signature | ||
return [2 /*return*/, this._signAndCollect(signing_paths)]; | ||
} | ||
}); | ||
}); | ||
}; | ||
return result; | ||
}, processErrorResponse); | ||
}, processErrorResponse); | ||
if (response.returnCode !== LedgerError.NoErrors) { | ||
return response; | ||
} | ||
// Transaction was approved so start iterating over signing_paths to sign | ||
// and collect each signature | ||
return this._signAndCollect(signing_paths); | ||
} | ||
// Sign an arbitrary message. | ||
@@ -406,201 +253,140 @@ // This function takes in an avax path prefix like: m/44'/9000'/0'/0' | ||
// message: The message to be signed | ||
AvalancheApp.prototype.signMsg = function (path_prefix, signing_paths, message) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var coinType, header, content, msgSize, avax_msg, response; | ||
var _this = this; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
coinType = (0, helper_1.pathCoinType)(path_prefix); | ||
if (coinType !== "9000'") { | ||
throw new Error('Only avax path is supported'); | ||
} | ||
header = Buffer.from('\x1AAvalanche Signed Message:\n', 'utf8'); | ||
content = Buffer.from(message, 'utf8'); | ||
msgSize = Buffer.alloc(4); | ||
msgSize.writeUInt32BE(content.length, 0); | ||
avax_msg = Buffer.from("".concat(header).concat(msgSize).concat(content), 'utf8'); | ||
return [4 /*yield*/, this.signGetChunks(avax_msg, path_prefix).then(function (chunks) { | ||
return _this.signSendChunk(1, chunks.length, chunks[0], common_1.FIRST_MESSAGE, common_1.INS.SIGN_MSG).then(function (response) { return __awaiter(_this, void 0, void 0, function () { | ||
var result, i; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
result = { | ||
returnCode: response.returnCode, | ||
errorMessage: response.errorMessage, | ||
signatures: null | ||
}; | ||
i = 1; | ||
_a.label = 1; | ||
case 1: | ||
if (!(i < chunks.length)) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, this.signSendChunk(1 + i, chunks.length, chunks[i], common_1.NEXT_MESSAGE, common_1.INS.SIGN_MSG)]; | ||
case 2: | ||
// eslint-disable-next-line no-await-in-loop | ||
result = _a.sent(); | ||
if (result.returnCode !== common_1.LedgerError.NoErrors) { | ||
return [3 /*break*/, 4]; | ||
} | ||
_a.label = 3; | ||
case 3: | ||
i += 1; | ||
return [3 /*break*/, 1]; | ||
case 4: return [2 /*return*/, result]; | ||
} | ||
}); | ||
}); }, common_1.processErrorResponse); | ||
}, common_1.processErrorResponse)]; | ||
case 1: | ||
response = _a.sent(); | ||
if (response.returnCode !== common_1.LedgerError.NoErrors) { | ||
return [2 /*return*/, response]; | ||
} | ||
// Message was approved so start iterating over signing_paths to sign | ||
// and collect each signature | ||
return [2 /*return*/, this._signAndCollect(signing_paths)]; | ||
async signMsg(path_prefix, signing_paths, message) { | ||
const coinType = pathCoinType(path_prefix); | ||
if (coinType !== "9000'") { | ||
throw new Error('Only avax path is supported'); | ||
} | ||
const header = Buffer.from('\x1AAvalanche Signed Message:\n', 'utf8'); | ||
const content = Buffer.from(message, 'utf8'); | ||
const msgSize = Buffer.alloc(4); | ||
msgSize.writeUInt32BE(content.length, 0); | ||
const avax_msg = Buffer.from(`${header}${msgSize}${content}`, 'utf8'); | ||
// Send msg for review | ||
const response = await this.signGetChunks(avax_msg, path_prefix).then(chunks => { | ||
return this.signSendChunk(1, chunks.length, chunks[0], FIRST_MESSAGE, INS.SIGN_MSG).then(async (response) => { | ||
// initialize response | ||
let result = { | ||
returnCode: response.returnCode, | ||
errorMessage: response.errorMessage, | ||
signatures: null, | ||
}; | ||
// send chunks | ||
for (let i = 1; i < chunks.length; i += 1) { | ||
// eslint-disable-next-line no-await-in-loop | ||
result = await this.signSendChunk(1 + i, chunks.length, chunks[i], NEXT_MESSAGE, INS.SIGN_MSG); | ||
if (result.returnCode !== LedgerError.NoErrors) { | ||
break; | ||
} | ||
} | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.getVersion = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, (0, common_1.getVersion)(this.transport)["catch"](function (err) { return (0, common_1.processErrorResponse)(err); })]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.getAppInfo = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this.transport.send(0xb0, 0x01, 0, 0).then(function (response) { | ||
var errorCodeData = response.slice(-2); | ||
var returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
var result = {}; | ||
var appName = 'err'; | ||
var appVersion = 'err'; | ||
var flagLen = 0; | ||
var flagsValue = 0; | ||
if (response[0] !== 1) { | ||
// Ledger responds with format ID 1. There is no spec for any format != 1 | ||
result.errorMessage = 'response format ID not recognized'; | ||
result.returnCode = common_1.LedgerError.DeviceIsBusy; | ||
} | ||
else { | ||
var appNameLen = response[1]; | ||
appName = response.slice(2, 2 + appNameLen).toString('ascii'); | ||
var idx = 2 + appNameLen; | ||
var appVersionLen = response[idx]; | ||
idx += 1; | ||
appVersion = response.slice(idx, idx + appVersionLen).toString('ascii'); | ||
idx += appVersionLen; | ||
var appFlagsLen = response[idx]; | ||
idx += 1; | ||
flagLen = appFlagsLen; | ||
flagsValue = response[idx]; | ||
} | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: (0, common_1.errorCodeToString)(returnCode), | ||
// | ||
appName: appName, | ||
appVersion: appVersion, | ||
flagLen: flagLen, | ||
flagsValue: flagsValue, | ||
flagRecovery: (flagsValue & 1) !== 0, | ||
// eslint-disable-next-line no-bitwise | ||
flagSignedMcuCode: (flagsValue & 2) !== 0, | ||
// eslint-disable-next-line no-bitwise | ||
flagOnboarded: (flagsValue & 4) !== 0, | ||
// eslint-disable-next-line no-bitwise | ||
flagPINValidated: (flagsValue & 128) !== 0 | ||
}; | ||
}, common_1.processErrorResponse)]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype._pubkey = function (path, show, hrp, chainid) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var p1, serializedPath, serializedHrp, serializedChainID; | ||
return __generator(this, function (_a) { | ||
p1 = show ? common_1.P1_VALUES.SHOW_ADDRESS_IN_DEVICE : common_1.P1_VALUES.ONLY_RETRIEVE; | ||
serializedPath = (0, helper_1.serializePath)(path); | ||
serializedHrp = (0, helper_1.serializeHrp)(hrp); | ||
serializedChainID = (0, helper_1.serializeChainID)(chainid); | ||
return [2 /*return*/, this.transport | ||
.send(common_1.CLA, common_1.INS.GET_ADDR, p1, 0, Buffer.concat([serializedHrp, serializedChainID, serializedPath]), [common_1.LedgerError.NoErrors]) | ||
.then(processGetAddrResponse, common_1.processErrorResponse)]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.getAddressAndPubKey = function (path, show, hrp, chainid) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this._pubkey(path, show, hrp, chainid)]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype._xpub = function (path, show, hrp, chainid) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var p1, serializedPath, serializedHrp, serializedChainID; | ||
return __generator(this, function (_a) { | ||
p1 = show ? common_1.P1_VALUES.SHOW_ADDRESS_IN_DEVICE : common_1.P1_VALUES.ONLY_RETRIEVE; | ||
serializedPath = (0, helper_1.serializePath)(path); | ||
serializedHrp = (0, helper_1.serializeHrp)(hrp); | ||
serializedChainID = (0, helper_1.serializeChainID)(chainid); | ||
return [2 /*return*/, this.transport | ||
.send(common_1.CLA, common_1.INS.GET_EXTENDED_PUBLIC_KEY, p1, 0, Buffer.concat([serializedHrp, serializedChainID, serializedPath]), [ | ||
common_1.LedgerError.NoErrors, | ||
]) | ||
.then(processGetXPubResponse, common_1.processErrorResponse)]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.getExtendedPubKey = function (path, show, hrp, chainid) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this._xpub(path, show, hrp, chainid)]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype._walletId = function (show) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var p1; | ||
return __generator(this, function (_a) { | ||
p1 = show ? common_1.P1_VALUES.SHOW_ADDRESS_IN_DEVICE : common_1.P1_VALUES.ONLY_RETRIEVE; | ||
return [2 /*return*/, this.transport.send(common_1.CLA, common_1.INS.WALLET_ID, p1, 0).then(function (response) { | ||
var errorCodeData = response.slice(-2); | ||
var returnCode = (errorCodeData[0] * 256 + errorCodeData[1]); | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: (0, common_1.errorCodeToString)(returnCode), | ||
id: response.slice(0, 6) | ||
}; | ||
}, common_1.processErrorResponse)]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.getWalletId = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this._walletId(false)]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.showWalletId = function () { | ||
return __awaiter(this, void 0, void 0, function () { | ||
return __generator(this, function (_a) { | ||
return [2 /*return*/, this._walletId(true)]; | ||
}); | ||
}); | ||
}; | ||
AvalancheApp.prototype.signEVMTransaction = function (path, rawTxHex, resolution) { | ||
return result; | ||
}, processErrorResponse); | ||
}, processErrorResponse); | ||
if (response.returnCode !== LedgerError.NoErrors) { | ||
return response; | ||
} | ||
// Message was approved so start iterating over signing_paths to sign | ||
// and collect each signature | ||
return this._signAndCollect(signing_paths); | ||
} | ||
async getVersion() { | ||
return getVersion(this.transport).catch(err => processErrorResponse(err)); | ||
} | ||
async getAppInfo() { | ||
return this.transport.send(0xb0, 0x01, 0, 0).then(response => { | ||
const errorCodeData = response.slice(-2); | ||
const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
const result = {}; | ||
let appName = 'err'; | ||
let appVersion = 'err'; | ||
let flagLen = 0; | ||
let flagsValue = 0; | ||
if (response[0] !== 1) { | ||
// Ledger responds with format ID 1. There is no spec for any format != 1 | ||
result.errorMessage = 'response format ID not recognized'; | ||
result.returnCode = LedgerError.DeviceIsBusy; | ||
} | ||
else { | ||
const appNameLen = response[1]; | ||
appName = response.slice(2, 2 + appNameLen).toString('ascii'); | ||
let idx = 2 + appNameLen; | ||
const appVersionLen = response[idx]; | ||
idx += 1; | ||
appVersion = response.slice(idx, idx + appVersionLen).toString('ascii'); | ||
idx += appVersionLen; | ||
const appFlagsLen = response[idx]; | ||
idx += 1; | ||
flagLen = appFlagsLen; | ||
flagsValue = response[idx]; | ||
} | ||
return { | ||
returnCode, | ||
errorMessage: errorCodeToString(returnCode), | ||
// | ||
appName, | ||
appVersion, | ||
flagLen, | ||
flagsValue, | ||
flagRecovery: (flagsValue & 1) !== 0, | ||
// eslint-disable-next-line no-bitwise | ||
flagSignedMcuCode: (flagsValue & 2) !== 0, | ||
// eslint-disable-next-line no-bitwise | ||
flagOnboarded: (flagsValue & 4) !== 0, | ||
// eslint-disable-next-line no-bitwise | ||
flagPINValidated: (flagsValue & 128) !== 0, | ||
}; | ||
}, processErrorResponse); | ||
} | ||
async _pubkey(path, show, hrp, chainid) { | ||
const p1 = show ? P1_VALUES.SHOW_ADDRESS_IN_DEVICE : P1_VALUES.ONLY_RETRIEVE; | ||
const serializedPath = serializePath(path); | ||
const serializedHrp = serializeHrp(hrp); | ||
const serializedChainID = serializeChainID(chainid); | ||
return this.transport | ||
.send(CLA, INS.GET_ADDR, p1, 0, Buffer.concat([serializedHrp, serializedChainID, serializedPath]), [LedgerError.NoErrors]) | ||
.then(processGetAddrResponse, processErrorResponse); | ||
} | ||
async getAddressAndPubKey(path, show, hrp, chainid) { | ||
return this._pubkey(path, show, hrp, chainid); | ||
} | ||
async _xpub(path, show, hrp, chainid) { | ||
const p1 = show ? P1_VALUES.SHOW_ADDRESS_IN_DEVICE : P1_VALUES.ONLY_RETRIEVE; | ||
const serializedPath = serializePath(path); | ||
const serializedHrp = serializeHrp(hrp); | ||
const serializedChainID = serializeChainID(chainid); | ||
return this.transport | ||
.send(CLA, INS.GET_EXTENDED_PUBLIC_KEY, p1, 0, Buffer.concat([serializedHrp, serializedChainID, serializedPath]), [ | ||
LedgerError.NoErrors, | ||
]) | ||
.then(processGetXPubResponse, processErrorResponse); | ||
} | ||
async getExtendedPubKey(path, show, hrp, chainid) { | ||
return this._xpub(path, show, hrp, chainid); | ||
} | ||
async _walletId(show) { | ||
const p1 = show ? P1_VALUES.SHOW_ADDRESS_IN_DEVICE : P1_VALUES.ONLY_RETRIEVE; | ||
return this.transport.send(CLA, INS.WALLET_ID, p1, 0).then(response => { | ||
const errorCodeData = response.slice(-2); | ||
const returnCode = (errorCodeData[0] * 256 + errorCodeData[1]); | ||
return { | ||
returnCode, | ||
errorMessage: errorCodeToString(returnCode), | ||
id: response.slice(0, 6), | ||
}; | ||
}, processErrorResponse); | ||
} | ||
async getWalletId() { | ||
return this._walletId(false); | ||
} | ||
async showWalletId() { | ||
return this._walletId(true); | ||
} | ||
signEVMTransaction(path, rawTxHex, resolution) { | ||
return this.eth.signTransaction(path, rawTxHex, resolution); | ||
}; | ||
AvalancheApp.prototype.getETHAddress = function (path, boolDisplay, boolChaincode) { | ||
} | ||
getETHAddress(path, boolDisplay, boolChaincode) { | ||
return this.eth.getAddress(path, boolDisplay, boolChaincode); | ||
}; | ||
AvalancheApp.prototype.getAppConfiguration = function () { | ||
} | ||
getAppConfiguration() { | ||
return this.eth.getAppConfiguration(); | ||
}; | ||
} | ||
// Function that provides the necessary token information to parse ERC721 transactions | ||
@@ -610,53 +396,50 @@ // The implementation aligns with the reference app-ethereum does, but it is provided as | ||
// hw-app-eth package. | ||
AvalancheApp.prototype.provideNftInfo = function (contract_address, token_name, chainId) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var p2, p1, offset, buffer, name, address, id; | ||
return __generator(this, function (_a) { | ||
p2 = 0; | ||
p1 = 0; | ||
offset = 0; | ||
buffer = Buffer.alloc(1 + 1 + 1 + common_1.CHAIN_ID_SIZE + common_1.COLLECTION_NAME_MAX_LEN + common_1.CONTRACT_ADDRESS_LEN + common_1.CHAIN_ID_SIZE); | ||
// write type and version | ||
buffer.writeInt8(common_1.TYPE_1, offset); // type_1 | ||
offset += 1; | ||
buffer.writeInt8(common_1.VERSION_1, offset); // version | ||
offset += 1; | ||
// the len prefix is just 1-byte | ||
if (token_name.length > common_1.COLLECTION_NAME_MAX_LEN) { | ||
return [2 /*return*/, { | ||
returnCode: common_1.LedgerError.WrongLength, | ||
errorMessage: 'Token name too long' | ||
}]; | ||
} | ||
buffer.writeInt8(token_name.length, offset); | ||
offset += 1; | ||
name = Buffer.from(token_name, 'utf8'); | ||
offset += name.copy(buffer, offset); | ||
address = Buffer.from(contract_address, 'hex'); | ||
offset += address.copy(buffer, offset); | ||
id = BigInt(chainId); | ||
buffer.writeBigUInt64BE(id, offset); | ||
return [2 /*return*/, this.transport.send(common_1.CLA_ETH, common_1.INS.ETH_PROVIDE_NFT_INFO, p1, p2, buffer).then(function (response) { | ||
var errorCodeData = response.slice(-2); | ||
var returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
var errorMessage = (0, common_1.errorCodeToString)(returnCode); | ||
if (returnCode === common_1.LedgerError.DataIsInvalid || returnCode === common_1.LedgerError.WrongLength) { | ||
errorMessage = "".concat(errorMessage, " : ").concat(response.slice(0, response.length - 2).toString('ascii')); | ||
} | ||
if (returnCode === common_1.LedgerError.NoErrors && response.length > 2) { | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: errorMessage | ||
}; | ||
} | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: errorMessage | ||
}; | ||
}, common_1.processErrorResponse)]; | ||
}); | ||
}); | ||
}; | ||
return AvalancheApp; | ||
}()); | ||
exports["default"] = AvalancheApp; | ||
async provideNftInfo(contract_address, token_name, chainId) { | ||
const p2 = 0; | ||
const p1 = 0; | ||
let offset = 0; | ||
// allocate version, type, name_len, name, contract_address and chain_id | ||
const buffer = Buffer.alloc(1 + 1 + 1 + CHAIN_ID_SIZE + COLLECTION_NAME_MAX_LEN + CONTRACT_ADDRESS_LEN + CHAIN_ID_SIZE); | ||
// write type and version | ||
buffer.writeInt8(TYPE_1, offset); // type_1 | ||
offset += 1; | ||
buffer.writeInt8(VERSION_1, offset); // version | ||
offset += 1; | ||
// the len prefix is just 1-byte | ||
if (token_name.length > COLLECTION_NAME_MAX_LEN) { | ||
return { | ||
returnCode: LedgerError.WrongLength, | ||
errorMessage: 'Token name too long', | ||
}; | ||
} | ||
buffer.writeInt8(token_name.length, offset); | ||
offset += 1; | ||
// copy token name | ||
const name = Buffer.from(token_name, 'utf8'); | ||
offset += name.copy(buffer, offset); | ||
// copy address | ||
const address = Buffer.from(contract_address, 'hex'); | ||
offset += address.copy(buffer, offset); | ||
// copy chainID | ||
const id = BigInt(chainId); | ||
buffer.writeBigUInt64BE(id, offset); | ||
return this.transport.send(CLA_ETH, INS.ETH_PROVIDE_NFT_INFO, p1, p2, buffer).then((response) => { | ||
const errorCodeData = response.slice(-2); | ||
const returnCode = errorCodeData[0] * 256 + errorCodeData[1]; | ||
let errorMessage = errorCodeToString(returnCode); | ||
if (returnCode === LedgerError.DataIsInvalid || returnCode === LedgerError.WrongLength) { | ||
errorMessage = `${errorMessage} : ${response.slice(0, response.length - 2).toString('ascii')}`; | ||
} | ||
if (returnCode === LedgerError.NoErrors && response.length > 2) { | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: errorMessage, | ||
}; | ||
} | ||
return { | ||
returnCode: returnCode, | ||
errorMessage: errorMessage, | ||
}; | ||
}, processErrorResponse); | ||
} | ||
} |
@@ -1,2 +0,1 @@ | ||
"use strict"; | ||
exports.__esModule = true; | ||
export {}; |
@@ -5,3 +5,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "0.7.1", | ||
"version": "0.8.0", | ||
"description": "Node API for Avalanche App (Ledger Nano S/X/S+)", | ||
@@ -23,3 +23,4 @@ "main": "./dist/index.js", | ||
"scripts": { | ||
"build": "tsc" | ||
"build": "tsc", | ||
"prettier": "prettier --write ./" | ||
}, | ||
@@ -30,26 +31,26 @@ "bugs": { | ||
"dependencies": { | ||
"@ledgerhq/hw-app-eth": "^6.29.7", | ||
"@ledgerhq/cryptoassets": "6.37.0", | ||
"@ledgerhq/hw-transport": "^6.27.5", | ||
"bs58": "^5.0.0", | ||
"sha3": "^2.1.4" | ||
"@ledgerhq/hw-app-eth": "6.29.7", | ||
"@ledgerhq/hw-transport": "6.27.10", | ||
"bs58": "5.0.0", | ||
"sha3": "2.1.4" | ||
}, | ||
"devDependencies": { | ||
"@types/bs58": "^4.0.1", | ||
"@types/ledgerhq__hw-transport": "^4.21.3", | ||
"@typescript-eslint/eslint-plugin": "^5.38.1", | ||
"@typescript-eslint/parser": "^5.38.1", | ||
"bip32": "^3.1.0", | ||
"bip39": "^3.0.4", | ||
"core-js": "^3.11.1", | ||
"@types/bs58": "4.0.1", | ||
"@types/ledgerhq__hw-transport": "4.21.4", | ||
"@typescript-eslint/eslint-plugin": "5.38.1", | ||
"@typescript-eslint/parser": "5.38.1", | ||
"bip32": "3.1.0", | ||
"bip39": "3.0.4", | ||
"core-js": "3.11.1", | ||
"crypto-js": "4.1.1", | ||
"eslint": "^8.24.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.20.2", | ||
"eslint-plugin-jest": "^27.0.4", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"jest": "^29.1.2", | ||
"prettier": "^2.0.4", | ||
"semantic-release": "^19.0.5", | ||
"typescript": "^4.2.4" | ||
"eslint": "8.24.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-import": "2.20.2", | ||
"eslint-plugin-jest": "27.0.4", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"jest": "29.1.2", | ||
"prettier": "2.8.3", | ||
"semantic-release": "19.0.5", | ||
"typescript": "4.2.4" | ||
}, | ||
@@ -56,0 +57,0 @@ "moduleDirectories": [ |
@@ -531,7 +531,7 @@ /** ****************************************************************************** | ||
getAppConfiguration(): Promise<{ | ||
arbitraryDataEnabled: number; | ||
erc20ProvisioningNecessary: number; | ||
starkEnabled: number; | ||
starkv2Supported: number; | ||
version: string; | ||
arbitraryDataEnabled: number | ||
erc20ProvisioningNecessary: number | ||
starkEnabled: number | ||
starkv2Supported: number | ||
version: string | ||
}> { | ||
@@ -538,0 +538,0 @@ return this.eth.getAppConfiguration() |
@@ -9,3 +9,3 @@ export interface ResponseBase { | ||
hash: Buffer | ||
address: string, | ||
address: string | ||
} | ||
@@ -12,0 +12,0 @@ |
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"target": "ESNext", | ||
"module": "ESNext", | ||
"strict": true, | ||
"moduleResolution": "node", | ||
"esModuleInterop": true, | ||
"declarationDir": "dist", | ||
"declaration": true, | ||
@@ -7,0 +10,0 @@ "forceConsistentCasingInFileNames": true, |
78551
1681
+ Added@ledgerhq/devices@7.0.7(transitive)
+ Added@ledgerhq/hw-app-eth@6.29.7(transitive)
+ Added@ledgerhq/hw-transport@6.27.10(transitive)
+ Addedaxios@0.26.1(transitive)
+ Addedrxjs@6.6.7(transitive)
+ Addedtslib@1.14.1(transitive)
- Removed@ledgerhq/cryptoassets-evm-signatures@13.5.3(transitive)
- Removed@ledgerhq/domain-service@1.2.19(transitive)
- Removed@ledgerhq/evm-tools@1.4.0(transitive)
- Removed@ledgerhq/hw-app-eth@6.42.7(transitive)
- Removed@ledgerhq/live-env@2.5.0(transitive)
- Removed@ledgerhq/types-live@6.60.0(transitive)
- Removedasynckit@0.4.0(transitive)
- Removedaxios@1.7.7(transitive)
- Removedcall-bind-apply-helpers@1.0.2(transitive)
- Removedcombined-stream@1.0.8(transitive)
- Removedcrypto-js@4.2.0(transitive)
- Removeddelayed-stream@1.0.0(transitive)
- Removeddunder-proto@1.0.1(transitive)
- Removedeip55@2.1.1(transitive)
- Removedes-define-property@1.0.1(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedes-object-atoms@1.1.1(transitive)
- Removedes-set-tostringtag@2.1.0(transitive)
- Removedform-data@4.0.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.3.0(transitive)
- Removedget-proto@1.0.1(transitive)
- Removedgopd@1.2.0(transitive)
- Removedhas-symbols@1.1.0(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedhasown@2.0.2(transitive)
- Removedkeccak@3.0.4(transitive)
- Removedmath-intrinsics@1.1.0(transitive)
- Removedmime-db@1.52.0(transitive)
- Removedmime-types@2.1.35(transitive)
- Removednode-addon-api@2.0.2(transitive)
- Removednode-gyp-build@4.8.4(transitive)
- Removedproxy-from-env@1.1.0(transitive)
- Removedreact@18.3.1(transitive)
- Removedreact-dom@18.3.1(transitive)
- Removedreadable-stream@3.6.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedscheduler@0.23.2(transitive)
- Removedstring_decoder@1.3.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)
- Removedutility-types@3.11.0(transitive)
Updated@ledgerhq/hw-app-eth@6.29.7
Updatedbs58@5.0.0
Updatedsha3@2.1.4