-
Notifications
You must be signed in to change notification settings - Fork 13
/
types.go
77 lines (64 loc) · 2.16 KB
/
types.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
74
75
76
77
// DONTCOVER
// nolint
package v1_1_0
import (
sdk "github.com/cosmos/cosmos-sdk/types"
)
const (
ModuleName = "docs"
)
// v1.1.0 docs genesis state
type GenesisState struct {
UsersData []UserData `json:"users_data"`
SupportedMetadataSchemes []MetadataSchema `json:"supported_metadata_schemes"`
TrustedMetadataSchemaProposers []sdk.AccAddress `json:"trusted_metadata_schema_proposers"`
}
type UserData struct {
User sdk.AccAddress `json:"user"`
SentDocuments []Document `json:"sent_documents"`
ReceivedDocuments []Document `json:"received_documents"`
SentReceipts []DocumentReceipt `json:"sent_receipts"`
ReceivedReceipts []DocumentReceipt `json:"received_receipts"`
}
// -----------------
// --- Document
// -----------------
type Document struct {
UUID string `json:"uuid"`
Metadata DocumentMetadata `json:"metadata"`
ContentURI string `json:"content_uri"`
Checksum DocumentChecksum `json:"checksum"`
Sender sdk.AccAddress `json:"sender"`
Recipient sdk.AccAddress `json:"recipient"`
}
type DocumentMetadata struct {
ContentURI string `json:"content_uri"`
SchemaType string `json:"schema_type"` // Optional - Either this or schema must be defined
Schema *DocumentMetadataSchema `json:"schema"` // Optional - Either this or schema_type must be defined
}
type DocumentMetadataSchema struct {
URI string `json:"uri"`
Version string `json:"version"`
}
type DocumentChecksum struct {
Value string `json:"value"`
Algorithm string `json:"algorithm"`
}
// -----------------------
// --- Document receipt
// -----------------------
type DocumentReceipt struct {
Sender sdk.AccAddress `json:"sender"`
Recipient sdk.AccAddress `json:"recipient"`
TxHash string `json:"tx_hash"`
DocumentUUID string `json:"document_uuid"`
Proof string `json:"proof"`
}
// ------------------------
// --- Metadata schemes
// -------------------------
type MetadataSchema struct {
Type string `json:"type"`
SchemaURI string `json:"schema_uri"`
Version string `json:"version"`
}