chore(wallet) remove unused multi-transaction-update event

A leftover after migrating to incremental activity updates session-based
We now use pending instead of `multi-transaction-update`, there is no
multi-transaction update without an equivalent pending or transfer update
This commit is contained in:
Stefan 2024-03-25 21:05:06 +02:00 committed by Stefan Dunca
parent 98c3be55b9
commit 48af7a6f49
2 changed files with 4 additions and 43 deletions

View File

@ -17,15 +17,9 @@ import (
"github.com/status-im/status-go/params" "github.com/status-im/status-go/params"
"github.com/status-im/status-go/services/wallet/bridge" "github.com/status-im/status-go/services/wallet/bridge"
wallet_common "github.com/status-im/status-go/services/wallet/common" wallet_common "github.com/status-im/status-go/services/wallet/common"
"github.com/status-im/status-go/services/wallet/walletevent"
"github.com/status-im/status-go/transactions" "github.com/status-im/status-go/transactions"
) )
const (
// EventMTTransactionUpdate is emitted when a multi-transaction is updated (added or deleted)
EventMTTransactionUpdate walletevent.EventType = "multi-transaction-update"
)
type SignatureDetails struct { type SignatureDetails struct {
R string `json:"r"` R string `json:"r"`
S string `json:"s"` S string `json:"s"`

View File

@ -14,14 +14,12 @@ import (
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
"github.com/status-im/status-go/account" "github.com/status-im/status-go/account"
"github.com/status-im/status-go/eth-node/crypto" "github.com/status-im/status-go/eth-node/crypto"
"github.com/status-im/status-go/eth-node/types" "github.com/status-im/status-go/eth-node/types"
"github.com/status-im/status-go/services/wallet/bridge" "github.com/status-im/status-go/services/wallet/bridge"
wallet_common "github.com/status-im/status-go/services/wallet/common" wallet_common "github.com/status-im/status-go/services/wallet/common"
"github.com/status-im/status-go/services/wallet/walletevent"
"github.com/status-im/status-go/signal" "github.com/status-im/status-go/signal"
"github.com/status-im/status-go/transactions" "github.com/status-im/status-go/transactions"
) )
@ -124,34 +122,7 @@ func insertMultiTransaction(db *sql.DB, multiTransaction *MultiTransaction) (wal
} }
func (tm *TransactionManager) InsertMultiTransaction(multiTransaction *MultiTransaction) (wallet_common.MultiTransactionIDType, error) { func (tm *TransactionManager) InsertMultiTransaction(multiTransaction *MultiTransaction) (wallet_common.MultiTransactionIDType, error) {
return tm.insertMultiTransactionAndNotify(tm.db, multiTransaction, nil) return insertMultiTransaction(tm.db, multiTransaction)
}
func (tm *TransactionManager) insertMultiTransactionAndNotify(db *sql.DB, multiTransaction *MultiTransaction, chainIDs []uint64) (wallet_common.MultiTransactionIDType, error) {
id, err := insertMultiTransaction(db, multiTransaction)
if err != nil {
publishMultiTransactionUpdatedEvent(db, multiTransaction, tm.eventFeed, chainIDs)
}
return id, err
}
// publishMultiTransactionUpdatedEvent notify listeners of new multi transaction (used in activity history)
func publishMultiTransactionUpdatedEvent(db *sql.DB, multiTransaction *MultiTransaction, eventFeed *event.Feed, chainIDs []uint64) {
publishFn := func(chainID uint64) {
eventFeed.Send(walletevent.Event{
Type: EventMTTransactionUpdate,
ChainID: chainID,
Accounts: []common.Address{multiTransaction.FromAddress, multiTransaction.ToAddress},
At: int64(multiTransaction.Timestamp),
})
}
if len(chainIDs) > 0 {
for _, chainID := range chainIDs {
publishFn(chainID)
}
} else {
publishFn(0)
}
} }
func updateMultiTransaction(db *sql.DB, multiTransaction *MultiTransaction) error { func updateMultiTransaction(db *sql.DB, multiTransaction *MultiTransaction) error {
@ -198,14 +169,10 @@ func (tm *TransactionManager) CreateMultiTransactionFromCommand(ctx context.Cont
multiTransaction := multiTransactionFromCommand(command) multiTransaction := multiTransactionFromCommand(command)
chainIDs := make([]uint64, 0, len(data)) if multiTransaction.Type == MultiTransactionSend && multiTransaction.FromNetworkID == 0 && len(data) == 1 {
for _, tx := range data { multiTransaction.FromNetworkID = data[0].ChainID
chainIDs = append(chainIDs, tx.ChainID)
} }
if multiTransaction.Type == MultiTransactionSend && multiTransaction.FromNetworkID == 0 && len(chainIDs) == 1 { multiTransactionID, err := insertMultiTransaction(tm.db, multiTransaction)
multiTransaction.FromNetworkID = chainIDs[0]
}
multiTransactionID, err := tm.insertMultiTransactionAndNotify(tm.db, multiTransaction, chainIDs)
if err != nil { if err != nil {
return nil, err return nil, err
} }