()
| 180 | } |
| 181 | |
| 182 | func showAllDatabaseDeposit() { |
| 183 | var ( |
| 184 | req = new(types.QueryAccountSQLChainProfilesReq) |
| 185 | resp = new(types.QueryAccountSQLChainProfilesResp) |
| 186 | pubKey *asymmetric.PublicKey |
| 187 | err error |
| 188 | ) |
| 189 | |
| 190 | if pubKey, err = kms.GetLocalPublicKey(); err != nil { |
| 191 | ConsoleLog.WithError(err).Error("query database chain profile failed") |
| 192 | SetExitStatus(1) |
| 193 | return |
| 194 | } |
| 195 | |
| 196 | if req.Addr, err = crypto.PubKeyHash(pubKey); err != nil { |
| 197 | ConsoleLog.WithError(err).Error("query database chain profile failed") |
| 198 | SetExitStatus(1) |
| 199 | return |
| 200 | } |
| 201 | |
| 202 | if err = mux.RequestBP(route.MCCQueryAccountSQLChainProfiles.String(), req, resp); err != nil { |
| 203 | if strings.Contains(err.Error(), "can't find method") { |
| 204 | // old version block producer |
| 205 | ConsoleLog.WithError(err).Warning("query account database profiles is not supported in old version block producer") |
| 206 | return |
| 207 | } |
| 208 | |
| 209 | ConsoleLog.WithError(err).Error("query account database profiles failed") |
| 210 | SetExitStatus(1) |
| 211 | return |
| 212 | } |
| 213 | |
| 214 | if len(resp.Profiles) == 0 { |
| 215 | fmt.Println("found no related database") |
| 216 | return |
| 217 | } |
| 218 | |
| 219 | fmt.Printf("Database Deposits:\n\n") |
| 220 | fmt.Printf("%-64s\tDeposit\tArrears\tAdvancePayment\n", "DatabaseID") |
| 221 | |
| 222 | for _, p := range resp.Profiles { |
| 223 | for _, user := range p.Users { |
| 224 | if user.Address == req.Addr && user.Permission != nil && user.Permission.Role != types.Void { |
| 225 | fmt.Printf("%s\t%d\t%d\t%d\n", |
| 226 | p.ID, user.Deposit, user.Arrears, user.AdvancePayment) |
| 227 | } |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | func runWallet(cmd *Command, args []string) { |
| 233 | commonFlagsInit(cmd) |
no test coverage detected