From b992a91ca851665b81ac85e9f1b69d8d7a25e0d5 Mon Sep 17 00:00:00 2001 From: Yannick Huard Date: Sun, 5 Sep 2021 18:47:13 +0200 Subject: [PATCH] chore: add @babel/runtime --- .babelrc | 1 + dist/es/tx-data-by-compiled.js | 13 +------------ dist/lib/create-identity.js | 4 ++-- dist/lib/index.js | 6 +++--- dist/lib/recover.js | 4 ++-- dist/lib/sign-transaction.js | 4 ++-- dist/lib/tx-data-by-compiled.js | 18 +++++------------- package.json | 2 ++ 8 files changed, 18 insertions(+), 34 deletions(-) diff --git a/.babelrc b/.babelrc index a7ced41..41da503 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,6 @@ { "presets": ["@babel/preset-env"], + "plugins": ["@babel/plugin-transform-runtime"], "env": { "es6": { "presets": [ diff --git a/dist/es/tx-data-by-compiled.js b/dist/es/tx-data-by-compiled.js index 003128c..1bf37ae 100644 --- a/dist/es/tx-data-by-compiled.js +++ b/dist/es/tx-data-by-compiled.js @@ -1,15 +1,4 @@ -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } - -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } - +import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; import { ContractFactory } from 'ethers'; export default function txDataByCompiled(abi, bytecode, args) { // solc returns a string which is often passed instead of the json diff --git a/dist/lib/create-identity.js b/dist/lib/create-identity.js index 0510283..a4a02bd 100644 --- a/dist/lib/create-identity.js +++ b/dist/lib/create-identity.js @@ -1,5 +1,7 @@ "use strict"; +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + Object.defineProperty(exports, "__esModule", { value: true }); @@ -14,8 +16,6 @@ var _hash = require("eth-lib/lib/hash"); var _bytes = _interopRequireDefault(require("eth-lib/lib/bytes")); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - var MIN_ENTROPY_SIZE = 128; /** * create a privateKey from the given entropy or a new one diff --git a/dist/lib/index.js b/dist/lib/index.js index a1c3908..f09a589 100644 --- a/dist/lib/index.js +++ b/dist/lib/index.js @@ -1,6 +1,8 @@ "use strict"; -function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + +var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true @@ -115,8 +117,6 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; } -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - var _default = { createIdentity: _createIdentity["default"], publicKey: publicKey, diff --git a/dist/lib/recover.js b/dist/lib/recover.js index 8db1e75..309529e 100644 --- a/dist/lib/recover.js +++ b/dist/lib/recover.js @@ -1,5 +1,7 @@ "use strict"; +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + Object.defineProperty(exports, "__esModule", { value: true }); @@ -9,8 +11,6 @@ var _recoverPublicKey = _interopRequireDefault(require("./recover-public-key")); var _publicKey = require("./public-key"); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - /** * returns the adress with which the messageHash was signed * @param {string} sigString diff --git a/dist/lib/sign-transaction.js b/dist/lib/sign-transaction.js index 36bb942..4e44e29 100644 --- a/dist/lib/sign-transaction.js +++ b/dist/lib/sign-transaction.js @@ -1,5 +1,7 @@ "use strict"; +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + Object.defineProperty(exports, "__esModule", { value: true }); @@ -11,8 +13,6 @@ var _publicKeyByPrivateKey = _interopRequireDefault(require("./public-key-by-pri var _publicKey = require("./public-key"); -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } - function signTransaction(rawTx, privateKey) { var txOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; // check if privateKey->address matches rawTx.from diff --git a/dist/lib/tx-data-by-compiled.js b/dist/lib/tx-data-by-compiled.js index 1b549e0..dc4b026 100644 --- a/dist/lib/tx-data-by-compiled.js +++ b/dist/lib/tx-data-by-compiled.js @@ -1,29 +1,21 @@ "use strict"; +var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); + Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = txDataByCompiled; -var _ethers = require("ethers"); - -function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } - -function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } +var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); -function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } - -function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } - -function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } - -function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } +var _ethers = require("ethers"); function txDataByCompiled(abi, bytecode, args) { // solc returns a string which is often passed instead of the json if (typeof abi === 'string') abi = JSON.parse(abi); // Construct a Contract Factory var factory = new _ethers.ContractFactory(abi, '0x' + bytecode); - var deployTransaction = factory.getDeployTransaction.apply(factory, _toConsumableArray(args)); + var deployTransaction = factory.getDeployTransaction.apply(factory, (0, _toConsumableArray2["default"])(args)); return deployTransaction.data; } \ No newline at end of file diff --git a/package.json b/package.json index fedaa71..bccdbd0 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "devDependencies": { "@babel/cli": "^7.15.4", "@babel/core": "^7.0.0", + "@babel/plugin-transform-runtime": "^7.15.0", "@babel/preset-env": "^7.0.0", "assert": "2.0.0", "async-test-util": "1.7.3", @@ -93,6 +94,7 @@ "webpack-cli": "4.8.0" }, "dependencies": { + "@babel/runtime": "^7.15.4", "@ethereumjs/tx": "3.3.0", "@types/bn.js": "5.1.0", "eccrypto": "1.1.6",