@dynamic-labs/solana 4.4.4 → 4.5.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 +14 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +11 -11
- package/src/injected/fetchInjectedWalletConnectors.cjs +4 -4
- package/src/injected/fetchInjectedWalletConnectors.d.ts +3 -1
- package/src/injected/fetchInjectedWalletConnectors.js +4 -4
- package/src/injected/walletStandard/createSolanaSignerFromWalletStandard/createSolanaSignerFromWalletStandard.cjs +14 -2
- package/src/injected/walletStandard/createSolanaSignerFromWalletStandard/createSolanaSignerFromWalletStandard.js +14 -2
- package/src/injected/walletStandard/hasAllWalletStandardRequiredFeatures/hasAllWalletStandardRequiredFeatures.cjs +8 -6
- package/src/injected/walletStandard/hasAllWalletStandardRequiredFeatures/hasAllWalletStandardRequiredFeatures.d.ts +2 -1
- package/src/injected/walletStandard/hasAllWalletStandardRequiredFeatures/hasAllWalletStandardRequiredFeatures.js +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
|
|
2
|
+
## [4.5.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.4.4...v4.5.0) (2025-02-04)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* allow injecting onramp providers for funding via sdk overrides ([#7967](https://github.com/dynamic-labs/dynamic-auth/issues/7967)) ([d738b3b](https://github.com/dynamic-labs/dynamic-auth/commit/d738b3ba1307bc6f2ffc5c8f98a44c6f509c0e96))
|
|
8
|
+
* headless transaction simulation ([#7928](https://github.com/dynamic-labs/dynamic-auth/issues/7928)) ([8eb4c9c](https://github.com/dynamic-labs/dynamic-auth/commit/8eb4c9cd9857a34c56f2e58aba124b5b7e185359))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* memo hooks and state to reduce rerenders ([#7912](https://github.com/dynamic-labs/dynamic-auth/issues/7912)) ([5351570](https://github.com/dynamic-labs/dynamic-auth/commit/5351570874eb3b9465d2a2c99ea5caaa787ecc80))
|
|
14
|
+
* rely on bitcoin sats-connect transaction inputs for handling sigHashTypes ([#7969](https://github.com/dynamic-labs/dynamic-auth/issues/7969)) ([e043306](https://github.com/dynamic-labs/dynamic-auth/commit/e043306be44dd9058265c19d7e14cb07dd6db1fe))
|
|
15
|
+
|
|
2
16
|
### [4.4.4](https://github.com/dynamic-labs/dynamic-auth/compare/v4.4.3...v4.4.4) (2025-01-31)
|
|
3
17
|
|
|
4
18
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.0",
|
|
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",
|
|
@@ -25,16 +25,16 @@
|
|
|
25
25
|
"@wallet-standard/experimental-features": "0.1.1",
|
|
26
26
|
"bs58": "5.0.0",
|
|
27
27
|
"tweetnacl": "1.0.3",
|
|
28
|
-
"@dynamic-labs/assert-package-version": "4.
|
|
29
|
-
"@dynamic-labs/embedded-wallet-solana": "4.
|
|
30
|
-
"@dynamic-labs/logger": "4.
|
|
31
|
-
"@dynamic-labs/rpc-providers": "4.
|
|
32
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
33
|
-
"@dynamic-labs/solana-core": "4.
|
|
34
|
-
"@dynamic-labs/types": "4.
|
|
35
|
-
"@dynamic-labs/utils": "4.
|
|
36
|
-
"@dynamic-labs/wallet-book": "4.
|
|
37
|
-
"@dynamic-labs/wallet-connector-core": "4.
|
|
28
|
+
"@dynamic-labs/assert-package-version": "4.5.0",
|
|
29
|
+
"@dynamic-labs/embedded-wallet-solana": "4.5.0",
|
|
30
|
+
"@dynamic-labs/logger": "4.5.0",
|
|
31
|
+
"@dynamic-labs/rpc-providers": "4.5.0",
|
|
32
|
+
"@dynamic-labs/sdk-api-core": "0.0.607",
|
|
33
|
+
"@dynamic-labs/solana-core": "4.5.0",
|
|
34
|
+
"@dynamic-labs/types": "4.5.0",
|
|
35
|
+
"@dynamic-labs/utils": "4.5.0",
|
|
36
|
+
"@dynamic-labs/wallet-book": "4.5.0",
|
|
37
|
+
"@dynamic-labs/wallet-connector-core": "4.5.0"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {}
|
|
40
40
|
}
|
|
@@ -27,7 +27,7 @@ const walletsWithCustomConnectors = [
|
|
|
27
27
|
'backpacksol',
|
|
28
28
|
'solflare',
|
|
29
29
|
];
|
|
30
|
-
const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
30
|
+
const shouldAddWalletStandardConnector = (wallet, walletBook, authMode) => {
|
|
31
31
|
var _a;
|
|
32
32
|
const { name } = wallet;
|
|
33
33
|
const chain = 'sol';
|
|
@@ -45,7 +45,7 @@ const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
|
45
45
|
isNotWalletStandard);
|
|
46
46
|
};
|
|
47
47
|
const shouldHandleFromWalletBook = Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).find(shouldHandleWalletFromWalletBook);
|
|
48
|
-
const hasAllFeatures = hasAllWalletStandardRequiredFeatures.hasAllWalletStandardRequiredFeatures(wallet);
|
|
48
|
+
const hasAllFeatures = hasAllWalletStandardRequiredFeatures.hasAllWalletStandardRequiredFeatures(wallet, authMode);
|
|
49
49
|
logger.logger.logVerboseTroubleshootingMessage('[SOL shouldAddWalletStandardConnector]', {
|
|
50
50
|
hasAllFeatures,
|
|
51
51
|
shouldAdd: !shouldHandleFromWalletBook && hasAllFeatures,
|
|
@@ -53,7 +53,7 @@ const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
|
53
53
|
});
|
|
54
54
|
return !shouldHandleFromWalletBook && hasAllFeatures;
|
|
55
55
|
};
|
|
56
|
-
const fetchInjectedWalletConnectors = ({ walletBook: walletBook$1, }) => {
|
|
56
|
+
const fetchInjectedWalletConnectors = ({ walletBook: walletBook$1, authMode, }) => {
|
|
57
57
|
var _a;
|
|
58
58
|
const walletBookConnectors = Object.entries((_a = walletBook$1 === null || walletBook$1 === void 0 ? void 0 : walletBook$1.wallets) !== null && _a !== void 0 ? _a : {})
|
|
59
59
|
.filter(([key, wallet]) => {
|
|
@@ -80,7 +80,7 @@ const fetchInjectedWalletConnectors = ({ walletBook: walletBook$1, }) => {
|
|
|
80
80
|
});
|
|
81
81
|
const walletStandardWallets = getWalletStandardWallets.getWalletStandardWallets();
|
|
82
82
|
const walletStandardConnectors = walletStandardWallets
|
|
83
|
-
.filter((wallet) => shouldAddWalletStandardConnector(wallet, walletBook$1))
|
|
83
|
+
.filter((wallet) => shouldAddWalletStandardConnector(wallet, walletBook$1, authMode))
|
|
84
84
|
.map((wallet) => {
|
|
85
85
|
const walletBookWallet = walletBook.findWalletBookWalletByNameAndChain(walletBook$1, wallet.name, 'sol');
|
|
86
86
|
// if the wallet book wallet is found, we want to use it to get the metadata
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { WalletBookSchema } from '@dynamic-labs/wallet-book';
|
|
2
2
|
import { WalletConnectorConstructor } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import type { AuthMode } from '@dynamic-labs/types';
|
|
3
4
|
export declare const injectedWalletOverrides: WalletConnectorConstructor[];
|
|
4
|
-
export declare const fetchInjectedWalletConnectors: ({ walletBook, }: {
|
|
5
|
+
export declare const fetchInjectedWalletConnectors: ({ walletBook, authMode, }: {
|
|
5
6
|
walletBook: WalletBookSchema;
|
|
7
|
+
authMode: AuthMode;
|
|
6
8
|
}) => WalletConnectorConstructor[];
|
|
@@ -23,7 +23,7 @@ const walletsWithCustomConnectors = [
|
|
|
23
23
|
'backpacksol',
|
|
24
24
|
'solflare',
|
|
25
25
|
];
|
|
26
|
-
const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
26
|
+
const shouldAddWalletStandardConnector = (wallet, walletBook, authMode) => {
|
|
27
27
|
var _a;
|
|
28
28
|
const { name } = wallet;
|
|
29
29
|
const chain = 'sol';
|
|
@@ -41,7 +41,7 @@ const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
|
41
41
|
isNotWalletStandard);
|
|
42
42
|
};
|
|
43
43
|
const shouldHandleFromWalletBook = Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {}).find(shouldHandleWalletFromWalletBook);
|
|
44
|
-
const hasAllFeatures = hasAllWalletStandardRequiredFeatures(wallet);
|
|
44
|
+
const hasAllFeatures = hasAllWalletStandardRequiredFeatures(wallet, authMode);
|
|
45
45
|
logger.logVerboseTroubleshootingMessage('[SOL shouldAddWalletStandardConnector]', {
|
|
46
46
|
hasAllFeatures,
|
|
47
47
|
shouldAdd: !shouldHandleFromWalletBook && hasAllFeatures,
|
|
@@ -49,7 +49,7 @@ const shouldAddWalletStandardConnector = (wallet, walletBook) => {
|
|
|
49
49
|
});
|
|
50
50
|
return !shouldHandleFromWalletBook && hasAllFeatures;
|
|
51
51
|
};
|
|
52
|
-
const fetchInjectedWalletConnectors = ({ walletBook, }) => {
|
|
52
|
+
const fetchInjectedWalletConnectors = ({ walletBook, authMode, }) => {
|
|
53
53
|
var _a;
|
|
54
54
|
const walletBookConnectors = Object.entries((_a = walletBook === null || walletBook === void 0 ? void 0 : walletBook.wallets) !== null && _a !== void 0 ? _a : {})
|
|
55
55
|
.filter(([key, wallet]) => {
|
|
@@ -76,7 +76,7 @@ const fetchInjectedWalletConnectors = ({ walletBook, }) => {
|
|
|
76
76
|
});
|
|
77
77
|
const walletStandardWallets = getWalletStandardWallets();
|
|
78
78
|
const walletStandardConnectors = walletStandardWallets
|
|
79
|
-
.filter((wallet) => shouldAddWalletStandardConnector(wallet, walletBook))
|
|
79
|
+
.filter((wallet) => shouldAddWalletStandardConnector(wallet, walletBook, authMode))
|
|
80
80
|
.map((wallet) => {
|
|
81
81
|
const walletBookWallet = findWalletBookWalletByNameAndChain(walletBook, wallet.name, 'sol');
|
|
82
82
|
// if the wallet book wallet is found, we want to use it to get the metadata
|
|
@@ -67,8 +67,14 @@ const createSolanaSignerFromWalletStandard = ({ wallet, walletConnector, network
|
|
|
67
67
|
});
|
|
68
68
|
const signAllTransactions = (transactions) => _tslib.__awaiter(void 0, void 0, void 0, function* () { return Promise.all(transactions.map(signTransaction)); });
|
|
69
69
|
const signAndSendTransaction = (transaction) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
70
|
+
var _e;
|
|
71
|
+
const signAndSendTransactionMethod = (_e = features['solana:signAndSendTransaction']) === null || _e === void 0 ? void 0 : _e.signAndSendTransaction;
|
|
72
|
+
if (!signAndSendTransactionMethod) {
|
|
73
|
+
logger.logger.error('signAndSendTransaction - Not implemented');
|
|
74
|
+
throw new Error('signAndSendTransaction - Not implemented by wallet');
|
|
75
|
+
}
|
|
70
76
|
const account = yield getCurrentAccount();
|
|
71
|
-
const signedTransactions = yield
|
|
77
|
+
const signedTransactions = yield signAndSendTransactionMethod({
|
|
72
78
|
account,
|
|
73
79
|
chain: yield getChain(),
|
|
74
80
|
transaction: transaction.serialize(),
|
|
@@ -77,8 +83,14 @@ const createSolanaSignerFromWalletStandard = ({ wallet, walletConnector, network
|
|
|
77
83
|
return { signature: new TextDecoder().decode(signature) };
|
|
78
84
|
});
|
|
79
85
|
const signMessage = (message) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
|
|
86
|
+
var _f;
|
|
87
|
+
const signMessageMethod = (_f = features['solana:signMessage']) === null || _f === void 0 ? void 0 : _f.signMessage;
|
|
88
|
+
if (!signMessageMethod) {
|
|
89
|
+
logger.logger.error('signMessage - Not implemented');
|
|
90
|
+
throw new Error('signMessage - Not implemented by wallet');
|
|
91
|
+
}
|
|
80
92
|
const account = yield getCurrentAccount();
|
|
81
|
-
const messages = yield
|
|
93
|
+
const messages = yield signMessageMethod({
|
|
82
94
|
account,
|
|
83
95
|
message,
|
|
84
96
|
});
|
|
@@ -63,8 +63,14 @@ const createSolanaSignerFromWalletStandard = ({ wallet, walletConnector, network
|
|
|
63
63
|
});
|
|
64
64
|
const signAllTransactions = (transactions) => __awaiter(void 0, void 0, void 0, function* () { return Promise.all(transactions.map(signTransaction)); });
|
|
65
65
|
const signAndSendTransaction = (transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
+
var _e;
|
|
67
|
+
const signAndSendTransactionMethod = (_e = features['solana:signAndSendTransaction']) === null || _e === void 0 ? void 0 : _e.signAndSendTransaction;
|
|
68
|
+
if (!signAndSendTransactionMethod) {
|
|
69
|
+
logger.error('signAndSendTransaction - Not implemented');
|
|
70
|
+
throw new Error('signAndSendTransaction - Not implemented by wallet');
|
|
71
|
+
}
|
|
66
72
|
const account = yield getCurrentAccount();
|
|
67
|
-
const signedTransactions = yield
|
|
73
|
+
const signedTransactions = yield signAndSendTransactionMethod({
|
|
68
74
|
account,
|
|
69
75
|
chain: yield getChain(),
|
|
70
76
|
transaction: transaction.serialize(),
|
|
@@ -73,8 +79,14 @@ const createSolanaSignerFromWalletStandard = ({ wallet, walletConnector, network
|
|
|
73
79
|
return { signature: new TextDecoder().decode(signature) };
|
|
74
80
|
});
|
|
75
81
|
const signMessage = (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
82
|
+
var _f;
|
|
83
|
+
const signMessageMethod = (_f = features['solana:signMessage']) === null || _f === void 0 ? void 0 : _f.signMessage;
|
|
84
|
+
if (!signMessageMethod) {
|
|
85
|
+
logger.error('signMessage - Not implemented');
|
|
86
|
+
throw new Error('signMessage - Not implemented by wallet');
|
|
87
|
+
}
|
|
76
88
|
const account = yield getCurrentAccount();
|
|
77
|
-
const messages = yield
|
|
89
|
+
const messages = yield signMessageMethod({
|
|
78
90
|
account,
|
|
79
91
|
message,
|
|
80
92
|
});
|
|
@@ -3,13 +3,15 @@
|
|
|
3
3
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
|
-
const hasAllWalletStandardRequiredFeatures = (wallet) => {
|
|
7
|
-
var _a, _b, _c, _d
|
|
8
|
-
|
|
6
|
+
const hasAllWalletStandardRequiredFeatures = (wallet, authMode = 'connect-and-sign') => {
|
|
7
|
+
var _a, _b, _c, _d;
|
|
8
|
+
const hasBasicFeatures = Boolean(((_a = wallet.features) === null || _a === void 0 ? void 0 : _a['standard:events']) &&
|
|
9
9
|
((_b = wallet.features) === null || _b === void 0 ? void 0 : _b['standard:connect']) &&
|
|
10
|
-
((_c = wallet.features) === null || _c === void 0 ? void 0 : _c['solana:
|
|
11
|
-
|
|
12
|
-
((
|
|
10
|
+
((_c = wallet.features) === null || _c === void 0 ? void 0 : _c['solana:signTransaction']));
|
|
11
|
+
const hasAuthModeFeatures = authMode === 'connect-and-sign'
|
|
12
|
+
? Boolean((_d = wallet.features) === null || _d === void 0 ? void 0 : _d['solana:signMessage'])
|
|
13
|
+
: true;
|
|
14
|
+
return hasBasicFeatures && hasAuthModeFeatures;
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
exports.hasAllWalletStandardRequiredFeatures = hasAllWalletStandardRequiredFeatures;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import { Wallet } from '@wallet-standard/base';
|
|
2
|
-
|
|
2
|
+
import type { AuthMode } from '@dynamic-labs/types';
|
|
3
|
+
export declare const hasAllWalletStandardRequiredFeatures: (wallet: Wallet, authMode?: AuthMode) => boolean;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
'use client'
|
|
2
|
-
const hasAllWalletStandardRequiredFeatures = (wallet) => {
|
|
3
|
-
var _a, _b, _c, _d
|
|
4
|
-
|
|
2
|
+
const hasAllWalletStandardRequiredFeatures = (wallet, authMode = 'connect-and-sign') => {
|
|
3
|
+
var _a, _b, _c, _d;
|
|
4
|
+
const hasBasicFeatures = Boolean(((_a = wallet.features) === null || _a === void 0 ? void 0 : _a['standard:events']) &&
|
|
5
5
|
((_b = wallet.features) === null || _b === void 0 ? void 0 : _b['standard:connect']) &&
|
|
6
|
-
((_c = wallet.features) === null || _c === void 0 ? void 0 : _c['solana:
|
|
7
|
-
|
|
8
|
-
((
|
|
6
|
+
((_c = wallet.features) === null || _c === void 0 ? void 0 : _c['solana:signTransaction']));
|
|
7
|
+
const hasAuthModeFeatures = authMode === 'connect-and-sign'
|
|
8
|
+
? Boolean((_d = wallet.features) === null || _d === void 0 ? void 0 : _d['solana:signMessage'])
|
|
9
|
+
: true;
|
|
10
|
+
return hasBasicFeatures && hasAuthModeFeatures;
|
|
9
11
|
};
|
|
10
12
|
|
|
11
13
|
export { hasAllWalletStandardRequiredFeatures };
|