[#47] Add Makefile helpers for wallet management

Signed-off-by: Vitaliy Potyarkin <v.potyarkin@yadro.com>
This commit is contained in:
Vitaliy Potyarkin 2024-09-20 14:08:46 +00:00
parent 539faea51e
commit 52c5fb042d
2 changed files with 50 additions and 0 deletions

View file

@ -92,6 +92,27 @@ enable-oracle:
tick.epoch: tick.epoch:
@docker exec aio /usr/bin/frostfs-adm --config /config/frostfs-adm.yml morph force-new-epoch @docker exec aio /usr/bin/frostfs-adm --config /config/frostfs-adm.yml morph force-new-epoch
# Create new wallet
WALLET?=wallets/wallet1.json
.PHONY: wallet
wallet:
@! test -f "$(WALLET)" || { echo "File exists: $(WALLET)"; exit 1; }
@docker exec -it aio /usr/bin/neo-go wallet init -a -w "$(WALLET)"
# Refill GAS in arbitrary WALLET (must be under wallets/ directory)
GAS?=50.0
.PHONY: refill
refill:
@docker exec aio /usr/bin/frostfs-adm --config /config/frostfs-adm.yml \
morph refill-gas --storage-wallet=/$(WALLET) --gas=$(GAS)
@$(MAKE) --no-print-directory balance
# Show wallet balance
.PHONY: balance
balance:
@echo "Balance for $(WALLET)"
@docker exec aio /usr/bin/neo-go wallet nep17 balance -r http://localhost:30333 -w "$(WALLET)"
# Show current version # Show current version
version: version:
@echo $(VERSION) @echo $(VERSION)

View file

@ -288,6 +288,35 @@ If everything is rigth, the stdout will show a pretty-printed contents of the wa
wallet successfully created, file location is /wallets/new-wallet.json wallet successfully created, file location is /wallets/new-wallet.json
``` ```
You can use `make wallet WALLET=wallets/new-wallet.json`
to execute the steps listed above a little faster.
### Transfering GAS tokens to wallet
To add GAS to a new wallet use `make refill`
```console
$ make refill GAS=12.3 WALLET=wallets/new-wallet.json
Waiting for transactions to persist...
Balance for wallets/new-wallet.json
Account NgB6jnyVsMg6E3gQQLXoccZ3JBMLsgiut3
GAS: GasToken (d2a4cff31913016155e38e474a2c06d08be276cf)
Amount : 12.3
Updated: 25069
```
### Checking wallet balance
```console
$ make balance WALLET=wallets/new-wallet.json
Balance for wallets/new-wallet.json
Account NgB6jnyVsMg6E3gQQLXoccZ3JBMLsgiut3
GAS: GasToken (d2a4cff31913016155e38e474a2c06d08be276cf)
Amount : 12.3
Updated: 25069
```
## frostfs-cli interface ## frostfs-cli interface