Skip to content

Commit

Permalink
fix: usage of default address and account in tx client
Browse files Browse the repository at this point in the history
  • Loading branch information
cmwaters committed Jun 19, 2024
1 parent 9c6322c commit 49876ff
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/user/tx_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,22 @@ func WithDefaultAddress(address sdktypes.AccAddress) Option {
panic(err)
}
c.defaultAccount = record.Name
c.defaultAddress = address
}
}

func WithDefaultAccount(name string) Option {
return func(c *TxClient) {
if _, err := c.signer.keys.Key(name); err != nil {
rec, err := c.signer.keys.Key(name)
if err != nil {
panic(err)
}
addr, err := rec.GetAddress()
if err != nil {
panic(err)
}
c.defaultAccount = name
c.defaultAddress = addr
}
}

Expand Down

0 comments on commit 49876ff

Please sign in to comment.