Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ethersproject/wallet

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethersproject/wallet - npm Package Compare versions

Comparing version 5.0.5 to 5.0.6

2

lib.esm/_version.d.ts

@@ -1,1 +0,1 @@

export declare const version = "wallet/5.0.5";
export declare const version = "wallet/5.0.6";

@@ -1,2 +0,2 @@

export const version = "wallet/5.0.5";
export const version = "wallet/5.0.6";
//# sourceMappingURL=_version.js.map
import { Provider, TransactionRequest } from "@ethersproject/abstract-provider";
import { ExternallyOwnedAccount, Signer } from "@ethersproject/abstract-signer";
import { ExternallyOwnedAccount, Signer, TypedDataDomain, TypedDataField, TypedDataSigner } from "@ethersproject/abstract-signer";
import { Bytes, BytesLike, SignatureLike } from "@ethersproject/bytes";

@@ -8,3 +8,3 @@ import { Mnemonic } from "@ethersproject/hdnode";

import { Wordlist } from "@ethersproject/wordlists";
export declare class Wallet extends Signer implements ExternallyOwnedAccount {
export declare class Wallet extends Signer implements ExternallyOwnedAccount, TypedDataSigner {
readonly address: string;

@@ -22,2 +22,3 @@ readonly provider: Provider;

signMessage(message: Bytes | string): Promise<string>;
_signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
encrypt(password: Bytes | string, options?: any, progressCallback?: ProgressCallback): Promise<string>;

@@ -24,0 +25,0 @@ /**

"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());
});
};
import { getAddress } from "@ethersproject/address";

@@ -6,3 +15,3 @@ import { Provider } from "@ethersproject/abstract-provider";

import { arrayify, concat, hexDataSlice, isHexString, joinSignature } from "@ethersproject/bytes";
import { hashMessage } from "@ethersproject/hash";
import { hashMessage, _TypedDataEncoder } from "@ethersproject/hash";
import { defaultPath, HDNode, entropyToMnemonic } from "@ethersproject/hdnode";

@@ -96,4 +105,20 @@ import { keccak256 } from "@ethersproject/keccak256";

signMessage(message) {
return Promise.resolve(joinSignature(this._signingKey().signDigest(hashMessage(message))));
return __awaiter(this, void 0, void 0, function* () {
return joinSignature(this._signingKey().signDigest(hashMessage(message)));
});
}
_signTypedData(domain, types, value) {
return __awaiter(this, void 0, void 0, function* () {
// Populate any ENS names
const populated = yield _TypedDataEncoder.resolveNames(domain, types, value, (name) => {
if (this.provider == null) {
logger.throwError("cannot resolve ENS names without a provider", Logger.errors.UNSUPPORTED_OPERATION, {
operation: "resolveName"
});
}
return this.provider.resolveName(name);
});
return joinSignature(this._signingKey().signDigest(_TypedDataEncoder.hash(populated.domain, types, populated.value)));
});
}
encrypt(password, options, progressCallback) {

@@ -100,0 +125,0 @@ if (typeof (options) === "function" && !progressCallback) {

@@ -1,1 +0,1 @@

export declare const version = "wallet/5.0.5";
export declare const version = "wallet/5.0.6";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "wallet/5.0.5";
exports.version = "wallet/5.0.6";
//# sourceMappingURL=_version.js.map
import { Provider, TransactionRequest } from "@ethersproject/abstract-provider";
import { ExternallyOwnedAccount, Signer } from "@ethersproject/abstract-signer";
import { ExternallyOwnedAccount, Signer, TypedDataDomain, TypedDataField, TypedDataSigner } from "@ethersproject/abstract-signer";
import { Bytes, BytesLike, SignatureLike } from "@ethersproject/bytes";

@@ -8,3 +8,3 @@ import { Mnemonic } from "@ethersproject/hdnode";

import { Wordlist } from "@ethersproject/wordlists";
export declare class Wallet extends Signer implements ExternallyOwnedAccount {
export declare class Wallet extends Signer implements ExternallyOwnedAccount, TypedDataSigner {
readonly address: string;

@@ -22,2 +22,3 @@ readonly provider: Provider;

signMessage(message: Bytes | string): Promise<string>;
_signTypedData(domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, value: Record<string, any>): Promise<string>;
encrypt(password: Bytes | string, options?: any, progressCallback?: ProgressCallback): Promise<string>;

@@ -24,0 +25,0 @@ /**

@@ -15,2 +15,38 @@ "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 (_) 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 };
}
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -127,4 +163,29 @@ var address_1 = require("@ethersproject/address");

Wallet.prototype.signMessage = function (message) {
return Promise.resolve(bytes_1.joinSignature(this._signingKey().signDigest(hash_1.hashMessage(message))));
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, bytes_1.joinSignature(this._signingKey().signDigest(hash_1.hashMessage(message)))];
});
});
};
Wallet.prototype._signTypedData = function (domain, types, value) {
return __awaiter(this, void 0, void 0, function () {
var populated;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, hash_1._TypedDataEncoder.resolveNames(domain, types, value, function (name) {
if (_this.provider == null) {
logger.throwError("cannot resolve ENS names without a provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
operation: "resolveName"
});
}
return _this.provider.resolveName(name);
})];
case 1:
populated = _a.sent();
return [2 /*return*/, bytes_1.joinSignature(this._signingKey().signDigest(hash_1._TypedDataEncoder.hash(populated.domain, types, populated.value)))];
}
});
});
};
Wallet.prototype.encrypt = function (password, options, progressCallback) {

@@ -131,0 +192,0 @@ if (typeof (options) === "function" && !progressCallback) {

@@ -22,3 +22,3 @@ {

"ethereum": "donations.ethers.eth",
"gitHead": "ffa4a2d0549fe2c606bda3130f4a3f3d788f8dcf",
"gitHead": "86146650d83865d83b10867e9592923eada5d7cc",
"keywords": [

@@ -42,5 +42,5 @@ "Ethereum",

},
"tarballHash": "0x0cb756cccaebc5c23b59d9a6025643448c15032b4a796a3e6095c46607f085ca",
"tarballHash": "0xef774b0cab37ac7114d7daa7af5b9696d8aaa82bcee5a9e26239c36a66222c11",
"types": "./lib/index.d.ts",
"version": "5.0.5"
"version": "5.0.6"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc