@dynamic-labs/sdk-react-core 0.16.12 → 0.16.13

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,4 +1,11 @@
1
1
 
2
+ ### [0.16.13](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.12...v0.16.13) (2023-05-08)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * **TransactionModal:** ensure alchemy will not fail when estimating for gas ([#2067](https://github.com/dynamic-labs/DynamicAuth/issues/2067)) ([a0aea1b](https://github.com/dynamic-labs/DynamicAuth/commit/a0aea1bbabb9a81968dc4ba59d62e748c267849a))
8
+
2
9
  ### [0.16.12](https://github.com/dynamic-labs/DynamicAuth/compare/v0.16.11...v0.16.12) (2023-05-05)
3
10
 
4
11
 
package/package.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var version = "0.16.12";
5
+ var version = "0.16.13";
6
6
  var dependencies = {
7
7
  "react-focus-lock": "^2.9.2",
8
8
  "@dynamic-labs/sdk-api": "0.0.174",
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
- var version = "0.16.12";
1
+ var version = "0.16.13";
2
2
  var dependencies = {
3
3
  "react-focus-lock": "^2.9.2",
4
4
  "@dynamic-labs/sdk-api": "0.0.174",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/sdk-react-core",
3
- "version": "0.16.12",
3
+ "version": "0.16.13",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -17,9 +17,9 @@
17
17
  "formik": "^2.2.9",
18
18
  "qrcode": "1.5.1",
19
19
  "ethers": "^5.7.2",
20
- "@dynamic-labs/logger": "0.16.12",
21
- "@dynamic-labs/multi-wallet": "0.16.12",
22
- "@dynamic-labs/wallet-connector-core": "0.16.12"
20
+ "@dynamic-labs/logger": "0.16.13",
21
+ "@dynamic-labs/multi-wallet": "0.16.13",
22
+ "@dynamic-labs/wallet-connector-core": "0.16.13"
23
23
  },
24
24
  "devDependencies": {
25
25
  "semver": "^7.3.8"
@@ -81,8 +81,13 @@ const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onT
81
81
  return val ? ethers.ethers.BigNumber.from(val) : undefined;
82
82
  }));
83
83
  const { data: effectiveGasPrice, isLoading: isEffectiveGasPriceLoading } = usePromise.usePromise(() => _tslib.__awaiter(void 0, void 0, void 0, function* () {
84
+ // To safely run estimateGas using alchemy, we need to remove the from address
85
+ // because alchemy checks the origin address funds and can return an error if
86
+ // origin wallet has no funds for the transaction
87
+ // https://docs.alchemy.com/reference/eth-estimategas
88
+ const { from } = transaction, transactionWithNoOrigin = _tslib.__rest(transaction, ["from"]);
84
89
  const gasPrice = yield provider.getGasPrice();
85
- const estimatedGas = yield provider.estimateGas(transaction);
90
+ const estimatedGas = yield provider.estimateGas(transactionWithNoOrigin);
86
91
  return gasPrice && estimatedGas
87
92
  ? ethers.ethers.BigNumber.from(gasPrice).mul(estimatedGas)
88
93
  : undefined;
@@ -1,4 +1,4 @@
1
- import { __awaiter } from '../../../../_virtual/_tslib.js';
1
+ import { __awaiter, __rest } from '../../../../_virtual/_tslib.js';
2
2
  import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { useRef, useState, useCallback, useMemo } from 'react';
4
4
  import { ethers } from 'ethers';
@@ -77,8 +77,13 @@ const TransactionConfirmationModal = ({ title, appOrigin, handler, onReject, onT
77
77
  return val ? ethers.BigNumber.from(val) : undefined;
78
78
  }));
79
79
  const { data: effectiveGasPrice, isLoading: isEffectiveGasPriceLoading } = usePromise(() => __awaiter(void 0, void 0, void 0, function* () {
80
+ // To safely run estimateGas using alchemy, we need to remove the from address
81
+ // because alchemy checks the origin address funds and can return an error if
82
+ // origin wallet has no funds for the transaction
83
+ // https://docs.alchemy.com/reference/eth-estimategas
84
+ const { from } = transaction, transactionWithNoOrigin = __rest(transaction, ["from"]);
80
85
  const gasPrice = yield provider.getGasPrice();
81
- const estimatedGas = yield provider.estimateGas(transaction);
86
+ const estimatedGas = yield provider.estimateGas(transactionWithNoOrigin);
82
87
  return gasPrice && estimatedGas
83
88
  ? ethers.BigNumber.from(gasPrice).mul(estimatedGas)
84
89
  : undefined;