@dynamic-labs/embedded-wallet 3.0.0-alpha.12 → 3.0.0-alpha.14

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,50 @@
1
1
 
2
+ ## [3.0.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.13...v3.0.0-alpha.14) (2024-07-09)
3
+
4
+
5
+ ### ⚠ BREAKING CHANGES
6
+
7
+ * remove setPrimaryWallet in favor of useSwitchWallet (#6212)
8
+ * move getBalance method to wallet so it can be fetched for any wallet not just the active one (#6200)
9
+ * make Wallet a class instead of just a type (#6094)
10
+
11
+ ### Features
12
+
13
+ * add @dynamic-labs/solana-extension ([#6140](https://github.com/dynamic-labs/DynamicAuth/issues/6140)) ([c0e2a06](https://github.com/dynamic-labs/DynamicAuth/commit/c0e2a067dd83163094b58a15696df8654da47c65))
14
+ * add solana support for multi-asset ([#6222](https://github.com/dynamic-labs/DynamicAuth/issues/6222)) ([9660d79](https://github.com/dynamic-labs/DynamicAuth/commit/9660d7962f1fb01011d68397bb367fdfc5335ca9))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * allow closing re-connect wallet modal ([#6250](https://github.com/dynamic-labs/DynamicAuth/issues/6250)) ([55ba25b](https://github.com/dynamic-labs/DynamicAuth/commit/55ba25bd3e907629aaa26e788885bfa38f8fe350))
20
+ * move getBalance method to wallet so it can be fetched for any wallet not just the active one ([#6200](https://github.com/dynamic-labs/DynamicAuth/issues/6200)) ([ee94773](https://github.com/dynamic-labs/DynamicAuth/commit/ee94773df9b31462a325666760fcf1fc70dec68a))
21
+ * move getNameService method to wallet so name service data can be fetched for any wallet ([#6205](https://github.com/dynamic-labs/DynamicAuth/issues/6205)) ([6671ae9](https://github.com/dynamic-labs/DynamicAuth/commit/6671ae92532ffc1889e24519e75f47d336ac0da6))
22
+ * relax phone number length validation ([#6226](https://github.com/dynamic-labs/DynamicAuth/issues/6226)) ([f0969b4](https://github.com/dynamic-labs/DynamicAuth/commit/f0969b4fbdafde07125cddecb16b4bfd011ea65e))
23
+ * sdkHasLoaded flipping back to false with otp ([#6242](https://github.com/dynamic-labs/DynamicAuth/issues/6242)) ([32ad9dd](https://github.com/dynamic-labs/DynamicAuth/commit/32ad9dd2dae7775f494506773fb343fe1a249c65))
24
+ * send transaction demo undefined address/value ([#6248](https://github.com/dynamic-labs/DynamicAuth/issues/6248)) ([036a511](https://github.com/dynamic-labs/DynamicAuth/commit/036a511fb848ef461edd9b7a5d79d478b0f1cf23))
25
+ * set last active account on accountChange request ([#6218](https://github.com/dynamic-labs/DynamicAuth/issues/6218)) ([05797d2](https://github.com/dynamic-labs/DynamicAuth/commit/05797d292aab8b4de02555594d4d1bbd4c9543eb))
26
+ * show ledger toggle when linking wallet ([#6202](https://github.com/dynamic-labs/DynamicAuth/issues/6202)) ([a449c0b](https://github.com/dynamic-labs/DynamicAuth/commit/a449c0bfc4e3a75ccd7084b930c48fbd6c14f691))
27
+ * show user wallet in profile view on single wallet mode even if it's not primary ([#6187](https://github.com/dynamic-labs/DynamicAuth/issues/6187)) ([ffaaeb2](https://github.com/dynamic-labs/DynamicAuth/commit/ffaaeb2c6cbb2868a381d85451ae5574024156bb))
28
+ * stop auto-switching to connected secondary wallet if primary wallet is not connected ([#6196](https://github.com/dynamic-labs/DynamicAuth/issues/6196)) ([4e8bcd2](https://github.com/dynamic-labs/DynamicAuth/commit/4e8bcd2d02d3fca54a0ed29c45b386ae99266b84))
29
+ * stop coinbase and solflare popups when secondary ([#6225](https://github.com/dynamic-labs/DynamicAuth/issues/6225)) ([7e9c104](https://github.com/dynamic-labs/DynamicAuth/commit/7e9c1049a09c9fd513c9a2a746d6baac916f1bf4))
30
+ * stop sending double sign request on network switch ([e325709](https://github.com/dynamic-labs/DynamicAuth/commit/e325709bb5d2d1331fe16cc705398fc7b1cc292a))
31
+ * tunrkey solana signer accept uint8array message ([#6137](https://github.com/dynamic-labs/DynamicAuth/issues/6137)) ([70f89ce](https://github.com/dynamic-labs/DynamicAuth/commit/70f89ce0dafa4c99b318c9c5adce59083cd6d284))
32
+ * update formatting of phantom bitcoin publickey ([#6210](https://github.com/dynamic-labs/DynamicAuth/issues/6210)) ([f58cea9](https://github.com/dynamic-labs/DynamicAuth/commit/f58cea99333fd7c6af8f56f637ee32f1f7ce8d76))
33
+ * use white color in farcaster qr code when in dark mode ([#6245](https://github.com/dynamic-labs/DynamicAuth/issues/6245)) ([a91958d](https://github.com/dynamic-labs/DynamicAuth/commit/a91958d8773be138da8f54791c4c67866257bbad))
34
+
35
+
36
+ * make Wallet a class instead of just a type ([#6094](https://github.com/dynamic-labs/DynamicAuth/issues/6094)) ([6dc4672](https://github.com/dynamic-labs/DynamicAuth/commit/6dc4672951cfadc22a6c569e74eae3485bd472f3))
37
+ * remove setPrimaryWallet in favor of useSwitchWallet ([#6212](https://github.com/dynamic-labs/DynamicAuth/issues/6212)) ([de125e1](https://github.com/dynamic-labs/DynamicAuth/commit/de125e1ebbc20507e4ec07f337f5f5fd13aabcbe))
38
+
39
+ ## [3.0.0-alpha.13](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.12...v3.0.0-alpha.13) (2024-06-27)
40
+
41
+
42
+ ### Bug Fixes
43
+
44
+ * coinbase smart wallet better handling in iframes ([#6184](https://github.com/dynamic-labs/DynamicAuth/issues/6184)) ([2c4befe](https://github.com/dynamic-labs/DynamicAuth/commit/2c4befedd09e6a432139cb3d08ea61004c3896d5))
45
+ * show connected network name when icon url is missing ([#6191](https://github.com/dynamic-labs/DynamicAuth/issues/6191)) ([dafd9e3](https://github.com/dynamic-labs/DynamicAuth/commit/dafd9e323f47ca3d61556e9a8c84ba3bfd27af8f))
46
+ * use correct account when creating wallet client ([#6179](https://github.com/dynamic-labs/DynamicAuth/issues/6179)) ([4e45a15](https://github.com/dynamic-labs/DynamicAuth/commit/4e45a15b2d7221ec80df919aa93468a75a94bed3))
47
+
2
48
  ## [3.0.0-alpha.12](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.11...v3.0.0-alpha.12) (2024-06-27)
3
49
 
4
50
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/embedded-wallet",
3
- "version": "3.0.0-alpha.12",
3
+ "version": "3.0.0-alpha.14",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -31,9 +31,9 @@
31
31
  "@turnkey/http": "2.7.1",
32
32
  "@turnkey/iframe-stamper": "2.0.0",
33
33
  "@turnkey/webauthn-stamper": "0.5.0",
34
- "@dynamic-labs/utils": "3.0.0-alpha.12",
35
- "@dynamic-labs/wallet-book": "3.0.0-alpha.12",
36
- "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.12"
34
+ "@dynamic-labs/utils": "3.0.0-alpha.14",
35
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.14",
36
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.14"
37
37
  },
38
38
  "peerDependencies": {}
39
39
  }
@@ -83,6 +83,12 @@ class ExportHandler {
83
83
  }
84
84
  exportPrivateKey(_a) {
85
85
  return _tslib.__awaiter(this, arguments, void 0, function* ({ privateKeyId, organizationId, }) {
86
+ const apiKeyStamper = ExportHandler === null || ExportHandler === void 0 ? void 0 : ExportHandler.apiKeyStamper;
87
+ if (apiKeyStamper) {
88
+ this.__turnkeyClient = new http.TurnkeyClient({
89
+ baseUrl: turnkeyBaseUrl,
90
+ }, apiKeyStamper);
91
+ }
86
92
  if (!this.__iframeStamper ||
87
93
  !this.__publicKey ||
88
94
  !this.__turnkeyClient ||
@@ -106,6 +112,12 @@ class ExportHandler {
106
112
  }
107
113
  exportWallet(_a) {
108
114
  return _tslib.__awaiter(this, arguments, void 0, function* ({ walletId, organizationId, address, }) {
115
+ const apiKeyStamper = ExportHandler === null || ExportHandler === void 0 ? void 0 : ExportHandler.apiKeyStamper;
116
+ if (apiKeyStamper) {
117
+ this.__turnkeyClient = new http.TurnkeyClient({
118
+ baseUrl: turnkeyBaseUrl,
119
+ }, apiKeyStamper);
120
+ }
109
121
  if (!this.__iframeStamper ||
110
122
  !this.__publicKey ||
111
123
  !this.__turnkeyClient ||
@@ -79,6 +79,12 @@ class ExportHandler {
79
79
  }
80
80
  exportPrivateKey(_a) {
81
81
  return __awaiter(this, arguments, void 0, function* ({ privateKeyId, organizationId, }) {
82
+ const apiKeyStamper = ExportHandler === null || ExportHandler === void 0 ? void 0 : ExportHandler.apiKeyStamper;
83
+ if (apiKeyStamper) {
84
+ this.__turnkeyClient = new TurnkeyClient({
85
+ baseUrl: turnkeyBaseUrl,
86
+ }, apiKeyStamper);
87
+ }
82
88
  if (!this.__iframeStamper ||
83
89
  !this.__publicKey ||
84
90
  !this.__turnkeyClient ||
@@ -102,6 +108,12 @@ class ExportHandler {
102
108
  }
103
109
  exportWallet(_a) {
104
110
  return __awaiter(this, arguments, void 0, function* ({ walletId, organizationId, address, }) {
111
+ const apiKeyStamper = ExportHandler === null || ExportHandler === void 0 ? void 0 : ExportHandler.apiKeyStamper;
112
+ if (apiKeyStamper) {
113
+ this.__turnkeyClient = new TurnkeyClient({
114
+ baseUrl: turnkeyBaseUrl,
115
+ }, apiKeyStamper);
116
+ }
105
117
  if (!this.__iframeStamper ||
106
118
  !this.__publicKey ||
107
119
  !this.__turnkeyClient ||
@@ -164,20 +164,23 @@ class TurnkeyWalletConnectorBase extends walletConnectorCore.WalletConnectorBase
164
164
  this.removeSessionKeysFunction = func;
165
165
  }
166
166
  createOrRestoreSession() {
167
- return _tslib.__awaiter(this, void 0, void 0, function* () {
167
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ ignoreRestore, } = {}) {
168
168
  var _a;
169
+ if (!this.isSessionKeyCompatible() ||
170
+ TurnkeyWalletConnectorBase.isLoadingSession) {
171
+ return;
172
+ }
169
173
  if (!this.createOrRestoreSessionFetcherFunction) {
170
174
  throw new utils.DynamicError('Cannot register session key to init provider');
171
175
  }
172
- if (TurnkeyWalletConnectorBase.isLoadingSession) {
173
- return;
174
- }
175
176
  if ((_a = TurnkeyWalletConnectorBase.sessionKeys) === null || _a === void 0 ? void 0 : _a.publicKey) {
176
177
  return TurnkeyWalletConnectorBase.sessionKeys.publicKey;
177
178
  }
178
179
  try {
179
180
  TurnkeyWalletConnectorBase.isLoadingSession = true;
180
- const sessionKeys = yield this.createOrRestoreSessionFetcherFunction();
181
+ const sessionKeys = yield this.createOrRestoreSessionFetcherFunction({
182
+ ignoreRestore,
183
+ });
181
184
  TurnkeyWalletConnectorBase.sessionKeys = sessionKeys;
182
185
  TurnkeyWalletConnectorBase.apiKeyStamper = new apiKeyStamper.ApiKeyStamper({
183
186
  apiPrivateKey: sessionKeys.privateKey,
@@ -28,7 +28,9 @@ export declare abstract class TurnkeyWalletConnectorBase extends WalletConnector
28
28
  private __exportHandler;
29
29
  static sessionKeys: SessionKeys | undefined;
30
30
  static apiKeyStamper: ApiKeyStamper | undefined;
31
- createOrRestoreSessionFetcherFunction: (() => Promise<SessionKeys>) | undefined;
31
+ createOrRestoreSessionFetcherFunction: (({ ignoreRestore }: {
32
+ ignoreRestore?: boolean;
33
+ }) => Promise<SessionKeys>) | undefined;
32
34
  removeSessionKeysFunction: (() => Promise<void>) | undefined;
33
35
  constructor(nameAndKey: TurnkeyWalletConnectorNameAndKey, props: TurnkeyConnectorBaseProps);
34
36
  getWebAuthnAttestation(): Promise<{
@@ -60,7 +62,9 @@ export declare abstract class TurnkeyWalletConnectorBase extends WalletConnector
60
62
  setSessionKeyFetcher(func: () => Promise<SessionKeys>): void;
61
63
  setSessionKeyRemoveFunction(func: () => Promise<void>): void;
62
64
  removeSessionKeys: () => Promise<void>;
63
- createOrRestoreSession(): Promise<string | undefined>;
65
+ createOrRestoreSession({ ignoreRestore, }?: {
66
+ ignoreRestore?: boolean;
67
+ }): Promise<string | undefined>;
64
68
  isSessionKeyCompatible(): boolean;
65
69
  isSessionActive(): Promise<boolean>;
66
70
  get sessionKeys(): SessionKeys | undefined;
@@ -160,20 +160,23 @@ class TurnkeyWalletConnectorBase extends WalletConnectorBase {
160
160
  this.removeSessionKeysFunction = func;
161
161
  }
162
162
  createOrRestoreSession() {
163
- return __awaiter(this, void 0, void 0, function* () {
163
+ return __awaiter(this, arguments, void 0, function* ({ ignoreRestore, } = {}) {
164
164
  var _a;
165
+ if (!this.isSessionKeyCompatible() ||
166
+ TurnkeyWalletConnectorBase.isLoadingSession) {
167
+ return;
168
+ }
165
169
  if (!this.createOrRestoreSessionFetcherFunction) {
166
170
  throw new DynamicError('Cannot register session key to init provider');
167
171
  }
168
- if (TurnkeyWalletConnectorBase.isLoadingSession) {
169
- return;
170
- }
171
172
  if ((_a = TurnkeyWalletConnectorBase.sessionKeys) === null || _a === void 0 ? void 0 : _a.publicKey) {
172
173
  return TurnkeyWalletConnectorBase.sessionKeys.publicKey;
173
174
  }
174
175
  try {
175
176
  TurnkeyWalletConnectorBase.isLoadingSession = true;
176
- const sessionKeys = yield this.createOrRestoreSessionFetcherFunction();
177
+ const sessionKeys = yield this.createOrRestoreSessionFetcherFunction({
178
+ ignoreRestore,
179
+ });
177
180
  TurnkeyWalletConnectorBase.sessionKeys = sessionKeys;
178
181
  TurnkeyWalletConnectorBase.apiKeyStamper = new ApiKeyStamper({
179
182
  apiPrivateKey: sessionKeys.privateKey,