Skip to content

Commit

Permalink
fix(eibc): fix update-demand-order CLI (#992)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtsitrin committed Jul 15, 2024
1 parent 90104b6 commit e538ff7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions x/eibc/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func GetTxCmd() *cobra.Command {

func NewFulfillOrderTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "fulfill-order [order-id]",
Use: "fulfill-order [order-id] [expected-fee-amount]",
Short: "Fulfill a new eibc order",
Example: "dymd tx eibc fulfill-order <order-id> <expected-fee-amount>",
Long: `Fulfill a new eibc order by providing the order ID and the expected fee amount.
Expand Down Expand Up @@ -67,7 +67,7 @@ func NewFulfillOrderTxCmd() *cobra.Command {

func NewUpdateDemandOrderTxCmd() *cobra.Command {
cmd := &cobra.Command{
Use: "update-demand-order [order-id]",
Use: "update-demand-order [order-id] [new-fee-amount]",
Short: "Update a demand order",
Example: "dymd tx eibc update-demand-order <order-id> <new-fee-amount>",
Args: cobra.ExactArgs(2),
Expand Down
4 changes: 2 additions & 2 deletions x/eibc/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ func (suite *KeeperTestSuite) TestMsgUpdateDemandOrder() {
suite.Require().NoError(err)

// try to update the demand order
msg := types.NewMsgUpdateDemandOrder(demandOrder.Id, tc.submittedBy, tc.newFee.String())
msg := types.NewMsgUpdateDemandOrder(tc.submittedBy, demandOrder.Id, tc.newFee.String())
_, err = suite.msgServer.UpdateDemandOrder(suite.Ctx, msg)
if tc.expectError {
suite.Require().Error(err, tc.name)
Expand Down Expand Up @@ -304,7 +304,7 @@ func (suite *KeeperTestSuite) TestUpdateDemandOrderOnAckOrTimeout() {
// try to update the demand order
newFee := sdk.NewInt(400)
expectedNewPrice := sdk.NewInt(600)
msg := types.NewMsgUpdateDemandOrder(demandOrder.Id, eibcSupplyAddr.String(), newFee.String())
msg := types.NewMsgUpdateDemandOrder(eibcSupplyAddr.String(), demandOrder.Id, newFee.String())
_, err = suite.msgServer.UpdateDemandOrder(suite.Ctx, msg)
suite.Require().NoError(err)
// check if the demand order is updated
Expand Down
4 changes: 2 additions & 2 deletions x/eibc/types/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (m *MsgFulfillOrder) GetFulfillerBech32Address() []byte {
return sdk.MustAccAddressFromBech32(m.FulfillerAddress)
}

func NewMsgUpdateDemandOrder(orderId, ownerAddr, newFee string) *MsgUpdateDemandOrder {
func NewMsgUpdateDemandOrder(ownerAddr, orderId, newFee string) *MsgUpdateDemandOrder {
return &MsgUpdateDemandOrder{
OrderId: orderId,
OwnerAddress: ownerAddr,
Expand Down Expand Up @@ -97,7 +97,7 @@ func isValidOrderId(orderId string) bool {

func validateCommon(orderId, address, fee string) error {
if !isValidOrderId(orderId) {
return ErrInvalidOrderID
return fmt.Errorf("%w: %s", ErrInvalidOrderID, orderId)
}
_, err := sdk.AccAddressFromBech32(address)
if err != nil {
Expand Down

0 comments on commit e538ff7

Please sign in to comment.