Updated dist files.
This commit is contained in:
parent
3ab373334c
commit
79ef1e975d
23
CHANGELOG.md
23
CHANGELOG.md
@ -3,6 +3,29 @@ Changelog
|
||||
|
||||
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
|
||||
|
||||
ethers/v5.0.0-beta.160 (2019-11-20 18:36)
|
||||
-----------------------------------------
|
||||
|
||||
- Updated API in testcases. ([3ab3733](https://github.com/ethers-io/ethers.js/commit/3ab373334c75800f2b20b6639ed8eb1b11e453ef))
|
||||
- Fixed scrypt import in ESM build. ([b72ef27](https://github.com/ethers-io/ethers.js/commit/b72ef27b2a8f9941fb9d79122ec449fed9d2464d))
|
||||
- Fixed null apiKey problem for InfuraProvider. ([e518151](https://github.com/ethers-io/ethers.js/commit/e51815150912d10e2734707986b10b37c87d6d12))
|
||||
- Added support for sighash-style tuple parsing. ([19aaade](https://github.com/ethers-io/ethers.js/commit/19aaade9c62510012cfd50ae487ebd1705a28678))
|
||||
- Fixed solc imports for cli. ([c35ddaf](https://github.com/ethers-io/ethers.js/commit/c35ddaf646efa25e738fee604585a0a7af45b206))
|
||||
- Added nonce manager to experimental index. ([8316406](https://github.com/ethers-io/ethers.js/commit/8316406977ea26ca2044d16f7b3bb6ba21ef5b43))
|
||||
- Removing NodesmithProvider from default provider as it is being discontinued. ([01ca350](https://github.com/ethers-io/ethers.js/commit/01ca35036ca11a47f60890e5cae62e46a00f3da8))
|
||||
- Moved bare ABI named functions and events from Interface into Contracts to simplify other consumers of Interface. ([da8ca2e](https://github.com/ethers-io/ethers.js/commit/da8ca2e8bc982fc3ea0343bb3c593a485ca1fef0))
|
||||
- Added support for complex API keys including support for INFURA project secrets. ([#464](https://github.com/ethers-io/ethers.js/issues/464), [#651](https://github.com/ethers-io/ethers.js/issues/651), [#652](https://github.com/ethers-io/ethers.js/issues/652); [1ec5804](https://github.com/ethers-io/ethers.js/commit/1ec5804bd460f6948d4813469fdc7bf739baa6a6))
|
||||
- Migrated to scrypt-js v3. ([75895fa](https://github.com/ethers-io/ethers.js/commit/75895fa1491e7542c755a102f4e4c190685fd2b6))
|
||||
- Moved getDefaultProvider to providers package. ([51e4ef2](https://github.com/ethers-io/ethers.js/commit/51e4ef2b45b83a8d82923600a2fac544d70b0807))
|
||||
- Migrating providers to modern syntax and scoping. ([#634](https://github.com/ethers-io/ethers.js/issues/634); [e1509a6](https://github.com/ethers-io/ethers.js/commit/e1509a6326dd2cb8bf7ed64b82dd3947b768a314))
|
||||
- Migrating to modern syntax and scoping. ([#634](https://github.com/ethers-io/ethers.js/issues/634); [394c36c](https://github.com/ethers-io/ethers.js/commit/394c36cad43f229a94c72d21f94d1c7982a887a1))
|
||||
- Added provider property to Web3Provider. ([#641](https://github.com/ethers-io/ethers.js/issues/641); [1d4f90a](https://github.com/ethers-io/ethers.js/commit/1d4f90a958da6364117353850d62535c9702abd2))
|
||||
- Updated GitHub issue cache. ([494381a](https://github.com/ethers-io/ethers.js/commit/494381a6284cc8ed90bd8002d42a6b6d94dc1200))
|
||||
- Force deploy receipt to address to be null. ([#573](https://github.com/ethers-io/ethers.js/issues/573); [d9d438a](https://github.com/ethers-io/ethers.js/commit/d9d438a119bb11f8516fc9cf02c534ab3816fcb3))
|
||||
- Updated experimental NonceManager. ([3d514c8](https://github.com/ethers-io/ethers.js/commit/3d514c8dbb94e1c4ce5754463e683dd9dbe7c0aa))
|
||||
- Fixed typo in error message. ([28339a9](https://github.com/ethers-io/ethers.js/commit/28339a9c8585392086da159a46df4afb8958915c))
|
||||
- Added GitHub issue caching. ([fea867a](https://github.com/ethers-io/ethers.js/commit/fea867a206f007a17718396e486883a5e718aa29))
|
||||
|
||||
ethers/v5.0.0-beta.159 (2019-10-17 01:08)
|
||||
-----------------------------------------
|
||||
|
||||
|
2
packages/abi/lib.esm/_version.d.ts
vendored
2
packages/abi/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "abi/5.0.0-beta.140";
|
||||
export declare const version = "abi/5.0.0-beta.141";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "abi/5.0.0-beta.140";
|
||||
export const version = "abi/5.0.0-beta.141";
|
||||
|
@ -43,7 +43,10 @@ function parseParamType(param, allowIndexed) {
|
||||
let c = param[i];
|
||||
switch (c) {
|
||||
case "(":
|
||||
if (!node.state.allowParams) {
|
||||
if (node.state.allowType && node.type === "") {
|
||||
node.type = "tuple";
|
||||
}
|
||||
else if (!node.state.allowParams) {
|
||||
throwError(i);
|
||||
}
|
||||
node.state.allowType = false;
|
||||
|
@ -67,17 +67,19 @@ export class Interface {
|
||||
bucket[signature] = fragment;
|
||||
});
|
||||
// Add any fragments with a unique name by its name (sans signature parameters)
|
||||
/*
|
||||
[this.events, this.functions].forEach((bucket) => {
|
||||
let count = getNameCount(bucket);
|
||||
Object.keys(bucket).forEach((signature) => {
|
||||
let fragment = bucket[signature];
|
||||
if (count[fragment.name] !== 1) {
|
||||
logger.warn("duplicate definition - " + fragment.name);
|
||||
return;
|
||||
logger.warn("duplicate definition - " + fragment.name);
|
||||
return;
|
||||
}
|
||||
bucket[fragment.name] = fragment;
|
||||
});
|
||||
});
|
||||
*/
|
||||
// If we do not have a constructor use the default "constructor() payable"
|
||||
if (!this.deploy) {
|
||||
defineReadOnly(this, "deploy", ConstructorFragment.from({ type: "constructor" }));
|
||||
@ -98,24 +100,60 @@ export class Interface {
|
||||
}
|
||||
getFunction(nameOrSignatureOrSighash) {
|
||||
if (isHexString(nameOrSignatureOrSighash)) {
|
||||
return getFragment(nameOrSignatureOrSighash, this.getSighash.bind(this), this.functions);
|
||||
for (const name in this.functions) {
|
||||
if (nameOrSignatureOrSighash === this.getSighash(name)) {
|
||||
return this.functions[name];
|
||||
}
|
||||
}
|
||||
logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash);
|
||||
}
|
||||
// It is a bare name, look up the function (will return null if ambiguous)
|
||||
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
||||
return (this.functions[nameOrSignatureOrSighash.trim()] || null);
|
||||
const name = nameOrSignatureOrSighash.trim();
|
||||
const matching = Object.keys(this.functions).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
||||
if (matching.length === 0) {
|
||||
logger.throwArgumentError("no matching function", "name", name);
|
||||
}
|
||||
else if (matching.length > 1) {
|
||||
logger.throwArgumentError("multiple matching functions", "name", name);
|
||||
}
|
||||
return this.functions[matching[0]];
|
||||
}
|
||||
// Normlize the signature and lookup the function
|
||||
return this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||
const result = this.functions[FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||
if (!result) {
|
||||
logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
getEvent(nameOrSignatureOrTopic) {
|
||||
if (isHexString(nameOrSignatureOrTopic)) {
|
||||
return getFragment(nameOrSignatureOrTopic, this.getEventTopic.bind(this), this.events);
|
||||
const topichash = nameOrSignatureOrTopic.toLowerCase();
|
||||
for (const name in this.events) {
|
||||
if (topichash === this.getEventTopic(name)) {
|
||||
return this.events[name];
|
||||
}
|
||||
}
|
||||
logger.throwArgumentError("no matching event", "topichash", topichash);
|
||||
}
|
||||
// It is a bare name, look up the function (will return null if ambiguous)
|
||||
if (nameOrSignatureOrTopic.indexOf("(") === -1) {
|
||||
return this.events[nameOrSignatureOrTopic];
|
||||
const name = nameOrSignatureOrTopic.trim();
|
||||
const matching = Object.keys(this.events).filter((f) => (f.split("(" /* fix:) */)[0] === name));
|
||||
if (matching.length === 0) {
|
||||
logger.throwArgumentError("no matching event", "name", name);
|
||||
}
|
||||
else if (matching.length > 1) {
|
||||
logger.throwArgumentError("multiple matching events", "name", name);
|
||||
}
|
||||
return this.events[matching[0]];
|
||||
}
|
||||
return this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
||||
// Normlize the signature and lookup the function
|
||||
const result = this.events[EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
||||
if (!result) {
|
||||
logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
getSighash(functionFragment) {
|
||||
if (typeof (functionFragment) === "string") {
|
||||
@ -335,27 +373,3 @@ export class Interface {
|
||||
return !!(value && value._isInterface);
|
||||
}
|
||||
}
|
||||
function getFragment(hash, calcFunc, items) {
|
||||
for (let signature in items) {
|
||||
if (signature.indexOf("(") === -1) {
|
||||
continue;
|
||||
}
|
||||
let fragment = items[signature];
|
||||
if (calcFunc(fragment) === hash) {
|
||||
return fragment;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function getNameCount(fragments) {
|
||||
let unique = {};
|
||||
// Count each name
|
||||
for (let signature in fragments) {
|
||||
let name = fragments[signature].name;
|
||||
if (!unique[name]) {
|
||||
unique[name] = 0;
|
||||
}
|
||||
unique[name]++;
|
||||
}
|
||||
return unique;
|
||||
}
|
||||
|
2
packages/abi/lib/_version.d.ts
vendored
2
packages/abi/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "abi/5.0.0-beta.140";
|
||||
export declare const version = "abi/5.0.0-beta.141";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "abi/5.0.0-beta.140";
|
||||
exports.version = "abi/5.0.0-beta.141";
|
||||
|
@ -57,7 +57,10 @@ function parseParamType(param, allowIndexed) {
|
||||
var c = param[i];
|
||||
switch (c) {
|
||||
case "(":
|
||||
if (!node.state.allowParams) {
|
||||
if (node.state.allowType && node.type === "") {
|
||||
node.type = "tuple";
|
||||
}
|
||||
else if (!node.state.allowParams) {
|
||||
throwError(i);
|
||||
}
|
||||
node.state.allowType = false;
|
||||
|
@ -105,17 +105,19 @@ var Interface = /** @class */ (function () {
|
||||
bucket[signature] = fragment;
|
||||
});
|
||||
// Add any fragments with a unique name by its name (sans signature parameters)
|
||||
[this.events, this.functions].forEach(function (bucket) {
|
||||
var count = getNameCount(bucket);
|
||||
Object.keys(bucket).forEach(function (signature) {
|
||||
var fragment = bucket[signature];
|
||||
/*
|
||||
[this.events, this.functions].forEach((bucket) => {
|
||||
let count = getNameCount(bucket);
|
||||
Object.keys(bucket).forEach((signature) => {
|
||||
let fragment = bucket[signature];
|
||||
if (count[fragment.name] !== 1) {
|
||||
logger.warn("duplicate definition - " + fragment.name);
|
||||
return;
|
||||
logger.warn("duplicate definition - " + fragment.name);
|
||||
return;
|
||||
}
|
||||
bucket[fragment.name] = fragment;
|
||||
});
|
||||
});
|
||||
*/
|
||||
// If we do not have a constructor use the default "constructor() payable"
|
||||
if (!this.deploy) {
|
||||
properties_1.defineReadOnly(this, "deploy", fragments_1.ConstructorFragment.from({ type: "constructor" }));
|
||||
@ -136,24 +138,60 @@ var Interface = /** @class */ (function () {
|
||||
};
|
||||
Interface.prototype.getFunction = function (nameOrSignatureOrSighash) {
|
||||
if (bytes_1.isHexString(nameOrSignatureOrSighash)) {
|
||||
return getFragment(nameOrSignatureOrSighash, this.getSighash.bind(this), this.functions);
|
||||
for (var name_1 in this.functions) {
|
||||
if (nameOrSignatureOrSighash === this.getSighash(name_1)) {
|
||||
return this.functions[name_1];
|
||||
}
|
||||
}
|
||||
logger.throwArgumentError("no matching function", "sighash", nameOrSignatureOrSighash);
|
||||
}
|
||||
// It is a bare name, look up the function (will return null if ambiguous)
|
||||
if (nameOrSignatureOrSighash.indexOf("(") === -1) {
|
||||
return (this.functions[nameOrSignatureOrSighash.trim()] || null);
|
||||
var name_2 = nameOrSignatureOrSighash.trim();
|
||||
var matching = Object.keys(this.functions).filter(function (f) { return (f.split("(" /* fix:) */)[0] === name_2); });
|
||||
if (matching.length === 0) {
|
||||
logger.throwArgumentError("no matching function", "name", name_2);
|
||||
}
|
||||
else if (matching.length > 1) {
|
||||
logger.throwArgumentError("multiple matching functions", "name", name_2);
|
||||
}
|
||||
return this.functions[matching[0]];
|
||||
}
|
||||
// Normlize the signature and lookup the function
|
||||
return this.functions[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||
var result = this.functions[fragments_1.FunctionFragment.fromString(nameOrSignatureOrSighash).format()];
|
||||
if (!result) {
|
||||
logger.throwArgumentError("no matching function", "signature", nameOrSignatureOrSighash);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
Interface.prototype.getEvent = function (nameOrSignatureOrTopic) {
|
||||
if (bytes_1.isHexString(nameOrSignatureOrTopic)) {
|
||||
return getFragment(nameOrSignatureOrTopic, this.getEventTopic.bind(this), this.events);
|
||||
var topichash = nameOrSignatureOrTopic.toLowerCase();
|
||||
for (var name_3 in this.events) {
|
||||
if (topichash === this.getEventTopic(name_3)) {
|
||||
return this.events[name_3];
|
||||
}
|
||||
}
|
||||
logger.throwArgumentError("no matching event", "topichash", topichash);
|
||||
}
|
||||
// It is a bare name, look up the function (will return null if ambiguous)
|
||||
if (nameOrSignatureOrTopic.indexOf("(") === -1) {
|
||||
return this.events[nameOrSignatureOrTopic];
|
||||
var name_4 = nameOrSignatureOrTopic.trim();
|
||||
var matching = Object.keys(this.events).filter(function (f) { return (f.split("(" /* fix:) */)[0] === name_4); });
|
||||
if (matching.length === 0) {
|
||||
logger.throwArgumentError("no matching event", "name", name_4);
|
||||
}
|
||||
else if (matching.length > 1) {
|
||||
logger.throwArgumentError("multiple matching events", "name", name_4);
|
||||
}
|
||||
return this.events[matching[0]];
|
||||
}
|
||||
return this.events[fragments_1.EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
||||
// Normlize the signature and lookup the function
|
||||
var result = this.events[fragments_1.EventFragment.fromString(nameOrSignatureOrTopic).format()];
|
||||
if (!result) {
|
||||
logger.throwArgumentError("no matching event", "signature", nameOrSignatureOrTopic);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
Interface.prototype.getSighash = function (functionFragment) {
|
||||
if (typeof (functionFragment) === "string") {
|
||||
@ -376,27 +414,3 @@ var Interface = /** @class */ (function () {
|
||||
return Interface;
|
||||
}());
|
||||
exports.Interface = Interface;
|
||||
function getFragment(hash, calcFunc, items) {
|
||||
for (var signature in items) {
|
||||
if (signature.indexOf("(") === -1) {
|
||||
continue;
|
||||
}
|
||||
var fragment = items[signature];
|
||||
if (calcFunc(fragment) === hash) {
|
||||
return fragment;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function getNameCount(fragments) {
|
||||
var unique = {};
|
||||
// Count each name
|
||||
for (var signature in fragments) {
|
||||
var name_1 = fragments[signature].name;
|
||||
if (!unique[name_1]) {
|
||||
unique[name_1] = 0;
|
||||
}
|
||||
unique[name_1]++;
|
||||
}
|
||||
return unique;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/abi",
|
||||
"version": "5.0.0-beta.140",
|
||||
"version": "5.0.0-beta.141",
|
||||
"description": "Utilities and Classes for parsing, formatting and managing Ethereum ABIs.",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
@ -33,5 +33,5 @@
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0x3e0d6156f8855cd1938962b691562193daeffacdf061949e8a6ad329e8a1e207"
|
||||
"tarballHash": "0x8ab039f54add63e60520103856dcec83107f301a5d712a92cc6207a0ddbf3ffc"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "abi/5.0.0-beta.140";
|
||||
export const version = "abi/5.0.0-beta.141";
|
||||
|
@ -1 +1 @@
|
||||
export declare const version = "abstract-signer/5.0.0-beta.135";
|
||||
export declare const version = "abstract-signer/5.0.0-beta.136";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "abstract-signer/5.0.0-beta.135";
|
||||
export const version = "abstract-signer/5.0.0-beta.136";
|
||||
|
@ -1,4 +1,13 @@
|
||||
"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 { defineReadOnly, resolveProperties, shallowCopy } from "@ethersproject/properties";
|
||||
import { Logger } from "@ethersproject/logger";
|
||||
import { version } from "./_version";
|
||||
@ -74,12 +83,12 @@ export class Signer {
|
||||
// - estimateGas
|
||||
// - populateTransaction (and therefor sendTransaction)
|
||||
checkTransaction(transaction) {
|
||||
for (let key in transaction) {
|
||||
for (const key in transaction) {
|
||||
if (allowedTransactionKeys.indexOf(key) === -1) {
|
||||
logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction);
|
||||
}
|
||||
}
|
||||
let tx = shallowCopy(transaction);
|
||||
const tx = shallowCopy(transaction);
|
||||
if (tx.from == null) {
|
||||
tx.from = this.getAddress();
|
||||
}
|
||||
@ -90,7 +99,8 @@ export class Signer {
|
||||
// By default called from: (overriding these prevents it)
|
||||
// - sendTransaction
|
||||
populateTransaction(transaction) {
|
||||
return resolveProperties(this.checkTransaction(transaction)).then((tx) => {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const tx = yield resolveProperties(this.checkTransaction(transaction));
|
||||
if (tx.to != null) {
|
||||
tx.to = Promise.resolve(tx.to).then((to) => this.resolveName(to));
|
||||
}
|
||||
@ -125,7 +135,7 @@ export class Signer {
|
||||
if (tx.chainId == null) {
|
||||
tx.chainId = this.getChainId();
|
||||
}
|
||||
return resolveProperties(tx);
|
||||
return yield resolveProperties(tx);
|
||||
});
|
||||
}
|
||||
///////////////////
|
||||
|
2
packages/abstract-signer/lib/_version.d.ts
vendored
2
packages/abstract-signer/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "abstract-signer/5.0.0-beta.135";
|
||||
export declare const version = "abstract-signer/5.0.0-beta.136";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "abstract-signer/5.0.0-beta.135";
|
||||
exports.version = "abstract-signer/5.0.0-beta.136";
|
||||
|
@ -12,6 +12,42 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
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 });
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
@ -108,43 +144,52 @@ var Signer = /** @class */ (function () {
|
||||
// By default called from: (overriding these prevents it)
|
||||
// - sendTransaction
|
||||
Signer.prototype.populateTransaction = function (transaction) {
|
||||
var _this = this;
|
||||
return properties_1.resolveProperties(this.checkTransaction(transaction)).then(function (tx) {
|
||||
if (tx.to != null) {
|
||||
tx.to = Promise.resolve(tx.to).then(function (to) { return _this.resolveName(to); });
|
||||
}
|
||||
if (tx.gasPrice == null) {
|
||||
tx.gasPrice = _this.getGasPrice();
|
||||
}
|
||||
if (tx.nonce == null) {
|
||||
tx.nonce = _this.getTransactionCount("pending");
|
||||
}
|
||||
// Make sure any provided address matches this signer
|
||||
if (tx.from == null) {
|
||||
tx.from = _this.getAddress();
|
||||
}
|
||||
else {
|
||||
tx.from = Promise.all([
|
||||
_this.getAddress(),
|
||||
_this.provider.resolveName(tx.from)
|
||||
]).then(function (results) {
|
||||
if (results[0] !== results[1]) {
|
||||
logger.throwArgumentError("from address mismatch", "transaction", transaction);
|
||||
}
|
||||
return results[0];
|
||||
});
|
||||
}
|
||||
if (tx.gasLimit == null) {
|
||||
tx.gasLimit = _this.estimateGas(tx).catch(function (error) {
|
||||
logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
|
||||
tx: tx
|
||||
});
|
||||
});
|
||||
}
|
||||
if (tx.chainId == null) {
|
||||
tx.chainId = _this.getChainId();
|
||||
}
|
||||
return properties_1.resolveProperties(tx);
|
||||
return __awaiter(this, void 0, void 0, function () {
|
||||
var tx;
|
||||
var _this = this;
|
||||
return __generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0: return [4 /*yield*/, properties_1.resolveProperties(this.checkTransaction(transaction))];
|
||||
case 1:
|
||||
tx = _a.sent();
|
||||
if (tx.to != null) {
|
||||
tx.to = Promise.resolve(tx.to).then(function (to) { return _this.resolveName(to); });
|
||||
}
|
||||
if (tx.gasPrice == null) {
|
||||
tx.gasPrice = this.getGasPrice();
|
||||
}
|
||||
if (tx.nonce == null) {
|
||||
tx.nonce = this.getTransactionCount("pending");
|
||||
}
|
||||
// Make sure any provided address matches this signer
|
||||
if (tx.from == null) {
|
||||
tx.from = this.getAddress();
|
||||
}
|
||||
else {
|
||||
tx.from = Promise.all([
|
||||
this.getAddress(),
|
||||
this.provider.resolveName(tx.from)
|
||||
]).then(function (results) {
|
||||
if (results[0] !== results[1]) {
|
||||
logger.throwArgumentError("from address mismatch", "transaction", transaction);
|
||||
}
|
||||
return results[0];
|
||||
});
|
||||
}
|
||||
if (tx.gasLimit == null) {
|
||||
tx.gasLimit = this.estimateGas(tx).catch(function (error) {
|
||||
logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
|
||||
tx: tx
|
||||
});
|
||||
});
|
||||
}
|
||||
if (tx.chainId == null) {
|
||||
tx.chainId = this.getChainId();
|
||||
}
|
||||
return [4 /*yield*/, properties_1.resolveProperties(tx)];
|
||||
case 2: return [2 /*return*/, _a.sent()];
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
///////////////////
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/abstract-signer",
|
||||
"version": "5.0.0-beta.135",
|
||||
"version": "5.0.0-beta.136",
|
||||
"description": "An Abstract Class for desribing an Ethereum Signer for ethers.",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
@ -29,5 +29,5 @@
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0x6b8c183c976fddaf1cea8a6044447d674b5a30a2fd8364e321affaa573139a89"
|
||||
"tarballHash": "0xb15621c33c076e145b49f77d1fb608f584ae52db026ba52673102eed4bdff2e9"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "abstract-signer/5.0.0-beta.135";
|
||||
export const version = "abstract-signer/5.0.0-beta.136";
|
||||
|
2
packages/address/lib.esm/_version.d.ts
vendored
2
packages/address/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "address/5.0.0-beta.131";
|
||||
export declare const version = "address/5.0.0-beta.132";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "address/5.0.0-beta.131";
|
||||
export const version = "address/5.0.0-beta.132";
|
||||
|
@ -13,12 +13,12 @@ function getChecksumAddress(address) {
|
||||
logger.throwArgumentError("invalid address", "address", address);
|
||||
}
|
||||
address = address.toLowerCase();
|
||||
let chars = address.substring(2).split("");
|
||||
let hashed = new Uint8Array(40);
|
||||
const chars = address.substring(2).split("");
|
||||
const expanded = new Uint8Array(40);
|
||||
for (let i = 0; i < 40; i++) {
|
||||
hashed[i] = chars[i].charCodeAt(0);
|
||||
expanded[i] = chars[i].charCodeAt(0);
|
||||
}
|
||||
hashed = arrayify(keccak256(hashed));
|
||||
const hashed = arrayify(keccak256(expanded));
|
||||
for (let i = 0; i < 40; i += 2) {
|
||||
if ((hashed[i >> 1] >> 4) >= 8) {
|
||||
chars[i] = chars[i].toUpperCase();
|
||||
@ -39,7 +39,7 @@ function log10(x) {
|
||||
}
|
||||
// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number
|
||||
// Create lookup table
|
||||
let ibanLookup = {};
|
||||
const ibanLookup = {};
|
||||
for (let i = 0; i < 10; i++) {
|
||||
ibanLookup[String(i)] = String(i);
|
||||
}
|
||||
@ -47,14 +47,11 @@ for (let i = 0; i < 26; i++) {
|
||||
ibanLookup[String.fromCharCode(65 + i)] = String(10 + i);
|
||||
}
|
||||
// How many decimal digits can we process? (for 64-bit float, this is 15)
|
||||
let safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));
|
||||
const safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));
|
||||
function ibanChecksum(address) {
|
||||
address = address.toUpperCase();
|
||||
address = address.substring(4) + address.substring(0, 2) + "00";
|
||||
let expanded = "";
|
||||
address.split("").forEach(function (c) {
|
||||
expanded += ibanLookup[c];
|
||||
});
|
||||
let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join("");
|
||||
// Javascript can handle integers safely up to 15 (decimal) digits
|
||||
while (expanded.length >= safeDigits) {
|
||||
let block = expanded.substring(0, safeDigits);
|
||||
@ -124,6 +121,6 @@ export function getContractAddress(transaction) {
|
||||
catch (error) {
|
||||
logger.throwArgumentError("missing from address", "transaction", transaction);
|
||||
}
|
||||
let nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString()));
|
||||
const nonce = stripZeros(arrayify(BigNumber.from(transaction.nonce).toHexString()));
|
||||
return getAddress(hexDataSlice(keccak256(encode([from, nonce])), 12));
|
||||
}
|
||||
|
2
packages/address/lib/_version.d.ts
vendored
2
packages/address/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "address/5.0.0-beta.131";
|
||||
export declare const version = "address/5.0.0-beta.132";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "address/5.0.0-beta.131";
|
||||
exports.version = "address/5.0.0-beta.132";
|
||||
|
@ -15,11 +15,11 @@ function getChecksumAddress(address) {
|
||||
}
|
||||
address = address.toLowerCase();
|
||||
var chars = address.substring(2).split("");
|
||||
var hashed = new Uint8Array(40);
|
||||
var expanded = new Uint8Array(40);
|
||||
for (var i = 0; i < 40; i++) {
|
||||
hashed[i] = chars[i].charCodeAt(0);
|
||||
expanded[i] = chars[i].charCodeAt(0);
|
||||
}
|
||||
hashed = bytes_1.arrayify(keccak256_1.keccak256(hashed));
|
||||
var hashed = bytes_1.arrayify(keccak256_1.keccak256(expanded));
|
||||
for (var i = 0; i < 40; i += 2) {
|
||||
if ((hashed[i >> 1] >> 4) >= 8) {
|
||||
chars[i] = chars[i].toUpperCase();
|
||||
@ -52,10 +52,7 @@ var safeDigits = Math.floor(log10(MAX_SAFE_INTEGER));
|
||||
function ibanChecksum(address) {
|
||||
address = address.toUpperCase();
|
||||
address = address.substring(4) + address.substring(0, 2) + "00";
|
||||
var expanded = "";
|
||||
address.split("").forEach(function (c) {
|
||||
expanded += ibanLookup[c];
|
||||
});
|
||||
var expanded = address.split("").map(function (c) { return ibanLookup[c]; }).join("");
|
||||
// Javascript can handle integers safely up to 15 (decimal) digits
|
||||
while (expanded.length >= safeDigits) {
|
||||
var block = expanded.substring(0, safeDigits);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/address",
|
||||
"version": "5.0.0-beta.131",
|
||||
"version": "5.0.0-beta.132",
|
||||
"description": "Utilities for handling Ethereum Addresses for ethers.",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
@ -30,5 +30,5 @@
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0x602e8905b62009a926e8c96eb2f8bddcb8269f398d094ac8aeeb5536d77c2c1a"
|
||||
"tarballHash": "0x525c2a6354d1fb020e134ffa657ab8283c8448da95c2fd8b7e4291a71ced794e"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "address/5.0.0-beta.131";
|
||||
export const version = "address/5.0.0-beta.132";
|
||||
|
2
packages/base64/lib.esm/_version.d.ts
vendored
2
packages/base64/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "base64/5.0.0-beta.129";
|
||||
export declare const version = "base64/5.0.0-beta.130";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "base64/5.0.0-beta.129";
|
||||
export const version = "base64/5.0.0-beta.130";
|
||||
|
@ -2,7 +2,7 @@
|
||||
import { arrayify } from "@ethersproject/bytes";
|
||||
export function decode(textData) {
|
||||
textData = atob(textData);
|
||||
let data = [];
|
||||
const data = [];
|
||||
for (let i = 0; i < textData.length; i++) {
|
||||
data.push(textData.charCodeAt(i));
|
||||
}
|
||||
|
2
packages/base64/lib/_version.d.ts
vendored
2
packages/base64/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "base64/5.0.0-beta.129";
|
||||
export declare const version = "base64/5.0.0-beta.130";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "base64/5.0.0-beta.129";
|
||||
exports.version = "base64/5.0.0-beta.130";
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/base64",
|
||||
"version": "5.0.0-beta.129",
|
||||
"version": "5.0.0-beta.130",
|
||||
"description": "Base64 coder.",
|
||||
"main": "./lib/index.js",
|
||||
"browser": "./lib/browser.js",
|
||||
@ -26,5 +26,5 @@
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0x3ab1f7c71a596f00ebf2371360c296876ae5bc3c44fc7a1d4c063727a6d3f206"
|
||||
"tarballHash": "0x16926fbbdb8cafe3a8984e518fcb38ead0f21de2589b91dd92ca4cead71827b5"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "base64/5.0.0-beta.129";
|
||||
export const version = "base64/5.0.0-beta.130";
|
||||
|
2
packages/bignumber/lib.esm/_version.d.ts
vendored
2
packages/bignumber/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "bignumber/5.0.0-beta.133";
|
||||
export declare const version = "bignumber/5.0.0-beta.134";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "bignumber/5.0.0-beta.133";
|
||||
export const version = "bignumber/5.0.0-beta.134";
|
||||
|
@ -52,7 +52,7 @@ export class BigNumber {
|
||||
return toBigNumber(toBN(this).sub(toBN(other)));
|
||||
}
|
||||
div(other) {
|
||||
let o = BigNumber.from(other);
|
||||
const o = BigNumber.from(other);
|
||||
if (o.isZero()) {
|
||||
throwFault("division by zero", "div");
|
||||
}
|
||||
@ -195,14 +195,14 @@ function toBigNumber(value) {
|
||||
return BigNumber.from(toHex(value));
|
||||
}
|
||||
function toBN(value) {
|
||||
let hex = BigNumber.from(value).toHexString();
|
||||
const hex = BigNumber.from(value).toHexString();
|
||||
if (hex[0] === "-") {
|
||||
return (new BN("-" + hex.substring(3), 16));
|
||||
}
|
||||
return new BN(hex.substring(2), 16);
|
||||
}
|
||||
function throwFault(fault, operation, value) {
|
||||
let params = { fault: fault, operation: operation };
|
||||
const params = { fault: fault, operation: operation };
|
||||
if (value != null) {
|
||||
params.value = value;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ const _constructorGuard = {};
|
||||
const Zero = BigNumber.from(0);
|
||||
const NegativeOne = BigNumber.from(-1);
|
||||
function throwFault(message, fault, operation, value) {
|
||||
let params = { fault: fault, operation: operation };
|
||||
const params = { fault: fault, operation: operation };
|
||||
if (value !== undefined) {
|
||||
params.value = value;
|
||||
}
|
||||
@ -36,10 +36,10 @@ export function formatFixed(value, decimals) {
|
||||
if (decimals == null) {
|
||||
decimals = 0;
|
||||
}
|
||||
let multiplier = getMultiplier(decimals);
|
||||
const multiplier = getMultiplier(decimals);
|
||||
// Make sure wei is a big number (convert as necessary)
|
||||
value = BigNumber.from(value);
|
||||
let negative = value.lt(Zero);
|
||||
const negative = value.lt(Zero);
|
||||
if (negative) {
|
||||
value = value.mul(NegativeOne);
|
||||
}
|
||||
@ -49,7 +49,7 @@ export function formatFixed(value, decimals) {
|
||||
}
|
||||
// Strip training 0
|
||||
fraction = fraction.match(/^([0-9]*[1-9]|0)(0*)/)[1];
|
||||
let whole = value.div(multiplier).toString();
|
||||
const whole = value.div(multiplier).toString();
|
||||
value = whole + "." + fraction;
|
||||
if (negative) {
|
||||
value = "-" + value;
|
||||
@ -60,7 +60,7 @@ export function parseFixed(value, decimals) {
|
||||
if (decimals == null) {
|
||||
decimals = 0;
|
||||
}
|
||||
let multiplier = getMultiplier(decimals);
|
||||
const multiplier = getMultiplier(decimals);
|
||||
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
||||
logger.throwArgumentError("invalid decimal value", "value", value);
|
||||
}
|
||||
@ -68,7 +68,7 @@ export function parseFixed(value, decimals) {
|
||||
return BigNumber.from(value);
|
||||
}
|
||||
// Is it negative?
|
||||
let negative = (value.substring(0, 1) === "-");
|
||||
const negative = (value.substring(0, 1) === "-");
|
||||
if (negative) {
|
||||
value = value.substring(1);
|
||||
}
|
||||
@ -76,7 +76,7 @@ export function parseFixed(value, decimals) {
|
||||
logger.throwArgumentError("missing value", "value", value);
|
||||
}
|
||||
// Split it into a whole and fractional part
|
||||
let comps = value.split(".");
|
||||
const comps = value.split(".");
|
||||
if (comps.length > 2) {
|
||||
logger.throwArgumentError("too many decimal points", "value", value);
|
||||
}
|
||||
@ -95,8 +95,8 @@ export function parseFixed(value, decimals) {
|
||||
while (fraction.length < multiplier.length - 1) {
|
||||
fraction += "0";
|
||||
}
|
||||
let wholeValue = BigNumber.from(whole);
|
||||
let fractionValue = BigNumber.from(fraction);
|
||||
const wholeValue = BigNumber.from(whole);
|
||||
const fractionValue = BigNumber.from(fraction);
|
||||
let wei = (wholeValue.mul(multiplier)).add(fractionValue);
|
||||
if (negative) {
|
||||
wei = wei.mul(NegativeOne);
|
||||
@ -127,7 +127,7 @@ export class FixedFormat {
|
||||
signed = false;
|
||||
}
|
||||
else if (value != null) {
|
||||
let match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
||||
const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
||||
if (!match) {
|
||||
logger.throwArgumentError("invalid fixed format", "format", value);
|
||||
}
|
||||
@ -137,7 +137,7 @@ export class FixedFormat {
|
||||
}
|
||||
}
|
||||
else if (value) {
|
||||
let check = (key, type, defaultValue) => {
|
||||
const check = (key, type, defaultValue) => {
|
||||
if (value[key] == null) {
|
||||
return defaultValue;
|
||||
}
|
||||
@ -175,26 +175,26 @@ export class FixedNumber {
|
||||
}
|
||||
addUnsafe(other) {
|
||||
this._checkFormat(other);
|
||||
let a = parseFixed(this._value, this.format.decimals);
|
||||
let b = parseFixed(other._value, other.format.decimals);
|
||||
const a = parseFixed(this._value, this.format.decimals);
|
||||
const b = parseFixed(other._value, other.format.decimals);
|
||||
return FixedNumber.fromValue(a.add(b), this.format.decimals, this.format);
|
||||
}
|
||||
subUnsafe(other) {
|
||||
this._checkFormat(other);
|
||||
let a = parseFixed(this._value, this.format.decimals);
|
||||
let b = parseFixed(other._value, other.format.decimals);
|
||||
const a = parseFixed(this._value, this.format.decimals);
|
||||
const b = parseFixed(other._value, other.format.decimals);
|
||||
return FixedNumber.fromValue(a.sub(b), this.format.decimals, this.format);
|
||||
}
|
||||
mulUnsafe(other) {
|
||||
this._checkFormat(other);
|
||||
let a = parseFixed(this._value, this.format.decimals);
|
||||
let b = parseFixed(other._value, other.format.decimals);
|
||||
const a = parseFixed(this._value, this.format.decimals);
|
||||
const b = parseFixed(other._value, other.format.decimals);
|
||||
return FixedNumber.fromValue(a.mul(b).div(this.format._multiplier), this.format.decimals, this.format);
|
||||
}
|
||||
divUnsafe(other) {
|
||||
this._checkFormat(other);
|
||||
let a = parseFixed(this._value, this.format.decimals);
|
||||
let b = parseFixed(other._value, other.format.decimals);
|
||||
const a = parseFixed(this._value, this.format.decimals);
|
||||
const b = parseFixed(other._value, other.format.decimals);
|
||||
return FixedNumber.fromValue(a.mul(this.format._multiplier).div(b), this.format.decimals, this.format);
|
||||
}
|
||||
// @TODO: Support other rounding algorithms
|
||||
@ -211,7 +211,7 @@ export class FixedNumber {
|
||||
return this;
|
||||
}
|
||||
// Bump the value up by the 0.00...0005
|
||||
let bump = "0." + zeros.substring(0, decimals) + "5";
|
||||
const bump = "0." + zeros.substring(0, decimals) + "5";
|
||||
comps = this.addUnsafe(FixedNumber.fromString(bump, this.format))._value.split(".");
|
||||
// Now it is safe to truncate
|
||||
return FixedNumber.fromString(comps[0] + "." + comps[1].substring(0, decimals));
|
||||
@ -224,7 +224,7 @@ export class FixedNumber {
|
||||
if (width % 8) {
|
||||
logger.throwArgumentError("invalid byte width", "width", width);
|
||||
}
|
||||
let hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
||||
const hex = BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
||||
return hexZeroPad(hex, width / 8);
|
||||
}
|
||||
toUnsafeFloat() { return parseFloat(this.toString()); }
|
||||
@ -249,8 +249,8 @@ export class FixedNumber {
|
||||
if (format == null) {
|
||||
format = "fixed";
|
||||
}
|
||||
let fixedFormat = FixedFormat.from(format);
|
||||
let numeric = parseFixed(value, fixedFormat.decimals);
|
||||
const fixedFormat = FixedFormat.from(format);
|
||||
const numeric = parseFixed(value, fixedFormat.decimals);
|
||||
if (!fixedFormat.signed && numeric.lt(Zero)) {
|
||||
throwFault("unsigned value cannot be negative", "overflow", "value", value);
|
||||
}
|
||||
@ -262,14 +262,14 @@ export class FixedNumber {
|
||||
hex = numeric.toHexString();
|
||||
hex = hexZeroPad(hex, fixedFormat.width / 8);
|
||||
}
|
||||
let decimal = formatFixed(numeric, fixedFormat.decimals);
|
||||
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
||||
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
||||
}
|
||||
static fromBytes(value, format) {
|
||||
if (format == null) {
|
||||
format = "fixed";
|
||||
}
|
||||
let fixedFormat = FixedFormat.from(format);
|
||||
const fixedFormat = FixedFormat.from(format);
|
||||
if (arrayify(value).length > fixedFormat.width / 8) {
|
||||
throw new Error("overflow");
|
||||
}
|
||||
@ -277,8 +277,8 @@ export class FixedNumber {
|
||||
if (fixedFormat.signed) {
|
||||
numeric = numeric.fromTwos(fixedFormat.width);
|
||||
}
|
||||
let hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
||||
let decimal = formatFixed(numeric, fixedFormat.decimals);
|
||||
const hex = numeric.toTwos((fixedFormat.signed ? 0 : 1) + fixedFormat.width).toHexString();
|
||||
const decimal = formatFixed(numeric, fixedFormat.decimals);
|
||||
return new FixedNumber(_constructorGuard, hex, decimal, fixedFormat);
|
||||
}
|
||||
static from(value, format) {
|
||||
|
2
packages/bignumber/lib/_version.d.ts
vendored
2
packages/bignumber/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "bignumber/5.0.0-beta.133";
|
||||
export declare const version = "bignumber/5.0.0-beta.134";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "bignumber/5.0.0-beta.133";
|
||||
exports.version = "bignumber/5.0.0-beta.134";
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/bignumber",
|
||||
"version": "5.0.0-beta.133",
|
||||
"version": "5.0.0-beta.134",
|
||||
"description": "BigNumber library used in ethers.js.",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
@ -29,5 +29,5 @@
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0x384e4e9abbfdfd873a8dbf105cd03a5cee12f85bbb1edc7f63d57580b73f92b5"
|
||||
"tarballHash": "0x953ebc5751e6ae80be6e3749a560efb4845a43a460a03815ca4e265116c09d06"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "bignumber/5.0.0-beta.133";
|
||||
export const version = "bignumber/5.0.0-beta.134";
|
||||
|
2
packages/bytes/lib.esm/_version.d.ts
vendored
2
packages/bytes/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "bytes/5.0.0-beta.132";
|
||||
export declare const version = "bytes/5.0.0-beta.133";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "bytes/5.0.0-beta.132";
|
||||
export const version = "bytes/5.0.0-beta.133";
|
||||
|
@ -11,7 +11,7 @@ function addSlice(array) {
|
||||
return array;
|
||||
}
|
||||
array.slice = function () {
|
||||
let args = Array.prototype.slice.call(arguments);
|
||||
const args = Array.prototype.slice.call(arguments);
|
||||
return addSlice(new Uint8Array(Array.prototype.slice.apply(array, args)));
|
||||
};
|
||||
return array;
|
||||
@ -33,7 +33,7 @@ export function isBytes(value) {
|
||||
return false;
|
||||
}
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
let v = value[i];
|
||||
const v = value[i];
|
||||
if (v < 0 || v >= 256 || (v % 1)) {
|
||||
return false;
|
||||
}
|
||||
@ -46,7 +46,7 @@ export function arrayify(value, options) {
|
||||
}
|
||||
if (typeof (value) === "number") {
|
||||
logger.checkSafeUint53(value, "invalid arrayify value");
|
||||
let result = [];
|
||||
const result = [];
|
||||
while (value) {
|
||||
result.unshift(value & 0xff);
|
||||
value /= 256;
|
||||
@ -75,7 +75,7 @@ export function arrayify(value, options) {
|
||||
logger.throwArgumentError("hex data is odd-length", "value", value);
|
||||
}
|
||||
}
|
||||
let result = [];
|
||||
const result = [];
|
||||
for (let i = 0; i < hex.length; i += 2) {
|
||||
result.push(parseInt(hex.substring(i, i + 2), 16));
|
||||
}
|
||||
@ -87,9 +87,9 @@ export function arrayify(value, options) {
|
||||
return logger.throwArgumentError("invalid arrayify value", "value", value);
|
||||
}
|
||||
export function concat(items) {
|
||||
let objects = items.map(item => arrayify(item));
|
||||
let length = objects.reduce((accum, item) => (accum + item.length), 0);
|
||||
let result = new Uint8Array(length);
|
||||
const objects = items.map(item => arrayify(item));
|
||||
const length = objects.reduce((accum, item) => (accum + item.length), 0);
|
||||
const result = new Uint8Array(length);
|
||||
objects.reduce((offset, object) => {
|
||||
result.set(object, offset);
|
||||
return offset + object.length;
|
||||
@ -117,7 +117,7 @@ export function zeroPad(value, length) {
|
||||
if (value.length > length) {
|
||||
logger.throwArgumentError("value out of range", "value", arguments[0]);
|
||||
}
|
||||
let result = new Uint8Array(length);
|
||||
const result = new Uint8Array(length);
|
||||
result.set(value, length - value.length);
|
||||
return addSlice(result);
|
||||
}
|
||||
@ -218,7 +218,7 @@ export function hexConcat(items) {
|
||||
return result;
|
||||
}
|
||||
export function hexValue(value) {
|
||||
let trimmed = hexStripZeros(hexlify(value, { hexPad: "left" }));
|
||||
const trimmed = hexStripZeros(hexlify(value, { hexPad: "left" }));
|
||||
if (trimmed === "0x") {
|
||||
return "0x0";
|
||||
}
|
||||
@ -254,7 +254,7 @@ export function hexZeroPad(value, length) {
|
||||
return value;
|
||||
}
|
||||
export function splitSignature(signature) {
|
||||
let result = {
|
||||
const result = {
|
||||
r: "0x",
|
||||
s: "0x",
|
||||
_vs: "0x",
|
||||
@ -262,7 +262,7 @@ export function splitSignature(signature) {
|
||||
v: 0
|
||||
};
|
||||
if (isBytesLike(signature)) {
|
||||
let bytes = arrayify(signature);
|
||||
const bytes = arrayify(signature);
|
||||
if (bytes.length !== 65) {
|
||||
logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
|
||||
}
|
||||
@ -318,12 +318,12 @@ export function splitSignature(signature) {
|
||||
if (result._vs.length > 66) {
|
||||
logger.throwArgumentError("signature _vs overflow", "signature", signature);
|
||||
}
|
||||
let vs = arrayify(result._vs);
|
||||
let recoveryParam = ((vs[0] >= 128) ? 1 : 0);
|
||||
let v = 27 + result.recoveryParam;
|
||||
const vs = arrayify(result._vs);
|
||||
const recoveryParam = ((vs[0] >= 128) ? 1 : 0);
|
||||
const v = 27 + result.recoveryParam;
|
||||
// Use _vs to compute s
|
||||
vs[0] &= 0x7f;
|
||||
let s = hexlify(vs);
|
||||
const s = hexlify(vs);
|
||||
// Check _vs aggress with other parameters
|
||||
if (result.s == null) {
|
||||
result.s = s;
|
||||
@ -357,7 +357,7 @@ export function splitSignature(signature) {
|
||||
logger.throwArgumentError("signature overflow r or s", "signature", signature);
|
||||
}
|
||||
if (result._vs == null) {
|
||||
let vs = arrayify(result.s);
|
||||
const vs = arrayify(result.s);
|
||||
if (vs[0] >= 128) {
|
||||
logger.throwArgumentError("signature s out of range", "signature", signature);
|
||||
}
|
||||
|
2
packages/bytes/lib/_version.d.ts
vendored
2
packages/bytes/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "bytes/5.0.0-beta.132";
|
||||
export declare const version = "bytes/5.0.0-beta.133";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "bytes/5.0.0-beta.132";
|
||||
exports.version = "bytes/5.0.0-beta.133";
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/bytes",
|
||||
"version": "5.0.0-beta.132",
|
||||
"version": "5.0.0-beta.133",
|
||||
"description": "Bytes utility functions for ethers.",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
@ -27,5 +27,5 @@
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0xea2884dc82e479b3b674c73850c069acd777740d8099630c644880f52fcf4abd"
|
||||
"tarballHash": "0x3e8a397f275035835198e5399652aec1e0427ef473f6abfaccf764cbeecc5b89"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "bytes/5.0.0-beta.132";
|
||||
export const version = "bytes/5.0.0-beta.133";
|
||||
|
2
packages/cli/lib.esm/_version.d.ts
vendored
2
packages/cli/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "cli/5.0.0-beta.145";
|
||||
export declare const version = "cli/5.0.0-beta.146";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "cli/5.0.0-beta.145";
|
||||
export const version = "cli/5.0.0-beta.146";
|
||||
|
@ -11,7 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
import fs from "fs";
|
||||
import { basename } from "path";
|
||||
import { ethers } from "ethers";
|
||||
import scrypt from "scrypt-js";
|
||||
import * as scrypt from "scrypt-js";
|
||||
import { getChoice, getPassword, getProgressBar } from "./prompt";
|
||||
import { version } from "./_version";
|
||||
const logger = new ethers.utils.Logger(version);
|
||||
@ -396,21 +396,11 @@ function loadAccount(arg, plugin, preventFile) {
|
||||
let passwordBytes = ethers.utils.toUtf8Bytes(password, ethers.utils.UnicodeNormalizationForm.NFKC);
|
||||
let saltBytes = ethers.utils.arrayify(ethers.utils.HDNode.fromMnemonic(mnemonic).privateKey);
|
||||
let progressBar = getProgressBar("Decrypting");
|
||||
return (new Promise((resolve, reject) => {
|
||||
scrypt(passwordBytes, saltBytes, (1 << 20), 8, 1, 32, (error, progress, key) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
progressBar(progress);
|
||||
if (key) {
|
||||
let derivedPassword = ethers.utils.hexlify(key).substring(2);
|
||||
let node = ethers.utils.HDNode.fromMnemonic(mnemonic, derivedPassword).derivePath(ethers.utils.defaultPath);
|
||||
resolve(new ethers.Wallet(node.privateKey, plugin.provider));
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
return scrypt.scrypt(passwordBytes, saltBytes, (1 << 20), 8, 1, 32, progressBar).then((key) => {
|
||||
const derivedPassword = ethers.utils.hexlify(key).substring(2);
|
||||
const node = ethers.utils.HDNode.fromMnemonic(mnemonic, derivedPassword).derivePath(ethers.utils.defaultPath);
|
||||
return new ethers.Wallet(node.privateKey, plugin.provider);
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
@ -43,7 +43,7 @@ export function compile(source, options) {
|
||||
let findImport = (filename) => {
|
||||
try {
|
||||
return {
|
||||
contents: fs.readFileSync(resolve(options.basedir, options.filename)).toString()
|
||||
contents: fs.readFileSync(resolve(options.basedir, filename)).toString()
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
|
2
packages/cli/lib/_version.d.ts
vendored
2
packages/cli/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "cli/5.0.0-beta.145";
|
||||
export declare const version = "cli/5.0.0-beta.146";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "cli/5.0.0-beta.145";
|
||||
exports.version = "cli/5.0.0-beta.146";
|
||||
|
@ -51,11 +51,18 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var fs_1 = __importDefault(require("fs"));
|
||||
var path_1 = require("path");
|
||||
var ethers_1 = require("ethers");
|
||||
var scrypt_js_1 = __importDefault(require("scrypt-js"));
|
||||
var scrypt = __importStar(require("scrypt-js"));
|
||||
var prompt_1 = require("./prompt");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
|
||||
@ -544,21 +551,11 @@ function loadAccount(arg, plugin, preventFile) {
|
||||
var passwordBytes = ethers_1.ethers.utils.toUtf8Bytes(password, ethers_1.ethers.utils.UnicodeNormalizationForm.NFKC);
|
||||
var saltBytes = ethers_1.ethers.utils.arrayify(ethers_1.ethers.utils.HDNode.fromMnemonic(mnemonic_1).privateKey);
|
||||
var progressBar = prompt_1.getProgressBar("Decrypting");
|
||||
return (new Promise(function (resolve, reject) {
|
||||
scrypt_js_1.default(passwordBytes, saltBytes, (1 << 20), 8, 1, 32, function (error, progress, key) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
else {
|
||||
progressBar(progress);
|
||||
if (key) {
|
||||
var derivedPassword = ethers_1.ethers.utils.hexlify(key).substring(2);
|
||||
var node = ethers_1.ethers.utils.HDNode.fromMnemonic(mnemonic_1, derivedPassword).derivePath(ethers_1.ethers.utils.defaultPath);
|
||||
resolve(new ethers_1.ethers.Wallet(node.privateKey, plugin.provider));
|
||||
}
|
||||
}
|
||||
});
|
||||
}));
|
||||
return scrypt.scrypt(passwordBytes, saltBytes, (1 << 20), 8, 1, 32, progressBar).then(function (key) {
|
||||
var derivedPassword = ethers_1.ethers.utils.hexlify(key).substring(2);
|
||||
var node = ethers_1.ethers.utils.HDNode.fromMnemonic(mnemonic_1, derivedPassword).derivePath(ethers_1.ethers.utils.defaultPath);
|
||||
return new ethers_1.ethers.Wallet(node.privateKey, plugin.provider);
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
@ -47,7 +47,7 @@ function compile(source, options) {
|
||||
var findImport = function (filename) {
|
||||
try {
|
||||
return {
|
||||
contents: fs_1.default.readFileSync(path_1.resolve(options.basedir, options.filename)).toString()
|
||||
contents: fs_1.default.readFileSync(path_1.resolve(options.basedir, filename)).toString()
|
||||
};
|
||||
}
|
||||
catch (error) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/cli",
|
||||
"version": "5.0.0-beta.145",
|
||||
"version": "5.0.0-beta.146",
|
||||
"description": "Command-Line Interface scripts and releated utilities.",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
@ -39,5 +39,5 @@
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0x57a2be298c5b9a6e4a800c9e5412cb2c3afd8ef6268c6f92423499a0d58611cf"
|
||||
"tarballHash": "0x664e42117580037f716878bd130f188bc75c443c1d1994bb9fe7f512e6164c8e"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "cli/5.0.0-beta.145";
|
||||
export const version = "cli/5.0.0-beta.146";
|
||||
|
2
packages/contracts/lib.esm/_version.d.ts
vendored
2
packages/contracts/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "contracts/5.0.0-beta.140";
|
||||
export declare const version = "contracts/5.0.0-beta.141";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "contracts/5.0.0-beta.140";
|
||||
export const version = "contracts/5.0.0-beta.141";
|
||||
|
@ -35,6 +35,15 @@ function resolveAddresses(signerOrProvider, value, paramType) {
|
||||
}
|
||||
return Promise.resolve(value);
|
||||
}
|
||||
/*
|
||||
export function _populateTransaction(func: FunctionFragment, args: Array<any>, overrides?: any): Promise<Transaction> {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function _sendTransaction(func: FunctionFragment, args: Array<any>, overrides?: any): Promise<Transaction> {
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
function runMethod(contract, functionName, options) {
|
||||
let method = contract.interface.functions[functionName];
|
||||
return function (...params) {
|
||||
@ -287,15 +296,31 @@ export class Contract {
|
||||
defineReadOnly(this, "functions", {});
|
||||
defineReadOnly(this, "populateTransaction", {});
|
||||
defineReadOnly(this, "filters", {});
|
||||
Object.keys(this.interface.events).forEach((eventName) => {
|
||||
let event = this.interface.events[eventName];
|
||||
defineReadOnly(this.filters, eventName, (...args) => {
|
||||
return {
|
||||
address: this.address,
|
||||
topics: this.interface.encodeFilterTopics(event, args)
|
||||
};
|
||||
{
|
||||
const uniqueFilters = {};
|
||||
Object.keys(this.interface.events).forEach((eventSignature) => {
|
||||
let event = this.interface.events[eventSignature];
|
||||
defineReadOnly(this.filters, eventSignature, (...args) => {
|
||||
return {
|
||||
address: this.address,
|
||||
topics: this.interface.encodeFilterTopics(event, args)
|
||||
};
|
||||
});
|
||||
if (!uniqueFilters[event.name]) {
|
||||
uniqueFilters[event.name] = [];
|
||||
}
|
||||
uniqueFilters[event.name].push(eventSignature);
|
||||
});
|
||||
});
|
||||
Object.keys(uniqueFilters).forEach((name) => {
|
||||
const filters = uniqueFilters[name];
|
||||
if (filters.length === 1) {
|
||||
defineReadOnly(this.filters, name, this.filters[filters[0]]);
|
||||
}
|
||||
else {
|
||||
logger.warn(`Duplicate definition of ${name} (${filters.join(", ")})`);
|
||||
}
|
||||
});
|
||||
}
|
||||
defineReadOnly(this, "_runningEvents", {});
|
||||
defineReadOnly(this, "_wrappedEmits", {});
|
||||
defineReadOnly(this, "address", addressOrName);
|
||||
@ -319,7 +344,10 @@ export class Contract {
|
||||
logger.throwArgumentError("provider is required to use non-address contract address", "addressOrName", addressOrName);
|
||||
}
|
||||
}
|
||||
const uniqueFunctions = {};
|
||||
Object.keys(this.interface.functions).forEach((name) => {
|
||||
const fragment = this.interface.functions[name];
|
||||
// @TODO: This should take in fragment
|
||||
let run = runMethod(this, name, {});
|
||||
if (this[name] == null) {
|
||||
defineReadOnly(this, name, run);
|
||||
@ -336,6 +364,24 @@ export class Contract {
|
||||
if (this.estimate[name] == null) {
|
||||
defineReadOnly(this.estimate, name, runMethod(this, name, { estimate: true }));
|
||||
}
|
||||
if (!uniqueFunctions[fragment.name]) {
|
||||
uniqueFunctions[fragment.name] = [];
|
||||
}
|
||||
uniqueFunctions[fragment.name].push(name);
|
||||
});
|
||||
Object.keys(uniqueFunctions).forEach((name) => {
|
||||
const signatures = uniqueFunctions[name];
|
||||
if (signatures.length > 1) {
|
||||
logger.warn(`Duplicate definition of ${name} (${signatures.join(", ")})`);
|
||||
return;
|
||||
}
|
||||
if (this[name] == null) {
|
||||
defineReadOnly(this, name, this[signatures[0]]);
|
||||
}
|
||||
defineReadOnly(this.functions, name, this.functions[signatures[0]]);
|
||||
defineReadOnly(this.callStatic, name, this.callStatic[signatures[0]]);
|
||||
defineReadOnly(this.populateTransaction, name, this.populateTransaction[signatures[0]]);
|
||||
defineReadOnly(this.estimate, name, this.estimate[signatures[0]]);
|
||||
});
|
||||
}
|
||||
static getContractAddress(transaction) {
|
||||
|
2
packages/contracts/lib/_version.d.ts
vendored
2
packages/contracts/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "contracts/5.0.0-beta.140";
|
||||
export declare const version = "contracts/5.0.0-beta.141";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "contracts/5.0.0-beta.140";
|
||||
exports.version = "contracts/5.0.0-beta.141";
|
||||
|
@ -56,6 +56,15 @@ function resolveAddresses(signerOrProvider, value, paramType) {
|
||||
}
|
||||
return Promise.resolve(value);
|
||||
}
|
||||
/*
|
||||
export function _populateTransaction(func: FunctionFragment, args: Array<any>, overrides?: any): Promise<Transaction> {
|
||||
return null;
|
||||
}
|
||||
|
||||
export function _sendTransaction(func: FunctionFragment, args: Array<any>, overrides?: any): Promise<Transaction> {
|
||||
return null;
|
||||
}
|
||||
*/
|
||||
function runMethod(contract, functionName, options) {
|
||||
var method = contract.interface.functions[functionName];
|
||||
return function () {
|
||||
@ -328,19 +337,35 @@ var Contract = /** @class */ (function () {
|
||||
properties_1.defineReadOnly(this, "functions", {});
|
||||
properties_1.defineReadOnly(this, "populateTransaction", {});
|
||||
properties_1.defineReadOnly(this, "filters", {});
|
||||
Object.keys(this.interface.events).forEach(function (eventName) {
|
||||
var event = _this.interface.events[eventName];
|
||||
properties_1.defineReadOnly(_this.filters, eventName, function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
{
|
||||
var uniqueFilters_1 = {};
|
||||
Object.keys(this.interface.events).forEach(function (eventSignature) {
|
||||
var event = _this.interface.events[eventSignature];
|
||||
properties_1.defineReadOnly(_this.filters, eventSignature, function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
return {
|
||||
address: _this.address,
|
||||
topics: _this.interface.encodeFilterTopics(event, args)
|
||||
};
|
||||
});
|
||||
if (!uniqueFilters_1[event.name]) {
|
||||
uniqueFilters_1[event.name] = [];
|
||||
}
|
||||
return {
|
||||
address: _this.address,
|
||||
topics: _this.interface.encodeFilterTopics(event, args)
|
||||
};
|
||||
uniqueFilters_1[event.name].push(eventSignature);
|
||||
});
|
||||
});
|
||||
Object.keys(uniqueFilters_1).forEach(function (name) {
|
||||
var filters = uniqueFilters_1[name];
|
||||
if (filters.length === 1) {
|
||||
properties_1.defineReadOnly(_this.filters, name, _this.filters[filters[0]]);
|
||||
}
|
||||
else {
|
||||
logger.warn("Duplicate definition of " + name + " (" + filters.join(", ") + ")");
|
||||
}
|
||||
});
|
||||
}
|
||||
properties_1.defineReadOnly(this, "_runningEvents", {});
|
||||
properties_1.defineReadOnly(this, "_wrappedEmits", {});
|
||||
properties_1.defineReadOnly(this, "address", addressOrName);
|
||||
@ -364,7 +389,10 @@ var Contract = /** @class */ (function () {
|
||||
logger.throwArgumentError("provider is required to use non-address contract address", "addressOrName", addressOrName);
|
||||
}
|
||||
}
|
||||
var uniqueFunctions = {};
|
||||
Object.keys(this.interface.functions).forEach(function (name) {
|
||||
var fragment = _this.interface.functions[name];
|
||||
// @TODO: This should take in fragment
|
||||
var run = runMethod(_this, name, {});
|
||||
if (_this[name] == null) {
|
||||
properties_1.defineReadOnly(_this, name, run);
|
||||
@ -381,6 +409,24 @@ var Contract = /** @class */ (function () {
|
||||
if (_this.estimate[name] == null) {
|
||||
properties_1.defineReadOnly(_this.estimate, name, runMethod(_this, name, { estimate: true }));
|
||||
}
|
||||
if (!uniqueFunctions[fragment.name]) {
|
||||
uniqueFunctions[fragment.name] = [];
|
||||
}
|
||||
uniqueFunctions[fragment.name].push(name);
|
||||
});
|
||||
Object.keys(uniqueFunctions).forEach(function (name) {
|
||||
var signatures = uniqueFunctions[name];
|
||||
if (signatures.length > 1) {
|
||||
logger.warn("Duplicate definition of " + name + " (" + signatures.join(", ") + ")");
|
||||
return;
|
||||
}
|
||||
if (_this[name] == null) {
|
||||
properties_1.defineReadOnly(_this, name, _this[signatures[0]]);
|
||||
}
|
||||
properties_1.defineReadOnly(_this.functions, name, _this.functions[signatures[0]]);
|
||||
properties_1.defineReadOnly(_this.callStatic, name, _this.callStatic[signatures[0]]);
|
||||
properties_1.defineReadOnly(_this.populateTransaction, name, _this.populateTransaction[signatures[0]]);
|
||||
properties_1.defineReadOnly(_this.estimate, name, _this.estimate[signatures[0]]);
|
||||
});
|
||||
}
|
||||
Contract.getContractAddress = function (transaction) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/contracts",
|
||||
"version": "5.0.0-beta.140",
|
||||
"version": "5.0.0-beta.141",
|
||||
"description": "Contract abstraction meta-class for ethers.",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
@ -34,5 +34,5 @@
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0x3f0bde6de9ee75a66d88a2d346c0ae689f551370ee8c4cc79f40c6a5d16436e7"
|
||||
"tarballHash": "0x17b50f94b2c4aa5d24fe5b3621bbcf0a5043003c133bd288908c88cb32d5f5a9"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "contracts/5.0.0-beta.140";
|
||||
export const version = "contracts/5.0.0-beta.141";
|
||||
|
2427
packages/ethers/dist/ethers.esm.js
vendored
2427
packages/ethers/dist/ethers.esm.js
vendored
File diff suppressed because it is too large
Load Diff
4
packages/ethers/dist/ethers.esm.min.js
vendored
4
packages/ethers/dist/ethers.esm.min.js
vendored
File diff suppressed because one or more lines are too long
2955
packages/ethers/dist/ethers.umd.js
vendored
2955
packages/ethers/dist/ethers.umd.js
vendored
File diff suppressed because it is too large
Load Diff
4
packages/ethers/dist/ethers.umd.min.js
vendored
4
packages/ethers/dist/ethers.umd.min.js
vendored
File diff suppressed because one or more lines are too long
2
packages/ethers/lib.esm/_version.d.ts
vendored
2
packages/ethers/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "ethers/5.0.0-beta.159";
|
||||
export declare const version = "ethers/5.0.0-beta.160";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "ethers/5.0.0-beta.159";
|
||||
export const version = "ethers/5.0.0-beta.160";
|
||||
|
2
packages/ethers/lib.esm/ethers.d.ts
vendored
2
packages/ethers/lib.esm/ethers.d.ts
vendored
@ -4,6 +4,7 @@ import { Signer, VoidSigner } from "@ethersproject/abstract-signer";
|
||||
import { Wallet } from "@ethersproject/wallet";
|
||||
import * as constants from "@ethersproject/constants";
|
||||
import * as providers from "@ethersproject/providers";
|
||||
import { getDefaultProvider } from "@ethersproject/providers";
|
||||
import { Wordlist, wordlists } from "@ethersproject/wordlists";
|
||||
import * as utils from "./utils";
|
||||
declare const errors: {
|
||||
@ -15,5 +16,4 @@ import { Transaction, UnsignedTransaction } from "@ethersproject/transactions";
|
||||
import { version } from "./_version";
|
||||
declare const logger: utils.Logger;
|
||||
import { ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface } from "@ethersproject/contracts";
|
||||
declare function getDefaultProvider(network?: providers.Network | string, options?: any): providers.BaseProvider;
|
||||
export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist };
|
||||
|
@ -5,6 +5,7 @@ import { Signer, VoidSigner } from "@ethersproject/abstract-signer";
|
||||
import { Wallet } from "@ethersproject/wallet";
|
||||
import * as constants from "@ethersproject/constants";
|
||||
import * as providers from "@ethersproject/providers";
|
||||
import { getDefaultProvider } from "@ethersproject/providers";
|
||||
import { Wordlist, wordlists } from "@ethersproject/wordlists";
|
||||
import * as utils from "./utils";
|
||||
import { Logger } from "@ethersproject/logger";
|
||||
@ -15,21 +16,6 @@ const errors = Logger.errors;
|
||||
import { version } from "./_version";
|
||||
const logger = new Logger(version);
|
||||
////////////////////////
|
||||
// Helper Functions
|
||||
function getDefaultProvider(network, options) {
|
||||
if (network == null) {
|
||||
network = "homestead";
|
||||
}
|
||||
let n = providers.getNetwork(network);
|
||||
if (!n || !n._defaultProvider) {
|
||||
logger.throwError("unsupported getDefaultProvider network", Logger.errors.NETWORK_ERROR, {
|
||||
operation: "getDefaultProvider",
|
||||
network: network
|
||||
});
|
||||
}
|
||||
return n._defaultProvider(providers, options);
|
||||
}
|
||||
////////////////////////
|
||||
// Exports
|
||||
export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists,
|
||||
////////////////////////
|
||||
|
2
packages/ethers/lib/_version.d.ts
vendored
2
packages/ethers/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "ethers/5.0.0-beta.159";
|
||||
export declare const version = "ethers/5.0.0-beta.160";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "ethers/5.0.0-beta.159";
|
||||
exports.version = "ethers/5.0.0-beta.160";
|
||||
|
2
packages/ethers/lib/ethers.d.ts
vendored
2
packages/ethers/lib/ethers.d.ts
vendored
@ -4,6 +4,7 @@ import { Signer, VoidSigner } from "@ethersproject/abstract-signer";
|
||||
import { Wallet } from "@ethersproject/wallet";
|
||||
import * as constants from "@ethersproject/constants";
|
||||
import * as providers from "@ethersproject/providers";
|
||||
import { getDefaultProvider } from "@ethersproject/providers";
|
||||
import { Wordlist, wordlists } from "@ethersproject/wordlists";
|
||||
import * as utils from "./utils";
|
||||
declare const errors: {
|
||||
@ -15,5 +16,4 @@ import { Transaction, UnsignedTransaction } from "@ethersproject/transactions";
|
||||
import { version } from "./_version";
|
||||
declare const logger: utils.Logger;
|
||||
import { ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface } from "@ethersproject/contracts";
|
||||
declare function getDefaultProvider(network?: providers.Network | string, options?: any): providers.BaseProvider;
|
||||
export { Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, version, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist };
|
||||
|
@ -22,6 +22,8 @@ var constants = __importStar(require("@ethersproject/constants"));
|
||||
exports.constants = constants;
|
||||
var providers = __importStar(require("@ethersproject/providers"));
|
||||
exports.providers = providers;
|
||||
var providers_1 = require("@ethersproject/providers");
|
||||
exports.getDefaultProvider = providers_1.getDefaultProvider;
|
||||
var wordlists_1 = require("@ethersproject/wordlists");
|
||||
exports.Wordlist = wordlists_1.Wordlist;
|
||||
exports.wordlists = wordlists_1.wordlists;
|
||||
@ -37,19 +39,3 @@ var _version_1 = require("./_version");
|
||||
exports.version = _version_1.version;
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
exports.logger = logger;
|
||||
////////////////////////
|
||||
// Helper Functions
|
||||
function getDefaultProvider(network, options) {
|
||||
if (network == null) {
|
||||
network = "homestead";
|
||||
}
|
||||
var n = providers.getNetwork(network);
|
||||
if (!n || !n._defaultProvider) {
|
||||
logger.throwError("unsupported getDefaultProvider network", logger_1.Logger.errors.NETWORK_ERROR, {
|
||||
operation: "getDefaultProvider",
|
||||
network: network
|
||||
});
|
||||
}
|
||||
return n._defaultProvider(providers, options);
|
||||
}
|
||||
exports.getDefaultProvider = getDefaultProvider;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ethers",
|
||||
"version": "5.0.0-beta.159",
|
||||
"version": "5.0.0-beta.160",
|
||||
"description": "Umbrella package for most common Ethers libraries.",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
@ -54,5 +54,5 @@
|
||||
"module": "./dist/ethers.esm.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0x3e84db7f109b5a0f7b820a45a7d8abfbd028a42c741a2040846a130dafe32d36"
|
||||
"tarballHash": "0xc5beab5b0414d554e5cdc0e316af832c83055debae95c860e6a85abdb85f4396"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "ethers/5.0.0-beta.159";
|
||||
export const version = "ethers/5.0.0-beta.160";
|
||||
|
2
packages/experimental/lib.esm/_version.d.ts
vendored
2
packages/experimental/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "experimental/5.0.0-beta.132";
|
||||
export declare const version = "experimental/5.0.0-beta.133";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "experimental/5.0.0-beta.132";
|
||||
export const version = "experimental/5.0.0-beta.133";
|
||||
|
@ -1,6 +1,6 @@
|
||||
"use strict";
|
||||
import { ethers } from "ethers";
|
||||
import scrypt from "scrypt-js";
|
||||
import { scrypt } from "scrypt-js";
|
||||
import { version } from "./_version";
|
||||
const logger = new ethers.utils.Logger(version);
|
||||
let warned = false;
|
||||
@ -26,24 +26,12 @@ export class BrainWallet extends ethers.Wallet {
|
||||
else {
|
||||
passwordBytes = ethers.utils.arrayify(password);
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
scrypt(passwordBytes, usernameBytes, (1 << 18), 8, 1, 32, (error, progress, key) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
else if (key) {
|
||||
if (legacy) {
|
||||
resolve(new BrainWallet(key));
|
||||
}
|
||||
else {
|
||||
let mnemonic = ethers.utils.entropyToMnemonic(ethers.utils.arrayify(key).slice(0, 16));
|
||||
resolve(new BrainWallet(ethers.Wallet.fromMnemonic(mnemonic)));
|
||||
}
|
||||
}
|
||||
else if (progressCallback) {
|
||||
return progressCallback(progress);
|
||||
}
|
||||
});
|
||||
return scrypt(passwordBytes, usernameBytes, (1 << 18), 8, 1, 32, progressCallback).then((key) => {
|
||||
if (legacy) {
|
||||
return new BrainWallet(key);
|
||||
}
|
||||
const mnemonic = ethers.utils.entropyToMnemonic(ethers.utils.arrayify(key).slice(0, 16));
|
||||
return new BrainWallet(ethers.Wallet.fromMnemonic(mnemonic));
|
||||
});
|
||||
}
|
||||
static generate(username, password, progressCallback) {
|
||||
|
2
packages/experimental/lib.esm/index.d.ts
vendored
2
packages/experimental/lib.esm/index.d.ts
vendored
@ -0,0 +1,2 @@
|
||||
import { NonceManager } from "./nonce-manager";
|
||||
export { NonceManager };
|
@ -1 +1,3 @@
|
||||
"use strict";
|
||||
import { NonceManager } from "./nonce-manager";
|
||||
export { NonceManager };
|
||||
|
@ -2,7 +2,8 @@ import { ethers } from "ethers";
|
||||
export declare class NonceManager extends ethers.Signer {
|
||||
readonly signer: ethers.Signer;
|
||||
readonly provider: ethers.providers.Provider;
|
||||
_transactionCount: Promise<number>;
|
||||
_initialPromise: Promise<number>;
|
||||
_deltaCount: number;
|
||||
constructor(signer: ethers.Signer);
|
||||
connect(provider: ethers.providers.Provider): NonceManager;
|
||||
getAddress(): Promise<string>;
|
||||
|
@ -2,10 +2,13 @@
|
||||
import { ethers } from "ethers";
|
||||
import { version } from "./_version";
|
||||
const logger = new ethers.utils.Logger(version);
|
||||
// @TODO: Keep a per-NonceManager pool of sent but unmined transactions for
|
||||
// rebroadcasting, in case we overrun the transaction pool
|
||||
export class NonceManager extends ethers.Signer {
|
||||
constructor(signer) {
|
||||
logger.checkNew(new.target, NonceManager);
|
||||
super();
|
||||
this._deltaCount = 0;
|
||||
ethers.utils.defineReadOnly(this, "signer", signer);
|
||||
}
|
||||
connect(provider) {
|
||||
@ -16,25 +19,22 @@ export class NonceManager extends ethers.Signer {
|
||||
}
|
||||
getTransactionCount(blockTag) {
|
||||
if (blockTag === "pending") {
|
||||
if (!this._transactionCount) {
|
||||
this._transactionCount = this.signer.getTransactionCount("pending");
|
||||
if (!this._initialPromise) {
|
||||
this._initialPromise = this.signer.getTransactionCount("pending");
|
||||
}
|
||||
return this._transactionCount;
|
||||
const deltaCount = this._deltaCount;
|
||||
return this._initialPromise.then((initial) => (initial + deltaCount));
|
||||
}
|
||||
return this.signer.getTransactionCount(blockTag);
|
||||
}
|
||||
setTransactionCount(transactionCount) {
|
||||
this._transactionCount = Promise.resolve(transactionCount).then((nonce) => {
|
||||
this._initialPromise = Promise.resolve(transactionCount).then((nonce) => {
|
||||
return ethers.BigNumber.from(nonce).toNumber();
|
||||
});
|
||||
this._deltaCount = 0;
|
||||
}
|
||||
incrementTransactionCount(count) {
|
||||
if (!count) {
|
||||
count = 1;
|
||||
}
|
||||
this._transactionCount = this.getTransactionCount("pending").then((nonce) => {
|
||||
return nonce + count;
|
||||
});
|
||||
this._deltaCount += (count ? count : 1);
|
||||
}
|
||||
signMessage(message) {
|
||||
return this.signer.signMessage(message);
|
||||
@ -46,9 +46,14 @@ export class NonceManager extends ethers.Signer {
|
||||
sendTransaction(transaction) {
|
||||
if (transaction.nonce == null) {
|
||||
transaction = ethers.utils.shallowCopy(transaction);
|
||||
transaction.nonce = this.getTransactionCount();
|
||||
transaction.nonce = this.getTransactionCount("pending");
|
||||
this.incrementTransactionCount();
|
||||
}
|
||||
this.setTransactionCount(transaction.nonce);
|
||||
return this.signer.sendTransaction(transaction);
|
||||
else {
|
||||
this.setTransactionCount(transaction.nonce);
|
||||
}
|
||||
return this.signer.sendTransaction(transaction).then((tx) => {
|
||||
return tx;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
2
packages/experimental/lib/_version.d.ts
vendored
2
packages/experimental/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "experimental/5.0.0-beta.132";
|
||||
export declare const version = "experimental/5.0.0-beta.133";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "experimental/5.0.0-beta.132";
|
||||
exports.version = "experimental/5.0.0-beta.133";
|
||||
|
@ -12,12 +12,9 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var ethers_1 = require("ethers");
|
||||
var scrypt_js_1 = __importDefault(require("scrypt-js"));
|
||||
var scrypt_js_1 = require("scrypt-js");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
|
||||
var warned = false;
|
||||
@ -47,24 +44,12 @@ var BrainWallet = /** @class */ (function (_super) {
|
||||
else {
|
||||
passwordBytes = ethers_1.ethers.utils.arrayify(password);
|
||||
}
|
||||
return new Promise(function (resolve, reject) {
|
||||
scrypt_js_1.default(passwordBytes, usernameBytes, (1 << 18), 8, 1, 32, function (error, progress, key) {
|
||||
if (error) {
|
||||
reject(error);
|
||||
}
|
||||
else if (key) {
|
||||
if (legacy) {
|
||||
resolve(new BrainWallet(key));
|
||||
}
|
||||
else {
|
||||
var mnemonic = ethers_1.ethers.utils.entropyToMnemonic(ethers_1.ethers.utils.arrayify(key).slice(0, 16));
|
||||
resolve(new BrainWallet(ethers_1.ethers.Wallet.fromMnemonic(mnemonic)));
|
||||
}
|
||||
}
|
||||
else if (progressCallback) {
|
||||
return progressCallback(progress);
|
||||
}
|
||||
});
|
||||
return scrypt_js_1.scrypt(passwordBytes, usernameBytes, (1 << 18), 8, 1, 32, progressCallback).then(function (key) {
|
||||
if (legacy) {
|
||||
return new BrainWallet(key);
|
||||
}
|
||||
var mnemonic = ethers_1.ethers.utils.entropyToMnemonic(ethers_1.ethers.utils.arrayify(key).slice(0, 16));
|
||||
return new BrainWallet(ethers_1.ethers.Wallet.fromMnemonic(mnemonic));
|
||||
});
|
||||
};
|
||||
BrainWallet.generate = function (username, password, progressCallback) {
|
||||
|
2
packages/experimental/lib/index.d.ts
vendored
2
packages/experimental/lib/index.d.ts
vendored
@ -0,0 +1,2 @@
|
||||
import { NonceManager } from "./nonce-manager";
|
||||
export { NonceManager };
|
@ -1 +1,4 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var nonce_manager_1 = require("./nonce-manager");
|
||||
exports.NonceManager = nonce_manager_1.NonceManager;
|
||||
|
3
packages/experimental/lib/nonce-manager.d.ts
vendored
3
packages/experimental/lib/nonce-manager.d.ts
vendored
@ -2,7 +2,8 @@ import { ethers } from "ethers";
|
||||
export declare class NonceManager extends ethers.Signer {
|
||||
readonly signer: ethers.Signer;
|
||||
readonly provider: ethers.providers.Provider;
|
||||
_transactionCount: Promise<number>;
|
||||
_initialPromise: Promise<number>;
|
||||
_deltaCount: number;
|
||||
constructor(signer: ethers.Signer);
|
||||
connect(provider: ethers.providers.Provider): NonceManager;
|
||||
getAddress(): Promise<string>;
|
||||
|
@ -16,6 +16,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var ethers_1 = require("ethers");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
|
||||
// @TODO: Keep a per-NonceManager pool of sent but unmined transactions for
|
||||
// rebroadcasting, in case we overrun the transaction pool
|
||||
var NonceManager = /** @class */ (function (_super) {
|
||||
__extends(NonceManager, _super);
|
||||
function NonceManager(signer) {
|
||||
@ -23,6 +25,7 @@ var NonceManager = /** @class */ (function (_super) {
|
||||
var _this = this;
|
||||
logger.checkNew(_newTarget, NonceManager);
|
||||
_this = _super.call(this) || this;
|
||||
_this._deltaCount = 0;
|
||||
ethers_1.ethers.utils.defineReadOnly(_this, "signer", signer);
|
||||
return _this;
|
||||
}
|
||||
@ -34,25 +37,22 @@ var NonceManager = /** @class */ (function (_super) {
|
||||
};
|
||||
NonceManager.prototype.getTransactionCount = function (blockTag) {
|
||||
if (blockTag === "pending") {
|
||||
if (!this._transactionCount) {
|
||||
this._transactionCount = this.signer.getTransactionCount("pending");
|
||||
if (!this._initialPromise) {
|
||||
this._initialPromise = this.signer.getTransactionCount("pending");
|
||||
}
|
||||
return this._transactionCount;
|
||||
var deltaCount_1 = this._deltaCount;
|
||||
return this._initialPromise.then(function (initial) { return (initial + deltaCount_1); });
|
||||
}
|
||||
return this.signer.getTransactionCount(blockTag);
|
||||
};
|
||||
NonceManager.prototype.setTransactionCount = function (transactionCount) {
|
||||
this._transactionCount = Promise.resolve(transactionCount).then(function (nonce) {
|
||||
this._initialPromise = Promise.resolve(transactionCount).then(function (nonce) {
|
||||
return ethers_1.ethers.BigNumber.from(nonce).toNumber();
|
||||
});
|
||||
this._deltaCount = 0;
|
||||
};
|
||||
NonceManager.prototype.incrementTransactionCount = function (count) {
|
||||
if (!count) {
|
||||
count = 1;
|
||||
}
|
||||
this._transactionCount = this.getTransactionCount("pending").then(function (nonce) {
|
||||
return nonce + count;
|
||||
});
|
||||
this._deltaCount += (count ? count : 1);
|
||||
};
|
||||
NonceManager.prototype.signMessage = function (message) {
|
||||
return this.signer.signMessage(message);
|
||||
@ -64,10 +64,15 @@ var NonceManager = /** @class */ (function (_super) {
|
||||
NonceManager.prototype.sendTransaction = function (transaction) {
|
||||
if (transaction.nonce == null) {
|
||||
transaction = ethers_1.ethers.utils.shallowCopy(transaction);
|
||||
transaction.nonce = this.getTransactionCount();
|
||||
transaction.nonce = this.getTransactionCount("pending");
|
||||
this.incrementTransactionCount();
|
||||
}
|
||||
this.setTransactionCount(transaction.nonce);
|
||||
return this.signer.sendTransaction(transaction);
|
||||
else {
|
||||
this.setTransactionCount(transaction.nonce);
|
||||
}
|
||||
return this.signer.sendTransaction(transaction).then(function (tx) {
|
||||
return tx;
|
||||
});
|
||||
};
|
||||
return NonceManager;
|
||||
}(ethers_1.ethers.Signer));
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/experimental",
|
||||
"version": "5.0.0-beta.132",
|
||||
"version": "5.0.0-beta.133",
|
||||
"description": "Experimental libraries for ethers. These should not be considered stable.",
|
||||
"main": "./lib/index.js",
|
||||
"scripts": {
|
||||
@ -28,5 +28,5 @@
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"ethereum": "donations.ethers.eth",
|
||||
"tarballHash": "0x9058d5bd70241b5cdd7e616bba4837f7a49ebd82895070ccc47f4de63d63324c"
|
||||
"tarballHash": "0x004416cb35c4bb09fe835b6837fb08c1807c4a98f6191bd2e7007bb8c0316267"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "experimental/5.0.0-beta.132";
|
||||
export const version = "experimental/5.0.0-beta.133";
|
||||
|
2
packages/hash/lib.esm/_version.d.ts
vendored
2
packages/hash/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "hash/5.0.0-beta.131";
|
||||
export declare const version = "hash/5.0.0-beta.132";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "hash/5.0.0-beta.131";
|
||||
export const version = "hash/5.0.0-beta.132";
|
||||
|
@ -10,7 +10,7 @@ const Zeros = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
const Partition = new RegExp("^((.*)\\.)?([^.]+)$");
|
||||
export function isValidName(name) {
|
||||
try {
|
||||
let comps = name.split(".");
|
||||
const comps = name.split(".");
|
||||
for (let i = 0; i < comps.length; i++) {
|
||||
if (nameprep(comps[i]).length === 0) {
|
||||
throw new Error("empty");
|
||||
@ -27,8 +27,8 @@ export function namehash(name) {
|
||||
}
|
||||
let result = Zeros;
|
||||
while (name.length) {
|
||||
let partition = name.match(Partition);
|
||||
let label = toUtf8Bytes(nameprep(partition[3]));
|
||||
const partition = name.match(Partition);
|
||||
const label = toUtf8Bytes(nameprep(partition[3]));
|
||||
result = keccak256(concat([result, keccak256(label)]));
|
||||
name = partition[2] || "";
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user