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/LICENSE +21 -0
- package/README.md +88 -0
- package/dist/cli.cjs +12 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.mts +1 -0
- package/dist/cli.mjs +13 -0
- package/dist/cli.mjs.map +1 -0
- package/dist/index.cjs +5 -0
- package/dist/index.d.cts +4937 -0
- package/dist/index.d.mts +4937 -0
- package/dist/index.mjs +2 -0
- package/dist/src-B5DkELSU.cjs +47 -0
- package/dist/src-B5DkELSU.cjs.map +1 -0
- package/dist/src-B_8LrWmO.mjs +30 -0
- package/dist/src-B_8LrWmO.mjs.map +1 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 beeman https://github.com/beeman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# solana-mobile
|
|
2
|
+
|
|
3
|
+
TypeScript library for Solana development using [`@solana/kit`](https://github.com/anza-xyz/kit).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Bun, TypeScript, Biome, tsdown, Changesets, GitHub Actions** — batteries included
|
|
8
|
+
- **`@solana/kit` client** — `createClient().use(rpc(...))` plugin pattern
|
|
9
|
+
- **Explorer URL helper** — generate Solana Explorer links
|
|
10
|
+
- **WebSocket URL derivation** — automatic `wss://` from `https://` RPC URLs
|
|
11
|
+
- **E2E tests** — real Solana RPC tests via [Surfpool](https://github.com/txtx/surfpool) + [Testcontainers](https://github.com/beeman/testcontainers)
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
bun install
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If you want to override the default RPC endpoint locally, copy the example env file first:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
cp .env.example .env
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Usage
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { createSolanaClient, getExplorerUrl } from 'solana-mobile'
|
|
29
|
+
|
|
30
|
+
const client = createSolanaClient({ url: 'https://api.devnet.solana.com' })
|
|
31
|
+
|
|
32
|
+
const slot = await client.rpc.getSlot().send()
|
|
33
|
+
console.log(`Current slot: ${slot}`)
|
|
34
|
+
|
|
35
|
+
const url = getExplorerUrl('tx/your-signature', 'devnet')
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## CLI
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# Check connectivity (defaults to devnet)
|
|
42
|
+
bun run src/cli.ts
|
|
43
|
+
|
|
44
|
+
# Custom RPC URL via argument
|
|
45
|
+
bun run src/cli.ts https://api.mainnet-beta.solana.com
|
|
46
|
+
|
|
47
|
+
# Or via environment variable
|
|
48
|
+
SOLANA_ENDPOINT=https://api.mainnet-beta.solana.com bun run src/cli.ts
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
bun install
|
|
55
|
+
bun run ruler:apply # apply AI agent rules
|
|
56
|
+
bun run build
|
|
57
|
+
bun run check-types
|
|
58
|
+
bun run lint
|
|
59
|
+
bun test # unit tests
|
|
60
|
+
bun run test:e2e # e2e tests (requires Docker)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Testing
|
|
64
|
+
|
|
65
|
+
Unit tests (`bun test`) run without any external dependencies.
|
|
66
|
+
|
|
67
|
+
E2E tests (`bun run test:e2e`) spin up a [Surfpool](https://github.com/txtx/surfpool) container via [`@beeman/testcontainers`](https://github.com/beeman/testcontainers) and run real RPC calls against it. Docker must be running.
|
|
68
|
+
|
|
69
|
+
#### Using solana-test-validator instead of Surfpool
|
|
70
|
+
|
|
71
|
+
To switch the e2e tests to use `solana-test-validator`, update `test/e2e.test.ts`:
|
|
72
|
+
|
|
73
|
+
```diff
|
|
74
|
+
- import { createLocalSolanaClient, SurfpoolContainer, type StartedSurfpoolContainer } from '@beeman/testcontainers'
|
|
75
|
+
+ import { createLocalSolanaClient, SolanaTestValidatorContainer, type StartedSolanaTestValidatorContainer } from '@beeman/testcontainers'
|
|
76
|
+
|
|
77
|
+
- let container: StartedSurfpoolContainer
|
|
78
|
+
+ let container: StartedSolanaTestValidatorContainer
|
|
79
|
+
|
|
80
|
+
- container = await new SurfpoolContainer().start()
|
|
81
|
+
+ container = await new SolanaTestValidatorContainer().start()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The client API is identical — both containers expose `.url`, `.urlWs`, and work with `createLocalSolanaClient()`.
|
|
85
|
+
|
|
86
|
+
## License
|
|
87
|
+
|
|
88
|
+
MIT – see [LICENSE](./LICENSE).
|
package/dist/cli.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
const require_src = require("./src-B5DkELSU.cjs");
|
|
3
|
+
//#region src/cli.ts
|
|
4
|
+
async function main() {
|
|
5
|
+
const url = process.argv[2] ?? process.env.SOLANA_ENDPOINT ?? "https://api.devnet.solana.com";
|
|
6
|
+
const slot = await require_src.createSolanaClient({ url }).rpc.getSlot().send();
|
|
7
|
+
console.log(`Connected to ${url} — current slot: ${slot}`);
|
|
8
|
+
}
|
|
9
|
+
main();
|
|
10
|
+
//#endregion
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=cli.cjs.map
|
package/dist/cli.cjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.cjs","names":["createSolanaClient"],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env bun\n\nimport { createSolanaClient } from './index.ts'\n\nasync function main() {\n const url = process.argv[2] ?? process.env.SOLANA_ENDPOINT ?? 'https://api.devnet.solana.com'\n const client = createSolanaClient({ url })\n\n const slot = await client.rpc.getSlot().send()\n console.log(`Connected to ${url} — current slot: ${slot}`)\n}\n\nmain()\n"],"mappings":";;;AAIA,eAAe,OAAO;CACpB,MAAM,MAAM,QAAQ,KAAK,MAAM,QAAQ,IAAI,mBAAmB;CAG9D,MAAM,OAAO,MAFEA,YAAAA,mBAAmB,EAAE,KAAK,CAAC,CAEhB,IAAI,SAAS,CAAC,MAAM;AAC9C,SAAQ,IAAI,gBAAgB,IAAI,mBAAmB,OAAO;;AAG5D,MAAM"}
|
package/dist/cli.d.cts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.d.mts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
import { n as createSolanaClient } from "./src-B_8LrWmO.mjs";
|
|
3
|
+
//#region src/cli.ts
|
|
4
|
+
async function main() {
|
|
5
|
+
const url = process.argv[2] ?? process.env.SOLANA_ENDPOINT ?? "https://api.devnet.solana.com";
|
|
6
|
+
const slot = await createSolanaClient({ url }).rpc.getSlot().send();
|
|
7
|
+
console.log(`Connected to ${url} — current slot: ${slot}`);
|
|
8
|
+
}
|
|
9
|
+
main();
|
|
10
|
+
//#endregion
|
|
11
|
+
export {};
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=cli.mjs.map
|
package/dist/cli.mjs.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.mjs","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env bun\n\nimport { createSolanaClient } from './index.ts'\n\nasync function main() {\n const url = process.argv[2] ?? process.env.SOLANA_ENDPOINT ?? 'https://api.devnet.solana.com'\n const client = createSolanaClient({ url })\n\n const slot = await client.rpc.getSlot().send()\n console.log(`Connected to ${url} — current slot: ${slot}`)\n}\n\nmain()\n"],"mappings":";;;AAIA,eAAe,OAAO;CACpB,MAAM,MAAM,QAAQ,KAAK,MAAM,QAAQ,IAAI,mBAAmB;CAG9D,MAAM,OAAO,MAFE,mBAAmB,EAAE,KAAK,CAAC,CAEhB,IAAI,SAAS,CAAC,MAAM;AAC9C,SAAQ,IAAI,gBAAgB,IAAI,mBAAmB,OAAO;;AAG5D,MAAM"}
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_src = require("./src-B5DkELSU.cjs");
|
|
3
|
+
exports.createSolanaClient = require_src.createSolanaClient;
|
|
4
|
+
exports.getExplorerUrl = require_src.getExplorerUrl;
|
|
5
|
+
exports.getWsUrl = require_src.getWsUrl;
|