forked from tornado-packages/ethers.js
Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
023e946072 | ||
|
|
004cb826d2 | ||
|
|
bfcf224b2b | ||
|
|
c969fe5a68 | ||
|
|
8737f12e1b | ||
|
|
1267eeef4a | ||
|
|
11c250ff7c | ||
|
|
c303199d26 | ||
|
|
ae458a1a49 | ||
|
|
760a5aec74 | ||
|
|
2967efc2b0 | ||
|
|
24f243e689 | ||
|
|
d719064628 | ||
|
|
a7d0b41d98 | ||
|
|
a980fc3db0 |
2
_version.d.ts
vendored
2
_version.d.ts
vendored
@@ -1 +1 @@
|
||||
export declare const version = "4.0.32";
|
||||
export declare const version = "4.0.37";
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "4.0.32";
|
||||
exports.version = "4.0.37";
|
||||
|
||||
@@ -204,7 +204,7 @@ function runMethod(contract, functionName, estimateOnly) {
|
||||
tx.gasLimit = bignumber_1.bigNumberify(method.gas).add(21000);
|
||||
}
|
||||
if (!contract.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });
|
||||
}
|
||||
// Make sure they aren't overriding something they shouldn't
|
||||
if (tx.from != null) {
|
||||
@@ -366,7 +366,7 @@ var Contract = /** @class */ (function () {
|
||||
Contract.prototype.fallback = function (overrides) {
|
||||
var _this = this;
|
||||
if (!this.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' });
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' });
|
||||
}
|
||||
var tx = properties_1.shallowCopy(overrides || {});
|
||||
['from', 'to'].forEach(function (key) {
|
||||
|
||||
59
dist/ethers.js
vendored
59
dist/ethers.js
vendored
@@ -1,7 +1,7 @@
|
||||
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.ethers = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "4.0.32";
|
||||
exports.version = "4.0.37";
|
||||
|
||||
},{}],2:[function(require,module,exports){
|
||||
"use strict";
|
||||
@@ -252,7 +252,7 @@ function runMethod(contract, functionName, estimateOnly) {
|
||||
tx.gasLimit = bignumber_1.bigNumberify(method.gas).add(21000);
|
||||
}
|
||||
if (!contract.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' });
|
||||
}
|
||||
// Make sure they aren't overriding something they shouldn't
|
||||
if (tx.from != null) {
|
||||
@@ -414,7 +414,7 @@ var Contract = /** @class */ (function () {
|
||||
Contract.prototype.fallback = function (overrides) {
|
||||
var _this = this;
|
||||
if (!this.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' });
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' });
|
||||
}
|
||||
var tx = properties_1.shallowCopy(overrides || {});
|
||||
['from', 'to'].forEach(function (key) {
|
||||
@@ -8646,24 +8646,28 @@ exports.shr64_lo = shr64_lo;
|
||||
if (typeof Object.create === 'function') {
|
||||
// implementation from standard node.js 'util' module
|
||||
module.exports = function inherits(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
});
|
||||
if (superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
ctor.prototype = Object.create(superCtor.prototype, {
|
||||
constructor: {
|
||||
value: ctor,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
}
|
||||
})
|
||||
}
|
||||
};
|
||||
} else {
|
||||
// old school shim for old browsers
|
||||
module.exports = function inherits(ctor, superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
var TempCtor = function () {}
|
||||
TempCtor.prototype = superCtor.prototype
|
||||
ctor.prototype = new TempCtor()
|
||||
ctor.prototype.constructor = ctor
|
||||
if (superCtor) {
|
||||
ctor.super_ = superCtor
|
||||
var TempCtor = function () {}
|
||||
TempCtor.prototype = superCtor.prototype
|
||||
ctor.prototype = new TempCtor()
|
||||
ctor.prototype.constructor = ctor
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9620,7 +9624,7 @@ module.exports = { browser: true };
|
||||
|
||||
}).call(this,require("timers").setImmediate)
|
||||
},{"timers":45}],44:[function(require,module,exports){
|
||||
(function (process,global){
|
||||
(function (process,global,clearImmediate){
|
||||
(function (global, undefined) {
|
||||
"use strict";
|
||||
|
||||
@@ -9797,8 +9801,8 @@ module.exports = { browser: true };
|
||||
attachTo.clearImmediate = clearImmediate;
|
||||
}(typeof self === "undefined" ? typeof global === "undefined" ? this : global : self));
|
||||
|
||||
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"_process":42}],45:[function(require,module,exports){
|
||||
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("timers").clearImmediate)
|
||||
},{"_process":42,"timers":45}],45:[function(require,module,exports){
|
||||
(function (global){
|
||||
module.exports = { setImmediate: global.setImmediate };
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
@@ -11069,7 +11073,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.getNetwork().then(function (network) {
|
||||
// No ENS...
|
||||
if (!network.ensAddress) {
|
||||
errors.throwError('network does support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });
|
||||
errors.throwError('network does not support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });
|
||||
}
|
||||
// keccak256('resolver(bytes32)')
|
||||
var data = '0x0178b8bf' + hash_1.namehash(name).substring(2);
|
||||
@@ -11143,6 +11147,9 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var transaction = { to: resolverAddress, data: data };
|
||||
return self.call(transaction);
|
||||
}).then(function (data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
// Strip off the "0x"
|
||||
data = data.substring(2);
|
||||
// Strip off the dynamic string pointer (0x20)
|
||||
@@ -14287,7 +14294,7 @@ var HDNode = /** @class */ (function () {
|
||||
result = result._derive(index);
|
||||
}
|
||||
else {
|
||||
throw new Error('invlaid path component - ' + component);
|
||||
throw new Error('invalid path component - ' + component);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -14339,8 +14346,8 @@ function _fromSeed(seed, mnemonic) {
|
||||
return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic, 'm');
|
||||
}
|
||||
function fromMnemonic(mnemonic, wordlist, password) {
|
||||
// Check that the checksum s valid (will throw an error)
|
||||
mnemonicToEntropy(mnemonic, wordlist);
|
||||
// Normalize the mnemonic (also throws if the checksum is invalid)
|
||||
mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist);
|
||||
return _fromSeed(mnemonicToSeed(mnemonic, password), mnemonic);
|
||||
}
|
||||
exports.fromMnemonic = fromMnemonic;
|
||||
@@ -15503,7 +15510,7 @@ function _decode(data, offset) {
|
||||
else if (data[offset] >= 0x80) {
|
||||
var length = data[offset] - 0x80;
|
||||
if (offset + 1 + length > data.length) {
|
||||
throw new Error('invlaid rlp data');
|
||||
throw new Error('invalid rlp data');
|
||||
}
|
||||
var result = bytes_1.hexlify(data.slice(offset + 1, offset + 1 + length));
|
||||
return { consumed: (1 + length), result: result };
|
||||
@@ -15750,7 +15757,7 @@ function decrypt(json, password, progressCallback) {
|
||||
return null;
|
||||
}
|
||||
var signingKey = new signing_key_1.SigningKey(privateKey);
|
||||
if (signingKey.address !== address_1.getAddress(data.address)) {
|
||||
if (data.address && signingKey.address !== address_1.getAddress(data.address)) {
|
||||
reject(new Error('address mismatch'));
|
||||
return null;
|
||||
}
|
||||
|
||||
2
dist/ethers.min.js
vendored
2
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.min.js.map
vendored
2
dist/ethers.min.js.map
vendored
File diff suppressed because one or more lines are too long
2
dist/ethers.types.txt
vendored
2
dist/ethers.types.txt
vendored
@@ -266,7 +266,7 @@ declare module 'ethers/utils/shims' {
|
||||
}
|
||||
|
||||
declare module 'ethers/_version' {
|
||||
export const version = "4.0.32";
|
||||
export const version = "4.0.37";
|
||||
}
|
||||
|
||||
declare module 'ethers/utils/bignumber' {
|
||||
|
||||
2
dist/shims.js
vendored
2
dist/shims.js
vendored
File diff suppressed because one or more lines are too long
1969
package-lock.json
generated
1969
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ethers",
|
||||
"version": "4.0.32",
|
||||
"version": "4.0.37",
|
||||
"description": "Ethereum wallet library.",
|
||||
"main": "./index.js",
|
||||
"types": "./index.d.ts",
|
||||
@@ -64,5 +64,6 @@
|
||||
"type": "git",
|
||||
"url": "git://github.com/ethers-io/ethers.js.git"
|
||||
},
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"license": "MIT"
|
||||
}
|
||||
|
||||
@@ -1013,7 +1013,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.getNetwork().then(function (network) {
|
||||
// No ENS...
|
||||
if (!network.ensAddress) {
|
||||
errors.throwError('network does support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });
|
||||
errors.throwError('network does not support ENS', errors.UNSUPPORTED_OPERATION, { operation: 'ENS', network: network.name });
|
||||
}
|
||||
// keccak256('resolver(bytes32)')
|
||||
var data = '0x0178b8bf' + hash_1.namehash(name).substring(2);
|
||||
@@ -1087,6 +1087,9 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var transaction = { to: resolverAddress, data: data };
|
||||
return self.call(transaction);
|
||||
}).then(function (data) {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
// Strip off the "0x"
|
||||
data = data.substring(2);
|
||||
// Strip off the dynamic string pointer (0x20)
|
||||
|
||||
@@ -1 +1 @@
|
||||
export const version = "4.0.32";
|
||||
export const version = "4.0.37";
|
||||
|
||||
@@ -262,7 +262,7 @@ function runMethod(contract: Contract, functionName: string, estimateOnly: boole
|
||||
}
|
||||
|
||||
if (!contract.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' })
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction' })
|
||||
}
|
||||
|
||||
// Make sure they aren't overriding something they shouldn't
|
||||
@@ -478,7 +478,7 @@ export class Contract {
|
||||
|
||||
fallback(overrides?: TransactionRequest): Promise<TransactionResponse> {
|
||||
if (!this.signer) {
|
||||
errors.throwError('sending a transaction require a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' })
|
||||
errors.throwError('sending a transaction requires a signer', errors.UNSUPPORTED_OPERATION, { operation: 'sendTransaction(fallback)' })
|
||||
}
|
||||
|
||||
var tx: TransactionRequest = shallowCopy(overrides || {});
|
||||
|
||||
@@ -1142,7 +1142,7 @@ export class BaseProvider extends Provider {
|
||||
// No ENS...
|
||||
if (!network.ensAddress) {
|
||||
errors.throwError(
|
||||
'network does support ENS',
|
||||
'network does not support ENS',
|
||||
errors.UNSUPPORTED_OPERATION,
|
||||
{ operation: 'ENS', network: network.name }
|
||||
);
|
||||
@@ -1221,6 +1221,8 @@ export class BaseProvider extends Provider {
|
||||
return self.call(transaction);
|
||||
|
||||
}).then(function(data) {
|
||||
if (data == null) { return null; }
|
||||
|
||||
// Strip off the "0x"
|
||||
data = data.substring(2);
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ export class HDNode {
|
||||
if (index >= HardenedBit) { throw new Error('invalid path index - ' + component); }
|
||||
result = result._derive(index);
|
||||
} else {
|
||||
throw new Error('invlaid path component - ' + component);
|
||||
throw new Error('invalid path component - ' + component);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -127,7 +127,7 @@ function _decode(data: Uint8Array, offset: number): { consumed: number, result:
|
||||
} else if (data[offset] >= 0x80) {
|
||||
var length = data[offset] - 0x80;
|
||||
if (offset + 1 + length > data.length) {
|
||||
throw new Error('invlaid rlp data');
|
||||
throw new Error('invalid rlp data');
|
||||
}
|
||||
|
||||
var result = hexlify(data.slice(offset + 1, offset + 1 + length));
|
||||
|
||||
@@ -171,7 +171,7 @@ export function decrypt(json: string, password: Arrayish, progressCallback?: Pro
|
||||
}
|
||||
|
||||
var signingKey = new SigningKey(privateKey);
|
||||
if (signingKey.address !== getAddress(data.address)) {
|
||||
if (data.address && signingKey.address !== getAddress(data.address)) {
|
||||
reject(new Error('address mismatch'));
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ var path = require('path');
|
||||
var utils = require('../utils.js');
|
||||
|
||||
function prefixAddress(address) {
|
||||
if (!address) { return null; }
|
||||
if (address.substring(0, 2) !== '0x') {
|
||||
address = '0x' + address;
|
||||
}
|
||||
@@ -25,6 +26,10 @@ Output.push({
|
||||
});
|
||||
*/
|
||||
|
||||
var addresses = {
|
||||
"582": "0x008aeeda4d805471df9b2a5b0f38a0c3bcba786b"
|
||||
};
|
||||
|
||||
var privateKeys = {
|
||||
'0x0b88d4b324ec24c8c078551e6e5075547157e5b6': '0xd4375d2a931db84ea8825b69a3128913597744d9236cacec675cc18e1bda4446',
|
||||
'0x2e326fa404fc3661de4f4361776ed9bbabdc26e3': '0xcf367fc32bf789b3339c6664af4a12263e9db0e0eb70f247da1d1165e150c487',
|
||||
@@ -33,7 +38,8 @@ var privateKeys = {
|
||||
'0x88a5c2d9919e46f883eb62f7b8dd9d0cc45bc290': '0xf03e581353c794928373fb0893bc731aefc4c4e234e643f3a46998b03cd4d7c5',
|
||||
'0x17c5185167401ed00cf5f5b2fc97d9bbfdb7d025': '0x4242424242424242424242424242424242424242424242424242424242424242',
|
||||
'0x012363d61bdc53d0290a0f25e9c89f8257550fb8': '0x4c94faa2c558a998d10ee8b2b9b8eb1fbcb8a6ac5fd085c6f95535604fc1bffb',
|
||||
'0x15db397ed5f682acb22b0afc6c8de4cdfbda7cbc': '0xcdf3c34a2ea0ff181f462856168f5851e68c37b583eb158403e43aeab4964fee'
|
||||
'0x15db397ed5f682acb22b0afc6c8de4cdfbda7cbc': '0xcdf3c34a2ea0ff181f462856168f5851e68c37b583eb158403e43aeab4964fee',
|
||||
'0x008aeeda4d805471df9b2a5b0f38a0c3bcba786b': '0x7a28b5ba57c53603b0b07b56bba752f7784bf506fa95edc395f5cf6c7514fe9d'
|
||||
}
|
||||
|
||||
var mnemonics = {
|
||||
@@ -62,14 +68,16 @@ fs.readdirSync(walletPath).forEach(function(filename) {
|
||||
});
|
||||
|
||||
} else {
|
||||
let address = (addresses[name] || prefixAddress(data.address));
|
||||
Output.push({
|
||||
type: 'secret-storage',
|
||||
address: prefixAddress(data.address),
|
||||
hasAddress: !addresses[name],
|
||||
address: address,
|
||||
json: JSON.stringify(data),
|
||||
mnemonic: mnemonics[prefixAddress(data.address)] || '',
|
||||
mnemonic: mnemonics[address] || '',
|
||||
name: name,
|
||||
password: password,
|
||||
privateKey: privateKeys[prefixAddress(data.address)],
|
||||
privateKey: privateKeys[address],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"6087dab2f9fdbbfaddc31a909735c1e6"},"ciphertext":"5318b4d5bcd28de64ee5559e671353e16f075ecae9f99c7a79a38af5f869aa46","kdf":"pbkdf2","kdfparams":{"c":262144,"dklen":32,"prf":"hmac-sha256","salt":"ae3cd4e7013836a3df6bd7241b12db061dbe2c6785853cce422d148a624ce0bd"},"mac":"517ead924a9d0dc3124507e3393d175ce3ff7c1e96529c6c555ce9e51205e9b2"},"id":"3198bc9c-6672-5ab3-d995-4942343ae5b6","version":3}
|
||||
@@ -5,11 +5,20 @@ var assert = require('assert');
|
||||
var utils = require('./utils');
|
||||
var ethers = utils.getEthers(__filename);
|
||||
|
||||
function skip(name) {
|
||||
var match = name.match(/^random-([0-9]+)$/);
|
||||
if (match && parseInt(match[1]) > 512) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
describe('Test HD Node Derivation', function(test) {
|
||||
|
||||
var tests = utils.loadTests('hdnode');
|
||||
tests.forEach(function(test) {
|
||||
it('Derives the HD nodes - ' + test.name, function() {
|
||||
if (skip(test.name)) { return; }
|
||||
it('Derives the HD nodes - ' + test.name, function() {
|
||||
this.timeout(10000);
|
||||
|
||||
//var rootNode = new ethers.utils.HDNode.fromSeed(test.seed);
|
||||
@@ -87,6 +96,7 @@ describe('Test HD Node Derivation', function(test) {
|
||||
describe('Test HD Mnemonic Phrases', function testMnemonic() {
|
||||
var tests = utils.loadTests('hdnode');
|
||||
tests.forEach(function(test) {
|
||||
if (skip(test.name)) { return; }
|
||||
it(('converts mnemonic phrases - ' + test.name), function() {
|
||||
this.timeout(1000000);
|
||||
|
||||
|
||||
@@ -12,8 +12,10 @@ describe('Test JSON Wallets', function() {
|
||||
it(('decrypts wallet - ' + test.name), function() {
|
||||
this.timeout(1200000);
|
||||
|
||||
assert.ok((ethers.utils.getJsonWalletAddress(test.json) !== null),
|
||||
'detect encrypted JSON wallet');
|
||||
if (test.hasAddress) {
|
||||
assert.ok((ethers.utils.getJsonWalletAddress(test.json) !== null),
|
||||
'detect encrypted JSON wallet');
|
||||
}
|
||||
|
||||
return Wallet.fromEncryptedJson(test.json, test.password).then(function(wallet) {
|
||||
assert.equal(wallet.privateKey, test.privateKey,
|
||||
|
||||
Binary file not shown.
@@ -174,7 +174,7 @@ var HDNode = /** @class */ (function () {
|
||||
result = result._derive(index);
|
||||
}
|
||||
else {
|
||||
throw new Error('invlaid path component - ' + component);
|
||||
throw new Error('invalid path component - ' + component);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -226,8 +226,8 @@ function _fromSeed(seed, mnemonic) {
|
||||
return new HDNode(_constructorGuard, bytes32(I.slice(0, 32)), null, "0x00000000", bytes32(I.slice(32)), 0, 0, mnemonic, 'm');
|
||||
}
|
||||
function fromMnemonic(mnemonic, wordlist, password) {
|
||||
// Check that the checksum s valid (will throw an error)
|
||||
mnemonicToEntropy(mnemonic, wordlist);
|
||||
// Normalize the mnemonic (also throws if the checksum is invalid)
|
||||
mnemonic = entropyToMnemonic(mnemonicToEntropy(mnemonic, wordlist), wordlist);
|
||||
return _fromSeed(mnemonicToSeed(mnemonic, password), mnemonic);
|
||||
}
|
||||
exports.fromMnemonic = fromMnemonic;
|
||||
|
||||
@@ -98,7 +98,7 @@ function _decode(data, offset) {
|
||||
else if (data[offset] >= 0x80) {
|
||||
var length = data[offset] - 0x80;
|
||||
if (offset + 1 + length > data.length) {
|
||||
throw new Error('invlaid rlp data');
|
||||
throw new Error('invalid rlp data');
|
||||
}
|
||||
var result = bytes_1.hexlify(data.slice(offset + 1, offset + 1 + length));
|
||||
return { consumed: (1 + length), result: result };
|
||||
|
||||
@@ -125,7 +125,7 @@ function decrypt(json, password, progressCallback) {
|
||||
return null;
|
||||
}
|
||||
var signingKey = new signing_key_1.SigningKey(privateKey);
|
||||
if (signingKey.address !== address_1.getAddress(data.address)) {
|
||||
if (data.address && signingKey.address !== address_1.getAddress(data.address)) {
|
||||
reject(new Error('address mismatch'));
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user