@dynamic-labs/ethereum-core 4.3.2 → 4.4.1
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 +21 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +8 -8
- package/src/wallet/EthereumWallet.cjs +17 -1
- package/src/wallet/EthereumWallet.d.ts +8 -1
- package/src/wallet/EthereumWallet.js +18 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
|
|
2
|
+
### [4.4.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.4.0...v4.4.1) (2025-01-27)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* allow override of rpc urls in connectionConfig for Solana and Eclipse ([#7884](https://github.com/dynamic-labs/dynamic-auth/issues/7884)) ([b65cea0](https://github.com/dynamic-labs/dynamic-auth/commit/b65cea0f7f5240c0e021843266c1437feffa51c5))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* close banxa modal when clicking outside of modal ([#7890](https://github.com/dynamic-labs/dynamic-auth/issues/7890)) ([cc5b5a5](https://github.com/dynamic-labs/dynamic-auth/commit/cc5b5a5911615925065411472f7874aeafff0a25))
|
|
13
|
+
|
|
14
|
+
## [4.4.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.3.2...v4.4.0) (2025-01-24)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* allow override of rpc urls in evmNetworks overrides ([#7874](https://github.com/dynamic-labs/dynamic-auth/issues/7874)) ([41c5030](https://github.com/dynamic-labs/dynamic-auth/commit/f0fef3c06bb82457da92c7f5655a0a6daf57e3aa))
|
|
20
|
+
* add ZeroDev v3 migration support ([#7854](https://github.com/dynamic-labs/dynamic-auth/issues/7854)) ([8e34ea0](https://github.com/dynamic-labs/dynamic-auth/commit/8e34ea0ec2451ded6df1138f53354b0a53140ecc))
|
|
21
|
+
* adds view for choosing funds deposit method ([#7813](https://github.com/dynamic-labs/dynamic-auth/issues/7813)) ([41c5030](https://github.com/dynamic-labs/dynamic-auth/commit/41c50309c94da61525bff5ea5f36dc1f68a4c79d))
|
|
22
|
+
|
|
2
23
|
### [4.3.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.3.1...v4.3.2) (2025-01-24)
|
|
3
24
|
|
|
4
25
|
### [4.3.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.3.0...v4.3.1) (2025-01-23)
|
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": "4.
|
|
3
|
+
"version": "4.4.1",
|
|
4
4
|
"description": "Core package for utilities and types for viem",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -22,12 +22,12 @@
|
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"viem": "^2.21.55",
|
|
25
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
26
|
-
"@dynamic-labs/logger": "4.
|
|
27
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
28
|
-
"@dynamic-labs/types": "4.
|
|
29
|
-
"@dynamic-labs/utils": "4.
|
|
30
|
-
"@dynamic-labs/wallet-book": "4.
|
|
31
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
25
|
+
"@dynamic-labs/assert-package-version": "4.4.1",
|
|
26
|
+
"@dynamic-labs/logger": "4.4.1",
|
|
27
|
+
"@dynamic-labs/rpc-providers": "4.4.1",
|
|
28
|
+
"@dynamic-labs/types": "4.4.1",
|
|
29
|
+
"@dynamic-labs/utils": "4.4.1",
|
|
30
|
+
"@dynamic-labs/wallet-book": "4.4.1",
|
|
31
|
+
"@dynamic-labs/wallet-connector-core": "4.4.1"
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -11,6 +11,7 @@ require('../utils/logger.cjs');
|
|
|
11
11
|
require('../utils/viem/estimateL1Fee/opStack/estimateL1Fee.cjs');
|
|
12
12
|
require('../utils/viem/chainsMap/chainsMap.cjs');
|
|
13
13
|
var interceptTransport = require('../utils/viem/interceptTransport/interceptTransport.cjs');
|
|
14
|
+
var abi = require('../utils/viem/erc20/abi.cjs');
|
|
14
15
|
require('viem/accounts');
|
|
15
16
|
var getOrMapViemChain = require('../utils/viem/getOrMapViemChain/getOrMapViemChain.cjs');
|
|
16
17
|
|
|
@@ -19,11 +20,26 @@ class EthereumWallet extends walletConnectorCore.Wallet {
|
|
|
19
20
|
* Sends the native balance of the wallet to the given address.
|
|
20
21
|
* @param amount - The amount of balance to send (in ETH).
|
|
21
22
|
* @param toAddress - The address to send the balance to.
|
|
23
|
+
* @param token - The token to send (optional) — for example, an ERC20 token.
|
|
24
|
+
* @param token.address - The address of the token contract.
|
|
25
|
+
* @param token.decimals - The decimals of the token (defaults to 18).
|
|
22
26
|
* @returns The transaction hash of the sent transaction.
|
|
23
27
|
*/
|
|
24
28
|
sendBalance(_a) {
|
|
25
|
-
return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
29
|
+
return _tslib.__awaiter(this, arguments, void 0, function* ({ amount, toAddress, token, }) {
|
|
26
30
|
const provider = yield this.getWalletClient();
|
|
31
|
+
if (token && token.address) {
|
|
32
|
+
const erc20Contract = viem.getContract({
|
|
33
|
+
abi: abi.erc20Abi,
|
|
34
|
+
address: token.address,
|
|
35
|
+
client: provider,
|
|
36
|
+
});
|
|
37
|
+
const transfer = yield erc20Contract.write['transfer']([
|
|
38
|
+
toAddress,
|
|
39
|
+
viem.parseUnits(amount, token.decimals || 18),
|
|
40
|
+
]);
|
|
41
|
+
return transfer;
|
|
42
|
+
}
|
|
27
43
|
const transaction = {
|
|
28
44
|
account: this.address,
|
|
29
45
|
chain: getOrMapViemChain.getChain(yield provider.getChainId()),
|
|
@@ -6,11 +6,18 @@ export declare class EthereumWallet extends Wallet<EthereumWalletConnector> {
|
|
|
6
6
|
* Sends the native balance of the wallet to the given address.
|
|
7
7
|
* @param amount - The amount of balance to send (in ETH).
|
|
8
8
|
* @param toAddress - The address to send the balance to.
|
|
9
|
+
* @param token - The token to send (optional) — for example, an ERC20 token.
|
|
10
|
+
* @param token.address - The address of the token contract.
|
|
11
|
+
* @param token.decimals - The decimals of the token (defaults to 18).
|
|
9
12
|
* @returns The transaction hash of the sent transaction.
|
|
10
13
|
*/
|
|
11
|
-
sendBalance({ amount, toAddress, }: {
|
|
14
|
+
sendBalance({ amount, toAddress, token, }: {
|
|
12
15
|
amount: string;
|
|
13
16
|
toAddress: string;
|
|
17
|
+
token?: {
|
|
18
|
+
address: string;
|
|
19
|
+
decimals?: number;
|
|
20
|
+
};
|
|
14
21
|
}): Promise<`0x${string}`>;
|
|
15
22
|
/**
|
|
16
23
|
* Retrieves the public client.
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
-
import { parseEther, createWalletClient, custom } from 'viem';
|
|
3
|
+
import { getContract, parseUnits, parseEther, createWalletClient, custom } from 'viem';
|
|
4
4
|
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
5
5
|
import '@dynamic-labs/utils';
|
|
6
6
|
import '../utils/logger.js';
|
|
7
7
|
import '../utils/viem/estimateL1Fee/opStack/estimateL1Fee.js';
|
|
8
8
|
import '../utils/viem/chainsMap/chainsMap.js';
|
|
9
9
|
import { interceptTransport } from '../utils/viem/interceptTransport/interceptTransport.js';
|
|
10
|
+
import { erc20Abi } from '../utils/viem/erc20/abi.js';
|
|
10
11
|
import 'viem/accounts';
|
|
11
12
|
import { getChain } from '../utils/viem/getOrMapViemChain/getOrMapViemChain.js';
|
|
12
13
|
|
|
@@ -15,11 +16,26 @@ class EthereumWallet extends Wallet {
|
|
|
15
16
|
* Sends the native balance of the wallet to the given address.
|
|
16
17
|
* @param amount - The amount of balance to send (in ETH).
|
|
17
18
|
* @param toAddress - The address to send the balance to.
|
|
19
|
+
* @param token - The token to send (optional) — for example, an ERC20 token.
|
|
20
|
+
* @param token.address - The address of the token contract.
|
|
21
|
+
* @param token.decimals - The decimals of the token (defaults to 18).
|
|
18
22
|
* @returns The transaction hash of the sent transaction.
|
|
19
23
|
*/
|
|
20
24
|
sendBalance(_a) {
|
|
21
|
-
return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, }) {
|
|
25
|
+
return __awaiter(this, arguments, void 0, function* ({ amount, toAddress, token, }) {
|
|
22
26
|
const provider = yield this.getWalletClient();
|
|
27
|
+
if (token && token.address) {
|
|
28
|
+
const erc20Contract = getContract({
|
|
29
|
+
abi: erc20Abi,
|
|
30
|
+
address: token.address,
|
|
31
|
+
client: provider,
|
|
32
|
+
});
|
|
33
|
+
const transfer = yield erc20Contract.write['transfer']([
|
|
34
|
+
toAddress,
|
|
35
|
+
parseUnits(amount, token.decimals || 18),
|
|
36
|
+
]);
|
|
37
|
+
return transfer;
|
|
38
|
+
}
|
|
23
39
|
const transaction = {
|
|
24
40
|
account: this.address,
|
|
25
41
|
chain: getChain(yield provider.getChainId()),
|