@dynamic-labs/solana-core 0.0.0-exp20240827.1
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 +3952 -0
- package/LICENSE +21 -0
- package/README.md +11 -0
- package/_virtual/_tslib.cjs +36 -0
- package/_virtual/_tslib.js +32 -0
- package/package.json +41 -0
- package/src/connector/SolWalletConnector.cjs +175 -0
- package/src/connector/SolWalletConnector.d.ts +37 -0
- package/src/connector/SolWalletConnector.js +171 -0
- package/src/connector/index.d.ts +1 -0
- package/src/constants.cjs +8 -0
- package/src/constants.d.ts +1 -0
- package/src/constants.js +4 -0
- package/src/index.cjs +36 -0
- package/src/index.d.ts +6 -0
- package/src/index.js +13 -0
- package/src/rpc/RpcProviderSolana/RpcProviderSolana.cjs +29 -0
- package/src/rpc/RpcProviderSolana/RpcProviderSolana.d.ts +18 -0
- package/src/rpc/RpcProviderSolana/RpcProviderSolana.js +27 -0
- package/src/rpc/RpcProviderSolana/index.d.ts +1 -0
- package/src/rpc/index.d.ts +3 -0
- package/src/rpc/solanaProvidersSelector/index.d.ts +1 -0
- package/src/rpc/solanaProvidersSelector/solanaProvidersSelector.cjs +24 -0
- package/src/rpc/solanaProvidersSelector/solanaProvidersSelector.d.ts +7 -0
- package/src/rpc/solanaProvidersSelector/solanaProvidersSelector.js +20 -0
- package/src/types.d.ts +67 -0
- package/src/utils/SolanaUiTransaction/SolanaUiTransaction.cjs +153 -0
- package/src/utils/SolanaUiTransaction/SolanaUiTransaction.d.ts +40 -0
- package/src/utils/SolanaUiTransaction/SolanaUiTransaction.js +148 -0
- package/src/utils/SolanaUiTransaction/index.d.ts +1 -0
- package/src/utils/decodeTransactionFromBase64/decodeTransactionFromBase64.cjs +16 -0
- package/src/utils/decodeTransactionFromBase64/decodeTransactionFromBase64.d.ts +3 -0
- package/src/utils/decodeTransactionFromBase64/decodeTransactionFromBase64.js +12 -0
- package/src/utils/decodeTransactionFromBase64/index.d.ts +1 -0
- package/src/utils/encodeTransactionToBase64/encodeTransactionToBase64.cjs +15 -0
- package/src/utils/encodeTransactionToBase64/encodeTransactionToBase64.d.ts +6 -0
- package/src/utils/encodeTransactionToBase64/encodeTransactionToBase64.js +11 -0
- package/src/utils/encodeTransactionToBase64/index.d.ts +1 -0
- package/src/utils/extractNonce/extractNonce.cjs +14 -0
- package/src/utils/extractNonce/extractNonce.d.ts +1 -0
- package/src/utils/extractNonce/extractNonce.js +10 -0
- package/src/utils/extractNonce/index.d.ts +1 -0
- package/src/utils/getGenesisHashLSKey/getGenesisHashLSKey.cjs +10 -0
- package/src/utils/getGenesisHashLSKey/getGenesisHashLSKey.d.ts +1 -0
- package/src/utils/getGenesisHashLSKey/getGenesisHashLSKey.js +6 -0
- package/src/utils/getGenesisHashLSKey/index.d.ts +1 -0
- package/src/utils/index.d.ts +5 -0
- package/src/utils/isVersionedTransaction/index.d.ts +1 -0
- package/src/utils/isVersionedTransaction/isVersionedTransaction.cjs +8 -0
- package/src/utils/isVersionedTransaction/isVersionedTransaction.d.ts +2 -0
- package/src/utils/isVersionedTransaction/isVersionedTransaction.js +4 -0
- package/src/wallet/SolanaWallet.cjs +52 -0
- package/src/wallet/SolanaWallet.d.ts +17 -0
- package/src/wallet/SolanaWallet.js +48 -0
- package/src/wallet/index.d.ts +2 -0
- package/src/wallet/isSolanaWallet/index.d.ts +1 -0
- package/src/wallet/isSolanaWallet/isSolanaWallet.cjs +8 -0
- package/src/wallet/isSolanaWallet/isSolanaWallet.d.ts +3 -0
- package/src/wallet/isSolanaWallet/isSolanaWallet.js +4 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
5
|
+
|
|
6
|
+
var _tslib = require('../../_virtual/_tslib.cjs');
|
|
7
|
+
var walletConnectorCore = require('@dynamic-labs/wallet-connector-core');
|
|
8
|
+
var utils = require('@dynamic-labs/utils');
|
|
9
|
+
|
|
10
|
+
class SolanaWallet extends walletConnectorCore.Wallet {
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves the RPC connection
|
|
13
|
+
* @returns A promise that resolves to the RPC connection
|
|
14
|
+
*/
|
|
15
|
+
getConnection() {
|
|
16
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
return this._connector.getWalletClient();
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves the solana signer for the wallet.
|
|
22
|
+
* @returns A promise that resolves to the signer,
|
|
23
|
+
* or throws an error if the signer cannot be retrieved.
|
|
24
|
+
*/
|
|
25
|
+
getSigner() {
|
|
26
|
+
return _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const signer = yield this._connector.getSigner();
|
|
28
|
+
if (!signer) {
|
|
29
|
+
throw new Error('unable to retrieve Solana signer');
|
|
30
|
+
}
|
|
31
|
+
utils.wrapMethodWithCallback(signer, 'signTransaction', (originalSignTransaction, transaction) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
yield this.sync();
|
|
33
|
+
return originalSignTransaction(transaction);
|
|
34
|
+
}));
|
|
35
|
+
utils.wrapMethodWithCallback(signer, 'signAllTransactions', (originalSignAllTransactions, transactions) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
yield this.sync();
|
|
37
|
+
return originalSignAllTransactions(transactions);
|
|
38
|
+
}));
|
|
39
|
+
utils.wrapMethodWithCallback(signer, 'signAndSendTransaction', (originalSignAndSendTransaction, transaction, ...args) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
yield this.sync();
|
|
41
|
+
return originalSignAndSendTransaction(transaction, ...args);
|
|
42
|
+
}));
|
|
43
|
+
utils.wrapMethodWithCallback(signer, 'signMessage', (originalSignMessage, message, ...args) => _tslib.__awaiter(this, void 0, void 0, function* () {
|
|
44
|
+
yield this.sync();
|
|
45
|
+
return originalSignMessage(message, ...args);
|
|
46
|
+
}));
|
|
47
|
+
return signer;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
exports.SolanaWallet = SolanaWallet;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Connection } from '@solana/web3.js';
|
|
2
|
+
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
3
|
+
import { SolWalletConnector } from '../connector';
|
|
4
|
+
import { ISolana } from '../types';
|
|
5
|
+
export declare class SolanaWallet extends Wallet<SolWalletConnector> {
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves the RPC connection
|
|
8
|
+
* @returns A promise that resolves to the RPC connection
|
|
9
|
+
*/
|
|
10
|
+
getConnection(): Promise<Connection>;
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves the solana signer for the wallet.
|
|
13
|
+
* @returns A promise that resolves to the signer,
|
|
14
|
+
* or throws an error if the signer cannot be retrieved.
|
|
15
|
+
*/
|
|
16
|
+
getSigner(): Promise<ISolana>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
import { __awaiter } from '../../_virtual/_tslib.js';
|
|
3
|
+
import { Wallet } from '@dynamic-labs/wallet-connector-core';
|
|
4
|
+
import { wrapMethodWithCallback } from '@dynamic-labs/utils';
|
|
5
|
+
|
|
6
|
+
class SolanaWallet extends Wallet {
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves the RPC connection
|
|
9
|
+
* @returns A promise that resolves to the RPC connection
|
|
10
|
+
*/
|
|
11
|
+
getConnection() {
|
|
12
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
13
|
+
return this._connector.getWalletClient();
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Retrieves the solana signer for the wallet.
|
|
18
|
+
* @returns A promise that resolves to the signer,
|
|
19
|
+
* or throws an error if the signer cannot be retrieved.
|
|
20
|
+
*/
|
|
21
|
+
getSigner() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const signer = yield this._connector.getSigner();
|
|
24
|
+
if (!signer) {
|
|
25
|
+
throw new Error('unable to retrieve Solana signer');
|
|
26
|
+
}
|
|
27
|
+
wrapMethodWithCallback(signer, 'signTransaction', (originalSignTransaction, transaction) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
yield this.sync();
|
|
29
|
+
return originalSignTransaction(transaction);
|
|
30
|
+
}));
|
|
31
|
+
wrapMethodWithCallback(signer, 'signAllTransactions', (originalSignAllTransactions, transactions) => __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
yield this.sync();
|
|
33
|
+
return originalSignAllTransactions(transactions);
|
|
34
|
+
}));
|
|
35
|
+
wrapMethodWithCallback(signer, 'signAndSendTransaction', (originalSignAndSendTransaction, transaction, ...args) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
yield this.sync();
|
|
37
|
+
return originalSignAndSendTransaction(transaction, ...args);
|
|
38
|
+
}));
|
|
39
|
+
wrapMethodWithCallback(signer, 'signMessage', (originalSignMessage, message, ...args) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
yield this.sync();
|
|
41
|
+
return originalSignMessage(message, ...args);
|
|
42
|
+
}));
|
|
43
|
+
return signer;
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { SolanaWallet };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './isSolanaWallet';
|