From 3195c1faf3636418407054a8e8a3343949fec272 Mon Sep 17 00:00:00 2001 From: Danilo Pantani Date: Sun, 1 Dec 2024 23:50:52 -0300 Subject: [PATCH] fix api break --- ignite/pkg/chaincmd/chaincmd.go | 5 +++-- ignite/pkg/chaincmd/runner/chain.go | 2 +- ignite/pkg/cosmosfaucet/transfer.go | 7 +++---- integration/faucet/faucet_test.go | 3 +-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/ignite/pkg/chaincmd/chaincmd.go b/ignite/pkg/chaincmd/chaincmd.go index 5f7869d37b..b1eb6d0a9e 100644 --- a/ignite/pkg/chaincmd/chaincmd.go +++ b/ignite/pkg/chaincmd/chaincmd.go @@ -2,6 +2,7 @@ package chaincmd import ( "fmt" + "strings" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" @@ -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, } @@ -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, diff --git a/ignite/pkg/chaincmd/runner/chain.go b/ignite/pkg/chaincmd/runner/chain.go index f53461e34e..6d08564ec3 100644 --- a/ignite/pkg/chaincmd/runner/chain.go +++ b/ignite/pkg/chaincmd/runner/chain.go @@ -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...), diff --git a/ignite/pkg/cosmosfaucet/transfer.go b/ignite/pkg/cosmosfaucet/transfer.go index ac9d0c4eb6..d5145428a3 100644 --- a/ignite/pkg/cosmosfaucet/transfer.go +++ b/ignite/pkg/cosmosfaucet/transfer.go @@ -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) @@ -97,7 +96,7 @@ 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 @@ -105,7 +104,7 @@ func (f *Faucet) Transfer(ctx context.Context, toAccountAddress string, coins sd 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 } diff --git a/integration/faucet/faucet_test.go b/integration/faucet/faucet_test.go index b47ad1a8a5..33ec46d556 100644 --- a/integration/faucet/faucet_test.go +++ b/integration/faucet/faucet_test.go @@ -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) {