Skip to content

Commit

Permalink
Remove AuthToken method
Browse files Browse the repository at this point in the history
The method is only used in the rpc client constructor
  • Loading branch information
kerzhner committed Sep 1, 2023
1 parent e4bf71c commit 8e23451
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ func NewRpcClient(trans transport.Requester) (RpcClientApi, error) {
c.routineTracker.Add(1)
go c.subscribeToNotifications(ctx, notificationChan)

c.authToken, err = c.AuthToken()
authToken, err := WaitForRequestNoAuth[serde.NoPayloadRequest, string](c, serde.GetAuthTokenMethod, serde.NoPayloadRequest{})
c.authToken = authToken

return c, err
}

Expand All @@ -148,14 +150,6 @@ func (rc *rpcClient) Address() (common.Address, error) {
return rc.nodeAddress, nil
}

// AuthToken fetches an authentication token from the nitro node
func (rc *rpcClient) AuthToken() (string, error) {
if rc.authToken == "" {
return WaitForRequestNoAuth[serde.NoPayloadRequest, string](rc, serde.GetAuthTokenMethod, serde.NoPayloadRequest{})
}
return rc.authToken, nil
}

// CreateVoucher creates a voucher for the given channelId and amount and returns it.
// It is the responsibility of the caller to send the voucher to the payee.
func (rc *rpcClient) CreateVoucher(chId types.Destination, amount uint64) (payments.Voucher, error) {
Expand Down

0 comments on commit 8e23451

Please sign in to comment.