@dynamic-labs/ethereum-aa 4.11.1 → 4.12.0
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 +25 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -9
- package/src/AccountAbstractionConnector.cjs +104 -0
- package/src/AccountAbstractionConnector.d.ts +69 -0
- package/src/AccountAbstractionConnector.js +100 -0
- package/src/ZKsyncConnector.cjs +526 -0
- package/src/ZKsyncConnector.d.ts +17228 -0
- package/src/ZKsyncConnector.js +522 -0
- package/src/ZeroDevConnector.cjs +15 -38
- package/src/ZeroDevConnector.d.ts +17 -7677
- package/src/ZeroDevConnector.js +17 -40
- package/src/index.cjs +11 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +10 -1
- package/src/utils/abi.cjs +88 -0
- package/src/utils/abi.d.ts +102 -0
- package/src/utils/abi.js +84 -0
- package/src/utils/index.d.ts +1 -0
- package/src/utils/isZKsyncConnector.cjs +8 -0
- package/src/utils/isZKsyncConnector.d.ts +3 -0
- package/src/utils/isZKsyncConnector.js +4 -0
- package/src/utils/zksync/deployment.cjs +97 -0
- package/src/utils/zksync/deployment.d.ts +37 -0
- package/src/utils/zksync/deployment.js +91 -0
- package/src/utils/zksync/getSalt.cjs +10 -0
- package/src/utils/zksync/getSalt.d.ts +1 -0
- package/src/utils/zksync/getSalt.js +6 -0
- package/src/utils/zksync/index.d.ts +4 -0
- package/src/utils/zksync/network.cjs +17 -0
- package/src/utils/zksync/network.d.ts +2 -0
- package/src/utils/zksync/network.js +13 -0
- package/src/utils/zksync/passkeys.cjs +41 -0
- package/src/utils/zksync/passkeys.d.ts +9 -0
- package/src/utils/zksync/passkeys.js +37 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.12.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.11.2...v4.12.0) (2025-04-14)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* add sui sign transaction to waas-sui connector ([#8528](https://github.com/dynamic-labs/dynamic-auth/issues/8528)) ([7dfd806](https://github.com/dynamic-labs/dynamic-auth/commit/7dfd8063ac92d2ec6eb2de71a3ed2946a9f89fe3))
|
|
8
|
+
* implement zksync account abstraction connector ([#8318](https://github.com/dynamic-labs/dynamic-auth/issues/8318)) ([e80b42f](https://github.com/dynamic-labs/dynamic-auth/commit/e80b42f9067450348b0ff02c5b682653353cdcb9))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* only define primary wallet when it is done verifying ([#8521](https://github.com/dynamic-labs/dynamic-auth/issues/8521)) ([34f6058](https://github.com/dynamic-labs/dynamic-auth/commit/34f605817c91cc1b131b4de876609e231703f8b4))
|
|
14
|
+
|
|
15
|
+
### [4.11.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.11.1...v4.11.2) (2025-04-11)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* correctly expire nonce ([#8518](https://github.com/dynamic-labs/dynamic-auth/issues/8518)) ([14c4eb1](https://github.com/dynamic-labs/dynamic-auth/commit/14c4eb143b8a6debc91fb0cb6aafe8336b370927))
|
|
21
|
+
* profile aspect ratio ([#8510](https://github.com/dynamic-labs/dynamic-auth/issues/8510)) ([869615d](https://github.com/dynamic-labs/dynamic-auth/commit/869615d00144d2df5c61eaa5ab39700114739732))
|
|
22
|
+
* **react-native:** ensure secure storage items are saved sequentially ([#8512](https://github.com/dynamic-labs/dynamic-auth/issues/8512)) ([53e2f7f](https://github.com/dynamic-labs/dynamic-auth/commit/53e2f7f47ce3ae79c781fcd3b9a446a0edbf4246))
|
|
23
|
+
* **react-native:** reload react-native webview when it is unmounted by OS ([#8477](https://github.com/dynamic-labs/dynamic-auth/issues/8477)) ([09e20a4](https://github.com/dynamic-labs/dynamic-auth/commit/09e20a418afd592fa31dffd7645729e0e77a8b3d))
|
|
24
|
+
* **react-native:** sync state with client when SDK fully loaded ([#8476](https://github.com/dynamic-labs/dynamic-auth/issues/8476)) ([bae8814](https://github.com/dynamic-labs/dynamic-auth/commit/bae88141e7d74e1ff453ee33ee16316c18e803d1))
|
|
25
|
+
* wallet standard wallets not sending SOL ([#8515](https://github.com/dynamic-labs/dynamic-auth/issues/8515)) ([0db973a](https://github.com/dynamic-labs/dynamic-auth/commit/0db973aceb5dc05cda142ceffcc925f9523a452d))
|
|
26
|
+
|
|
2
27
|
### [4.11.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.11.0...v4.11.1) (2025-04-09)
|
|
3
28
|
|
|
4
29
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/ethereum-aa",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.12.0",
|
|
4
4
|
"description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,17 +18,18 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
21
|
+
"@dynamic-labs/sdk-api-core": "0.0.658",
|
|
22
22
|
"@zerodev/ecdsa-validator": "5.4.4",
|
|
23
23
|
"@zerodev/multi-chain-ecdsa-validator": "5.4.3",
|
|
24
24
|
"@zerodev/sdk": "5.4.26",
|
|
25
|
-
"
|
|
26
|
-
"@dynamic-labs/
|
|
27
|
-
"@dynamic-labs/
|
|
28
|
-
"@dynamic-labs/
|
|
29
|
-
"@dynamic-labs/
|
|
30
|
-
"@dynamic-labs/
|
|
31
|
-
"@dynamic-labs/wallet-
|
|
25
|
+
"zksync-sso": "0.0.0-beta.14",
|
|
26
|
+
"@dynamic-labs/assert-package-version": "4.12.0",
|
|
27
|
+
"@dynamic-labs/ethereum-core": "4.12.0",
|
|
28
|
+
"@dynamic-labs/logger": "4.12.0",
|
|
29
|
+
"@dynamic-labs/types": "4.12.0",
|
|
30
|
+
"@dynamic-labs/utils": "4.12.0",
|
|
31
|
+
"@dynamic-labs/wallet-book": "4.12.0",
|
|
32
|
+
"@dynamic-labs/wallet-connector-core": "4.12.0"
|
|
32
33
|
},
|
|
33
34
|
"peerDependencies": {
|
|
34
35
|
"viem": "^2.21.55"
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../_virtual/_tslib.cjs');
|
|
7
|
+
var viem = require('viem');
|
|
8
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
+
var utils = require('@dynamic-labs/utils');
|
|
10
|
+
var ethereumCore = require('@dynamic-labs/ethereum-core');
|
|
11
|
+
|
|
12
|
+
class AccountAbstractionConnector extends walletConnectorCore.WalletConnectorBase {
|
|
13
|
+
constructor(opts) {
|
|
14
|
+
super({ walletBook: opts.walletBook });
|
|
15
|
+
this._isGasSponsorshipDisabled = false;
|
|
16
|
+
this.evmNetworks = [];
|
|
17
|
+
this.ChainWallet = ethereumCore.EthereumWallet;
|
|
18
|
+
this.isEmbeddedWallet = true;
|
|
19
|
+
this.connectedChain = 'EVM';
|
|
20
|
+
this.supportedChains = ['ETH', 'EVM'];
|
|
21
|
+
this._walletUiUtils = opts.walletUiUtils;
|
|
22
|
+
this.evmNetworks = opts.evmNetworks;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets the EOA connector associated with this account abstraction wallet
|
|
26
|
+
* @deprecated Use getEOAConnector with a specific smart contract wallet address instead
|
|
27
|
+
*/
|
|
28
|
+
getEOAConnector() {
|
|
29
|
+
return this.eoaConnector;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Disables gas sponsorship for the next transaction
|
|
33
|
+
*/
|
|
34
|
+
disableGasSponsorshipOnce() {
|
|
35
|
+
this._isGasSponsorshipDisabled = true;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Protected method to check if gas sponsorship is disabled
|
|
39
|
+
*/
|
|
40
|
+
isGasSponsorshipDisabled() {
|
|
41
|
+
return this._isGasSponsorshipDisabled;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Gets the enabled networks
|
|
45
|
+
*/
|
|
46
|
+
getEnabledNetworks() {
|
|
47
|
+
return this.evmNetworks;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Gets the signer for the current wallet
|
|
51
|
+
*/
|
|
52
|
+
getSigner() {
|
|
53
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
return this.getWalletClient();
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Gets the balance for an address
|
|
59
|
+
*/
|
|
60
|
+
getBalance(address) {
|
|
61
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
const publicClient = yield this.getPublicClient();
|
|
63
|
+
if (!publicClient) {
|
|
64
|
+
throw new utils.DynamicError('No public client available');
|
|
65
|
+
}
|
|
66
|
+
const balance = yield publicClient.getBalance({ address });
|
|
67
|
+
return viem.formatEther(balance);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Validates that the expected wallet is active
|
|
72
|
+
*/
|
|
73
|
+
validateActiveWallet(expectedAddress) {
|
|
74
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
75
|
+
const currentAddress = yield this.getAddress();
|
|
76
|
+
if ((currentAddress === null || currentAddress === void 0 ? void 0 : currentAddress.toLowerCase()) !== expectedAddress.toLowerCase()) {
|
|
77
|
+
throw new utils.DynamicError('Invalid active wallet');
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
createUiTransaction(from) {
|
|
82
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
83
|
+
yield this.validateActiveWallet(from);
|
|
84
|
+
const walletClient = this.getWalletClient();
|
|
85
|
+
const publicClient = yield this.getPublicClient();
|
|
86
|
+
if (!publicClient || !walletClient) {
|
|
87
|
+
throw new utils.DynamicError('No public client available');
|
|
88
|
+
}
|
|
89
|
+
return ethereumCore.createViemUiTransaction({
|
|
90
|
+
from,
|
|
91
|
+
publicClient: publicClient,
|
|
92
|
+
walletClient: walletClient,
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
getBlockExplorerUrlsForCurrentNetwork() {
|
|
97
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
return (_b = (_a = this.eoaConnector) === null || _a === void 0 ? void 0 : _a.getBlockExplorerUrlsForCurrentNetwork()) !== null && _b !== void 0 ? _b : [];
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
exports.AccountAbstractionConnector = AccountAbstractionConnector;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Chain, InternalWalletConnector, WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
2
|
+
import { EthereumWallet } from '@dynamic-labs/ethereum-core';
|
|
3
|
+
import { IUITransaction, WalletUiUtils, GenericNetwork } from '@dynamic-labs/types';
|
|
4
|
+
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
5
|
+
import { SmartWalletProperties } from '@dynamic-labs/sdk-api-core';
|
|
6
|
+
export type AccountAbstractionConnectorProps = {
|
|
7
|
+
walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
8
|
+
walletBook: WalletBookSchema;
|
|
9
|
+
evmNetworks: GenericNetwork[];
|
|
10
|
+
};
|
|
11
|
+
export declare abstract class AccountAbstractionConnector extends WalletConnectorBase<typeof EthereumWallet> {
|
|
12
|
+
abstract eoaConnector: InternalWalletConnector | undefined;
|
|
13
|
+
abstract eoaAddress: string | undefined;
|
|
14
|
+
protected _walletUiUtils: WalletUiUtils<InternalWalletConnector>;
|
|
15
|
+
private _isGasSponsorshipDisabled;
|
|
16
|
+
protected evmNetworks: GenericNetwork[];
|
|
17
|
+
ChainWallet: typeof EthereumWallet;
|
|
18
|
+
isEmbeddedWallet: boolean;
|
|
19
|
+
connectedChain: Chain;
|
|
20
|
+
supportedChains: Chain[];
|
|
21
|
+
constructor(opts: AccountAbstractionConnectorProps);
|
|
22
|
+
/**
|
|
23
|
+
* Gets the EOA connector associated with this account abstraction wallet
|
|
24
|
+
* @deprecated Use getEOAConnector with a specific smart contract wallet address instead
|
|
25
|
+
*/
|
|
26
|
+
getEOAConnector(): InternalWalletConnector | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* Disables gas sponsorship for the next transaction
|
|
29
|
+
*/
|
|
30
|
+
disableGasSponsorshipOnce(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Protected method to check if gas sponsorship is disabled
|
|
33
|
+
*/
|
|
34
|
+
protected isGasSponsorshipDisabled(): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Gets the enabled networks
|
|
37
|
+
*/
|
|
38
|
+
getEnabledNetworks(): GenericNetwork[];
|
|
39
|
+
/**
|
|
40
|
+
* Gets the signer for the current wallet
|
|
41
|
+
*/
|
|
42
|
+
getSigner(): Promise<unknown>;
|
|
43
|
+
/**
|
|
44
|
+
* Gets the balance for an address
|
|
45
|
+
*/
|
|
46
|
+
getBalance(address: string): Promise<string | undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* Validates that the expected wallet is active
|
|
49
|
+
*/
|
|
50
|
+
validateActiveWallet(expectedAddress: string): Promise<void>;
|
|
51
|
+
abstract canSponsorTransactionGas(transaction: {
|
|
52
|
+
from: string;
|
|
53
|
+
to?: string;
|
|
54
|
+
value?: bigint;
|
|
55
|
+
data?: string;
|
|
56
|
+
}): Promise<boolean>;
|
|
57
|
+
createUiTransaction(from: string): Promise<IUITransaction>;
|
|
58
|
+
getBlockExplorerUrlsForCurrentNetwork(): Promise<string[]>;
|
|
59
|
+
abstract getAccountAbstractionProvider<T>({ withSponsorship, }: {
|
|
60
|
+
withSponsorship: boolean;
|
|
61
|
+
}): Promise<T>;
|
|
62
|
+
abstract initialize(params: {
|
|
63
|
+
smartWalletAddress: string;
|
|
64
|
+
eoaAddress: string;
|
|
65
|
+
eoaConnector: InternalWalletConnector;
|
|
66
|
+
properties?: SmartWalletProperties;
|
|
67
|
+
shouldSetEoaConnector?: boolean;
|
|
68
|
+
}): Promise<void>;
|
|
69
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../_virtual/_tslib.js';
|
|
3
|
+
import { formatEther } from 'viem';
|
|
4
|
+
import { WalletConnectorBase } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { DynamicError } from '@dynamic-labs/utils';
|
|
6
|
+
import { EthereumWallet, createViemUiTransaction } from '@dynamic-labs/ethereum-core';
|
|
7
|
+
|
|
8
|
+
class AccountAbstractionConnector extends WalletConnectorBase {
|
|
9
|
+
constructor(opts) {
|
|
10
|
+
super({ walletBook: opts.walletBook });
|
|
11
|
+
this._isGasSponsorshipDisabled = false;
|
|
12
|
+
this.evmNetworks = [];
|
|
13
|
+
this.ChainWallet = EthereumWallet;
|
|
14
|
+
this.isEmbeddedWallet = true;
|
|
15
|
+
this.connectedChain = 'EVM';
|
|
16
|
+
this.supportedChains = ['ETH', 'EVM'];
|
|
17
|
+
this._walletUiUtils = opts.walletUiUtils;
|
|
18
|
+
this.evmNetworks = opts.evmNetworks;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Gets the EOA connector associated with this account abstraction wallet
|
|
22
|
+
* @deprecated Use getEOAConnector with a specific smart contract wallet address instead
|
|
23
|
+
*/
|
|
24
|
+
getEOAConnector() {
|
|
25
|
+
return this.eoaConnector;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Disables gas sponsorship for the next transaction
|
|
29
|
+
*/
|
|
30
|
+
disableGasSponsorshipOnce() {
|
|
31
|
+
this._isGasSponsorshipDisabled = true;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Protected method to check if gas sponsorship is disabled
|
|
35
|
+
*/
|
|
36
|
+
isGasSponsorshipDisabled() {
|
|
37
|
+
return this._isGasSponsorshipDisabled;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Gets the enabled networks
|
|
41
|
+
*/
|
|
42
|
+
getEnabledNetworks() {
|
|
43
|
+
return this.evmNetworks;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Gets the signer for the current wallet
|
|
47
|
+
*/
|
|
48
|
+
getSigner() {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
return this.getWalletClient();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Gets the balance for an address
|
|
55
|
+
*/
|
|
56
|
+
getBalance(address) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const publicClient = yield this.getPublicClient();
|
|
59
|
+
if (!publicClient) {
|
|
60
|
+
throw new DynamicError('No public client available');
|
|
61
|
+
}
|
|
62
|
+
const balance = yield publicClient.getBalance({ address });
|
|
63
|
+
return formatEther(balance);
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Validates that the expected wallet is active
|
|
68
|
+
*/
|
|
69
|
+
validateActiveWallet(expectedAddress) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const currentAddress = yield this.getAddress();
|
|
72
|
+
if ((currentAddress === null || currentAddress === void 0 ? void 0 : currentAddress.toLowerCase()) !== expectedAddress.toLowerCase()) {
|
|
73
|
+
throw new DynamicError('Invalid active wallet');
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
createUiTransaction(from) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
yield this.validateActiveWallet(from);
|
|
80
|
+
const walletClient = this.getWalletClient();
|
|
81
|
+
const publicClient = yield this.getPublicClient();
|
|
82
|
+
if (!publicClient || !walletClient) {
|
|
83
|
+
throw new DynamicError('No public client available');
|
|
84
|
+
}
|
|
85
|
+
return createViemUiTransaction({
|
|
86
|
+
from,
|
|
87
|
+
publicClient: publicClient,
|
|
88
|
+
walletClient: walletClient,
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
getBlockExplorerUrlsForCurrentNetwork() {
|
|
93
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
+
var _a, _b;
|
|
95
|
+
return (_b = (_a = this.eoaConnector) === null || _a === void 0 ? void 0 : _a.getBlockExplorerUrlsForCurrentNetwork()) !== null && _b !== void 0 ? _b : [];
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { AccountAbstractionConnector };
|