eth-dcent-keyring
Advanced tools
Comparing version 0.2.0 to 0.2.1
38
index.js
@@ -79,2 +79,17 @@ const { EventEmitter } = require('events') | ||
const getTypedTxOption = (type, transactionJson) => { | ||
if (type === 1 || type === 2) { | ||
const optParams = {} | ||
optParams.accessList = transactionJson.accessList | ||
if (type === 2) { | ||
optParams.maxPriorityFeePerGas = transactionJson.maxPriorityFeePerGas | ||
optParams.maxFeePerGas = transactionJson.maxFeePerGas | ||
} | ||
return optParams | ||
} | ||
return {} | ||
} | ||
function isOldStyleEthereumjsTx (tx) { | ||
@@ -99,2 +114,6 @@ return typeof tx.getChainId === 'function' | ||
getModel () { | ||
return 'DCENT Biometric Wallet' | ||
} | ||
serialize () { | ||
@@ -251,2 +270,3 @@ return Promise.resolve({ | ||
let transaction | ||
let txType = 0 | ||
if (isOldStyleEthereumjsTx(tx)) { | ||
@@ -265,2 +285,6 @@ // legacy transaction from ethereumjs-tx package has no .toJSON() function, | ||
} else { | ||
if (tx._type === 1 || tx._type === 2) { | ||
txType = tx._type | ||
} | ||
transaction = { | ||
@@ -274,3 +298,3 @@ ...tx.toJSON(), | ||
transaction.value = (transaction.value === '0x') ? '0x0' : transaction.value | ||
const typedOpstions = getTypedTxOption(txType, transaction) | ||
return new Promise((resolve, reject) => { | ||
@@ -288,3 +312,5 @@ this.unlock() | ||
this.path, // key path | ||
transaction.chainId | ||
transaction.chainId, | ||
txType, | ||
typedOpstions | ||
).then((response) => { | ||
@@ -388,3 +414,3 @@ LOG('response - ', response) | ||
signTypedData (withAccount, typedData) { | ||
signTypedData (withAccount, typedData, opts) { | ||
// Waiting on dcent to enable this | ||
@@ -397,5 +423,5 @@ LOG('signPersonalMessage - withAccount', withAccount) | ||
.then((_) => { | ||
DcentConnector.getEthereumSignedTypedData( | ||
typedData, | ||
this.path | ||
DcentConnector.getSignedData( | ||
this.path, | ||
{ payload: typedData, version: opts.version } | ||
).then((response) => { | ||
@@ -402,0 +428,0 @@ if (response.header.status === DcentResult.SUCCESS) { |
{ | ||
"name": "eth-dcent-keyring", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A MetaMask compatible keyring, for D'CENT hardware wallets", | ||
@@ -37,3 +37,3 @@ "main": "index.js", | ||
"ethereumjs-util": "7.0.9", | ||
"dcent-web-connector": "^0.10.5" | ||
"dcent-web-connector": "^0.11.2" | ||
}, | ||
@@ -40,0 +40,0 @@ "devDependencies": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
17129
424
0
+ Addeddcent-web-connector@0.11.4(transitive)
- Removeddcent-web-connector@0.10.5(transitive)
Updateddcent-web-connector@^0.11.2