@dynamic-labs/solana-core 5.4.1 → 5.6.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 +22 -0
- package/package.cjs +1 -1
- package/package.js +1 -1
- package/package.json +7 -7
- package/src/connector/SolanaWalletConnector.cjs +1 -0
- package/src/connector/SolanaWalletConnector.js +1 -0
- package/src/index.cjs +2 -0
- package/src/index.js +1 -0
- package/src/rpc/RpcProviderSolana/RpcProviderSolana.cjs +2 -0
- package/src/rpc/RpcProviderSolana/RpcProviderSolana.js +2 -0
- package/src/utils/index.d.ts +1 -0
- package/src/utils/screenSolanaTransactions/index.d.ts +1 -0
- package/src/utils/screenSolanaTransactions/screenSolanaTransactions.cjs +42 -0
- package/src/utils/screenSolanaTransactions/screenSolanaTransactions.d.ts +13 -0
- package/src/utils/screenSolanaTransactions/screenSolanaTransactions.js +38 -0
- package/src/wallet/SolanaWallet.cjs +16 -42
- package/src/wallet/SolanaWallet.d.ts +0 -6
- package/src/wallet/SolanaWallet.js +16 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,26 @@
|
|
|
1
1
|
|
|
2
|
+
## [5.6.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.5.0...v5.6.0) (2026-09-01)
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* forward target signer passwords ([#12300](https://github.com/dynamic-labs/dynamic-auth/issues/12300)) ([39b142b](https://github.com/dynamic-labs/dynamic-auth/commit/39b142b51767ad54ae57196a381bec19a892c06f))
|
|
8
|
+
|
|
9
|
+
## [5.5.0](https://github.com/dynamic-labs/dynamic-auth/compare/v5.4.1...v5.5.0) (2026-08-31)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
* **waas-evm:** route embedded EVM sends through gas sponsorship when enabled ([#12306](https://github.com/dynamic-labs/dynamic-auth/issues/12306)) ([6046ff3](https://github.com/dynamic-labs/dynamic-auth/commit/6046ff362d8de9402793bdaa7319fda645ff4c04))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* **bitcoin:** resolve the active BTC wallet and network correctly across the widget ([#12308](https://github.com/dynamic-labs/dynamic-auth/issues/12308)) ([13e9eae](https://github.com/dynamic-labs/dynamic-auth/commit/13e9eaec19b3925db507c878988cfd82da5a6de6))
|
|
20
|
+
* **btc:** unbreak BTC transaction confirmation, testnet balances and taproot testnet switching ([#12305](https://github.com/dynamic-labs/dynamic-auth/issues/12305)) ([5fd999c](https://github.com/dynamic-labs/dynamic-auth/commit/5fd999c4c819d3a74e967c0cfa77c5877a74906b))
|
|
21
|
+
* **react-native-extension:** stop leaking expo-secure-store into consumer autolinking ([#12296](https://github.com/dynamic-labs/dynamic-auth/issues/12296)) ([1e0396a](https://github.com/dynamic-labs/dynamic-auth/commit/1e0396ab00c79aa0b2f45b6d7b1d339c1dac1203)), closes [#12254](https://github.com/dynamic-labs/dynamic-auth/issues/12254)
|
|
22
|
+
* **screening:** wire connected-wallet screening into the Send Balance UI (DYNT-1663) ([#12303](https://github.com/dynamic-labs/dynamic-auth/issues/12303)) ([5d26ff3](https://github.com/dynamic-labs/dynamic-auth/commit/5d26ff375118302522c39bd2f1fa9e04f7378eaf))
|
|
23
|
+
|
|
2
24
|
### [5.4.1](https://github.com/dynamic-labs/dynamic-auth/compare/v5.4.0...v5.4.1) (2026-08-26)
|
|
3
25
|
|
|
4
26
|
|
package/package.cjs
CHANGED
package/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs/solana-core",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "Core package for utilities and types for solana",
|
|
5
5
|
"author": "Dynamic Labs, Inc.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"homepage": "https://www.dynamic.xyz/",
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@dynamic-labs/sdk-api-core": "0.12.0",
|
|
22
|
-
"@dynamic-labs/utils": "5.
|
|
22
|
+
"@dynamic-labs/utils": "5.6.0",
|
|
23
23
|
"@solana/web3.js": "1.98.1",
|
|
24
24
|
"@solana/spl-token": "0.4.14",
|
|
25
|
-
"@dynamic-labs/assert-package-version": "5.
|
|
26
|
-
"@dynamic-labs/rpc-providers": "5.
|
|
27
|
-
"@dynamic-labs/types": "5.
|
|
28
|
-
"@dynamic-labs/wallet-book": "5.
|
|
29
|
-
"@dynamic-labs/wallet-connector-core": "5.
|
|
25
|
+
"@dynamic-labs/assert-package-version": "5.6.0",
|
|
26
|
+
"@dynamic-labs/rpc-providers": "5.6.0",
|
|
27
|
+
"@dynamic-labs/types": "5.6.0",
|
|
28
|
+
"@dynamic-labs/wallet-book": "5.6.0",
|
|
29
|
+
"@dynamic-labs/wallet-connector-core": "5.6.0",
|
|
30
30
|
"eventemitter3": "5.0.1"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {}
|
|
@@ -13,6 +13,7 @@ var getOverrideRpcUrlForNetwork = require('../utils/getOverrideRpcUrlForNetwork/
|
|
|
13
13
|
require('@solana/spl-token');
|
|
14
14
|
var constants = require('../constants.cjs');
|
|
15
15
|
var getBackwardsCompatibleSolNetworks = require('../utils/getBackwardsCompatibleSolNetworks/getBackwardsCompatibleSolNetworks.cjs');
|
|
16
|
+
require('@dynamic-labs/types');
|
|
16
17
|
|
|
17
18
|
const MEMO_PROGRAM_ID = new web3_js.PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
|
|
18
19
|
class SolanaWalletConnector extends walletConnectorCore.WalletConnectorBase {
|
|
@@ -9,6 +9,7 @@ import { getOverrideRpcUrlForNetwork } from '../utils/getOverrideRpcUrlForNetwor
|
|
|
9
9
|
import '@solana/spl-token';
|
|
10
10
|
import { DYNAMIC_SVM_NETWORK_ID_LS_KEY } from '../constants.js';
|
|
11
11
|
import { getBackwardsCompatibleSolNetworks } from '../utils/getBackwardsCompatibleSolNetworks/getBackwardsCompatibleSolNetworks.js';
|
|
12
|
+
import '@dynamic-labs/types';
|
|
12
13
|
|
|
13
14
|
const MEMO_PROGRAM_ID = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr');
|
|
14
15
|
class SolanaWalletConnector extends WalletConnectorBase {
|
package/src/index.cjs
CHANGED
|
@@ -20,6 +20,7 @@ var createNonNativeTokenTransfer = require('./utils/createNonNativeTokenTransfer
|
|
|
20
20
|
var createSolTransfer = require('./utils/createSolTransfer/createSolTransfer.cjs');
|
|
21
21
|
var getBackwardsCompatibleSolNetworks = require('./utils/getBackwardsCompatibleSolNetworks/getBackwardsCompatibleSolNetworks.cjs');
|
|
22
22
|
var serializeTransactionForScreening = require('./utils/serializeTransactionForScreening/serializeTransactionForScreening.cjs');
|
|
23
|
+
var screenSolanaTransactions = require('./utils/screenSolanaTransactions/screenSolanaTransactions.cjs');
|
|
23
24
|
var SolanaWallet = require('./wallet/SolanaWallet.cjs');
|
|
24
25
|
var isSolanaWallet = require('./wallet/isSolanaWallet/isSolanaWallet.cjs');
|
|
25
26
|
var isLedgerSolanaWallet = require('./wallet/isLedgerSolanaWallet/isLedgerSolanaWallet.cjs');
|
|
@@ -40,6 +41,7 @@ exports.createNonNativeTokenTransfer = createNonNativeTokenTransfer.createNonNat
|
|
|
40
41
|
exports.createSolTransfer = createSolTransfer.createSolTransfer;
|
|
41
42
|
exports.getBackwardsCompatibleSolNetworks = getBackwardsCompatibleSolNetworks.getBackwardsCompatibleSolNetworks;
|
|
42
43
|
exports.serializeTransactionForScreening = serializeTransactionForScreening.serializeTransactionForScreening;
|
|
44
|
+
exports.screenSolanaTransactions = screenSolanaTransactions.screenSolanaTransactions;
|
|
43
45
|
exports.SolanaWallet = SolanaWallet.SolanaWallet;
|
|
44
46
|
exports.isSolanaWallet = isSolanaWallet.isSolanaWallet;
|
|
45
47
|
exports.isLedgerSolanaWallet = isLedgerSolanaWallet.isLedgerSolanaWallet;
|
package/src/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { createNonNativeTokenTransfer } from './utils/createNonNativeTokenTransf
|
|
|
16
16
|
export { createSolTransfer } from './utils/createSolTransfer/createSolTransfer.js';
|
|
17
17
|
export { getBackwardsCompatibleSolNetworks } from './utils/getBackwardsCompatibleSolNetworks/getBackwardsCompatibleSolNetworks.js';
|
|
18
18
|
export { serializeTransactionForScreening } from './utils/serializeTransactionForScreening/serializeTransactionForScreening.js';
|
|
19
|
+
export { screenSolanaTransactions } from './utils/screenSolanaTransactions/screenSolanaTransactions.js';
|
|
19
20
|
export { SolanaWallet } from './wallet/SolanaWallet.js';
|
|
20
21
|
export { isSolanaWallet } from './wallet/isSolanaWallet/isSolanaWallet.js';
|
|
21
22
|
export { isLedgerSolanaWallet } from './wallet/isLedgerSolanaWallet/isLedgerSolanaWallet.js';
|
|
@@ -7,6 +7,8 @@ require('../../../_virtual/_tslib.cjs');
|
|
|
7
7
|
require('@solana/spl-token');
|
|
8
8
|
require('@dynamic-labs/utils');
|
|
9
9
|
var getOverrideRpcUrlForNetwork = require('../../utils/getOverrideRpcUrlForNetwork/getOverrideRpcUrlForNetwork.cjs');
|
|
10
|
+
require('@dynamic-labs/types');
|
|
11
|
+
require('@dynamic-labs/wallet-connector-core');
|
|
10
12
|
|
|
11
13
|
rpcProviders.ChainRpcProviders.getSolanaProviderByChainId = (rpcProviders, chainId) => {
|
|
12
14
|
var _a;
|
|
@@ -5,6 +5,8 @@ import '../../../_virtual/_tslib.js';
|
|
|
5
5
|
import '@solana/spl-token';
|
|
6
6
|
import '@dynamic-labs/utils';
|
|
7
7
|
import { getOverrideRpcUrlForNetwork } from '../../utils/getOverrideRpcUrlForNetwork/getOverrideRpcUrlForNetwork.js';
|
|
8
|
+
import '@dynamic-labs/types';
|
|
9
|
+
import '@dynamic-labs/wallet-connector-core';
|
|
8
10
|
|
|
9
11
|
ChainRpcProviders.getSolanaProviderByChainId = (rpcProviders, chainId) => {
|
|
10
12
|
var _a;
|
package/src/utils/index.d.ts
CHANGED
|
@@ -9,3 +9,4 @@ export { createNonNativeTokenTransfer } from './createNonNativeTokenTransfer';
|
|
|
9
9
|
export { createSolTransfer } from './createSolTransfer';
|
|
10
10
|
export { getBackwardsCompatibleSolNetworks } from './getBackwardsCompatibleSolNetworks';
|
|
11
11
|
export { serializeTransactionForScreening } from './serializeTransactionForScreening';
|
|
12
|
+
export { screenSolanaTransactions } from './screenSolanaTransactions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { screenSolanaTransactions } from './screenSolanaTransactions';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../../_virtual/_tslib.cjs');
|
|
7
|
+
var types = require('@dynamic-labs/types');
|
|
8
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
|
+
var serializeTransactionForScreening = require('../serializeTransactionForScreening/serializeTransactionForScreening.cjs');
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Screens the transactions' destinations before the wallet is prompted to
|
|
13
|
+
* sign. Rejects only on an explicit block; a transaction that cannot be
|
|
14
|
+
* serialized is skipped (fail-open) so screening never breaks signing.
|
|
15
|
+
*/
|
|
16
|
+
const screenSolanaTransactions = (_a) => _tslib.__awaiter(void 0, [_a], void 0, function* ({ transactionScreening, transactions, senderAddress, }) {
|
|
17
|
+
if (!transactionScreening)
|
|
18
|
+
return;
|
|
19
|
+
// Serialized one at a time: legacy transactions still compile their
|
|
20
|
+
// message on serialize, so an unprepared one throws, and mapping the batch
|
|
21
|
+
// as a unit would drop screening for its siblings too.
|
|
22
|
+
const serializedTransactions = transactions.flatMap((transaction) => {
|
|
23
|
+
try {
|
|
24
|
+
return [serializeTransactionForScreening.serializeTransactionForScreening(transaction)];
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
walletConnectorCore.logger.warn('Failed to serialize transaction for screening', {
|
|
28
|
+
message: error instanceof Error ? error.message : 'unknown error',
|
|
29
|
+
});
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (serializedTransactions.length === 0)
|
|
34
|
+
return;
|
|
35
|
+
yield transactionScreening.screenTransaction({
|
|
36
|
+
chain: types.TransactionScreeningChain.SOL,
|
|
37
|
+
context: { svmTransaction: { serializedTransactions } },
|
|
38
|
+
senderAddress,
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
exports.screenSolanaTransactions = screenSolanaTransactions;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Transaction, VersionedTransaction } from '@solana/web3.js';
|
|
2
|
+
import { TransactionScreeningService } from '@dynamic-labs/types';
|
|
3
|
+
export type ScreenSolanaTransactionsParams = {
|
|
4
|
+
transactionScreening: TransactionScreeningService | undefined;
|
|
5
|
+
transactions: (Transaction | VersionedTransaction)[];
|
|
6
|
+
senderAddress: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Screens the transactions' destinations before the wallet is prompted to
|
|
10
|
+
* sign. Rejects only on an explicit block; a transaction that cannot be
|
|
11
|
+
* serialized is skipped (fail-open) so screening never breaks signing.
|
|
12
|
+
*/
|
|
13
|
+
export declare const screenSolanaTransactions: ({ transactionScreening, transactions, senderAddress, }: ScreenSolanaTransactionsParams) => Promise<void>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../../_virtual/_tslib.js';
|
|
3
|
+
import { TransactionScreeningChain } from '@dynamic-labs/types';
|
|
4
|
+
import { logger } from '@dynamic-labs/wallet-connector-core';
|
|
5
|
+
import { serializeTransactionForScreening } from '../serializeTransactionForScreening/serializeTransactionForScreening.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Screens the transactions' destinations before the wallet is prompted to
|
|
9
|
+
* sign. Rejects only on an explicit block; a transaction that cannot be
|
|
10
|
+
* serialized is skipped (fail-open) so screening never breaks signing.
|
|
11
|
+
*/
|
|
12
|
+
const screenSolanaTransactions = (_a) => __awaiter(void 0, [_a], void 0, function* ({ transactionScreening, transactions, senderAddress, }) {
|
|
13
|
+
if (!transactionScreening)
|
|
14
|
+
return;
|
|
15
|
+
// Serialized one at a time: legacy transactions still compile their
|
|
16
|
+
// message on serialize, so an unprepared one throws, and mapping the batch
|
|
17
|
+
// as a unit would drop screening for its siblings too.
|
|
18
|
+
const serializedTransactions = transactions.flatMap((transaction) => {
|
|
19
|
+
try {
|
|
20
|
+
return [serializeTransactionForScreening(transaction)];
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
logger.warn('Failed to serialize transaction for screening', {
|
|
24
|
+
message: error instanceof Error ? error.message : 'unknown error',
|
|
25
|
+
});
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
if (serializedTransactions.length === 0)
|
|
30
|
+
return;
|
|
31
|
+
yield transactionScreening.screenTransaction({
|
|
32
|
+
chain: TransactionScreeningChain.SOL,
|
|
33
|
+
context: { svmTransaction: { serializedTransactions } },
|
|
34
|
+
senderAddress,
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export { screenSolanaTransactions };
|
|
@@ -4,14 +4,13 @@
|
|
|
4
4
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
5
|
|
|
6
6
|
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
|
-
var types = require('@dynamic-labs/types');
|
|
8
7
|
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
9
8
|
var utils = require('@dynamic-labs/utils');
|
|
10
9
|
require('@solana/web3.js');
|
|
11
10
|
require('@solana/spl-token');
|
|
12
11
|
var createNonNativeTokenTransfer = require('../utils/createNonNativeTokenTransfer/createNonNativeTokenTransfer.cjs');
|
|
13
12
|
var createSolTransfer = require('../utils/createSolTransfer/createSolTransfer.cjs');
|
|
14
|
-
var
|
|
13
|
+
var screenSolanaTransactions = require('../utils/screenSolanaTransactions/screenSolanaTransactions.cjs');
|
|
15
14
|
|
|
16
15
|
class SolanaWallet extends walletConnectorCore.Wallet {
|
|
17
16
|
/**
|
|
@@ -74,16 +73,20 @@ class SolanaWallet extends walletConnectorCore.Wallet {
|
|
|
74
73
|
return utils.cloneObjectWithOverrides(signer, {
|
|
75
74
|
signAllTransactions: (transactions) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
76
75
|
yield this.sync();
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
yield screenSolanaTransactions.screenSolanaTransactions({
|
|
77
|
+
senderAddress: this.address,
|
|
78
|
+
transactionScreening: this._connector.transactionScreening,
|
|
79
|
+
transactions,
|
|
80
|
+
});
|
|
80
81
|
return signer.signAllTransactions(transactions);
|
|
81
82
|
}),
|
|
82
83
|
signAndSendTransaction: (transaction, ...args) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
83
84
|
yield this.sync();
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
yield screenSolanaTransactions.screenSolanaTransactions({
|
|
86
|
+
senderAddress: this.address,
|
|
87
|
+
transactionScreening: this._connector.transactionScreening,
|
|
88
|
+
transactions: [transaction],
|
|
89
|
+
});
|
|
87
90
|
return signer.signAndSendTransaction(transaction, ...args);
|
|
88
91
|
}),
|
|
89
92
|
signMessage: (message, ...args) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -92,9 +95,11 @@ class SolanaWallet extends walletConnectorCore.Wallet {
|
|
|
92
95
|
}),
|
|
93
96
|
signTransaction: (transaction) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
94
97
|
yield this.sync();
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
yield screenSolanaTransactions.screenSolanaTransactions({
|
|
99
|
+
senderAddress: this.address,
|
|
100
|
+
transactionScreening: this._connector.transactionScreening,
|
|
101
|
+
transactions: [transaction],
|
|
102
|
+
});
|
|
98
103
|
return signer.signTransaction(transaction);
|
|
99
104
|
}),
|
|
100
105
|
});
|
|
@@ -105,37 +110,6 @@ class SolanaWallet extends walletConnectorCore.Wallet {
|
|
|
105
110
|
}
|
|
106
111
|
});
|
|
107
112
|
}
|
|
108
|
-
/**
|
|
109
|
-
* Screens the transactions' destinations before the wallet is prompted to
|
|
110
|
-
* sign. Rejects only on an explicit block; a transaction that cannot be
|
|
111
|
-
* serialized is skipped (fail-open) so screening never breaks signing.
|
|
112
|
-
*/
|
|
113
|
-
screenTransactions(transactions) {
|
|
114
|
-
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
var _a;
|
|
116
|
-
// Serialized one at a time: legacy transactions still compile their
|
|
117
|
-
// message on serialize, so an unprepared one throws, and mapping the batch
|
|
118
|
-
// as a unit would drop screening for its siblings too.
|
|
119
|
-
const serializedTransactions = transactions.flatMap((transaction) => {
|
|
120
|
-
try {
|
|
121
|
-
return [serializeTransactionForScreening.serializeTransactionForScreening(transaction)];
|
|
122
|
-
}
|
|
123
|
-
catch (error) {
|
|
124
|
-
walletConnectorCore.logger.warn('Failed to serialize transaction for screening', {
|
|
125
|
-
message: error instanceof Error ? error.message : 'unknown error',
|
|
126
|
-
});
|
|
127
|
-
return [];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
if (serializedTransactions.length === 0)
|
|
131
|
-
return;
|
|
132
|
-
yield ((_a = this._connector.transactionScreening) === null || _a === void 0 ? void 0 : _a.screenTransaction({
|
|
133
|
-
chain: types.TransactionScreeningChain.SOL,
|
|
134
|
-
context: { svmTransaction: { serializedTransactions } },
|
|
135
|
-
senderAddress: this.address,
|
|
136
|
-
}));
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
113
|
}
|
|
140
114
|
|
|
141
115
|
exports.SolanaWallet = SolanaWallet;
|
|
@@ -28,10 +28,4 @@ export declare class SolanaWallet extends Wallet<SolanaWalletConnector> {
|
|
|
28
28
|
* or throws an error if the signer cannot be retrieved.
|
|
29
29
|
*/
|
|
30
30
|
getSigner(): Promise<ISolana>;
|
|
31
|
-
/**
|
|
32
|
-
* Screens the transactions' destinations before the wallet is prompted to
|
|
33
|
-
* sign. Rejects only on an explicit block; a transaction that cannot be
|
|
34
|
-
* serialized is skipped (fail-open) so screening never breaks signing.
|
|
35
|
-
*/
|
|
36
|
-
private screenTransactions;
|
|
37
31
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
-
import { TransactionScreeningChain } from '@dynamic-labs/types';
|
|
4
3
|
import { Wallet, logger } from '@dynamic-labs/wallet-connector-core';
|
|
5
4
|
import { cloneObjectWithOverrides } from '@dynamic-labs/utils';
|
|
6
5
|
import '@solana/web3.js';
|
|
7
6
|
import '@solana/spl-token';
|
|
8
7
|
import { createNonNativeTokenTransfer } from '../utils/createNonNativeTokenTransfer/createNonNativeTokenTransfer.js';
|
|
9
8
|
import { createSolTransfer } from '../utils/createSolTransfer/createSolTransfer.js';
|
|
10
|
-
import {
|
|
9
|
+
import { screenSolanaTransactions } from '../utils/screenSolanaTransactions/screenSolanaTransactions.js';
|
|
11
10
|
|
|
12
11
|
class SolanaWallet extends Wallet {
|
|
13
12
|
/**
|
|
@@ -70,16 +69,20 @@ class SolanaWallet extends Wallet {
|
|
|
70
69
|
return cloneObjectWithOverrides(signer, {
|
|
71
70
|
signAllTransactions: (transactions) => __awaiter(this, void 0, void 0, function* () {
|
|
72
71
|
yield this.sync();
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
yield screenSolanaTransactions({
|
|
73
|
+
senderAddress: this.address,
|
|
74
|
+
transactionScreening: this._connector.transactionScreening,
|
|
75
|
+
transactions,
|
|
76
|
+
});
|
|
76
77
|
return signer.signAllTransactions(transactions);
|
|
77
78
|
}),
|
|
78
79
|
signAndSendTransaction: (transaction, ...args) => __awaiter(this, void 0, void 0, function* () {
|
|
79
80
|
yield this.sync();
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
yield screenSolanaTransactions({
|
|
82
|
+
senderAddress: this.address,
|
|
83
|
+
transactionScreening: this._connector.transactionScreening,
|
|
84
|
+
transactions: [transaction],
|
|
85
|
+
});
|
|
83
86
|
return signer.signAndSendTransaction(transaction, ...args);
|
|
84
87
|
}),
|
|
85
88
|
signMessage: (message, ...args) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -88,9 +91,11 @@ class SolanaWallet extends Wallet {
|
|
|
88
91
|
}),
|
|
89
92
|
signTransaction: (transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
90
93
|
yield this.sync();
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
yield screenSolanaTransactions({
|
|
95
|
+
senderAddress: this.address,
|
|
96
|
+
transactionScreening: this._connector.transactionScreening,
|
|
97
|
+
transactions: [transaction],
|
|
98
|
+
});
|
|
94
99
|
return signer.signTransaction(transaction);
|
|
95
100
|
}),
|
|
96
101
|
});
|
|
@@ -101,37 +106,6 @@ class SolanaWallet extends Wallet {
|
|
|
101
106
|
}
|
|
102
107
|
});
|
|
103
108
|
}
|
|
104
|
-
/**
|
|
105
|
-
* Screens the transactions' destinations before the wallet is prompted to
|
|
106
|
-
* sign. Rejects only on an explicit block; a transaction that cannot be
|
|
107
|
-
* serialized is skipped (fail-open) so screening never breaks signing.
|
|
108
|
-
*/
|
|
109
|
-
screenTransactions(transactions) {
|
|
110
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
var _a;
|
|
112
|
-
// Serialized one at a time: legacy transactions still compile their
|
|
113
|
-
// message on serialize, so an unprepared one throws, and mapping the batch
|
|
114
|
-
// as a unit would drop screening for its siblings too.
|
|
115
|
-
const serializedTransactions = transactions.flatMap((transaction) => {
|
|
116
|
-
try {
|
|
117
|
-
return [serializeTransactionForScreening(transaction)];
|
|
118
|
-
}
|
|
119
|
-
catch (error) {
|
|
120
|
-
logger.warn('Failed to serialize transaction for screening', {
|
|
121
|
-
message: error instanceof Error ? error.message : 'unknown error',
|
|
122
|
-
});
|
|
123
|
-
return [];
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
if (serializedTransactions.length === 0)
|
|
127
|
-
return;
|
|
128
|
-
yield ((_a = this._connector.transactionScreening) === null || _a === void 0 ? void 0 : _a.screenTransaction({
|
|
129
|
-
chain: TransactionScreeningChain.SOL,
|
|
130
|
-
context: { svmTransaction: { serializedTransactions } },
|
|
131
|
-
senderAddress: this.address,
|
|
132
|
-
}));
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
109
|
}
|
|
136
110
|
|
|
137
111
|
export { SolanaWallet };
|