Skip to content

Commit

Permalink
fix api break
Browse files Browse the repository at this point in the history
  • Loading branch information
Pantani committed Dec 2, 2024
1 parent 025d012 commit 3195c1f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
5 changes: 3 additions & 2 deletions ignite/pkg/chaincmd/chaincmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package chaincmd

import (
"fmt"
"strings"

"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -518,7 +519,7 @@ func BankSendWithFees(fee sdk.Coin) BankSendOption {
}

// BankSendCommand returns the command for transferring tokens.
func (c ChainCmd) BankSendCommand(fromAddress, toAddress string, amount []string, options ...BankSendOption) step.Option {
func (c ChainCmd) BankSendCommand(fromAddress, toAddress, amount string, options ...BankSendOption) step.Option {
command := []string{
commandTx,
}
Expand All @@ -529,7 +530,7 @@ func (c ChainCmd) BankSendCommand(fromAddress, toAddress string, amount []string
fromAddress,
toAddress,
)
command = append(command, amount...)
command = append(command, strings.Split(amount, ",")...)
command = append(command,
optionBroadcastMode, flags.BroadcastSync,
optionYes,
Expand Down
2 changes: 1 addition & 1 deletion ignite/pkg/chaincmd/runner/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (r Runner) Status(ctx context.Context) (NodeStatus, error) {
}

// BankSend sends amount from fromAccount to toAccount.
func (r Runner) BankSend(ctx context.Context, fromAccount, toAccount string, amount []string, options ...chaincmd.BankSendOption) (string, error) {
func (r Runner) BankSend(ctx context.Context, fromAccount, toAccount, amount string, options ...chaincmd.BankSendOption) (string, error) {
b := newBuffer()
opt := []step.Option{
r.chainCmd.BankSendCommand(fromAccount, toAccount, amount, options...),
Expand Down
7 changes: 3 additions & 4 deletions ignite/pkg/cosmosfaucet/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ func (f *Faucet) Transfer(ctx context.Context, toAccountAddress string, coins sd
transferMutex.Lock()
defer transferMutex.Unlock()

var coinsStr []string

transfer := sdk.NewCoins()
// check for each coin, the max transferred amount hasn't been reached
for _, c := range coins {
totalSent, err := f.TotalTransferredAmount(ctx, toAccountAddress, c.Denom)
Expand All @@ -97,15 +96,15 @@ func (f *Faucet) Transfer(ctx context.Context, toAccountAddress string, coins sd
}
}

coinsStr = append(coinsStr, c.String())
transfer = transfer.Add(c)
}

// perform transfer for all coins
fromAccount, err := f.runner.ShowAccount(ctx, f.accountName)
if err != nil {
return err
}
txHash, err := f.runner.BankSend(ctx, fromAccount.Address, toAccountAddress, coinsStr, chaincmd.BankSendWithFees(f.feeAmount))
txHash, err := f.runner.BankSend(ctx, fromAccount.Address, toAccountAddress, transfer.String(), chaincmd.BankSendWithFees(f.feeAmount))
if err != nil {
return err
}
Expand Down
3 changes: 1 addition & 2 deletions integration/faucet/faucet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ func TestRequestCoinsFromFaucet(t *testing.T) {
})
}
require.NoError(t, g.Wait())
time.Sleep(time.Second * 2)
checkAccountBalance(ctx, t, cosmosClient, addr, maxCoins)
checkAccountBalance(ctx, t, cosmosClient, addr, []string{"3stake", "30token"})
}

func checkAccountBalance(ctx context.Context, t *testing.T, c cosmosclient.Client, accAddr string, coins []string) {
Expand Down

0 comments on commit 3195c1f

Please sign in to comment.