@dynamic-labs/embedded-wallet-solana 4.6.3 → 4.7.1

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,25 @@
1
1
 
2
+ ### [4.7.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.7.0...v4.7.1) (2025-02-20)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * remove user logout when sdk version change ([#8112](https://github.com/dynamic-labs/dynamic-auth/issues/8112)) ([b1a321f](https://github.com/dynamic-labs/dynamic-auth/commit/b1a321f18231f083aeb365d4dc92e992897a7e1b))
8
+
9
+ ## [4.7.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.6.3...v4.7.0) (2025-02-20)
10
+
11
+
12
+ ### Features
13
+
14
+ * 7702 support ([14ee3cd](https://github.com/dynamic-labs/dynamic-auth/commit/14ee3cd3513ac8b3e8e866cc2026b042c706b7e6))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * fallback to empty array when token balances is called with an invalid chain ID ([#8108](https://github.com/dynamic-labs/dynamic-auth/issues/8108)) ([7d14ded](https://github.com/dynamic-labs/dynamic-auth/commit/7d14ded6afa0de604901bbc8bc13620d03dc2e8c))
20
+ * improve global connectivity sign typed data reliability ([#8103](https://github.com/dynamic-labs/dynamic-auth/issues/8103)) ([8b0d2dd](https://github.com/dynamic-labs/dynamic-auth/commit/8b0d2ddbeb62a11732a9d59bc6cd4b72d82b9855))
21
+ * **QNTM-2902:** ensure react updates icons ([#8105](https://github.com/dynamic-labs/dynamic-auth/issues/8105)) ([1182c4c](https://github.com/dynamic-labs/dynamic-auth/commit/1182c4cc103c599e6bbff89af9b1312fb96b6d05))
22
+
2
23
  ### [4.6.3](https://github.com/dynamic-labs/dynamic-auth/compare/v4.6.2...v4.6.3) (2025-02-14)
3
24
 
4
25
 
package/package.cjs CHANGED
@@ -3,11 +3,11 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.6.3";
6
+ var version = "4.7.1";
7
7
  var dependencies = {
8
- "@dynamic-labs/utils": "4.6.3",
9
- "@dynamic-labs/logger": "4.6.3",
10
- "@dynamic-labs/types": "4.6.3",
8
+ "@dynamic-labs/utils": "4.7.1",
9
+ "@dynamic-labs/logger": "4.7.1",
10
+ "@dynamic-labs/types": "4.7.1",
11
11
  "@dynamic-labs/sdk-api-core": "0.0.628",
12
12
  eventemitter3: "5.0.1",
13
13
  "@solana/web3.js": "1.92.1",
package/package.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use client'
2
- var version = "4.6.3";
2
+ var version = "4.7.1";
3
3
  var dependencies = {
4
- "@dynamic-labs/utils": "4.6.3",
5
- "@dynamic-labs/logger": "4.6.3",
6
- "@dynamic-labs/types": "4.6.3",
4
+ "@dynamic-labs/utils": "4.7.1",
5
+ "@dynamic-labs/logger": "4.7.1",
6
+ "@dynamic-labs/types": "4.7.1",
7
7
  "@dynamic-labs/sdk-api-core": "0.0.628",
8
8
  eventemitter3: "5.0.1",
9
9
  "@solana/web3.js": "1.92.1",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/embedded-wallet-solana",
3
- "version": "4.6.3",
3
+ "version": "4.7.1",
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,22 +18,22 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/utils": "4.6.3",
22
- "@dynamic-labs/logger": "4.6.3",
23
- "@dynamic-labs/types": "4.6.3",
21
+ "@dynamic-labs/utils": "4.7.1",
22
+ "@dynamic-labs/logger": "4.7.1",
23
+ "@dynamic-labs/types": "4.7.1",
24
24
  "@dynamic-labs/sdk-api-core": "0.0.628",
25
25
  "eventemitter3": "5.0.1",
26
26
  "@solana/web3.js": "1.92.1",
27
27
  "@turnkey/iframe-stamper": "2.0.0",
28
28
  "@turnkey/solana": "1.0.1",
29
29
  "@turnkey/webauthn-stamper": "0.5.0",
30
- "@dynamic-labs/assert-package-version": "4.6.3",
31
- "@dynamic-labs/embedded-wallet": "4.6.3",
32
- "@dynamic-labs/rpc-providers": "4.6.3",
33
- "@dynamic-labs/solana-core": "4.6.3",
34
- "@dynamic-labs/wallet-book": "4.6.3",
35
- "@dynamic-labs/wallet-connector-core": "4.6.3",
36
- "@dynamic-labs/webauthn": "4.6.3",
30
+ "@dynamic-labs/assert-package-version": "4.7.1",
31
+ "@dynamic-labs/embedded-wallet": "4.7.1",
32
+ "@dynamic-labs/rpc-providers": "4.7.1",
33
+ "@dynamic-labs/solana-core": "4.7.1",
34
+ "@dynamic-labs/wallet-book": "4.7.1",
35
+ "@dynamic-labs/wallet-connector-core": "4.7.1",
36
+ "@dynamic-labs/webauthn": "4.7.1",
37
37
  "react-dom": "18.2.0",
38
38
  "viem": "2.21.57"
39
39
  },
@@ -42,7 +42,7 @@ class TurnkeySolanaWalletConnector extends embeddedWallet.TurnkeyWalletConnector
42
42
  }
43
43
  throw new Error('Failed to get environment id');
44
44
  };
45
- this.solNetworks = props.solNetworks;
45
+ this.solNetworks = solanaCore.getBackwardsCompatibleSolNetworks(props.solNetworks, props.connectionConfig);
46
46
  this.walletUiUtils = props.walletUiUtils;
47
47
  this._turnkeyAccount = undefined;
48
48
  this._connectionClient = undefined;
@@ -72,8 +72,12 @@ class TurnkeySolanaWalletConnector extends embeddedWallet.TurnkeyWalletConnector
72
72
  getWalletClient() {
73
73
  return this.getConnection();
74
74
  }
75
+ /**
76
+ * @param returnDynamicNetworkId - If true, the dynamic network ID will be returned instead of the network cluster
77
+ * @returns The network cluster (e.g. 'mainnet', 'testnet', 'devnet') or dynamic network (used for switching networks)
78
+ */
75
79
  getNetwork() {
76
- return _tslib.__awaiter(this, void 0, void 0, function* () {
80
+ return _tslib.__awaiter(this, arguments, void 0, function* (returnDynamicNetworkId = false) {
77
81
  const connection = this.getConnection();
78
82
  let genesisHash = localStorage.getItem(solanaCore.getGenesisHashLSKey(connection.rpcEndpoint));
79
83
  if (!genesisHash) {
@@ -83,14 +87,12 @@ class TurnkeySolanaWalletConnector extends embeddedWallet.TurnkeyWalletConnector
83
87
  genesisHash = genesisHash.substring(0, 32);
84
88
  // see: https://github.com/ChainAgnostic/namespaces/blob/main/solana/caip2.md
85
89
  if (genesisHash === '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp') {
86
- return 'mainnet';
87
- }
88
- else if (genesisHash === 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1') {
89
- return 'devnet';
90
+ return returnDynamicNetworkId ? '101' : 'mainnet';
90
91
  }
91
- else {
92
- return 'testnet';
92
+ if (genesisHash === 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1') {
93
+ return returnDynamicNetworkId ? '103' : 'devnet';
93
94
  }
95
+ return returnDynamicNetworkId ? '102' : 'testnet';
94
96
  });
95
97
  }
96
98
  getPublicClient() {
@@ -439,7 +441,7 @@ class TurnkeySolanaWalletConnector extends embeddedWallet.TurnkeyWalletConnector
439
441
  let optimizedTransaction = transaction;
440
442
  try {
441
443
  // we cannot optimize partially signed transactions as once a tx is modified the signatures are no longer valid
442
- if ((yield this.getNetwork()) === 'mainnet' &&
444
+ if ((yield this.getNetwork(true)) === '101' &&
443
445
  !solanaCore.isTxAlreadySigned(transaction)) {
444
446
  optimizedTransaction = (yield api.optimizeSolanaTransaction(this.getEnvId(), transaction, (_a = this.turnkeyAddress) !== null && _a !== void 0 ? _a : ''));
445
447
  }
@@ -31,7 +31,11 @@ export declare class TurnkeySolanaWalletConnector extends TurnkeyWalletConnector
31
31
  getRpcUrl(): string;
32
32
  getConnection(commitmentOrConfig?: Commitment | ConnectionConfig): Connection;
33
33
  getWalletClient(): Connection;
34
- getNetwork(): Promise<string>;
34
+ /**
35
+ * @param returnDynamicNetworkId - If true, the dynamic network ID will be returned instead of the network cluster
36
+ * @returns The network cluster (e.g. 'mainnet', 'testnet', 'devnet') or dynamic network (used for switching networks)
37
+ */
38
+ getNetwork(returnDynamicNetworkId?: boolean): Promise<string>;
35
39
  getPublicClient(): Promise<Connection | undefined>;
36
40
  supportsNetworkSwitching(): boolean;
37
41
  setVerifiedCredentials(verifiedCredentials: JwtVerifiedCredential[]): void;
@@ -6,7 +6,7 @@ import { TurnkeySigner } from '@turnkey/solana';
6
6
  import { IframeStamper } from '@turnkey/iframe-stamper';
7
7
  import { isSameAddress } from '@dynamic-labs/wallet-connector-core';
8
8
  import { DynamicError, bufferToBase64 } from '@dynamic-labs/utils';
9
- import { SolanaWallet, getOverrideRpcUrlForNetwork, ProviderChain, getGenesisHashLSKey, SolanaUiTransaction, isTxAlreadySigned } from '@dynamic-labs/solana-core';
9
+ import { SolanaWallet, getBackwardsCompatibleSolNetworks, getOverrideRpcUrlForNetwork, ProviderChain, getGenesisHashLSKey, SolanaUiTransaction, isTxAlreadySigned } from '@dynamic-labs/solana-core';
10
10
  import { TurnkeyWalletConnectorBase, findTurnkeyVerifiedCredentials, TURNKEY_SDK_SESSION_KEY_RETRYABLE_ERRORS, logger } from '@dynamic-labs/embedded-wallet';
11
11
  import { createSolanaConnection } from '../utils/createSolanaConnection/createSolanaConnection.js';
12
12
  import { optimizeSolanaTransaction } from '../utils/api/api.js';
@@ -38,7 +38,7 @@ class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase {
38
38
  }
39
39
  throw new Error('Failed to get environment id');
40
40
  };
41
- this.solNetworks = props.solNetworks;
41
+ this.solNetworks = getBackwardsCompatibleSolNetworks(props.solNetworks, props.connectionConfig);
42
42
  this.walletUiUtils = props.walletUiUtils;
43
43
  this._turnkeyAccount = undefined;
44
44
  this._connectionClient = undefined;
@@ -68,8 +68,12 @@ class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase {
68
68
  getWalletClient() {
69
69
  return this.getConnection();
70
70
  }
71
+ /**
72
+ * @param returnDynamicNetworkId - If true, the dynamic network ID will be returned instead of the network cluster
73
+ * @returns The network cluster (e.g. 'mainnet', 'testnet', 'devnet') or dynamic network (used for switching networks)
74
+ */
71
75
  getNetwork() {
72
- return __awaiter(this, void 0, void 0, function* () {
76
+ return __awaiter(this, arguments, void 0, function* (returnDynamicNetworkId = false) {
73
77
  const connection = this.getConnection();
74
78
  let genesisHash = localStorage.getItem(getGenesisHashLSKey(connection.rpcEndpoint));
75
79
  if (!genesisHash) {
@@ -79,14 +83,12 @@ class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase {
79
83
  genesisHash = genesisHash.substring(0, 32);
80
84
  // see: https://github.com/ChainAgnostic/namespaces/blob/main/solana/caip2.md
81
85
  if (genesisHash === '5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp') {
82
- return 'mainnet';
83
- }
84
- else if (genesisHash === 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1') {
85
- return 'devnet';
86
+ return returnDynamicNetworkId ? '101' : 'mainnet';
86
87
  }
87
- else {
88
- return 'testnet';
88
+ if (genesisHash === 'EtWTRABZaYq6iMfeYKouRu166VU2xqa1') {
89
+ return returnDynamicNetworkId ? '103' : 'devnet';
89
90
  }
91
+ return returnDynamicNetworkId ? '102' : 'testnet';
90
92
  });
91
93
  }
92
94
  getPublicClient() {
@@ -435,7 +437,7 @@ class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase {
435
437
  let optimizedTransaction = transaction;
436
438
  try {
437
439
  // we cannot optimize partially signed transactions as once a tx is modified the signatures are no longer valid
438
- if ((yield this.getNetwork()) === 'mainnet' &&
440
+ if ((yield this.getNetwork(true)) === '101' &&
439
441
  !isTxAlreadySigned(transaction)) {
440
442
  optimizedTransaction = (yield optimizeSolanaTransaction(this.getEnvId(), transaction, (_a = this.turnkeyAddress) !== null && _a !== void 0 ? _a : ''));
441
443
  }