@dynamic-labs/ethereum-aa 4.11.2 → 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 +13 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +10 -9
- package/src/AccountAbstractionConnector.cjs +29 -0
- package/src/AccountAbstractionConnector.d.ts +6 -2
- package/src/AccountAbstractionConnector.js +30 -1
- package/src/ZKsyncConnector.cjs +526 -0
- package/src/ZKsyncConnector.d.ts +17228 -0
- package/src/ZKsyncConnector.js +522 -0
- package/src/ZeroDevConnector.cjs +1 -25
- package/src/ZeroDevConnector.d.ts +2 -7662
- package/src/ZeroDevConnector.js +2 -26
- 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
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var viem = require('viem');
|
|
7
|
+
|
|
8
|
+
const getSalt = (saltText = 'DynamicLabs') => `0x${Buffer.from(viem.toBytes(saltText, { size: 32 })).toString('hex')}`;
|
|
9
|
+
|
|
10
|
+
exports.getSalt = getSalt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getSalt: (saltText?: string) => `0x${string}`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
+
|
|
8
|
+
const ensureEoaConnectorNetwork = (eoaConnector, chainId) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
9
|
+
const eoaNetwork = yield eoaConnector.getNetwork();
|
|
10
|
+
if (Number(eoaNetwork) !== chainId) {
|
|
11
|
+
yield eoaConnector.switchNetwork({
|
|
12
|
+
networkChainId: chainId,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
exports.ensureEoaConnectorNetwork = ensureEoaConnectorNetwork;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
|
|
4
|
+
const ensureEoaConnectorNetwork = (eoaConnector, chainId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5
|
+
const eoaNetwork = yield eoaConnector.getNetwork();
|
|
6
|
+
if (Number(eoaNetwork) !== chainId) {
|
|
7
|
+
yield eoaConnector.switchNetwork({
|
|
8
|
+
networkChainId: chainId,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export { ensureEoaConnectorNetwork };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
+
var utils$1 = require('zksync-sso/utils');
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Retrieves and encodes passkey module data for smart account deployment
|
|
12
|
+
* @returns Encoded passkey module data as a hex string
|
|
13
|
+
* @throws {Error} If credential public key or ID is not found
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
const getEncodedPasskeyModuleData = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ passkeyAddress, }) {
|
|
17
|
+
if (!passkeyAddress) {
|
|
18
|
+
throw new Error('Passkey address is not initialized');
|
|
19
|
+
}
|
|
20
|
+
const storedCredentialPublicKey = utils.StorageService.getItem('credentialPublicKey');
|
|
21
|
+
if (!storedCredentialPublicKey) {
|
|
22
|
+
throw new Error('Credential public key not found');
|
|
23
|
+
}
|
|
24
|
+
const credentialPublicKey = new Uint8Array(Object.values(storedCredentialPublicKey));
|
|
25
|
+
const credentialId = utils.StorageService.getItem('credentialId');
|
|
26
|
+
if (!credentialId) {
|
|
27
|
+
throw new Error('Credential ID not found');
|
|
28
|
+
}
|
|
29
|
+
const passkeyPublicKey = utils$1.getPublicKeyBytesFromPasskeySignature(credentialPublicKey);
|
|
30
|
+
const encodedPasskeyParameters = utils$1.encodePasskeyModuleParameters({
|
|
31
|
+
credentialId: credentialId,
|
|
32
|
+
expectedOrigin: window.location.origin,
|
|
33
|
+
passkeyPublicKey,
|
|
34
|
+
});
|
|
35
|
+
return utils$1.encodeModuleData({
|
|
36
|
+
address: passkeyAddress,
|
|
37
|
+
parameters: encodedPasskeyParameters,
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
exports.getEncodedPasskeyModuleData = getEncodedPasskeyModuleData;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Retrieves and encodes passkey module data for smart account deployment
|
|
3
|
+
* @returns Encoded passkey module data as a hex string
|
|
4
|
+
* @throws {Error} If credential public key or ID is not found
|
|
5
|
+
* @private
|
|
6
|
+
*/
|
|
7
|
+
export declare const getEncodedPasskeyModuleData: ({ passkeyAddress, }: {
|
|
8
|
+
passkeyAddress?: `0x${string}`;
|
|
9
|
+
}) => Promise<`0x${string}`>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
import { getPublicKeyBytesFromPasskeySignature, encodePasskeyModuleParameters, encodeModuleData } from 'zksync-sso/utils';
|
|
4
|
+
import { StorageService } from '@dynamic-labs/utils';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves and encodes passkey module data for smart account deployment
|
|
8
|
+
* @returns Encoded passkey module data as a hex string
|
|
9
|
+
* @throws {Error} If credential public key or ID is not found
|
|
10
|
+
* @private
|
|
11
|
+
*/
|
|
12
|
+
const getEncodedPasskeyModuleData = (_a) => __awaiter(void 0, [_a], void 0, function* ({ passkeyAddress, }) {
|
|
13
|
+
if (!passkeyAddress) {
|
|
14
|
+
throw new Error('Passkey address is not initialized');
|
|
15
|
+
}
|
|
16
|
+
const storedCredentialPublicKey = StorageService.getItem('credentialPublicKey');
|
|
17
|
+
if (!storedCredentialPublicKey) {
|
|
18
|
+
throw new Error('Credential public key not found');
|
|
19
|
+
}
|
|
20
|
+
const credentialPublicKey = new Uint8Array(Object.values(storedCredentialPublicKey));
|
|
21
|
+
const credentialId = StorageService.getItem('credentialId');
|
|
22
|
+
if (!credentialId) {
|
|
23
|
+
throw new Error('Credential ID not found');
|
|
24
|
+
}
|
|
25
|
+
const passkeyPublicKey = getPublicKeyBytesFromPasskeySignature(credentialPublicKey);
|
|
26
|
+
const encodedPasskeyParameters = encodePasskeyModuleParameters({
|
|
27
|
+
credentialId: credentialId,
|
|
28
|
+
expectedOrigin: window.location.origin,
|
|
29
|
+
passkeyPublicKey,
|
|
30
|
+
});
|
|
31
|
+
return encodeModuleData({
|
|
32
|
+
address: passkeyAddress,
|
|
33
|
+
parameters: encodedPasskeyParameters,
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { getEncodedPasskeyModuleData };
|