github.com/status-im/status-go@v1.1.0/services/wallet/router/pathprocessor/common.go (about)

     1  package pathprocessor
     2  
     3  import (
     4  	"fmt"
     5  	"math/big"
     6  
     7  	ethTypes "github.com/ethereum/go-ethereum/core/types"
     8  
     9  	"github.com/ethereum/go-ethereum/accounts/abi/bind"
    10  	"github.com/ethereum/go-ethereum/common"
    11  	"github.com/status-im/status-go/account"
    12  	"github.com/status-im/status-go/eth-node/types"
    13  )
    14  
    15  func getSigner(chainID uint64, from types.Address, verifiedAccount *account.SelectedExtKey) bind.SignerFn {
    16  	return func(addr common.Address, tx *ethTypes.Transaction) (*ethTypes.Transaction, error) {
    17  		s := ethTypes.NewLondonSigner(new(big.Int).SetUint64(chainID))
    18  		return ethTypes.SignTx(tx, s, verifiedAccount.AccountKey.PrivateKey)
    19  	}
    20  }
    21  
    22  func makeKey(fromChain, toChain uint64, fromTokenSymbol, toTokenSymbol string) string {
    23  	if fromTokenSymbol != "" || toTokenSymbol != "" {
    24  		return fmt.Sprintf("%d-%d-%s-%s", fromChain, toChain, fromTokenSymbol, toTokenSymbol)
    25  	}
    26  	return fmt.Sprintf("%d-%d", fromChain, toChain)
    27  }