solana-mobile 0.0.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/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { n as createSolanaClient, r as getWsUrl, t as getExplorerUrl } from "./src-B_8LrWmO.mjs";
2
+ export { createSolanaClient, getExplorerUrl, getWsUrl };
@@ -0,0 +1,47 @@
1
+ let _solana_kit = require("@solana/kit");
2
+ let _solana_kit_plugin_rpc = require("@solana/kit-plugin-rpc");
3
+ //#region src/lib/get-ws-url.ts
4
+ /**
5
+ * Derive a WebSocket URL from an HTTP URL.
6
+ *
7
+ * `url.replace('http', 'ws')` correctly handles both protocols:
8
+ * - `http://` → `ws://`
9
+ * - `https://` → `wss://` (replaces first occurrence of 'http' → 'ws', leaving the 's')
10
+ *
11
+ * Also maps the default RPC port 8899 to the default WS port 8900.
12
+ */
13
+ function getWsUrl(url) {
14
+ return url.replace("http", "ws").replace("8899", "8900");
15
+ }
16
+ //#endregion
17
+ //#region src/lib/create-solana-client.ts
18
+ function createSolanaClient({ url, urlWs }) {
19
+ urlWs = urlWs ?? getWsUrl(url);
20
+ return (0, _solana_kit.createClient)().use((0, _solana_kit_plugin_rpc.rpc)(url, urlWs ? { url: urlWs } : void 0));
21
+ }
22
+ //#endregion
23
+ //#region src/lib/get-explorer-url.ts
24
+ function getExplorerUrl(path, cluster = "devnet") {
25
+ return `https://explorer.solana.com/${path}${cluster === "mainnet-beta" ? "" : `?cluster=${cluster}`}`;
26
+ }
27
+ //#endregion
28
+ Object.defineProperty(exports, "createSolanaClient", {
29
+ enumerable: true,
30
+ get: function() {
31
+ return createSolanaClient;
32
+ }
33
+ });
34
+ Object.defineProperty(exports, "getExplorerUrl", {
35
+ enumerable: true,
36
+ get: function() {
37
+ return getExplorerUrl;
38
+ }
39
+ });
40
+ Object.defineProperty(exports, "getWsUrl", {
41
+ enumerable: true,
42
+ get: function() {
43
+ return getWsUrl;
44
+ }
45
+ });
46
+
47
+ //# sourceMappingURL=src-B5DkELSU.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-B5DkELSU.cjs","names":[],"sources":["../src/lib/get-ws-url.ts","../src/lib/create-solana-client.ts","../src/lib/get-explorer-url.ts"],"sourcesContent":["/**\n * Derive a WebSocket URL from an HTTP URL.\n *\n * `url.replace('http', 'ws')` correctly handles both protocols:\n * - `http://` → `ws://`\n * - `https://` → `wss://` (replaces first occurrence of 'http' → 'ws', leaving the 's')\n *\n * Also maps the default RPC port 8899 to the default WS port 8900.\n */\nexport function getWsUrl(url: string): string {\n return url.replace('http', 'ws').replace('8899', '8900')\n}\n","import { createClient } from '@solana/kit'\nimport { rpc } from '@solana/kit-plugin-rpc'\nimport { getWsUrl } from './get-ws-url.ts'\n\nexport function createSolanaClient({ url, urlWs }: { url: string; urlWs?: string }) {\n urlWs = urlWs ?? getWsUrl(url)\n return createClient().use(rpc(url, urlWs ? { url: urlWs } : undefined))\n}\n\nexport type SolanaClient = ReturnType<typeof createSolanaClient>\n","export type SolanaCluster = 'devnet' | 'mainnet-beta' | 'testnet'\n\nexport type ExplorerPath = `account/${string}` | `block/${string}` | `tx/${string}`\n\nexport function getExplorerUrl(path: ExplorerPath, cluster: SolanaCluster = 'devnet'): string {\n const base = 'https://explorer.solana.com'\n const clusterParam = cluster === 'mainnet-beta' ? '' : `?cluster=${cluster}`\n\n return `${base}/${path}${clusterParam}`\n}\n"],"mappings":";;;;;;;;;;;;AASA,SAAgB,SAAS,KAAqB;AAC5C,QAAO,IAAI,QAAQ,QAAQ,KAAK,CAAC,QAAQ,QAAQ,OAAO;;;;ACN1D,SAAgB,mBAAmB,EAAE,KAAK,SAA0C;AAClF,SAAQ,SAAS,SAAS,IAAI;AAC9B,SAAA,GAAA,YAAA,eAAqB,CAAC,KAAA,GAAA,uBAAA,KAAQ,KAAK,QAAQ,EAAE,KAAK,OAAO,GAAG,KAAA,EAAU,CAAC;;;;ACFzE,SAAgB,eAAe,MAAoB,UAAyB,UAAkB;AAI5F,QAAO,+BAAW,OAFG,YAAY,iBAAiB,KAAK,YAAY"}
@@ -0,0 +1,30 @@
1
+ import { createClient } from "@solana/kit";
2
+ import { rpc } from "@solana/kit-plugin-rpc";
3
+ //#region src/lib/get-ws-url.ts
4
+ /**
5
+ * Derive a WebSocket URL from an HTTP URL.
6
+ *
7
+ * `url.replace('http', 'ws')` correctly handles both protocols:
8
+ * - `http://` → `ws://`
9
+ * - `https://` → `wss://` (replaces first occurrence of 'http' → 'ws', leaving the 's')
10
+ *
11
+ * Also maps the default RPC port 8899 to the default WS port 8900.
12
+ */
13
+ function getWsUrl(url) {
14
+ return url.replace("http", "ws").replace("8899", "8900");
15
+ }
16
+ //#endregion
17
+ //#region src/lib/create-solana-client.ts
18
+ function createSolanaClient({ url, urlWs }) {
19
+ urlWs = urlWs ?? getWsUrl(url);
20
+ return createClient().use(rpc(url, urlWs ? { url: urlWs } : void 0));
21
+ }
22
+ //#endregion
23
+ //#region src/lib/get-explorer-url.ts
24
+ function getExplorerUrl(path, cluster = "devnet") {
25
+ return `https://explorer.solana.com/${path}${cluster === "mainnet-beta" ? "" : `?cluster=${cluster}`}`;
26
+ }
27
+ //#endregion
28
+ export { createSolanaClient as n, getWsUrl as r, getExplorerUrl as t };
29
+
30
+ //# sourceMappingURL=src-B_8LrWmO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"src-B_8LrWmO.mjs","names":[],"sources":["../src/lib/get-ws-url.ts","../src/lib/create-solana-client.ts","../src/lib/get-explorer-url.ts"],"sourcesContent":["/**\n * Derive a WebSocket URL from an HTTP URL.\n *\n * `url.replace('http', 'ws')` correctly handles both protocols:\n * - `http://` → `ws://`\n * - `https://` → `wss://` (replaces first occurrence of 'http' → 'ws', leaving the 's')\n *\n * Also maps the default RPC port 8899 to the default WS port 8900.\n */\nexport function getWsUrl(url: string): string {\n return url.replace('http', 'ws').replace('8899', '8900')\n}\n","import { createClient } from '@solana/kit'\nimport { rpc } from '@solana/kit-plugin-rpc'\nimport { getWsUrl } from './get-ws-url.ts'\n\nexport function createSolanaClient({ url, urlWs }: { url: string; urlWs?: string }) {\n urlWs = urlWs ?? getWsUrl(url)\n return createClient().use(rpc(url, urlWs ? { url: urlWs } : undefined))\n}\n\nexport type SolanaClient = ReturnType<typeof createSolanaClient>\n","export type SolanaCluster = 'devnet' | 'mainnet-beta' | 'testnet'\n\nexport type ExplorerPath = `account/${string}` | `block/${string}` | `tx/${string}`\n\nexport function getExplorerUrl(path: ExplorerPath, cluster: SolanaCluster = 'devnet'): string {\n const base = 'https://explorer.solana.com'\n const clusterParam = cluster === 'mainnet-beta' ? '' : `?cluster=${cluster}`\n\n return `${base}/${path}${clusterParam}`\n}\n"],"mappings":";;;;;;;;;;;;AASA,SAAgB,SAAS,KAAqB;AAC5C,QAAO,IAAI,QAAQ,QAAQ,KAAK,CAAC,QAAQ,QAAQ,OAAO;;;;ACN1D,SAAgB,mBAAmB,EAAE,KAAK,SAA0C;AAClF,SAAQ,SAAS,SAAS,IAAI;AAC9B,QAAO,cAAc,CAAC,IAAI,IAAI,KAAK,QAAQ,EAAE,KAAK,OAAO,GAAG,KAAA,EAAU,CAAC;;;;ACFzE,SAAgB,eAAe,MAAoB,UAAyB,UAAkB;AAI5F,QAAO,+BAAW,OAFG,YAAY,iBAAiB,KAAK,YAAY"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "bin": {
3
+ "solana-mobile": "dist/cli.mjs"
4
+ },
5
+ "dependencies": {
6
+ "@solana/kit": "6.8.0",
7
+ "@solana/kit-plugin-rpc": "0.9.0"
8
+ },
9
+ "devDependencies": {
10
+ "@beeman/testcontainers": "1.1.1",
11
+ "@biomejs/biome": "2.4.6",
12
+ "@changesets/cli": "2.30.0",
13
+ "@intellectronica/ruler": "0.3.38",
14
+ "@solana/kit-plugins": "0.9.0",
15
+ "@types/bun": "1.3.13",
16
+ "lefthook": "2.1.5",
17
+ "pkg-pr-new": "0.0.62",
18
+ "publint": "0.3.18",
19
+ "testcontainers": "11.11.0",
20
+ "tsdown": "0.21.7",
21
+ "typescript": "6.0.2"
22
+ },
23
+ "exports": {
24
+ ".": {
25
+ "import": {
26
+ "types": "./dist/index.d.mts",
27
+ "default": "./dist/index.mjs"
28
+ },
29
+ "require": {
30
+ "types": "./dist/index.d.cts",
31
+ "default": "./dist/index.cjs"
32
+ }
33
+ }
34
+ },
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "license": "MIT",
39
+ "main": "./dist/index.cjs",
40
+ "module": "./dist/index.mjs",
41
+ "description": "",
42
+ "name": "solana-mobile",
43
+ "scripts": {
44
+ "build": "tsdown",
45
+ "changeset": "changeset",
46
+ "check-types": "tsc -b --noEmit",
47
+ "ci": "bun run build && bun run lint && bun run check-types && bun run test",
48
+ "lint": "biome check --error-on-warnings",
49
+ "lint:fix": "biome check --error-on-warnings --write",
50
+ "prepare": "lefthook install",
51
+ "release": "changeset publish",
52
+ "ruler:apply": "ruler apply --local-only",
53
+ "test": "bun test test/*.test.ts",
54
+ "test:e2e": "bun test test/e2e.test.ts",
55
+ "test:watch": "bun test test/*.test.ts --watch",
56
+ "version": "changeset version && bun lint:fix"
57
+ },
58
+ "type": "module",
59
+ "types": "./dist/index.d.mts",
60
+ "version": "0.0.0"
61
+ }