@vue-solana/core 0.7.0 → 0.7.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.
Files changed (50) hide show
  1. package/README.md +73 -48
  2. package/dist/address.d.cts +2 -0
  3. package/dist/address.d.mts +2 -0
  4. package/dist/address.d.ts +2 -0
  5. package/dist/buffer-polyfill.cjs +12 -0
  6. package/dist/buffer-polyfill.d.cts +8 -0
  7. package/dist/buffer-polyfill.d.mts +8 -0
  8. package/dist/buffer-polyfill.d.ts +8 -0
  9. package/dist/buffer-polyfill.mjs +10 -0
  10. package/dist/clusters.d.cts +2 -0
  11. package/dist/clusters.d.mts +2 -0
  12. package/dist/clusters.d.ts +2 -0
  13. package/dist/index.cjs +13 -2
  14. package/dist/index.d.cts +5 -1
  15. package/dist/index.d.mts +5 -1
  16. package/dist/index.d.ts +5 -1
  17. package/dist/index.mjs +4 -2
  18. package/dist/ios-wallet.d.cts +2 -0
  19. package/dist/ios-wallet.d.mts +2 -0
  20. package/dist/ios-wallet.d.ts +2 -0
  21. package/dist/mobile-wallet.d.cts +2 -0
  22. package/dist/mobile-wallet.d.mts +2 -0
  23. package/dist/mobile-wallet.d.ts +2 -0
  24. package/dist/rpc.d.cts +2 -0
  25. package/dist/rpc.d.mts +2 -0
  26. package/dist/rpc.d.ts +2 -0
  27. package/dist/shared/{core.DSMNiaHD.mjs → core.BBMCTQpw.mjs} +10 -1
  28. package/dist/shared/{core.DX2frf65.cjs → core.BU9rgxEj.cjs} +23 -14
  29. package/dist/transaction.d.cts +2 -0
  30. package/dist/transaction.d.mts +2 -0
  31. package/dist/transaction.d.ts +2 -0
  32. package/dist/types.d.cts +2 -0
  33. package/dist/types.d.mts +2 -0
  34. package/dist/types.d.ts +2 -0
  35. package/dist/wallet-standard.cjs +3 -1
  36. package/dist/wallet-standard.d.cts +2 -0
  37. package/dist/wallet-standard.d.mts +2 -0
  38. package/dist/wallet-standard.d.ts +2 -0
  39. package/dist/wallet-standard.mjs +3 -1
  40. package/dist/wallet.d.cts +2 -0
  41. package/dist/wallet.d.mts +2 -0
  42. package/dist/wallet.d.ts +2 -0
  43. package/dist/web3.cjs +13 -0
  44. package/dist/web3.d.cts +3 -0
  45. package/dist/web3.d.mts +3 -0
  46. package/dist/web3.d.ts +3 -0
  47. package/dist/web3.mjs +1 -0
  48. package/package.json +15 -3
  49. package/types/buffer.d.ts +3 -0
  50. package/types/web3-compat.d.ts +140 -0
package/README.md CHANGED
@@ -1,10 +1,15 @@
1
1
  # @vue-solana/core
2
2
 
3
- Framework-agnostic Solana primitives used by the Vue Solana packages.
3
+ [![npm version](https://img.shields.io/npm/v/@vue-solana/core.svg)](https://www.npmjs.com/package/@vue-solana/core)
4
+ [![npm downloads](https://img.shields.io/npm/dt/@vue-solana/core.svg)](https://www.npmjs.com/package/@vue-solana/core)
5
+ [![license](https://img.shields.io/npm/l/@vue-solana/core.svg)](https://github.com/vue-solana/vue-solana/blob/main/LICENSE)
6
+ [![docs](https://img.shields.io/badge/docs-vue--solana-blue)](https://vue-solana-docs.vercel.app/packages/core)
7
+
8
+ Framework-agnostic Solana primitives for Vue Solana libraries and apps that want shared RPC, wallet, and transaction helpers without installing a Vue plugin.
4
9
 
5
10
  Use this package directly when you want connection helpers, shared wallet types, Android Mobile Wallet Adapter registration helpers, message signing support, and transaction helpers without installing the Vue plugin.
6
11
 
7
- `@vue-solana/core` does not replace `@solana/web3-compat`. Use `@solana/web3-compat` for raw Solana primitives like `Connection`, `PublicKey`, and transactions. Use `@vue-solana/core` for Vue Solana shared configuration, cluster endpoint defaults, wallet interfaces, and transaction helpers.
12
+ `@vue-solana/core` wraps `@solana/web3-compat` and re-exports the Solana primitives most Vue Solana apps need, including `Connection`, `PublicKey`, `Transaction`, and `VersionedTransaction`.
8
13
 
9
14
  Official Solana docs:
10
15
 
@@ -20,14 +25,35 @@ Full Vue Solana docs:
20
25
  - [Agent Skill](https://vue-solana-docs.vercel.app/agent-skill)
21
26
  - [Troubleshooting](https://vue-solana-docs.vercel.app/troubleshooting)
22
27
 
28
+ ## Features
29
+
30
+ - Cluster-aware RPC connection helpers with HTTP and WebSocket endpoint defaults.
31
+ - Shared `SolanaConfig`, `SolanaContext`, and `SolanaWallet` types for framework integrations.
32
+ - Wallet capability assertions for connection, message signing, and transaction signing flows.
33
+ - Browser Wallet Standard adaptation primitives.
34
+ - Android Mobile Wallet Adapter registration helpers.
35
+ - iOS browser wallet link helpers for supported wallets.
36
+ - Transaction submission and confirmation helpers.
37
+
38
+ ## Compatibility
39
+
40
+ | Requirement | Supported |
41
+ | ------------- | ----------------------------------------------- |
42
+ | Runtime | Modern ESM or CommonJS bundlers |
43
+ | TypeScript | TypeScript 5.x recommended |
44
+ | Solana client | `@solana/web3-compat@^0.0.21` |
45
+ | Clusters | `mainnet-beta`, `devnet`, `testnet`, `localnet` |
46
+
47
+ This package depends on `@solana/web3-compat` and exposes the supported compatibility primitives through `@vue-solana/core` and `@vue-solana/core/web3`, so apps do not need to install `@solana/web3-compat` directly for normal Vue Solana usage.
48
+
23
49
  ## Install
24
50
 
25
51
  ```sh
26
- pnpm add @vue-solana/core @solana/web3-compat
52
+ pnpm add @vue-solana/core
27
53
  ```
28
54
 
29
55
  ```sh
30
- npm install @vue-solana/core @solana/web3-compat
56
+ npm install @vue-solana/core
31
57
  ```
32
58
 
33
59
  ## Quick Start
@@ -49,9 +75,18 @@ The root export remains supported. Direct subpath exports are also available for
49
75
  ```ts
50
76
  import { createSolanaContext } from "@vue-solana/core/rpc";
51
77
  import { parsePublicKey } from "@vue-solana/core/address";
78
+ import { PublicKey, Transaction } from "@vue-solana/core/web3";
52
79
  import type { SolanaConfig } from "@vue-solana/core/types";
53
80
  ```
54
81
 
82
+ Browser apps that create or serialize legacy transactions can install the Buffer polyfill before transaction code runs:
83
+
84
+ ```ts
85
+ import { installSolanaBufferPolyfill } from "@vue-solana/core/buffer-polyfill";
86
+
87
+ installSolanaBufferPolyfill();
88
+ ```
89
+
55
90
  ## Configuration
56
91
 
57
92
  ```ts
@@ -66,6 +101,14 @@ const config: SolanaConfig = {
66
101
  };
67
102
  ```
68
103
 
104
+ | Option | Type | Default | Description |
105
+ | ------------- | ------------------------------------------------------- | ----------------------------- | --------------------------------------------------------------------------------------- |
106
+ | `cluster` | `"mainnet-beta" \| "devnet" \| "testnet" \| "localnet"` | `"devnet"` | Solana cluster used when `endpoint` is omitted. |
107
+ | `endpoint` | `string` | Public endpoint for `cluster` | HTTP RPC endpoint. Use a dedicated RPC provider for production apps. |
108
+ | `wsEndpoint` | `string` | Derived from `endpoint` | WebSocket RPC endpoint. |
109
+ | `commitment` | Solana commitment | Solana client default | Default commitment for created connections. |
110
+ | `autoConnect` | `boolean` | `false` | Consumed by Vue/Nuxt integrations to reconnect a previously selected discovered wallet. |
111
+
69
112
  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.
70
113
 
71
114
  `autoConnect` is consumed by the Vue plugin and Nuxt module. It defaults to `false`; when set to `true`, Vue Solana reconnects only a previously selected wallet identity that is discovered again on the client.
@@ -84,27 +127,33 @@ Direct subpaths:
84
127
 
85
128
  - `@vue-solana/core/types`
86
129
  - `@vue-solana/core/address`
130
+ - `@vue-solana/core/buffer-polyfill`
87
131
  - `@vue-solana/core/clusters`
132
+ - `@vue-solana/core/errors`
88
133
  - `@vue-solana/core/ios-wallet`
89
134
  - `@vue-solana/core/mobile-wallet`
90
135
  - `@vue-solana/core/rpc`
136
+ - `@vue-solana/core/timeout`
91
137
  - `@vue-solana/core/transaction`
92
138
  - `@vue-solana/core/wallet`
93
139
  - `@vue-solana/core/wallet-standard`
94
-
95
- - `DEFAULT_CLUSTER`: default cluster, currently `devnet`.
96
- - `parsePublicKey(value)`: parses a `PublicKey`, address string, ref-like `{ value }`, getter, `null`, or `undefined` into a `PublicKey | null`.
97
- - `createSolanaConnection(config?)`: creates a `Connection`.
98
- - `createSolanaContext(config?)`: creates `{ cluster, endpoint, wsEndpoint, connection }`.
99
- - `getClusterEndpoint(cluster?)`: returns the HTTP RPC endpoint for a cluster.
100
- - `getClusterWebSocketEndpoint(cluster?)`: returns the WebSocket endpoint for a cluster.
101
- - `getWebSocketEndpoint(endpoint)`: converts `http`/`https` RPC URLs to `ws`/`wss` URLs.
102
- - `isWalletConnected(wallet)`: checks whether a wallet is connected and has a public key.
103
- - `assertWalletConnected(wallet)`: throws if the wallet is not connected.
104
- - `assertWalletCanSignMessage(wallet)`: throws if the wallet is disconnected or cannot sign messages.
105
- - `assertWalletCanSign(wallet)`: throws if the wallet cannot sign transactions.
106
- - `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.
107
- - `confirmTransactionSignature(connection, signature, options?)`: waits for a submitted signature to reach a requested commitment. Defaults to `confirmed` commitment and a 60 second timeout.
140
+ - `@vue-solana/core/web3`
141
+
142
+ | API | Description |
143
+ | ------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
144
+ | `DEFAULT_CLUSTER` | Default cluster, currently `devnet`. |
145
+ | `parsePublicKey(value)` | Parses a `PublicKey`, address string, ref-like `{ value }`, getter, `null`, or `undefined` into a `PublicKey \| null`. |
146
+ | `createSolanaConnection(config?)` | Creates a Solana `Connection`. |
147
+ | `createSolanaContext(config?)` | Creates `{ cluster, endpoint, wsEndpoint, connection }`. |
148
+ | `getClusterEndpoint(cluster?)` | Returns the HTTP RPC endpoint for a cluster. |
149
+ | `getClusterWebSocketEndpoint(cluster?)` | Returns the WebSocket endpoint for a cluster. |
150
+ | `getWebSocketEndpoint(endpoint)` | Converts `http`/`https` RPC URLs to `ws`/`wss` URLs. |
151
+ | `isWalletConnected(wallet)` | Checks whether a wallet is connected and has a public key. |
152
+ | `assertWalletConnected(wallet)` | Throws if the wallet is not connected. |
153
+ | `assertWalletCanSignMessage(wallet)` | Throws if the wallet is disconnected or cannot sign messages. |
154
+ | `assertWalletCanSign(wallet)` | Throws if the wallet cannot sign transactions. |
155
+ | `signAndSendTransaction(connection, wallet, transaction, options?)` | Signs and sends a transaction using a configured wallet. Android MWA wallets prefer `signTransaction` plus app-side RPC submission when available. |
156
+ | `confirmTransactionSignature(connection, signature, options?)` | Waits for a submitted signature to reach a requested commitment. Defaults to `confirmed` and a 60 second timeout. |
108
157
 
109
158
  ## Wallet Interface
110
159
 
@@ -153,37 +202,13 @@ npx skills add vue-solana/vue-solana --skill vue-solana
153
202
 
154
203
  Docs: [Vue Solana Agent Skill](https://vue-solana-docs.vercel.app/agent-skill)
155
204
 
156
- ## Known TypeScript Issue
157
-
158
- `@solana/web3-compat@0.0.21` currently has broken TypeScript metadata. Runtime imports still use the real package, but TypeScript consumers may need a local declaration shim.
159
-
160
- If TypeScript cannot resolve `@solana/web3-compat`, add `types/web3-compat.d.ts` to your app:
161
-
162
- ```ts
163
- declare module "@solana/web3-compat" {
164
- export type {
165
- AccountInfo,
166
- Commitment,
167
- RpcResponseAndContext,
168
- SendOptions,
169
- SignatureResult,
170
- SignatureStatus,
171
- TransactionSignature,
172
- } from "@solana/web3.js";
173
- export {
174
- Connection,
175
- Keypair,
176
- PublicKey,
177
- SystemProgram,
178
- Transaction,
179
- TransactionInstruction,
180
- VersionedTransaction,
181
- } from "@solana/web3.js";
182
- }
183
- ```
205
+ ## Caveats
184
206
 
185
- Make sure your `tsconfig.json` includes `types/**/*.d.ts` or another pattern that includes the shim.
207
+ - Public Solana RPC endpoints are useful for development, but production apps should use dedicated RPC infrastructure.
208
+ - Use `mainnet-beta` for Solana mainnet. `mainnet` is intentionally not accepted as a cluster alias.
209
+ - `@solana/web3-compat@0.0.21` currently has broken TypeScript package metadata. Runtime imports still use the real package, and current core packages publish temporary declaration shims for the documented import paths. See [Troubleshooting](https://vue-solana-docs.vercel.app/troubleshooting) for details.
210
+ - Desktop native app wallets are planned but not implemented yet.
186
211
 
187
212
  ## Status
188
213
 
189
- This package is early-stage. RPC helpers, browser extension wallet primitives, Android mobile wallet registration, message signing, and transaction helpers are usable.
214
+ This package provides RPC helpers, browser extension wallet primitives, Android mobile wallet registration, message signing, and transaction helpers.
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { PublicKey } from '@solana/web3-compat';
2
4
 
3
5
  type PublicKeyInput = PublicKey | string | null | undefined;
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { PublicKey } from '@solana/web3-compat';
2
4
 
3
5
  type PublicKeyInput = PublicKey | string | null | undefined;
package/dist/address.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { PublicKey } from '@solana/web3-compat';
2
4
 
3
5
  type PublicKeyInput = PublicKey | string | null | undefined;
@@ -0,0 +1,12 @@
1
+ 'use strict';
2
+
3
+ const _ = require('buffer/');
4
+
5
+ function installSolanaBufferPolyfill() {
6
+ const globalScope = globalThis;
7
+ globalScope.Buffer ??= _.Buffer;
8
+ return globalScope.Buffer;
9
+ }
10
+
11
+ exports.Buffer = _.Buffer;
12
+ exports.installSolanaBufferPolyfill = installSolanaBufferPolyfill;
@@ -0,0 +1,8 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
3
+ import { Buffer } from 'buffer/';
4
+ export { Buffer } from 'buffer/';
5
+
6
+ declare function installSolanaBufferPolyfill(): typeof Buffer;
7
+
8
+ export { installSolanaBufferPolyfill };
@@ -0,0 +1,8 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
3
+ import { Buffer } from 'buffer/';
4
+ export { Buffer } from 'buffer/';
5
+
6
+ declare function installSolanaBufferPolyfill(): typeof Buffer;
7
+
8
+ export { installSolanaBufferPolyfill };
@@ -0,0 +1,8 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
3
+ import { Buffer } from 'buffer/';
4
+ export { Buffer } from 'buffer/';
5
+
6
+ declare function installSolanaBufferPolyfill(): typeof Buffer;
7
+
8
+ export { installSolanaBufferPolyfill };
@@ -0,0 +1,10 @@
1
+ import { Buffer } from 'buffer/';
2
+ export { Buffer } from 'buffer/';
3
+
4
+ function installSolanaBufferPolyfill() {
5
+ const globalScope = globalThis;
6
+ globalScope.Buffer ??= Buffer;
7
+ return globalScope.Buffer;
8
+ }
9
+
10
+ export { installSolanaBufferPolyfill };
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaCluster } from './types.cjs';
2
4
  import '@solana/web3-compat';
3
5
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaCluster } from './types.mjs';
2
4
  import '@solana/web3-compat';
3
5
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaCluster } from './types.js';
2
4
  import '@solana/web3-compat';
3
5
 
package/dist/index.cjs CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  const clusters = require('./clusters.cjs');
4
4
  const address = require('./address.cjs');
5
+ const bufferPolyfill = require('./buffer-polyfill.cjs');
5
6
  const errors = require('./errors.cjs');
6
7
  const adapter = require('./shared/core.BsekSwcZ.cjs');
7
8
  const mobileWallet = require('./mobile-wallet.cjs');
@@ -9,8 +10,9 @@ const rpc = require('./rpc.cjs');
9
10
  const transaction = require('./transaction.cjs');
10
11
  const timeout = require('./timeout.cjs');
11
12
  const wallet = require('./wallet.cjs');
12
- const discovery = require('./shared/core.DX2frf65.cjs');
13
- require('@solana/web3-compat');
13
+ const discovery = require('./shared/core.BU9rgxEj.cjs');
14
+ const web3Compat = require('@solana/web3-compat');
15
+ const _ = require('buffer/');
14
16
  require('bs58');
15
17
  require('tweetnacl');
16
18
  require('@solana-mobile/wallet-standard-mobile');
@@ -25,6 +27,7 @@ exports.getClusterEndpoint = clusters.getClusterEndpoint;
25
27
  exports.getClusterWebSocketEndpoint = clusters.getClusterWebSocketEndpoint;
26
28
  exports.getWebSocketEndpoint = clusters.getWebSocketEndpoint;
27
29
  exports.parsePublicKey = address.parsePublicKey;
30
+ exports.installSolanaBufferPolyfill = bufferPolyfill.installSolanaBufferPolyfill;
28
31
  exports.SolanaError = errors.SolanaError;
29
32
  exports.createSolanaError = errors.createSolanaError;
30
33
  exports.isSolanaError = errors.isSolanaError;
@@ -59,3 +62,11 @@ exports.getRegisteredSolanaWallets = discovery.getRegisteredSolanaWallets;
59
62
  exports.getSolanaChain = discovery.getSolanaChain;
60
63
  exports.isSolanaStandardWallet = discovery.isSolanaStandardWallet;
61
64
  exports.subscribeSolanaWallets = discovery.subscribeSolanaWallets;
65
+ exports.Connection = web3Compat.Connection;
66
+ exports.Keypair = web3Compat.Keypair;
67
+ exports.PublicKey = web3Compat.PublicKey;
68
+ exports.SystemProgram = web3Compat.SystemProgram;
69
+ exports.Transaction = web3Compat.Transaction;
70
+ exports.TransactionInstruction = web3Compat.TransactionInstruction;
71
+ exports.VersionedTransaction = web3Compat.VersionedTransaction;
72
+ exports.Buffer = _.Buffer;
package/dist/index.d.cts CHANGED
@@ -1,5 +1,8 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  export { DEFAULT_CLUSTER, getClusterEndpoint, getClusterWebSocketEndpoint, getWebSocketEndpoint } from './clusters.cjs';
2
4
  export { MaybePublicKeyInput, PublicKeyInput, parsePublicKey } from './address.cjs';
5
+ export { installSolanaBufferPolyfill } from './buffer-polyfill.cjs';
3
6
  export { SolanaError, SolanaErrorCode, SolanaErrorOptions, createSolanaError, isSolanaError, normalizeSolanaError } from './errors.cjs';
4
7
  export { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, IosWalletCallbackResult, IosWalletInfo, IosWalletMethod, SolanaIosWalletAppIdentity, adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo } from './ios-wallet.cjs';
5
8
  export { RegisterSolanaMobileWalletOptions, SolanaMobileWalletAppIdentity, getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, registerSolanaMobileWallet } from './mobile-wallet.cjs';
@@ -9,5 +12,6 @@ export { withSolanaTimeout, withTimeout } from './timeout.cjs';
9
12
  export { ConfirmTransactionOptions, SendTransactionOptions, SolanaChain, SolanaCluster, SolanaConfig, SolanaContext, SolanaSignMessageResult, SolanaTransaction, SolanaWallet, SolanaWalletInfo, TransactionConfirmation } from './types.cjs';
10
13
  export { SolanaWalletError, SolanaWalletErrorCode, assertWalletCanSign, assertWalletCanSignMessage, assertWalletConnected, createNoWalletSelectedError, isWalletConnected } from './wallet.cjs';
11
14
  export { AdaptSolanaWalletOptions, SOLANA_CHAINS, SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.cjs';
12
- import '@solana/web3-compat';
15
+ export { AccountInfo, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SendOptions, SignatureResult, SignatureStatus, SystemProgram, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@solana/web3-compat';
16
+ export { Buffer } from 'buffer/';
13
17
  import '@wallet-standard/base';
package/dist/index.d.mts CHANGED
@@ -1,5 +1,8 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  export { DEFAULT_CLUSTER, getClusterEndpoint, getClusterWebSocketEndpoint, getWebSocketEndpoint } from './clusters.mjs';
2
4
  export { MaybePublicKeyInput, PublicKeyInput, parsePublicKey } from './address.mjs';
5
+ export { installSolanaBufferPolyfill } from './buffer-polyfill.mjs';
3
6
  export { SolanaError, SolanaErrorCode, SolanaErrorOptions, createSolanaError, isSolanaError, normalizeSolanaError } from './errors.mjs';
4
7
  export { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, IosWalletCallbackResult, IosWalletInfo, IosWalletMethod, SolanaIosWalletAppIdentity, adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo } from './ios-wallet.mjs';
5
8
  export { RegisterSolanaMobileWalletOptions, SolanaMobileWalletAppIdentity, getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, registerSolanaMobileWallet } from './mobile-wallet.mjs';
@@ -9,5 +12,6 @@ export { withSolanaTimeout, withTimeout } from './timeout.mjs';
9
12
  export { ConfirmTransactionOptions, SendTransactionOptions, SolanaChain, SolanaCluster, SolanaConfig, SolanaContext, SolanaSignMessageResult, SolanaTransaction, SolanaWallet, SolanaWalletInfo, TransactionConfirmation } from './types.mjs';
10
13
  export { SolanaWalletError, SolanaWalletErrorCode, assertWalletCanSign, assertWalletCanSignMessage, assertWalletConnected, createNoWalletSelectedError, isWalletConnected } from './wallet.mjs';
11
14
  export { AdaptSolanaWalletOptions, SOLANA_CHAINS, SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.mjs';
12
- import '@solana/web3-compat';
15
+ export { AccountInfo, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SendOptions, SignatureResult, SignatureStatus, SystemProgram, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@solana/web3-compat';
16
+ export { Buffer } from 'buffer/';
13
17
  import '@wallet-standard/base';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  export { DEFAULT_CLUSTER, getClusterEndpoint, getClusterWebSocketEndpoint, getWebSocketEndpoint } from './clusters.js';
2
4
  export { MaybePublicKeyInput, PublicKeyInput, parsePublicKey } from './address.js';
5
+ export { installSolanaBufferPolyfill } from './buffer-polyfill.js';
3
6
  export { SolanaError, SolanaErrorCode, SolanaErrorOptions, createSolanaError, isSolanaError, normalizeSolanaError } from './errors.js';
4
7
  export { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, IosWalletCallbackResult, IosWalletInfo, IosWalletMethod, SolanaIosWalletAppIdentity, adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo } from './ios-wallet.js';
5
8
  export { RegisterSolanaMobileWalletOptions, SolanaMobileWalletAppIdentity, getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, registerSolanaMobileWallet } from './mobile-wallet.js';
@@ -9,5 +12,6 @@ export { withSolanaTimeout, withTimeout } from './timeout.js';
9
12
  export { ConfirmTransactionOptions, SendTransactionOptions, SolanaChain, SolanaCluster, SolanaConfig, SolanaContext, SolanaSignMessageResult, SolanaTransaction, SolanaWallet, SolanaWalletInfo, TransactionConfirmation } from './types.js';
10
13
  export { SolanaWalletError, SolanaWalletErrorCode, assertWalletCanSign, assertWalletCanSignMessage, assertWalletConnected, createNoWalletSelectedError, isWalletConnected } from './wallet.js';
11
14
  export { AdaptSolanaWalletOptions, SOLANA_CHAINS, SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, adaptSolanaStandardWallet, getRegisteredSolanaWallets, getSolanaChain, isSolanaStandardWallet, subscribeSolanaWallets } from './wallet-standard.js';
12
- import '@solana/web3-compat';
15
+ export { AccountInfo, Commitment, Connection, Keypair, PublicKey, RpcResponseAndContext, SendOptions, SignatureResult, SignatureStatus, SystemProgram, Transaction, TransactionInstruction, TransactionSignature, VersionedTransaction } from '@solana/web3-compat';
16
+ export { Buffer } from 'buffer/';
13
17
  import '@wallet-standard/base';
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  export { DEFAULT_CLUSTER, getClusterEndpoint, getClusterWebSocketEndpoint, getWebSocketEndpoint } from './clusters.mjs';
2
2
  export { parsePublicKey } from './address.mjs';
3
+ export { installSolanaBufferPolyfill } from './buffer-polyfill.mjs';
3
4
  export { SolanaError, createSolanaError, isSolanaError, normalizeSolanaError } from './errors.mjs';
4
5
  export { a as adaptSolanaIosWallet, g as getDefaultIosWalletAppIdentity, b as getDefaultIosWalletRedirectUrl, c as getSolanaIosWallets, h as handleSolanaIosWalletCallback, i as isIosBrowser, d as isSolanaIosBrowserWalletSupported, e as isSolanaIosWalletInfo } from './shared/core.Ch_Z7_17.mjs';
5
6
  export { getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, registerSolanaMobileWallet } from './mobile-wallet.mjs';
@@ -7,8 +8,9 @@ export { createSolanaConnection, createSolanaContext } from './rpc.mjs';
7
8
  export { confirmTransactionSignature, signAndSendTransaction } from './transaction.mjs';
8
9
  export { withSolanaTimeout, withTimeout } from './timeout.mjs';
9
10
  export { SolanaWalletError, assertWalletCanSign, assertWalletCanSignMessage, assertWalletConnected, createNoWalletSelectedError, isWalletConnected } from './wallet.mjs';
10
- export { S as SOLANA_CHAINS, a as SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, b as adaptSolanaStandardWallet, g as getRegisteredSolanaWallets, c as getSolanaChain, i as isSolanaStandardWallet, s as subscribeSolanaWallets } from './shared/core.DSMNiaHD.mjs';
11
- import '@solana/web3-compat';
11
+ export { S as SOLANA_CHAINS, a as SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, b as adaptSolanaStandardWallet, g as getRegisteredSolanaWallets, c as getSolanaChain, i as isSolanaStandardWallet, s as subscribeSolanaWallets } from './shared/core.BBMCTQpw.mjs';
12
+ export { Connection, Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction, VersionedTransaction } from '@solana/web3-compat';
13
+ export { Buffer } from 'buffer/';
12
14
  import 'bs58';
13
15
  import 'tweetnacl';
14
16
  import '@solana-mobile/wallet-standard-mobile';
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaChain, SolanaCluster, SolanaWalletInfo, SolanaWallet } from './types.cjs';
2
4
  import '@solana/web3-compat';
3
5
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaChain, SolanaCluster, SolanaWalletInfo, SolanaWallet } from './types.mjs';
2
4
  import '@solana/web3-compat';
3
5
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaChain, SolanaCluster, SolanaWalletInfo, SolanaWallet } from './types.js';
2
4
  import '@solana/web3-compat';
3
5
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaChain } from './types.cjs';
2
4
  import '@solana/web3-compat';
3
5
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaChain } from './types.mjs';
2
4
  import '@solana/web3-compat';
3
5
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaChain } from './types.js';
2
4
  import '@solana/web3-compat';
3
5
 
package/dist/rpc.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { Connection } from '@solana/web3-compat';
2
4
  import { SolanaConfig, SolanaContext } from './types.cjs';
3
5
 
package/dist/rpc.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { Connection } from '@solana/web3-compat';
2
4
  import { SolanaConfig, SolanaContext } from './types.mjs';
3
5
 
package/dist/rpc.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { Connection } from '@solana/web3-compat';
2
4
  import { SolanaConfig, SolanaContext } from './types.js';
3
5
 
@@ -2,6 +2,7 @@ import { StandardEvents, StandardDisconnect, StandardConnect } from '@wallet-sta
2
2
  import { SolanaSignAndSendTransaction, SolanaSignTransaction, SolanaSignMessage } from '@solana/wallet-standard-features';
3
3
  import { Transaction, VersionedTransaction, PublicKey } from '@solana/web3-compat';
4
4
  import bs58 from 'bs58';
5
+ import { SolanaWalletError } from '../wallet.mjs';
5
6
  import { getWallets } from '@wallet-standard/app';
6
7
 
7
8
  const SOLANA_CHAINS = [
@@ -151,7 +152,15 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
151
152
  if (!result) {
152
153
  throw new Error("Solana wallet did not return a signed transaction");
153
154
  }
154
- return deserializeTransaction(transactions[index], result.signedTransaction);
155
+ const transaction = transactions[index];
156
+ if (!transaction) {
157
+ throw new SolanaWalletError(
158
+ "WALLET_FEATURE_UNSUPPORTED",
159
+ "Solana wallet returned a signed transaction without a matching request",
160
+ { feature: "signTransaction" }
161
+ );
162
+ }
163
+ return deserializeTransaction(transaction, result.signedTransaction);
155
164
  });
156
165
  } : void 0,
157
166
  signAndSendTransaction: hasSignAndSendTransaction(wallet) ? async (transaction, sendOptions) => {
@@ -4,6 +4,7 @@ const features = require('@wallet-standard/features');
4
4
  const walletStandardFeatures = require('@solana/wallet-standard-features');
5
5
  const web3Compat = require('@solana/web3-compat');
6
6
  const bs58 = require('bs58');
7
+ const wallet = require('../wallet.cjs');
7
8
  const app = require('@wallet-standard/app');
8
9
 
9
10
  function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
@@ -47,14 +48,14 @@ function deserializeTransaction(source, bytes) {
47
48
  }
48
49
 
49
50
  function adaptSolanaStandardWallet(walletInfo, options = {}) {
50
- const wallet = walletInfo.wallet;
51
- let accounts = wallet.accounts;
51
+ const wallet$1 = walletInfo.wallet;
52
+ let accounts = wallet$1.accounts;
52
53
  let account = options.account;
53
54
  let allowAccountUpdates = Boolean(options.account);
54
55
  let connecting = false;
55
56
  let disconnecting = false;
56
57
  let manuallyDisconnected = false;
57
- const eventsFeature = wallet.features[features.StandardEvents];
58
+ const eventsFeature = wallet$1.features[features.StandardEvents];
58
59
  eventsFeature?.on("change", (properties) => {
59
60
  if (properties.accounts) {
60
61
  accounts = properties.accounts;
@@ -82,7 +83,7 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
82
83
  manuallyDisconnected = false;
83
84
  options.onChange?.();
84
85
  try {
85
- const feature = wallet.features[features.StandardConnect];
86
+ const feature = wallet$1.features[features.StandardConnect];
86
87
  const result = await feature.connect();
87
88
  accounts = result.accounts;
88
89
  allowAccountUpdates = true;
@@ -96,7 +97,7 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
96
97
  }
97
98
  },
98
99
  async disconnect() {
99
- const feature = wallet.features[features.StandardDisconnect];
100
+ const feature = wallet$1.features[features.StandardDisconnect];
100
101
  disconnecting = true;
101
102
  manuallyDisconnected = true;
102
103
  allowAccountUpdates = false;
@@ -116,9 +117,9 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
116
117
  options.onChange?.();
117
118
  }
118
119
  },
119
- signMessage: hasSignMessage(wallet) ? async (message) => {
120
+ signMessage: hasSignMessage(wallet$1) ? async (message) => {
120
121
  const activeAccount = getActiveAccount(account);
121
- const [result] = await wallet.features[walletStandardFeatures.SolanaSignMessage].signMessage({
122
+ const [result] = await wallet$1.features[walletStandardFeatures.SolanaSignMessage].signMessage({
122
123
  account: activeAccount,
123
124
  message
124
125
  });
@@ -127,9 +128,9 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
127
128
  }
128
129
  return result;
129
130
  } : void 0,
130
- signTransaction: hasSignTransaction(wallet) ? async (transaction) => {
131
+ signTransaction: hasSignTransaction(wallet$1) ? async (transaction) => {
131
132
  const activeAccount = getActiveAccount(account);
132
- const [result] = await wallet.features[walletStandardFeatures.SolanaSignTransaction].signTransaction({
133
+ const [result] = await wallet$1.features[walletStandardFeatures.SolanaSignTransaction].signTransaction({
133
134
  account: activeAccount,
134
135
  transaction: serializeTransaction(transaction),
135
136
  chain: options.chain
@@ -139,9 +140,9 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
139
140
  }
140
141
  return deserializeTransaction(transaction, result.signedTransaction);
141
142
  } : void 0,
142
- signAllTransactions: hasSignTransaction(wallet) ? async (transactions) => {
143
+ signAllTransactions: hasSignTransaction(wallet$1) ? async (transactions) => {
143
144
  const activeAccount = getActiveAccount(account);
144
- const results = await wallet.features[walletStandardFeatures.SolanaSignTransaction].signTransaction(
145
+ const results = await wallet$1.features[walletStandardFeatures.SolanaSignTransaction].signTransaction(
145
146
  ...transactions.map((transaction) => ({
146
147
  account: activeAccount,
147
148
  transaction: serializeTransaction(transaction),
@@ -157,12 +158,20 @@ function adaptSolanaStandardWallet(walletInfo, options = {}) {
157
158
  if (!result) {
158
159
  throw new Error("Solana wallet did not return a signed transaction");
159
160
  }
160
- return deserializeTransaction(transactions[index], result.signedTransaction);
161
+ const transaction = transactions[index];
162
+ if (!transaction) {
163
+ throw new wallet.SolanaWalletError(
164
+ "WALLET_FEATURE_UNSUPPORTED",
165
+ "Solana wallet returned a signed transaction without a matching request",
166
+ { feature: "signTransaction" }
167
+ );
168
+ }
169
+ return deserializeTransaction(transaction, result.signedTransaction);
161
170
  });
162
171
  } : void 0,
163
- signAndSendTransaction: hasSignAndSendTransaction(wallet) ? async (transaction, sendOptions) => {
172
+ signAndSendTransaction: hasSignAndSendTransaction(wallet$1) ? async (transaction, sendOptions) => {
164
173
  const activeAccount = getActiveAccount(account);
165
- const [result] = await wallet.features[walletStandardFeatures.SolanaSignAndSendTransaction].signAndSendTransaction({
174
+ const [result] = await wallet$1.features[walletStandardFeatures.SolanaSignAndSendTransaction].signAndSendTransaction({
166
175
  account: activeAccount,
167
176
  transaction: serializeTransaction(transaction),
168
177
  chain: options.chain ?? getSolanaAccountChain(activeAccount),
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { Connection, TransactionSignature } from '@solana/web3-compat';
2
4
  import { ConfirmTransactionOptions, TransactionConfirmation, SolanaWallet, SolanaTransaction, SendTransactionOptions } from './types.cjs';
3
5
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { Connection, TransactionSignature } from '@solana/web3-compat';
2
4
  import { ConfirmTransactionOptions, TransactionConfirmation, SolanaWallet, SolanaTransaction, SendTransactionOptions } from './types.mjs';
3
5
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { Connection, TransactionSignature } from '@solana/web3-compat';
2
4
  import { ConfirmTransactionOptions, TransactionConfirmation, SolanaWallet, SolanaTransaction, SendTransactionOptions } from './types.js';
3
5
 
package/dist/types.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { Commitment, SendOptions, Connection, Transaction, VersionedTransaction, PublicKey, TransactionSignature, RpcResponseAndContext, SignatureResult } from '@solana/web3-compat';
2
4
 
3
5
  type SolanaCluster = "mainnet-beta" | "testnet" | "devnet" | "localnet";
package/dist/types.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { Commitment, SendOptions, Connection, Transaction, VersionedTransaction, PublicKey, TransactionSignature, RpcResponseAndContext, SignatureResult } from '@solana/web3-compat';
2
4
 
3
5
  type SolanaCluster = "mainnet-beta" | "testnet" | "devnet" | "localnet";
package/dist/types.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { Commitment, SendOptions, Connection, Transaction, VersionedTransaction, PublicKey, TransactionSignature, RpcResponseAndContext, SignatureResult } from '@solana/web3-compat';
2
4
 
3
5
  type SolanaCluster = "mainnet-beta" | "testnet" | "devnet" | "localnet";
@@ -1,10 +1,12 @@
1
1
  'use strict';
2
2
 
3
- const discovery = require('./shared/core.DX2frf65.cjs');
3
+ const discovery = require('./shared/core.BU9rgxEj.cjs');
4
4
  require('@wallet-standard/features');
5
5
  require('@solana/wallet-standard-features');
6
6
  require('@solana/web3-compat');
7
7
  require('bs58');
8
+ require('./wallet.cjs');
9
+ require('./errors.cjs');
8
10
  require('@wallet-standard/app');
9
11
 
10
12
 
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { WalletAccount, Wallet } from '@wallet-standard/base';
2
4
  import { SolanaChain, SolanaWalletInfo, SolanaWallet, SolanaCluster } from './types.cjs';
3
5
  import '@solana/web3-compat';
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { WalletAccount, Wallet } from '@wallet-standard/base';
2
4
  import { SolanaChain, SolanaWalletInfo, SolanaWallet, SolanaCluster } from './types.mjs';
3
5
  import '@solana/web3-compat';
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { WalletAccount, Wallet } from '@wallet-standard/base';
2
4
  import { SolanaChain, SolanaWalletInfo, SolanaWallet, SolanaCluster } from './types.js';
3
5
  import '@solana/web3-compat';
@@ -1,6 +1,8 @@
1
- export { S as SOLANA_CHAINS, a as SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, b as adaptSolanaStandardWallet, g as getRegisteredSolanaWallets, c as getSolanaChain, i as isSolanaStandardWallet, s as subscribeSolanaWallets } from './shared/core.DSMNiaHD.mjs';
1
+ export { S as SOLANA_CHAINS, a as SOLANA_MOBILE_WALLET_ADAPTER_WALLET_NAME, b as adaptSolanaStandardWallet, g as getRegisteredSolanaWallets, c as getSolanaChain, i as isSolanaStandardWallet, s as subscribeSolanaWallets } from './shared/core.BBMCTQpw.mjs';
2
2
  import '@wallet-standard/features';
3
3
  import '@solana/wallet-standard-features';
4
4
  import '@solana/web3-compat';
5
5
  import 'bs58';
6
+ import './wallet.mjs';
7
+ import './errors.mjs';
6
8
  import '@wallet-standard/app';
package/dist/wallet.d.cts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaWallet } from './types.cjs';
2
4
  import { SolanaError } from './errors.cjs';
3
5
  import '@solana/web3-compat';
package/dist/wallet.d.mts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaWallet } from './types.mjs';
2
4
  import { SolanaError } from './errors.mjs';
3
5
  import '@solana/web3-compat';
package/dist/wallet.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ /// <reference path="../types/web3-compat.d.ts" />
2
+ /// <reference path="../types/buffer.d.ts" />
1
3
  import { SolanaWallet } from './types.js';
2
4
  import { SolanaError } from './errors.js';
3
5
  import '@solana/web3-compat';
package/dist/web3.cjs ADDED
@@ -0,0 +1,13 @@
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;
@@ -0,0 +1,3 @@
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';
@@ -0,0 +1,3 @@
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 ADDED
@@ -0,0 +1,3 @@
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 ADDED
@@ -0,0 +1 @@
1
+ export { Connection, Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction, VersionedTransaction } from '@solana/web3-compat';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/core",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
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
+ "./buffer-polyfill": {
39
+ "types": "./dist/buffer-polyfill.d.ts",
40
+ "import": "./dist/buffer-polyfill.mjs",
41
+ "require": "./dist/buffer-polyfill.cjs"
42
+ },
38
43
  "./types": {
39
44
  "types": "./dist/types.d.ts",
40
45
  "import": "./dist/types.mjs",
@@ -84,10 +89,16 @@
84
89
  "types": "./dist/wallet-standard.d.ts",
85
90
  "import": "./dist/wallet-standard.mjs",
86
91
  "require": "./dist/wallet-standard.cjs"
92
+ },
93
+ "./web3": {
94
+ "types": "./dist/web3.d.ts",
95
+ "import": "./dist/web3.mjs",
96
+ "require": "./dist/web3.cjs"
87
97
  }
88
98
  },
89
99
  "files": [
90
- "dist"
100
+ "dist",
101
+ "types"
91
102
  ],
92
103
  "publishConfig": {
93
104
  "access": "public"
@@ -99,6 +110,7 @@
99
110
  "@wallet-standard/app": "^1.1.1",
100
111
  "@wallet-standard/base": "^1.1.1",
101
112
  "@wallet-standard/features": "^1.1.1",
113
+ "buffer": "^6.0.3",
102
114
  "bs58": "^6.0.0",
103
115
  "tweetnacl": "^1.0.3"
104
116
  },
@@ -107,7 +119,7 @@
107
119
  "unbuild": "^3.5.0"
108
120
  },
109
121
  "scripts": {
110
- "build": "unbuild",
122
+ "build": "unbuild && node scripts/prepare-declarations.mjs",
111
123
  "dev": "unbuild --stub",
112
124
  "typecheck": "tsc --noEmit",
113
125
  "clean": "rm -rf dist"
@@ -0,0 +1,3 @@
1
+ declare module "buffer/" {
2
+ export * from "buffer";
3
+ }
@@ -0,0 +1,140 @@
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
+ }