@aeternity/aepp-sdk 13.0.0 → 13.0.1

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/aepp-sdk.js CHANGED
@@ -5270,6 +5270,7 @@ __webpack_require__.d(__webpack_exports__, {
5270
5270
  "pollForQueries": () => (/* reexport */ pollForQueries),
5271
5271
  "pollForQueryResponse": () => (/* reexport */ pollForQueryResponse),
5272
5272
  "postQueryToOracle": () => (/* reexport */ postQueryToOracle),
5273
+ "prefixedAmount": () => (/* reexport */ prefixedAmount),
5273
5274
  "produceNameId": () => (/* reexport */ produceNameId),
5274
5275
  "readInt": () => (/* reexport */ readInt),
5275
5276
  "recover": () => (/* reexport */ recover),
@@ -6346,9 +6347,9 @@ const getLowerBoundPrefix = exponent => {
6346
6347
  var _prefixes$find;
6347
6348
  return (_prefixes$find = prefixes.find(p => p.magnitude <= exponent)) !== null && _prefixes$find !== void 0 ? _prefixes$find : prefixes[prefixes.length - 1];
6348
6349
  };
6349
- /* harmony default export */ const amount_formatter = (rawValue => {
6350
+ const prefixedAmount = rawValue => {
6350
6351
  var _value$e;
6351
- const value = new BigNumber(rawValue);
6352
+ const value = new (external_bignumber_js_default())(rawValue);
6352
6353
  const exp = (_value$e = value.e) !== null && _value$e !== void 0 ? _value$e : 0;
6353
6354
  const {
6354
6355
  name,
@@ -6356,7 +6357,7 @@ const getLowerBoundPrefix = exponent => {
6356
6357
  } = (exp < 0 ? getNearestPrefix : getLowerBoundPrefix)(exp);
6357
6358
  const v = value.shiftedBy(-magnitude).precision(9 + Math.min(exp - magnitude, 0)).toFixed();
6358
6359
  return `${v}${name !== '' ? ' ' : ''}${name}`;
6359
- });
6360
+ };
6360
6361
  // EXTERNAL MODULE: external "tweetnacl"
6361
6362
  var external_tweetnacl_ = __webpack_require__(79);
6362
6363
  var external_tweetnacl_default = /*#__PURE__*/__webpack_require__.n(external_tweetnacl_);
@@ -14518,6 +14519,23 @@ class AccountMemory extends AccountBase {
14518
14519
  * Calculates the cost of transaction execution
14519
14520
  * Provides an upper cost of contract-call-related transactions because of `gasLimit`.
14520
14521
  * Also assumes that oracle query fee is 0 unless it is provided in options.
14522
+ *
14523
+ * The idea is that if you need to show transaction details with some accuracy you can define
14524
+ * expense fields that you want to show separately. And to show `getExecutionCost` result as a fee,
14525
+ * subtracting all fields shown separately.
14526
+ *
14527
+ * @example
14528
+ * ```vue
14529
+ * <template>
14530
+ * Amount: {{ txUnpacked.amount }}
14531
+ * Name fee: {{ txUnpacked.nameFee }}
14532
+ * Other fees: {{ getExecutionCost(txEncoded) - txUnpacked.amount - txUnpacked.nameFee }}
14533
+ * </template>
14534
+ * ```
14535
+ *
14536
+ * Doing this way you won't worry to show wrong fee for a transaction you may not support. Because
14537
+ * the SDK calculates the overall price of any transaction on its side.
14538
+ *
14521
14539
  * @param transaction - Transaction to calculate the cost of
14522
14540
  * @param innerTx - Should be provided if transaction wrapped with Tag.PayingForTx
14523
14541
  * @param gasUsed - Amount of gas actually used to make calculation more accurate