You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove a contract from local state (does NOT delete from the Hedera network).
76
+
**Default:** submits `ContractDeleteTransaction` on Hedera, then removes the contract from local CLI state. **With `--state-only`:** only removes it from local CLI state (no network transaction). Hedera does not allow deleting a contract on the network if it has no admin key; in that case use `--state-only` for local cleanup only. When the contract has an admin key, pass `--admin-key` (or keep a stored admin reference from `contract create --admin-key`) if signing material is not already in state.
77
77
78
-
| Option | Short | Type | Required | Default | Description |
|`--contract`|`-c`| string |**yes**| — | Contract ID (`0.0.xxx`) or alias; for network delete, state entry optional if mirror can resolve ID |
83
+
|`--state-only`|`-s`| boolean | no |`false`| Remove only from local CLI state; do not submit a network delete |
84
+
|`--transfer-id`|`-t`| string | no† | — | Account receiving remaining HBAR (ID or alias). †One of `-t` or `-r` required for network delete. Not with `--state-only`|
85
+
|`--transfer-contract-id`|`-r`| string | no† | — | Contract receiving remaining HBAR. †One of `-t` or `-r` required for network delete. Not with `--state-only`|
86
+
|`--admin-key`|`-a`| repeatable | no | — | Admin key if not stored in state (same as create). Not with `--state-only`|
87
+
|`--key-manager`|`-k`| string | no | config | Key manager when resolving `--admin-key`|
Lists all deployed contracts stored in the state across all networks.
@@ -103,17 +109,29 @@ Lists all deployed contracts stored in the state across all networks.
103
109
hcli contract list
104
110
```
105
111
112
+
### Contract Delete
113
+
114
+
**Default:** submits `ContractDeleteTransaction` on Hedera, then removes the contract from local CLI state. **With `--state-only`:** only removes from local CLI state (no network transaction).
115
+
116
+
When deleting on Hedera (default), pass **`--transfer-id` (`-t`)** or **`--transfer-contract-id` (`-r`)** so remaining HBAR has a destination (avoids `OBTAINER_REQUIRED` from the network). Use `--admin-key` when signing material for the contract admin key is not already in state (same formats as create). Contracts **without** an admin key on Hedera cannot be deleted on the network—use `--state-only` to drop local CLI state only. If the contract is not in local state, the CLI loads contract info from the mirror node.
0 commit comments