-
Notifications
You must be signed in to change notification settings - Fork 7
/
messages.go
73 lines (63 loc) · 1.93 KB
/
messages.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package tonconnect
import (
"encoding/json"
"github.com/kevinburke/nacl"
)
type bridgeMessage struct {
BrdigeURL string
From nacl.Key
Message walletMessage
}
type walletMessage struct {
ID json.Number `json:"id,omitempty"`
Event string `json:"event,omitempty"`
Type string `json:"type,omitempty"`
Result any `json:"result,omitempty"`
Payload payload `json:"payload,omitempty"`
Error *struct {
Code uint64 `json:"code"`
Message string `json:"message"`
} `json:"error,omitempty"`
}
type payload struct {
Code uint64 `json:"code,omitempty"`
Message string `json:"message,omitempty"`
Device deviceInfo `json:"device,omitempty"`
Items []connectItemReply `json:"items,omitempty"`
}
type deviceInfo struct {
Platform string `json:"platform"`
AppName string `json:"appName"`
AppVersion string `json:"appVersion"`
MaxProtocolVersion uint64 `json:"maxProtocolVersion"`
Features []any `json:"features"`
}
type feature struct {
Name string `json:"name"`
MaxMessages uint64 `json:"maxMessages,omitempty"`
}
type connectItemReply struct {
Name string `json:"name"`
Address string `json:"address,omitempty"`
Network int64 `json:"network,string,omitempty"`
PublicKey string `json:"publicKey,omitempty"`
WalletStateInit []byte `json:"walletStateInit,omitempty"`
Proof proof `json:"proof,omitempty"`
Error *struct {
Code uint64 `json:"code"`
Message string `json:"message"`
} `json:"error,omitempty"`
}
type proof struct {
Timestamp uint64 `json:"timestamp"`
Domain struct {
LengthBytes uint64 `json:"lengthBytes"`
Value string `json:"value"`
} `json:"domain"`
Signature []byte `json:"signature"`
Payload string `json:"payload"`
}
type signDataResult struct {
Signature []byte `json:"signature"`
Timestamp uint64 `json:"timestamp"`
}