@dynamic-labs/embedded-wallet-solana 3.0.0-alpha.22 → 3.0.0-alpha.23

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,18 @@
1
1
 
2
+ ## [3.0.0-alpha.23](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.22...v3.0.0-alpha.23) (2024-07-19)
3
+
4
+
5
+ ### Features
6
+
7
+ * show custom labels in the sdk ([#6352](https://github.com/dynamic-labs/DynamicAuth/issues/6352)) ([6eec9b2](https://github.com/dynamic-labs/DynamicAuth/commit/6eec9b26dbfd25c5138378aa92de8379a5cd0ddc))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * add missing await to viem controller ([#6354](https://github.com/dynamic-labs/DynamicAuth/issues/6354)) ([32c7362](https://github.com/dynamic-labs/DynamicAuth/commit/32c73625c5575f9134edd541c7221aba08a741b5))
13
+ * allow for react-native 0.74.x ([#6371](https://github.com/dynamic-labs/DynamicAuth/issues/6371)) ([37e08b6](https://github.com/dynamic-labs/DynamicAuth/commit/37e08b6b32bcaef7b7f6a4dedc45b2321f3f64a6))
14
+ * not able to switch to secondary wallet ([#6373](https://github.com/dynamic-labs/DynamicAuth/issues/6373)) ([f85ed10](https://github.com/dynamic-labs/DynamicAuth/commit/f85ed10aca8bf41658eb1418cd87e1c5061d4b1b))
15
+
2
16
  ## [3.0.0-alpha.22](https://github.com/dynamic-labs/DynamicAuth/compare/v3.0.0-alpha.21...v3.0.0-alpha.22) (2024-07-18)
3
17
 
4
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/embedded-wallet-solana",
3
- "version": "3.0.0-alpha.22",
3
+ "version": "3.0.0-alpha.23",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dynamic-labs/dynamic-auth.git",
@@ -33,14 +33,14 @@
33
33
  "@turnkey/iframe-stamper": "2.0.0",
34
34
  "@turnkey/solana": "0.3.1",
35
35
  "@turnkey/webauthn-stamper": "0.5.0",
36
- "@dynamic-labs/embedded-wallet": "3.0.0-alpha.22",
37
- "@dynamic-labs/rpc-provider-solana": "3.0.0-alpha.22",
38
- "@dynamic-labs/rpc-providers": "3.0.0-alpha.22",
39
- "@dynamic-labs/solana-utils": "3.0.0-alpha.22",
40
- "@dynamic-labs/types": "3.0.0-alpha.22",
41
- "@dynamic-labs/utils": "3.0.0-alpha.22",
42
- "@dynamic-labs/wallet-book": "3.0.0-alpha.22",
43
- "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.22",
36
+ "@dynamic-labs/embedded-wallet": "3.0.0-alpha.23",
37
+ "@dynamic-labs/rpc-provider-solana": "3.0.0-alpha.23",
38
+ "@dynamic-labs/rpc-providers": "3.0.0-alpha.23",
39
+ "@dynamic-labs/solana-utils": "3.0.0-alpha.23",
40
+ "@dynamic-labs/types": "3.0.0-alpha.23",
41
+ "@dynamic-labs/utils": "3.0.0-alpha.23",
42
+ "@dynamic-labs/wallet-book": "3.0.0-alpha.23",
43
+ "@dynamic-labs/wallet-connector-core": "3.0.0-alpha.23",
44
44
  "viem": "2.9.25"
45
45
  },
46
46
  "peerDependencies": {}
@@ -9,6 +9,7 @@ var webauthnStamper = require('@turnkey/webauthn-stamper');
9
9
  var http = require('@turnkey/http');
10
10
  var solana = require('@turnkey/solana');
11
11
  var iframeStamper = require('@turnkey/iframe-stamper');
12
+ var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
12
13
  var rpcProviderSolana = require('@dynamic-labs/rpc-provider-solana');
13
14
  var utils = require('@dynamic-labs/utils');
14
15
  var solanaUtils = require('@dynamic-labs/solana-utils');
@@ -221,6 +222,7 @@ class TurnkeySolanaWalletConnector extends embeddedWallet.TurnkeyWalletConnector
221
222
  }
222
223
  signTransaction(transaction) {
223
224
  return _tslib.__awaiter(this, void 0, void 0, function* () {
225
+ var _a;
224
226
  yield this.createOrRestoreSession();
225
227
  let account = yield this.getTurnkeyAccount();
226
228
  const address = this.turnkeyAddress;
@@ -230,13 +232,20 @@ class TurnkeySolanaWalletConnector extends embeddedWallet.TurnkeyWalletConnector
230
232
  try {
231
233
  yield account.addSignature(transaction, address);
232
234
  }
233
- catch (_a) {
234
- yield this.removeSessionKeys();
235
- yield this.createOrRestoreSession({
236
- ignoreRestore: true,
237
- });
238
- account = (yield this.getTurnkeyAccount());
239
- yield account.addSignature(transaction, address);
235
+ catch (err) {
236
+ if (err.message.includes(embeddedWallet.TURNKEY_API_KEY_EXPIRY_MESSAGE) ||
237
+ err.message.includes(embeddedWallet.TURNKEY_API_KEY_NOT_FOUND_MESSAGE)) {
238
+ yield this.removeSessionKeys();
239
+ yield this.createOrRestoreSession({
240
+ ignoreRestore: true,
241
+ });
242
+ account = (yield this.getTurnkeyAccount());
243
+ yield account.addSignature(transaction, address);
244
+ }
245
+ else {
246
+ walletConnectorCore.logger.error(`[TK] SubOrg: ${(_a = this.walletProperties) === null || _a === void 0 ? void 0 : _a.turnkeySubOrganizationId} failed to perform activity`, err);
247
+ throw err;
248
+ }
240
249
  }
241
250
  return transaction;
242
251
  });
@@ -5,10 +5,11 @@ import { WebauthnStamper } from '@turnkey/webauthn-stamper';
5
5
  import { TurnkeyClient } from '@turnkey/http';
6
6
  import { TurnkeySigner } from '@turnkey/solana';
7
7
  import { IframeStamper } from '@turnkey/iframe-stamper';
8
+ import { logger } from '@dynamic-labs/wallet-connector-core';
8
9
  import { ProviderChain } from '@dynamic-labs/rpc-provider-solana';
9
10
  import { DynamicError, getTLD, PlatformService, bufferToBase64 } from '@dynamic-labs/utils';
10
11
  import { SolanaUiTransaction } from '@dynamic-labs/solana-utils';
11
- import { TurnkeyWalletConnectorBase, findTurnkeyVerifiedCredential, PasskeyService, TURNKEY_API_BASE_URL } from '@dynamic-labs/embedded-wallet';
12
+ import { TurnkeyWalletConnectorBase, findTurnkeyVerifiedCredential, PasskeyService, TURNKEY_API_BASE_URL, TURNKEY_API_KEY_EXPIRY_MESSAGE, TURNKEY_API_KEY_NOT_FOUND_MESSAGE } from '@dynamic-labs/embedded-wallet';
12
13
  import { createSolanaConnection } from '../utils/createSolanaConnection/createSolanaConnection.js';
13
14
  import { getGenesisHashLSKey } from '../utils/getGenesisHashLSKey/getGenesisHashLSKey.js';
14
15
  import { decodeTransaction, getTotalSolanaSpend, summarizeTransactionDecodedData } from '../utils/transactionDecoder/transactionDecoder.js';
@@ -217,6 +218,7 @@ class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase {
217
218
  }
218
219
  signTransaction(transaction) {
219
220
  return __awaiter(this, void 0, void 0, function* () {
221
+ var _a;
220
222
  yield this.createOrRestoreSession();
221
223
  let account = yield this.getTurnkeyAccount();
222
224
  const address = this.turnkeyAddress;
@@ -226,13 +228,20 @@ class TurnkeySolanaWalletConnector extends TurnkeyWalletConnectorBase {
226
228
  try {
227
229
  yield account.addSignature(transaction, address);
228
230
  }
229
- catch (_a) {
230
- yield this.removeSessionKeys();
231
- yield this.createOrRestoreSession({
232
- ignoreRestore: true,
233
- });
234
- account = (yield this.getTurnkeyAccount());
235
- yield account.addSignature(transaction, address);
231
+ catch (err) {
232
+ if (err.message.includes(TURNKEY_API_KEY_EXPIRY_MESSAGE) ||
233
+ err.message.includes(TURNKEY_API_KEY_NOT_FOUND_MESSAGE)) {
234
+ yield this.removeSessionKeys();
235
+ yield this.createOrRestoreSession({
236
+ ignoreRestore: true,
237
+ });
238
+ account = (yield this.getTurnkeyAccount());
239
+ yield account.addSignature(transaction, address);
240
+ }
241
+ else {
242
+ logger.error(`[TK] SubOrg: ${(_a = this.walletProperties) === null || _a === void 0 ? void 0 : _a.turnkeySubOrganizationId} failed to perform activity`, err);
243
+ throw err;
244
+ }
236
245
  }
237
246
  return transaction;
238
247
  });