Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static fromEncryptedJson(json, password, progressCallback) {
return decryptJsonWallet(json, password, progressCallback).then((account) => {
return new Wallet(account);
});
}
static fromMnemonic(mnemonic, path, wordlist) {
static fromEncryptedJson(json: string, password: Bytes | string, progressCallback?: ProgressCallback): Promise {
return decryptJsonWallet(json, password, progressCallback).then((account) => {
return new Wallet(account);
});
}
Wallet.fromEncryptedJson = function (json, password, progressCallback) {
return json_wallets_1.decryptJsonWallet(json, password, progressCallback).then(function (account) {
return new Wallet(account);
});
};
Wallet.fromMnemonic = function (mnemonic, path, wordlist) {
encrypt(password: Bytes | string, options?: any, progressCallback?: ProgressCallback): Promise {
if (typeof(options) === "function" && !progressCallback) {
progressCallback = options;
options = {};
}
if (progressCallback && typeof(progressCallback) !== "function") {
throw new Error("invalid callback");
}
if (!options) { options = {}; }
return encryptKeystore(this, password, options, progressCallback);
}
encrypt(password, options, progressCallback) {
if (typeof (options) === "function" && !progressCallback) {
progressCallback = options;
options = {};
}
if (progressCallback && typeof (progressCallback) !== "function") {
throw new Error("invalid callback");
}
if (!options) {
options = {};
}
return encryptKeystore(this, password, options, progressCallback);
}
/**
Wallet.prototype.encrypt = function (password, options, progressCallback) {
if (typeof (options) === "function" && !progressCallback) {
progressCallback = options;
options = {};
}
if (progressCallback && typeof (progressCallback) !== "function") {
throw new Error("invalid callback");
}
if (!options) {
options = {};
}
return json_wallets_1.encryptKeystore(this, password, options, progressCallback);
};
/**
exports.splitSignature = bytes_1.splitSignature;
exports.stripZeros = bytes_1.stripZeros;
var hash_1 = require("@ethersproject/hash");
exports.hashMessage = hash_1.hashMessage;
exports.id = hash_1.id;
exports.isValidName = hash_1.isValidName;
exports.namehash = hash_1.namehash;
var hdnode_1 = require("@ethersproject/hdnode");
exports.defaultPath = hdnode_1.defaultPath;
exports.entropyToMnemonic = hdnode_1.entropyToMnemonic;
exports.HDNode = hdnode_1.HDNode;
exports.isValidMnemonic = hdnode_1.isValidMnemonic;
exports.mnemonicToEntropy = hdnode_1.mnemonicToEntropy;
exports.mnemonicToSeed = hdnode_1.mnemonicToSeed;
var json_wallets_1 = require("@ethersproject/json-wallets");
exports.getJsonWalletAddress = json_wallets_1.getJsonWalletAddress;
var keccak256_1 = require("@ethersproject/keccak256");
exports.keccak256 = keccak256_1.keccak256;
var logger_1 = require("@ethersproject/logger");
exports.Logger = logger_1.Logger;
var sha2_1 = require("@ethersproject/sha2");
exports.sha256 = sha2_1.sha256;
var solidity_1 = require("@ethersproject/solidity");
exports.solidityKeccak256 = solidity_1.keccak256;
exports.solidityPack = solidity_1.pack;
exports.soliditySha256 = solidity_1.sha256;
var random_1 = require("@ethersproject/random");
exports.randomBytes = random_1.randomBytes;
var properties_1 = require("@ethersproject/properties");
exports.checkProperties = properties_1.checkProperties;
exports.deepCopy = properties_1.deepCopy;
exports.defineReadOnly = properties_1.defineReadOnly;