Updated TypeScript version.
This commit is contained in:
parent
1e0ed4e99a
commit
e8028d0e73
|
@ -0,0 +1,20 @@
|
|||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const { resolve } = require("path");
|
||||
|
||||
const sourceEthers = fs.readFileSync(resolve(__dirname, "../../packages/ethers/src.ts/ethers.ts")).toString();
|
||||
const targets = sourceEthers.match(/export\s*{\s*((.|\s)*)}/)[1].trim();
|
||||
|
||||
const output = `"use strict";
|
||||
|
||||
import * as ethers from "./ethers";
|
||||
|
||||
export { ethers };
|
||||
|
||||
export {
|
||||
${ targets }
|
||||
} from "./ethers";
|
||||
`;
|
||||
|
||||
fs.writeFileSync(resolve(__dirname, "../../packages/ethers/src.ts/index.ts"), output);
|
|
@ -6,7 +6,7 @@
|
|||
"bootstrap": "node ./admin/cmds/reset-build.js && node ./admin/cmds/update-depgraph && lerna bootstrap --hoist",
|
||||
"build": "tsc --build ./tsconfig.project.json",
|
||||
"clean": "node ./admin/cmds/reset-build.js && tsc --build --clean ./tsconfig.project.json",
|
||||
"_dist_prepare": "npm run clean && npm run bootstrap && npm run build",
|
||||
"_dist_prepare": "npm run clean && npm run bootstrap && npm run build && node ./admin/cmds/update-exports.js",
|
||||
"_dist_ethers": "rollup -c && rollup -c --configMinify && rollup -c --configModule && rollup -c --configModule --configMinify",
|
||||
"_dist_tests": "rollup -c --configTest && rollup -c --configTest --configMinify && rollup -c --configTest --configModule && rollup -c --configTest --configModule --configMinify",
|
||||
"_test_prepare": "npm run _dist_prepare && npm run _dist_tests",
|
||||
|
@ -27,6 +27,7 @@
|
|||
"devDependencies": {
|
||||
"@types/assert": "^1.4.1",
|
||||
"@types/mocha": "^5.2.0",
|
||||
"@types/node": "^12.7.4",
|
||||
"aes-js": "3.0.0",
|
||||
"browserify": "16.2.3",
|
||||
"diff": "4.0.1",
|
||||
|
@ -38,7 +39,7 @@
|
|||
"scrypt-js": "2.0.4",
|
||||
"semver": "^5.6.0",
|
||||
"tar": "4.4.8",
|
||||
"typescript": "3.3.3",
|
||||
"typescript": "3.6.2",
|
||||
"rollup": "1.20.1",
|
||||
"rollup-plugin-commonjs": "10.0.2",
|
||||
"rollup-plugin-json": "4.0.0",
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
// We use this for base 36 maths
|
||||
import * as BN from "bn.js";
|
||||
import { BN } from "bn.js";
|
||||
|
||||
import { arrayify, hexDataSlice, isHexString, stripZeros } from "@ethersproject/bytes";
|
||||
import { BigNumberish } from "@ethersproject/bignumber";
|
||||
|
@ -106,7 +106,7 @@ export function getAddress(address: string): string {
|
|||
logger.throwArgumentError("bad icap checksum", "address", address);
|
||||
}
|
||||
|
||||
result = (new BN.BN(address.substring(4), 36)).toString(16);
|
||||
result = (new BN(address.substring(4), 36)).toString(16);
|
||||
while (result.length < 40) { result = "0" + result; }
|
||||
result = getChecksumAddress("0x" + result);
|
||||
|
||||
|
@ -126,7 +126,7 @@ export function isAddress(address: string): boolean {
|
|||
}
|
||||
|
||||
export function getIcapAddress(address: string): string {
|
||||
let base36 = (new BN.BN(getAddress(address).substring(2), 16)).toString(36).toUpperCase();
|
||||
let base36 = (new BN(getAddress(address).substring(2), 16)).toString(36).toUpperCase();
|
||||
while (base36.length < 30) { base36 = "0" + base36; }
|
||||
return "XE" + ibanChecksum("XE00" + base36) + base36;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
import * as BN from "bn.js";
|
||||
import { BN } from "bn.js";
|
||||
|
||||
import { Bytes, Hexable, hexlify, isBytes, isHexString } from "@ethersproject/bytes";
|
||||
|
||||
|
@ -154,7 +154,7 @@ export class BigNumber implements Hexable {
|
|||
}
|
||||
|
||||
if (value.match(/^-?[0-9]+$/)) {
|
||||
return new BigNumber(_constructorGuard, toHex(new BN.BN(value)));
|
||||
return new BigNumber(_constructorGuard, toHex(new BN(value)));
|
||||
}
|
||||
|
||||
return logger.throwArgumentError("invalid BigNumber string", "value", value);
|
||||
|
@ -200,7 +200,7 @@ export class BigNumber implements Hexable {
|
|||
}
|
||||
|
||||
// Normalize the hex string
|
||||
function toHex(value: string | BN.BN): string {
|
||||
function toHex(value: string | BN): string {
|
||||
|
||||
// For BN, call on the hex string
|
||||
if (typeof(value) !== "string") {
|
||||
|
@ -242,16 +242,16 @@ function toHex(value: string | BN.BN): string {
|
|||
return value;
|
||||
}
|
||||
|
||||
function toBigNumber(value: BN.BN): BigNumber {
|
||||
function toBigNumber(value: BN): BigNumber {
|
||||
return BigNumber.from(toHex(value));
|
||||
}
|
||||
|
||||
function toBN(value: BigNumberish): BN.BN {
|
||||
function toBN(value: BigNumberish): BN {
|
||||
let hex = BigNumber.from(value).toHexString();
|
||||
if (hex[0] === "-") {
|
||||
return (new BN.BN("-" + hex.substring(3), 16));
|
||||
return (new BN("-" + hex.substring(3), 16));
|
||||
}
|
||||
return new BN.BN(hex.substring(2), 16);
|
||||
return new BN(hex.substring(2), 16);
|
||||
}
|
||||
|
||||
function throwFault(fault: string, operation: string, value?: any): never {
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
"ethers-ts": "./lib/bin/ethers-ts.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@types/node": "10.3.2",
|
||||
"@ethersproject/basex": ">=5.0.0-beta.127",
|
||||
"ethers": ">=5.0.0-beta.156",
|
||||
"mime-types": "2.1.11",
|
||||
|
@ -20,6 +19,9 @@
|
|||
"solc": "0.5.10",
|
||||
"solidity-parser-antlr": "^0.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.7.4"
|
||||
},
|
||||
"keywords": [
|
||||
"Ethereum",
|
||||
"ethers",
|
||||
|
@ -36,5 +38,5 @@
|
|||
},
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"tarballHash": "0x045c7d61113b060ecb79426c442a9bcc28c3ed5baebd6c324b8c5ccdd83aa39c"
|
||||
"tarballHash": "0x7224b7a62cd2554bab3585709e8016fc4a7672c33c568dcbdfbf63d838c18283"
|
||||
}
|
||||
|
|
|
@ -4,4 +4,61 @@ import * as ethers from "./ethers";
|
|||
|
||||
export { ethers };
|
||||
|
||||
export * from "./ethers";
|
||||
export {
|
||||
Signer,
|
||||
|
||||
Wallet,
|
||||
VoidSigner,
|
||||
|
||||
getDefaultProvider,
|
||||
providers,
|
||||
|
||||
Contract,
|
||||
ContractFactory,
|
||||
|
||||
BigNumber,
|
||||
FixedNumber,
|
||||
|
||||
constants,
|
||||
errors,
|
||||
|
||||
logger,
|
||||
|
||||
utils,
|
||||
|
||||
wordlists,
|
||||
|
||||
|
||||
////////////////////////
|
||||
// Compile-Time Constants
|
||||
|
||||
version,
|
||||
|
||||
|
||||
////////////////////////
|
||||
// Types
|
||||
|
||||
ContractFunction,
|
||||
ContractReceipt,
|
||||
ContractTransaction,
|
||||
Event,
|
||||
EventFilter,
|
||||
|
||||
Overrides,
|
||||
PayableOverrides,
|
||||
CallOverrides,
|
||||
|
||||
ContractInterface,
|
||||
|
||||
BigNumberish,
|
||||
|
||||
Bytes,
|
||||
BytesLike,
|
||||
|
||||
Signature,
|
||||
|
||||
Transaction,
|
||||
UnsignedTransaction,
|
||||
|
||||
Wordlist
|
||||
} from "./ethers";
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
"@ethersproject/web": ">=5.0.0-beta.129"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "10.3.2"
|
||||
"@types/node": "^12.7.4"
|
||||
},
|
||||
"keywords": [
|
||||
"Ethereum",
|
||||
|
@ -45,5 +45,5 @@
|
|||
},
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"tarballHash": "0x655b117ac21836fcd5bed6025dbd53583596f141bc2b67b833342f60e37038d4"
|
||||
"tarballHash": "0xc0b5e1a60b427d64d93f366727dc57777d24bfd92b8ddeb6408b367a7780f045"
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
"@ethersproject/logger": ">=5.0.0-beta.129"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "10.3.2"
|
||||
"@types/node": "^12.7.4"
|
||||
},
|
||||
"keywords": [
|
||||
"Ethereum",
|
||||
|
@ -30,5 +30,5 @@
|
|||
},
|
||||
"module": "./lib.esm/index.js",
|
||||
"types": "./lib/index.d.ts",
|
||||
"tarballHash": "0x45c2e53529bd3cf7b1ba4bbbe448813aa2540b792fab4db7bdfbac9c204f1d7e"
|
||||
"tarballHash": "0x884bc62b2feb8949cbbf59bb1fea3ca8c671ab16149e1688d74b9f1bd360e89c"
|
||||
}
|
||||
|
|
|
@ -12,8 +12,15 @@ function Replacer(options = {}) {
|
|||
return {
|
||||
name: "file-replacer",
|
||||
transform(code, id) {
|
||||
//console.log(id, code.length);
|
||||
/*
|
||||
console.log("------");
|
||||
console.log("NAME", id, id.match("node-resolve:empty.js$"));
|
||||
console.log(code);
|
||||
console.log("------");
|
||||
*/
|
||||
|
||||
if (!filter(id)) { return null; }
|
||||
|
||||
for (let i = 0; i < suffixes.length; i++) {
|
||||
const suffix = suffixes[i];
|
||||
if (id.match(new RegExp(suffix))) {
|
||||
|
@ -21,7 +28,8 @@ function Replacer(options = {}) {
|
|||
let newCode = options.replace[suffix];
|
||||
console.log(`Replace: ${ id } (${ code.length } => ${ newCode.length })`);
|
||||
return {
|
||||
code: newCode
|
||||
code: newCode,
|
||||
map: { mappings: '' }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -89,8 +97,8 @@ export default commandLineArgs => {
|
|||
namedExports: {
|
||||
"bn.js": [ "BN" ],
|
||||
"elliptic": [ "ec" ]
|
||||
}
|
||||
})
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
if (minify) {
|
||||
|
|
Loading…
Reference in New Issue