@dynamic-labs/global-wallet-client 4.20.3 → 4.20.4
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 +7 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -8
- package/src/lib/functions/createZksyncSession/createZksyncSession.cjs +9 -1
- package/src/lib/functions/createZksyncSession/createZksyncSession.d.ts +9 -1
- package/src/lib/functions/createZksyncSession/createZksyncSession.js +9 -1
- package/src/lib/functions/createZksyncSessionClient/createZksyncSessionClient.cjs +28 -0
- package/src/lib/functions/createZksyncSessionClient/createZksyncSessionClient.d.ts +3459 -0
- package/src/lib/functions/createZksyncSessionClient/createZksyncSessionClient.js +24 -0
- package/src/lib/functions/createZksyncSessionClient/index.d.ts +1 -0
- package/src/zksync.cjs +2 -0
- package/src/zksync.d.ts +1 -0
- package/src/zksync.js +1 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { parseSessionConfigJSON, createSessionClient } from '@dynamic-labs/ethereum-aa-zksync';
|
|
3
|
+
import { getWalletNetwork } from '../getWalletNetwork/getWalletNetwork.js';
|
|
4
|
+
import { isEthereumWallet } from '../isEthereumWallet/isEthereumWallet.js';
|
|
5
|
+
|
|
6
|
+
const isStringified = (config) => typeof config.expiresAt === 'string';
|
|
7
|
+
const createZksyncSessionClient = (wallet, { sessionKey, sessionKeyValidator, sessionConfig, }) => {
|
|
8
|
+
if (!isEthereumWallet(wallet)) {
|
|
9
|
+
throw new Error('Wallet is not an Ethereum wallet');
|
|
10
|
+
}
|
|
11
|
+
const config = isStringified(sessionConfig)
|
|
12
|
+
? parseSessionConfigJSON(sessionConfig)
|
|
13
|
+
: sessionConfig;
|
|
14
|
+
const chainId = getWalletNetwork(wallet);
|
|
15
|
+
return createSessionClient({
|
|
16
|
+
chainId,
|
|
17
|
+
sessionConfig: config,
|
|
18
|
+
sessionKey,
|
|
19
|
+
sessionKeyValidator,
|
|
20
|
+
smartAccountAddress: wallet.address,
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { createZksyncSessionClient };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './createZksyncSessionClient';
|
package/src/zksync.cjs
CHANGED
|
@@ -6,9 +6,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var createZksyncSession = require('./lib/functions/createZksyncSession/createZksyncSession.cjs');
|
|
7
7
|
var listZksyncSessions = require('./lib/functions/listZksyncSessions/listZksyncSessions.cjs');
|
|
8
8
|
var revokeZksyncSession = require('./lib/functions/revokeZksyncSession/revokeZksyncSession.cjs');
|
|
9
|
+
var createZksyncSessionClient = require('./lib/functions/createZksyncSessionClient/createZksyncSessionClient.cjs');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
12
13
|
exports.createZksyncSession = createZksyncSession.createZksyncSession;
|
|
13
14
|
exports.listZksyncSessions = listZksyncSessions.listZksyncSessions;
|
|
14
15
|
exports.revokeZksyncSession = revokeZksyncSession.revokeZksyncSession;
|
|
16
|
+
exports.createZksyncSessionClient = createZksyncSessionClient.createZksyncSessionClient;
|
package/src/zksync.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { createZksyncSession } from './lib/functions/createZksyncSession';
|
|
2
2
|
export { listZksyncSessions } from './lib/functions/listZksyncSessions';
|
|
3
3
|
export { revokeZksyncSession } from './lib/functions/revokeZksyncSession';
|
|
4
|
+
export { createZksyncSessionClient } from './lib/functions/createZksyncSessionClient';
|
package/src/zksync.js
CHANGED
|
@@ -2,3 +2,4 @@
|
|
|
2
2
|
export { createZksyncSession } from './lib/functions/createZksyncSession/createZksyncSession.js';
|
|
3
3
|
export { listZksyncSessions } from './lib/functions/listZksyncSessions/listZksyncSessions.js';
|
|
4
4
|
export { revokeZksyncSession } from './lib/functions/revokeZksyncSession/revokeZksyncSession.js';
|
|
5
|
+
export { createZksyncSessionClient } from './lib/functions/createZksyncSessionClient/createZksyncSessionClient.js';
|