github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/rpc/web3/ethclient/transact_client_test.go (about)

     1  // +build ethereum,integration
     2  
     3  package ethclient
     4  
     5  import (
     6  	"context"
     7  	"fmt"
     8  	"testing"
     9  
    10  	"github.com/hyperledger/burrow/execution/solidity"
    11  	"github.com/hyperledger/burrow/tests/web3/web3test"
    12  	"github.com/hyperledger/burrow/txs/payload"
    13  	"github.com/stretchr/testify/require"
    14  )
    15  
    16  func TestEthTransactClient_CallTxSync(t *testing.T) {
    17  	pk := web3test.GetPrivateKey(t)
    18  	cli := NewTransactClient(NewEthClient(web3test.GetChainRPCClient())).WithAccounts(pk)
    19  	input := pk.GetAddress()
    20  	gasPrice, err := cli.GetGasPrice()
    21  	require.NoError(t, err)
    22  	nonce, err := cli.GetTransactionCount(input)
    23  	require.NoError(t, err)
    24  	txe, err := cli.CallTxSync(context.Background(), &payload.CallTx{
    25  		Input: &payload.TxInput{
    26  			Address:  input,
    27  			Sequence: nonce,
    28  		},
    29  		GasPrice: gasPrice,
    30  		GasLimit: BasicGasLimit * 10,
    31  		Data:     solidity.Bytecode_EventEmitter,
    32  	})
    33  	require.NoError(t, err)
    34  	fmt.Println(txe)
    35  }