@vue-solana/core 1.2.0 → 2.1.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.
Files changed (82) hide show
  1. package/README.md +48 -35
  2. package/dist/action.cjs +15 -0
  3. package/dist/action.d.cts +28 -0
  4. package/dist/action.d.mts +28 -0
  5. package/dist/action.d.ts +28 -0
  6. package/dist/action.mjs +12 -0
  7. package/dist/address.cjs +10 -10
  8. package/dist/address.d.cts +11 -13
  9. package/dist/address.d.mts +11 -13
  10. package/dist/address.d.ts +11 -13
  11. package/dist/address.mjs +10 -10
  12. package/dist/buffer-polyfill.d.cts +0 -1
  13. package/dist/buffer-polyfill.d.mts +0 -1
  14. package/dist/buffer-polyfill.d.ts +0 -1
  15. package/dist/clusters.d.cts +1 -4
  16. package/dist/clusters.d.mts +1 -4
  17. package/dist/clusters.d.ts +1 -4
  18. package/dist/index.cjs +14 -20
  19. package/dist/index.d.cts +7 -10
  20. package/dist/index.d.mts +7 -10
  21. package/dist/index.d.ts +7 -10
  22. package/dist/index.mjs +8 -9
  23. package/dist/ios-wallet.cjs +2 -2
  24. package/dist/ios-wallet.d.cts +1 -4
  25. package/dist/ios-wallet.d.mts +1 -4
  26. package/dist/ios-wallet.d.ts +1 -4
  27. package/dist/ios-wallet.mjs +2 -2
  28. package/dist/kit.cjs +4 -0
  29. package/dist/kit.d.cts +2 -5
  30. package/dist/kit.d.mts +2 -5
  31. package/dist/kit.d.ts +2 -5
  32. package/dist/kit.mjs +1 -1
  33. package/dist/mobile-wallet.d.cts +1 -4
  34. package/dist/mobile-wallet.d.mts +1 -4
  35. package/dist/mobile-wallet.d.ts +1 -4
  36. package/dist/rpc.cjs +0 -12
  37. package/dist/rpc.d.cts +2 -11
  38. package/dist/rpc.d.mts +2 -11
  39. package/dist/rpc.d.ts +2 -11
  40. package/dist/rpc.mjs +1 -12
  41. package/dist/shared/{core.Ch_Z7_17.mjs → core.BwW4HVQI.mjs} +12 -28
  42. package/dist/shared/{core.DAUuCWrr.d.mts → core.CQ_yMDAL.d.cts} +65 -30
  43. package/dist/shared/{core.DAUuCWrr.d.ts → core.CQ_yMDAL.d.mts} +65 -30
  44. package/dist/shared/{core.DAUuCWrr.d.cts → core.CQ_yMDAL.d.ts} +65 -30
  45. package/dist/shared/{core.BsekSwcZ.cjs → core.Cb48vQvC.cjs} +12 -28
  46. package/dist/shared/{core.DjbtrJWl.mjs → core.DEcQDbtz.mjs} +89 -37
  47. package/dist/shared/{core.BQoh-5Wu.cjs → core.DjxUirkw.cjs} +101 -49
  48. package/dist/token-accounts.cjs +44 -28
  49. package/dist/token-accounts.d.cts +20 -20
  50. package/dist/token-accounts.d.mts +20 -20
  51. package/dist/token-accounts.d.ts +20 -20
  52. package/dist/token-accounts.mjs +44 -28
  53. package/dist/transaction.cjs +50 -31
  54. package/dist/transaction.d.cts +9 -15
  55. package/dist/transaction.d.mts +9 -15
  56. package/dist/transaction.d.ts +9 -15
  57. package/dist/transaction.mjs +51 -32
  58. package/dist/types.d.cts +1 -4
  59. package/dist/types.d.mts +1 -4
  60. package/dist/types.d.ts +1 -4
  61. package/dist/wallet-standard.cjs +1 -4
  62. package/dist/wallet-standard.d.cts +1 -4
  63. package/dist/wallet-standard.d.mts +1 -4
  64. package/dist/wallet-standard.d.ts +1 -4
  65. package/dist/wallet-standard.mjs +1 -4
  66. package/dist/wallet.cjs +33 -0
  67. package/dist/wallet.d.cts +5 -5
  68. package/dist/wallet.d.mts +5 -5
  69. package/dist/wallet.d.ts +5 -5
  70. package/dist/wallet.mjs +31 -1
  71. package/package.json +6 -13
  72. package/dist/spl-token.cjs +0 -12
  73. package/dist/spl-token.d.cts +0 -4
  74. package/dist/spl-token.d.mts +0 -4
  75. package/dist/spl-token.d.ts +0 -4
  76. package/dist/spl-token.mjs +0 -1
  77. package/dist/web3.cjs +0 -13
  78. package/dist/web3.d.cts +0 -3
  79. package/dist/web3.d.mts +0 -3
  80. package/dist/web3.d.ts +0 -3
  81. package/dist/web3.mjs +0 -1
  82. package/types/web3-compat.d.ts +0 -140
package/dist/wallet.d.mts CHANGED
@@ -1,8 +1,5 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- import { h as SolanaWallet } from './shared/core.DAUuCWrr.mjs';
1
+ import { k as SolanaWallet } from './shared/core.CQ_yMDAL.mjs';
4
2
  import { SolanaError } from './errors.mjs';
5
- import '@solana/web3-compat';
6
3
  import '@solana/kit';
7
4
 
8
5
  type SolanaWalletErrorCode = "NO_WALLET_SELECTED" | "WALLET_NOT_CONNECTED" | "WALLET_FEATURE_UNSUPPORTED";
@@ -19,6 +16,9 @@ declare function assertWalletConnected(wallet: SolanaWallet | null | undefined):
19
16
  };
20
17
  declare function assertWalletCanSign(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signTransaction">>;
21
18
  declare function assertWalletCanSignMessage(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signMessage">>;
19
+ declare function assertWalletCanSignIn(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signIn">>;
20
+ declare function assertWalletCanSignTransactions(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signTransactions">>;
21
+ declare function assertWalletCanSignAndSendTransactions(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signAndSendTransactions">>;
22
22
 
23
- export { SolanaWalletError, assertWalletCanSign, assertWalletCanSignMessage, assertWalletConnected, createNoWalletSelectedError, isWalletConnected };
23
+ export { SolanaWalletError, assertWalletCanSign, assertWalletCanSignAndSendTransactions, assertWalletCanSignIn, assertWalletCanSignMessage, assertWalletCanSignTransactions, assertWalletConnected, createNoWalletSelectedError, isWalletConnected };
24
24
  export type { SolanaWalletErrorCode };
package/dist/wallet.d.ts CHANGED
@@ -1,8 +1,5 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- import { h as SolanaWallet } from './shared/core.DAUuCWrr.js';
1
+ import { k as SolanaWallet } from './shared/core.CQ_yMDAL.js';
4
2
  import { SolanaError } from './errors.js';
5
- import '@solana/web3-compat';
6
3
  import '@solana/kit';
7
4
 
8
5
  type SolanaWalletErrorCode = "NO_WALLET_SELECTED" | "WALLET_NOT_CONNECTED" | "WALLET_FEATURE_UNSUPPORTED";
@@ -19,6 +16,9 @@ declare function assertWalletConnected(wallet: SolanaWallet | null | undefined):
19
16
  };
20
17
  declare function assertWalletCanSign(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signTransaction">>;
21
18
  declare function assertWalletCanSignMessage(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signMessage">>;
19
+ declare function assertWalletCanSignIn(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signIn">>;
20
+ declare function assertWalletCanSignTransactions(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signTransactions">>;
21
+ declare function assertWalletCanSignAndSendTransactions(wallet: SolanaWallet | null | undefined): asserts wallet is SolanaWallet & Required<Pick<SolanaWallet, "signAndSendTransactions">>;
22
22
 
23
- export { SolanaWalletError, assertWalletCanSign, assertWalletCanSignMessage, assertWalletConnected, createNoWalletSelectedError, isWalletConnected };
23
+ export { SolanaWalletError, assertWalletCanSign, assertWalletCanSignAndSendTransactions, assertWalletCanSignIn, assertWalletCanSignMessage, assertWalletCanSignTransactions, assertWalletConnected, createNoWalletSelectedError, isWalletConnected };
24
24
  export type { SolanaWalletErrorCode };
package/dist/wallet.mjs CHANGED
@@ -37,5 +37,35 @@ function assertWalletCanSignMessage(wallet) {
37
37
  );
38
38
  }
39
39
  }
40
+ function assertWalletCanSignIn(wallet) {
41
+ assertWalletConnected(wallet);
42
+ if (!wallet.signIn) {
43
+ throw new SolanaWalletError(
44
+ "WALLET_FEATURE_UNSUPPORTED",
45
+ "Solana wallet does not support signIn (Sign In With Solana)",
46
+ { feature: "signIn" }
47
+ );
48
+ }
49
+ }
50
+ function assertWalletCanSignTransactions(wallet) {
51
+ assertWalletConnected(wallet);
52
+ if (!wallet.signTransactions && !wallet.signAllTransactions) {
53
+ throw new SolanaWalletError(
54
+ "WALLET_FEATURE_UNSUPPORTED",
55
+ "Solana wallet does not support signTransactions",
56
+ { feature: "signTransactions" }
57
+ );
58
+ }
59
+ }
60
+ function assertWalletCanSignAndSendTransactions(wallet) {
61
+ assertWalletConnected(wallet);
62
+ if (!wallet.signAndSendTransactions && !wallet.signAndSendTransaction) {
63
+ throw new SolanaWalletError(
64
+ "WALLET_FEATURE_UNSUPPORTED",
65
+ "Solana wallet does not support signAndSendTransactions",
66
+ { feature: "signAndSendTransactions" }
67
+ );
68
+ }
69
+ }
40
70
 
41
- export { SolanaWalletError, assertWalletCanSign, assertWalletCanSignMessage, assertWalletConnected, createNoWalletSelectedError, isWalletConnected };
71
+ export { SolanaWalletError, assertWalletCanSign, assertWalletCanSignAndSendTransactions, assertWalletCanSignIn, assertWalletCanSignMessage, assertWalletCanSignTransactions, assertWalletConnected, createNoWalletSelectedError, isWalletConnected };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/core",
3
- "version": "1.2.0",
3
+ "version": "2.1.0",
4
4
  "description": "Framework-agnostic primitives for Vue Solana libraries.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -35,6 +35,11 @@
35
35
  "import": "./dist/address.mjs",
36
36
  "require": "./dist/address.cjs"
37
37
  },
38
+ "./action": {
39
+ "types": "./dist/action.d.ts",
40
+ "import": "./dist/action.mjs",
41
+ "require": "./dist/action.cjs"
42
+ },
38
43
  "./buffer-polyfill": {
39
44
  "types": "./dist/buffer-polyfill.d.ts",
40
45
  "import": "./dist/buffer-polyfill.mjs",
@@ -95,16 +100,6 @@
95
100
  "import": "./dist/wallet-standard.mjs",
96
101
  "require": "./dist/wallet-standard.cjs"
97
102
  },
98
- "./web3": {
99
- "types": "./dist/web3.d.ts",
100
- "import": "./dist/web3.mjs",
101
- "require": "./dist/web3.cjs"
102
- },
103
- "./spl-token": {
104
- "types": "./dist/spl-token.d.ts",
105
- "import": "./dist/spl-token.mjs",
106
- "require": "./dist/spl-token.cjs"
107
- },
108
103
  "./token-accounts": {
109
104
  "types": "./dist/token-accounts.d.ts",
110
105
  "import": "./dist/token-accounts.mjs",
@@ -122,9 +117,7 @@
122
117
  "@solana-mobile/wallet-standard-mobile": "^0.5.3",
123
118
  "@solana/kit": "^8.3.0",
124
119
  "@solana/kit-plugin-rpc": "^0.19.0",
125
- "@solana/spl-token": "^0.4.15",
126
120
  "@solana/wallet-standard-features": "^1.3.0",
127
- "@solana/web3-compat": "^0.0.21",
128
121
  "@wallet-standard/app": "^1.1.1",
129
122
  "@wallet-standard/base": "^1.1.1",
130
123
  "@wallet-standard/features": "^1.1.1",
@@ -1,12 +0,0 @@
1
- 'use strict';
2
-
3
- const splToken = require('@solana/spl-token');
4
-
5
-
6
-
7
- exports.AccountState = splToken.AccountState;
8
- exports.TOKEN_2022_PROGRAM_ID = splToken.TOKEN_2022_PROGRAM_ID;
9
- exports.TOKEN_PROGRAM_ID = splToken.TOKEN_PROGRAM_ID;
10
- exports.getAssociatedTokenAddressSync = splToken.getAssociatedTokenAddressSync;
11
- exports.unpackAccount = splToken.unpackAccount;
12
- exports.unpackMint = splToken.unpackMint;
@@ -1,4 +0,0 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- export { AccountState, Mint, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, Account as TokenAccount, getAssociatedTokenAddressSync, unpackAccount, unpackMint } from '@solana/spl-token';
4
- import '@solana/web3-compat';
@@ -1,4 +0,0 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- export { AccountState, Mint, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, Account as TokenAccount, getAssociatedTokenAddressSync, unpackAccount, unpackMint } from '@solana/spl-token';
4
- import '@solana/web3-compat';
@@ -1,4 +0,0 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- export { AccountState, Mint, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, Account as TokenAccount, getAssociatedTokenAddressSync, unpackAccount, unpackMint } from '@solana/spl-token';
4
- import '@solana/web3-compat';
@@ -1 +0,0 @@
1
- export { AccountState, TOKEN_2022_PROGRAM_ID, TOKEN_PROGRAM_ID, getAssociatedTokenAddressSync, unpackAccount, unpackMint } from '@solana/spl-token';
package/dist/web3.cjs DELETED
@@ -1,13 +0,0 @@
1
- 'use strict';
2
-
3
- const web3Compat = require('@solana/web3-compat');
4
-
5
-
6
-
7
- exports.Connection = web3Compat.Connection;
8
- exports.Keypair = web3Compat.Keypair;
9
- exports.PublicKey = web3Compat.PublicKey;
10
- exports.SystemProgram = web3Compat.SystemProgram;
11
- exports.Transaction = web3Compat.Transaction;
12
- exports.TransactionInstruction = web3Compat.TransactionInstruction;
13
- exports.VersionedTransaction = web3Compat.VersionedTransaction;
package/dist/web3.d.cts DELETED
@@ -1,3 +0,0 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- export { AccountInfo, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SendOptions, SignatureResult, SignatureStatus, SystemProgram, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@solana/web3-compat';
package/dist/web3.d.mts DELETED
@@ -1,3 +0,0 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- export { AccountInfo, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SendOptions, SignatureResult, SignatureStatus, SystemProgram, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@solana/web3-compat';
package/dist/web3.d.ts DELETED
@@ -1,3 +0,0 @@
1
- /// <reference path="../types/web3-compat.d.ts" />
2
- /// <reference path="../types/buffer.d.ts" />
3
- export { AccountInfo, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SendOptions, SignatureResult, SignatureStatus, SystemProgram, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@solana/web3-compat';
package/dist/web3.mjs DELETED
@@ -1 +0,0 @@
1
- export { Connection, Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction, VersionedTransaction } from '@solana/web3-compat';
@@ -1,140 +0,0 @@
1
- declare module "@solana/web3-compat" {
2
- export type Commitment =
3
- | "processed"
4
- | "confirmed"
5
- | "finalized"
6
- | "recent"
7
- | "single"
8
- | "singleGossip"
9
- | "root"
10
- | "max";
11
-
12
- export type TransactionSignature = string;
13
-
14
- export interface SendOptions {
15
- skipPreflight?: boolean;
16
- preflightCommitment?: Commitment;
17
- maxRetries?: number;
18
- minContextSlot?: number;
19
- }
20
-
21
- export interface RpcResponseAndContext<T> {
22
- context: {
23
- slot: number;
24
- apiVersion?: string;
25
- };
26
- value: T;
27
- }
28
-
29
- export interface AccountInfo<TData> {
30
- executable: boolean;
31
- owner: PublicKey;
32
- lamports: number;
33
- data: TData;
34
- rentEpoch?: number;
35
- }
36
-
37
- export interface SignatureResult {
38
- err: unknown | null;
39
- }
40
-
41
- export interface SignatureStatus {
42
- slot: number;
43
- confirmations: number | null;
44
- err: unknown | null;
45
- confirmationStatus?: Commitment;
46
- }
47
-
48
- export type PublicKeyInitData =
49
- | PublicKey
50
- | string
51
- | Uint8Array
52
- | readonly number[]
53
- | ArrayLike<number>;
54
-
55
- export class PublicKey {
56
- constructor(value: PublicKeyInitData);
57
- toBase58(): string;
58
- toBytes(): Uint8Array;
59
- toBuffer(): Uint8Array;
60
- equals(publicKey: PublicKey): boolean;
61
- toString(): string;
62
- }
63
-
64
- export class Keypair {
65
- public publicKey: PublicKey;
66
- public secretKey: Uint8Array;
67
- static generate(): Keypair;
68
- static fromSecretKey(secretKey: Uint8Array): Keypair;
69
- }
70
-
71
- export class TransactionInstruction {
72
- constructor(options: { keys: unknown[]; programId: PublicKey; data?: Uint8Array });
73
- }
74
-
75
- export class Transaction {
76
- feePayer?: PublicKey;
77
- recentBlockhash?: string;
78
- constructor(options?: { feePayer?: PublicKey; recentBlockhash?: string });
79
- add(...instructions: TransactionInstruction[]): this;
80
- serialize(options?: { requireAllSignatures?: boolean; verifySignatures?: boolean }): Uint8Array;
81
- static from(buffer: Uint8Array): Transaction;
82
- }
83
-
84
- export class VersionedTransaction {
85
- serialize(): Uint8Array;
86
- static deserialize(buffer: Uint8Array): VersionedTransaction;
87
- }
88
-
89
- export const SystemProgram: {
90
- transfer(options: {
91
- fromPubkey: PublicKey;
92
- toPubkey: PublicKey;
93
- lamports: number;
94
- }): TransactionInstruction;
95
- };
96
-
97
- export class Connection {
98
- readonly rpcEndpoint: string;
99
- constructor(
100
- endpoint: string,
101
- config?: Commitment | { commitment?: Commitment; wsEndpoint?: string },
102
- );
103
- getLatestBlockhash(
104
- commitment?: Commitment,
105
- ): Promise<{ blockhash: string; lastValidBlockHeight: number }>;
106
- getBalance(publicKey: PublicKey, commitment?: Commitment): Promise<number>;
107
- getAccountInfo<TData = Uint8Array>(
108
- publicKey: PublicKey,
109
- commitment?: Commitment,
110
- ): Promise<AccountInfo<TData> | null>;
111
- getProgramAccounts(
112
- publicKey: PublicKey,
113
- config?: unknown,
114
- ): Promise<{ pubkey: PublicKey; account: AccountInfo<Uint8Array> }[]>;
115
- getSignatureStatuses(
116
- signatures: TransactionSignature[],
117
- config?: { searchTransactionHistory?: boolean },
118
- ): Promise<{ value: (SignatureStatus | null)[] }>;
119
- confirmTransaction(
120
- signature: TransactionSignature,
121
- commitment?: Commitment,
122
- ): Promise<RpcResponseAndContext<SignatureResult>>;
123
- sendRawTransaction(
124
- rawTransaction: Uint8Array,
125
- options?: SendOptions,
126
- ): Promise<TransactionSignature>;
127
- onAccountChange(
128
- publicKey: PublicKey,
129
- callback: (accountInfo: AccountInfo<Uint8Array>, context: { slot: number }) => void,
130
- commitment?: Commitment,
131
- ): number;
132
- removeAccountChangeListener(subscriptionId: number): Promise<void>;
133
- onSignature(
134
- signature: TransactionSignature,
135
- callback: (notification: SignatureResult, context: { slot: number }) => void,
136
- commitment?: Commitment,
137
- ): number;
138
- removeSignatureListener(subscriptionId: number): Promise<void>;
139
- }
140
- }