mirror of
https://github.com/status-im/status-go.git
synced 2025-01-10 06:36:32 +00:00
4cc6028d59
This commit implements `personal_sign` RPC or web3 personal.sign methods. NB! Contains breaking API changes.
31 lines
847 B
Go
31 lines
847 B
Go
package shhext
|
|
|
|
import (
|
|
"github.com/ethereum/go-ethereum/common"
|
|
"github.com/status-im/status-go/geth/signal"
|
|
)
|
|
|
|
// EnvelopeSignal includes hash of the envelope.
|
|
type EnvelopeSignal struct {
|
|
Hash common.Hash `json:"hash"`
|
|
}
|
|
|
|
// EnvelopeSignalHandler sends signals when envelope is sent or expired.
|
|
type EnvelopeSignalHandler struct{}
|
|
|
|
// EnvelopeSent triggered when envelope delivered atleast to 1 peer.
|
|
func (h EnvelopeSignalHandler) EnvelopeSent(hash common.Hash) {
|
|
signal.Send(signal.Envelope{
|
|
Type: signal.EventEnvelopeSent,
|
|
Event: EnvelopeSignal{Hash: hash},
|
|
})
|
|
}
|
|
|
|
// EnvelopeExpired triggered when envelope is expired but wasn't delivered to any peer.
|
|
func (h EnvelopeSignalHandler) EnvelopeExpired(hash common.Hash) {
|
|
signal.Send(signal.Envelope{
|
|
Type: signal.EventEnvelopeExpired,
|
|
Event: EnvelopeSignal{Hash: hash},
|
|
})
|
|
}
|