github.com/status-im/status-go@v1.1.0/protocol/messenger_walletconnect.go (about) 1 package protocol 2 3 import ( 4 "github.com/status-im/status-go/protocol/requests" 5 ) 6 7 type WalletConnectSession struct { 8 PeerID string `json:"peerId"` 9 DAppName string `json:"dappName"` 10 DAppURL string `json:"dappURL"` 11 Info string `json:"info"` 12 } 13 14 func (m *Messenger) getWalletConnectSession() ([]WalletConnectSession, error) { 15 return m.persistence.GetWalletConnectSession() 16 } 17 18 func (m *Messenger) AddWalletConnectSession(request *requests.AddWalletConnectSession) error { 19 if err := request.Validate(); err != nil { 20 return err 21 } 22 23 session := &WalletConnectSession{ 24 PeerID: request.PeerID, 25 DAppName: request.DAppName, 26 DAppURL: request.DAppURL, 27 Info: request.Info, 28 } 29 30 return m.persistence.InsertWalletConnectSession(session) 31 } 32 33 func (m *Messenger) GetWalletConnectSession() ([]WalletConnectSession, error) { 34 35 return m.getWalletConnectSession() 36 } 37 38 func (m *Messenger) DestroyWalletConnectSession(peerID string) error { 39 return m.persistence.DeleteWalletConnectSession(peerID) 40 }