@magicblock-console/core 0.1.0 → 0.1.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.
- package/README.md +79 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# @magicblock-console/core
|
|
2
|
+
|
|
3
|
+
Core SDK for managing [MagicBlock Ephemeral Rollups](https://www.magicblock.gg/) on Solana. Shared logic used by the CLI, MCP Server, and Web Dashboard.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Project Management** — create, configure, and manage ER projects
|
|
8
|
+
- **ER Lifecycle** — delegate, commit, undelegate accounts on Ephemeral Rollups
|
|
9
|
+
- **Gasless Transactions** — zero-fee execution on ER
|
|
10
|
+
- **Privacy Mode** — confidential state via TEE (Private Ephemeral Rollups)
|
|
11
|
+
- **VRF** — verifiable randomness requests
|
|
12
|
+
- **Cranks** — scheduled automatic execution
|
|
13
|
+
- **Oracle** — Pyth price feeds on ER
|
|
14
|
+
- **Monitoring** — status, costs, and logs
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @magicblock-console/core
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { createClient, MemoryStorage } from '@magicblock-console/core';
|
|
26
|
+
|
|
27
|
+
const client = createClient({
|
|
28
|
+
network: 'devnet',
|
|
29
|
+
storage: new MemoryStorage(),
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// Create a project
|
|
33
|
+
await client.projects.create({ name: 'my-game', region: 'us' });
|
|
34
|
+
|
|
35
|
+
// Enable features
|
|
36
|
+
await client.projects.configure('my-game', {
|
|
37
|
+
features: { gasless: true, vrf: true },
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Delegate an account to ER
|
|
41
|
+
await client.er.delegate({
|
|
42
|
+
account: 'YourAccountPubkey...',
|
|
43
|
+
project: 'my-game',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// Request VRF randomness
|
|
47
|
+
const result = await client.vrf.request({ project: 'my-game' });
|
|
48
|
+
console.log(result.value); // 32 bytes of randomness
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Wallet Connection
|
|
52
|
+
|
|
53
|
+
Connect a Solana wallet for real blockchain operations:
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// From keypair file (CLI/server)
|
|
57
|
+
await client.connectWithKeypair('~/.config/solana/id.json');
|
|
58
|
+
|
|
59
|
+
// From browser wallet (web)
|
|
60
|
+
await client.connectWithSigner({
|
|
61
|
+
publicKey: wallet.publicKey,
|
|
62
|
+
signTransaction: (tx) => wallet.signTransaction(tx),
|
|
63
|
+
});
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Without a wallet connection, all operations run in **simulated mode** with realistic mock data.
|
|
67
|
+
|
|
68
|
+
## Network
|
|
69
|
+
|
|
70
|
+
Operates on Solana Devnet by default. ER validators available in US, EU, and Asia regions.
|
|
71
|
+
|
|
72
|
+
## Related Packages
|
|
73
|
+
|
|
74
|
+
- [`@magicblock-console/cli`](https://www.npmjs.com/package/@magicblock-console/cli) — Terminal interface
|
|
75
|
+
- [`@magicblock-console/mcp`](https://www.npmjs.com/package/@magicblock-console/mcp) — AI agent interface (MCP Server)
|
|
76
|
+
|
|
77
|
+
## License
|
|
78
|
+
|
|
79
|
+
MIT
|