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:
parent
6e52565356
commit
8bcb6ce667
|
@ -68,7 +68,7 @@ func (tm *TransactionManager) SendTransactionForSigningToKeycard(ctx context.Con
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
signal.SendTransactionsForSigningEvent(hashes)
|
signal.SendWalletEvent(signal.SignTransactions, hashes)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (tmr *SignalsTransmitter) Start() error {
|
||||||
return
|
return
|
||||||
case event := <-events:
|
case event := <-events:
|
||||||
if !event.Type.IsInternal() {
|
if !event.Type.IsInternal() {
|
||||||
signal.SendWalletEvent(event)
|
signal.SendWalletEvent(signal.Wallet, event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,19 +1,13 @@
|
||||||
package signal
|
package signal
|
||||||
|
|
||||||
|
type SignalType string
|
||||||
|
|
||||||
const (
|
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.
|
// SendWalletEvent sends event from services/wallet/events.
|
||||||
func SendWalletEvent(event interface{}) {
|
func SendWalletEvent(signalType SignalType, event interface{}) {
|
||||||
send(walletEvent, event)
|
send(string(signalType), event)
|
||||||
}
|
|
||||||
|
|
||||||
func SendTransactionsForSigningEvent(transactions []string) {
|
|
||||||
send(walletEvent, UnsignedTransactions{Type: "sing-transactions", Transactions: transactions})
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue