Documentation ¶
Index ¶
- Constants
- Variables
- func AddSession(db *sql.DB, networks []params.Network, session_json string) error
- func DeleteSession(db *sql.DB, topic Topic) error
- func DisconnectSession(db *sql.DB, topic Topic) error
- func SafeSignTypedDataForDApps(typedJson string, privateKey *ecdsa.PrivateKey, chainID uint64, legacy bool) (types.HexBytes, error)
- func SetupTestDB(t *testing.T) (db *sql.DB, close func())
- func UpsertSession(db *sql.DB, data DBSession) error
- type DBDApp
- type DBSession
- type JSONProxyType
- type Metadata
- type Namespace
- type PairSessionResponse
- type Params
- type Proposer
- type RequestParams
- type Scanner
- type Session
- type SessionDelete
- type SessionProposal
- type SessionRequest
- type Topic
- type Verified
- type VerifyContext
Constants ¶
const ( SupportedEip155Namespace = "eip155" ProposeUserPairEvent = walletevent.EventType("WalletConnectProposeUserPair") )
Variables ¶
var ( ErrorInvalidSessionProposal = errors.New("invalid session proposal") ErrorNamespaceNotSupported = errors.New("namespace not supported") ErrorChainsNotSupported = errors.New("chains not supported") ErrorInvalidParamsCount = errors.New("invalid params count") ErrorInvalidAddressMsgIndex = errors.New("invalid address and/or msg index (must be 0 or 1)") ErrorMethodNotSupported = errors.New("method not supported") )
Functions ¶
func AddSession ¶ added in v0.179.24
AddSession adds a new active session to the database
func SafeSignTypedDataForDApps ¶ added in v0.181.34
Types ¶
type DBDApp ¶ added in v0.179.24
type DBSession ¶ added in v0.179.24
type DBSession struct { Topic Topic `json:"topic"` Disconnected bool `json:"disconnected"` SessionJSON string `json:"sessionJson"` Expiry int64 `json:"expiry"` CreatedTimestamp int64 `json:"createdTimestamp"` PairingTopic Topic `json:"pairingTopic"` TestChains bool `json:"testChains"` DBDApp }
func GetActiveSessions ¶ added in v0.171.33
GetActiveSessions returns all active sessions (not disconnected and not expired) that have an expiry timestamp newer or equal to the given timestamp.
func GetSessionByTopic ¶ added in v0.171.33
GetSessionByTopic returns sql.ErrNoRows if no session is found.
func GetSessions ¶ added in v0.179.24
GetSessions returns all sessions in the ascending order of creation time
type JSONProxyType ¶
type JSONProxyType struct {
// contains filtered or unexported fields
}
JSONProxyType provides a generic way of changing the JSON value before unmarshalling it into the target. transform function is called before unmarshalling.
func (*JSONProxyType) UnmarshalJSON ¶
func (b *JSONProxyType) UnmarshalJSON(input []byte) error
type Namespace ¶
type PairSessionResponse ¶
type PairSessionResponse struct { SessionProposal SessionProposal `json:"sessionProposal"` SupportedNamespaces map[string]Namespace `json:"supportedNamespaces"` }
type Params ¶
type Params struct { ID int64 `json:"id"` PairingTopic Topic `json:"pairingTopic"` Expiry int64 `json:"expiry"` RequiredNamespaces map[string]Namespace `json:"requiredNamespaces"` OptionalNamespaces map[string]Namespace `json:"optionalNamespaces"` Proposer Proposer `json:"proposer"` Verify VerifyContext `json:"verifyContext"` }
Params has RequiredNamespaces entries if part of "proposal namespace" and Namespaces entries if part of "session namespace" see https://specs.walletconnect.com/2.0/specs/clients/sign/namespaces#controller-side-validation-of-incoming-proposal-namespaces-wallet
func (*Params) ValidateForProposal ¶ added in v0.179.24
ValidateForProposal validates params part of the Proposal Namespace
type RequestParams ¶
type RequestParams struct { Request struct { Method string `json:"method"` Params []json.RawMessage `json:"params"` } `json:"request"` ChainID string `json:"chainId"` }
type Session ¶ added in v0.171.33
type Session struct { Acknowledged bool `json:"acknowledged"` Controller string `json:"controller"` Expiry int64 `json:"expiry"` Namespaces map[string]Namespace `json:"namespaces"` OptionalNamespaces map[string]Namespace `json:"optionalNamespaces"` PairingTopic Topic `json:"pairingTopic"` Peer Proposer `json:"peer"` Relay json.RawMessage `json:"relay"` RequiredNamespaces map[string]Namespace `json:"requiredNamespaces"` Self Proposer `json:"self"` Topic Topic `json:"topic"` }
type SessionDelete ¶
type SessionProposal ¶
func (*SessionProposal) ValidateProposal ¶ added in v0.179.24
func (p *SessionProposal) ValidateProposal() bool
ValidateProposal validates params part of the Proposal Namespace https://specs.walletconnect.com/2.0/specs/clients/sign/namespaces#controller-side-validation-of-incoming-proposal-namespaces-wallet
type SessionRequest ¶
type SessionRequest struct { ID int64 `json:"id"` Topic Topic `json:"topic"` Params RequestParams `json:"params"` Verify VerifyContext `json:"verifyContext"` }
type VerifyContext ¶
type VerifyContext struct {
Verified Verified `json:"verified"`
}