@dynamic-labs/global-wallet-client 4.3.2 → 4.4.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 CHANGED
@@ -1,4 +1,13 @@
1
1
 
2
+ ## [4.4.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.3.2...v4.4.0) (2025-01-24)
3
+
4
+
5
+ ### Features
6
+
7
+ * 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))
8
+ * 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))
9
+ * 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))
10
+
2
11
  ### [4.3.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.3.1...v4.3.2) (2025-01-24)
3
12
 
4
13
  ### [4.3.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.3.0...v4.3.1) (2025-01-23)
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.3.2";
6
+ var version = "4.4.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.3.2";
2
+ var version = "4.4.0";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/global-wallet-client",
3
- "version": "4.3.2",
3
+ "version": "4.4.0",
4
4
  "description": "Core package for building Dynamic's Global Wallet",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -39,11 +39,11 @@
39
39
  },
40
40
  "homepage": "https://www.dynamic.xyz/",
41
41
  "dependencies": {
42
- "@dynamic-labs/assert-package-version": "4.3.2",
43
- "@dynamic-labs/logger": "4.3.2",
44
- "@dynamic-labs/store": "4.3.2",
45
- "@dynamic-labs/types": "4.3.2",
46
- "@dynamic-labs/utils": "4.3.2",
42
+ "@dynamic-labs/assert-package-version": "4.4.0",
43
+ "@dynamic-labs/logger": "4.4.0",
44
+ "@dynamic-labs/store": "4.4.0",
45
+ "@dynamic-labs/types": "4.4.0",
46
+ "@dynamic-labs/utils": "4.4.0",
47
47
  "eventemitter3": "5.0.1"
48
48
  },
49
49
  "peerDependencies": {
@@ -3,6 +3,7 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
+ var _package = require('../../package.cjs');
6
7
  var createConnectAction = require('./actions/connectAction/createConnectAction.cjs');
7
8
  var createPopupOpener = require('./functions/createPopupOpener/createPopupOpener.cjs');
8
9
  var createClientStore = require('./store/createClientStore.cjs');
@@ -10,11 +11,21 @@ var createClientEventEmitter = require('./functions/createClientEventEmitter/cre
10
11
  var createDisconnectAction = require('./actions/disconnectAction/createDisconnectAction.cjs');
11
12
  var createEthereumModule = require('./functions/createEthereumModule/createEthereumModule.cjs');
12
13
  var createSolanaModule = require('./functions/createSolanaModule/createSolanaModule.cjs');
14
+ var addVersionPostfixToUrl = require('./functions/addVersionPostfixToUrl/addVersionPostfixToUrl.cjs');
13
15
 
14
- const createGlobalWalletClient = ({ environmentId, popup: popupInfo, }) => {
16
+ const createGlobalWalletClient = ({ environmentId, popup: popupInfo, developmentOptions: { postfixPopupUrlWithVersion = true } = {}, }) => {
15
17
  const eventEmitter = createClientEventEmitter.createClientEventEmitter();
16
18
  const store = createClientStore.createClientStore();
17
- const openPopup = createPopupOpener.createPopupOpener({ environmentId, popupInfo, store });
19
+ const popupUrl = postfixPopupUrlWithVersion
20
+ ? addVersionPostfixToUrl.addVersionPostfixToUrl(_package.version, popupInfo.url)
21
+ : popupInfo.url;
22
+ const openPopup = createPopupOpener.createPopupOpener({
23
+ environmentId,
24
+ popupHeight: popupInfo.height,
25
+ popupUrl,
26
+ popupWidth: popupInfo.width,
27
+ store,
28
+ });
18
29
  const connect = createConnectAction.createConnectAction({
19
30
  onConnect: () => eventEmitter.emit('connect'),
20
31
  openPopup,
@@ -1,9 +1,10 @@
1
- import { PopupInfo } from './types';
1
+ import { DevelopmentOptions, PopupInfo } from './types';
2
2
  export type CreateGlobalWalletClientProps = {
3
3
  environmentId: string;
4
4
  popup: PopupInfo;
5
+ developmentOptions?: DevelopmentOptions;
5
6
  };
6
- export declare const createGlobalWalletClient: ({ environmentId, popup: popupInfo, }: CreateGlobalWalletClientProps) => {
7
+ export declare const createGlobalWalletClient: ({ environmentId, popup: popupInfo, developmentOptions: { postfixPopupUrlWithVersion }, }: CreateGlobalWalletClientProps) => {
7
8
  connect: ({ chain }: import("./types").ConnectArgs) => Promise<import("dist/packages/types/src").BaseWallet>;
8
9
  disconnect: () => void;
9
10
  ethereum: {
@@ -1,4 +1,5 @@
1
1
  'use client'
2
+ import { version } from '../../package.js';
2
3
  import { createConnectAction } from './actions/connectAction/createConnectAction.js';
3
4
  import { createPopupOpener } from './functions/createPopupOpener/createPopupOpener.js';
4
5
  import { createClientStore } from './store/createClientStore.js';
@@ -6,11 +7,21 @@ import { createClientEventEmitter } from './functions/createClientEventEmitter/c
6
7
  import { createDisconnectAction } from './actions/disconnectAction/createDisconnectAction.js';
7
8
  import { createEthereumModule } from './functions/createEthereumModule/createEthereumModule.js';
8
9
  import { createSolanaModule } from './functions/createSolanaModule/createSolanaModule.js';
10
+ import { addVersionPostfixToUrl } from './functions/addVersionPostfixToUrl/addVersionPostfixToUrl.js';
9
11
 
10
- const createGlobalWalletClient = ({ environmentId, popup: popupInfo, }) => {
12
+ const createGlobalWalletClient = ({ environmentId, popup: popupInfo, developmentOptions: { postfixPopupUrlWithVersion = true } = {}, }) => {
11
13
  const eventEmitter = createClientEventEmitter();
12
14
  const store = createClientStore();
13
- const openPopup = createPopupOpener({ environmentId, popupInfo, store });
15
+ const popupUrl = postfixPopupUrlWithVersion
16
+ ? addVersionPostfixToUrl(version, popupInfo.url)
17
+ : popupInfo.url;
18
+ const openPopup = createPopupOpener({
19
+ environmentId,
20
+ popupHeight: popupInfo.height,
21
+ popupUrl,
22
+ popupWidth: popupInfo.width,
23
+ store,
24
+ });
14
25
  const connect = createConnectAction({
15
26
  onConnect: () => eventEmitter.emit('connect'),
16
27
  openPopup,
@@ -0,0 +1,24 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ /**
7
+ * Appends a version string to the end of a URL's pathname
8
+ * @param version - The version string to append to the URL
9
+ * @param url - The base URL to modify
10
+ * @returns The modified URL with the version appended to the pathname
11
+ * @example
12
+ * addVersionPostfixToUrl('v1', 'https://api.example.com/path')
13
+ * // Returns: 'https://api.example.com/path/v1'
14
+ */
15
+ const addVersionPostfixToUrl = (version, url) => {
16
+ const urlObj = new URL(url);
17
+ urlObj.pathname = [
18
+ ...urlObj.pathname.split('/').filter(Boolean),
19
+ version,
20
+ ].join('/');
21
+ return urlObj.toString();
22
+ };
23
+
24
+ exports.addVersionPostfixToUrl = addVersionPostfixToUrl;
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Appends a version string to the end of a URL's pathname
3
+ * @param version - The version string to append to the URL
4
+ * @param url - The base URL to modify
5
+ * @returns The modified URL with the version appended to the pathname
6
+ * @example
7
+ * addVersionPostfixToUrl('v1', 'https://api.example.com/path')
8
+ * // Returns: 'https://api.example.com/path/v1'
9
+ */
10
+ export declare const addVersionPostfixToUrl: (version: string, url: string) => string;
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+ /**
3
+ * Appends a version string to the end of a URL's pathname
4
+ * @param version - The version string to append to the URL
5
+ * @param url - The base URL to modify
6
+ * @returns The modified URL with the version appended to the pathname
7
+ * @example
8
+ * addVersionPostfixToUrl('v1', 'https://api.example.com/path')
9
+ * // Returns: 'https://api.example.com/path/v1'
10
+ */
11
+ const addVersionPostfixToUrl = (version, url) => {
12
+ const urlObj = new URL(url);
13
+ urlObj.pathname = [
14
+ ...urlObj.pathname.split('/').filter(Boolean),
15
+ version,
16
+ ].join('/');
17
+ return urlObj.toString();
18
+ };
19
+
20
+ export { addVersionPostfixToUrl };
@@ -0,0 +1 @@
1
+ export { addVersionPostfixToUrl } from './addVersionPostfixToUrl';
@@ -10,7 +10,7 @@ var onPopupClose = require('../onPopupClose/onPopupClose.cjs');
10
10
  var mergeAndEncryptParams = require('../mergeAndEncryptParams/mergeAndEncryptParams.cjs');
11
11
  var getCenteredPopupFeatures = require('../getCenteredPopupFeatures/getCenteredPopupFeatures.cjs');
12
12
 
13
- const createPopupOpener = ({ environmentId, popupInfo, store, popupActionTimeout = 1000, // Wait page up to 1 second for new actions before closing
13
+ const createPopupOpener = ({ environmentId, popupUrl, popupWidth = 420, popupHeight = 520, store, popupActionTimeout = 1000, // Wait page up to 1 second for new actions before closing
14
14
  }) => {
15
15
  let popup = null;
16
16
  let didOpenPopup = false;
@@ -22,15 +22,12 @@ const createPopupOpener = ({ environmentId, popupInfo, store, popupActionTimeout
22
22
  lastActionId = null;
23
23
  };
24
24
  return (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ params, pathname, }) {
25
- var _b, _c;
26
25
  // Used as a unique identifier for the action
27
26
  const actionId = new Date().getTime();
28
27
  lastActionId = actionId;
29
- const popupFinalUrl = new URL(popupInfo.url);
28
+ const popupFinalUrl = new URL(popupUrl);
30
29
  const activeConnection = store.getActiveConnection();
31
30
  const resultDeferredPromise = new utils.DeferredPromise();
32
- const popupWidth = (_b = popupInfo.width) !== null && _b !== void 0 ? _b : 420;
33
- const popupHeight = (_c = popupInfo.height) !== null && _c !== void 0 ? _c : 520;
34
31
  // Setup popup URL and data
35
32
  popupFinalUrl.hash = `/${pathname}`;
36
33
  popupFinalUrl.searchParams.set('provider_env_id', environmentId);
@@ -1,9 +1,10 @@
1
1
  import { GetPopupActionFuncArgs, GetPopupActionName, GetPopupActionResult, IPopupAction } from '@dynamic-labs/types';
2
- import { PopupInfo } from '../../types';
3
2
  import { ClientStore } from '../../store/createClientStore';
4
3
  type CreatePopupOpenerProps = {
5
4
  environmentId: string;
6
- popupInfo: PopupInfo;
5
+ popupUrl: string;
6
+ popupWidth?: number;
7
+ popupHeight?: number;
7
8
  store: ClientStore;
8
9
  popupActionTimeout?: number;
9
10
  };
@@ -11,6 +12,6 @@ type OpenPopupProps<TAction extends IPopupAction> = {
11
12
  params: GetPopupActionFuncArgs<TAction>;
12
13
  pathname: GetPopupActionName<TAction>;
13
14
  };
14
- export declare const createPopupOpener: ({ environmentId, popupInfo, store, popupActionTimeout, }: CreatePopupOpenerProps) => <TPopupAction extends IPopupAction>({ params, pathname, }: OpenPopupProps<TPopupAction>) => Promise<GetPopupActionResult<TPopupAction>>;
15
+ export declare const createPopupOpener: ({ environmentId, popupUrl, popupWidth, popupHeight, store, popupActionTimeout, }: CreatePopupOpenerProps) => <TPopupAction extends IPopupAction>({ params, pathname, }: OpenPopupProps<TPopupAction>) => Promise<GetPopupActionResult<TPopupAction>>;
15
16
  export type OpenPopup = ReturnType<typeof createPopupOpener>;
16
17
  export {};
@@ -6,7 +6,7 @@ import { onPopupClose } from '../onPopupClose/onPopupClose.js';
6
6
  import { mergeAndEncryptParams } from '../mergeAndEncryptParams/mergeAndEncryptParams.js';
7
7
  import { getCenteredPopupFeatures } from '../getCenteredPopupFeatures/getCenteredPopupFeatures.js';
8
8
 
9
- const createPopupOpener = ({ environmentId, popupInfo, store, popupActionTimeout = 1000, // Wait page up to 1 second for new actions before closing
9
+ const createPopupOpener = ({ environmentId, popupUrl, popupWidth = 420, popupHeight = 520, store, popupActionTimeout = 1000, // Wait page up to 1 second for new actions before closing
10
10
  }) => {
11
11
  let popup = null;
12
12
  let didOpenPopup = false;
@@ -18,15 +18,12 @@ const createPopupOpener = ({ environmentId, popupInfo, store, popupActionTimeout
18
18
  lastActionId = null;
19
19
  };
20
20
  return (_a) => __awaiter(void 0, [_a], void 0, function* ({ params, pathname, }) {
21
- var _b, _c;
22
21
  // Used as a unique identifier for the action
23
22
  const actionId = new Date().getTime();
24
23
  lastActionId = actionId;
25
- const popupFinalUrl = new URL(popupInfo.url);
24
+ const popupFinalUrl = new URL(popupUrl);
26
25
  const activeConnection = store.getActiveConnection();
27
26
  const resultDeferredPromise = new DeferredPromise();
28
- const popupWidth = (_b = popupInfo.width) !== null && _b !== void 0 ? _b : 420;
29
- const popupHeight = (_c = popupInfo.height) !== null && _c !== void 0 ? _c : 520;
30
27
  // Setup popup URL and data
31
28
  popupFinalUrl.hash = `/${pathname}`;
32
29
  popupFinalUrl.searchParams.set('provider_env_id', environmentId);
@@ -7,3 +7,10 @@ export type PopupInfo = {
7
7
  export type ConnectArgs = {
8
8
  chain: 'evm' | 'solana';
9
9
  };
10
+ export type DevelopmentOptions = {
11
+ /**
12
+ * If true, the version will be appended to the URL
13
+ * @default true
14
+ */
15
+ postfixPopupUrlWithVersion?: boolean;
16
+ };