chore!: wallet related signals alignment

A signal type `wallet` which had an event `type` set to `sing-transactions` is now a new signal
type `wallt.sing.transactions` with event which represents list of transactions that need to be signed.
This commit is contained in:
Sale Djenic 2024-06-20 10:50:59 +02:00 committed by saledjenic
parent 6e52565356
commit 8bcb6ce667
3 changed files with 8 additions and 14 deletions

View File

@ -68,7 +68,7 @@ func (tm *TransactionManager) SendTransactionForSigningToKeycard(ctx context.Con
return err
}
signal.SendTransactionsForSigningEvent(hashes)
signal.SendWalletEvent(signal.SignTransactions, hashes)
return nil
}

View File

@ -48,7 +48,7 @@ func (tmr *SignalsTransmitter) Start() error {
return
case event := <-events:
if !event.Type.IsInternal() {
signal.SendWalletEvent(event)
signal.SendWalletEvent(signal.Wallet, event)
}
}
}

View File

@ -1,19 +1,13 @@
package signal
type SignalType string
const (
walletEvent = "wallet"
Wallet = SignalType("wallet")
SignTransactions = SignalType("wallet.sign.transactions")
)
type UnsignedTransactions struct {
Type string `json:"type"`
Transactions []string `json:"transactions"`
}
// SendWalletEvent sends event from services/wallet/events.
func SendWalletEvent(event interface{}) {
send(walletEvent, event)
}
func SendTransactionsForSigningEvent(transactions []string) {
send(walletEvent, UnsignedTransactions{Type: "sing-transactions", Transactions: transactions})
func SendWalletEvent(signalType SignalType, event interface{}) {
send(string(signalType), event)
}