Skip to content

Commit

Permalink
Access unexported fields by getter method
Browse files Browse the repository at this point in the history
Signed-off-by: omani <[email protected]>
  • Loading branch information
omani authored and yilunzhang committed Aug 2, 2023
1 parent ff43714 commit 8b07676
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@ func (c *Client) NewNanoPay(recipientAddress, fee string, duration int) (*NanoPa
// RPC client.
func (c *Client) NewNanoPayClaimer(recipientAddress string, claimIntervalMs, lingerMs int32, minFlushAmount string, onError *OnError) (*NanoPayClaimer, error) {
if len(recipientAddress) == 0 {
recipientAddress = c.wallet.address
recipientAddress = c.wallet.Address()
}
return NewNanoPayClaimer(c, recipientAddress, claimIntervalMs, lingerMs, minFlushAmount, onError)
}
Expand All @@ -1287,7 +1287,7 @@ func (c *Client) GetNonce(txPool bool) (int64, error) {
// connected node as the RPC server, followed by this client's SeedRPCServerAddr
// if failed.
func (c *Client) GetNonceContext(ctx context.Context, txPool bool) (int64, error) {
return c.GetNonceByAddressContext(ctx, c.wallet.address, txPool)
return c.GetNonceByAddressContext(ctx, c.wallet.Address(), txPool)
}

// GetNonceByAddress wraps GetNonceByAddressContext with background context.
Expand Down Expand Up @@ -1335,7 +1335,7 @@ func (c *Client) Balance() (*Amount, error) {
// connected node as the RPC server, followed by this client's SeedRPCServerAddr
// if failed.
func (c *Client) BalanceContext(ctx context.Context) (*Amount, error) {
return c.BalanceByAddressContext(ctx, c.wallet.address)
return c.BalanceByAddressContext(ctx, c.wallet.Address())
}

// BalanceByAddress wraps BalanceByAddressContext with background context.
Expand Down
6 changes: 3 additions & 3 deletions multiclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ func (m *MultiClient) NewNanoPay(recipientAddress, fee string, duration int) (*N
// as RPC client.
func (m *MultiClient) NewNanoPayClaimer(recipientAddress string, claimIntervalMs, lingerMs int32, minFlushAmount string, onError *OnError) (*NanoPayClaimer, error) {
if len(recipientAddress) == 0 {
recipientAddress = m.GetDefaultClient().wallet.address
recipientAddress = m.GetDefaultClient().wallet.Address()
}
return NewNanoPayClaimer(m, recipientAddress, claimIntervalMs, lingerMs, minFlushAmount, onError)
}
Expand All @@ -852,7 +852,7 @@ func (m *MultiClient) GetNonce(txPool bool) (int64, error) {
// connected node as the RPC server, followed by this multiclient's
// SeedRPCServerAddr if failed.
func (m *MultiClient) GetNonceContext(ctx context.Context, txPool bool) (int64, error) {
return m.GetNonceByAddressContext(ctx, m.GetDefaultClient().wallet.address, txPool)
return m.GetNonceByAddressContext(ctx, m.GetDefaultClient().wallet.Address(), txPool)
}

// GetNonceByAddress wraps GetNonceByAddressContext with background context.
Expand Down Expand Up @@ -904,7 +904,7 @@ func (m *MultiClient) Balance() (*Amount, error) {
// connected node as the RPC server, followed by this multiclient's
// SeedRPCServerAddr if failed.
func (m *MultiClient) BalanceContext(ctx context.Context) (*Amount, error) {
return m.BalanceByAddressContext(ctx, m.GetDefaultClient().wallet.address)
return m.BalanceByAddressContext(ctx, m.GetDefaultClient().wallet.Address())
}

// BalanceByAddress wraps BalanceByAddressContext with background context.
Expand Down
4 changes: 2 additions & 2 deletions wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (w *Wallet) GetNonce(txPool bool) (int64, error) {
// GetNonceContext is the same as package level GetNonceContext, but using this
// wallet's SeedRPCServerAddr.
func (w *Wallet) GetNonceContext(ctx context.Context, txPool bool) (int64, error) {
return w.GetNonceByAddressContext(ctx, w.address, txPool)
return w.GetNonceByAddressContext(ctx, w.Address(), txPool)
}

// GetNonceByAddress wraps GetNonceByAddressContext with background context.
Expand Down Expand Up @@ -284,7 +284,7 @@ func (w *Wallet) Balance() (*Amount, error) {
// BalanceContext is the same as package level GetBalanceContext, but using this
// wallet's SeedRPCServerAddr.
func (w *Wallet) BalanceContext(ctx context.Context) (*Amount, error) {
return w.BalanceByAddressContext(ctx, w.address)
return w.BalanceByAddressContext(ctx, w.Address())
}

// BalanceByAddress wraps BalanceByAddressContext with background context.
Expand Down

0 comments on commit 8b07676

Please sign in to comment.