@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.
- package/README.md +48 -35
- package/dist/action.cjs +15 -0
- package/dist/action.d.cts +28 -0
- package/dist/action.d.mts +28 -0
- package/dist/action.d.ts +28 -0
- package/dist/action.mjs +12 -0
- package/dist/address.cjs +10 -10
- package/dist/address.d.cts +11 -13
- package/dist/address.d.mts +11 -13
- package/dist/address.d.ts +11 -13
- package/dist/address.mjs +10 -10
- package/dist/buffer-polyfill.d.cts +0 -1
- package/dist/buffer-polyfill.d.mts +0 -1
- package/dist/buffer-polyfill.d.ts +0 -1
- package/dist/clusters.d.cts +1 -4
- package/dist/clusters.d.mts +1 -4
- package/dist/clusters.d.ts +1 -4
- package/dist/index.cjs +14 -20
- package/dist/index.d.cts +7 -10
- package/dist/index.d.mts +7 -10
- package/dist/index.d.ts +7 -10
- package/dist/index.mjs +8 -9
- package/dist/ios-wallet.cjs +2 -2
- package/dist/ios-wallet.d.cts +1 -4
- package/dist/ios-wallet.d.mts +1 -4
- package/dist/ios-wallet.d.ts +1 -4
- package/dist/ios-wallet.mjs +2 -2
- package/dist/kit.cjs +4 -0
- package/dist/kit.d.cts +2 -5
- package/dist/kit.d.mts +2 -5
- package/dist/kit.d.ts +2 -5
- package/dist/kit.mjs +1 -1
- package/dist/mobile-wallet.d.cts +1 -4
- package/dist/mobile-wallet.d.mts +1 -4
- package/dist/mobile-wallet.d.ts +1 -4
- package/dist/rpc.cjs +0 -12
- package/dist/rpc.d.cts +2 -11
- package/dist/rpc.d.mts +2 -11
- package/dist/rpc.d.ts +2 -11
- package/dist/rpc.mjs +1 -12
- package/dist/shared/{core.Ch_Z7_17.mjs → core.BwW4HVQI.mjs} +12 -28
- package/dist/shared/{core.DAUuCWrr.d.mts → core.CQ_yMDAL.d.cts} +65 -30
- package/dist/shared/{core.DAUuCWrr.d.ts → core.CQ_yMDAL.d.mts} +65 -30
- package/dist/shared/{core.DAUuCWrr.d.cts → core.CQ_yMDAL.d.ts} +65 -30
- package/dist/shared/{core.BsekSwcZ.cjs → core.Cb48vQvC.cjs} +12 -28
- package/dist/shared/{core.DjbtrJWl.mjs → core.DEcQDbtz.mjs} +89 -37
- package/dist/shared/{core.BQoh-5Wu.cjs → core.DjxUirkw.cjs} +101 -49
- package/dist/token-accounts.cjs +44 -28
- package/dist/token-accounts.d.cts +20 -20
- package/dist/token-accounts.d.mts +20 -20
- package/dist/token-accounts.d.ts +20 -20
- package/dist/token-accounts.mjs +44 -28
- package/dist/transaction.cjs +50 -31
- package/dist/transaction.d.cts +9 -15
- package/dist/transaction.d.mts +9 -15
- package/dist/transaction.d.ts +9 -15
- package/dist/transaction.mjs +51 -32
- package/dist/types.d.cts +1 -4
- package/dist/types.d.mts +1 -4
- package/dist/types.d.ts +1 -4
- package/dist/wallet-standard.cjs +1 -4
- package/dist/wallet-standard.d.cts +1 -4
- package/dist/wallet-standard.d.mts +1 -4
- package/dist/wallet-standard.d.ts +1 -4
- package/dist/wallet-standard.mjs +1 -4
- package/dist/wallet.cjs +33 -0
- package/dist/wallet.d.cts +5 -5
- package/dist/wallet.d.mts +5 -5
- package/dist/wallet.d.ts +5 -5
- package/dist/wallet.mjs +31 -1
- package/package.json +6 -13
- package/dist/spl-token.cjs +0 -12
- package/dist/spl-token.d.cts +0 -4
- package/dist/spl-token.d.mts +0 -4
- package/dist/spl-token.d.ts +0 -4
- package/dist/spl-token.mjs +0 -1
- package/dist/web3.cjs +0 -13
- package/dist/web3.d.cts +0 -3
- package/dist/web3.d.mts +0 -3
- package/dist/web3.d.ts +0 -3
- package/dist/web3.mjs +0 -1
- package/types/web3-compat.d.ts +0 -140
package/README.md
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
Framework-agnostic Solana primitives for Vue Solana libraries and apps that want shared RPC, wallet, and transaction helpers without installing a Vue plugin.
|
|
9
9
|
|
|
10
|
-
Use this package directly when you want
|
|
10
|
+
Use this package directly when you want Kit RPC client helpers, shared wallet types, Android Mobile Wallet Adapter registration helpers, message signing support, token account reads, and transaction helpers without installing the Vue plugin.
|
|
11
11
|
|
|
12
|
-
`@vue-solana/core`
|
|
12
|
+
`@vue-solana/core` builds on `@solana/kit`. It exposes `createSolanaClient()` and re-exports Kit primitives (`address`, `lamports`, and the `Address`, `Commitment`, `Lamports`, `Rpc`, `Signature`, and `SolanaRpcApi` types) from `@vue-solana/core/kit`. The legacy `@solana/web3-compat` surface and the `web3` subpaths were removed in v2.0.0; transactions flow through the packages as raw `Uint8Array` wire bytes.
|
|
13
13
|
|
|
14
14
|
Official Solana docs:
|
|
15
15
|
|
|
@@ -27,24 +27,27 @@ Full Vue Solana docs:
|
|
|
27
27
|
|
|
28
28
|
## Features
|
|
29
29
|
|
|
30
|
-
- Cluster-aware RPC
|
|
30
|
+
- Cluster-aware RPC helpers with HTTP and WebSocket endpoint defaults.
|
|
31
|
+
- A Kit `client` with lazy `rpc` and `rpcSubscriptions` through `createSolanaClient()` / `createSolanaContext()`.
|
|
31
32
|
- Shared `SolanaConfig`, `SolanaContext`, and `SolanaWallet` types for framework integrations.
|
|
32
33
|
- Wallet capability assertions for connection, message signing, and transaction signing flows.
|
|
33
34
|
- Browser Wallet Standard adaptation primitives.
|
|
34
35
|
- Android Mobile Wallet Adapter registration helpers.
|
|
35
36
|
- iOS browser wallet link helpers for supported wallets.
|
|
36
37
|
- Transaction submission and confirmation helpers.
|
|
38
|
+
- SPL token account reads through Kit RPC `jsonParsed`.
|
|
39
|
+
- A framework-agnostic action state machine (`createSolanaActionStore`) for async Solana work with per-attempt `AbortSignal` handling.
|
|
37
40
|
|
|
38
41
|
## Compatibility
|
|
39
42
|
|
|
40
|
-
| Requirement | Supported
|
|
41
|
-
| ------------- |
|
|
42
|
-
| Runtime | Modern ESM or CommonJS bundlers
|
|
43
|
-
| TypeScript | TypeScript 5.x recommended
|
|
44
|
-
| Solana client | `@solana/
|
|
45
|
-
| Clusters | `mainnet-beta`, `devnet`, `testnet`, `localnet`
|
|
43
|
+
| Requirement | Supported |
|
|
44
|
+
| ------------- | --------------------------------------------------- |
|
|
45
|
+
| Runtime | Modern ESM or CommonJS bundlers |
|
|
46
|
+
| TypeScript | TypeScript 5.x recommended |
|
|
47
|
+
| Solana client | `@solana/kit@^8.3.0` (and `@solana/kit-plugin-rpc`) |
|
|
48
|
+
| Clusters | `mainnet-beta`, `devnet`, `testnet`, `localnet` |
|
|
46
49
|
|
|
47
|
-
This package depends on `@solana/web3-compat
|
|
50
|
+
This package no longer depends on `@solana/web3-compat`. It depends on `@solana/kit` and `@solana/kit-plugin-rpc`, so apps do not need to install either directly for normal Vue Solana usage.
|
|
48
51
|
|
|
49
52
|
## Install
|
|
50
53
|
|
|
@@ -65,21 +68,21 @@ const solana = createSolanaContext({
|
|
|
65
68
|
cluster: "devnet",
|
|
66
69
|
});
|
|
67
70
|
|
|
68
|
-
const {
|
|
71
|
+
const { value } = await solana.client.rpc.getLatestBlockhash().send();
|
|
69
72
|
|
|
70
|
-
console.log(solana.endpoint, blockhash);
|
|
73
|
+
console.log(solana.endpoint, value.blockhash);
|
|
71
74
|
```
|
|
72
75
|
|
|
73
76
|
The root export remains supported. Direct subpath exports are also available for narrower imports:
|
|
74
77
|
|
|
75
78
|
```ts
|
|
76
79
|
import { createSolanaContext } from "@vue-solana/core/rpc";
|
|
77
|
-
import {
|
|
78
|
-
import { PublicKey, Transaction } from "@vue-solana/core/web3";
|
|
80
|
+
import { parseAddress } from "@vue-solana/core/address";
|
|
79
81
|
import type { SolanaConfig } from "@vue-solana/core/types";
|
|
82
|
+
import { address, createSolanaClient } from "@vue-solana/core/kit";
|
|
80
83
|
```
|
|
81
84
|
|
|
82
|
-
Browser apps that
|
|
85
|
+
Browser apps that serialize transactions can install the Buffer polyfill before transaction code runs:
|
|
83
86
|
|
|
84
87
|
```ts
|
|
85
88
|
import { installSolanaBufferPolyfill } from "@vue-solana/core/buffer-polyfill";
|
|
@@ -106,7 +109,7 @@ const config: SolanaConfig = {
|
|
|
106
109
|
| `cluster` | `"mainnet-beta" \| "devnet" \| "testnet" \| "localnet"` | `"devnet"` | Solana cluster used when `endpoint` is omitted. |
|
|
107
110
|
| `endpoint` | `string` | Public endpoint for `cluster` | HTTP RPC endpoint. Use a dedicated RPC provider for production apps. |
|
|
108
111
|
| `wsEndpoint` | `string` | Derived from `endpoint` | WebSocket RPC endpoint. |
|
|
109
|
-
| `commitment` | Solana commitment | Solana client default | Default commitment for
|
|
112
|
+
| `commitment` | Solana commitment | Solana client default | Default commitment for RPC calls. |
|
|
110
113
|
| `autoConnect` | `boolean` | `false` | Consumed by Vue/Nuxt integrations to reconnect a previously selected discovered wallet. |
|
|
111
114
|
|
|
112
115
|
Supported clusters are `mainnet-beta`, `testnet`, `devnet`, and `localnet`. If `endpoint` is omitted, the package uses the public Solana RPC endpoint for the selected cluster. If `wsEndpoint` is omitted, it is derived from the RPC endpoint.
|
|
@@ -125,35 +128,42 @@ https://faucet.solana.com
|
|
|
125
128
|
|
|
126
129
|
Direct subpaths:
|
|
127
130
|
|
|
131
|
+
- `@vue-solana/core/action`
|
|
128
132
|
- `@vue-solana/core/types`
|
|
129
133
|
- `@vue-solana/core/address`
|
|
130
134
|
- `@vue-solana/core/buffer-polyfill`
|
|
131
135
|
- `@vue-solana/core/clusters`
|
|
132
136
|
- `@vue-solana/core/errors`
|
|
133
137
|
- `@vue-solana/core/ios-wallet`
|
|
138
|
+
- `@vue-solana/core/kit`
|
|
134
139
|
- `@vue-solana/core/mobile-wallet`
|
|
135
140
|
- `@vue-solana/core/rpc`
|
|
141
|
+
- `@vue-solana/core/token-accounts`
|
|
136
142
|
- `@vue-solana/core/timeout`
|
|
137
143
|
- `@vue-solana/core/transaction`
|
|
138
144
|
- `@vue-solana/core/wallet`
|
|
139
145
|
- `@vue-solana/core/wallet-standard`
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
|
143
|
-
|
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
146
|
+
|
|
147
|
+
| API | Description |
|
|
148
|
+
| --------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
149
|
+
| `DEFAULT_CLUSTER` | Default cluster, currently `devnet`. |
|
|
150
|
+
| `parseAddress(value)` | Parses an `Address`, address string, ref-like `{ value }`, getter, `null`, or `undefined` into an `Address \| null`. Invalid strings throw `INVALID_ADDRESS`. |
|
|
151
|
+
| `createSolanaClient(config?)` | Creates a Kit client exposing lazy `rpc` and `rpcSubscriptions`. |
|
|
152
|
+
| `createSolanaContext(config?)` | Creates `{ cluster, endpoint, wsEndpoint, client }`. |
|
|
153
|
+
| `getClusterEndpoint(cluster?)` | Returns the HTTP RPC endpoint for a cluster. |
|
|
154
|
+
| `getClusterWebSocketEndpoint(cluster?)` | Returns the WebSocket endpoint for a cluster. |
|
|
155
|
+
| `getWebSocketEndpoint(endpoint)` | Converts `http`/`https` RPC URLs to `ws`/`wss` URLs. |
|
|
156
|
+
| `isWalletConnected(wallet)` | Checks whether a wallet is connected and has an address. |
|
|
157
|
+
| `assertWalletConnected(wallet)` | Throws if the wallet is not connected. |
|
|
158
|
+
| `assertWalletCanSignMessage(wallet)` | Throws if the wallet is disconnected or cannot sign messages. |
|
|
159
|
+
| `assertWalletCanSign(wallet)` | Throws if the wallet cannot sign transactions. |
|
|
160
|
+
| `signAndSendTransaction(client, wallet, transaction, options?)` | Signs and sends raw wire bytes (`SolanaTransaction = Uint8Array`) using a configured wallet. |
|
|
161
|
+
| `confirmTransactionSignature(client, signature, options?)` | Waits for a submitted signature to reach a requested commitment by polling `getSignatureStatuses`. Defaults to `confirmed` and a 60 second timeout. |
|
|
162
|
+
| `getTokenAccountsByOwner(client, owner, options?)` | Returns SPL token accounts for an owner (token and token-2022 programs by default). |
|
|
163
|
+
| `getTokenAccount(client, address, commitment?)` | Reads a single token account, returning `null` when it does not exist. |
|
|
164
|
+
| `getTokenBalance(client, mint, owner, commitment?)` | Reads the token balance for an owner's associated token account as `{ amount, decimals }`. |
|
|
165
|
+
| `createSolanaActionStore(fn)` | Wraps an async `(signal, ...args) => Promise` function into a `{ getState, subscribe, dispatch, reset, withSignal }` store; each dispatch aborts the prior in-flight call. |
|
|
166
|
+
| `isSolanaActionAborted(error)` | Detects abort errors from superseded action dispatches. |
|
|
157
167
|
|
|
158
168
|
## Wallet Interface
|
|
159
169
|
|
|
@@ -170,6 +180,8 @@ const wallet: SolanaWallet = {
|
|
|
170
180
|
};
|
|
171
181
|
```
|
|
172
182
|
|
|
183
|
+
`SolanaWallet.publicKey` is an `Address` string (`null` when disconnected). `signTransaction` and `signAllTransactions` accept and return raw `Uint8Array` wire bytes.
|
|
184
|
+
|
|
173
185
|
Browser extension wallets discovered through the Solana Wallet Standard are adapted into `SolanaWallet`. Android Mobile Wallet Adapter is registered through `@solana-mobile/wallet-standard-mobile` and then adapted through the same Wallet Standard adapter on supported Android Chrome clients. iOS browser wallet entries for Phantom, Solflare, and Backpack are adapted through wallet-specific universal links. Wallet capability metadata exposes whether each wallet supports message signing, transaction signing, and sign-and-send flows. You can also provide a custom object that implements `SolanaWallet` for tests or custom adapters.
|
|
174
186
|
|
|
175
187
|
Current wallet support:
|
|
@@ -206,9 +218,10 @@ Docs: [Vue Solana Agent Skill](https://vue-solana-docs.vercel.app/agent-skill)
|
|
|
206
218
|
|
|
207
219
|
- Public Solana RPC endpoints are useful for development, but production apps should use dedicated RPC infrastructure.
|
|
208
220
|
- Use `mainnet-beta` for Solana mainnet. `mainnet` is intentionally not accepted as a cluster alias.
|
|
209
|
-
-
|
|
221
|
+
- Transactions are raw wire bytes. Build transaction messages with `@solana/kit` (`createTransactionMessage()`, `compileTransaction()`) and serialize them before passing them to wallet flows.
|
|
222
|
+
- v2.0.0 removed `@solana/web3-compat` and the `web3` subpaths. See the [Kit Migration guide](https://vue-solana-docs.vercel.app/guides/kit-migration) for migrating from v1.
|
|
210
223
|
- Desktop native app wallets are planned but not implemented yet.
|
|
211
224
|
|
|
212
225
|
## Status
|
|
213
226
|
|
|
214
|
-
This package provides RPC helpers, browser extension wallet primitives, Android mobile wallet registration, message signing,
|
|
227
|
+
This package provides Kit RPC helpers, browser extension wallet primitives, Android mobile wallet registration, message signing, token account reads, transaction helpers, and a framework-agnostic async action state machine.
|
package/dist/action.cjs
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const kit = require('@solana/kit');
|
|
4
|
+
require('@solana/kit-plugin-rpc');
|
|
5
|
+
|
|
6
|
+
function createSolanaActionStore(fn) {
|
|
7
|
+
return kit.createReactiveActionStore(fn);
|
|
8
|
+
}
|
|
9
|
+
function isSolanaActionAborted(error) {
|
|
10
|
+
return kit.isAbortError(error);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
exports.isAbortError = kit.isAbortError;
|
|
14
|
+
exports.createSolanaActionStore = createSolanaActionStore;
|
|
15
|
+
exports.isSolanaActionAborted = isSolanaActionAborted;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactiveActionState, ReactiveActionStore } from '@solana/kit';
|
|
2
|
+
export { isAbortError } from '@solana/kit';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Framework-agnostic action state machine for Solana async work.
|
|
6
|
+
*
|
|
7
|
+
* Wraps an async function receiving a fresh `AbortSignal` per call and exposes a
|
|
8
|
+
* `{ getState, subscribe, dispatch, reset, withSignal }` store that UI frameworks
|
|
9
|
+
* can bridge into reactive state (Vue composables, React hooks, etc.).
|
|
10
|
+
*
|
|
11
|
+
* - Each `dispatch` aborts the previous in-flight call (fresh signal per dispatch).
|
|
12
|
+
* - Superseded calls reject with an abort error; real failures surface on state.
|
|
13
|
+
* - `withSignal` composes a caller-provided cancellation source per dispatch
|
|
14
|
+
* (per-attempt timeouts, shared kill switches).
|
|
15
|
+
*
|
|
16
|
+
* @see `createReactiveActionStore` from `@solana/kit`, which this wraps.
|
|
17
|
+
*/
|
|
18
|
+
type SolanaActionStore<TArgs extends readonly unknown[], TResult> = ReactiveActionStore<TArgs, TResult>;
|
|
19
|
+
declare function createSolanaActionStore<TArgs extends readonly unknown[], TResult>(fn: (signal: AbortSignal, ...args: TArgs) => Promise<TResult>): SolanaActionStore<TArgs, TResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Snapshot shape bridged into reactive state by framework composables.
|
|
22
|
+
*/
|
|
23
|
+
type SolanaActionState<TResult> = ReactiveActionState<TResult>;
|
|
24
|
+
|
|
25
|
+
declare function isSolanaActionAborted(error: unknown): boolean;
|
|
26
|
+
|
|
27
|
+
export { createSolanaActionStore, isSolanaActionAborted };
|
|
28
|
+
export type { SolanaActionState, SolanaActionStore };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactiveActionState, ReactiveActionStore } from '@solana/kit';
|
|
2
|
+
export { isAbortError } from '@solana/kit';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Framework-agnostic action state machine for Solana async work.
|
|
6
|
+
*
|
|
7
|
+
* Wraps an async function receiving a fresh `AbortSignal` per call and exposes a
|
|
8
|
+
* `{ getState, subscribe, dispatch, reset, withSignal }` store that UI frameworks
|
|
9
|
+
* can bridge into reactive state (Vue composables, React hooks, etc.).
|
|
10
|
+
*
|
|
11
|
+
* - Each `dispatch` aborts the previous in-flight call (fresh signal per dispatch).
|
|
12
|
+
* - Superseded calls reject with an abort error; real failures surface on state.
|
|
13
|
+
* - `withSignal` composes a caller-provided cancellation source per dispatch
|
|
14
|
+
* (per-attempt timeouts, shared kill switches).
|
|
15
|
+
*
|
|
16
|
+
* @see `createReactiveActionStore` from `@solana/kit`, which this wraps.
|
|
17
|
+
*/
|
|
18
|
+
type SolanaActionStore<TArgs extends readonly unknown[], TResult> = ReactiveActionStore<TArgs, TResult>;
|
|
19
|
+
declare function createSolanaActionStore<TArgs extends readonly unknown[], TResult>(fn: (signal: AbortSignal, ...args: TArgs) => Promise<TResult>): SolanaActionStore<TArgs, TResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Snapshot shape bridged into reactive state by framework composables.
|
|
22
|
+
*/
|
|
23
|
+
type SolanaActionState<TResult> = ReactiveActionState<TResult>;
|
|
24
|
+
|
|
25
|
+
declare function isSolanaActionAborted(error: unknown): boolean;
|
|
26
|
+
|
|
27
|
+
export { createSolanaActionStore, isSolanaActionAborted };
|
|
28
|
+
export type { SolanaActionState, SolanaActionStore };
|
package/dist/action.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ReactiveActionState, ReactiveActionStore } from '@solana/kit';
|
|
2
|
+
export { isAbortError } from '@solana/kit';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Framework-agnostic action state machine for Solana async work.
|
|
6
|
+
*
|
|
7
|
+
* Wraps an async function receiving a fresh `AbortSignal` per call and exposes a
|
|
8
|
+
* `{ getState, subscribe, dispatch, reset, withSignal }` store that UI frameworks
|
|
9
|
+
* can bridge into reactive state (Vue composables, React hooks, etc.).
|
|
10
|
+
*
|
|
11
|
+
* - Each `dispatch` aborts the previous in-flight call (fresh signal per dispatch).
|
|
12
|
+
* - Superseded calls reject with an abort error; real failures surface on state.
|
|
13
|
+
* - `withSignal` composes a caller-provided cancellation source per dispatch
|
|
14
|
+
* (per-attempt timeouts, shared kill switches).
|
|
15
|
+
*
|
|
16
|
+
* @see `createReactiveActionStore` from `@solana/kit`, which this wraps.
|
|
17
|
+
*/
|
|
18
|
+
type SolanaActionStore<TArgs extends readonly unknown[], TResult> = ReactiveActionStore<TArgs, TResult>;
|
|
19
|
+
declare function createSolanaActionStore<TArgs extends readonly unknown[], TResult>(fn: (signal: AbortSignal, ...args: TArgs) => Promise<TResult>): SolanaActionStore<TArgs, TResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Snapshot shape bridged into reactive state by framework composables.
|
|
22
|
+
*/
|
|
23
|
+
type SolanaActionState<TResult> = ReactiveActionState<TResult>;
|
|
24
|
+
|
|
25
|
+
declare function isSolanaActionAborted(error: unknown): boolean;
|
|
26
|
+
|
|
27
|
+
export { createSolanaActionStore, isSolanaActionAborted };
|
|
28
|
+
export type { SolanaActionState, SolanaActionStore };
|
package/dist/action.mjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createReactiveActionStore, isAbortError } from '@solana/kit';
|
|
2
|
+
export { isAbortError } from '@solana/kit';
|
|
3
|
+
import '@solana/kit-plugin-rpc';
|
|
4
|
+
|
|
5
|
+
function createSolanaActionStore(fn) {
|
|
6
|
+
return createReactiveActionStore(fn);
|
|
7
|
+
}
|
|
8
|
+
function isSolanaActionAborted(error) {
|
|
9
|
+
return isAbortError(error);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export { createSolanaActionStore, isSolanaActionAborted };
|
package/dist/address.cjs
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const kit = require('@solana/kit');
|
|
4
4
|
const errors = require('./errors.cjs');
|
|
5
5
|
|
|
6
|
-
function
|
|
7
|
-
const
|
|
8
|
-
if (!
|
|
6
|
+
function parseAddress(value) {
|
|
7
|
+
const input = toAddressInput(value);
|
|
8
|
+
if (!input) {
|
|
9
9
|
return null;
|
|
10
10
|
}
|
|
11
|
-
if (
|
|
12
|
-
return
|
|
11
|
+
if (kit.isAddress(input)) {
|
|
12
|
+
return input;
|
|
13
13
|
}
|
|
14
14
|
try {
|
|
15
|
-
return
|
|
15
|
+
return kit.address(input);
|
|
16
16
|
} catch (cause) {
|
|
17
17
|
throw errors.createSolanaError("INVALID_ADDRESS", "Invalid Solana address", { cause });
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function toAddressInput(value) {
|
|
21
21
|
if (!value) {
|
|
22
22
|
return null;
|
|
23
23
|
}
|
|
24
24
|
if (typeof value === "function") {
|
|
25
25
|
return value();
|
|
26
26
|
}
|
|
27
|
-
if (
|
|
27
|
+
if (typeof value === "string") {
|
|
28
28
|
return value;
|
|
29
29
|
}
|
|
30
30
|
return value.value;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
exports.
|
|
33
|
+
exports.parseAddress = parseAddress;
|
package/dist/address.d.cts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference path="../types/buffer.d.ts" />
|
|
3
|
-
import { PublicKey } from '@solana/web3-compat';
|
|
1
|
+
import { Address } from '@solana/kit';
|
|
4
2
|
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
value:
|
|
8
|
-
} | (() =>
|
|
3
|
+
type AddressInput = Address | string | null | undefined;
|
|
4
|
+
type MaybeAddressInput = AddressInput | {
|
|
5
|
+
value: AddressInput;
|
|
6
|
+
} | (() => AddressInput);
|
|
9
7
|
/**
|
|
10
|
-
* Parse a
|
|
8
|
+
* Parse a Solana address from a Kit `Address`, string, ref, or getter.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Valid strings are returned as `Address`; invalid input throws a
|
|
11
|
+
* `SolanaError` with code `INVALID_ADDRESS`.
|
|
14
12
|
*/
|
|
15
|
-
declare function
|
|
13
|
+
declare function parseAddress(value: MaybeAddressInput): Address | null;
|
|
16
14
|
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
15
|
+
export { parseAddress };
|
|
16
|
+
export type { AddressInput, MaybeAddressInput };
|
package/dist/address.d.mts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference path="../types/buffer.d.ts" />
|
|
3
|
-
import { PublicKey } from '@solana/web3-compat';
|
|
1
|
+
import { Address } from '@solana/kit';
|
|
4
2
|
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
value:
|
|
8
|
-
} | (() =>
|
|
3
|
+
type AddressInput = Address | string | null | undefined;
|
|
4
|
+
type MaybeAddressInput = AddressInput | {
|
|
5
|
+
value: AddressInput;
|
|
6
|
+
} | (() => AddressInput);
|
|
9
7
|
/**
|
|
10
|
-
* Parse a
|
|
8
|
+
* Parse a Solana address from a Kit `Address`, string, ref, or getter.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Valid strings are returned as `Address`; invalid input throws a
|
|
11
|
+
* `SolanaError` with code `INVALID_ADDRESS`.
|
|
14
12
|
*/
|
|
15
|
-
declare function
|
|
13
|
+
declare function parseAddress(value: MaybeAddressInput): Address | null;
|
|
16
14
|
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
15
|
+
export { parseAddress };
|
|
16
|
+
export type { AddressInput, MaybeAddressInput };
|
package/dist/address.d.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference path="../types/buffer.d.ts" />
|
|
3
|
-
import { PublicKey } from '@solana/web3-compat';
|
|
1
|
+
import { Address } from '@solana/kit';
|
|
4
2
|
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
value:
|
|
8
|
-
} | (() =>
|
|
3
|
+
type AddressInput = Address | string | null | undefined;
|
|
4
|
+
type MaybeAddressInput = AddressInput | {
|
|
5
|
+
value: AddressInput;
|
|
6
|
+
} | (() => AddressInput);
|
|
9
7
|
/**
|
|
10
|
-
* Parse a
|
|
8
|
+
* Parse a Solana address from a Kit `Address`, string, ref, or getter.
|
|
11
9
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
10
|
+
* Valid strings are returned as `Address`; invalid input throws a
|
|
11
|
+
* `SolanaError` with code `INVALID_ADDRESS`.
|
|
14
12
|
*/
|
|
15
|
-
declare function
|
|
13
|
+
declare function parseAddress(value: MaybeAddressInput): Address | null;
|
|
16
14
|
|
|
17
|
-
export {
|
|
18
|
-
export type {
|
|
15
|
+
export { parseAddress };
|
|
16
|
+
export type { AddressInput, MaybeAddressInput };
|
package/dist/address.mjs
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isAddress, address } from '@solana/kit';
|
|
2
2
|
import { createSolanaError } from './errors.mjs';
|
|
3
3
|
|
|
4
|
-
function
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
4
|
+
function parseAddress(value) {
|
|
5
|
+
const input = toAddressInput(value);
|
|
6
|
+
if (!input) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
|
-
if (
|
|
10
|
-
return
|
|
9
|
+
if (isAddress(input)) {
|
|
10
|
+
return input;
|
|
11
11
|
}
|
|
12
12
|
try {
|
|
13
|
-
return
|
|
13
|
+
return address(input);
|
|
14
14
|
} catch (cause) {
|
|
15
15
|
throw createSolanaError("INVALID_ADDRESS", "Invalid Solana address", { cause });
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function toAddressInput(value) {
|
|
19
19
|
if (!value) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
22
22
|
if (typeof value === "function") {
|
|
23
23
|
return value();
|
|
24
24
|
}
|
|
25
|
-
if (
|
|
25
|
+
if (typeof value === "string") {
|
|
26
26
|
return value;
|
|
27
27
|
}
|
|
28
28
|
return value.value;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export {
|
|
31
|
+
export { parseAddress };
|
package/dist/clusters.d.cts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference path="../types/buffer.d.ts" />
|
|
3
|
-
import { c as SolanaCluster } from './shared/core.DAUuCWrr.cjs';
|
|
4
|
-
import '@solana/web3-compat';
|
|
1
|
+
import { c as SolanaCluster } from './shared/core.CQ_yMDAL.cjs';
|
|
5
2
|
import '@solana/kit';
|
|
6
3
|
|
|
7
4
|
declare const DEFAULT_CLUSTER: SolanaCluster;
|
package/dist/clusters.d.mts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference path="../types/buffer.d.ts" />
|
|
3
|
-
import { c as SolanaCluster } from './shared/core.DAUuCWrr.mjs';
|
|
4
|
-
import '@solana/web3-compat';
|
|
1
|
+
import { c as SolanaCluster } from './shared/core.CQ_yMDAL.mjs';
|
|
5
2
|
import '@solana/kit';
|
|
6
3
|
|
|
7
4
|
declare const DEFAULT_CLUSTER: SolanaCluster;
|
package/dist/clusters.d.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference path="../types/buffer.d.ts" />
|
|
3
|
-
import { c as SolanaCluster } from './shared/core.DAUuCWrr.js';
|
|
4
|
-
import '@solana/web3-compat';
|
|
1
|
+
import { c as SolanaCluster } from './shared/core.CQ_yMDAL.js';
|
|
5
2
|
import '@solana/kit';
|
|
6
3
|
|
|
7
4
|
declare const DEFAULT_CLUSTER: SolanaCluster;
|
package/dist/index.cjs
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
const action = require('./action.cjs');
|
|
3
4
|
const clusters = require('./clusters.cjs');
|
|
4
5
|
const address = require('./address.cjs');
|
|
5
6
|
const bufferPolyfill = require('./buffer-polyfill.cjs');
|
|
6
7
|
const errors = require('./errors.cjs');
|
|
7
|
-
const adapter = require('./shared/core.
|
|
8
|
+
const adapter = require('./shared/core.Cb48vQvC.cjs');
|
|
8
9
|
const kit$1 = require('./kit.cjs');
|
|
9
10
|
const mobileWallet = require('./mobile-wallet.cjs');
|
|
10
11
|
const rpc = require('./rpc.cjs');
|
|
11
|
-
const splToken = require('@solana/spl-token');
|
|
12
12
|
const tokenAccounts = require('./token-accounts.cjs');
|
|
13
13
|
const transaction = require('./transaction.cjs');
|
|
14
14
|
const timeout = require('./timeout.cjs');
|
|
15
15
|
const wallet = require('./wallet.cjs');
|
|
16
|
-
const discovery = require('./shared/core.
|
|
17
|
-
const web3Compat = require('@solana/web3-compat');
|
|
16
|
+
const discovery = require('./shared/core.DjxUirkw.cjs');
|
|
18
17
|
const _ = require('buffer/');
|
|
19
18
|
const kit = require('@solana/kit');
|
|
19
|
+
require('@solana/kit-plugin-rpc');
|
|
20
20
|
require('bs58');
|
|
21
21
|
require('tweetnacl');
|
|
22
|
-
require('@solana/kit-plugin-rpc');
|
|
23
22
|
require('@solana-mobile/wallet-standard-mobile');
|
|
24
23
|
require('@wallet-standard/features');
|
|
25
24
|
require('@solana/wallet-standard-features');
|
|
@@ -27,11 +26,13 @@ require('@wallet-standard/app');
|
|
|
27
26
|
|
|
28
27
|
|
|
29
28
|
|
|
29
|
+
exports.createSolanaActionStore = action.createSolanaActionStore;
|
|
30
|
+
exports.isSolanaActionAborted = action.isSolanaActionAborted;
|
|
30
31
|
exports.DEFAULT_CLUSTER = clusters.DEFAULT_CLUSTER;
|
|
31
32
|
exports.getClusterEndpoint = clusters.getClusterEndpoint;
|
|
32
33
|
exports.getClusterWebSocketEndpoint = clusters.getClusterWebSocketEndpoint;
|
|
33
34
|
exports.getWebSocketEndpoint = clusters.getWebSocketEndpoint;
|
|
34
|
-
exports.
|
|
35
|
+
exports.parseAddress = address.parseAddress;
|
|
35
36
|
exports.installSolanaBufferPolyfill = bufferPolyfill.installSolanaBufferPolyfill;
|
|
36
37
|
exports.SolanaError = errors.SolanaError;
|
|
37
38
|
exports.createSolanaError = errors.createSolanaError;
|
|
@@ -49,14 +50,7 @@ exports.createSolanaClient = kit$1.createSolanaClient;
|
|
|
49
50
|
exports.getDefaultMobileWalletAppIdentity = mobileWallet.getDefaultMobileWalletAppIdentity;
|
|
50
51
|
exports.isSolanaMobileWalletSupported = mobileWallet.isSolanaMobileWalletSupported;
|
|
51
52
|
exports.registerSolanaMobileWallet = mobileWallet.registerSolanaMobileWallet;
|
|
52
|
-
exports.createSolanaConnection = rpc.createSolanaConnection;
|
|
53
53
|
exports.createSolanaContext = rpc.createSolanaContext;
|
|
54
|
-
exports.AccountState = splToken.AccountState;
|
|
55
|
-
exports.TOKEN_2022_PROGRAM_ID = splToken.TOKEN_2022_PROGRAM_ID;
|
|
56
|
-
exports.TOKEN_PROGRAM_ID = splToken.TOKEN_PROGRAM_ID;
|
|
57
|
-
exports.getAssociatedTokenAddressSync = splToken.getAssociatedTokenAddressSync;
|
|
58
|
-
exports.unpackAccount = splToken.unpackAccount;
|
|
59
|
-
exports.unpackMint = splToken.unpackMint;
|
|
60
54
|
exports.getTokenAccount = tokenAccounts.getTokenAccount;
|
|
61
55
|
exports.getTokenAccountsByOwner = tokenAccounts.getTokenAccountsByOwner;
|
|
62
56
|
exports.getTokenBalance = tokenAccounts.getTokenBalance;
|
|
@@ -66,7 +60,10 @@ exports.withSolanaTimeout = timeout.withSolanaTimeout;
|
|
|
66
60
|
exports.withTimeout = timeout.withTimeout;
|
|
67
61
|
exports.SolanaWalletError = wallet.SolanaWalletError;
|
|
68
62
|
exports.assertWalletCanSign = wallet.assertWalletCanSign;
|
|
63
|
+
exports.assertWalletCanSignAndSendTransactions = wallet.assertWalletCanSignAndSendTransactions;
|
|
64
|
+
exports.assertWalletCanSignIn = wallet.assertWalletCanSignIn;
|
|
69
65
|
exports.assertWalletCanSignMessage = wallet.assertWalletCanSignMessage;
|
|
66
|
+
exports.assertWalletCanSignTransactions = wallet.assertWalletCanSignTransactions;
|
|
70
67
|
exports.assertWalletConnected = wallet.assertWalletConnected;
|
|
71
68
|
exports.createNoWalletSelectedError = wallet.createNoWalletSelectedError;
|
|
72
69
|
exports.isWalletConnected = wallet.isWalletConnected;
|
|
@@ -77,13 +74,10 @@ exports.getRegisteredSolanaWallets = discovery.getRegisteredSolanaWallets;
|
|
|
77
74
|
exports.getSolanaChain = discovery.getSolanaChain;
|
|
78
75
|
exports.isSolanaStandardWallet = discovery.isSolanaStandardWallet;
|
|
79
76
|
exports.subscribeSolanaWallets = discovery.subscribeSolanaWallets;
|
|
80
|
-
exports.Connection = web3Compat.Connection;
|
|
81
|
-
exports.Keypair = web3Compat.Keypair;
|
|
82
|
-
exports.PublicKey = web3Compat.PublicKey;
|
|
83
|
-
exports.SystemProgram = web3Compat.SystemProgram;
|
|
84
|
-
exports.Transaction = web3Compat.Transaction;
|
|
85
|
-
exports.TransactionInstruction = web3Compat.TransactionInstruction;
|
|
86
|
-
exports.VersionedTransaction = web3Compat.VersionedTransaction;
|
|
87
77
|
exports.Buffer = _.Buffer;
|
|
88
78
|
exports.address = kit.address;
|
|
79
|
+
exports.createReactiveActionStore = kit.createReactiveActionStore;
|
|
80
|
+
exports.createReactiveStoreWithInitialValueAndSlotTracking = kit.createReactiveStoreWithInitialValueAndSlotTracking;
|
|
81
|
+
exports.getAbortablePromise = kit.getAbortablePromise;
|
|
82
|
+
exports.isAbortError = kit.isAbortError;
|
|
89
83
|
exports.lamports = kit.lamports;
|