Skip to content

Commit

Permalink
Remove config file usage, add wallet list cmd (#499)
Browse files Browse the repository at this point in the history
* remove config file related things

Signed-off-by: Aaron Sutula <[email protected]>

* wallet list command

Signed-off-by: Aaron Sutula <[email protected]>

* update docs

Signed-off-by: Aaron Sutula <[email protected]>

* Add List to deals module interface

Signed-off-by: Aaron Sutula <[email protected]>
  • Loading branch information
asutula authored Jul 2, 2020
1 parent 28a3cd4 commit c5596fa
Show file tree
Hide file tree
Showing 72 changed files with 339 additions and 248 deletions.
14 changes: 12 additions & 2 deletions api/client/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package client

import (
"context"
"fmt"

"github.com/textileio/powergate/wallet/rpc"
)
Expand All @@ -15,16 +16,25 @@ type Wallet struct {
func (w *Wallet) NewWallet(ctx context.Context, typ string) (string, error) {
resp, err := w.client.NewAddress(ctx, &rpc.NewAddressRequest{Type: typ})
if err != nil {
return "", err
return "", fmt.Errorf("calling NewAddress: %v", err)
}
return resp.GetAddress(), nil
}

// List returns all wallet addresses.
func (w *Wallet) List(ctx context.Context) ([]string, error) {
resp, err := w.client.List(ctx, &rpc.ListRequest{})
if err != nil {
return nil, fmt.Errorf("calling List: %v", err)
}
return resp.Addresses, nil
}

// WalletBalance gets a filecoin wallet's balance.
func (w *Wallet) WalletBalance(ctx context.Context, address string) (uint64, error) {
resp, err := w.client.WalletBalance(ctx, &rpc.WalletBalanceRequest{Address: address})
if err != nil {
return 0, err
return 0, fmt.Errorf("calling WalletBalance: %v", err)
}
return resp.GetBalance(), nil
}
15 changes: 15 additions & 0 deletions api/client/wallet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,21 @@ func TestNewWallet(t *testing.T) {
}
}

func TestList(t *testing.T) {
skipIfShort(t)
w, done := setupWallet(t)
defer done()

var err error
addresses, err := w.List(ctx)
if err != nil {
t.Fatalf("failed to list addresses: %v", err)
}
if len(addresses) < 1 {
t.Fatal("received empty addresses list")
}
}

func TestWalletBalance(t *testing.T) {
skipIfShort(t)
w, done := setupWallet(t)
Expand Down
2 changes: 0 additions & 2 deletions cli-docs/pow/pow.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ A client for storage and retreival of powergate data
### Options

```
--config string config file (default is $HOME/.powergate.yaml)
-h, --help help for pow
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```
Expand All @@ -22,7 +21,6 @@ A client for storage and retreival of powergate data
* [pow faults](pow_faults.md) - Provides commands to view faults data
* [pow ffs](pow_ffs.md) - Provides commands to manage ffs
* [pow health](pow_health.md) - Display the node health status
* [pow init](pow_init.md) - Initializes a config file with the provided values or defaults
* [pow miners](pow_miners.md) - Provides commands to view miners data
* [pow net](pow_net.md) - Provides commands related to peers and network
* [pow reputation](pow_reputation.md) - Provides commands to view miner reputation data
Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_asks.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Provides commands to view asks data
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_asks_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pow asks get [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_asks_query.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pow asks query [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_deal.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pow deal [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_deals.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Provides commands to manage storage deals
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_deals_all.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pow deals all [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_deals_final.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pow deals final [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_deals_pending.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pow deals pending [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_deals_retrieval.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pow deals retrieval [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_deals_retrieve.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pow deals retrieve [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_deals_store.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pow deals store [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_deals_watch.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow deals watch [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_faults.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Provides commands to view faults data
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_faults_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pow faults get [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Provides commands to manage ffs
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_addToHot.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs addToHot [path] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_addrs.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Provides commands to manage wallet addresses
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_addrs_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs addrs list [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_addrs_new.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pow ffs addrs new [name] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_cancel.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs cancel [jobid] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_close.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs close [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Provides commands to manage storage configuration
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_config_default.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs config default [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_config_prep.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs config prep [cid] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_config_set.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs config set [(optional)file] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pow ffs create [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs get [cid] [output file path] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_id.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs id [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_info.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs info [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_log.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pow ffs log [cid] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_paych.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Provides commands to manage payment channels
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_paych_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs paych create [from] [to] [amount] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_paych_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs paych list [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_paych_redeem.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs paych redeem [from] [to] [amount] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_pull.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs pull [cid] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_push.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ pow ffs push [cid] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_remove.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs remove [cid] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_replace.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ pow ffs replace [cid1] [cid2] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_send.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs send [from address] [to address] [amount] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
1 change: 0 additions & 1 deletion cli-docs/pow/pow_ffs_show.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pow ffs show [cid] [flags]
### Options inherited from parent commands

```
--config string config file (default is $HOME/.powergate.yaml)
--serverAddress string address of the powergate service api (default "/ip4/127.0.0.1/tcp/5002")
```

Expand Down
Loading

0 comments on commit c5596fa

Please sign in to comment.