2024-05-23 16:22:57 +00:00
|
|
|
package transfer
|
|
|
|
|
|
|
|
import (
|
|
|
|
"math/big"
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
ethTypes "github.com/ethereum/go-ethereum/core/types"
|
2024-06-06 20:08:25 +00:00
|
|
|
"github.com/status-im/status-go/services/wallet/router/pathprocessor"
|
2024-05-23 16:22:57 +00:00
|
|
|
)
|
|
|
|
|
2024-06-06 20:08:25 +00:00
|
|
|
func (tm *TransactionManager) buildTransactions(pathProcessors map[string]pathprocessor.PathProcessor) ([]string, error) {
|
2024-05-23 16:22:57 +00:00
|
|
|
tm.transactionsForKeycardSigning = make(map[common.Hash]*TransactionDescription)
|
|
|
|
var hashes []string
|
2024-06-06 20:08:25 +00:00
|
|
|
for _, bridgeTx := range tm.multipathTransactionsData {
|
|
|
|
builtTx, err := pathProcessors[bridgeTx.Name].BuildTransaction(bridgeTx)
|
2024-05-23 16:22:57 +00:00
|
|
|
if err != nil {
|
|
|
|
return hashes, err
|
|
|
|
}
|
|
|
|
|
|
|
|
signer := ethTypes.NewLondonSigner(big.NewInt(int64(bridgeTx.ChainID)))
|
|
|
|
txHash := signer.Hash(builtTx)
|
|
|
|
|
|
|
|
tm.transactionsForKeycardSigning[txHash] = &TransactionDescription{
|
|
|
|
from: common.Address(bridgeTx.From()),
|
|
|
|
chainID: bridgeTx.ChainID,
|
|
|
|
builtTx: builtTx,
|
|
|
|
}
|
|
|
|
|
|
|
|
hashes = append(hashes, txHash.String())
|
|
|
|
}
|
|
|
|
|
|
|
|
return hashes, nil
|
|
|
|
}
|