@vue-solana/core 0.3.0 → 0.3.2
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/README.md +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/transaction.cjs +11 -1
- package/dist/transaction.mjs +10 -0
- package/dist/types.d.cts +2 -0
- package/dist/types.d.mts +2 -0
- package/dist/types.d.ts +2 -0
- package/dist/wallet-standard.cjs +5 -2
- package/dist/wallet-standard.d.cts +2 -1
- package/dist/wallet-standard.d.mts +2 -1
- package/dist/wallet-standard.d.ts +2 -1
- package/dist/wallet-standard.mjs +5 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -95,7 +95,7 @@ Direct subpaths:
|
|
|
95
95
|
- `isWalletConnected(wallet)`: checks whether a wallet is connected and has a public key.
|
|
96
96
|
- `assertWalletConnected(wallet)`: throws if the wallet is not connected.
|
|
97
97
|
- `assertWalletCanSign(wallet)`: throws if the wallet cannot sign transactions.
|
|
98
|
-
- `signAndSendTransaction(connection, wallet, transaction, options?)`: signs and sends a transaction using a configured wallet.
|
|
98
|
+
- `signAndSendTransaction(connection, wallet, transaction, options?)`: signs and sends a transaction using a configured wallet. Android Mobile Wallet Adapter wallets prefer `signTransaction` plus app-side RPC submission when available so the app can reliably return the submitted signature.
|
|
99
99
|
|
|
100
100
|
## Wallet Interface
|
|
101
101
|
|
package/dist/index.cjs
CHANGED
|
@@ -28,6 +28,7 @@ exports.signAndSendTransaction = transaction.signAndSendTransaction;
|
|
|
28
28
|
exports.assertWalletCanSign = wallet.assertWalletCanSign;
|
|
29
29
|
exports.assertWalletConnected = wallet.assertWalletConnected;
|
|
30
30
|
exports.isWalletConnected = wallet.isWalletConnected;
|
|
31
|
+
exports.SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME = walletStandard.SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME;
|
|
31
32
|
exports.adaptSolanaStandardWallet = walletStandard.adaptSolanaStandardWallet;
|
|
32
33
|
exports.getRegisteredSolanaWallets = walletStandard.getRegisteredSolanaWallets;
|
|
33
34
|
exports.getSolanaChain = walletStandard.getSolanaChain;
|
package/dist/index.d.cts
CHANGED
|
@@ -4,6 +4,6 @@ export { createSolanaConnection, createSolanaContext } from './rpc.cjs';
|
|
|
4
4
|
export { signAndSendTransaction } from './transaction.cjs';
|
|
5
5
|
export { SendTransactionOptions, SolanaChain, SolanaCluster, SolanaConfig, SolanaContext, SolanaTransaction, SolanaWallet, SolanaWalletInfo } from './types.cjs';
|
|
6
6
|
export { assertWalletCanSign, assertWalletConnected, isWalletConnected } from './wallet.cjs';
|
|
7
|
-
export { AdaptSolanaWalletOptions, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.cjs';
|
|
7
|
+
export { AdaptSolanaWalletOptions, SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.cjs';
|
|
8
8
|
import '@solana/web3-compat';
|
|
9
9
|
import '@wallet-standard/base';
|
package/dist/index.d.mts
CHANGED
|
@@ -4,6 +4,6 @@ export { createSolanaConnection, createSolanaContext } from './rpc.mjs';
|
|
|
4
4
|
export { signAndSendTransaction } from './transaction.mjs';
|
|
5
5
|
export { SendTransactionOptions, SolanaChain, SolanaCluster, SolanaConfig, SolanaContext, SolanaTransaction, SolanaWallet, SolanaWalletInfo } from './types.mjs';
|
|
6
6
|
export { assertWalletCanSign, assertWalletConnected, isWalletConnected } from './wallet.mjs';
|
|
7
|
-
export { AdaptSolanaWalletOptions, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.mjs';
|
|
7
|
+
export { AdaptSolanaWalletOptions, SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.mjs';
|
|
8
8
|
import '@solana/web3-compat';
|
|
9
9
|
import '@wallet-standard/base';
|
package/dist/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export { createSolanaConnection, createSolanaContext } from './rpc.js';
|
|
|
4
4
|
export { signAndSendTransaction } from './transaction.js';
|
|
5
5
|
export { SendTransactionOptions, SolanaChain, SolanaCluster, SolanaConfig, SolanaContext, SolanaTransaction, SolanaWallet, SolanaWalletInfo } from './types.js';
|
|
6
6
|
export { assertWalletCanSign, assertWalletConnected, isWalletConnected } from './wallet.js';
|
|
7
|
-
export { AdaptSolanaWalletOptions, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.js';
|
|
7
|
+
export { AdaptSolanaWalletOptions, SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.js';
|
|
8
8
|
import '@solana/web3-compat';
|
|
9
9
|
import '@wallet-standard/base';
|
package/dist/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ export { getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, regis
|
|
|
3
3
|
export { createSolanaConnection, createSolanaContext } from './rpc.mjs';
|
|
4
4
|
export { signAndSendTransaction } from './transaction.mjs';
|
|
5
5
|
export { assertWalletCanSign, assertWalletConnected, isWalletConnected } from './wallet.mjs';
|
|
6
|
-
export { adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.mjs';
|
|
6
|
+
export { SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.mjs';
|
|
7
7
|
import '@solana-mobile/wallet-standard-mobile';
|
|
8
8
|
import '@solana/web3-compat';
|
|
9
9
|
import '@wallet-standard/app';
|
package/dist/transaction.cjs
CHANGED
|
@@ -4,14 +4,24 @@ const wallet = require('./wallet.cjs');
|
|
|
4
4
|
|
|
5
5
|
async function signAndSendTransaction(connection, wallet$1, transaction, options) {
|
|
6
6
|
wallet.assertWalletConnected(wallet$1);
|
|
7
|
+
if (isMobileWalletAdapterWallet(wallet$1) && wallet$1.signTransaction) {
|
|
8
|
+
wallet.assertWalletCanSign(wallet$1);
|
|
9
|
+
return signAndSendRawTransaction(connection, wallet$1, transaction, options);
|
|
10
|
+
}
|
|
7
11
|
if (wallet$1.signAndSendTransaction) {
|
|
8
12
|
const result = await wallet$1.signAndSendTransaction(transaction, options);
|
|
9
13
|
return result.signature;
|
|
10
14
|
}
|
|
11
15
|
wallet.assertWalletCanSign(wallet$1);
|
|
12
|
-
|
|
16
|
+
return signAndSendRawTransaction(connection, wallet$1, transaction, options);
|
|
17
|
+
}
|
|
18
|
+
async function signAndSendRawTransaction(connection, wallet, transaction, options) {
|
|
19
|
+
const signedTransaction = await wallet.signTransaction(transaction);
|
|
13
20
|
const rawTransaction = signedTransaction.serialize();
|
|
14
21
|
return connection.sendRawTransaction(rawTransaction, options);
|
|
15
22
|
}
|
|
23
|
+
function isMobileWalletAdapterWallet(wallet) {
|
|
24
|
+
return wallet.source === "mobile-wallet-adapter";
|
|
25
|
+
}
|
|
16
26
|
|
|
17
27
|
exports.signAndSendTransaction = signAndSendTransaction;
|
package/dist/transaction.mjs
CHANGED
|
@@ -2,14 +2,24 @@ import { assertWalletConnected, assertWalletCanSign } from './wallet.mjs';
|
|
|
2
2
|
|
|
3
3
|
async function signAndSendTransaction(connection, wallet, transaction, options) {
|
|
4
4
|
assertWalletConnected(wallet);
|
|
5
|
+
if (isMobileWalletAdapterWallet(wallet) && wallet.signTransaction) {
|
|
6
|
+
assertWalletCanSign(wallet);
|
|
7
|
+
return signAndSendRawTransaction(connection, wallet, transaction, options);
|
|
8
|
+
}
|
|
5
9
|
if (wallet.signAndSendTransaction) {
|
|
6
10
|
const result = await wallet.signAndSendTransaction(transaction, options);
|
|
7
11
|
return result.signature;
|
|
8
12
|
}
|
|
9
13
|
assertWalletCanSign(wallet);
|
|
14
|
+
return signAndSendRawTransaction(connection, wallet, transaction, options);
|
|
15
|
+
}
|
|
16
|
+
async function signAndSendRawTransaction(connection, wallet, transaction, options) {
|
|
10
17
|
const signedTransaction = await wallet.signTransaction(transaction);
|
|
11
18
|
const rawTransaction = signedTransaction.serialize();
|
|
12
19
|
return connection.sendRawTransaction(rawTransaction, options);
|
|
13
20
|
}
|
|
21
|
+
function isMobileWalletAdapterWallet(wallet) {
|
|
22
|
+
return wallet.source === "mobile-wallet-adapter";
|
|
23
|
+
}
|
|
14
24
|
|
|
15
25
|
export { signAndSendTransaction };
|
package/dist/types.d.cts
CHANGED
|
@@ -21,6 +21,8 @@ interface SolanaWallet {
|
|
|
21
21
|
connected: boolean;
|
|
22
22
|
connecting?: boolean;
|
|
23
23
|
disconnecting?: boolean;
|
|
24
|
+
platform?: SolanaWalletInfo["platform"];
|
|
25
|
+
source?: SolanaWalletInfo["source"];
|
|
24
26
|
connect: () => Promise<void>;
|
|
25
27
|
disconnect: () => Promise<void>;
|
|
26
28
|
signTransaction?: <T extends SolanaTransaction>(transaction: T) => Promise<T>;
|
package/dist/types.d.mts
CHANGED
|
@@ -21,6 +21,8 @@ interface SolanaWallet {
|
|
|
21
21
|
connected: boolean;
|
|
22
22
|
connecting?: boolean;
|
|
23
23
|
disconnecting?: boolean;
|
|
24
|
+
platform?: SolanaWalletInfo["platform"];
|
|
25
|
+
source?: SolanaWalletInfo["source"];
|
|
24
26
|
connect: () => Promise<void>;
|
|
25
27
|
disconnect: () => Promise<void>;
|
|
26
28
|
signTransaction?: <T extends SolanaTransaction>(transaction: T) => Promise<T>;
|
package/dist/types.d.ts
CHANGED
|
@@ -21,6 +21,8 @@ interface SolanaWallet {
|
|
|
21
21
|
connected: boolean;
|
|
22
22
|
connecting?: boolean;
|
|
23
23
|
disconnecting?: boolean;
|
|
24
|
+
platform?: SolanaWalletInfo["platform"];
|
|
25
|
+
source?: SolanaWalletInfo["source"];
|
|
24
26
|
connect: () => Promise<void>;
|
|
25
27
|
disconnect: () => Promise<void>;
|
|
26
28
|
signTransaction?: <T extends SolanaTransaction>(transaction: T) => Promise<T>;
|
package/dist/wallet-standard.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const app = require('@wallet-standard/app');
|
|
4
|
-
const walletStandardMobile = require('@solana-mobile/wallet-standard-mobile');
|
|
5
4
|
const features = require('@wallet-standard/features');
|
|
6
5
|
const walletStandardFeatures = require('@solana/wallet-standard-features');
|
|
7
6
|
const web3Compat = require('@solana/web3-compat');
|
|
@@ -17,6 +16,7 @@ const SOLANA_CHAINS = [
|
|
|
17
16
|
"solana:devnet",
|
|
18
17
|
"solana:localnet"
|
|
19
18
|
];
|
|
19
|
+
const SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME = "Mobile Wallet Adapter";
|
|
20
20
|
function getSolanaChain(cluster) {
|
|
21
21
|
if (cluster === "mainnet-beta") {
|
|
22
22
|
return "solana:mainnet";
|
|
@@ -62,6 +62,8 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
|
|
|
62
62
|
}
|
|
63
63
|
});
|
|
64
64
|
return {
|
|
65
|
+
platform: walletInfo.platform,
|
|
66
|
+
source: walletInfo.source,
|
|
65
67
|
get publicKey() {
|
|
66
68
|
return account ? new web3Compat.PublicKey(account.publicKey) : null;
|
|
67
69
|
},
|
|
@@ -154,7 +156,7 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
|
|
|
154
156
|
};
|
|
155
157
|
}
|
|
156
158
|
function createSolanaWalletInfo(wallet) {
|
|
157
|
-
const isMobileWallet = wallet.name ===
|
|
159
|
+
const isMobileWallet = wallet.name === SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME;
|
|
158
160
|
return {
|
|
159
161
|
name: wallet.name,
|
|
160
162
|
icon: wallet.icon,
|
|
@@ -214,6 +216,7 @@ function deserializeTransaction(source, bytes) {
|
|
|
214
216
|
return web3Compat.VersionedTransaction.deserialize(bytes);
|
|
215
217
|
}
|
|
216
218
|
|
|
219
|
+
exports.SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME = SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME;
|
|
217
220
|
exports.adaptSolanaStandardWallet = adaptSolanaStandardWallet;
|
|
218
221
|
exports.getRegisteredSolanaWallets = getRegisteredSolanaWallets;
|
|
219
222
|
exports.getSolanaChain = getSolanaChain;
|
|
@@ -2,6 +2,7 @@ import { WalletAccount, Wallet } from '@wallet-standard/base';
|
|
|
2
2
|
import { SolanaChain, SolanaWalletInfo, SolanaWallet, SolanaCluster } from './types.cjs';
|
|
3
3
|
import '@solana/web3-compat';
|
|
4
4
|
|
|
5
|
+
declare const SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME = "Mobile Wallet Adapter";
|
|
5
6
|
interface AdaptSolanaWalletOptions {
|
|
6
7
|
chain?: SolanaChain;
|
|
7
8
|
account?: WalletAccount;
|
|
@@ -13,5 +14,5 @@ declare function getRegisteredSolanaWallets(): SolanaWalletInfo[];
|
|
|
13
14
|
declare function subscribeSolanaWallets(listener: () => void): () => void;
|
|
14
15
|
declare function adaptSolanaStandardWallet(walletInfo: SolanaWalletInfo, options?: AdaptSolanaWalletOptions): SolanaWallet;
|
|
15
16
|
|
|
16
|
-
export { adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets };
|
|
17
|
+
export { SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets };
|
|
17
18
|
export type { AdaptSolanaWalletOptions };
|
|
@@ -2,6 +2,7 @@ import { WalletAccount, Wallet } from '@wallet-standard/base';
|
|
|
2
2
|
import { SolanaChain, SolanaWalletInfo, SolanaWallet, SolanaCluster } from './types.mjs';
|
|
3
3
|
import '@solana/web3-compat';
|
|
4
4
|
|
|
5
|
+
declare const SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME = "Mobile Wallet Adapter";
|
|
5
6
|
interface AdaptSolanaWalletOptions {
|
|
6
7
|
chain?: SolanaChain;
|
|
7
8
|
account?: WalletAccount;
|
|
@@ -13,5 +14,5 @@ declare function getRegisteredSolanaWallets(): SolanaWalletInfo[];
|
|
|
13
14
|
declare function subscribeSolanaWallets(listener: () => void): () => void;
|
|
14
15
|
declare function adaptSolanaStandardWallet(walletInfo: SolanaWalletInfo, options?: AdaptSolanaWalletOptions): SolanaWallet;
|
|
15
16
|
|
|
16
|
-
export { adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets };
|
|
17
|
+
export { SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets };
|
|
17
18
|
export type { AdaptSolanaWalletOptions };
|
|
@@ -2,6 +2,7 @@ import { WalletAccount, Wallet } from '@wallet-standard/base';
|
|
|
2
2
|
import { SolanaChain, SolanaWalletInfo, SolanaWallet, SolanaCluster } from './types.js';
|
|
3
3
|
import '@solana/web3-compat';
|
|
4
4
|
|
|
5
|
+
declare const SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME = "Mobile Wallet Adapter";
|
|
5
6
|
interface AdaptSolanaWalletOptions {
|
|
6
7
|
chain?: SolanaChain;
|
|
7
8
|
account?: WalletAccount;
|
|
@@ -13,5 +14,5 @@ declare function getRegisteredSolanaWallets(): SolanaWalletInfo[];
|
|
|
13
14
|
declare function subscribeSolanaWallets(listener: () => void): () => void;
|
|
14
15
|
declare function adaptSolanaStandardWallet(walletInfo: SolanaWalletInfo, options?: AdaptSolanaWalletOptions): SolanaWallet;
|
|
15
16
|
|
|
16
|
-
export { adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets };
|
|
17
|
+
export { SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets };
|
|
17
18
|
export type { AdaptSolanaWalletOptions };
|
package/dist/wallet-standard.mjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { getWallets } from '@wallet-standard/app';
|
|
2
|
-
import { SolanaMobileWalletAdapterWalletName } from '@solana-mobile/wallet-standard-mobile';
|
|
3
2
|
import { StandardEvents, StandardDisconnect, StandardConnect } from '@wallet-standard/features';
|
|
4
3
|
import { SolanaSignAndSendTransaction, SolanaSignTransaction } from '@solana/wallet-standard-features';
|
|
5
4
|
import { PublicKey, Transaction, VersionedTransaction } from '@solana/web3-compat';
|
|
@@ -11,6 +10,7 @@ const SOLANA_CHAINS = [
|
|
|
11
10
|
"solana:devnet",
|
|
12
11
|
"solana:localnet"
|
|
13
12
|
];
|
|
13
|
+
const SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME = "Mobile Wallet Adapter";
|
|
14
14
|
function getSolanaChain(cluster) {
|
|
15
15
|
if (cluster === "mainnet-beta") {
|
|
16
16
|
return "solana:mainnet";
|
|
@@ -56,6 +56,8 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
|
|
|
56
56
|
}
|
|
57
57
|
});
|
|
58
58
|
return {
|
|
59
|
+
platform: walletInfo.platform,
|
|
60
|
+
source: walletInfo.source,
|
|
59
61
|
get publicKey() {
|
|
60
62
|
return account ? new PublicKey(account.publicKey) : null;
|
|
61
63
|
},
|
|
@@ -148,7 +150,7 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
|
|
|
148
150
|
};
|
|
149
151
|
}
|
|
150
152
|
function createSolanaWalletInfo(wallet) {
|
|
151
|
-
const isMobileWallet = wallet.name ===
|
|
153
|
+
const isMobileWallet = wallet.name === SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME;
|
|
152
154
|
return {
|
|
153
155
|
name: wallet.name,
|
|
154
156
|
icon: wallet.icon,
|
|
@@ -208,4 +210,4 @@ function deserializeTransaction(source, bytes) {
|
|
|
208
210
|
return VersionedTransaction.deserialize(bytes);
|
|
209
211
|
}
|
|
210
212
|
|
|
211
|
-
export { adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets };
|
|
213
|
+
export { SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets };
|