@dynamic-labs/solana 1.1.0-alpha.14 → 1.1.0-alpha.16

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,31 @@
1
1
 
2
+ ## [1.1.0-alpha.16](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.15...v1.1.0-alpha.16) (2024-01-30)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * add fallback to getWalletBookWallet for customers still passing in name, add deprecation warn ([#4518](https://github.com/dynamic-labs/DynamicAuth/issues/4518)) ([b233ea1](https://github.com/dynamic-labs/DynamicAuth/commit/b233ea1cd640d8d9d94c52ab230787f3d869151a))
8
+ * handle braavos network change to account which doesn not exist ([#4519](https://github.com/dynamic-labs/DynamicAuth/issues/4519)) ([486020f](https://github.com/dynamic-labs/DynamicAuth/commit/486020fb09a274388ba34c8d1b37ac3a1ff3dba6))
9
+
10
+ ## [1.1.0-alpha.15](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.14...v1.1.0-alpha.15) (2024-01-28)
11
+
12
+
13
+ ### Features
14
+
15
+ * add wallet group override to wallet book ([#4488](https://github.com/dynamic-labs/DynamicAuth/issues/4488)) ([cb19ad3](https://github.com/dynamic-labs/DynamicAuth/commit/cb19ad3ea82de488752ceceeaf0e1458a388df6e))
16
+ * enable solana embedded wallets ([#4457](https://github.com/dynamic-labs/DynamicAuth/issues/4457)) ([b0c47f4](https://github.com/dynamic-labs/DynamicAuth/commit/b0c47f4475baa12f52076da46ef993c13bd2c243))
17
+ * group ArgentX wallets ([#4495](https://github.com/dynamic-labs/DynamicAuth/issues/4495)) ([b10d79a](https://github.com/dynamic-labs/DynamicAuth/commit/b10d79a668efecedca37ddb358e6adf95319650d))
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * add support for newest backpack extension ([#4468](https://github.com/dynamic-labs/DynamicAuth/issues/4468)) ([a219f32](https://github.com/dynamic-labs/DynamicAuth/commit/a219f325be672599e50b07f6751234a7fc98286e))
23
+ * bump timeout for slower connections ([#4475](https://github.com/dynamic-labs/DynamicAuth/issues/4475)) ([7a07ff5](https://github.com/dynamic-labs/DynamicAuth/commit/7a07ff589eaaf3b28a94d277df3eedabbca60702))
24
+ * change out getWalletBookWallet for findWalletBookWallet to avoid throwing during lookup ([#4477](https://github.com/dynamic-labs/DynamicAuth/issues/4477)) ([4648040](https://github.com/dynamic-labs/DynamicAuth/commit/4648040c166e73dd2c31b0e27897713339436c2f))
25
+ * connect to wallet with wallet connect even if network is not supported ([#4465](https://github.com/dynamic-labs/DynamicAuth/issues/4465)) ([9dbca3e](https://github.com/dynamic-labs/DynamicAuth/commit/9dbca3eb4d4990ee4be642677c1604170b425dc3))
26
+ * pass id to wagmi chain override ([#4512](https://github.com/dynamic-labs/DynamicAuth/issues/4512)) ([2bf2f04](https://github.com/dynamic-labs/DynamicAuth/commit/2bf2f0487f5b1be936dd279107c11fe5d2b42666))
27
+ * switching wallet in extension caused connected flag to be false temporarily ([#4454](https://github.com/dynamic-labs/DynamicAuth/issues/4454)) ([3650f6e](https://github.com/dynamic-labs/DynamicAuth/commit/3650f6ec471a7c779f4d304ab94c9350dd55055b))
28
+
2
29
  ## [1.1.0-alpha.14](https://github.com/dynamic-labs/DynamicAuth/compare/v1.1.0-alpha.13...v1.1.0-alpha.14) (2024-01-23)
3
30
 
4
31
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/solana",
3
- "version": "1.1.0-alpha.14",
3
+ "version": "1.1.0-alpha.16",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/dynamic-labs/DynamicAuth.git",
@@ -27,12 +27,13 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@solana/web3.js": "1.70.1",
30
- "@dynamic-labs/sdk-api": "0.0.352",
31
- "@dynamic-labs/rpc-providers": "1.1.0-alpha.14",
32
- "@dynamic-labs/types": "1.1.0-alpha.14",
33
- "@dynamic-labs/utils": "1.1.0-alpha.14",
34
- "@dynamic-labs/wallet-book": "1.1.0-alpha.14",
35
- "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.14",
30
+ "@dynamic-labs/sdk-api": "0.0.356",
31
+ "@dynamic-labs/rpc-providers": "1.1.0-alpha.16",
32
+ "@dynamic-labs/turnkey": "1.1.0-alpha.16",
33
+ "@dynamic-labs/types": "1.1.0-alpha.16",
34
+ "@dynamic-labs/utils": "1.1.0-alpha.16",
35
+ "@dynamic-labs/wallet-book": "1.1.0-alpha.16",
36
+ "@dynamic-labs/wallet-connector-core": "1.1.0-alpha.16",
36
37
  "eventemitter3": "5.0.1"
37
38
  },
38
39
  "peerDependencies": {}
@@ -5,6 +5,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var _tslib = require('../_virtual/_tslib.cjs');
6
6
  var utils = require('@dynamic-labs/utils');
7
7
  var walletBook = require('@dynamic-labs/wallet-book');
8
+ require('@dynamic-labs/turnkey');
9
+ require('@dynamic-labs/sdk-api');
8
10
  var InjectedWalletBase = require('./injected/InjectedWalletBase.cjs');
9
11
  require('@solana/web3.js');
10
12
  require('@dynamic-labs/wallet-connector-core');
@@ -1,6 +1,8 @@
1
1
  import { __awaiter } from '../_virtual/_tslib.js';
2
2
  import { bufferToBase64 } from '@dynamic-labs/utils';
3
3
  import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
4
+ import '@dynamic-labs/turnkey';
5
+ import '@dynamic-labs/sdk-api';
4
6
  import { InjectedWalletBase } from './injected/InjectedWalletBase.js';
5
7
  import '@solana/web3.js';
6
8
  import '@dynamic-labs/wallet-connector-core';
package/src/index.cjs CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
+ var turnkey = require('@dynamic-labs/turnkey');
6
+ var sdkApi = require('@dynamic-labs/sdk-api');
5
7
  var fetchInjectedWalletConnectors = require('./injected/fetchInjectedWalletConnectors.cjs');
6
8
  var isSignedMessage = require('./utils/isSignedMessage.cjs');
7
9
  var isBackpackSolanaSigner = require('./utils/isBackpackSolanaSigner.cjs');
@@ -10,6 +12,7 @@ var isBackpackSolanaSigner = require('./utils/isBackpackSolanaSigner.cjs');
10
12
  const SolanaWalletConnectors = (props) => [
11
13
  ...fetchInjectedWalletConnectors.injectedWalletOverrides,
12
14
  ...fetchInjectedWalletConnectors.fetchInjectedWalletConnectors(props),
15
+ ...turnkey.TurnkeyWalletConnectors(props, sdkApi.ChainEnum.Sol),
13
16
  ];
14
17
 
15
18
  exports.isSignedMessage = isSignedMessage.isSignedMessage;
package/src/index.js CHANGED
@@ -1,3 +1,5 @@
1
+ import { TurnkeyWalletConnectors } from '@dynamic-labs/turnkey';
2
+ import { ChainEnum } from '@dynamic-labs/sdk-api';
1
3
  import { injectedWalletOverrides, fetchInjectedWalletConnectors } from './injected/fetchInjectedWalletConnectors.js';
2
4
  export { isSignedMessage } from './utils/isSignedMessage.js';
3
5
  export { isBackpackSolanaSigner } from './utils/isBackpackSolanaSigner.js';
@@ -6,6 +8,7 @@ export { isBackpackSolanaSigner } from './utils/isBackpackSolanaSigner.js';
6
8
  const SolanaWalletConnectors = (props) => [
7
9
  ...injectedWalletOverrides,
8
10
  ...fetchInjectedWalletConnectors(props),
11
+ ...TurnkeyWalletConnectors(props, ChainEnum.Sol),
9
12
  ];
10
13
 
11
14
  export { SolanaWalletConnectors };
@@ -33,6 +33,9 @@ class BackpackSol extends InjectedWalletBase.InjectedWalletBase {
33
33
  if (!signedMessage) {
34
34
  return undefined;
35
35
  }
36
+ if (typeof signedMessage === 'object' && 'signature' in signedMessage) {
37
+ return utils.bufferToBase64(signedMessage.signature);
38
+ }
36
39
  return utils.bufferToBase64(signedMessage);
37
40
  });
38
41
  }
@@ -29,6 +29,9 @@ class BackpackSol extends InjectedWalletBase {
29
29
  if (!signedMessage) {
30
30
  return undefined;
31
31
  }
32
+ if (typeof signedMessage === 'object' && 'signature' in signedMessage) {
33
+ return bufferToBase64(signedMessage.signature);
34
+ }
32
35
  return bufferToBase64(signedMessage);
33
36
  });
34
37
  }
@@ -11,52 +11,59 @@ var SignMessageNotSupportedError = require('../errors/SignMessageNotSupportedErr
11
11
  class InjectedWalletBase extends solWalletConnector.SolWalletConnector {
12
12
  getSolProviderHelper() {
13
13
  if (!this.wallet) {
14
- this.wallet = walletBook.getWalletBookWallet(this.walletBook, this.key);
14
+ this.wallet = walletBook.findWalletBookWallet(this.walletBook, this.key);
15
15
  }
16
- if (!this.solProviderHelper) {
16
+ if (this.wallet && !this.solProviderHelper) {
17
17
  this.solProviderHelper = new solProviderHelper.SolProviderHelper(this.wallet);
18
18
  }
19
- // adding the forced typing below to avoid having to null check in other methods
20
19
  return this.solProviderHelper;
21
20
  }
22
21
  setupEventListeners() {
23
- this.getSolProviderHelper()._setupEventListeners(this);
22
+ var _a;
23
+ (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a._setupEventListeners(this);
24
24
  }
25
25
  teardownEventListeners() {
26
- this.getSolProviderHelper()._teardownEventListeners();
26
+ var _a;
27
+ (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a._teardownEventListeners();
27
28
  }
28
29
  connect() {
30
+ var _a;
29
31
  return _tslib.__awaiter(this, void 0, void 0, function* () {
30
- yield this.getSolProviderHelper().connect();
32
+ yield ((_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.connect());
31
33
  });
32
34
  }
33
35
  getSigner() {
36
+ var _a;
34
37
  return _tslib.__awaiter(this, void 0, void 0, function* () {
35
- return this.getSolProviderHelper().connect();
38
+ return (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.connect();
36
39
  });
37
40
  }
38
41
  isInstalledOnBrowser() {
39
- return this.getSolProviderHelper().isInstalledHelper();
42
+ var _a;
43
+ return Boolean((_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.isInstalledHelper());
40
44
  }
41
45
  fetchPublicAddress() {
46
+ var _a;
42
47
  return _tslib.__awaiter(this, void 0, void 0, function* () {
43
48
  if (!this.isInstalledOnBrowser())
44
49
  return;
45
- return this.getSolProviderHelper().fetchPublicAddress();
50
+ return (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.fetchPublicAddress();
46
51
  });
47
52
  }
48
53
  signMessage(messageToSign) {
54
+ var _a, _b;
49
55
  return _tslib.__awaiter(this, void 0, void 0, function* () {
50
- const walletAddress = yield this.getSolProviderHelper().fetchPublicAddress();
56
+ const walletAddress = yield ((_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.fetchPublicAddress());
51
57
  if (walletAddress && this.isLedgerAddress(walletAddress)) {
52
58
  throw new SignMessageNotSupportedError.SignMessageNotSupportedError(this.name);
53
59
  }
54
- return this.getSolProviderHelper().signMessage(messageToSign);
60
+ return (_b = this.getSolProviderHelper()) === null || _b === void 0 ? void 0 : _b.signMessage(messageToSign);
55
61
  });
56
62
  }
57
63
  getConnectedAccounts() {
64
+ var _a, _b;
58
65
  return _tslib.__awaiter(this, void 0, void 0, function* () {
59
- return this.getSolProviderHelper().getConnectedAccounts();
66
+ return (_b = (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.getConnectedAccounts()) !== null && _b !== void 0 ? _b : [];
60
67
  });
61
68
  }
62
69
  }
@@ -5,7 +5,7 @@ import { SolWalletConnector } from '../solWalletConnector';
5
5
  export declare abstract class InjectedWalletBase extends SolWalletConnector {
6
6
  solProviderHelper: SolProviderHelper | undefined;
7
7
  wallet: WalletSchema | undefined;
8
- getSolProviderHelper(): SolProviderHelper;
8
+ getSolProviderHelper(): SolProviderHelper | undefined;
9
9
  setupEventListeners(): void;
10
10
  teardownEventListeners(): void;
11
11
  connect(): Promise<void>;
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from '../../_virtual/_tslib.js';
2
- import { getWalletBookWallet } from '@dynamic-labs/wallet-book';
2
+ import { findWalletBookWallet } from '@dynamic-labs/wallet-book';
3
3
  import { SolProviderHelper } from '../solProviderHelper.js';
4
4
  import { SolWalletConnector } from '../solWalletConnector.js';
5
5
  import { SignMessageNotSupportedError } from '../errors/SignMessageNotSupportedError.js';
@@ -7,52 +7,59 @@ import { SignMessageNotSupportedError } from '../errors/SignMessageNotSupportedE
7
7
  class InjectedWalletBase extends SolWalletConnector {
8
8
  getSolProviderHelper() {
9
9
  if (!this.wallet) {
10
- this.wallet = getWalletBookWallet(this.walletBook, this.key);
10
+ this.wallet = findWalletBookWallet(this.walletBook, this.key);
11
11
  }
12
- if (!this.solProviderHelper) {
12
+ if (this.wallet && !this.solProviderHelper) {
13
13
  this.solProviderHelper = new SolProviderHelper(this.wallet);
14
14
  }
15
- // adding the forced typing below to avoid having to null check in other methods
16
15
  return this.solProviderHelper;
17
16
  }
18
17
  setupEventListeners() {
19
- this.getSolProviderHelper()._setupEventListeners(this);
18
+ var _a;
19
+ (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a._setupEventListeners(this);
20
20
  }
21
21
  teardownEventListeners() {
22
- this.getSolProviderHelper()._teardownEventListeners();
22
+ var _a;
23
+ (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a._teardownEventListeners();
23
24
  }
24
25
  connect() {
26
+ var _a;
25
27
  return __awaiter(this, void 0, void 0, function* () {
26
- yield this.getSolProviderHelper().connect();
28
+ yield ((_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.connect());
27
29
  });
28
30
  }
29
31
  getSigner() {
32
+ var _a;
30
33
  return __awaiter(this, void 0, void 0, function* () {
31
- return this.getSolProviderHelper().connect();
34
+ return (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.connect();
32
35
  });
33
36
  }
34
37
  isInstalledOnBrowser() {
35
- return this.getSolProviderHelper().isInstalledHelper();
38
+ var _a;
39
+ return Boolean((_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.isInstalledHelper());
36
40
  }
37
41
  fetchPublicAddress() {
42
+ var _a;
38
43
  return __awaiter(this, void 0, void 0, function* () {
39
44
  if (!this.isInstalledOnBrowser())
40
45
  return;
41
- return this.getSolProviderHelper().fetchPublicAddress();
46
+ return (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.fetchPublicAddress();
42
47
  });
43
48
  }
44
49
  signMessage(messageToSign) {
50
+ var _a, _b;
45
51
  return __awaiter(this, void 0, void 0, function* () {
46
- const walletAddress = yield this.getSolProviderHelper().fetchPublicAddress();
52
+ const walletAddress = yield ((_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.fetchPublicAddress());
47
53
  if (walletAddress && this.isLedgerAddress(walletAddress)) {
48
54
  throw new SignMessageNotSupportedError(this.name);
49
55
  }
50
- return this.getSolProviderHelper().signMessage(messageToSign);
56
+ return (_b = this.getSolProviderHelper()) === null || _b === void 0 ? void 0 : _b.signMessage(messageToSign);
51
57
  });
52
58
  }
53
59
  getConnectedAccounts() {
60
+ var _a, _b;
54
61
  return __awaiter(this, void 0, void 0, function* () {
55
- return this.getSolProviderHelper().getConnectedAccounts();
62
+ return (_b = (_a = this.getSolProviderHelper()) === null || _a === void 0 ? void 0 : _a.getConnectedAccounts()) !== null && _b !== void 0 ? _b : [];
56
63
  });
57
64
  }
58
65
  }
@@ -18,7 +18,7 @@ export declare class SolProviderHelper {
18
18
  windowLocations?: string[] | undefined;
19
19
  } | undefined;
20
20
  getInstalledProvider(): ISolana | undefined;
21
- installedProviders(): (import("./types").ISolanaSigner | import("./types").ICoinbaseSolanaSigner)[];
21
+ installedProviders(): (import("./types").ISolanaSigner | import("./types").IBackpackSolanaSigner | import("./types").ICoinbaseSolanaSigner)[];
22
22
  installedProviderLookup(providerFlags: Array<ProviderCondition<ProviderFlag>>): ISolana | undefined;
23
23
  findProvider(): ISolana | undefined;
24
24
  isInstalledHelper(): boolean;
package/src/types.d.ts CHANGED
@@ -55,8 +55,11 @@ export type ISolanaSigner = {
55
55
  }) => Promise<ConnectionResult>;
56
56
  disconnect(): Promise<void>;
57
57
  };
58
+ type BackpackSolanaSignerResponse = {
59
+ signature: Uint8Array;
60
+ };
58
61
  export type IBackpackSolanaSigner = Omit<ISolanaSigner, 'signMessage'> & {
59
- signMessage: (message: Uint8Array, encoding?: string) => Promise<void | Uint8Array>;
62
+ signMessage: (message: Uint8Array, encoding?: string) => Promise<void | BackpackSolanaSignerResponse | Uint8Array>;
60
63
  send: (transaction: Transaction, signers?: Signer[], options?: SendOptions, connection?: Connection, publicKey?: PublicKey) => Promise<TransactionSignature>;
61
64
  };
62
65
  export type ICoinbaseSolanaSigner = Omit<ISolanaSigner, 'signMessage'> & {