Skip to content
Snippets Groups Projects
Select Git revision
  • 5b749210b6195a17e70f0e224605e3f0f5233f9a
  • without_tipselection default
  • develop protected
  • fix/grafana-local-dashboard
  • wasp
  • fix/dashboard-explorer-freeze
  • master
  • feat/timerqueue
  • test/sync_debug_and_650
  • feat/sync_revamp_inv
  • wip/sync
  • tool/db-recovery
  • portcheck/fix
  • fix/synchronization
  • feat/new-dashboard-analysis
  • feat/refactored-analysis-dashboard
  • feat/new-analysis-dashboard
  • test/demo-prometheus-fpc
  • prometheus_metrics
  • wip/analysis-server
  • merge/fpc-test-value-transfer
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.3
  • v0.1.2
  • v0.1.1
  • v0.1.0
28 results

balance.go

Blame
  • user avatar
    Hans Moog authored and GitHub committed
    * Feat: started adding new logic to the wallet package
    
    * Feat: intermediary commit
    
    * Feat: added Outputs to wallet
    
    * Feat: started implementing SendFunds
    
    * Feat: added AddressManager + refactored code
    
    * Feat: tx gets constructed
    
    * Feat: txs get sent now
    
    * Feat: fixed bug after merge
    
    * Fix: fixed faucet
    
    * Fix: fix double spend tool
    
    * Fix: refactored broken tests
    
    * Fix: fixed additional tests
    
    * Fix: fixed some integration tests
    
    * Fix: fixed some issues
    
    * Fix: fixed further bugs in integration tests
    
    * Fix: fixed some bugs
    
    * :white_check_mark: Make WaitToKillTimeInSeconds a parameter
    
    * :wrench: Set default ParaWaitToKill to 60 seconds
    
    * :bug: Fix bug
    
    * Feat: added an output manager
    
    * Fix: fixed bug
    
    * Feat: added new features to the wallet
    
    * Feat: added missing comments
    
    * Feat: updated some stuff
    
    * Feat: started to implement a cli wallet
    
    * Feat: added new features to cli wallet
    
    * Feat: added more features to cli wallet
    
    * Feat: MOAR FEATURES
    
    * Feat: finished wallet
    
    * Fix: fixed bug due to refactor
    
    * Fix: fixed bugs
    
    * Refactor: removed comments from private methods
    
    * do not ignore client lib
    
    * move wallet inside of the client dir
    
    * do not ignore client in docker build
    
    * go fmt yourself
    
    * Feat: added config to wallet
    
    * Feat: exe creates default config upon first launch
    
    * Feat: updated gitignore
    
    * Feat: refactored some code
    
    * Feat: added ERROR to all "non-fatal" error messages
    
    * Feat: removed error prefix from call and moved to func
    
    * Feat: indented error message
    
    * Feat: make commands look like params in useage print
    
    * Feat: reordered commands and params
    
    * Feat: fixed bug with colored coins creation
    
    * Fix: fixed missing unit tests
    
    * Feat: added message to sendfunds
    
    * Feat: added message for faucet POW call
    
    * Feat: intermediary commit
    
    * Fix: Enable server-status to get server information
    
    * Fix: Fix dependency cycle
    
    * Fix: Fix unit test errors
    
    * Fix: Fix integration test
    
    * Fix: Fix consensus integration test
    
    * Fix: fix :dog:
    
    * Refactor: Reorganize the wallet files to make it cleaner
    
    * Fix: Fix :dog:
    
    * :package:
    
     Add script for building cli-wallet binaries
    
    Co-authored-by: default avatarHans Moog <hm@mkjc.net>
    Co-authored-by: default avatarcapossele <angelocapossele@gmail.com>
    Co-authored-by: default avatarWolfgang Welz <welzwo@gmail.com>
    Co-authored-by: default avatarjkrvivian <jkrvivian@gmail.com>
    7ba94158
    History
    balance.go 1.32 KiB
    package main
    
    import (
    	"flag"
    	"fmt"
    	"os"
    	"text/tabwriter"
    
    	"github.com/iotaledger/goshimmer/client/wallet"
    )
    
    func execBalanceCommand(command *flag.FlagSet, cliWallet *wallet.Wallet) {
    	err := command.Parse(os.Args[2:])
    	if err != nil {
    		panic(err)
    	}
    
    	confirmedBalance, pendingBalance, err := cliWallet.Balance()
    	if err != nil {
    		printUsage(nil, err.Error())
    	}
    
    	// initialize tab writer
    	w := new(tabwriter.Writer)
    	w.Init(os.Stdout, 0, 8, 2, '\t', 0)
    	defer w.Flush()
    
    	// print header
    	fmt.Println()
    	_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", "STATUS", "BALANCE", "COLOR", "TOKEN NAME")
    	_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", "------", "---------------", "--------------------------------------------", "-------------------------")
    
    	// print empty if no balances founds
    	if len(confirmedBalance) == 0 && len(pendingBalance) == 0 {
    		_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", "<EMPTY>", "<EMPTY>", "<EMPTY>", "<EMPTY>")
    
    		return
    	}
    
    	// print balances
    	for color, amount := range confirmedBalance {
    		_, _ = fmt.Fprintf(w, "%s\t%d %s\t%s\t%s\n", "[ OK ]", amount, cliWallet.AssetRegistry().Symbol(color), color.String(), cliWallet.AssetRegistry().Name(color))
    	}
    	for color, amount := range pendingBalance {
    		_, _ = fmt.Fprintf(w, "%s\t%d\t%s\t%s\n", "[PEND]", amount, color.String(), cliWallet.AssetRegistry().Name(color))
    	}
    }