@dynamic-labs/ethereum-core 3.9.6 → 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 +16 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/utils/viem/ViemRpcUiTransaction/ViemRpcUiTransaction.cjs +3 -15
- package/src/utils/viem/ViemRpcUiTransaction/ViemRpcUiTransaction.js +4 -16
- package/src/utils/viem/ViemUiTransaction/ViemUiTransaction.cjs +5 -0
- package/src/utils/viem/ViemUiTransaction/ViemUiTransaction.d.ts +1 -0
- package/src/utils/viem/ViemUiTransaction/ViemUiTransaction.js +5 -0
- package/src/utils/viem/createViemUiTransaction/createViemUiTransaction.cjs +1 -0
- package/src/utils/viem/createViemUiTransaction/createViemUiTransaction.js +1 -0
- package/src/utils/viem/getTransactionRecipient.cjs +25 -0
- package/src/utils/viem/getTransactionRecipient.d.ts +2 -0
- package/src/utils/viem/getTransactionRecipient.js +21 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,20 @@
|
|
|
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
|
+
|
|
11
|
+
### [3.9.7](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.6...v3.9.7) (2025-01-02)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* wc wallet client interactions on some wallets ([#7728](https://github.com/dynamic-labs/DynamicAuth/issues/7728)) ([f1190d9](https://github.com/dynamic-labs/DynamicAuth/commit/f1190d9bd119f00787b61009d28c2d0f564f1ed8))
|
|
17
|
+
|
|
2
18
|
### [3.9.6](https://github.com/dynamic-labs/DynamicAuth/compare/v3.9.5...v3.9.6) (2024-12-28)
|
|
3
19
|
|
|
4
20
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum-core",
|
|
3
|
-
"version": "3.9.
|
|
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.
|
|
34
|
-
"@dynamic-labs/logger": "3.9.
|
|
35
|
-
"@dynamic-labs/rpc-providers": "3.9.
|
|
36
|
-
"@dynamic-labs/types": "3.9.
|
|
37
|
-
"@dynamic-labs/utils": "3.9.
|
|
38
|
-
"@dynamic-labs/wallet-book": "3.9.
|
|
39
|
-
"@dynamic-labs/wallet-connector-core": "3.9.
|
|
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
|
|
64
|
-
|
|
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,
|
|
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
|
|
60
|
-
|
|
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;
|
|
@@ -26,6 +26,7 @@ const createViemUiTransaction = (_a) => _tslib.__awaiter(void 0, [_a], void 0, f
|
|
|
26
26
|
// Native token
|
|
27
27
|
return walletClient.sendTransaction({
|
|
28
28
|
account: from,
|
|
29
|
+
data: '0x',
|
|
29
30
|
maxFeePerGas: transaction.maxFeePerGas,
|
|
30
31
|
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
|
31
32
|
to: transaction.to,
|
|
@@ -22,6 +22,7 @@ const createViemUiTransaction = (_a) => __awaiter(void 0, [_a], void 0, function
|
|
|
22
22
|
// Native token
|
|
23
23
|
return walletClient.sendTransaction({
|
|
24
24
|
account: from,
|
|
25
|
+
data: '0x',
|
|
25
26
|
maxFeePerGas: transaction.maxFeePerGas,
|
|
26
27
|
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
|
27
28
|
to: transaction.to,
|
|
@@ -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,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 };
|