@dynamic-labs/ethereum-core 3.9.3 → 3.9.5

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.5](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.4...v3.9.5) (2024-12-20)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * 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))
8
+ * zerodev confirmation UI closes properly ([#7669](https://github.com/dynamic-labs/DynamicAuth/issues/7669)) ([ee68034](https://github.com/dynamic-labs/DynamicAuth/commit/ee6803489628c1c69fe6e97492898324d9209d31))
9
+
10
+ ### [3.9.4](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.3...v3.9.4) (2024-12-18)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * improve signtypeddata and signmessage for zerodev connector ([#7651](https://github.com/dynamic-labs/DynamicAuth/issues/7651)) ([6f2b938](https://github.com/dynamic-labs/DynamicAuth/commit/6f2b938cfbcb9d5ca15b20979b42a458a9062164))
16
+
2
17
  ### [3.9.3](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.2...v3.9.3) (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.3";
6
+ var version = "3.9.5";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "3.9.3";
2
+ var version = "3.9.5";
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.3",
3
+ "version": "3.9.5",
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.3",
34
- "@dynamic-labs/logger": "3.9.3",
35
- "@dynamic-labs/rpc-providers": "3.9.3",
36
- "@dynamic-labs/types": "3.9.3",
37
- "@dynamic-labs/utils": "3.9.3",
38
- "@dynamic-labs/wallet-book": "3.9.3",
39
- "@dynamic-labs/wallet-connector-core": "3.9.3"
33
+ "@dynamic-labs/assert-package-version": "3.9.5",
34
+ "@dynamic-labs/logger": "3.9.5",
35
+ "@dynamic-labs/rpc-providers": "3.9.5",
36
+ "@dynamic-labs/types": "3.9.5",
37
+ "@dynamic-labs/utils": "3.9.5",
38
+ "@dynamic-labs/wallet-book": "3.9.5",
39
+ "@dynamic-labs/wallet-connector-core": "3.9.5"
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