@dynamic-labs/ethereum-core 3.9.7 → 3.9.8

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,13 @@
1
1
 
2
+ ### [3.9.8](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.7...v3.9.8) (2025-01-09)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * allow confirmed commitment transactions for solana ([#7735](https://github.com/dynamic-labs/DynamicAuth/issues/7735)) ([7a43b79](https://github.com/dynamic-labs/DynamicAuth/commit/7a43b792ba615e277573b5540801a8b3e0c68155))
8
+ * allow selecting wallet directly without showing group view if wallet key is the same as group key ([#7748](https://github.com/dynamic-labs/DynamicAuth/issues/7748)) ([b335cbd](https://github.com/dynamic-labs/DynamicAuth/commit/b335cbdafc22d757c84995bd276c55681e6b2de5))
9
+ * make transaction destination parsing for regular EVM transactions ([#7719](https://github.com/dynamic-labs/DynamicAuth/issues/7719)) ([890bc0f](https://github.com/dynamic-labs/DynamicAuth/commit/890bc0f32a79fe3670d9dc4474b34c85854c0e70))
10
+
2
11
  ### [3.9.7](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.6...v3.9.7) (2025-01-02)
3
12
 
4
13
 
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.7";
6
+ var version = "3.9.8";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "3.9.7";
2
+ var version = "3.9.8";
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.7",
3
+ "version": "3.9.8",
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.7",
34
- "@dynamic-labs/logger": "3.9.7",
35
- "@dynamic-labs/rpc-providers": "3.9.7",
36
- "@dynamic-labs/types": "3.9.7",
37
- "@dynamic-labs/utils": "3.9.7",
38
- "@dynamic-labs/wallet-book": "3.9.7",
39
- "@dynamic-labs/wallet-connector-core": "3.9.7"
33
+ "@dynamic-labs/assert-package-version": "3.9.8",
34
+ "@dynamic-labs/logger": "3.9.8",
35
+ "@dynamic-labs/rpc-providers": "3.9.8",
36
+ "@dynamic-labs/types": "3.9.8",
37
+ "@dynamic-labs/utils": "3.9.8",
38
+ "@dynamic-labs/wallet-book": "3.9.8",
39
+ "@dynamic-labs/wallet-connector-core": "3.9.8"
40
40
  }
41
41
  }
@@ -11,6 +11,7 @@ var Eip1559FeeFeed = require('../Eip1559FeeFeed.cjs');
11
11
  var estimateL1Fee = require('../estimateL1Fee/estimateL1Fee.cjs');
12
12
  var parseEther = require('../parseEther/parseEther.cjs');
13
13
  var formatEther = require('../formatEther/formatEther.cjs');
14
+ var getTransactionRecipient = require('../getTransactionRecipient.cjs');
14
15
 
15
16
  class ViemRpcUiTransaction extends Eip1559FeeFeed.Eip1559FeeFeed {
16
17
  constructor({ transaction, onSubmit, publicClient, }) {
@@ -60,21 +61,8 @@ class ViemRpcUiTransaction extends Eip1559FeeFeed.Eip1559FeeFeed {
60
61
  });
61
62
  }
62
63
  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;
64
+ var _a;
65
+ return getTransactionRecipient.getTransactionRecipient(this.transaction.data, (_a = this.transaction.to) !== null && _a !== void 0 ? _a : undefined);
78
66
  }
79
67
  estimateGas() {
80
68
  return _tslib.__awaiter(this, void 0, void 0, function* () {
@@ -1,12 +1,13 @@
1
1
  'use client'
2
2
  import { __awaiter, __rest } from '../../../../_virtual/_tslib.js';
3
- import { hexToBigInt, decodeAbiParameters, toHex, TransactionExecutionError, BaseError } from 'viem';
3
+ import { hexToBigInt, 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';
7
7
  import { isL1FeeSupportedByChain, estimateL1Fee } from '../estimateL1Fee/estimateL1Fee.js';
8
8
  import { parseEther } from '../parseEther/parseEther.js';
9
9
  import { formatEther } from '../formatEther/formatEther.js';
10
+ import { getTransactionRecipient } from '../getTransactionRecipient.js';
10
11
 
11
12
  class ViemRpcUiTransaction extends Eip1559FeeFeed {
12
13
  constructor({ transaction, onSubmit, publicClient, }) {
@@ -56,21 +57,8 @@ class ViemRpcUiTransaction extends Eip1559FeeFeed {
56
57
  });
57
58
  }
58
59
  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;
60
+ var _a;
61
+ return getTransactionRecipient(this.transaction.data, (_a = this.transaction.to) !== null && _a !== void 0 ? _a : undefined);
74
62
  }
75
63
  estimateGas() {
76
64
  return __awaiter(this, void 0, void 0, function* () {
@@ -11,6 +11,7 @@ var estimateL1Fee = require('../estimateL1Fee/estimateL1Fee.cjs');
11
11
  var validateAddressFormat = require('../../validateAddressFormat/validateAddressFormat.cjs');
12
12
  var parseEther = require('../parseEther/parseEther.cjs');
13
13
  var formatEther = require('../formatEther/formatEther.cjs');
14
+ var getTransactionRecipient = require('../getTransactionRecipient.cjs');
14
15
 
15
16
  class ViemUiTransaction extends Eip1559FeeFeed.Eip1559FeeFeed {
16
17
  constructor({ transaction, onSubmit, publicClient, account, }) {
@@ -97,6 +98,10 @@ class ViemUiTransaction extends Eip1559FeeFeed.Eip1559FeeFeed {
97
98
  convertBigIntToHex(value) {
98
99
  return value ? viem.toHex(value) : undefined;
99
100
  }
101
+ getTransactionRecipient() {
102
+ var _a;
103
+ return getTransactionRecipient.getTransactionRecipient(this.transaction.data, (_a = this.transaction.to) !== null && _a !== void 0 ? _a : undefined);
104
+ }
100
105
  estimateL1Fee() {
101
106
  return _tslib.__awaiter(this, void 0, void 0, function* () {
102
107
  var _a;
@@ -49,6 +49,7 @@ export declare class ViemUiTransaction extends Eip1559FeeFeed implements IUITran
49
49
  getBalance(): Promise<bigint>;
50
50
  estimateGas(): Promise<bigint>;
51
51
  private convertBigIntToHex;
52
+ getTransactionRecipient(): `0x${string}` | undefined;
52
53
  estimateL1Fee(): Promise<bigint>;
53
54
  set maxFeePerGas(value: bigint);
54
55
  set maxPriorityFeePerGas(value: bigint);
@@ -7,6 +7,7 @@ import { isL1FeeSupportedByChain, estimateL1Fee } from '../estimateL1Fee/estimat
7
7
  import { validateAddressFormat } from '../../validateAddressFormat/validateAddressFormat.js';
8
8
  import { parseEther } from '../parseEther/parseEther.js';
9
9
  import { formatEther } from '../formatEther/formatEther.js';
10
+ import { getTransactionRecipient } from '../getTransactionRecipient.js';
10
11
 
11
12
  class ViemUiTransaction extends Eip1559FeeFeed {
12
13
  constructor({ transaction, onSubmit, publicClient, account, }) {
@@ -93,6 +94,10 @@ class ViemUiTransaction extends Eip1559FeeFeed {
93
94
  convertBigIntToHex(value) {
94
95
  return value ? toHex(value) : undefined;
95
96
  }
97
+ getTransactionRecipient() {
98
+ var _a;
99
+ return getTransactionRecipient(this.transaction.data, (_a = this.transaction.to) !== null && _a !== void 0 ? _a : undefined);
100
+ }
96
101
  estimateL1Fee() {
97
102
  return __awaiter(this, void 0, void 0, function* () {
98
103
  var _a;
@@ -0,0 +1,25 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var viem = require('viem');
7
+
8
+ const getTransactionRecipient = (data, to) => {
9
+ // 0xa9059cbb is the function selector for the transfer function
10
+ // so we can use it to check if the transaction is a transfer
11
+ // then decode the transaction data to get the recipient
12
+ if (data === null || data === void 0 ? void 0 : data.startsWith('0xa9059cbb')) {
13
+ return viem.decodeAbiParameters([
14
+ { name: 'x', type: 'address' },
15
+ { name: 'x', type: 'uint256' },
16
+ ], ('0x' + (data === null || data === void 0 ? void 0 : data.slice(10))))[0];
17
+ }
18
+ // if the data is 0x or undefined, then the recipient is the "to" address
19
+ if (!data || data === '0x') {
20
+ return to !== null && to !== void 0 ? to : undefined;
21
+ }
22
+ return undefined;
23
+ };
24
+
25
+ exports.getTransactionRecipient = getTransactionRecipient;
@@ -0,0 +1,2 @@
1
+ import { Hex } from 'viem';
2
+ export declare const getTransactionRecipient: (data: Hex | undefined, to: Hex | undefined) => Hex | undefined;
@@ -0,0 +1,21 @@
1
+ 'use client'
2
+ import { decodeAbiParameters } from 'viem';
3
+
4
+ const getTransactionRecipient = (data, to) => {
5
+ // 0xa9059cbb is the function selector for the transfer function
6
+ // so we can use it to check if the transaction is a transfer
7
+ // then decode the transaction data to get the recipient
8
+ if (data === null || data === void 0 ? void 0 : data.startsWith('0xa9059cbb')) {
9
+ return decodeAbiParameters([
10
+ { name: 'x', type: 'address' },
11
+ { name: 'x', type: 'uint256' },
12
+ ], ('0x' + (data === null || data === void 0 ? void 0 : data.slice(10))))[0];
13
+ }
14
+ // if the data is 0x or undefined, then the recipient is the "to" address
15
+ if (!data || data === '0x') {
16
+ return to !== null && to !== void 0 ? to : undefined;
17
+ }
18
+ return undefined;
19
+ };
20
+
21
+ export { getTransactionRecipient };