@dynamic-labs/ethereum-core 3.9.4 → 3.9.6

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,19 @@
1
1
 
2
+ ### [3.9.6](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.5...v3.9.6) (2024-12-28)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * properly cancel transaction confirmation UI when using account abstraction and embedded wallets ([#7713](https://github.com/dynamic-labs/DynamicAuth/issues/7713)) ([ef3020b](https://github.com/dynamic-labs/DynamicAuth/commit/ef3020b5985928178c7cda7bbeb9e96dcbc3a925)), closes [#7669](https://github.com/dynamic-labs/DynamicAuth/issues/7669)
8
+
9
+ ### [3.9.5](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.4...v3.9.5) (2024-12-20)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * confirmation ui shows recipient if tx is native/token transfer ([#7679](https://github.com/dynamic-labs/DynamicAuth/issues/7679)) ([868d75a](https://github.com/dynamic-labs/DynamicAuth/commit/868d75a0b15b72084b8cefcdde2913e27001af48))
15
+ * zerodev confirmation UI closes properly ([#7669](https://github.com/dynamic-labs/DynamicAuth/issues/7669)) ([ee68034](https://github.com/dynamic-labs/DynamicAuth/commit/ee6803489628c1c69fe6e97492898324d9209d31))
16
+
2
17
  ### [3.9.4](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.3...v3.9.4) (2024-12-18)
3
18
 
4
19
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "3.9.4";
6
+ var version = "3.9.6";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "3.9.4";
2
+ var version = "3.9.6";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/ethereum-core",
3
- "version": "3.9.4",
3
+ "version": "3.9.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -30,12 +30,12 @@
30
30
  },
31
31
  "peerDependencies": {
32
32
  "viem": "^2.7.12",
33
- "@dynamic-labs/assert-package-version": "3.9.4",
34
- "@dynamic-labs/logger": "3.9.4",
35
- "@dynamic-labs/rpc-providers": "3.9.4",
36
- "@dynamic-labs/types": "3.9.4",
37
- "@dynamic-labs/utils": "3.9.4",
38
- "@dynamic-labs/wallet-book": "3.9.4",
39
- "@dynamic-labs/wallet-connector-core": "3.9.4"
33
+ "@dynamic-labs/assert-package-version": "3.9.6",
34
+ "@dynamic-labs/logger": "3.9.6",
35
+ "@dynamic-labs/rpc-providers": "3.9.6",
36
+ "@dynamic-labs/types": "3.9.6",
37
+ "@dynamic-labs/utils": "3.9.6",
38
+ "@dynamic-labs/wallet-book": "3.9.6",
39
+ "@dynamic-labs/wallet-connector-core": "3.9.6"
40
40
  }
41
41
  }
@@ -59,6 +59,23 @@ class ViemRpcUiTransaction extends Eip1559FeeFeed.Eip1559FeeFeed {
59
59
  address: this.transaction.from,
60
60
  });
61
61
  }
62
+ getTransactionRecipient() {
63
+ var _a, _b, _c;
64
+ // 0xa9059cbb is the function selector for the transfer function
65
+ // so we can use it to check if the transaction is a transfer
66
+ // then decode the transaction data to get the recipient
67
+ if ((_a = this.transaction.data) === null || _a === void 0 ? void 0 : _a.startsWith('0xa9059cbb')) {
68
+ return viem.decodeAbiParameters([
69
+ { name: 'x', type: 'address' },
70
+ { name: 'x', type: 'uint256' },
71
+ ], ('0x' + ((_b = this.transaction.data) === null || _b === void 0 ? void 0 : _b.slice(10))))[0];
72
+ }
73
+ // if the data is 0x or undefined, then the recipient is the "to" address
74
+ if (!this.transaction.data || this.transaction.data === '0x') {
75
+ return (_c = this.transaction.to) !== null && _c !== void 0 ? _c : undefined;
76
+ }
77
+ return undefined;
78
+ }
62
79
  estimateGas() {
63
80
  return _tslib.__awaiter(this, void 0, void 0, function* () {
64
81
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -28,6 +28,7 @@ export declare class ViemRpcUiTransaction extends Eip1559FeeFeed implements IUIT
28
28
  get data(): `0x${string}` | undefined;
29
29
  submit(): Promise<string>;
30
30
  getBalance(): Promise<bigint>;
31
+ getTransactionRecipient(): `0x${string}` | undefined;
31
32
  estimateGas(): Promise<bigint>;
32
33
  estimateL1Fee(): Promise<bigint>;
33
34
  set maxFeePerGas(value: bigint);
@@ -1,6 +1,6 @@
1
1
  'use client'
2
2
  import { __awaiter, __rest } from '../../../../_virtual/_tslib.js';
3
- import { hexToBigInt, toHex, TransactionExecutionError, BaseError } from 'viem';
3
+ import { hexToBigInt, decodeAbiParameters, toHex, TransactionExecutionError, BaseError } from 'viem';
4
4
  import { UserRejectedTransactionError } from '@dynamic-labs/utils';
5
5
  import { validateAddressFormat } from '../../validateAddressFormat/validateAddressFormat.js';
6
6
  import { Eip1559FeeFeed } from '../Eip1559FeeFeed.js';
@@ -55,6 +55,23 @@ class ViemRpcUiTransaction extends Eip1559FeeFeed {
55
55
  address: this.transaction.from,
56
56
  });
57
57
  }
58
+ getTransactionRecipient() {
59
+ var _a, _b, _c;
60
+ // 0xa9059cbb is the function selector for the transfer function
61
+ // so we can use it to check if the transaction is a transfer
62
+ // then decode the transaction data to get the recipient
63
+ if ((_a = this.transaction.data) === null || _a === void 0 ? void 0 : _a.startsWith('0xa9059cbb')) {
64
+ return decodeAbiParameters([
65
+ { name: 'x', type: 'address' },
66
+ { name: 'x', type: 'uint256' },
67
+ ], ('0x' + ((_b = this.transaction.data) === null || _b === void 0 ? void 0 : _b.slice(10))))[0];
68
+ }
69
+ // if the data is 0x or undefined, then the recipient is the "to" address
70
+ if (!this.transaction.data || this.transaction.data === '0x') {
71
+ return (_c = this.transaction.to) !== null && _c !== void 0 ? _c : undefined;
72
+ }
73
+ return undefined;
74
+ }
58
75
  estimateGas() {
59
76
  return __awaiter(this, void 0, void 0, function* () {
60
77
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -33,6 +33,9 @@ const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, on
33
33
  error.walk() instanceof utils.UserRejectedTransactionError) {
34
34
  throw new viem.UserRejectedRequestError(error.walk());
35
35
  }
36
+ if (error instanceof utils.UserRejectedTransactionError) {
37
+ throw new viem.UserRejectedRequestError(error);
38
+ }
36
39
  if (error instanceof utils.UserRejectedRequestError) {
37
40
  throw new viem.UserRejectedRequestError(error);
38
41
  }
@@ -29,6 +29,9 @@ const interceptTransport = ({ getAccounts, onPersonalSign, onSendTransaction, on
29
29
  error.walk() instanceof UserRejectedTransactionError) {
30
30
  throw new UserRejectedRequestError$1(error.walk());
31
31
  }
32
+ if (error instanceof UserRejectedTransactionError) {
33
+ throw new UserRejectedRequestError$1(error);
34
+ }
32
35
  if (error instanceof UserRejectedRequestError) {
33
36
  throw new UserRejectedRequestError$1(error);
34
37
  }