Socket
Socket
Sign inDemoInstall

@onekeyfe/hd-core

Package Overview
Dependencies
107
Maintainers
2
Versions
206
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.21 to 0.3.22

dist/data-manager/MessagesConfig.d.ts

12

dist/api/evm/latest/signTransaction.d.ts

@@ -10,2 +10,14 @@ import { EthereumTxRequestOneKey, TypedCall } from '@onekeyfe/hd-transport';

}) => Promise<EVMSignedTx>;
export declare const evmSignTx: ({ typedCall, addressN, tx, supportTrezor, }: {
typedCall: TypedCall;
addressN: number[];
tx: EVMTransaction;
supportTrezor?: boolean | undefined;
}) => Promise<EVMSignedTx>;
export declare const evmSignTxEip1559: ({ typedCall, addressN, tx, supportTrezor, }: {
typedCall: TypedCall;
addressN: number[];
tx: EVMTransactionEIP1559;
supportTrezor?: boolean | undefined;
}) => Promise<EVMSignedTx>;
export declare const signTransaction: ({ typedCall, isEIP1559, addressN, tx, }: {

@@ -12,0 +24,0 @@ addressN: number[];

8

package.json
{
"name": "@onekeyfe/hd-core",
"version": "0.3.21",
"version": "0.3.22",
"description": "> TODO: description",

@@ -28,4 +28,4 @@ "author": "OneKey",

"dependencies": {
"@onekeyfe/hd-shared": "^0.3.21",
"@onekeyfe/hd-transport": "^0.3.21",
"@onekeyfe/hd-shared": "^0.3.22",
"@onekeyfe/hd-transport": "^0.3.22",
"axios": "^0.27.2",

@@ -48,3 +48,3 @@ "bignumber.js": "^9.0.2",

},
"gitHead": "7d052f9affce1324c5585ebd918d4ce3bc275406"
"gitHead": "c6a9dda00f6a16ee19d9d6e3d417744f67e70c01"
}

@@ -72,3 +72,3 @@ import {

const evmSignTx = async ({
export const evmSignTx = async ({
typedCall,

@@ -131,3 +131,3 @@ addressN,

const evmSignTxEip1559 = async ({
export const evmSignTxEip1559 = async ({
typedCall,

@@ -134,0 +134,0 @@ addressN,

@@ -1,86 +0,5 @@

import { EthereumSignTx, EthereumSignTxEIP1559, TypedCall } from '@onekeyfe/hd-transport';
import { TypedCall } from '@onekeyfe/hd-transport';
import { EVMTransaction, EVMTransactionEIP1559 } from '../../../types';
import { cutString } from '../../helpers/stringUtils';
import { stripHexStartZeroes } from '../../helpers/hexUtils';
import { processTxRequest } from '../latest/signTransaction';
import { evmSignTx, evmSignTxEip1559 } from '../latest/signTransaction';
const evmSignTx = async (typedCall: TypedCall, addressN: number[], tx: EVMTransaction) => {
const { to, value, gasPrice, gasLimit, nonce, data, chainId, txType } = tx;
const length = data == null ? 0 : data.length / 2;
const [first, rest] = cutString(data, 1024 * 2);
let message: EthereumSignTx = {
address_n: addressN,
nonce: stripHexStartZeroes(nonce),
gas_price: stripHexStartZeroes(gasPrice),
gas_limit: stripHexStartZeroes(gasLimit),
to,
value: stripHexStartZeroes(value),
chain_id: chainId,
};
if (length !== 0) {
message = {
...message,
data_length: length,
data_initial_chunk: first,
};
}
if (txType !== null) {
message = {
...message,
tx_type: txType,
};
}
const response = await typedCall('EthereumSignTx', 'EthereumTxRequest', message);
return processTxRequest({ typedCall, request: response.message, data: rest, chainId });
};
const evmSignTxEip1559 = async (
typedCall: TypedCall,
addressN: number[],
tx: EVMTransactionEIP1559
) => {
const {
to,
value,
gasLimit,
nonce,
data,
chainId,
maxFeePerGas,
maxPriorityFeePerGas,
accessList,
} = tx;
const length = data == null ? 0 : data.length / 2;
const [first, rest] = cutString(data, 1024 * 2);
const message: EthereumSignTxEIP1559 = {
address_n: addressN,
nonce: stripHexStartZeroes(nonce),
max_gas_fee: stripHexStartZeroes(maxFeePerGas),
max_priority_fee: stripHexStartZeroes(maxPriorityFeePerGas),
gas_limit: stripHexStartZeroes(gasLimit),
to,
value: stripHexStartZeroes(value),
data_length: length,
data_initial_chunk: first,
chain_id: chainId,
access_list: (accessList || []).map(a => ({
address: a.address,
storage_keys: a.storageKeys,
})),
};
const response = await typedCall('EthereumSignTxEIP1559', 'EthereumTxRequest', message);
return processTxRequest({ typedCall, request: response.message, data: rest });
};
export const signTransaction = async ({

@@ -98,3 +17,8 @@ typedCall,

isEIP1559
? evmSignTxEip1559(typedCall, addressN, tx as EVMTransactionEIP1559)
: evmSignTx(typedCall, addressN, tx as EVMTransaction);
? evmSignTxEip1559({
typedCall,
addressN,
tx: tx as EVMTransactionEIP1559,
supportTrezor: true,
})
: evmSignTx({ typedCall, addressN, tx: tx as EVMTransaction, supportTrezor: true });

@@ -14,3 +14,3 @@ import semver from 'semver';

import DataManager, { MessageVersion } from '../data-manager/DataManager';
import { PROTOBUF_MESSAGE_CONFIG } from '../data/messages-config';
import { PROTOBUF_MESSAGE_CONFIG } from '../data-manager/MessagesConfig';

@@ -17,0 +17,0 @@ export const getDeviceModel = (features?: Features): IDeviceModel => {

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc