@dynamic-labs/global-wallet-client 4.34.0 → 4.35.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 +12 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +9 -9
- package/src/lib/functions/addWebWalletOpenerService/addWebWalletOpenerService.cjs +1 -0
- package/src/lib/functions/addWebWalletOpenerService/addWebWalletOpenerService.js +1 -0
- package/src/lib/functions/addWebWalletOpenerService/methods/popupWalletOpener.cjs +2 -2
- package/src/lib/functions/addWebWalletOpenerService/methods/popupWalletOpener.d.ts +3 -1
- package/src/lib/functions/addWebWalletOpenerService/methods/popupWalletOpener.js +2 -2
- package/src/lib/functions/addWebWalletOpenerService/methods/utils/decodeResponse.cjs +16 -3
- package/src/lib/functions/addWebWalletOpenerService/methods/utils/decodeResponse.d.ts +2 -1
- package/src/lib/functions/addWebWalletOpenerService/methods/utils/decodeResponse.js +16 -3
- package/src/lib/functions/connect/connect.cjs +2 -2
- package/src/lib/functions/connect/connect.js +2 -2
- package/src/lib/functions/mergeAndEncryptParams/mergeAndEncryptParams.cjs +3 -1
- package/src/lib/functions/mergeAndEncryptParams/mergeAndEncryptParams.js +3 -1
- package/src/lib/functions/setInitialConnectionState/setInitialConnectionState.cjs +7 -1
- package/src/lib/functions/setInitialConnectionState/setInitialConnectionState.js +7 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.35.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.34.0...v4.35.0) (2025-10-02)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* update Bitget wallet logo with new SVG design ([#9615](https://github.com/dynamic-labs/dynamic-auth/issues/9615)) ([3b84f92](https://github.com/dynamic-labs/dynamic-auth/commit/3b84f9237d9a85ca334576aa9e986c73c7fa5973))
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* connecting global wallets via wallet connect ([#9608](https://github.com/dynamic-labs/dynamic-auth/issues/9608)) ([7b7767d](https://github.com/dynamic-labs/dynamic-auth/commit/7b7767dc322756edfe51f935155b0af2ebc52b6e))
|
|
13
|
+
|
|
2
14
|
## [4.34.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.33.0...v4.34.0) (2025-09-30)
|
|
3
15
|
|
|
4
16
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/global-wallet-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.35.0",
|
|
4
4
|
"description": "Core package for building Dynamic's Global Wallet",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
},
|
|
64
64
|
"homepage": "https://www.dynamic.xyz/",
|
|
65
65
|
"dependencies": {
|
|
66
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
67
|
-
"@dynamic-labs/ethereum-aa-zksync": "4.
|
|
68
|
-
"@dynamic-labs/logger": "4.
|
|
69
|
-
"@dynamic-labs/message-transport": "4.
|
|
70
|
-
"@dynamic-labs/store": "4.
|
|
71
|
-
"@dynamic-labs/types": "4.
|
|
72
|
-
"@dynamic-labs/utils": "4.
|
|
66
|
+
"@dynamic-labs/assert-package-version": "4.35.0",
|
|
67
|
+
"@dynamic-labs/ethereum-aa-zksync": "4.35.0",
|
|
68
|
+
"@dynamic-labs/logger": "4.35.0",
|
|
69
|
+
"@dynamic-labs/message-transport": "4.35.0",
|
|
70
|
+
"@dynamic-labs/store": "4.35.0",
|
|
71
|
+
"@dynamic-labs/types": "4.35.0",
|
|
72
|
+
"@dynamic-labs/utils": "4.35.0",
|
|
73
73
|
"eventemitter3": "5.0.1"
|
|
74
74
|
},
|
|
75
75
|
"peerDependencies": {
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"zksync-sso": "0.2.0",
|
|
82
82
|
"@wallet-standard/wallet": "^1.1.0",
|
|
83
83
|
"@zerodev/sdk": "5.4.36",
|
|
84
|
-
"@dynamic-labs/ethereum-aa": "4.
|
|
84
|
+
"@dynamic-labs/ethereum-aa": "4.35.0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependenciesMeta": {
|
|
87
87
|
"viem": {
|
|
@@ -27,6 +27,7 @@ const addWebWalletOpenerService = (client, globalWindow = global.window) => {
|
|
|
27
27
|
const popupWidth = (_b = popupInfo.width) !== null && _b !== void 0 ? _b : 420;
|
|
28
28
|
const postfixUrlWithVersion = (_c = developmentOptions.postfixPopupUrlWithVersion) !== null && _c !== void 0 ? _c : true;
|
|
29
29
|
const popupWalletOpener$1 = popupWalletOpener.createPopupWalletOpener({
|
|
30
|
+
client,
|
|
30
31
|
environmentId,
|
|
31
32
|
eventEmitter,
|
|
32
33
|
globalWindow,
|
|
@@ -23,6 +23,7 @@ const addWebWalletOpenerService = (client, globalWindow = global.window) => {
|
|
|
23
23
|
const popupWidth = (_b = popupInfo.width) !== null && _b !== void 0 ? _b : 420;
|
|
24
24
|
const postfixUrlWithVersion = (_c = developmentOptions.postfixPopupUrlWithVersion) !== null && _c !== void 0 ? _c : true;
|
|
25
25
|
const popupWalletOpener = createPopupWalletOpener({
|
|
26
|
+
client,
|
|
26
27
|
environmentId,
|
|
27
28
|
eventEmitter,
|
|
28
29
|
globalWindow,
|
|
@@ -15,7 +15,7 @@ var decodeResponse = require('./utils/decodeResponse.cjs');
|
|
|
15
15
|
var handlePromiseResponse = require('./utils/handlePromiseResponse.cjs');
|
|
16
16
|
|
|
17
17
|
const popupActionTimeout = 1000;
|
|
18
|
-
const createPopupWalletOpener = ({ popupInfo, popupHeight, popupWidth, environmentId, globalWindow, postfixUrlWithVersion, logger, eventEmitter, popupState, }) => (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ args, name, connection, }) {
|
|
18
|
+
const createPopupWalletOpener = ({ client, popupInfo, popupHeight, popupWidth, environmentId, globalWindow, postfixUrlWithVersion, logger, eventEmitter, popupState, }) => (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ args, name, connection, }) {
|
|
19
19
|
var _b;
|
|
20
20
|
// Used as a unique identifier for the action
|
|
21
21
|
const actionId = new Date().getTime();
|
|
@@ -66,7 +66,7 @@ const createPopupWalletOpener = ({ popupInfo, popupHeight, popupWidth, environme
|
|
|
66
66
|
throw new Error('Failed to open popup');
|
|
67
67
|
}
|
|
68
68
|
waitForResponse.waitForResponse({
|
|
69
|
-
decode: (data) => _tslib.__awaiter(void 0, void 0, void 0, function* () { return decodeResponse.decodeResponse(connection, data); }),
|
|
69
|
+
decode: (data) => _tslib.__awaiter(void 0, void 0, void 0, function* () { return decodeResponse.decodeResponse(connection, data, client); }),
|
|
70
70
|
onError: (error) => resultDeferredPromise.reject(error),
|
|
71
71
|
onResponse: (response) => resultDeferredPromise.resolve(response.data),
|
|
72
72
|
url: finalUrl.toString(),
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { WalletOpener } from '../../createWalletOpener';
|
|
2
|
+
import { GlobalWalletClient } from '../../../client/createGlobalWalletClient';
|
|
2
3
|
interface PopupOpenerDeps {
|
|
4
|
+
client: GlobalWalletClient;
|
|
3
5
|
popupInfo: any;
|
|
4
6
|
popupHeight: number;
|
|
5
7
|
popupWidth: number;
|
|
@@ -14,5 +16,5 @@ interface PopupOpenerDeps {
|
|
|
14
16
|
lastActionId: number | null;
|
|
15
17
|
};
|
|
16
18
|
}
|
|
17
|
-
export declare const createPopupWalletOpener: ({ popupInfo, popupHeight, popupWidth, environmentId, globalWindow, postfixUrlWithVersion, logger, eventEmitter, popupState, }: PopupOpenerDeps) => WalletOpener;
|
|
19
|
+
export declare const createPopupWalletOpener: ({ client, popupInfo, popupHeight, popupWidth, environmentId, globalWindow, postfixUrlWithVersion, logger, eventEmitter, popupState, }: PopupOpenerDeps) => WalletOpener;
|
|
18
20
|
export {};
|
|
@@ -11,7 +11,7 @@ import { decodeResponse } from './utils/decodeResponse.js';
|
|
|
11
11
|
import { handlePromiseResponse } from './utils/handlePromiseResponse.js';
|
|
12
12
|
|
|
13
13
|
const popupActionTimeout = 1000;
|
|
14
|
-
const createPopupWalletOpener = ({ popupInfo, popupHeight, popupWidth, environmentId, globalWindow, postfixUrlWithVersion, logger, eventEmitter, popupState, }) => (_a) => __awaiter(void 0, [_a], void 0, function* ({ args, name, connection, }) {
|
|
14
|
+
const createPopupWalletOpener = ({ client, popupInfo, popupHeight, popupWidth, environmentId, globalWindow, postfixUrlWithVersion, logger, eventEmitter, popupState, }) => (_a) => __awaiter(void 0, [_a], void 0, function* ({ args, name, connection, }) {
|
|
15
15
|
var _b;
|
|
16
16
|
// Used as a unique identifier for the action
|
|
17
17
|
const actionId = new Date().getTime();
|
|
@@ -62,7 +62,7 @@ const createPopupWalletOpener = ({ popupInfo, popupHeight, popupWidth, environme
|
|
|
62
62
|
throw new Error('Failed to open popup');
|
|
63
63
|
}
|
|
64
64
|
waitForResponse({
|
|
65
|
-
decode: (data) => __awaiter(void 0, void 0, void 0, function* () { return decodeResponse(connection, data); }),
|
|
65
|
+
decode: (data) => __awaiter(void 0, void 0, void 0, function* () { return decodeResponse(connection, data, client); }),
|
|
66
66
|
onError: (error) => resultDeferredPromise.reject(error),
|
|
67
67
|
onResponse: (response) => resultDeferredPromise.resolve(response.data),
|
|
68
68
|
url: finalUrl.toString(),
|
|
@@ -5,11 +5,24 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../../../../../_virtual/_tslib.cjs');
|
|
7
7
|
var utils = require('@dynamic-labs/utils');
|
|
8
|
+
require('eventemitter3');
|
|
9
|
+
require('@dynamic-labs/logger');
|
|
10
|
+
require('@dynamic-labs/store');
|
|
11
|
+
require('../../../../errors/DisconnectError.cjs');
|
|
12
|
+
require('../../../../constants/logger.cjs');
|
|
13
|
+
var getCore = require('../../../../client/getCore/getCore.cjs');
|
|
8
14
|
|
|
9
|
-
const decodeResponse = (connection, data) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
15
|
+
const decodeResponse = (connection, data, client) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
10
16
|
if (connection && utils.isEncryptedMessage(data)) {
|
|
11
|
-
const decryptedData = yield utils.decryptMessage(connection.sharedSecret, data.encryptedMessage, data.iv);
|
|
12
|
-
|
|
17
|
+
const decryptedData = yield utils.decryptMessage(connection.sharedSecret, data.encryptedMessage, data.iv, connection.nonce ? new TextEncoder().encode(connection.nonce) : undefined);
|
|
18
|
+
const decryptedDataParsed = JSON.parse(decryptedData);
|
|
19
|
+
// Store next nonce
|
|
20
|
+
if (decryptedDataParsed.nonce) {
|
|
21
|
+
getCore.getCore(client).store.setState({
|
|
22
|
+
connection: Object.assign(Object.assign({}, connection), { nonce: decryptedDataParsed.nonce }),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return decryptedDataParsed;
|
|
13
26
|
}
|
|
14
27
|
return data;
|
|
15
28
|
});
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { GlobalWalletConnection } from '@dynamic-labs/types';
|
|
2
|
-
|
|
2
|
+
import { GlobalWalletClient } from '../../../../client';
|
|
3
|
+
export declare const decodeResponse: (connection: GlobalWalletConnection | null, data: any, client: GlobalWalletClient) => Promise<any>;
|
|
@@ -1,11 +1,24 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../../../../../_virtual/_tslib.js';
|
|
3
3
|
import { isEncryptedMessage, decryptMessage } from '@dynamic-labs/utils';
|
|
4
|
+
import 'eventemitter3';
|
|
5
|
+
import '@dynamic-labs/logger';
|
|
6
|
+
import '@dynamic-labs/store';
|
|
7
|
+
import '../../../../errors/DisconnectError.js';
|
|
8
|
+
import '../../../../constants/logger.js';
|
|
9
|
+
import { getCore } from '../../../../client/getCore/getCore.js';
|
|
4
10
|
|
|
5
|
-
const decodeResponse = (connection, data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
11
|
+
const decodeResponse = (connection, data, client) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6
12
|
if (connection && isEncryptedMessage(data)) {
|
|
7
|
-
const decryptedData = yield decryptMessage(connection.sharedSecret, data.encryptedMessage, data.iv);
|
|
8
|
-
|
|
13
|
+
const decryptedData = yield decryptMessage(connection.sharedSecret, data.encryptedMessage, data.iv, connection.nonce ? new TextEncoder().encode(connection.nonce) : undefined);
|
|
14
|
+
const decryptedDataParsed = JSON.parse(decryptedData);
|
|
15
|
+
// Store next nonce
|
|
16
|
+
if (decryptedDataParsed.nonce) {
|
|
17
|
+
getCore(client).store.setState({
|
|
18
|
+
connection: Object.assign(Object.assign({}, connection), { nonce: decryptedDataParsed.nonce }),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return decryptedDataParsed;
|
|
9
22
|
}
|
|
10
23
|
return data;
|
|
11
24
|
});
|
|
@@ -43,12 +43,12 @@ const connect = (client) => _tslib.__awaiter(void 0, void 0, void 0, function* (
|
|
|
43
43
|
const { connectionId, encryptedMessage, expiresAt, iv, providerPublicKey } = data;
|
|
44
44
|
const sharedSecret = yield utils.deriveSharedSecret(keyPair.privateKey, yield utils.convertPublicKeyHexToCryptoKey(providerPublicKey));
|
|
45
45
|
const message = yield utils.decryptMessage(sharedSecret, encryptedMessage, iv);
|
|
46
|
-
const { ethereum, solana, wallets, settings } = JSON.parse(message);
|
|
46
|
+
const { ethereum, solana, wallets, settings, nonce } = JSON.parse(message);
|
|
47
47
|
setInitialConnectionState.setInitialConnectionState(client, {
|
|
48
48
|
connection: {
|
|
49
49
|
connectionId,
|
|
50
50
|
expiresAt,
|
|
51
|
-
|
|
51
|
+
nonce,
|
|
52
52
|
origin: window.location.origin,
|
|
53
53
|
sharedSecret,
|
|
54
54
|
},
|
|
@@ -39,12 +39,12 @@ const connect = (client) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
39
39
|
const { connectionId, encryptedMessage, expiresAt, iv, providerPublicKey } = data;
|
|
40
40
|
const sharedSecret = yield deriveSharedSecret(keyPair.privateKey, yield convertPublicKeyHexToCryptoKey(providerPublicKey));
|
|
41
41
|
const message = yield decryptMessage(sharedSecret, encryptedMessage, iv);
|
|
42
|
-
const { ethereum, solana, wallets, settings } = JSON.parse(message);
|
|
42
|
+
const { ethereum, solana, wallets, settings, nonce } = JSON.parse(message);
|
|
43
43
|
setInitialConnectionState(client, {
|
|
44
44
|
connection: {
|
|
45
45
|
connectionId,
|
|
46
46
|
expiresAt,
|
|
47
|
-
|
|
47
|
+
nonce,
|
|
48
48
|
origin: window.location.origin,
|
|
49
49
|
sharedSecret,
|
|
50
50
|
},
|
|
@@ -9,7 +9,9 @@ var mergeURLSearchParams = require('../mergeURLSearchParams/mergeURLSearchParams
|
|
|
9
9
|
|
|
10
10
|
const mergeAndEncryptParams = (url, params, activeConnection) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
11
11
|
if (activeConnection) {
|
|
12
|
-
const encryptedParams = yield utils.encryptMessage(activeConnection.sharedSecret, JSON.stringify(params)
|
|
12
|
+
const encryptedParams = yield utils.encryptMessage(activeConnection.sharedSecret, JSON.stringify(params), activeConnection.nonce
|
|
13
|
+
? new TextEncoder().encode(activeConnection.nonce)
|
|
14
|
+
: undefined);
|
|
13
15
|
mergeURLSearchParams.mergeURLSearchParams(url.searchParams, new URLSearchParams({
|
|
14
16
|
encrypted_message: encryptedParams.encryptedMessage,
|
|
15
17
|
iv: encryptedParams.iv,
|
|
@@ -5,7 +5,9 @@ import { mergeURLSearchParams } from '../mergeURLSearchParams/mergeURLSearchPara
|
|
|
5
5
|
|
|
6
6
|
const mergeAndEncryptParams = (url, params, activeConnection) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7
7
|
if (activeConnection) {
|
|
8
|
-
const encryptedParams = yield encryptMessage(activeConnection.sharedSecret, JSON.stringify(params)
|
|
8
|
+
const encryptedParams = yield encryptMessage(activeConnection.sharedSecret, JSON.stringify(params), activeConnection.nonce
|
|
9
|
+
? new TextEncoder().encode(activeConnection.nonce)
|
|
10
|
+
: undefined);
|
|
9
11
|
mergeURLSearchParams(url.searchParams, new URLSearchParams({
|
|
10
12
|
encrypted_message: encryptedParams.encryptedMessage,
|
|
11
13
|
iv: encryptedParams.iv,
|
|
@@ -26,7 +26,13 @@ const setInitialConnectionState = (client, { connection, ethereum, solana, walle
|
|
|
26
26
|
solana,
|
|
27
27
|
wallets,
|
|
28
28
|
});
|
|
29
|
-
core.store.setState({
|
|
29
|
+
core.store.setState({
|
|
30
|
+
connection,
|
|
31
|
+
ethereum,
|
|
32
|
+
settings,
|
|
33
|
+
solana,
|
|
34
|
+
wallets,
|
|
35
|
+
});
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
exports.setInitialConnectionState = setInitialConnectionState;
|
|
@@ -22,7 +22,13 @@ const setInitialConnectionState = (client, { connection, ethereum, solana, walle
|
|
|
22
22
|
solana,
|
|
23
23
|
wallets,
|
|
24
24
|
});
|
|
25
|
-
core.store.setState({
|
|
25
|
+
core.store.setState({
|
|
26
|
+
connection,
|
|
27
|
+
ethereum,
|
|
28
|
+
settings,
|
|
29
|
+
solana,
|
|
30
|
+
wallets,
|
|
31
|
+
});
|
|
26
32
|
};
|
|
27
33
|
|
|
28
34
|
export { setInitialConnectionState };
|