@twin.org/move-to-json 0.0.3-next.5 → 0.0.3-next.7
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 +8 -374
- package/dist/es/cli.js +1 -1
- package/dist/es/cli.js.map +1 -1
- package/dist/locales/en.json +6 -0
- package/docs/changelog.md +29 -1
- package/docs/reference/classes/CLI.md +2 -2
- package/docs/reference/interfaces/INetworkConfig.md +5 -5
- package/docs/usage.md +170 -0
- package/package.json +3 -3
- package/docs/examples.md +0 -98
package/README.md
CHANGED
|
@@ -1,387 +1,21 @@
|
|
|
1
1
|
# TWIN Move to JSON
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
### IOTA CLI Installation
|
|
8
|
-
|
|
9
|
-
Before using this tool, you need to install the IOTA CLI. The simplest way is using Homebrew:
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
# Install IOTA CLI using Homebrew (macOS/Linux/WSL)
|
|
13
|
-
brew install iotaledger/tap/iota
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
**Alternative installation methods:**
|
|
17
|
-
|
|
18
|
-
For other platforms or installation from source, see the [official IOTA installation guide](https://docs.iota.org/developer/getting-started/install-iota).
|
|
19
|
-
|
|
20
|
-
**Verify installation:**
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
iota --version
|
|
24
|
-
```
|
|
3
|
+
This app provides a command line workflow for compiling Move contracts and producing deployment-ready JSON for IOTA networks. It is intended for development teams that want predictable build and deployment inputs across test and production environments.
|
|
25
4
|
|
|
26
5
|
## Installation
|
|
27
6
|
|
|
28
7
|
```shell
|
|
29
|
-
npm install -
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Quick Start
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
# Build contracts for mainnet using environment variables (recommended)
|
|
36
|
-
npx move-to-json build "src/**/*.move" --load-env configs/mainnet.env --output smart-contract-deployments.json
|
|
37
|
-
|
|
38
|
-
# Deploy to mainnet using environment variables (recommended)
|
|
39
|
-
npx move-to-json deploy --load-env configs/mainnet.env --contracts smart-contract-deployments.json
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Environment Setup for Production Deployments
|
|
43
|
-
|
|
44
|
-
### Required Environment Variables
|
|
45
|
-
|
|
46
|
-
For production deployments, you need to set up environment variables containing your deployment credentials. The tool uses network-specific configuration files located in the `configs/` directory.
|
|
47
|
-
|
|
48
|
-
#### 1. Create Environment Files
|
|
49
|
-
|
|
50
|
-
Copy the environment templates for each network you plan to use:
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
# Copy environment templates for each network
|
|
54
|
-
cp configs/testnet.env.example configs/testnet.env
|
|
55
|
-
cp configs/devnet.env.example configs/devnet.env
|
|
56
|
-
cp configs/mainnet.env.example configs/mainnet.env
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
**Note:** Only copy the environment files for the networks you actually plan to deploy to. For development, you typically only need `testnet.env` and `devnet.env`.
|
|
60
|
-
|
|
61
|
-
#### 2. Generate Deployment Mnemonics
|
|
62
|
-
|
|
63
|
-
Use the wallet CLI to generate secure mnemonics and then manually update the appropriate network configuration files with the generated mnemonic.
|
|
64
|
-
|
|
65
|
-
### Environment Variable Reference
|
|
66
|
-
|
|
67
|
-
Each network has its own configuration file in the `configs/` directory with the required deployment mnemonic:
|
|
68
|
-
|
|
69
|
-
| Network | File | Required Variable |
|
|
70
|
-
| ------- | --------------------- | ------------------- |
|
|
71
|
-
| Testnet | `configs/testnet.env` | `DEPLOYER_MNEMONIC` |
|
|
72
|
-
| Devnet | `configs/devnet.env` | `DEPLOYER_MNEMONIC` |
|
|
73
|
-
| Mainnet | `configs/mainnet.env` | `DEPLOYER_MNEMONIC` |
|
|
74
|
-
|
|
75
|
-
### Security Best Practices
|
|
76
|
-
|
|
77
|
-
#### Local Development
|
|
78
|
-
|
|
79
|
-
- Store credentials in `configs/*.env` files (never commit to git - only commit `.example` files)
|
|
80
|
-
- Use test mnemonics with faucet funds for testnet/devnet
|
|
81
|
-
- Use dedicated deployment wallets separate from personal wallets
|
|
82
|
-
|
|
83
|
-
#### CI/CD and Production
|
|
84
|
-
|
|
85
|
-
- Store credentials in GitHub Secrets or your CI/CD secrets manager
|
|
86
|
-
- Use hardware wallets or HSM for mainnet deployment keys
|
|
87
|
-
- Implement approval workflows for mainnet deployments
|
|
88
|
-
- Monitor wallet balances and deployment costs
|
|
89
|
-
|
|
90
|
-
### Generating Credentials
|
|
91
|
-
|
|
92
|
-
#### 1. Generate Mnemonic and Seed
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
# Generate a new 24-word mnemonic and save to wallet.env
|
|
96
|
-
npx "@twin.org/wallet-cli" mnemonic --env wallet.env
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
#### 2. Generate Addresses from Seed
|
|
100
|
-
|
|
101
|
-
```bash
|
|
102
|
-
# Generate 5 addresses and save to address.env
|
|
103
|
-
npx "@twin.org/wallet-cli" address --load-env wallet.env --seed '!SEED' --count 5 --env address.env
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## Commands
|
|
107
|
-
|
|
108
|
-
### build
|
|
109
|
-
|
|
110
|
-
Compile Move contracts for a specific network:
|
|
111
|
-
|
|
112
|
-
```bash
|
|
113
|
-
# Using environment variables (recommended)
|
|
114
|
-
npx move-to-json build "src/**/*.move" --load-env configs/<network>.env [--output <file>]
|
|
115
|
-
|
|
116
|
-
# Using explicit network flag
|
|
117
|
-
npx move-to-json build "src/**/*.move" --network <network> [--output <file>]
|
|
118
|
-
|
|
119
|
-
# If installed globally
|
|
120
|
-
move-to-json build "src/**/*.move" --load-env configs/<network>.env [--output <file>]
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
**Options:**
|
|
124
|
-
|
|
125
|
-
- `--network <network>` - Target network (testnet/devnet/mainnet) **[Optional if using --load-env]**
|
|
126
|
-
- `--load-env <file>` - Load environment variables from file (must contain NETWORK variable)
|
|
127
|
-
- `--output <file>` - Output JSON file (default: smart-contract-deployments.json)
|
|
128
|
-
|
|
129
|
-
**What it does:**
|
|
130
|
-
|
|
131
|
-
1. Reads network from `--network` flag or `NETWORK` environment variable
|
|
132
|
-
2. Validates environment variables for the target network
|
|
133
|
-
3. Cleans build artifacts and Move.lock files
|
|
134
|
-
4. Compiles contracts using unified Move.toml (same bytecode for all networks)
|
|
135
|
-
5. Generates network-aware JSON with package IDs and base64 modules
|
|
136
|
-
|
|
137
|
-
**Key Changes:**
|
|
138
|
-
|
|
139
|
-
- **Unified Move.toml**: Uses single Move.toml file with `framework/testnet` for consistent builds
|
|
140
|
-
- **Network-agnostic compilation**: Same bytecode works across all networks
|
|
141
|
-
- **Environment-aware**: Network targeting handled by IOTA CLI environments, not Move.toml
|
|
142
|
-
|
|
143
|
-
**Example:**
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
# Build for testnet using environment variables (recommended)
|
|
147
|
-
npx move-to-json build "tests/fixtures/sources/**/*.move" --load-env configs/testnet.env --output tests/fixtures/smart-contract-deployments/smart-contract-deployments.json
|
|
148
|
-
|
|
149
|
-
# Build for mainnet using environment variables (recommended)
|
|
150
|
-
npx move-to-json build "src/contracts/**/*.move" --load-env configs/mainnet.env --output smart-contract-deployments.json
|
|
151
|
-
|
|
152
|
-
# Alternative: using explicit network flag
|
|
153
|
-
npx move-to-json build "tests/fixtures/sources/**/*.move" --network testnet --output tests/fixtures/smart-contract-deployments/smart-contract-deployments.json
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### deploy
|
|
157
|
-
|
|
158
|
-
Deploy compiled contracts to the specified network:
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
# Using environment variables (recommended)
|
|
162
|
-
npx move-to-json deploy --load-env configs/<network>.env [--contracts <file>] [options]
|
|
163
|
-
|
|
164
|
-
# Using explicit network flag
|
|
165
|
-
npx move-to-json deploy --network <network> [--load-env configs/<network>.env] [options]
|
|
166
|
-
|
|
167
|
-
# If installed globally
|
|
168
|
-
move-to-json deploy --load-env configs/<network>.env [--contracts <file>] [options]
|
|
8
|
+
npm install -D @twin.org/move-to-json
|
|
169
9
|
```
|
|
170
10
|
|
|
171
|
-
|
|
11
|
+
## Usage
|
|
172
12
|
|
|
173
|
-
|
|
174
|
-
- `--load-env <file>` - Load environment variables from file (must contain NETWORK variable)
|
|
175
|
-
- `--contracts <file>` - Compiled modules JSON file (default: smart-contract-deployments.json)
|
|
176
|
-
- `--dry-run` - Simulate deployment without executing
|
|
177
|
-
- `--force` - Force redeployment of existing packages
|
|
13
|
+
Usage of the CLI is shown in the examples [docs/usage.md](docs/usage.md)
|
|
178
14
|
|
|
179
|
-
|
|
15
|
+
## Reference
|
|
180
16
|
|
|
181
|
-
|
|
182
|
-
2. Loads environment variables from the file specified via `--load-env` flag
|
|
183
|
-
3. Validates deployment credentials are available
|
|
184
|
-
4. Checks wallet balance against gas requirements
|
|
185
|
-
5. Loads compiled contracts from JSON
|
|
186
|
-
6. Deploys using IOTA CLI with active network environment
|
|
187
|
-
7. Extracts and saves both Package ID and UpgradeCap ID
|
|
188
|
-
8. Updates JSON with deployed package information
|
|
17
|
+
Detailed reference documentation for the API can be found in [docs/reference/index.md](docs/reference/index.md)
|
|
189
18
|
|
|
190
|
-
|
|
19
|
+
## Changelog
|
|
191
20
|
|
|
192
|
-
|
|
193
|
-
- **Network targeting**: Uses IOTA CLI environments instead of Move.toml configuration
|
|
194
|
-
- **Consistent deployment**: Same compiled bytecode deployed to all networks
|
|
195
|
-
- **UpgradeCap tracking**: Captures and stores UpgradeCap object ID for future package upgrades
|
|
196
|
-
|
|
197
|
-
**Prerequisites:**
|
|
198
|
-
Ensure IOTA CLI environments are configured:
|
|
199
|
-
|
|
200
|
-
```bash
|
|
201
|
-
# Check available environments
|
|
202
|
-
iota client envs
|
|
203
|
-
|
|
204
|
-
# Configure networks if missing
|
|
205
|
-
iota client new-env --alias testnet --rpc https://fullnode.testnet.iota.cafe:443
|
|
206
|
-
iota client new-env --alias mainnet --rpc https://api.mainnet.iota.cafe
|
|
207
|
-
iota client new-env --alias devnet --rpc https://api.devnet.iota.cafe
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
**Example:**
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
# Deploy to testnet using environment variables (recommended)
|
|
214
|
-
npx move-to-json deploy --load-env configs/testnet.env --contracts tests/fixtures/smart-contract-deployments/smart-contract-deployments.json
|
|
215
|
-
|
|
216
|
-
# Deploy to mainnet using environment variables (recommended)
|
|
217
|
-
npx move-to-json deploy --load-env configs/mainnet.env --contracts tests/fixtures/smart-contract-deployments/smart-contract-deployments.json
|
|
218
|
-
|
|
219
|
-
# Dry run (simulation)
|
|
220
|
-
npx move-to-json deploy --load-env configs/testnet.env --contracts tests/fixtures/smart-contract-deployments/smart-contract-deployments.json --dry-run
|
|
221
|
-
```
|
|
222
|
-
|
|
223
|
-
**Output:**
|
|
224
|
-
The deployment saves both Package ID and UpgradeCap ID:
|
|
225
|
-
|
|
226
|
-
```json
|
|
227
|
-
{
|
|
228
|
-
"testnet": {
|
|
229
|
-
"packageId": "0x...",
|
|
230
|
-
"package": "base64data...",
|
|
231
|
-
"deployedPackageId": "0x239ad3ea39f0910a4dc4c98161bcde948fb5ed0d7d7ae6d9a593239c43af748e",
|
|
232
|
-
"upgradeCap": "0xfd6269c28e3931e41aa9d9e08ffabb8162cf1fd0baaef14094b4442e6c743edf"
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
```
|
|
236
|
-
|
|
237
|
-
**Important Note on UpgradeCap:**
|
|
238
|
-
The UpgradeCap ID is crucial for package upgrades. Keep this secure - it's required to upgrade your deployed packages in the future.
|
|
239
|
-
|
|
240
|
-
## Unified Move.toml Approach
|
|
241
|
-
|
|
242
|
-
The tool now uses a **unified Move.toml approach** that eliminates the need for network-specific Move.toml files. This provides better consistency and reduces complexity.
|
|
243
|
-
|
|
244
|
-
### Single Move.toml Configuration
|
|
245
|
-
|
|
246
|
-
Instead of multiple `Move.toml.{network}` files, use a single `Move.toml` file:
|
|
247
|
-
|
|
248
|
-
```toml
|
|
249
|
-
[package]
|
|
250
|
-
name = "my_contract"
|
|
251
|
-
version = "0.0.1"
|
|
252
|
-
edition = "2024.beta"
|
|
253
|
-
|
|
254
|
-
[dependencies]
|
|
255
|
-
Iota = {
|
|
256
|
-
git = "https://github.com/iotaledger/iota.git",
|
|
257
|
-
subdir = "crates/iota-framework/packages/iota-framework",
|
|
258
|
-
rev = "framework/testnet"
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
[addresses]
|
|
262
|
-
my_contract = "0x0"
|
|
263
|
-
|
|
264
|
-
[dev-dependencies]
|
|
265
|
-
# Optional: Override dependencies for testing
|
|
266
|
-
# Iota = { git = "https://github.com/iotaledger/iota.git", subdir = "crates/iota-framework/packages/iota-framework", rev = "framework/devnet", override = true }
|
|
267
|
-
|
|
268
|
-
[dev-addresses]
|
|
269
|
-
# Optional: Override addresses for development
|
|
270
|
-
# my_contract = "0x1234"
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
### Framework Version Strategy
|
|
274
|
-
|
|
275
|
-
- **Development/Testing**: Use `framework/testnet` for all networks
|
|
276
|
-
- **Production**: Same `framework/testnet` works for mainnet deployment
|
|
277
|
-
- **Consistency**: Same bytecode compiles for all target networks
|
|
278
|
-
|
|
279
|
-
### Network Targeting
|
|
280
|
-
|
|
281
|
-
Network targeting is handled through **IOTA CLI environments**, not Move.toml:
|
|
282
|
-
|
|
283
|
-
```bash
|
|
284
|
-
# Build once - same bytecode for all networks
|
|
285
|
-
iota move build
|
|
286
|
-
|
|
287
|
-
# Deploy to different networks by switching environments
|
|
288
|
-
iota client switch --env testnet && iota client publish
|
|
289
|
-
iota client switch --env mainnet && iota client publish
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Benefits
|
|
293
|
-
|
|
294
|
-
- ✅ **Consistent builds** across all networks
|
|
295
|
-
- ✅ **Reduced complexity** - no file copying
|
|
296
|
-
- ✅ **Industry standard** approach
|
|
297
|
-
- ✅ **Better maintainability** - single source of truth
|
|
298
|
-
- ✅ **Eliminated build conflicts** between networks
|
|
299
|
-
|
|
300
|
-
## Package Upgrades and UpgradeCap Management
|
|
301
|
-
|
|
302
|
-
When you deploy a Move package on IOTA, the network creates an **UpgradeCap** (Upgrade Capability) object that controls the ability to upgrade that package. This tool automatically captures and stores the UpgradeCap ID for future use.
|
|
303
|
-
|
|
304
|
-
### What is an UpgradeCap?
|
|
305
|
-
|
|
306
|
-
The UpgradeCap is a special object that:
|
|
307
|
-
|
|
308
|
-
- **Controls package upgrades**: Only the holder can upgrade the package
|
|
309
|
-
- **Is created once**: Generated during initial package deployment
|
|
310
|
-
- **Must be preserved**: Lost UpgradeCap = no future upgrades possible
|
|
311
|
-
- **Is network-specific**: Each network deployment gets its own UpgradeCap
|
|
312
|
-
|
|
313
|
-
### UpgradeCap Storage
|
|
314
|
-
|
|
315
|
-
The tool stores UpgradeCap IDs in the smart-contract-deployments.json file:
|
|
316
|
-
|
|
317
|
-
```json
|
|
318
|
-
{
|
|
319
|
-
"testnet": {
|
|
320
|
-
"packageId": "0xabc123...",
|
|
321
|
-
"package": "base64data...",
|
|
322
|
-
"deployedPackageId": "0x239ad3ea39f0910a4dc4c98161bcde948fb5ed0d7d7ae6d9a593239c43af748e",
|
|
323
|
-
"upgradeCap": "0xfd6269c28e3931e41aa9d9e08ffabb8162cf1fd0baaef14094b4442e6c743edf"
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
### Using UpgradeCap for Package Upgrades
|
|
329
|
-
|
|
330
|
-
To upgrade a deployed package, you'll need the UpgradeCap ID:
|
|
331
|
-
|
|
332
|
-
```bash
|
|
333
|
-
# Example upgrade command (using IOTA CLI)
|
|
334
|
-
iota client call --package 0x2 --module package --function upgrade \
|
|
335
|
-
--args 0xfd6269c28e3931e41aa9d9e08ffabb8162cf1fd0baaef14094b4442e6c743edf \
|
|
336
|
-
--gas-budget 50000000
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
## Known Issues
|
|
340
|
-
|
|
341
|
-
### Windows
|
|
342
|
-
|
|
343
|
-
#### Long Path Limitation Error
|
|
344
|
-
|
|
345
|
-
**Error Symptoms:**
|
|
346
|
-
|
|
347
|
-
- Build commands fail with `Failed to reset to latest Git state 'mainnet'`
|
|
348
|
-
- Tests timeout during Move compilation
|
|
349
|
-
- Git dependency resolution failures
|
|
350
|
-
|
|
351
|
-
**Root Cause:**
|
|
352
|
-
Windows has a default file path length limitation of 260 characters. The IOTA framework repository contains files with very long paths (especially in test directories) that exceed this limit, causing Git operations to fail during dependency resolution.
|
|
353
|
-
|
|
354
|
-
**Solution:**
|
|
355
|
-
Enable long path support in both Git and Windows:
|
|
356
|
-
|
|
357
|
-
1. **Enable Git Long Paths:**
|
|
358
|
-
|
|
359
|
-
```bash
|
|
360
|
-
git config --global core.longpaths true
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
2. **Enable Windows Long Path Support (requires Administrator privileges):**
|
|
364
|
-
|
|
365
|
-
```powershell
|
|
366
|
-
# Run PowerShell as Administrator
|
|
367
|
-
Set-ItemProperty -Path 'HKLM:SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
3. **Restart your computer** for Windows registry changes to take effect.
|
|
371
|
-
|
|
372
|
-
**Verification:**
|
|
373
|
-
After applying the fix, you should see successful Git dependency updates:
|
|
374
|
-
|
|
375
|
-
```bash
|
|
376
|
-
UPDATING GIT DEPENDENCY https://github.com/iotaledger/iota.git
|
|
377
|
-
INCLUDING DEPENDENCY Iota
|
|
378
|
-
INCLUDING DEPENDENCY MoveStdlib
|
|
379
|
-
BUILDING nft
|
|
380
|
-
```
|
|
381
|
-
|
|
382
|
-
**Alternative Workaround:**
|
|
383
|
-
If you cannot enable long path support system-wide, you can use the `--skip-fetch-latest-git-deps` flag as a workaround, though this will use cached dependencies instead of the latest versions:
|
|
384
|
-
|
|
385
|
-
```bash
|
|
386
|
-
iota move build --skip-fetch-latest-git-deps
|
|
387
|
-
```
|
|
21
|
+
The changes between each version can be found in [docs/changelog.md](docs/changelog.md)
|
package/dist/es/cli.js
CHANGED
|
@@ -21,7 +21,7 @@ export class CLI extends CLIBase {
|
|
|
21
21
|
return this.execute({
|
|
22
22
|
title: "TWIN Move to JSON",
|
|
23
23
|
appName: "move-to-json",
|
|
24
|
-
version: "0.0.3-next.
|
|
24
|
+
version: "0.0.3-next.7", // x-release-please-version
|
|
25
25
|
icon: "⚙️ ",
|
|
26
26
|
supportsEnvFiles: true,
|
|
27
27
|
overrideOutputWidth: options?.overrideOutputWidth
|
package/dist/es/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC/B;;;;;;;OAOG;IACI,KAAK,CAAC,GAAG,CACf,IAAc,EACd,gBAAyB,EACzB,OAEC;QAED,OAAO,IAAI,CAAC,OAAO,CAClB;YACC,KAAK,EAAE,mBAAmB;YAC1B,OAAO,EAAE,cAAc;YACvB,OAAO,EAAE,cAAc,EAAE,2BAA2B;YACpD,IAAI,EAAE,KAAK;YACX,gBAAgB,EAAE,IAAI;YACtB,mBAAmB,EAAE,OAAO,EAAE,mBAAmB;SACjD,EACD,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,EACzF,IAAI,CACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,OAAgB;QACvC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC3B,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport type { Command } from \"commander\";\nimport { buildCommandBuild } from \"./commands/build.js\";\nimport { buildCommandDeploy } from \"./commands/deploy.js\";\n\n/**\n * The main entry point for the Move to JSON CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options.\n\t * @param options.overrideOutputWidth Override the output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: {\n\t\t\toverrideOutputWidth?: number;\n\t\t}\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN Move to JSON\",\n\t\t\t\tappName: \"move-to-json\",\n\t\t\t\tversion: \"0.0.3-next.
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,gCAAgC;AAChC,uCAAuC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAE7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;GAEG;AACH,MAAM,OAAO,GAAI,SAAQ,OAAO;IAC/B;;;;;;;OAOG;IACI,KAAK,CAAC,GAAG,CACf,IAAc,EACd,gBAAyB,EACzB,OAEC;QAED,OAAO,IAAI,CAAC,OAAO,CAClB;YACC,KAAK,EAAE,mBAAmB;YAC1B,OAAO,EAAE,cAAc;YACvB,OAAO,EAAE,cAAc,EAAE,2BAA2B;YACpD,IAAI,EAAE,KAAK;YACX,gBAAgB,EAAE,IAAI;YACtB,mBAAmB,EAAE,OAAO,EAAE,mBAAmB;SACjD,EACD,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,YAAY,CAAC,EACzF,IAAI,CACJ,CAAC;IACH,CAAC;IAED;;;OAGG;IACO,aAAa,CAAC,OAAgB;QACvC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAC3B,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC7B,CAAC;CACD","sourcesContent":["// Copyright 2024 IOTA Stiftung.\n// SPDX-License-Identifier: Apache-2.0.\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\nimport { CLIBase } from \"@twin.org/cli-core\";\nimport type { Command } from \"commander\";\nimport { buildCommandBuild } from \"./commands/build.js\";\nimport { buildCommandDeploy } from \"./commands/deploy.js\";\n\n/**\n * The main entry point for the Move to JSON CLI.\n */\nexport class CLI extends CLIBase {\n\t/**\n\t * Run the app.\n\t * @param argv The process arguments.\n\t * @param localesDirectory The directory for the locales, default to relative to the script.\n\t * @param options Additional options.\n\t * @param options.overrideOutputWidth Override the output width.\n\t * @returns The exit code.\n\t */\n\tpublic async run(\n\t\targv: string[],\n\t\tlocalesDirectory?: string,\n\t\toptions?: {\n\t\t\toverrideOutputWidth?: number;\n\t\t}\n\t): Promise<number> {\n\t\treturn this.execute(\n\t\t\t{\n\t\t\t\ttitle: \"TWIN Move to JSON\",\n\t\t\t\tappName: \"move-to-json\",\n\t\t\t\tversion: \"0.0.3-next.7\", // x-release-please-version\n\t\t\t\ticon: \"⚙️ \",\n\t\t\t\tsupportsEnvFiles: true,\n\t\t\t\toverrideOutputWidth: options?.overrideOutputWidth\n\t\t\t},\n\t\t\tlocalesDirectory ?? path.join(path.dirname(fileURLToPath(import.meta.url)), \"../locales\"),\n\t\t\targv\n\t\t);\n\t}\n\n\t/**\n\t * Configure any options or actions at the root program level.\n\t * @param program The root program command.\n\t */\n\tprotected configureRoot(program: Command): void {\n\t\tbuildCommandBuild(program);\n\t\tbuildCommandDeploy(program);\n\t}\n}\n"]}
|
package/dist/locales/en.json
CHANGED
|
@@ -203,6 +203,12 @@
|
|
|
203
203
|
"gasStationTransactionFailed": "The gas station transaction failed",
|
|
204
204
|
"dryRunFailed": "The dry run execution failed"
|
|
205
205
|
},
|
|
206
|
+
"iotaIdentityUtils": {
|
|
207
|
+
"getControllerCapInfoFailed": "Getting the controller capability info for the identity failed",
|
|
208
|
+
"identityNotFound": "The identity could not be found \"{notFoundId}\"",
|
|
209
|
+
"identityDeleted": "The identity \"{identityId}\" has been deleted and cannot be used for minting",
|
|
210
|
+
"controllerTokenNotFound": "No controller token found for the identity \"{notFoundId}\" with the provided controller address"
|
|
211
|
+
},
|
|
206
212
|
"iotaSmartContractUtils": {
|
|
207
213
|
"migrationFailed": "Smart contract migration failed",
|
|
208
214
|
"migrateSmartContractFailed": "Failed to migrate smart contract for object \"{objectId}\"",
|
package/docs/changelog.md
CHANGED
|
@@ -1,4 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.3-next.7](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.6...move-to-json-v0.0.3-next.7) (2026-03-13)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* buffer usage required for identity ([#60](https://github.com/twinfoundation/dlt/issues/60)) ([0ba7d16](https://github.com/twinfoundation/dlt/commit/0ba7d165662b0083aa2b4c1325dd8c2e65defa2e))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @twin.org/dlt-iota bumped from 0.0.3-next.6 to 0.0.3-next.7
|
|
16
|
+
|
|
17
|
+
## [0.0.3-next.6](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.5...move-to-json-v0.0.3-next.6) (2026-03-12)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
* add IotaIdentityUtils to resolve IOTA identity controller cap info ([#57](https://github.com/twinfoundation/dlt/issues/57)) ([f15281a](https://github.com/twinfoundation/dlt/commit/f15281af3b2812bde5130a1813f9c0143f1462bf))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Dependencies
|
|
26
|
+
|
|
27
|
+
* The following workspace dependencies were updated
|
|
28
|
+
* dependencies
|
|
29
|
+
* @twin.org/dlt-iota bumped from 0.0.3-next.5 to 0.0.3-next.6
|
|
2
30
|
|
|
3
31
|
## [0.0.3-next.5](https://github.com/twinfoundation/dlt/compare/move-to-json-v0.0.3-next.4...move-to-json-v0.0.3-next.5) (2026-03-03)
|
|
4
32
|
|
|
@@ -22,7 +22,7 @@ The main entry point for the Move to JSON CLI.
|
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
25
|
-
### run()
|
|
25
|
+
### run() {#run}
|
|
26
26
|
|
|
27
27
|
> **run**(`argv`, `localesDirectory?`, `options?`): `Promise`\<`number`\>
|
|
28
28
|
|
|
@@ -60,7 +60,7 @@ The exit code.
|
|
|
60
60
|
|
|
61
61
|
***
|
|
62
62
|
|
|
63
|
-
### configureRoot()
|
|
63
|
+
### configureRoot() {#configureroot}
|
|
64
64
|
|
|
65
65
|
> `protected` **configureRoot**(`program`): `void`
|
|
66
66
|
|
|
@@ -4,7 +4,7 @@ Network configuration interface
|
|
|
4
4
|
|
|
5
5
|
## Properties
|
|
6
6
|
|
|
7
|
-
### network
|
|
7
|
+
### network {#network}
|
|
8
8
|
|
|
9
9
|
> **network**: `NetworkTypes`
|
|
10
10
|
|
|
@@ -12,7 +12,7 @@ The network type
|
|
|
12
12
|
|
|
13
13
|
***
|
|
14
14
|
|
|
15
|
-
### platform
|
|
15
|
+
### platform {#platform}
|
|
16
16
|
|
|
17
17
|
> **platform**: `"iota"`
|
|
18
18
|
|
|
@@ -20,7 +20,7 @@ The platform type
|
|
|
20
20
|
|
|
21
21
|
***
|
|
22
22
|
|
|
23
|
-
### rpc
|
|
23
|
+
### rpc {#rpc}
|
|
24
24
|
|
|
25
25
|
> **rpc**: `object`
|
|
26
26
|
|
|
@@ -36,7 +36,7 @@ The RPC configuration
|
|
|
36
36
|
|
|
37
37
|
***
|
|
38
38
|
|
|
39
|
-
### deployment
|
|
39
|
+
### deployment {#deployment}
|
|
40
40
|
|
|
41
41
|
> **deployment**: `object`
|
|
42
42
|
|
|
@@ -72,7 +72,7 @@ The deployment configuration
|
|
|
72
72
|
|
|
73
73
|
***
|
|
74
74
|
|
|
75
|
-
### contracts?
|
|
75
|
+
### contracts? {#contracts}
|
|
76
76
|
|
|
77
77
|
> `optional` **contracts**: `object`
|
|
78
78
|
|
package/docs/usage.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# Move to JSON Usage
|
|
2
|
+
|
|
3
|
+
Use these commands to build and deploy Move contracts with a repeatable workflow across testnet, devnet, and mainnet.
|
|
4
|
+
|
|
5
|
+
## Running
|
|
6
|
+
|
|
7
|
+
To install and run the CLI locally use the following commands:
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
npm install @twin.org/move-to-json -g
|
|
11
|
+
move-to-json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
or run directly using NPX:
|
|
15
|
+
|
|
16
|
+
```shell
|
|
17
|
+
npx "@twin.org/move-to-json"
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Help
|
|
21
|
+
|
|
22
|
+
```text
|
|
23
|
+
⚙️ TWIN Move to JSON v0.0.3-next.5
|
|
24
|
+
|
|
25
|
+
Usage: move-to-json
|
|
26
|
+
|
|
27
|
+
Options:
|
|
28
|
+
-V, --version output the version number
|
|
29
|
+
--lang <lang> The language to display the output in. (default: "en")
|
|
30
|
+
--load-env [env...] Load the env files to initialise any environment variables.
|
|
31
|
+
-h, --help display help for command
|
|
32
|
+
|
|
33
|
+
Commands:
|
|
34
|
+
build [options] <inputGlob> Compiles Move smart contracts using the IOTA CLI and generates a network-aware JSON structure containing compiled bytecode modules.
|
|
35
|
+
deploy [options] Deploys previously compiled Move contracts to the specified IOTA network using the configured environment.
|
|
36
|
+
help [command] display help for command
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Build Command Output
|
|
40
|
+
|
|
41
|
+
```text
|
|
42
|
+
⚙️ TWIN Move to JSON v0.0.3-next.5
|
|
43
|
+
|
|
44
|
+
Usage: move-to-json build [options] <inputGlob>
|
|
45
|
+
|
|
46
|
+
Compiles Move smart contracts using the IOTA CLI and generates a network-aware JSON structure containing compiled bytecode modules.
|
|
47
|
+
|
|
48
|
+
Arguments:
|
|
49
|
+
inputGlob A glob pattern that matches one or more Move files
|
|
50
|
+
|
|
51
|
+
Options:
|
|
52
|
+
--network <network> Target network (testnet/devnet/mainnet) (default: "!NETWORK")
|
|
53
|
+
--output <file> Output file for compiled modules JSON (default: "smart-contract-deployments.json")
|
|
54
|
+
-h, --help display help for command
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Deploy Command Output
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
⚙️ TWIN Move to JSON v0.0.3-next.5
|
|
61
|
+
|
|
62
|
+
Usage: move-to-json deploy [options]
|
|
63
|
+
|
|
64
|
+
Deploys previously compiled Move contracts to the specified IOTA network using the configured environment.
|
|
65
|
+
|
|
66
|
+
Options:
|
|
67
|
+
--contracts <path> Path to compiled contracts file (default: "smart-contract-deployments.json")
|
|
68
|
+
-n, --network <network> Target network (testnet, devnet, mainnet) (default: "!NETWORK")
|
|
69
|
+
--dry-run Perform a dry run without actual deployment
|
|
70
|
+
-f, --force Force redeployment even if already deployed
|
|
71
|
+
--rpc-url <url> RPC endpoint URL for the network (default: "!RPC_URL")
|
|
72
|
+
--address-index <number> Address index for key derivation (default: "!ADDRESS_INDEX")
|
|
73
|
+
--rpc-timeout <number> RPC request timeout in milliseconds (default: "!RPC_TIMEOUT")
|
|
74
|
+
--gas-budget <number> Gas budget for transactions (default: "!GAS_BUDGET")
|
|
75
|
+
--confirmation-timeout <number> Transaction confirmation timeout in milliseconds (default: "!CONFIRMATION_TIMEOUT")
|
|
76
|
+
--faucet-url <url> Faucet URL for requesting test tokens (default: "!FAUCET_URL")
|
|
77
|
+
--deployer-mnemonic <mnemonic> Deployer wallet mnemonic phrase (default: "!DEPLOYER_MNEMONIC")
|
|
78
|
+
--deployer-seed <seed> Deployer wallet seed (alternative to mnemonic) (default: "!DEPLOYER_SEED")
|
|
79
|
+
-h, --help display help for command
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Command Structure
|
|
83
|
+
|
|
84
|
+
The tool provides two core subcommands:
|
|
85
|
+
|
|
86
|
+
- `build` compiles Move contracts and generates a network-aware JSON structure.
|
|
87
|
+
- `deploy` deploys compiled contracts to a target network using your configured environment.
|
|
88
|
+
|
|
89
|
+
## Build Command
|
|
90
|
+
|
|
91
|
+
### Build Basic Usage
|
|
92
|
+
|
|
93
|
+
```shell
|
|
94
|
+
move-to-json build "src/contracts/**/*.move" --network testnet --output smart-contract-deployments.json
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### What it does
|
|
98
|
+
|
|
99
|
+
- Finds matching `.move` files using your glob pattern.
|
|
100
|
+
- Compiles contracts with the IOTA CLI.
|
|
101
|
+
- Computes deterministic package IDs from compiled bytecode.
|
|
102
|
+
- Writes network-aware contract data for deployment.
|
|
103
|
+
|
|
104
|
+
### Example Output Structure
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"testnet": {
|
|
109
|
+
"packageId": "0x1bd7add2dc75ba6a840e21792a1ba51d807ce9c3b29c4fa2140f383e77988daa",
|
|
110
|
+
"package": "oRzrCwYAAAAKAQAKAgoQ..."
|
|
111
|
+
},
|
|
112
|
+
"devnet": {
|
|
113
|
+
"packageId": "0x1bd7add2dc75ba6a840e21792a1ba51d807ce9c3b29c4fa2140f383e77988daa",
|
|
114
|
+
"package": "oRzrCwYAAAAKAQAKAgoQ..."
|
|
115
|
+
},
|
|
116
|
+
"mainnet": {
|
|
117
|
+
"packageId": "0x1bd7add2dc75ba6a840e21792a1ba51d807ce9c3b29c4fa2140f383e77988daa",
|
|
118
|
+
"package": "oRzrCwYAAAAKAQAKAgoQ..."
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Deploy Command
|
|
124
|
+
|
|
125
|
+
### Deploy Basic Usage
|
|
126
|
+
|
|
127
|
+
```shell
|
|
128
|
+
move-to-json deploy --network testnet --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
129
|
+
move-to-json deploy --network mainnet --force --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
130
|
+
move-to-json deploy --network testnet --dry-run --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### What the deploy command does
|
|
134
|
+
|
|
135
|
+
1. Prepares and validates the environment for the selected network.
|
|
136
|
+
2. Loads and validates deployment configuration.
|
|
137
|
+
3. Publishes contracts with the configured gas budget.
|
|
138
|
+
4. Updates contract JSON with deployed package IDs.
|
|
139
|
+
|
|
140
|
+
## Complete Workflow Example
|
|
141
|
+
|
|
142
|
+
```shell
|
|
143
|
+
# 1. Build contracts for testnet
|
|
144
|
+
move-to-json build "src/contracts/**/*.move" --network testnet --output src/contracts/smart-contract-deployments.json
|
|
145
|
+
|
|
146
|
+
# 2. Deploy to testnet
|
|
147
|
+
move-to-json deploy --network testnet --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
148
|
+
|
|
149
|
+
# 3. Validate on testnet
|
|
150
|
+
|
|
151
|
+
# 4. Build contracts for mainnet
|
|
152
|
+
move-to-json build "src/contracts/**/*.move" --network mainnet --output src/contracts/smart-contract-deployments.json
|
|
153
|
+
|
|
154
|
+
# 5. Deploy to mainnet
|
|
155
|
+
move-to-json deploy --network mainnet --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
## Security Considerations
|
|
159
|
+
|
|
160
|
+
- Mainnet deployments need careful gas and credential handling.
|
|
161
|
+
- Store wallet credentials in environment variables and secure secret stores.
|
|
162
|
+
- Use dry-run mode before live deployment.
|
|
163
|
+
- Test and verify on testnet before mainnet rollouts.
|
|
164
|
+
|
|
165
|
+
## Example
|
|
166
|
+
|
|
167
|
+
```shell
|
|
168
|
+
npx "@twin.org/move-to-json" build "tests/fixtures/sources/**/*.move" --load-env configs/testnet.env --output tests/fixtures/smart-contract-deployments/smart-contract-deployments.json
|
|
169
|
+
npx "@twin.org/move-to-json" deploy --load-env configs/testnet.env --contracts tests/fixtures/smart-contract-deployments/smart-contract-deployments.json --dry-run
|
|
170
|
+
```
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@twin.org/move-to-json",
|
|
3
|
-
"version": "0.0.3-next.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.3-next.7",
|
|
4
|
+
"description": "CLI for compiling Move contracts and preparing deployment JSON for IOTA networks.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/twinfoundation/dlt.git",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"@twin.org/cli-core": "next",
|
|
19
19
|
"@twin.org/core": "next",
|
|
20
20
|
"@twin.org/crypto": "next",
|
|
21
|
-
"@twin.org/dlt-iota": "0.0.3-next.
|
|
21
|
+
"@twin.org/dlt-iota": "0.0.3-next.7",
|
|
22
22
|
"@twin.org/nameof": "next",
|
|
23
23
|
"@twin.org/wallet-connector-iota": "next",
|
|
24
24
|
"commander": "14.0.3",
|
package/docs/examples.md
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# Move to JSON CLI Examples
|
|
2
|
-
|
|
3
|
-
This CLI compiles IOTA Move contracts into Base64-encoded modules, computes package IDs (SHA3-256), and provides network-specific deployment capabilities with separate build and deploy commands.
|
|
4
|
-
|
|
5
|
-
## Prerequisites
|
|
6
|
-
|
|
7
|
-
- Node.js (v20+)
|
|
8
|
-
- IOTA CLI installed in your PATH for compilation. You can download the IOTA CLI by visiting the [IOTA CLI GitHub Releases](https://github.com/iotaledger/iota/releases) page and downloading the appropriate binary for your operating system.
|
|
9
|
-
|
|
10
|
-
## Command Structure
|
|
11
|
-
|
|
12
|
-
The tool now uses separate `build` and `deploy` subcommands:
|
|
13
|
-
|
|
14
|
-
- **`build`** - Compiles Move contracts and generates network-aware JSON structure
|
|
15
|
-
- **`deploy`** - Deploys compiled contracts to specified network using configuration files
|
|
16
|
-
|
|
17
|
-
## Build Command
|
|
18
|
-
|
|
19
|
-
### Build Basic Usage
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
# Build contracts and generate network-aware JSON
|
|
23
|
-
move-to-json build "src/contracts/**/*.move" --network testnet --output smart-contract-deployments.json
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
### What it does
|
|
27
|
-
|
|
28
|
-
- Find all .move files matching the glob pattern
|
|
29
|
-
- Compile each file using the IOTA Move compiler
|
|
30
|
-
- Compute deterministic package IDs from compiled bytecode
|
|
31
|
-
- Generate network-aware JSON structure with testnet, devnet, and mainnet sections
|
|
32
|
-
- Each network contains identical packageId and package data, with deployedPackageId initially set to null
|
|
33
|
-
|
|
34
|
-
### Example Output Structure
|
|
35
|
-
|
|
36
|
-
```json
|
|
37
|
-
{
|
|
38
|
-
"testnet": {
|
|
39
|
-
"packageId": "0x1bd7add2dc75ba6a840e21792a1ba51d807ce9c3b29c4fa2140f383e77988daa",
|
|
40
|
-
"package": "oRzrCwYAAAAKAQAKAgoQ..."
|
|
41
|
-
},
|
|
42
|
-
"devnet": {
|
|
43
|
-
"packageId": "0x1bd7add2dc75ba6a840e21792a1ba51d807ce9c3b29c4fa2140f383e77988daa",
|
|
44
|
-
"package": "oRzrCwYAAAAKAQAKAgoQ..."
|
|
45
|
-
},
|
|
46
|
-
"mainnet": {
|
|
47
|
-
"packageId": "0x1bd7add2dc75ba6a840e21792a1ba51d807ce9c3b29c4fa2140f383e77988daa",
|
|
48
|
-
"package": "oRzrCwYAAAAKAQAKAgoQ..."
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Deploy Command
|
|
54
|
-
|
|
55
|
-
### Deploy Basic Usage
|
|
56
|
-
|
|
57
|
-
```bash
|
|
58
|
-
# Deploy to testnet
|
|
59
|
-
move-to-json deploy --network testnet --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
60
|
-
|
|
61
|
-
# Deploy to mainnet with force flag
|
|
62
|
-
move-to-json deploy --network mainnet --force --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
63
|
-
|
|
64
|
-
# Dry run (simulate without deploying)
|
|
65
|
-
move-to-json deploy --network testnet --dry-run --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### What the deploy command does
|
|
69
|
-
|
|
70
|
-
1. **Environment Preparation**: Cleans build artifacts and updates Move.toml for target network
|
|
71
|
-
2. **Configuration Validation**: Loads and validates network configuration
|
|
72
|
-
3. **Contract Deployment**: Uses IOTA CLI to publish contracts with appropriate gas budgets
|
|
73
|
-
4. **JSON Updates**: Updates the smart-contract-deployments.json with actual deployed package IDs
|
|
74
|
-
|
|
75
|
-
## Complete Workflow Example
|
|
76
|
-
|
|
77
|
-
```bash
|
|
78
|
-
# 1. Build contracts for testnet
|
|
79
|
-
move-to-json build "src/contracts/**/*.move" --network testnet --output src/contracts/smart-contract-deployments.json
|
|
80
|
-
|
|
81
|
-
# 2. Deploy to testnet first
|
|
82
|
-
move-to-json deploy --network testnet --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
83
|
-
|
|
84
|
-
# 3. Test and validate on testnet
|
|
85
|
-
|
|
86
|
-
# 4. Build contracts for mainnet
|
|
87
|
-
move-to-json build "src/contracts/**/*.move" --network mainnet --output src/contracts/smart-contract-deployments.json
|
|
88
|
-
|
|
89
|
-
# 5. Deploy to mainnet
|
|
90
|
-
move-to-json deploy --network mainnet --contracts <PATH-TO-CONTRACTS> --load-env <PATH-TO-ENVS>
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
## Security Considerations
|
|
94
|
-
|
|
95
|
-
- **Mainnet deployments** require careful configuration with appropriate gas budgets
|
|
96
|
-
- **Wallet credentials** should be stored securely using environment variables
|
|
97
|
-
- **Gas station integration** provides sponsored transactions for supported networks
|
|
98
|
-
- **Dry run mode** allows testing deployment logic without actual execution
|