edge-currency-monero 0.3.0 → 0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # edge-currency-monero
2
2
 
3
+ # 0.3.4 (2022-01-11)
4
+
5
+ - Fix git urls
6
+
7
+ # 0.3.3 (2021-09-28)
8
+
9
+ - Reformat spendable balance error into 3 lines
10
+
11
+ # 0.3.2 (2021-06-03)
12
+
13
+ - Remove icon URLs
14
+
15
+ # 0.3.1 (2021-05-25)
16
+
17
+ - Fix float amount precision
18
+ - Fix recorded native amount and fee
19
+
3
20
  # 0.3.0 (2021-05-24)
4
21
 
5
22
  - Import native code directly from react-native-mymonero-core. Before, this plugin relied on "magic" methods passed in via the global object.
@@ -20176,20 +20176,6 @@ module.exports = function (module) {
20176
20176
 
20177
20177
  /***/ }),
20178
20178
 
20179
- /***/ "./src/constants.js":
20180
- /*!**************************!*\
20181
- !*** ./src/constants.js ***!
20182
- \**************************/
20183
- /*! exports provided: imageServerUrl */
20184
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
20185
-
20186
- "use strict";
20187
- __webpack_require__.r(__webpack_exports__);
20188
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "imageServerUrl", function() { return imageServerUrl; });
20189
- var imageServerUrl = 'https://content.edge.app';
20190
-
20191
- /***/ }),
20192
-
20193
20179
  /***/ "./src/utils.js":
20194
20180
  /*!**********************!*\
20195
20181
  !*** ./src/utils.js ***!
@@ -20700,11 +20686,9 @@ var MoneroEngine = /*#__PURE__*/function () {
20700
20686
  }, {
20701
20687
  key: "processMoneroTransaction",
20702
20688
  value: function processMoneroTransaction(tx) {
20703
- var ourReceiveAddresses = []; // const nativeNetworkFee:string = bns.mul(tx.gasPrice, tx.gasUsed)
20704
-
20705
- var nativeNetworkFee = '0'; // Can't know the fee right now. Limitation of monero
20706
-
20707
- var netNativeAmount = biggystring__WEBPACK_IMPORTED_MODULE_0__["bns"].sub(tx.total_received, tx.total_sent);
20689
+ var ourReceiveAddresses = [];
20690
+ var nativeNetworkFee = tx.fee != null ? tx.fee : '0';
20691
+ var netNativeAmount = biggystring__WEBPACK_IMPORTED_MODULE_0__["bns"].add(biggystring__WEBPACK_IMPORTED_MODULE_0__["bns"].sub(tx.total_received, tx.total_sent), nativeNetworkFee);
20708
20692
 
20709
20693
  if (netNativeAmount.slice(0, 1) !== '-') {
20710
20694
  ourReceiveAddresses.push(this.walletLocalData.moneroAddress.toLowerCase());
@@ -21415,7 +21399,7 @@ var MoneroEngine = /*#__PURE__*/function () {
21415
21399
  var _makeSpendInner = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee19(edgeSpendInfo) {
21416
21400
  var _this3 = this;
21417
21401
 
21418
- var valid, currencyCode, publicAddress, nativeAmount, uniqueIdentifier, priority, result, sendParams, amountFloatString, amountFloat, date, edgeTransaction;
21402
+ var valid, currencyCode, publicAddress, nativeAmount, uniqueIdentifier, priority, result, sendParams, amountFloatString, amountFloat, regex, subst, msgFormatted, date, edgeTransaction;
21419
21403
  return regeneratorRuntime.wrap(function _callee19$(_context19) {
21420
21404
  while (1) {
21421
21405
  switch (_context19.prev = _context19.next) {
@@ -21576,7 +21560,7 @@ var MoneroEngine = /*#__PURE__*/function () {
21576
21560
 
21577
21561
  case 45:
21578
21562
  _context19.prev = 45;
21579
- amountFloatString = biggystring__WEBPACK_IMPORTED_MODULE_0__["bns"].div(nativeAmount, '1000000000000', 8); // Todo: Yikes. Why does mymonero-core-js take a float, not a string? -paulvp
21563
+ amountFloatString = biggystring__WEBPACK_IMPORTED_MODULE_0__["bns"].div(nativeAmount, '1000000000000', 12); // Todo: Yikes. Why does mymonero-core-js take a float, not a string? -paulvp
21580
21564
 
21581
21565
  amountFloat = parseFloat(amountFloatString);
21582
21566
  sendParams = {
@@ -21604,16 +21588,20 @@ var MoneroEngine = /*#__PURE__*/function () {
21604
21588
 
21605
21589
  case 51:
21606
21590
  result = _context19.sent;
21607
- _context19.next = 58;
21591
+ _context19.next = 61;
21608
21592
  break;
21609
21593
 
21610
21594
  case 54:
21611
21595
  _context19.prev = 54;
21612
21596
  _context19.t1 = _context19["catch"](45);
21613
- this.log.error("makeSpend error: ".concat(_context19.t1));
21614
- throw _context19.t1;
21615
-
21616
- case 58:
21597
+ // This error is specific to mymonero-core-js: github.com/mymonero/mymonero-core-cpp/blob/a53e57f2a376b05bb0f4d851713321c749e5d8d9/src/monero_transfer_utils.hpp#L112-L162
21598
+ this.log.error(_context19.t1.message);
21599
+ regex = / Have (\d*\.?\d+) XMR; need (\d*\.?\d+) XMR./gm;
21600
+ subst = "\nHave: $1 XMR.\nNeed: $2 XMR.";
21601
+ msgFormatted = _context19.t1.message.replace(regex, subst);
21602
+ throw new Error(msgFormatted);
21603
+
21604
+ case 61:
21617
21605
  date = Date.now() / 1000;
21618
21606
  nativeAmount = '-' + nativeAmount;
21619
21607
  edgeTransaction = {
@@ -21623,7 +21611,7 @@ var MoneroEngine = /*#__PURE__*/function () {
21623
21611
  // currencyCode
21624
21612
  blockHeight: 0,
21625
21613
  // blockHeight
21626
- nativeAmount: nativeAmount,
21614
+ nativeAmount: biggystring__WEBPACK_IMPORTED_MODULE_0__["bns"].sub(nativeAmount, result.networkFee),
21627
21615
  // nativeAmount
21628
21616
  networkFee: result.networkFee,
21629
21617
  ourReceiveAddresses: [],
@@ -21638,7 +21626,7 @@ var MoneroEngine = /*#__PURE__*/function () {
21638
21626
  this.log.warn("makeSpend result ".concat(Object(_utils_js__WEBPACK_IMPORTED_MODULE_2__["cleanResultLogs"])(result)));
21639
21627
  return _context19.abrupt("return", edgeTransaction);
21640
21628
 
21641
- case 64:
21629
+ case 67:
21642
21630
  case "end":
21643
21631
  return _context19.stop();
21644
21632
  }
@@ -21850,8 +21838,6 @@ if (typeof window !== 'undefined' && typeof window.addEdgeCorePlugins === 'funct
21850
21838
  "use strict";
21851
21839
  __webpack_require__.r(__webpack_exports__);
21852
21840
  /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "currencyInfo", function() { return currencyInfo; });
21853
- /* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./constants.js */ "./src/constants.js");
21854
-
21855
21841
  var otherSettings = {
21856
21842
  mymoneroApiServers: ['https://edge.mymonero.com:8443']
21857
21843
  };
@@ -21874,10 +21860,6 @@ var currencyInfo = {
21874
21860
  multiplier: '1000000000000',
21875
21861
  symbol: '‎ɱ'
21876
21862
  }],
21877
- symbolImage: "".concat(_constants_js__WEBPACK_IMPORTED_MODULE_0__["imageServerUrl"], "/monero-logo-solo-64.png"),
21878
- // Base64 encoded png image of the currency symbol (optional)
21879
- symbolImageDarkMono: "".concat(_constants_js__WEBPACK_IMPORTED_MODULE_0__["imageServerUrl"], "/monero-logo-solo-64.png"),
21880
- // Base64 encoded png image of the currency symbol (optional)
21881
21863
  metaTokens: []
21882
21864
  };
21883
21865