From 52c5fb042d32767dca5b1b93b180be35e4aa78ca Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Fri, 20 Sep 2024 14:08:46 +0000 Subject: [PATCH] [#47] Add Makefile helpers for wallet management Signed-off-by: Vitaliy Potyarkin --- Makefile | 21 +++++++++++++++++++++ README.md | 29 +++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) diff --git a/Makefile b/Makefile index 983f549..d1ce2bc 100644 --- a/Makefile +++ b/Makefile @@ -92,6 +92,27 @@ enable-oracle: tick.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 version: @echo $(VERSION) diff --git a/README.md b/README.md index 9ca12ab..25be80c 100644 --- a/README.md +++ b/README.md @@ -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 ``` +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