@vue-solana/core 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -48,6 +48,7 @@ The root export remains supported. Direct subpath exports are also available for
48
48
 
49
49
  ```ts
50
50
  import { createSolanaContext } from "@vue-solana/core/rpc";
51
+ import { parsePublicKey } from "@vue-solana/core/address";
51
52
  import type { SolanaConfig } from "@vue-solana/core/types";
52
53
  ```
53
54
 
@@ -82,6 +83,7 @@ https://faucet.solana.com
82
83
  Direct subpaths:
83
84
 
84
85
  - `@vue-solana/core/types`
86
+ - `@vue-solana/core/address`
85
87
  - `@vue-solana/core/clusters`
86
88
  - `@vue-solana/core/ios-wallet`
87
89
  - `@vue-solana/core/mobile-wallet`
@@ -91,6 +93,7 @@ Direct subpaths:
91
93
  - `@vue-solana/core/wallet-standard`
92
94
 
93
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`.
94
97
  - `createSolanaConnection(config?)`: creates a `Connection`.
95
98
  - `createSolanaContext(config?)`: creates `{ cluster, endpoint, wsEndpoint, connection }`.
96
99
  - `getClusterEndpoint(cluster?)`: returns the HTTP RPC endpoint for a cluster.
@@ -156,10 +159,12 @@ If TypeScript cannot resolve `@solana/web3-compat`, add `types/web3-compat.d.ts`
156
159
  ```ts
157
160
  declare module "@solana/web3-compat" {
158
161
  export type {
162
+ AccountInfo,
159
163
  Commitment,
160
164
  RpcResponseAndContext,
161
165
  SendOptions,
162
166
  SignatureResult,
167
+ SignatureStatus,
163
168
  TransactionSignature,
164
169
  } from "@solana/web3.js";
165
170
  export {
@@ -0,0 +1,25 @@
1
+ 'use strict';
2
+
3
+ const web3Compat = require('@solana/web3-compat');
4
+
5
+ function parsePublicKey(value) {
6
+ const publicKeyInput = toPublicKeyInput(value);
7
+ if (!publicKeyInput) {
8
+ return null;
9
+ }
10
+ return typeof publicKeyInput === "string" ? new web3Compat.PublicKey(publicKeyInput) : publicKeyInput;
11
+ }
12
+ function toPublicKeyInput(value) {
13
+ if (!value) {
14
+ return null;
15
+ }
16
+ if (typeof value === "function") {
17
+ return value();
18
+ }
19
+ if (value instanceof web3Compat.PublicKey || typeof value === "string") {
20
+ return value;
21
+ }
22
+ return value.value;
23
+ }
24
+
25
+ exports.parsePublicKey = parsePublicKey;
@@ -0,0 +1,10 @@
1
+ import { PublicKey } from '@solana/web3-compat';
2
+
3
+ type PublicKeyInput = PublicKey | string | null | undefined;
4
+ type MaybePublicKeyInput = PublicKeyInput | {
5
+ value: PublicKeyInput;
6
+ } | (() => PublicKeyInput);
7
+ declare function parsePublicKey(value: MaybePublicKeyInput): PublicKey | null;
8
+
9
+ export { parsePublicKey };
10
+ export type { MaybePublicKeyInput, PublicKeyInput };
@@ -0,0 +1,10 @@
1
+ import { PublicKey } from '@solana/web3-compat';
2
+
3
+ type PublicKeyInput = PublicKey | string | null | undefined;
4
+ type MaybePublicKeyInput = PublicKeyInput | {
5
+ value: PublicKeyInput;
6
+ } | (() => PublicKeyInput);
7
+ declare function parsePublicKey(value: MaybePublicKeyInput): PublicKey | null;
8
+
9
+ export { parsePublicKey };
10
+ export type { MaybePublicKeyInput, PublicKeyInput };
@@ -0,0 +1,10 @@
1
+ import { PublicKey } from '@solana/web3-compat';
2
+
3
+ type PublicKeyInput = PublicKey | string | null | undefined;
4
+ type MaybePublicKeyInput = PublicKeyInput | {
5
+ value: PublicKeyInput;
6
+ } | (() => PublicKeyInput);
7
+ declare function parsePublicKey(value: MaybePublicKeyInput): PublicKey | null;
8
+
9
+ export { parsePublicKey };
10
+ export type { MaybePublicKeyInput, PublicKeyInput };
@@ -0,0 +1,23 @@
1
+ import { PublicKey } from '@solana/web3-compat';
2
+
3
+ function parsePublicKey(value) {
4
+ const publicKeyInput = toPublicKeyInput(value);
5
+ if (!publicKeyInput) {
6
+ return null;
7
+ }
8
+ return typeof publicKeyInput === "string" ? new PublicKey(publicKeyInput) : publicKeyInput;
9
+ }
10
+ function toPublicKeyInput(value) {
11
+ if (!value) {
12
+ return null;
13
+ }
14
+ if (typeof value === "function") {
15
+ return value();
16
+ }
17
+ if (value instanceof PublicKey || typeof value === "string") {
18
+ return value;
19
+ }
20
+ return value.value;
21
+ }
22
+
23
+ export { parsePublicKey };
package/dist/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  const clusters = require('./clusters.cjs');
4
+ const address = require('./address.cjs');
4
5
  const adapter = require('./shared/core.DJZldB_x.cjs');
5
6
  const mobileWallet = require('./mobile-wallet.cjs');
6
7
  const rpc = require('./rpc.cjs');
@@ -21,6 +22,7 @@ exports.DEFAULT_CLUSTER = clusters.DEFAULT_CLUSTER;
21
22
  exports.getClusterEndpoint = clusters.getClusterEndpoint;
22
23
  exports.getClusterWebSocketEndpoint = clusters.getClusterWebSocketEndpoint;
23
24
  exports.getWebSocketEndpoint = clusters.getWebSocketEndpoint;
25
+ exports.parsePublicKey = address.parsePublicKey;
24
26
  exports.adaptSolanaIosWallet = adapter.adaptSolanaIosWallet;
25
27
  exports.getDefaultIosWalletAppIdentity = adapter.getDefaultIosWalletAppIdentity;
26
28
  exports.getDefaultIosWalletRedirectUrl = adapter.getDefaultIosWalletRedirectUrl;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { DEFAULT_CLUSTER, getClusterEndpoint, getClusterWebSocketEndpoint, getWebSocketEndpoint } from './clusters.cjs';
2
+ export { MaybePublicKeyInput, PublicKeyInput, parsePublicKey } from './address.cjs';
2
3
  export { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, IosWalletCallbackResult, IosWalletInfo, IosWalletMethod, SolanaIosWalletAppIdentity, adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo } from './ios-wallet.cjs';
3
4
  export { RegisterSolanaMobileWalletOptions, SolanaMobileWalletAppIdentity, getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, registerSolanaMobileWallet } from './mobile-wallet.cjs';
4
5
  export { createSolanaConnection, createSolanaContext } from './rpc.cjs';
package/dist/index.d.mts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { DEFAULT_CLUSTER, getClusterEndpoint, getClusterWebSocketEndpoint, getWebSocketEndpoint } from './clusters.mjs';
2
+ export { MaybePublicKeyInput, PublicKeyInput, parsePublicKey } from './address.mjs';
2
3
  export { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, IosWalletCallbackResult, IosWalletInfo, IosWalletMethod, SolanaIosWalletAppIdentity, adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo } from './ios-wallet.mjs';
3
4
  export { RegisterSolanaMobileWalletOptions, SolanaMobileWalletAppIdentity, getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, registerSolanaMobileWallet } from './mobile-wallet.mjs';
4
5
  export { createSolanaConnection, createSolanaContext } from './rpc.mjs';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { DEFAULT_CLUSTER, getClusterEndpoint, getClusterWebSocketEndpoint, getWebSocketEndpoint } from './clusters.js';
2
+ export { MaybePublicKeyInput, PublicKeyInput, parsePublicKey } from './address.js';
2
3
  export { AdaptSolanaIosWalletOptions, GetSolanaIosWalletsOptions, IosWalletCallbackResult, IosWalletInfo, IosWalletMethod, SolanaIosWalletAppIdentity, adaptSolanaIosWallet, getDefaultIosWalletAppIdentity, getDefaultIosWalletRedirectUrl, getSolanaIosWallets, handleSolanaIosWalletCallback, isIosBrowser, isSolanaIosBrowserWalletSupported, isSolanaIosWalletInfo } from './ios-wallet.js';
3
4
  export { RegisterSolanaMobileWalletOptions, SolanaMobileWalletAppIdentity, getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, registerSolanaMobileWallet } from './mobile-wallet.js';
4
5
  export { createSolanaConnection, createSolanaContext } from './rpc.js';
package/dist/index.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  export { DEFAULT_CLUSTER, getClusterEndpoint, getClusterWebSocketEndpoint, getWebSocketEndpoint } from './clusters.mjs';
2
+ export { parsePublicKey } from './address.mjs';
2
3
  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.DSI7vIfT.mjs';
3
4
  export { getDefaultMobileWalletAppIdentity, isSolanaMobileWalletSupported, registerSolanaMobileWallet } from './mobile-wallet.mjs';
4
5
  export { createSolanaConnection, createSolanaContext } from './rpc.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-solana/core",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "Framework-agnostic primitives for Vue Solana libraries.",
5
5
  "license": "MIT",
6
6
  "keywords": [
@@ -30,6 +30,11 @@
30
30
  "import": "./dist/index.mjs",
31
31
  "require": "./dist/index.cjs"
32
32
  },
33
+ "./address": {
34
+ "types": "./dist/address.d.ts",
35
+ "import": "./dist/address.mjs",
36
+ "require": "./dist/address.cjs"
37
+ },
33
38
  "./types": {
34
39
  "types": "./dist/types.d.ts",
35
40
  "import": "./dist/types.mjs",