@toruslabs/ethereum-controllers 5.3.2 → 5.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ethereumControllers.cjs.js +47 -32
- package/dist/ethereumControllers.cjs.js.map +1 -1
- package/dist/ethereumControllers.esm.js +105 -3
- package/dist/ethereumControllers.esm.js.map +1 -1
- package/dist/ethereumControllers.umd.min.js +1 -1
- package/dist/ethereumControllers.umd.min.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/interfaces.d.ts +1 -0
- package/package.json +4 -4
- package/src/Transaction/TransactionController.ts +1 -1
- package/src/index.ts +1 -0
- package/src/utils/interfaces.ts +1 -0
|
@@ -115,7 +115,14 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
115
115
|
TransactionStateManager: () => (/* reexport */ TransactionStateManager),
|
|
116
116
|
TypedMessageController: () => (/* reexport */ TypedMessageController),
|
|
117
117
|
XDAI_CHAIN_ID: () => (/* reexport */ XDAI_CHAIN_ID),
|
|
118
|
+
addCurrencies: () => (/* reexport */ addCurrencies),
|
|
118
119
|
bnLessThan: () => (/* reexport */ bnLessThan),
|
|
120
|
+
conversionGTE: () => (/* reexport */ conversionGTE),
|
|
121
|
+
conversionGreaterThan: () => (/* reexport */ conversionGreaterThan),
|
|
122
|
+
conversionLTE: () => (/* reexport */ conversionLTE),
|
|
123
|
+
conversionLessThan: () => (/* reexport */ conversionLessThan),
|
|
124
|
+
conversionMax: () => (/* reexport */ conversionMax),
|
|
125
|
+
conversionUtil: () => (/* reexport */ conversionUtil),
|
|
119
126
|
createChainIdMiddleware: () => (/* reexport */ createChainIdMiddleware),
|
|
120
127
|
createEthereumMiddleware: () => (/* reexport */ createEthereumMiddleware),
|
|
121
128
|
createGetAccountsMiddleware: () => (/* reexport */ createGetAccountsMiddleware),
|
|
@@ -134,6 +141,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
134
141
|
createProcessTypedMessageV4: () => (/* reexport */ createProcessTypedMessageV4),
|
|
135
142
|
createProviderConfigMiddleware: () => (/* reexport */ createProviderConfigMiddleware),
|
|
136
143
|
createRequestAccountsMiddleware: () => (/* reexport */ createRequestAccountsMiddleware),
|
|
144
|
+
decGWEIToHexWEI: () => (/* reexport */ decGWEIToHexWEI),
|
|
137
145
|
determineTransactionType: () => (/* reexport */ determineTransactionType),
|
|
138
146
|
ensureFieldIsString: () => (/* reexport */ ensureFieldIsString),
|
|
139
147
|
ensureMutuallyExclusiveFieldsNotProvided: () => (/* reexport */ ensureMutuallyExclusiveFieldsNotProvided),
|
|
@@ -145,15 +153,18 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
145
153
|
formatTime: () => (/* reexport */ formatTime),
|
|
146
154
|
formatTxMetaForRpcResult: () => (/* reexport */ formatTxMetaForRpcResult),
|
|
147
155
|
generateHistoryEntry: () => (/* reexport */ generateHistoryEntry),
|
|
156
|
+
getBigNumber: () => (/* reexport */ getBigNumber),
|
|
148
157
|
getChainType: () => (/* reexport */ getChainType),
|
|
149
158
|
getEthTxStatus: () => (/* reexport */ getEthTxStatus),
|
|
150
159
|
getEtherScanHashLink: () => (/* reexport */ getEtherScanHashLink),
|
|
151
160
|
getFinalStates: () => (/* reexport */ getFinalStates),
|
|
152
161
|
getIpfsEndpoint: () => (/* reexport */ getIpfsEndpoint),
|
|
162
|
+
hexWEIToDecGWEI: () => (/* reexport */ hexWEIToDecGWEI),
|
|
153
163
|
idleTimeTracker: () => (/* reexport */ idleTimeTracker),
|
|
154
164
|
isAddressByChainId: () => (/* reexport */ isAddressByChainId),
|
|
155
165
|
isEIP1559Transaction: () => (/* reexport */ isEIP1559Transaction),
|
|
156
166
|
isLegacyTransaction: () => (/* reexport */ isLegacyTransaction),
|
|
167
|
+
multiplyCurrencies: () => (/* reexport */ multiplyCurrencies),
|
|
157
168
|
normalizeAndValidateTxParams: () => (/* reexport */ normalizeAndValidateTxParams),
|
|
158
169
|
normalizeMessageData: () => (/* reexport */ normalizeMessageData),
|
|
159
170
|
normalizeTxParameters: () => (/* reexport */ normalizeTxParameters),
|
|
@@ -164,7 +175,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
164
175
|
sanitizeNftMetdataUrl: () => (/* reexport */ sanitizeNftMetdataUrl),
|
|
165
176
|
singleBalanceCheckerAbi: () => (/* reexport */ singleBalanceCheckerAbi),
|
|
166
177
|
snapshotFromTxMeta: () => (/* reexport */ snapshotFromTxMeta),
|
|
178
|
+
subtractCurrencies: () => (/* reexport */ subtractCurrencies),
|
|
167
179
|
toChecksumAddressByChainId: () => (/* reexport */ toChecksumAddressByChainId),
|
|
180
|
+
toNegative: () => (/* reexport */ toNegative),
|
|
168
181
|
transactionMatchesNetwork: () => (/* reexport */ transactionMatchesNetwork),
|
|
169
182
|
validateAddChainData: () => (/* reexport */ validateAddChainData),
|
|
170
183
|
validateAddress: () => (/* reexport */ validateAddress),
|
|
@@ -1547,6 +1560,7 @@ class CurrencyController extends base_controllers_namespaceObject.BaseCurrencyCo
|
|
|
1547
1560
|
const external_lodash_namespaceObject = require("lodash");
|
|
1548
1561
|
;// CONCATENATED MODULE: external "@babel/runtime/helpers/objectDestructuringEmpty"
|
|
1549
1562
|
const objectDestructuringEmpty_namespaceObject = require("@babel/runtime/helpers/objectDestructuringEmpty");
|
|
1563
|
+
var objectDestructuringEmpty_default = /*#__PURE__*/__webpack_require__.n(objectDestructuringEmpty_namespaceObject);
|
|
1550
1564
|
;// CONCATENATED MODULE: external "@babel/runtime/helpers/objectWithoutProperties"
|
|
1551
1565
|
const objectWithoutProperties_namespaceObject = require("@babel/runtime/helpers/objectWithoutProperties");
|
|
1552
1566
|
var objectWithoutProperties_default = /*#__PURE__*/__webpack_require__.n(objectWithoutProperties_namespaceObject);
|
|
@@ -1557,9 +1571,9 @@ var external_bn_js_default = /*#__PURE__*/__webpack_require__.n(external_bn_js_n
|
|
|
1557
1571
|
|
|
1558
1572
|
|
|
1559
1573
|
|
|
1560
|
-
const _excluded =
|
|
1561
|
-
_excluded2 =
|
|
1562
|
-
_excluded3 =
|
|
1574
|
+
const _excluded = ["aBase", "bBase"],
|
|
1575
|
+
_excluded2 = ["aBase", "bBase"],
|
|
1576
|
+
_excluded3 = ["multiplicandBase", "multiplierBase"];
|
|
1563
1577
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
1564
1578
|
// @ts-nocheck
|
|
1565
1579
|
/* Currency Conversion Utility
|
|
@@ -1698,10 +1712,10 @@ const getBigNumber = (value, base) => {
|
|
|
1698
1712
|
|
|
1699
1713
|
// We don't include 'number' here, because BigNumber will throw if passed
|
|
1700
1714
|
// a number primitive it considers unsafe.
|
|
1701
|
-
if (typeof value === "string" || value instanceof
|
|
1702
|
-
return new
|
|
1715
|
+
if (typeof value === "string" || value instanceof (external_bignumber_js_default())) {
|
|
1716
|
+
return new (external_bignumber_js_default())(value, base);
|
|
1703
1717
|
}
|
|
1704
|
-
return new
|
|
1718
|
+
return new (external_bignumber_js_default())(String(value), base);
|
|
1705
1719
|
};
|
|
1706
1720
|
const addCurrencies = function (a, b) {
|
|
1707
1721
|
let options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
@@ -1709,12 +1723,12 @@ const addCurrencies = function (a, b) {
|
|
|
1709
1723
|
aBase,
|
|
1710
1724
|
bBase
|
|
1711
1725
|
} = options,
|
|
1712
|
-
conversionOptions =
|
|
1726
|
+
conversionOptions = objectWithoutProperties_default()(options, _excluded);
|
|
1713
1727
|
if (!isValidBase(aBase) || !isValidBase(bBase)) {
|
|
1714
1728
|
throw new Error("Must specify valid aBase and bBase");
|
|
1715
1729
|
}
|
|
1716
1730
|
const value = getBigNumber(a, aBase).plus(getBigNumber(b, bBase));
|
|
1717
|
-
return converter(
|
|
1731
|
+
return converter(objectSpread2_default()({
|
|
1718
1732
|
value
|
|
1719
1733
|
}, conversionOptions));
|
|
1720
1734
|
};
|
|
@@ -1724,12 +1738,12 @@ const subtractCurrencies = function (a, b) {
|
|
|
1724
1738
|
aBase,
|
|
1725
1739
|
bBase
|
|
1726
1740
|
} = options,
|
|
1727
|
-
conversionOptions =
|
|
1741
|
+
conversionOptions = objectWithoutProperties_default()(options, _excluded2);
|
|
1728
1742
|
if (!isValidBase(aBase) || !isValidBase(bBase)) {
|
|
1729
1743
|
throw new Error("Must specify valid aBase and bBase");
|
|
1730
1744
|
}
|
|
1731
1745
|
const value = getBigNumber(a, aBase).minus(getBigNumber(b, bBase));
|
|
1732
|
-
return converter(
|
|
1746
|
+
return converter(objectSpread2_default()({
|
|
1733
1747
|
value
|
|
1734
1748
|
}, conversionOptions));
|
|
1735
1749
|
};
|
|
@@ -1739,47 +1753,47 @@ const multiplyCurrencies = function (a, b) {
|
|
|
1739
1753
|
multiplicandBase,
|
|
1740
1754
|
multiplierBase
|
|
1741
1755
|
} = options,
|
|
1742
|
-
conversionOptions =
|
|
1756
|
+
conversionOptions = objectWithoutProperties_default()(options, _excluded3);
|
|
1743
1757
|
if (!isValidBase(multiplicandBase) || !isValidBase(multiplierBase)) {
|
|
1744
1758
|
throw new Error("Must specify valid multiplicandBase and multiplierBase");
|
|
1745
1759
|
}
|
|
1746
1760
|
const value = getBigNumber(a, multiplicandBase).times(getBigNumber(b, multiplierBase));
|
|
1747
|
-
return converter(
|
|
1761
|
+
return converter(objectSpread2_default()({
|
|
1748
1762
|
value
|
|
1749
1763
|
}, conversionOptions));
|
|
1750
1764
|
};
|
|
1751
1765
|
const conversionGreaterThan = (_ref3, _ref4) => {
|
|
1752
|
-
let secondProps = Object.assign({}, (
|
|
1753
|
-
let firstProps = Object.assign({}, (
|
|
1754
|
-
const firstValue = converter(
|
|
1755
|
-
const secondValue = converter(
|
|
1766
|
+
let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref4), _ref4));
|
|
1767
|
+
let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref3), _ref3));
|
|
1768
|
+
const firstValue = converter(objectSpread2_default()({}, firstProps));
|
|
1769
|
+
const secondValue = converter(objectSpread2_default()({}, secondProps));
|
|
1756
1770
|
return firstValue.gt(secondValue);
|
|
1757
1771
|
};
|
|
1758
1772
|
const conversionLessThan = (_ref5, _ref6) => {
|
|
1759
|
-
let secondProps = Object.assign({}, (
|
|
1760
|
-
let firstProps = Object.assign({}, (
|
|
1761
|
-
const firstValue = converter(
|
|
1762
|
-
const secondValue = converter(
|
|
1773
|
+
let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref6), _ref6));
|
|
1774
|
+
let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref5), _ref5));
|
|
1775
|
+
const firstValue = converter(objectSpread2_default()({}, firstProps));
|
|
1776
|
+
const secondValue = converter(objectSpread2_default()({}, secondProps));
|
|
1763
1777
|
return firstValue.lt(secondValue);
|
|
1764
1778
|
};
|
|
1765
1779
|
const conversionMax = (_ref7, _ref8) => {
|
|
1766
|
-
let secondProps = Object.assign({}, (
|
|
1767
|
-
let firstProps = Object.assign({}, (
|
|
1768
|
-
const firstIsGreater = conversionGreaterThan(
|
|
1780
|
+
let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref8), _ref8));
|
|
1781
|
+
let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref7), _ref7));
|
|
1782
|
+
const firstIsGreater = conversionGreaterThan(objectSpread2_default()({}, firstProps), objectSpread2_default()({}, secondProps));
|
|
1769
1783
|
return firstIsGreater ? firstProps.value : secondProps.value;
|
|
1770
1784
|
};
|
|
1771
1785
|
const conversionGTE = (_ref9, _ref10) => {
|
|
1772
|
-
let secondProps = Object.assign({}, (
|
|
1773
|
-
let firstProps = Object.assign({}, (
|
|
1774
|
-
const firstValue = converter(
|
|
1775
|
-
const secondValue = converter(
|
|
1786
|
+
let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref10), _ref10));
|
|
1787
|
+
let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref9), _ref9));
|
|
1788
|
+
const firstValue = converter(objectSpread2_default()({}, firstProps));
|
|
1789
|
+
const secondValue = converter(objectSpread2_default()({}, secondProps));
|
|
1776
1790
|
return firstValue.isGreaterThanOrEqualTo(secondValue);
|
|
1777
1791
|
};
|
|
1778
1792
|
const conversionLTE = (_ref11, _ref12) => {
|
|
1779
|
-
let secondProps = Object.assign({}, (
|
|
1780
|
-
let firstProps = Object.assign({}, (
|
|
1781
|
-
const firstValue = converter(
|
|
1782
|
-
const secondValue = converter(
|
|
1793
|
+
let secondProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref12), _ref12));
|
|
1794
|
+
let firstProps = Object.assign({}, (objectDestructuringEmpty_default()(_ref11), _ref11));
|
|
1795
|
+
const firstValue = converter(objectSpread2_default()({}, firstProps));
|
|
1796
|
+
const secondValue = converter(objectSpread2_default()({}, secondProps));
|
|
1783
1797
|
return firstValue.isLessThanOrEqualTo(secondValue);
|
|
1784
1798
|
};
|
|
1785
1799
|
const toNegative = function (n) {
|
|
@@ -6465,7 +6479,7 @@ class TransactionController extends TransactionStateManager {
|
|
|
6465
6479
|
category,
|
|
6466
6480
|
methodParams
|
|
6467
6481
|
} = await determineTransactionType(txParameters, this.provider);
|
|
6468
|
-
txMeta.
|
|
6482
|
+
txMeta.contractType = type;
|
|
6469
6483
|
txMeta.transactionCategory = category;
|
|
6470
6484
|
txMeta.methodParams = methodParams;
|
|
6471
6485
|
txMeta.transaction.value = txMeta.transaction.value ? (0,util_namespaceObject.addHexPrefix)(txMeta.transaction.value) : "0x0";
|
|
@@ -6603,6 +6617,7 @@ class TransactionController extends TransactionStateManager {
|
|
|
6603
6617
|
|
|
6604
6618
|
|
|
6605
6619
|
|
|
6620
|
+
|
|
6606
6621
|
|
|
6607
6622
|
|
|
6608
6623
|
/**
|