@suzaku-network/suzaku-cli 1.0.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.
Files changed (194) hide show
  1. package/LICENSE +96 -0
  2. package/README.md +1080 -0
  3. package/bin/cli.js +3 -0
  4. package/defaults/.env.anvil +4 -0
  5. package/defaults/.env.dexalot +7 -0
  6. package/defaults/.env.fuji +4 -0
  7. package/defaults/.env.kiteai +2 -0
  8. package/defaults/.env.mainnet +4 -0
  9. package/defaults/.env.template +10 -0
  10. package/dist/abis/AccessControl.d.ts +176 -0
  11. package/dist/abis/AccessControl.js +230 -0
  12. package/dist/abis/AccessControl.js.map +1 -0
  13. package/dist/abis/BalancerValidatorManager.d.ts +1121 -0
  14. package/dist/abis/BalancerValidatorManager.js +1469 -0
  15. package/dist/abis/BalancerValidatorManager.js.map +1 -0
  16. package/dist/abis/DefaultCollateral.d.ts +620 -0
  17. package/dist/abis/DefaultCollateral.js +811 -0
  18. package/dist/abis/DefaultCollateral.js.map +1 -0
  19. package/dist/abis/ERC20.d.ts +635 -0
  20. package/dist/abis/ERC20.js +831 -0
  21. package/dist/abis/ERC20.js.map +1 -0
  22. package/dist/abis/IWarpMessenger.d.ts +104 -0
  23. package/dist/abis/IWarpMessenger.js +139 -0
  24. package/dist/abis/IWarpMessenger.js.map +1 -0
  25. package/dist/abis/KiteStakingManager.d.ts +1459 -0
  26. package/dist/abis/KiteStakingManager.js +1886 -0
  27. package/dist/abis/KiteStakingManager.js.map +1 -0
  28. package/dist/abis/L1Middleware.d.ts +1712 -0
  29. package/dist/abis/L1Middleware.js +2242 -0
  30. package/dist/abis/L1Middleware.js.map +1 -0
  31. package/dist/abis/L1Registry.d.ts +415 -0
  32. package/dist/abis/L1Registry.js +544 -0
  33. package/dist/abis/L1Registry.js.map +1 -0
  34. package/dist/abis/L1RestakeDelegator.d.ts +865 -0
  35. package/dist/abis/L1RestakeDelegator.js +1118 -0
  36. package/dist/abis/L1RestakeDelegator.js.map +1 -0
  37. package/dist/abis/OperatorL1OptInService.d.ts +288 -0
  38. package/dist/abis/OperatorL1OptInService.js +374 -0
  39. package/dist/abis/OperatorL1OptInService.js.map +1 -0
  40. package/dist/abis/OperatorRegistry.d.ts +125 -0
  41. package/dist/abis/OperatorRegistry.js +166 -0
  42. package/dist/abis/OperatorRegistry.js.map +1 -0
  43. package/dist/abis/OperatorVaultOptInService.d.ts +288 -0
  44. package/dist/abis/OperatorVaultOptInService.js +374 -0
  45. package/dist/abis/OperatorVaultOptInService.js.map +1 -0
  46. package/dist/abis/Ownable.d.ts +59 -0
  47. package/dist/abis/Ownable.js +79 -0
  48. package/dist/abis/Ownable.js.map +1 -0
  49. package/dist/abis/PoASecurityModule.d.ts +225 -0
  50. package/dist/abis/PoASecurityModule.js +299 -0
  51. package/dist/abis/PoASecurityModule.js.map +1 -0
  52. package/dist/abis/RewardsNativeToken.d.ts +1334 -0
  53. package/dist/abis/RewardsNativeToken.js +1749 -0
  54. package/dist/abis/RewardsNativeToken.js.map +1 -0
  55. package/dist/abis/StakingVault.d.ts +2913 -0
  56. package/dist/abis/StakingVault.js +3780 -0
  57. package/dist/abis/StakingVault.js.map +1 -0
  58. package/dist/abis/StakingVaultOperations.d.ts +980 -0
  59. package/dist/abis/StakingVaultOperations.js +1270 -0
  60. package/dist/abis/StakingVaultOperations.js.map +1 -0
  61. package/dist/abis/UptimeTracker.d.ts +300 -0
  62. package/dist/abis/UptimeTracker.js +397 -0
  63. package/dist/abis/UptimeTracker.js.map +1 -0
  64. package/dist/abis/ValidatorManager.d.ts +842 -0
  65. package/dist/abis/ValidatorManager.js +1101 -0
  66. package/dist/abis/ValidatorManager.js.map +1 -0
  67. package/dist/abis/VaultFactory.d.ts +288 -0
  68. package/dist/abis/VaultFactory.js +378 -0
  69. package/dist/abis/VaultFactory.js.map +1 -0
  70. package/dist/abis/VaultManager.d.ts +519 -0
  71. package/dist/abis/VaultManager.js +678 -0
  72. package/dist/abis/VaultManager.js.map +1 -0
  73. package/dist/abis/VaultTokenized.d.ts +1626 -0
  74. package/dist/abis/VaultTokenized.js +2114 -0
  75. package/dist/abis/VaultTokenized.js.map +1 -0
  76. package/dist/abis/abi-selectors.json +700 -0
  77. package/dist/abis/index.d.ts +18356 -0
  78. package/dist/abis/index.js +58 -0
  79. package/dist/abis/index.js.map +1 -0
  80. package/dist/accessControl.d.ts +15 -0
  81. package/dist/accessControl.js +36 -0
  82. package/dist/accessControl.js.map +1 -0
  83. package/dist/balancer.d.ts +25 -0
  84. package/dist/balancer.js +42 -0
  85. package/dist/balancer.js.map +1 -0
  86. package/dist/cli.d.mts +1 -0
  87. package/dist/cli.d.ts +2 -0
  88. package/dist/cli.js +3183 -0
  89. package/dist/cli.js.map +1 -0
  90. package/dist/cli.mjs +31343 -0
  91. package/dist/cli.mjs.map +1 -0
  92. package/dist/client.d.ts +34 -0
  93. package/dist/client.js +76 -0
  94. package/dist/client.js.map +1 -0
  95. package/dist/config.d.ts +10 -0
  96. package/dist/config.js +63 -0
  97. package/dist/config.js.map +1 -0
  98. package/dist/delegator.d.ts +4 -0
  99. package/dist/delegator.js +16 -0
  100. package/dist/delegator.js.map +1 -0
  101. package/dist/index.d.mts +19770 -0
  102. package/dist/index.d.ts +7 -0
  103. package/dist/index.js +24 -0
  104. package/dist/index.js.map +1 -0
  105. package/dist/index.mjs +27451 -0
  106. package/dist/index.mjs.map +1 -0
  107. package/dist/keyStore.d.ts +3 -0
  108. package/dist/keyStore.js +105 -0
  109. package/dist/keyStore.js.map +1 -0
  110. package/dist/kiteStaking.d.ts +91 -0
  111. package/dist/kiteStaking.js +731 -0
  112. package/dist/kiteStaking.js.map +1 -0
  113. package/dist/l1.d.ts +5 -0
  114. package/dist/l1.js +22 -0
  115. package/dist/l1.js.map +1 -0
  116. package/dist/lib/autoCompletion.d.ts +3 -0
  117. package/dist/lib/autoCompletion.js +55 -0
  118. package/dist/lib/autoCompletion.js.map +1 -0
  119. package/dist/lib/cChainUtils.d.ts +42 -0
  120. package/dist/lib/cChainUtils.js +271 -0
  121. package/dist/lib/cChainUtils.js.map +1 -0
  122. package/dist/lib/castUtils.d.ts +18 -0
  123. package/dist/lib/castUtils.js +81 -0
  124. package/dist/lib/castUtils.js.map +1 -0
  125. package/dist/lib/chainList.d.ts +5 -0
  126. package/dist/lib/chainList.js +86 -0
  127. package/dist/lib/chainList.js.map +1 -0
  128. package/dist/lib/cliParser.d.ts +27 -0
  129. package/dist/lib/cliParser.js +167 -0
  130. package/dist/lib/cliParser.js.map +1 -0
  131. package/dist/lib/commandUtils.d.ts +13 -0
  132. package/dist/lib/commandUtils.js +38 -0
  133. package/dist/lib/commandUtils.js.map +1 -0
  134. package/dist/lib/coreWalletUtils.d.ts +3 -0
  135. package/dist/lib/coreWalletUtils.js +74 -0
  136. package/dist/lib/coreWalletUtils.js.map +1 -0
  137. package/dist/lib/justification.d.ts +90 -0
  138. package/dist/lib/justification.js +577 -0
  139. package/dist/lib/justification.js.map +1 -0
  140. package/dist/lib/ledgerUtils.d.ts +4 -0
  141. package/dist/lib/ledgerUtils.js +258 -0
  142. package/dist/lib/ledgerUtils.js.map +1 -0
  143. package/dist/lib/logger.d.ts +46 -0
  144. package/dist/lib/logger.js +226 -0
  145. package/dist/lib/logger.js.map +1 -0
  146. package/dist/lib/pChainUtils.d.ts +128 -0
  147. package/dist/lib/pChainUtils.js +436 -0
  148. package/dist/lib/pChainUtils.js.map +1 -0
  149. package/dist/lib/pass.d.ts +81 -0
  150. package/dist/lib/pass.js +353 -0
  151. package/dist/lib/pass.js.map +1 -0
  152. package/dist/lib/safeUtils.d.ts +25 -0
  153. package/dist/lib/safeUtils.js +93 -0
  154. package/dist/lib/safeUtils.js.map +1 -0
  155. package/dist/lib/transferUtils.d.ts +643 -0
  156. package/dist/lib/transferUtils.js +141 -0
  157. package/dist/lib/transferUtils.js.map +1 -0
  158. package/dist/lib/utils.d.ts +28 -0
  159. package/dist/lib/utils.js +166 -0
  160. package/dist/lib/utils.js.map +1 -0
  161. package/dist/lib/viemUtils.d.ts +80 -0
  162. package/dist/lib/viemUtils.js +317 -0
  163. package/dist/lib/viemUtils.js.map +1 -0
  164. package/dist/lib/warpUtils.d.ts +76 -0
  165. package/dist/lib/warpUtils.js +448 -0
  166. package/dist/lib/warpUtils.js.map +1 -0
  167. package/dist/middleware.d.ts +75 -0
  168. package/dist/middleware.js +430 -0
  169. package/dist/middleware.js.map +1 -0
  170. package/dist/operator.d.ts +4 -0
  171. package/dist/operator.js +22 -0
  172. package/dist/operator.js.map +1 -0
  173. package/dist/operatorOptIn.d.ts +8 -0
  174. package/dist/operatorOptIn.js +39 -0
  175. package/dist/operatorOptIn.js.map +1 -0
  176. package/dist/rewards.d.ts +116 -0
  177. package/dist/rewards.js +244 -0
  178. package/dist/rewards.js.map +1 -0
  179. package/dist/securityModule.d.ts +8 -0
  180. package/dist/securityModule.js +305 -0
  181. package/dist/securityModule.js.map +1 -0
  182. package/dist/stakingVault.d.ts +184 -0
  183. package/dist/stakingVault.js +1224 -0
  184. package/dist/stakingVault.js.map +1 -0
  185. package/dist/uptime.d.ts +54 -0
  186. package/dist/uptime.js +246 -0
  187. package/dist/uptime.js.map +1 -0
  188. package/dist/vault.d.ts +16 -0
  189. package/dist/vault.js +131 -0
  190. package/dist/vault.js.map +1 -0
  191. package/dist/vaultManager.d.ts +8 -0
  192. package/dist/vaultManager.js +40 -0
  193. package/dist/vaultManager.js.map +1 -0
  194. package/package.json +62 -0
package/README.md ADDED
@@ -0,0 +1,1080 @@
1
+ # Suzaku CLI
2
+
3
+ A simple CLI tool to interact with Suzaku core smart contracts on Avalanche. The commands let you register L1s, set up vaults, register operators, handle deposits/withdrawals, and perform middleware operations.
4
+
5
+ > **Note:**
6
+ >
7
+ > - The default usage is aimed at launching on Fuji.
8
+
9
+ ---
10
+
11
+ ## Table of Contents
12
+
13
+ - [Suzaku CLI](#suzaku-cli)
14
+ - [Table of Contents](#table-of-contents)
15
+ - [Requirements](#requirements)
16
+ - [Installation](#installation)
17
+ - [Environment Setup](#environment-setup)
18
+ - [User experience](#user-experience)
19
+ - [Identify the required addresses and credentials](#identify-the-required-addresses-and-credentials)
20
+ - [Multi-Signature](#multi-signature)
21
+ - [Ledger Hardware Wallet](#ledger-hardware-wallet)
22
+ - [Token values](#token-values)
23
+ - [Usage on Fuji](#usage-on-fuji)
24
+ - [L1 Setup Sequence on Fuji](#l1-setup-sequence-on-fuji)
25
+ - [Rewards Testing Sequence](#rewards-testing-sequence)
26
+ - [Key Store Commands](#key-store-commands)
27
+ - [Commands Reference](#commands-reference)
28
+ - [Global Options](#global-options)
29
+ - [L1 Registry Commands (`l1-registry`)](#l1-registry-commands-l1-registry)
30
+ - [Operator Registry Commands (`operator-registry`)](#operator-registry-commands-operator-registry)
31
+ - [Vault Manager Commands (`vault-manager`)](#vault-manager-commands-vault-manager)
32
+ - [Vault Commands (`vault`)](#vault-commands-vault)
33
+ - [Middleware Commands (`middleware`)](#middleware-commands-middleware)
34
+ - [Operator Opt-In Commands (`opt-in`)](#operator-opt-in-commands-opt-in)
35
+ - [Balancer Commands (`balancer`)](#balancer-commands-balancer)
36
+ - [POA Security Module Commands (`poa`)](#poa-security-module-commands-poa)
37
+ - [Uptime Commands (`uptime`)](#uptime-commands-uptime)
38
+ - [Rewards Commands (`rewards`)](#rewards-commands-rewards)
39
+ - [Key Store Commands (`key`)](#key-store-commands-key)
40
+ - [Validator Manager Contract Commands (`vmc`)](#vmc-commands-vmc)
41
+ - [KiteStakingManager Commands (`kite-staking-manager`)](#kitestakingmanager-commands-kite-staking-manager)
42
+ - [StakingVault Commands (`staking-vault`)](#stakingvault-commands-staking-vault)
43
+ - [Ledger Commands (`ledger`)](#ledger-commands-ledger)
44
+ - [Safe Commands (`safe`)](#safe-commands-safe)
45
+ - [Access Control Commands (`access-control`)](#access-control-commands-access-control)
46
+ - [Completion](#completion)
47
+ - [Other Commands](#other-commands)
48
+
49
+ ## Requirements
50
+
51
+ - Node.js (v16+ recommended)
52
+ - pnpm package manager (or npm/yarn)
53
+ - [cast](https://book.getfoundry.sh/reference/cast) for token minting/approval commands (optional)
54
+ - [pass](https://www.passwordstore.org/) to manager private keys securely (mandatory on mainnet)
55
+
56
+ ---
57
+
58
+ ## Installation
59
+
60
+ 1. **Clone the repository and navigate to it:**
61
+
62
+ ```bash
63
+ git clone https://github.com/suzaku-network/suzaku-cli
64
+ cd suzaku-cli
65
+ ```
66
+
67
+ 2. **Install dependencies:**
68
+
69
+ ```bash
70
+ pnpm install
71
+ ```
72
+
73
+ ---
74
+
75
+ ## Environment Setup
76
+
77
+ ### User experience
78
+
79
+ - Link the cli globally to make it accessible system-wide
80
+
81
+ ```bash
82
+ pnpm link --global
83
+ ```
84
+
85
+ After ward you can use the cli using `suzaku-cli` command which hit the transpiled build (faster than `pnpm cli`)
86
+
87
+ - Enable the auto-completion (only available on bash & zsh).
88
+ This will be installed on the default user shell (It can be enforced using `SHELL` env var).
89
+
90
+ ```bash
91
+ suzaku-cli completion install
92
+ ```
93
+
94
+ - Wait confirmation.
95
+ It's often the case that, on fuji or on the mainnet, we should ensure the transaction haven't reverted waiting some blocks.
96
+ To wait some blocks to confirm a tx, use the `--wait` parameter followed by the number of block to wait.
97
+
98
+ To see all parameters, see the [Commands Reference](#commands-reference) below.
99
+
100
+ ### Identify the required addresses and credentials
101
+
102
+ The specific commands and required information (such as contract addresses and private keys) will vary depending on your role—Operator, Curator, or L1. Ensure you have the relevant contract addresses and credentials prepared before proceeding.
103
+
104
+ - **Private key security**
105
+
106
+ If you plain to use **Avalanche mainnet**, It's mandatory to **use `pass`**. The cli wrap this tool **avoiding** the use of **raw private keys** in the terminal which ends in the history.
107
+
108
+ Using this feature implies initializing the password store of the cli located in `~/.suzaku-cli/.password-store`:
109
+
110
+ ```bash
111
+ # Check if you have already setup gpg keys
112
+ suzaku-cli key list-gpg-ids
113
+ # initialize the keystore
114
+ suzaku-cli key init <all-needed-gpg-ids>
115
+ ```
116
+
117
+ To save a new private key, the best way is copying it into the clipboard and use the following command:
118
+
119
+ ```bash
120
+ # Show the address of the imported private key
121
+ suzaku-cli key create <private-key-role-name> -c
122
+ ```
123
+
124
+ The `-c` use the value in the clip board and erase it if the key format is valid.
125
+
126
+ To send tx with a stored key, use the `-s` parameter followed by the name of the secret as in the next command example.
127
+
128
+ For private key options, you can directly replace the pk value with its secret name.
129
+
130
+ ### Multi-Signature
131
+
132
+ **Requirement:** Set the env var `SAFE_API_KEY` after creating the API key on [Safe developer platform](https://developer.safe.global/api-keys)
133
+
134
+ The CLI supports [Safe wallet](https://app.safe.global/) on all transactions.
135
+ To use it, just use the private key of a signer (or use Ledger) and set the address of the wallet after `--safe` parameter like that:
136
+
137
+ ```bash
138
+ # Using a secret from the keystore (mainnet is default)
139
+ suzaku-cli vault set-l1-limit $DELEGATOR $BALANCER_VALIDATOR_MANAGER 100 1 -s signer1-pk --safe 0x1234...
140
+
141
+ # Using Ledger hardware wallet with Safe
142
+ suzaku-cli vault deposit $VAULT 1000 --ledger --safe 0x1234...
143
+ ```
144
+
145
+ **Transaction management strategy:**
146
+
147
+ 1. Search for similar pending transactions in the Safe.
148
+ 2. **Exact match:**
149
+ - If already signed by the user: Ignore the transaction (Skip).
150
+ - If not signed: Automatically confirm the existing transaction.
151
+ 3. **Partial match** (same function, different arguments):
152
+ - Display an interactive menu.
153
+ - Options: Confirm an existing transaction, Create a new one, or Skip all.
154
+ 4. **No match:** Create a new transaction.
155
+ 5. **Proposal:** If the signer is not an owner but is registered as a delegate, the transaction will be proposed instead of executed. Delegates can propose transactions that owners must then confirm.
156
+
157
+ The first signer to reach the Safe threshold will execute the transaction.
158
+
159
+ All other operations like reject tx... are not supported. Please use the official [Safe wallet UI](https://app.safe.global/).
160
+
161
+ ### Ledger Hardware Wallet
162
+
163
+ The CLI supports Ledger hardware wallets for secure transaction signing. This is the recommended method for mainnet operations.
164
+
165
+ ```bash
166
+ # Use Ledger for signing (mainnet is default)
167
+ suzaku-cli middleware add-node $MIDDLEWARE $NODE_ID $BLS_KEY --ledger
168
+
169
+ # Use Ledger with Safe multisig
170
+ suzaku-cli vault deposit $VAULT 1000 --ledger --safe 0x1234...
171
+
172
+ # Use Ledger on Fuji testnet
173
+ suzaku-cli vault deposit $VAULT 100 --ledger --network fuji
174
+ ```
175
+
176
+ **Configuration:**
177
+
178
+ - `LEDGER_ACCOUNT_INDEX`: Set this environment variable to use a different account index (default: 0)
179
+
180
+ **Ledger commands:**
181
+
182
+ ```bash
183
+ # Get addresses from connected Ledger
184
+ suzaku-cli ledger addresses
185
+
186
+ # Fix USB rules on Linux (if Ledger is not detected)
187
+ suzaku-cli ledger fix-usb-rules
188
+ ```
189
+
190
+ > **Note:** On Linux, you may need to run `suzaku-cli ledger fix-usb-rules` with sudo privileges if the device is not detected. It will use the official Ledger script to add `/etc/udev/rules.d/20-hw1.rules` to identify Ledger devices.
191
+
192
+ ## Token values
193
+
194
+ It's important to notice that all token values to use as cli input are decimal formatted.
195
+
196
+ It means the given value is multiplied by the onchain decimal number or, for AVAX, by 18 for the C-Chain and 9 for the P-Chain.
197
+
198
+ ## Usage on Fuji
199
+
200
+ When deploying on Fuji, run commands using the `fuji` network parameter. For example:
201
+
202
+ ```bash
203
+ suzaku-cli l1-registry register $BALANCER_VALIDATOR_MANAGER $MIDDLEWARE https://l1.com --network fuji --private-key $PK
204
+ ```
205
+
206
+ ### L1 Setup Sequence on Fuji
207
+
208
+ - **L1 & Vault Registration:**
209
+
210
+ ```bash
211
+ suzaku-cli l1-registry register $BALANCER_VALIDATOR_MANAGER $MIDDLEWARE https://l1.com --network fuji --private-key $L1_OWNER
212
+ # Vault max limit for the L1 is 2M token (use decimal format)
213
+ suzaku-cli vault-manager register-vault-l1 $VAULT_MANAGER $VAULT 1 2000000 --network fuji --private-key $L1_OWNER
214
+ ```
215
+
216
+ - **(Optional) Modify L1 Middleware:**
217
+
218
+ ```bash
219
+ # Update the middleware associated with a registered L1
220
+ suzaku-cli l1-registry set-middleware $BALANCER_VALIDATOR_MANAGER $MIDDLEWARE --network fuji --private-key $L1_OWNER
221
+ ```
222
+
223
+ - **Operator Setup & Opt-In:**
224
+
225
+ ```bash
226
+ suzaku-cli operator-registry register https://operator1.com --network fuji --private-key $OPERATOR_OWNER
227
+ suzaku-cli opt-in l1-in $BALANCER_VALIDATOR_MANAGER --network fuji --private-key $OPERATOR_OWNER
228
+ suzaku-cli opt-in check-l1 $OPERATOR $BALANCER_VALIDATOR_MANAGER --network fuji
229
+ suzaku-cli opt-in vault-in $VAULT --network fuji --private-key $OPERATOR_OWNER
230
+ suzaku-cli opt-in check-vault $OPERATOR $VAULT --network fuji
231
+ ```
232
+
233
+ - **Set Limits & Operator Shares:**
234
+
235
+ ```bash
236
+ # Set the limit of the L1 in this vault to 1M tokens (use decimal format)
237
+ suzaku-cli vault set-l1-limit $VAULT $BALANCER_VALIDATOR_MANAGER 1000000 1 --network fuji --private-key $L1_OWNER
238
+ # Operator will be able to use 10.5 tokens (use decimal format)
239
+ suzaku-cli vault set-operator-l1-shares $VAULT $BALANCER_VALIDATOR_MANAGER $OPERATOR 10.5 1 --network fuji --private-key $L1_OWNER
240
+ ```
241
+
242
+ - **(Optional) Mint & Approve sAVAX, Then Deposit**
243
+ 1. Mint via `cast`:
244
+ ```bash
245
+ cast send "$SAVAX" "mint(address,uint256)" "$STAKER" 5000000000000000000000000 \
246
+ --rpc-url $RPC_URL \
247
+ --private-key "$CURATOR_OWNER"
248
+ ```
249
+ 2. Check allowance:
250
+ ```bash
251
+ cast call "$SAVAX" "allowance(address,address)" "$STAKER" "$PRIMARY_COLLATERAL" \
252
+ --rpc-url $RPC_URL
253
+ ```
254
+ 3. Approve and deposit on the collateral (4M tokens):
255
+ ```bash
256
+ suzaku-cli vault collateral-deposit $COLLATERAL 4000000 --network fuji --private-key $STAKER_PK
257
+ ```
258
+ 4. Deposit on Vault's `deposit(address,uint256)`:
259
+ ```bash
260
+ suzaku-cli vault deposit $VAULT1 4000000 --private-key $STAKER_PK
261
+ ```
262
+
263
+ - **Deposits / Withdrawals / Claims:**
264
+
265
+ ```bash
266
+ suzaku-cli vault deposit $VAULT 400 --network fuji --private-key $STAKER_OWNER
267
+ suzaku-cli vault withdraw $VAULT 100 --network fuji --private-key $STAKER_OWNER
268
+ suzaku-cli vault claim $VAULT 100 --network fuji --private-key $STAKER_OWNER
269
+ ```
270
+
271
+ - **Check Vault Information**
272
+
273
+ ```bash
274
+ # Get vault collateral token
275
+ suzaku-cli vault get-collateral $VAULT --network fuji
276
+
277
+ # Get vault delegator
278
+ suzaku-cli vault get-delegator $VAULT --network fuji
279
+
280
+ # Check your vault balance (using --account for an address or a pk instead)
281
+ suzaku-cli vault get-balance $VAULT --account $STAKER_OWNER --network fuji
282
+
283
+ # Check total vault supply
284
+ suzaku-cli vault get-total-supply $VAULT --network fuji
285
+
286
+ # Check withdrawal shares for an epoch
287
+ suzaku-cli vault get-withdrawal-shares $VAULT 100 --account $STAKER_OWNER --network fuji
288
+ ```
289
+
290
+ - **Check Stakes & Epochs**
291
+
292
+ ```bash
293
+ suzaku-cli vault-manager opstakes $VAULT_MANAGER $OPERATOR --network fuji
294
+ suzaku-cli middleware get-current-epoch $MIDDLEWARE --network fuji
295
+ suzaku-cli middleware register-operator $MIDDLEWARE $OPERATOR --private-key $L1_OWNER --network fuji
296
+ suzaku-cli middleware calc-operator-cache $MIDDLEWARE <current-epoch> 1 --private-key $L1_OWNER --network fuji
297
+ suzaku-cli middleware get-operator-stake $MIDDLEWARE $OPERATOR <current-epoch> 1 --network fuji
298
+ ```
299
+
300
+ - **Balancer / Security Module Setup**
301
+
302
+ ```bash
303
+ suzaku-cli balancer set-up-security-module $BALANCER_VALIDATOR_MANAGER $MIDDLEWARE 200000 --private-key $L1_OWNER --network fuji
304
+ suzaku-cli balancer get-security-modules $BALANCER_VALIDATOR_MANAGER --network fuji
305
+ ```
306
+
307
+ - **Check Epoch Information**
308
+
309
+ ```bash
310
+ suzaku-cli middleware get-current-epoch $MIDDLEWARE --network fuji
311
+ suzaku-cli middleware calc-operator-cache $MIDDLEWARE <current-epoch> 1 --private-key $L1_OWNER --network fuji
312
+ suzaku-cli middleware get-operator-stake $MIDDLEWARE $OPERATOR <next-epoch> 1 --network fuji
313
+ ```
314
+
315
+ - **Process Node Stake Cache**
316
+
317
+ ```bash
318
+ # Process all epochs 50 by 50 (default)
319
+ suzaku-cli middleware process-node-stake-cache $MIDDLEWARE --private-key $L1_OWNER --network fuji
320
+
321
+ # Process 5 epochs at once
322
+ suzaku-cli middleware process-node-stake-cache $MIDDLEWARE --epochs 5 --private-key $L1_OWNER --network fuji
323
+
324
+ # Process 100 epochs in batches of 10, with 2 second delay between batches
325
+ suzaku-cli middleware process-node-stake-cache $MIDDLEWARE --epochs 10 --loop-epochs 10 --delay 2000 --private-key $L1_OWNER --network fuji
326
+
327
+ # Process all epochs in batches of 50, waiting 1 block between batches
328
+ suzaku-cli middleware process-node-stake-cache $MIDDLEWARE --epochs 10 --loop-epochs 10 --wait 1
329
+
330
+ ```
331
+
332
+ - **Initialize and Complete Node Addition**
333
+
334
+ ```bash
335
+ suzaku-cli middleware add-node $MIDDLEWARE $NODE_ID $BLS_KEY --private-key $OPERATOR_OWNER --network fuji
336
+
337
+ suzaku-cli middleware complete-validator-registration \ --network fuji
338
+ $MIDDLEWARE \
339
+ $ADD_NODE_TX_HASH \
340
+ $BLS_PROOF_OF_POSSESSION \
341
+ --private-key $OPERATOR_OWNER
342
+ ```
343
+
344
+ Use the same commands for the `poa` security module but adding the `initialWeight` parameter.
345
+
346
+ ### Rewards Testing Sequence
347
+
348
+ Here's a recommended sequence of commands to test the rewards functionality:
349
+
350
+ 1. **Initial Setup and Configuration**
351
+
352
+ ```bash
353
+ # Check current fees configuration
354
+ suzaku-cli rewards get-fees-config $REWARDS --network fuji
355
+
356
+ # Set appropriate fees if needed
357
+ suzaku-cli rewards update-protocol-fee $REWARDS 1000 --network fuji --private-key $CURATOR_OWNER
358
+ suzaku-cli rewards update-operator-fee $REWARDS 2000 --network fuji --private-key $CURATOR_OWNER
359
+ suzaku-cli rewards update-curator-fee $REWARDS 500 --network fuji --private-key $CURATOR_OWNER
360
+
361
+ # Configure minimum required uptime
362
+ suzaku-cli rewards get-min-uptime $REWARDS --network fuji
363
+ suzaku-cli rewards set-min-uptime $REWARDS 3000 --network fuji --private-key $CURATOR_OWNER
364
+
365
+ # Set rewards bips for collateral class
366
+ suzaku-cli rewards set-bips-collateral-class $REWARDS 1 5000 --network fuji --private-key $CURATOR_OWNER
367
+ ```
368
+
369
+ 1.1. **Mint & Approve Reward Tokens**
370
+
371
+ ```bash
372
+ # Mint reward tokens to the admin
373
+ cast send "$SAVAX" "mint(address,uint256)" "$L1_OWNER_ADDRESS" 10000000000000000000000000 \
374
+ --rpc-url $RPC_URL \
375
+ --private-key "$CURATOR_OWNER"
376
+
377
+ # Check balance
378
+ cast call "$SAVAX" "balanceOf(address)" "$L1_OWNER_ADDRESS" \
379
+ --rpc-url $RPC_URL
380
+
381
+ # Check current allowance
382
+ cast call "$SAVAX" "allowance(address,address)" "$L1_OWNER_ADDRESS" "$REWARDS" \
383
+ --rpc-url $RPC_URL
384
+
385
+ # Approve reward tokens to be used by the rewards contract
386
+ cast send "$SAVAX" "approve(address,uint256)" "$REWARDS" 10000000000000000000000000 \
387
+ --rpc-url $RPC_URL \
388
+ --private-key "$L1_OWNER"
389
+ ```
390
+
391
+ > **Note:** Make sure `$SAVAX` in this step corresponds to the same token address you plan to use as `$SAVAX` in the next step. The admin account needs a sufficient balance and allowance for the rewards contract to transfer tokens during the rewards allocation process.
392
+
393
+ 2. **Allocate Rewards**
394
+
395
+ ```bash
396
+ # Set rewards amount for the epochs you want to test (1 token in decimal format)
397
+ suzaku-cli rewards set-amount $REWARDS 99 5 1 --network fuji --private-key $L1_OWNER
398
+
399
+ # Verify rewards allocation
400
+ suzaku-cli rewards get-epoch-rewards $REWARDS 99 --network fuji
401
+ ```
402
+
403
+ 3. **Distribute Rewards**
404
+
405
+ ```bash
406
+ # Distribute rewards for epoch 99 with batch size 10
407
+ suzaku-cli rewards distribute $REWARDS 99 10 --network fuji --private-key $L1_OWNER
408
+
409
+ # Check distribution status
410
+ suzaku-cli rewards get-distribution-batch $REWARDS 99 --network fuji
411
+
412
+ # Continue distribution if not complete
413
+ suzaku-cli rewards distribute $REWARDS 99 10 --network fuji --private-key $L1_OWNER
414
+ ```
415
+
416
+ 4. **Verify Shares Calculation**
417
+
418
+ ```bash
419
+ # Check operator shares
420
+ suzaku-cli rewards get-operator-shares $REWARDS 99 $OPERATOR --network fuji
421
+
422
+ # Check vault shares
423
+ suzaku-cli rewards get-vault-shares $REWARDS 99 $VAULT --network fuji
424
+
425
+ # Check curator shares
426
+ suzaku-cli rewards get-curator-shares $REWARDS 99 $CURATOR --network fuji
427
+ ```
428
+
429
+ 5. **Claim Rewards**
430
+
431
+ ```bash
432
+ # Claim operator fees
433
+ suzaku-cli rewards claim-operator-fee $REWARDS --network fuji --private-key $OPERATOR_KEY
434
+
435
+ # Claim staker rewards
436
+ suzaku-cli rewards claim $REWARDS --network fuji --private-key $STAKER_KEY
437
+
438
+ # Claim curator fees
439
+ suzaku-cli rewards claim-curator-fee $REWARDS --network fuji --private-key $CURATOR_KEY
440
+
441
+ # Claim protocol fees
442
+ suzaku-cli rewards claim-protocol-fee $REWARDS --network fuji --private-key $PROTOCOL_OWNER
443
+ ```
444
+
445
+ 6. **Verify Claim Status**
446
+
447
+ ```bash
448
+ # Check last claimed epoch for operator
449
+ suzaku-cli rewards get-last-claimed-operator $REWARDS $OPERATOR $REWARDS_TOKEN --network fuji
450
+
451
+ # Check last claimed epoch for staker
452
+ suzaku-cli rewards get-last-claimed-staker $REWARDS $STAKER $REWARDS_TOKEN --network fuji
453
+
454
+ # Check last claimed epoch for curator
455
+ suzaku-cli rewards get-last-claimed-curator $REWARDS $CURATOR $REWARDS_TOKEN --network fuji
456
+ ```
457
+
458
+ 7. **Claim Undistributed Rewards (if applicable)**
459
+ ```bash
460
+ # This should be done after epoch 99+2 to ensure all claims are done
461
+ suzaku-cli rewards claim-undistributed $REWARDS 99 --network fuji --private-key $L1_OWNER
462
+ ```
463
+
464
+ ### Key Store Commands
465
+
466
+ The following commands allow you to manage the cli secrets keystore. Under the wood, it uses [pass](https://www.passwordstore.org/), the standard unix password manager.
467
+ It's a mandatory dependency when working on the mainnet with this cli.
468
+
469
+ 1. **Initialize cli keystore**
470
+
471
+ ```bash
472
+ # Acquire available gpg key ids
473
+ suzaku-cli key list-gpg-ids
474
+ > [suzabro@domain.com
475
+ > avabro@domain.com]
476
+ # Initialize the keystore using the ids that are supposed to interact with.
477
+ suzaku-cli key init suzabro@domain.com avabro@domain.com ...
478
+ ```
479
+
480
+ 2. **Create new secret**
481
+
482
+ ```bash
483
+ suzaku-cli key create operator
484
+ ```
485
+
486
+ 3. **Use your secret name instead of raw private key**
487
+
488
+ ```bash
489
+ suzaku-cli middleware add-node $L1_MIDDLEWARE $NODE_ID $BLS_KEY -s operator
490
+ ```
491
+
492
+ You'll be prompted like using [pass](https://www.passwordstore.org/) normally and it will use the underlying private key
493
+
494
+ 4. **List all available secrets**
495
+
496
+ ```bash
497
+ suzaku-cli key list
498
+ > Available secrets:
499
+ > .password-store
500
+ > └── operator
501
+ ```
502
+
503
+ 5. **Remove a secret**
504
+ ```bash
505
+ suzaku-cli key rm operator
506
+ ```
507
+
508
+ For a complete list of commands, see the [Commands Reference](#commands-reference) below.
509
+
510
+ ---
511
+
512
+ ## Commands Reference
513
+
514
+ Run the help command for a full listing of available commands and options:
515
+
516
+ ```bash
517
+ suzaku-cli --help
518
+ ```
519
+
520
+ ### Global Options
521
+
522
+ - `-n, --network <network>`: Network to use (fuji, mainnet, anvil, kiteai, kiteaitestnet, custom). Default: **mainnet**.
523
+ - `-r, --rpc-url <rpcUrl>`: RPC URL for a custom network. Automatically sets `--network` to `custom`. If `--network custom` is used, this option is **required**.
524
+ - `-k, --private-key <privateKey>`: Private key for signing transactions.
525
+ - `-s, --secret-name <secretName>`: The keystore secret name containing the private key.
526
+ - `-l, --ledger`: Use Ledger hardware wallet for signing (conflicts with `-k` and `-s`).
527
+ - `-w, --wait <confirmations>`: Number of confirmations to wait after a write transaction. Default: 2.
528
+ - `--json`: Output logs in JSON format.
529
+ - `-y, --yes`: Automatic yes to prompts.
530
+ - `--safe <address>`: Use Safe smart account for transactions (compatible with Ledger).
531
+ - `--cast`: Output equivalent Foundry `cast` commands instead of executing write transactions (conflicts with `--safe`).
532
+ - `--skip-abi-validation`: Skip the ABI validation for used contracts.
533
+
534
+ **Environment variables:**
535
+
536
+ - `LogLevel`: Set log verbosity (DEBUG, INFO, WARN, ERROR). Default: INFO.
537
+ - `LEDGER_ACCOUNT_INDEX`: Ledger account index to use. Default: 0.
538
+
539
+ ### L1 Registry Commands (`l1-registry`)
540
+
541
+ - **register `<balancerAddress>` `<l1Middleware>` `<metadataUrl>`**
542
+ Register a new L1 in the L1 registry.
543
+ - **get-all**
544
+ List all L1s registered in the L1 registry.
545
+ - **set-metadata-url `<l1Address>` `<metadataUrl>`**
546
+ Set metadata URL for an L1 in the L1 registry.
547
+ - **set-middleware `<l1Address>` `<l1Middleware>`**
548
+ Set middleware address for an L1 in the L1 registry.
549
+
550
+ ### Operator Registry Commands (`operator-registry`)
551
+
552
+ - **register `<metadataUrl>`**
553
+ Register a new operator in the operator registry.
554
+ - **get-all**
555
+ List all operators registered in the operator registry.
556
+
557
+ ### Vault Manager Commands (`vault-manager`)
558
+
559
+ - **register-vault-l1 `<middlewareVaultManagerAddress>` `<vaultAddress>` `<collateralClass>` `<maxLimit>`**
560
+ Register a vault for L1 staking.
561
+ - **update-vault-max-l1-limit `<middlewareVaultManagerAddress>` `<vaultAddress>` `<collateralClass>` `<maxLimit>`**
562
+ Update the maximum L1 limit for a vault.
563
+ - **remove-vault `<middlewareVaultManager>` `<vaultAddress>`**
564
+ Remove a vault from L1 staking.
565
+ - **get-vault-count `<middlewareVaultManager>`**
566
+ Get the number of vaults registered for L1 staking.
567
+ - **get-vault-at-with-times `<middlewareVaultManager>` `<index>`**
568
+ Get the vault address at a specific index along with its registration and removal times.
569
+ - **get-vault-collateral-class `<middlewareVaultManager>` `<vaultAddress>`**
570
+ Get the collateral class ID associated with a vault.
571
+ - **opstakes `<middlewareVaultManager>` `<operatorAddress>`**
572
+ Show operator stakes across L1s, enumerating each L1 the operator is opted into.
573
+ - **l1stakes `<validatorManagerAddress>`**
574
+ Show L1 stakes for a given validator manager.
575
+
576
+ ### Vault Commands (`vault`)
577
+
578
+ - **deposit `<vaultAddress>` `<amount>` [--onBehalfOf `<behalfOf>]**
579
+ Deposit tokens into the vault.
580
+ - **withdraw `<vaultAddress>` `<amount>` [--claimer `<claimer>]**
581
+ Withdraw tokens from the vault.
582
+ - **claim `<vaultAddress>` `<epoch>` [--recipient `<recipient>]**
583
+ Claim withdrawn tokens from the vault for a specific epoch.
584
+ - **grant-staker-role `<vaultAddress>` `<account>`**
585
+ Grant staker role on a vault to an account.
586
+ - **revoke-staker-role `<vaultAddress>` `<account>`**
587
+ Revoke staker role on a vault from an account.
588
+ - **collateral-deposit `<collateralAddress>` `<amount>`**
589
+ Approve and deposit tokens into the collateral contract associated with a vault.
590
+ - **set-deposit-limit `<vaultAddress>` `<limit>`**
591
+ Set deposit limit for a vault (0 will disable the limit).
592
+ - **collateral-increase-limit `<vaultAddress>` `<limit>`**
593
+ Set deposit limit for a collateral.
594
+ - **get-collateral `<vaultAddress>`**
595
+ Get the collateral token address of a vault.
596
+ - **get-delegator `<vaultAddress>`**
597
+ Get the delegator address of a vault.
598
+ - **get-balance `<vaultAddress>` [--account `<account>]**
599
+ Get vault token balance for an account.
600
+ - **get-active-balance `<vaultAddress>` [--account `<account>]**
601
+ Get active vault balance for an account.
602
+ - **get-total-supply `<vaultAddress>`**
603
+ Get total supply of vault tokens.
604
+ - **get-withdrawal-shares `<vaultAddress>` `<epoch>` [--account `<account>]**
605
+ Get withdrawal shares for an account at a specific epoch.
606
+ - **get-withdrawals `<vaultAddress>` `<epoch>` [--account `<account>]**
607
+ Get withdrawal amount for an account at a specific epoch.
608
+ - **get-deposit-limit `<vaultAddress>`**
609
+ Get deposit limit for a vault.
610
+ - **set-l1-limit `<vaultAddress>` `<l1Address>` `<limit>` `<collateralClass>`**
611
+ Set the L1 limit for a vault's delegator.
612
+ - **set-operator-l1-shares `<vaultAddress>` `<l1Address>` `<operatorAddress>` `<shares>` `<collateralClass>`**
613
+ Set the L1 shares for an operator in a delegator.
614
+ - **get-l1-limit `<vaultAddress>` `<l1Address>` `<collateralClass>`**
615
+ Get L1 limit for a vault's delegator.
616
+ - **get-operator-l1-shares `<vaultAddress>` `<l1Address>` `<collateralClass>` `<operatorAddress>`**
617
+ Get L1 shares for an operator in a vault's delegator.
618
+
619
+ ### Middleware Commands (`middleware`)
620
+
621
+ - **add-collateral-class `<middlewareAddress>` `<collateralClassId>` `<minValidatorStake>` `<maxValidatorStake>` `<initialCollateral>`**
622
+ Add a new collateral class to the middleware.
623
+ - **add-collateral-to-class `<middlewareAddress>` `<collateralClassId>` `<collateralAddress>`**
624
+ Add a new collateral address to an existing collateral class.
625
+ - **remove-collateral-from-class `<middlewareAddress>` `<collateralClassId>` `<collateralAddress>`**
626
+ Remove a collateral address from an existing collateral class.
627
+ - **remove-collateral-class `<middlewareAddress>` `<collateralClassId>`**
628
+ Remove an existing secondary collateral class.
629
+ - **activate-collateral-class `<middlewareAddress>` `<collateralClassId>`**
630
+ Activate a secondary collateral class.
631
+ - **deactivate-collateral-class `<middlewareAddress>` `<collateralClassId>`**
632
+ Deactivate a secondary collateral class.
633
+ - **register-operator `<middlewareAddress>` `<operator>`**
634
+ Register an operator to operate on this L1.
635
+ - **disable-operator `<middlewareAddress>` `<operator>`**
636
+ Disable an operator to prevent it from operating on this L1.
637
+ - **remove-operator `<middlewareAddress>` `<operator>`**
638
+ Remove an operator from this L1.
639
+ - **process-node-stake-cache `<middlewareAddress>` [--epochs `<epochs>] [--loop-epochs `<count>] [--delay `<milliseconds>]**
640
+ Manually process node stake cache for one or more epochs.
641
+ - **add-node `<middlewareAddress>` `<nodeId>` `<blsKey>` [--initial-stake `<initialStake>] [--registration-expiry `<expiry>] [--pchain-remaining-balance-owner-threshold `<threshold>] [--pchain-disable-owner-threshold `<threshold>] [--pchain-remaining-balance-owner-address `<address>...] [--pchain-disable-owner-address `<address>...]**
642
+ Add a new node to an L1.
643
+ - **complete-validator-registration `<middlewareAddress>` `<addNodeTxHash>` `<blsProofOfPossession>` [--pchain-tx-private-key `<pchainTxPrivateKey>] [--initial-balance `<initialBalance>] [--skip-wait-api]**
644
+ Complete validator registration on the P-Chain and on the middleware after adding a node.
645
+ - **remove-node `<middlewareAddress>` `<nodeId>`**
646
+ Remove a node from an L1.
647
+ - **complete-validator-removal `<middlewareAddress>` `<removeNodeTxHash>` [--pchain-tx-private-key `<pchainTxPrivateKey>] [--skip-wait-api] [--node-id `<nodeId>]**
648
+ Complete validator removal on the P-Chain and on the middleware after removing a node.
649
+ - **init-stake-update `<middlewareAddress>` `<nodeId>` `<newStake>`**
650
+ Initialize validator stake update and lock.
651
+ - **complete-stake-update `<middlewareAddress>` `<validatorStakeUpdateTxHash>` [--pchain-tx-private-key `<pchainTxPrivateKey>] [--node-id `<nodeId>]**
652
+ Complete validator stake update of all or specified node IDs.
653
+ - **calc-operator-cache `<middlewareAddress>` `<epoch>` `<collateralClass>`**
654
+ Calculate and cache stakes for operators.
655
+ - **calc-node-stakes `<middlewareAddress>`**
656
+ Calculate and cache node stakes for all operators.
657
+ - **force-update-nodes `<middlewareAddress>` `<operator>` [--limit-stake `<stake>]**
658
+ Force update operator nodes with stake limit.
659
+ - **top-up-operator-validators `<middlewareAddress>` `<operator>` `<targetBalance>`**
660
+ Top up all operator validators to meet a target continuous fee balance.
661
+ - **get-operator-stake `<middlewareAddress>` `<operator>` `<epoch>` `<collateralClass>`**
662
+ Get operator stake for a specific epoch and collateral class.
663
+ - **get-operator-nodes `<middlewareAddress>` `<operator>`**
664
+ Get all nodes for an operator.
665
+ - **get-current-epoch `<middlewareAddress>`**
666
+ Get current epoch number.
667
+ - **get-epoch-start-ts `<middlewareAddress>` `<epoch>`**
668
+ Get epoch start timestamp.
669
+ - **get-active-nodes-for-epoch `<middlewareAddress>` `<operator>` `<epoch>`**
670
+ Get active nodes for an operator in a specific epoch.
671
+ - **get-operator-nodes-length `<middlewareAddress>` `<operator>`**
672
+ Get current number of nodes for an operator.
673
+ - **get-node-stake-cache `<middlewareAddress>` `<epoch>` `<validationId>`**
674
+ Get node stake cache for a specific epoch and validator.
675
+ - **get-operator-validation-ids `<middlewareAddress>` `<operator>`**
676
+ Get all validation IDs for an operator.
677
+ - **get-operator-locked-stake `<middlewareAddress>` `<operator>`**
678
+ Get operator locked stake.
679
+ - **node-pending-removal `<middlewareAddress>` `<validationId>`**
680
+ Check if node is pending removal.
681
+ - **get-operator-used-stake `<middlewareAddress>` `<operator>`**
682
+ Get operator used stake from cache.
683
+ - **get-operator-available-stake `<middlewareAddress>` `<operator>`**
684
+ Get operator available stake.
685
+ - **get-all-operators `<middlewareAddress>`**
686
+ Get all operators registered.
687
+ - **get-collateral-class-ids `<middlewareAddress>`**
688
+ Get all collateral class IDs from the middleware.
689
+ - **get-active-collateral-classes `<middlewareAddress>`**
690
+ Get active collateral classes (primary and secondary).
691
+ - **node-logs `<middlewareAddress>` [--node-id `<nodeId>] [--snowscan-api-key `<string>]**
692
+ Get middleware node logs.
693
+ - **get-last-node-validation-id `<middlewareAddress>` `<nodeId>`**
694
+ Get last node validation ID.
695
+ - **to-vault-epoch `<middlewareAddress>` `<vaultAddress>` `<middlewareEpoch>`**
696
+ Convert middleware epoch to a vault epoch.
697
+ - **update-window-ends-ts `<middlewareAddress>`**
698
+ Get the end timestamp of the last completed middleware epoch window.
699
+ - **vault-to-middleware-epoch `<middlewareAddress>` `<vaultAddress>` `<vaultEpoch>`**
700
+ Convert vault epoch to a middleware epoch.
701
+ - **set-vault-manager `<middlewareAddress>` `<vaultManagerAddress>`**
702
+ Set vault manager.
703
+ - **account-info `<middlewareAddress>` `<account>`**
704
+ Get account info.
705
+ - **info `<middlewareAddress>`**
706
+ Get general information about the middleware.
707
+ - **weight-sync `<middlewareAddress>` [--epochs `<number>`] [--loop-epochs `<number>`]**
708
+ Watch for operators weight changes.
709
+
710
+ ### Operator Opt-In Commands (`opt-in`)
711
+
712
+ - **l1-in `<l1Address>`**
713
+ Operator opts in to a given L1.
714
+ - **l1-out `<l1Address>`**
715
+ Operator opts out from a given L1.
716
+ - **check-l1 `<operator>` `<l1Address>`**
717
+ Check if an operator is opted in to a given L1.
718
+ - **vault-in `<vaultAddress>`**
719
+ Operator opts in to a given Vault.
720
+ - **vault-out `<vaultAddress>`**
721
+ Operator opts out from a given Vault.
722
+ - **check-vault `<operator>` `<vaultAddress>`**
723
+ Check if an operator is opted in to a given Vault.
724
+
725
+ ### Balancer Commands (`balancer`)
726
+
727
+ - **set-up-security-module `<balancerValidatorManagerAddress>` `<middlewareAddress>` `<maxWeight>`**
728
+ Set up a security module.
729
+ - **get-security-modules `<balancerValidatorManagerAddress>`**
730
+ Get all security modules.
731
+ - **get-security-module-weights `<balancerValidatorManagerAddress>` `<securityModule>`**
732
+ Get security module weights.
733
+ - **get-validator-status `<balancerAddress>` `<nodeId>`**
734
+ Get validator status by node ID.
735
+ - **resend-validator-registration `<balancerAddress>` `<nodeId>`**
736
+ Resend validator registration transaction.
737
+ - **resend-weight-update `<balancerAddress>` `<nodeId>`**
738
+ Resend validator weight update transaction.
739
+ - **resend-validator-removal `<balancerAddress>` `<nodeId>`**
740
+ Resend validator removal transaction.
741
+ - **transfer-l1-ownership `<balancerAddress>` `<newOwner>`**
742
+ Transfer Validator manager, balancer and its security modules ownership to a new owner.
743
+
744
+ ### POA Security Module Commands (`poa`)
745
+
746
+ - **add-node `<poaSecurityModule>` `<nodeId>` `<blsKey>` `<initialWeight>` [--registration-expiry `<expiry>] [--pchain-remaining-balance-owner-threshold `<threshold>] [--pchain-disable-owner-threshold `<threshold>] [--pchain-remaining-balance-owner-address `<address>...] [--pchain-disable-owner-address `<address>...]**
747
+ Add a new node to an L1.
748
+ - **complete-validator-registration `<poaSecurityModuleAddress>` `<addNodeTxHash>` `<blsProofOfPossession>` [--pchain-tx-private-key `<pchainTxPrivateKey>] [--initial-balance `<initialBalance>] [--skip-wait-api]**
749
+ Complete validator registration on the P-Chain and on the middleware after adding a node.
750
+ - **remove-node `<poaSecurityModuleAddress>` `<nodeId>`**
751
+ Initiate validator removal.
752
+ - **complete-validator-removal `<poaSecurityModuleAddress>` `<nodeId>` `<removeNodeTxHash>` [--pchain-tx-private-key `<pchainTxPrivateKey>]**
753
+ Complete validator removal in the P-Chain and in the POA Security Module.
754
+ - **init-weight-update `<poaSecurityModuleAddress>` `<nodeId>` `<newWeight>`**
755
+ Update validator weight.
756
+ - **complete-weight-update `<middlewareAddress>` `<validatorStakeUpdateTxHash>` [--pchain-tx-private-key `<pchainTxPrivateKey>] [--node-id `<nodeId>]**
757
+ Complete validator weight update of all or specified node IDs.
758
+
759
+ ### Uptime Commands (`uptime`)
760
+
761
+ - **get-validation-uptime-message `<rpcUrl>` `<blockchainId>` `<nodeId>`**
762
+ Get the validation uptime message for a given validator in the given L1 RPC.
763
+ - **compute-validator-uptime `<uptimeTrackerAddress>` `<signedUptimeHex>`**
764
+ Compute validator uptime based on the signed uptime message.
765
+ - **report-uptime-validator `<rpcUrl>` `<blockchainId>` `<nodeId>` `<uptimeTrackerAddress>`**
766
+ Gets a validator's signed uptime message and submits it to the UptimeTracker contract.
767
+ - **report-all-validators-uptime `<uptimeTrackerAddress>` `<middlewareAddress>` `<rpcUrl>` `<blockchainId>`** [--epoch `<epoch>`]
768
+ Report uptime for all validators (optional `--epoch` defaults to current epoch).
769
+ - **compute-operator-uptime `<uptimeTrackerAddress>` `<operator>` `<epoch>`**
770
+ Compute uptime for an operator at a specific epoch.
771
+ - **compute-operator-uptime-range `<uptimeTrackerAddress>` `<operator>` `<startEpoch>` `<endEpoch>`**
772
+ Compute uptime for an operator over a range of epochs (client-side looping).
773
+ - **get-validator-uptime `<uptimeTrackerAddress>` `<validationID>` `<epoch>`**
774
+ Get the recorded uptime for a validator at a specific epoch.
775
+ - **check-validator-uptime-set `<uptimeTrackerAddress>` `<validationID>` `<epoch>`**
776
+ Check if uptime data is set for a validator at a specific epoch.
777
+ - **get-operator-uptime `<uptimeTrackerAddress>` `<operator>` `<epoch>`**
778
+ Get the recorded uptime for an operator at a specific epoch.
779
+ - **check-operator-uptime-set `<uptimeTrackerAddress>` `<operator>` `<epoch>`**
780
+ Check if uptime data is set for an operator at a specific epoch.
781
+
782
+ ### Rewards Commands (`rewards`)
783
+
784
+ - **distribute `<rewardsAddress>` `<epoch>` `<batchSize>`**
785
+ Distribute rewards for a specific epoch.
786
+ - **claim `<rewardsAddress>` [--recipient `<recipient>]**
787
+ Claim rewards for a staker in batch of 64 epochs.
788
+ - **claim-operator-fee `<rewardsAddress>` [--recipient `<recipient>]**
789
+ Claim operator fees in batch of 64 epochs.
790
+ - **claim-curator-fee `<rewardsAddress>` [--recipient `<recipient>]**
791
+ Claim all curator fees in batch of 64 epochs.
792
+ - **claim-protocol-fee `<rewardsAddress>` [--recipient `<recipient>]**
793
+ Claim protocol fees (only for protocol owner).
794
+ - **claim-undistributed `<rewardsAddress>` `<epoch>` [--recipient `<recipient>]**
795
+ Claim undistributed rewards (admin only).
796
+ - **set-amount `<rewardsAddress>` `<startEpoch>` `<numberOfEpochs>` `<rewardsAmount>`**
797
+ Set rewards amount for epochs.
798
+ - **set-bips-collateral-class `<rewardsAddress>` `<collateralClass>` `<bips>`**
799
+ Set rewards bips for collateral class.
800
+ - **set-min-uptime `<rewardsAddress>` `<minUptime>`**
801
+ Set minimum required uptime for rewards eligibility.
802
+ - **set-protocol-owner `<rewardsAddress>` `<newOwner>`**
803
+ Set protocol owner (DEFAULT_ADMIN_ROLE only).
804
+ - **update-protocol-fee `<rewardsAddress>` `<newFee>`**
805
+ Update protocol fee.
806
+ - **update-operator-fee `<rewardsAddress>` `<newFee>`**
807
+ Update operator fee.
808
+ - **update-curator-fee `<rewardsAddress>` `<newFee>`**
809
+ Update curator fee.
810
+ - **update-all-fees `<rewardsAddress>` `<protocolFee>` `<operatorFee>` `<curatorFee>`**
811
+ Update all fees at once (protocol, operator, curator).
812
+ - **get-epoch-rewards `<rewardsAddress>` `<epoch>`**
813
+ Get rewards amount for a specific epoch.
814
+ - **get-operator-shares `<rewardsAddress>` `<epoch>` `<operator>`**
815
+ Get operator shares for a specific epoch.
816
+ - **get-vault-shares `<rewardsAddress>` `<epoch>` `<vault>`**
817
+ Get vault shares for a specific epoch.
818
+ - **get-curator-shares `<rewardsAddress>` `<epoch>` `<curator>`**
819
+ Get curator shares for a specific epoch.
820
+ - **get-protocol-rewards `<rewardsAddress>` `<token>`**
821
+ Get protocol rewards for a token.
822
+ - **get-distribution-batch `<rewardsAddress>` `<epoch>`**
823
+ Get distribution batch status for an epoch.
824
+ - **get-fees-config `<rewardsAddress>`**
825
+ Get current fees configuration.
826
+ - **get-bips-collateral-class `<rewardsAddress>` `<collateralClass>`**
827
+ Get rewards bips for collateral class.
828
+ - **get-min-uptime `<rewardsAddress>`**
829
+ Get minimum required uptime for rewards eligibility.
830
+ - **get-last-claimed-staker `<rewardsAddress>` `<staker>` `<rewardToken>`**
831
+ Get last claimed epoch for a staker.
832
+ - **get-last-claimed-operator `<rewardsAddress>` `<operator>` `<rewardToken>`**
833
+ Get last claimed epoch for an operator.
834
+ - **get-last-claimed-curator `<rewardsAddress>` `<curator>` `<rewardToken>`**
835
+ Get last claimed epoch for a curator.
836
+
837
+ ### Key Store Commands (`key`)
838
+
839
+ - **list-gpg-ids**
840
+ List available gpg key ids installed on the system.
841
+ - **init `<gpgKeyIds...>`**
842
+ Initialize the keystore.
843
+ - **create `<name>`** (requires one of: **-c/--clip**, **-v/--value `<value>`**, or **-p/--prompt**)
844
+ Create a new encrypted secret (clipboard, value, or prompt for value).
845
+ - **rm `<name>`**
846
+ Remove an encrypted secret.
847
+ - **list** [--hide-addresses]
848
+ List all encrypted secrets.
849
+ - **addresses `<name>`**
850
+ Show the address of an encrypted private key.
851
+
852
+ ### Validator Manager Contract Commands (`vmc`)
853
+
854
+ - **info `<validatorManagerAddress>`**
855
+ Get summary information about a Validator Manager Contract.
856
+ - **transfer-ownership `<validatorManagerAddress>` `<owner>`**
857
+ Transfer the ownership of a ValidatorManager contract.
858
+ - **complete-validator-removal `<validatorManagerAddress>` `<removalTxId>`**
859
+ Complete the removal of a validator that has been pending removal.
860
+
861
+ ### KiteStakingManager Commands (`kite-staking-manager`)
862
+
863
+ Alias: `ksm`
864
+
865
+ > **Note:** All `kite-staking-manager` commands accept `--staking-manager-address <address>` to specify the KiteStakingManager contract. It can also be set via the `KITE_STAKING_MANAGER` environment variable (by default there is no need to set it on KiteAI mainnet and testnet as addresses are in the default `.env` files).
866
+ >
867
+ > These commands automatically switch to the KiteAI network (or KiteAI testnet when on Fuji).
868
+
869
+ - **info [--staking-manager-address `<address>`]**
870
+ Get global configuration from KiteStakingManager.
871
+ - **validator-info `<validationID>` [--staking-manager-address `<address>`]**
872
+ Get comprehensive information for a validator (pending rewards, reward accounting, etc.).
873
+ - **delegator-info `<delegationID>` [--staking-manager-address `<address>`]**
874
+ Get comprehensive information for a delegator (pending rewards, reward accounting, etc.).
875
+ - **update-staking-config `<minimumStakeAmount>` `<maximumStakeAmount>` `<minimumStakeDuration>` `<minimumDelegationFeeBips>` `<maximumStakeMultiplier>` [--staking-manager-address `<address>`]**
876
+ Update staking configuration. Stake amounts are in AVAX (18 decimals).
877
+ - **initiate-validator-registration `<nodeId>` `<blsKey>` `<delegationFeeBips>` `<minStakeDuration>` `<rewardRecipient>` `<stakeAmount>` [--staking-manager-address `<address>`] [--pchain-remaining-balance-owner-threshold `<threshold>`] [--pchain-disable-owner-threshold `<threshold>`] [--pchain-remaining-balance-owner-address `<address>`...] [--pchain-disable-owner-address `<address>`...]**
878
+ Initiate validator registration on KiteStakingManager. `stakeAmount` is in AVAX.
879
+ - **complete-validator-registration `<initiateTxHash>` `<blsProofOfPossession>` [--staking-manager-address `<address>`] [--pchain-tx-private-key `<pchainTxPrivateKey>`] [--initial-balance `<initialBalance>`] [--skip-wait-api]**
880
+ Complete validator registration on the P-Chain and on the KiteStakingManager after initiating registration.
881
+ - **initiate-delegator-registration `<nodeId>` `<rewardRecipient>` `<stakeAmount>` [--staking-manager-address `<address>`]**
882
+ Initiate delegator registration on KiteStakingManager. `stakeAmount` is in AVAX.
883
+ - **complete-delegator-registration `<initiateTxHash>` `<rpcUrl>` [--staking-manager-address `<address>`] [--pchain-tx-private-key `<pchainTxPrivateKey>`]**
884
+ Complete delegator registration on the P-Chain and on the KiteStakingManager after initiating registration.
885
+ - **initiate-delegator-removal `<delegationID>` [--staking-manager-address `<address>`] [--include-uptime-proof] [--rpc-url `<rpcUrl>`]**
886
+ Initiate delegator removal on KiteStakingManager. `--rpc-url` is required when `--include-uptime-proof` is set.
887
+ - **complete-delegator-removal `<initiateRemovalTxHash>` `<rpcUrl>` [--staking-manager-address `<address>`] [--pchain-tx-private-key `<pchainTxPrivateKey>`] [--skip-wait-api] [--delegation-id `<delegationID>`...] [--initiate-tx `<initiateTx>`]**
888
+ Complete delegator removal on the P-Chain and on the KiteStakingManager after initiating removal.
889
+ - **initiate-validator-removal `<nodeId>` [--staking-manager-address `<address>`] [--include-uptime-proof]**
890
+ Initiate validator removal on KiteStakingManager.
891
+ - **complete-validator-removal `<initiateRemovalTxHash>` [--staking-manager-address `<address>`] [--pchain-tx-private-key `<pchainTxPrivateKey>`] [--skip-wait-api] [--node-id `<nodeId>`...] [--initiate-tx `<initiateTx>`...]**
892
+ Complete validator removal on the P-Chain and on the KiteStakingManager after initiating removal.
893
+ - **submit-uptime-proof `<nodeId>` `<rpcUrl>` [--staking-manager-address `<address>`]**
894
+ Submit uptime proof for a validator.
895
+
896
+ ### StakingVault Commands (`staking-vault`)
897
+
898
+ Alias: `sv`
899
+
900
+ > **Note:** All `staking-vault` commands accept `--staking-vault-address <address>` to specify the StakingVault contract. It can also be set via the `STAKING_VAULT` environment variable.
901
+ >
902
+ > These commands automatically switch to the KiteAI network (or KiteAI testnet when on Fuji).
903
+
904
+ **User operations:**
905
+
906
+ - **deposit `<amount>` `<minShares>` [--staking-vault-address `<address>`]**
907
+ Deposit native tokens (AVAX) into the StakingVault. `amount` is in AVAX. `minShares` provides slippage protection.
908
+ - **request-withdrawal `<shares>` [--staking-vault-address `<address>`]**
909
+ Request withdrawal from the StakingVault. `shares` is the number of vault shares to burn.
910
+ - **claim-withdrawal `<requestId>` [--staking-vault-address `<address>`]**
911
+ Claim a withdrawal from the StakingVault using its request ID.
912
+ - **claim-withdrawal-for `<requestId>` [--staking-vault-address `<address>`]**
913
+ Claim a withdrawal for a specific request ID (permissionless).
914
+ - **claim-withdrawals-for `<requestIds...>` [--staking-vault-address `<address>`]**
915
+ Claim multiple withdrawals by request IDs in a single transaction (permissionless).
916
+ - **claim-escrowed-withdrawal `<recipient>` [--staking-vault-address `<address>`]**
917
+ Claim escrowed withdrawal funds to a recipient address.
918
+
919
+ **Admin / operator management:**
920
+
921
+ - **add-operator `<operator>` `<allocationBips>` `<feeRecipient>` [--staking-vault-address `<address>`]**
922
+ Add an operator to the StakingVault. `allocationBips` is in basis points (1 bips = 0.01%).
923
+ - **remove-operator `<operator>` [--staking-vault-address `<address>`]**
924
+ Remove an operator from the StakingVault.
925
+ - **update-operator-allocations `<operator>` `<allocationBips>` [--staking-vault-address `<address>`]**
926
+ Update an operator's allocation in the StakingVault.
927
+ - **claim-operator-fees [--staking-vault-address `<address>`]**
928
+ Claim operator fees for the caller (operator).
929
+ - **force-claim-operator-fees `<operator>` [--staking-vault-address `<address>`]**
930
+ Force claim operator fees for a given operator (admin).
931
+ - **claim-pending-protocol-fees [--staking-vault-address `<address>`]**
932
+ Claim pending protocol fees (admin).
933
+ - **pause [--staking-vault-address `<address>`]**
934
+ Pause the StakingVault.
935
+ - **unpause [--staking-vault-address `<address>`]**
936
+ Unpause the StakingVault.
937
+
938
+ **Epoch management:**
939
+
940
+ - **process-epoch [--staking-vault-address `<address>`]**
941
+ Process the current epoch in the StakingVault (fulfils pending withdrawals).
942
+ - **harvest [--staking-vault-address `<address>`]**
943
+ Harvest rewards (claim pending validator/delegator rewards).
944
+ - **harvest-validators `<operatorIndex>` `<start>` `<batchSize>` [--staking-vault-address `<address>`]**
945
+ Harvest validator rewards in a batch for an operator.
946
+ - **harvest-delegators `<operatorIndex>` `<start>` `<batchSize>` [--staking-vault-address `<address>`]**
947
+ Harvest delegator rewards in a batch for an operator.
948
+ - **prepare-withdrawals [--staking-vault-address `<address>`]**
949
+ Prepare withdrawals by initiating stake removals.
950
+
951
+ **Validator management:**
952
+
953
+ - **initiate-validator-registration `<nodeId>` `<blsKey>` `<stakeAmount>` [--staking-vault-address `<address>`] [--pchain-remaining-balance-owner-threshold `<threshold>`] [--pchain-disable-owner-threshold `<threshold>`] [--pchain-remaining-balance-owner-address `<address>`...] [--pchain-disable-owner-address `<address>`...]**
954
+ Initiate validator registration in the StakingVault. `stakeAmount` is in AVAX.
955
+ - **complete-validator-registration `<initiateTxHash>` `<blsProofOfPossession>` [--staking-vault-address `<address>`] [--pchain-tx-private-key `<pchainTxPrivateKey>`] [--initial-balance `<initialBalance>`] [--skip-wait-api]**
956
+ Complete validator registration on the P-Chain and on the StakingVault.
957
+ - **initiate-validator-removal `<nodeId>` [--staking-vault-address `<address>`]**
958
+ Initiate validator removal in the StakingVault.
959
+ - **complete-validator-removal `<initiateRemovalTxHash>` [--staking-vault-address `<address>`] [--pchain-tx-private-key `<pchainTxPrivateKey>`] [--skip-wait-api] [--node-id `<nodeId>`...] [--initiate-tx `<initiateTx>`]**
960
+ Complete validator removal on the P-Chain and on the StakingVault.
961
+ - **force-remove-validator `<nodeId>` [--staking-vault-address `<address>`]**
962
+ Force remove a validator from the StakingVault (admin/emergency operation).
963
+
964
+ **Delegator management:**
965
+
966
+ - **initiate-delegator-registration `<nodeId>` `<amount>` [--staking-vault-address `<address>`]**
967
+ Initiate delegator registration in the StakingVault. `amount` is in AVAX.
968
+ - **complete-delegator-registration `<initiateTxHash>` `<rpcUrl>` [--staking-vault-address `<address>`] [--pchain-tx-private-key `<pchainTxPrivateKey>`]**
969
+ Complete delegator registration on the P-Chain and on the StakingVault. `rpcUrl` is the L1 RPC (e.g. `http://domain:port`).
970
+ - **initiate-delegator-removal `<delegationID>` [--staking-vault-address `<address>`]**
971
+ Initiate delegator removal in the StakingVault.
972
+ - **complete-delegator-removal `<initiateRemovalTxHash>` [--staking-vault-address `<address>`] [--pchain-tx-private-key `<pchainTxPrivateKey>`] [--skip-wait-api] [--delegation-id `<delegationID>`...] [--initiate-tx `<initiateTx>`]**
973
+ Complete delegator removal on the P-Chain and on the StakingVault.
974
+ - **force-remove-delegator `<delegationID>` [--staking-vault-address `<address>`]**
975
+ Force remove a delegator from the StakingVault (admin/emergency operation).
976
+
977
+ **Read / info commands:**
978
+
979
+ - **info [--staking-vault-address `<address>`]**
980
+ Get general overview of the StakingVault.
981
+ - **fees-info [--staking-vault-address `<address>`]**
982
+ Get fees configuration of the StakingVault.
983
+ - **operators-info [--staking-vault-address `<address>`]**
984
+ Get operators details of the StakingVault.
985
+ - **validators-info [--staking-vault-address `<address>`]**
986
+ Get validators details per operator of the StakingVault.
987
+ - **delegators-info [--staking-vault-address `<address>`]**
988
+ Get delegations details per operator of the StakingVault.
989
+ - **withdrawals-info [--staking-vault-address `<address>`]**
990
+ Get withdrawal queue info of the StakingVault.
991
+ - **epoch-info [--staking-vault-address `<address>`]**
992
+ Get epoch info of the StakingVault.
993
+ - **full-info [--staking-vault-address `<address>`]**
994
+ Get all information about the StakingVault (combines all info commands above).
995
+ - **get-current-epoch [--staking-vault-address `<address>`]**
996
+ Get the current epoch number.
997
+ - **get-epoch-duration [--staking-vault-address `<address>`]**
998
+ Get epoch duration in seconds.
999
+ - **get-next-epoch-start-time [--staking-vault-address `<address>`]**
1000
+ Get the next epoch start timestamp.
1001
+
1002
+ ### Ledger Commands (`ledger`)
1003
+
1004
+ - **addresses**
1005
+ Get addresses from connected Ledger device.
1006
+ - **fix-usb-rules**
1007
+ Fix USB rules on Linux for Ledger device detection.
1008
+
1009
+ ### Safe Commands (`safe`)
1010
+
1011
+ - **nonce `<safeAddress>`**
1012
+ Get the current nonce of a Safe.
1013
+ - **get-role** [--account `<account>`]
1014
+ Get user role in the Safe (Owner, Delegate, or No role). Uses global `--safe` for the Safe address; optionally check a specific account with `--account`, otherwise uses the signer.
1015
+
1016
+ ### Access Control Commands (`access-control`)
1017
+
1018
+ - **grant-role `<contractAddress>` `<role>` `<account>`**
1019
+ Grant a role to an account.
1020
+ - **revoke-role `<contractAddress>` `<role>` `<account>`**
1021
+ Revoke a role from an account.
1022
+ - **has-role `<contractAddress>` `<role>` `<account>`**
1023
+ Check if an account has a specific role.
1024
+ - **get-role-admin `<contractAddress>` `<role>`**
1025
+ Get the admin role that controls a specific role.
1026
+
1027
+ ### Completion
1028
+
1029
+ - **completion install**
1030
+ Install shell autocompletion for Bash and Zsh (uses default user shell; set `SHELL` to override).
1031
+
1032
+ ### Other Commands
1033
+
1034
+ - **verify-abi `<address>` `<abi>`**
1035
+ Verify that a contract at a given address matches the expected Suzaku ABI (5% tolerance). This verification is done every time a contract is used and raises an error if validation fails.
1036
+ - **top-up-l1-validators `<subnetID>` `<targetBalance>` [--node-id `<nodeId>]**
1037
+ Top up all/selected l1 validators to meet a target continuous fee balance.
1038
+ - **help-all**
1039
+ Display help for all commands and sub-commands.
1040
+
1041
+ ---
1042
+
1043
+ ## Development Scripts
1044
+
1045
+ ### Update ABIs (`scripts/update-abis.mjs`)
1046
+
1047
+ This script updates the ABI files in `src/abis/` from a Foundry output directory. It extracts ABIs from compiled contract JSON files, deduplicates overloaded functions, and generates TypeScript files.
1048
+
1049
+ **Usage:**
1050
+
1051
+ ```bash
1052
+ # Use the default source directory
1053
+ scripts/update-abis.mjs
1054
+
1055
+ # Specify a custom source directory
1056
+ scripts/update-abis.mjs --source-dir /path/to/foundry/out
1057
+ scripts/update-abis.mjs -s /path/to/foundry/out
1058
+
1059
+ # Show help
1060
+ scripts/update-abis.mjs --help
1061
+ ```
1062
+
1063
+ **Options:**
1064
+
1065
+ | Option | Alias | Description |
1066
+ | --------------------- | ----- | ---------------------------------------------------------------------- |
1067
+ | `--source-dir <path>` | `-s` | Path to the Foundry output directory containing compiled contract ABIs |
1068
+ | `--help` | `-h` | Show help message |
1069
+
1070
+ **What it does:**
1071
+
1072
+ 1. Reads contract ABIs from the Foundry `out/` directory
1073
+ 2. Deduplicates overloaded functions (keeps the version with the fewest parameters)
1074
+ 3. Generates TypeScript files in `src/abis/`
1075
+ 4. Updates `abi-selectors.json` with function selectors for ABI validation
1076
+
1077
+ **What next:**
1078
+
1079
+ 1. Update the index.ts file in `src/abis/` with the new ABIs
1080
+ 2. If a contract is not a proxy but use the forward and delegate call pattern, add a combined ABI in the index.ts file (like with the StakingVault), and validate only the abi of the targeted contract address (as done in curriedContract function in `src/lib/viemUtils.ts`). Then you can instantiate the contract with the combined abi.