@layr-labs/ecloud-sdk 0.0.1-dev-rfc.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 +195 -0
- package/dist/index.cjs +7856 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +566 -0
- package/dist/index.d.ts +566 -0
- package/dist/index.js +7800 -0
- package/dist/index.js.map +1 -0
- package/dist/keys/mainnet-alpha/prod/kms-encryption-public-key.pem +14 -0
- package/dist/keys/mainnet-alpha/prod/kms-signing-public-key.pem +4 -0
- package/dist/keys/sepolia/dev/kms-encryption-public-key.pem +14 -0
- package/dist/keys/sepolia/dev/kms-signing-public-key.pem +4 -0
- package/dist/keys/sepolia/prod/kms-encryption-public-key.pem +14 -0
- package/dist/keys/sepolia/prod/kms-signing-public-key.pem +4 -0
- package/dist/templates/Dockerfile.layered.tmpl +58 -0
- package/dist/templates/compute-source-env.sh.tmpl +110 -0
- package/package.json +46 -0
package/README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# ECloud SDK
|
|
2
|
+
|
|
3
|
+
A TypeScript SDK and CLI for deploying and managing applications on eigenx TEE (Trusted Execution Environment). This monorepo provides both programmatic SDK access and a command-line interface for interacting with ecloud's decentralized compute platform.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
ECloud SDK enables developers to:
|
|
8
|
+
- Deploy containerized applications to ecloud TEE
|
|
9
|
+
- Manage application lifecycle (start, stop, terminate)
|
|
10
|
+
- Build and push Docker images with encryption
|
|
11
|
+
- Interact with ecloud smart contracts on Ethereum networks
|
|
12
|
+
- Monitor application status and logs
|
|
13
|
+
|
|
14
|
+
## Packages
|
|
15
|
+
|
|
16
|
+
This monorepo contains two main packages:
|
|
17
|
+
|
|
18
|
+
### `@layr-labs/ecloud-sdk`
|
|
19
|
+
|
|
20
|
+
The core TypeScript SDK for programmatic access to ecloud services.
|
|
21
|
+
|
|
22
|
+
**Features:**
|
|
23
|
+
- Type-safe client for ecloud operations
|
|
24
|
+
- Docker image building and pushing
|
|
25
|
+
- KMS encryption for secure deployments
|
|
26
|
+
- Smart contract interactions (EIP7702)
|
|
27
|
+
- Environment configuration management
|
|
28
|
+
|
|
29
|
+
### `@layr-labs/ecloud-cli`
|
|
30
|
+
|
|
31
|
+
Command-line interface built with oclif for deploying and managing applications.
|
|
32
|
+
|
|
33
|
+
**Features:**
|
|
34
|
+
- Deploy applications from Docker images
|
|
35
|
+
- Manage application lifecycle
|
|
36
|
+
- Environment-aware configuration
|
|
37
|
+
- Support for multiple networks
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
### Prerequisites
|
|
42
|
+
|
|
43
|
+
- Node.js 18+
|
|
44
|
+
- pnpm (recommended) or npm
|
|
45
|
+
- Docker (for building and pushing images)
|
|
46
|
+
|
|
47
|
+
### Install Dependencies
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
pnpm install
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Build
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pnpm build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
### CLI Usage
|
|
62
|
+
|
|
63
|
+
The CLI is available via the `ecloud` command after building:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# Deploy an application
|
|
67
|
+
npx ecloud app deploy \
|
|
68
|
+
--private-key <your-private-key> \
|
|
69
|
+
--environment sepolia \
|
|
70
|
+
--image <docker-image-reference>
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**Common Flags:**
|
|
74
|
+
- `--private-key`: Your Ethereum private key (or set `ECLOUD_PRIVATE_KEY` env var)
|
|
75
|
+
- `--environment`: Target environment (`sepolia` or `mainnet-alpha`)
|
|
76
|
+
- `--rpc-url`: Custom RPC URL (optional, or set `ECLOUD_RPC_URL` env var)
|
|
77
|
+
|
|
78
|
+
**Example:**
|
|
79
|
+
```bash
|
|
80
|
+
npx ecloud app deploy \
|
|
81
|
+
--private-key 0x... \
|
|
82
|
+
--environment sepolia
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### SDK Usage
|
|
86
|
+
|
|
87
|
+
```typescript
|
|
88
|
+
import { createECloudClient } from "@layr-labs/ecloud-sdk";
|
|
89
|
+
|
|
90
|
+
// Create a client
|
|
91
|
+
const client = createECloudClient({
|
|
92
|
+
privateKey: "0x...",
|
|
93
|
+
environment: "sepolia", // or "sepolia-dev" or "mainnet-alpha"
|
|
94
|
+
rpcUrl: "https://sepolia.infura.io/v3/...",
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
// Deploy an application
|
|
98
|
+
const result = await client.app.deploy({
|
|
99
|
+
image: "myapp:latest",
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
console.log(`Deployed app ID: ${result.appId}`);
|
|
103
|
+
console.log(`Transaction hash: ${result.tx}`);
|
|
104
|
+
|
|
105
|
+
// Start an application
|
|
106
|
+
await client.app.start(result.appId);
|
|
107
|
+
|
|
108
|
+
// Stop an application
|
|
109
|
+
await client.app.stop(result.appId);
|
|
110
|
+
|
|
111
|
+
// Terminate an application
|
|
112
|
+
await client.app.terminate(result.appId);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Environments
|
|
116
|
+
|
|
117
|
+
The SDK supports the following environments:
|
|
118
|
+
|
|
119
|
+
- **sepolia**: Sepolia testnet
|
|
120
|
+
- **mainnet-alpha**: Ethereum mainnet (alpha)
|
|
121
|
+
|
|
122
|
+
## Development
|
|
123
|
+
|
|
124
|
+
### Project Structure
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
ecloud-sdk/
|
|
128
|
+
├── packages/
|
|
129
|
+
│ ├── cli/ # CLI package
|
|
130
|
+
│ │ ├── src/
|
|
131
|
+
│ │ │ ├── commands/ # CLI commands
|
|
132
|
+
│ │ │ └── client.ts # Client loader
|
|
133
|
+
│ │ └── bin/ # CLI entry points
|
|
134
|
+
│ └── sdk/ # SDK package
|
|
135
|
+
│ └── src/
|
|
136
|
+
│ └── client/
|
|
137
|
+
│ └── modules/
|
|
138
|
+
│ └── app/ # App management module
|
|
139
|
+
│ ├── deploy/ # Deployment logic
|
|
140
|
+
│ └── index.ts
|
|
141
|
+
├── package.json
|
|
142
|
+
└── pnpm-workspace.yaml
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Scripts
|
|
146
|
+
|
|
147
|
+
- `pnpm build` - Build all packages
|
|
148
|
+
- `pnpm lint` - Lint all packages
|
|
149
|
+
- `pnpm format` - Check code formatting
|
|
150
|
+
- `pnpm format:fix` - Fix code formatting
|
|
151
|
+
- `pnpm test` - Run tests (when implemented)
|
|
152
|
+
- `pnpm ecloud` - Run the CLI
|
|
153
|
+
|
|
154
|
+
### Adding New Commands
|
|
155
|
+
|
|
156
|
+
1. Create a new command file in `packages/cli/src/commands/`
|
|
157
|
+
2. Export a class extending `Command` from `@oclif/core`
|
|
158
|
+
3. The command will be automatically discovered by oclif
|
|
159
|
+
|
|
160
|
+
### Adding New SDK Modules
|
|
161
|
+
|
|
162
|
+
1. Create a new module in `packages/sdk/src/client/modules/`
|
|
163
|
+
2. Export a module factory function (e.g., `createXxxModule`)
|
|
164
|
+
3. Add the module to the client in `packages/sdk/src/client/index.ts`
|
|
165
|
+
|
|
166
|
+
## Deployment Process
|
|
167
|
+
|
|
168
|
+
The deployment process involves several steps:
|
|
169
|
+
|
|
170
|
+
1. **Preflight Checks**: Validate environment and configuration
|
|
171
|
+
2. **Docker Build**: Build Docker image if needed
|
|
172
|
+
3. **Image Push**: Push image to registry
|
|
173
|
+
4. **Encryption**: Encrypt sensitive data using KMS
|
|
174
|
+
5. **On-Chain Deployment**: Deploy smart contract with app configuration
|
|
175
|
+
6. **Status Monitoring**: Watch until application is running
|
|
176
|
+
|
|
177
|
+
## Security
|
|
178
|
+
|
|
179
|
+
- Private keys are never stored or logged
|
|
180
|
+
- Sensitive data is encrypted using KMS before deployment
|
|
181
|
+
- All blockchain interactions use secure wallet clients
|
|
182
|
+
- Environment variables are supported for sensitive configuration
|
|
183
|
+
|
|
184
|
+
## Contributing
|
|
185
|
+
|
|
186
|
+
1. Fork the repository
|
|
187
|
+
2. Create a feature branch
|
|
188
|
+
3. Make your changes
|
|
189
|
+
4. Run tests and linting
|
|
190
|
+
5. Submit a pull request
|
|
191
|
+
|
|
192
|
+
## Support
|
|
193
|
+
|
|
194
|
+
For issues and questions, please open an issue on GitHub.
|
|
195
|
+
|