@wuwei-labs/srsly-cli 1.0.4
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 +245 -0
- package/dist/cli.js +220533 -0
- package/package.json +57 -0
package/README.md
ADDED
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# SRSLY CLI
|
|
2
|
+
|
|
3
|
+
Command-line interface for managing fleet rentals on Solana.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Quick Install (Recommended)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
curl -sSL https://raw.githubusercontent.com/wuwei-labs/srsly/main/cli/install.sh | bash
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Manual Installation
|
|
14
|
+
|
|
15
|
+
Download the appropriate binary for your platform from the [releases page](https://github.com/wuwei-labs/srsly/releases).
|
|
16
|
+
|
|
17
|
+
## Commands
|
|
18
|
+
|
|
19
|
+
### Contract Management
|
|
20
|
+
|
|
21
|
+
#### Create Contract
|
|
22
|
+
|
|
23
|
+
Create a new rental contract for your fleet.
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
# Standard payment frequencies
|
|
27
|
+
srsly contract create --fleet <ADDRESS> --rate <AMOUNT> --max <DURATION> --pay <FREQUENCY>
|
|
28
|
+
|
|
29
|
+
# Examples:
|
|
30
|
+
srsly contract create --fleet ABC... --rate 100 --max 7d --pay daily
|
|
31
|
+
srsly contract create --fleet ABC... --rate 50 --max 30d --min 7d --pay weekly
|
|
32
|
+
|
|
33
|
+
# Custom cron expressions (when enabled)
|
|
34
|
+
srsly contract create --fleet ABC... --rate 25 --max 7d --cron "0 */3 * * *" # Every 3 hours
|
|
35
|
+
srsly contract create --fleet ABC... --rate 10 --max 30d --cron "0 9,17 * * *" # 9 AM and 5 PM daily
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
**Options:**
|
|
39
|
+
- `-f, --fleet <ADDRESS>` - Fleet address (required)
|
|
40
|
+
- `-r, --rate <AMOUNT>` - Rental rate per payment period in ATLAS (required)
|
|
41
|
+
- `-x, --max <DURATION>` - Maximum rental duration (e.g., 7d, 1w, 30d) (required)
|
|
42
|
+
- `-n, --min <DURATION>` - Minimum rental duration (defaults to 1 payment period)
|
|
43
|
+
- `-p, --pay <FREQ>` - Payment frequency: hourly, daily, weekly, monthly
|
|
44
|
+
- `--cron <EXPR>` - Custom cron expression (requires config update)
|
|
45
|
+
- `--owner-profile <ADDRESS>` - Star Atlas profile address
|
|
46
|
+
|
|
47
|
+
**Note:** The `--max` and `--min` durations are interpreted as the number of payment periods on mainnet. For example, with daily payments, `--max 7d` means 7 daily payments.
|
|
48
|
+
|
|
49
|
+
### Schedule Management
|
|
50
|
+
|
|
51
|
+
#### Preview Payment Schedule
|
|
52
|
+
|
|
53
|
+
Preview when payments will occur for a given schedule.
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Preview standard frequencies
|
|
57
|
+
srsly schedule preview @daily --duration 7d
|
|
58
|
+
srsly schedule preview @hourly --periods 24
|
|
59
|
+
|
|
60
|
+
# Preview custom cron expressions
|
|
61
|
+
srsly schedule preview "0 */3 * * *" --duration 7d
|
|
62
|
+
srsly schedule preview "0 9,17 * * MON-FRI" --periods 10
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Options:**
|
|
66
|
+
- `-d, --duration <TIME>` - Duration to preview (default: 7d)
|
|
67
|
+
- `-p, --periods <COUNT>` - Number of periods to preview
|
|
68
|
+
|
|
69
|
+
#### Validate Cron Expression
|
|
70
|
+
|
|
71
|
+
Check if a cron expression is valid.
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
srsly schedule validate "@daily"
|
|
75
|
+
srsly schedule validate "0 */3 * * *"
|
|
76
|
+
srsly schedule validate "0 0 * * MON"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
#### Get Frequency Info
|
|
80
|
+
|
|
81
|
+
Show information about standard payment frequencies.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
srsly schedule info daily
|
|
85
|
+
srsly schedule info hourly
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Rental Operations
|
|
89
|
+
|
|
90
|
+
#### Accept Rental
|
|
91
|
+
|
|
92
|
+
Accept a rental contract and start the rental period.
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
srsly rental accept --contract <ADDRESS> --duration <TIME>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
#### Cancel Rental
|
|
99
|
+
|
|
100
|
+
Cancel an active rental (requires sufficient notice period).
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
srsly rental cancel --contract <ADDRESS> --rental <ADDRESS>
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Configuration
|
|
107
|
+
|
|
108
|
+
#### View Config
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
srsly config show
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
#### Set Config Values
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
srsly config set --network mainnet --keypair ~/.config/solana/id.json
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Utility Commands
|
|
121
|
+
|
|
122
|
+
#### Derive Addresses
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Derive contract address from fleet
|
|
126
|
+
srsly derive contract --fleet <ADDRESS>
|
|
127
|
+
|
|
128
|
+
# Derive rental address
|
|
129
|
+
srsly derive rental --contract <ADDRESS> --borrower <ADDRESS>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
#### Wallet Info
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
srsly wallet show
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Payment Schedules
|
|
139
|
+
|
|
140
|
+
### Standard Frequencies
|
|
141
|
+
|
|
142
|
+
- `@hourly` - Every hour on the hour
|
|
143
|
+
- `@daily` - Every day at midnight UTC
|
|
144
|
+
- `@weekly` - Every week
|
|
145
|
+
- `@monthly` - Every month (approximately 31 days)
|
|
146
|
+
|
|
147
|
+
### Custom Cron Expressions
|
|
148
|
+
|
|
149
|
+
When enabled by the protocol administrator, you can use custom cron expressions:
|
|
150
|
+
|
|
151
|
+
- `"0 */3 * * *"` - Every 3 hours
|
|
152
|
+
- `"0 9,17 * * *"` - At 9 AM and 5 PM daily
|
|
153
|
+
- `"0 0 * * MON-FRI"` - Midnight on weekdays
|
|
154
|
+
- `"*/30 * * * *"` - Every 30 minutes
|
|
155
|
+
|
|
156
|
+
**Note:** Custom cron expressions require:
|
|
157
|
+
1. The `Custom` payment frequency to be enabled in the protocol config
|
|
158
|
+
2. The antegen service to be upgraded with croner support
|
|
159
|
+
|
|
160
|
+
## Environment Variables
|
|
161
|
+
|
|
162
|
+
- `SRSLY_NETWORK` - Default network (mainnet, devnet)
|
|
163
|
+
- `SRSLY_RPC_URL` - Custom RPC endpoint
|
|
164
|
+
- `SRSLY_KEYPAIR_PATH` - Path to keypair file
|
|
165
|
+
|
|
166
|
+
## Examples
|
|
167
|
+
|
|
168
|
+
### Create a Daily Rental Contract
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# Create contract: 100 ATLAS per day, 7-30 day rentals
|
|
172
|
+
srsly contract create \
|
|
173
|
+
--fleet 8dCasgoyxi9iSitMS3g9G1Tafj77sfL7HatMzZfW3Q8N \
|
|
174
|
+
--rate 100 \
|
|
175
|
+
--min 7d \
|
|
176
|
+
--max 30d \
|
|
177
|
+
--pay daily
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Create a Custom Schedule Contract
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
# Create contract: 50 ATLAS every 3 hours, 5-20 payments
|
|
184
|
+
srsly contract create \
|
|
185
|
+
--fleet 8dCasgoyxi9iSitMS3g9G1Tafj77sfL7HatMzZfW3Q8N \
|
|
186
|
+
--rate 50 \
|
|
187
|
+
--min 5 \
|
|
188
|
+
--max 20 \
|
|
189
|
+
--cron "0 */3 * * *"
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Preview Payment Schedule
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# See when payments will occur
|
|
196
|
+
srsly schedule preview "0 */3 * * *" --periods 10
|
|
197
|
+
|
|
198
|
+
# Output:
|
|
199
|
+
# Expression: 0 */3 * * *
|
|
200
|
+
# Total Payments: 10
|
|
201
|
+
# First Payment: 2024-01-15 3:00:00 AM
|
|
202
|
+
# Last Payment: 2024-01-16 6:00:00 AM
|
|
203
|
+
#
|
|
204
|
+
# Sample payment times:
|
|
205
|
+
# 1. 2024-01-15 3:00:00 AM
|
|
206
|
+
# 2. 2024-01-15 6:00:00 AM
|
|
207
|
+
# 3. 2024-01-15 9:00:00 AM
|
|
208
|
+
# 4. 2024-01-15 12:00:00 PM
|
|
209
|
+
# 5. 2024-01-15 3:00:00 PM
|
|
210
|
+
# ... and 5 more
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Network Configuration
|
|
214
|
+
|
|
215
|
+
The CLI supports multiple networks:
|
|
216
|
+
|
|
217
|
+
- `mainnet` - Solana mainnet
|
|
218
|
+
- `devnet` - Solana devnet
|
|
219
|
+
- `localhost` - Local test validator
|
|
220
|
+
|
|
221
|
+
Set the network:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
srsly config set --network mainnet
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Troubleshooting
|
|
228
|
+
|
|
229
|
+
### Common Issues
|
|
230
|
+
|
|
231
|
+
1. **"Custom payment frequencies are not enabled"**
|
|
232
|
+
- Custom cron expressions require protocol configuration update
|
|
233
|
+
- Contact the protocol administrator
|
|
234
|
+
|
|
235
|
+
2. **"Invalid cron expression"**
|
|
236
|
+
- Use `srsly schedule validate` to check your expression
|
|
237
|
+
- Ensure you're using quotes around the expression
|
|
238
|
+
|
|
239
|
+
3. **"Duration must be a multiple of payment frequency"**
|
|
240
|
+
- This only applies to standard frequencies on older contracts
|
|
241
|
+
- Mainnet contracts use payment periods instead of seconds
|
|
242
|
+
|
|
243
|
+
## Support
|
|
244
|
+
|
|
245
|
+
For issues and feature requests, visit: https://github.com/wuwei-labs/srsly/issues
|