Update types.go
This commit is contained in:
parent
08cda1e8a7
commit
a90b874431
1 changed files with 22 additions and 27 deletions
49
types.go
49
types.go
|
|
@ -1,51 +1,46 @@
|
||||||
package types
|
package types
|
||||||
|
|
||||||
// Types module
|
// Нормализовано под ER: без старых полей и алиасов.
|
||||||
// Can be used for an import
|
|
||||||
// TODO someday it could be migrated onto generated types
|
|
||||||
|
|
||||||
|
|
||||||
type CommiterTxBody struct {
|
type CommiterTxBody struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"` // "commiter"
|
||||||
ID string `json:"id"`
|
ID string `json:"id"` // "commiter:<base64(pubkey)>"
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
CommiterPubKey string `json:"commiter_pubkey"`
|
CommiterPubKey string `json:"commiter_pubkey"` // base64
|
||||||
}
|
}
|
||||||
|
|
||||||
type BeneficiaryTxBody struct {
|
type BeneficiaryTxBody struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"` // "beneficiary"
|
||||||
ID string `json:"id"`
|
ID string `json:"id"` // "beneficiary:<uuid>"
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PromiseTxBody struct {
|
type PromiseTxBody struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"` // "promise"
|
||||||
ID string `json:"id"`
|
ID string `json:"id"` // "promise:<uuid>"
|
||||||
Description string `json:"description"`
|
Text string `json:"text"` // обяз.
|
||||||
Timestamp int64 `json:"timestamp,omitempty"` // ← чтобы понимать клиент
|
Due int64 `json:"due"` // unix seconds, обяз.
|
||||||
Title string `json:"title,omitempty"` // ← опционально, если когда-нибудь пригодится
|
BeneficiaryID string `json:"beneficiary_id"` // "beneficiary:<uuid>", обяз.
|
||||||
Deadline string `json:"deadline,omitempty"`
|
ParentPromiseID *string `json:"parent_promise_id"` // "promise:<uuid>", опц.
|
||||||
}
|
}
|
||||||
|
|
||||||
type CommitmentTxBody struct {
|
type CommitmentTxBody struct {
|
||||||
Type string `json:"type"`
|
Type string `json:"type"` // "commitment"
|
||||||
ID string `json:"id"`
|
ID string `json:"id"` // "commitment:<uuid>"
|
||||||
PromiseID string `json:"promise_id"`
|
PromiseID string `json:"promise_id"` // "promise:<uuid>"
|
||||||
CommiterID string `json:"commiter_id"`
|
CommiterID string `json:"commiter_id"` // "commiter:<base64(pubkey)>"
|
||||||
CommiterSig string `json:"commiter_sig,omitempty"`
|
Due int64 `json:"due"` // unix seconds, обяз.
|
||||||
}
|
}
|
||||||
|
|
||||||
type CompoundTx struct {
|
type CompoundTx struct {
|
||||||
Body struct {
|
Body struct {
|
||||||
Promise *PromiseTxBody `json:"promise"`
|
Promise *PromiseTxBody `json:"promise"` // обяз.
|
||||||
Commitment *CommitmentTxBody `json:"commitment"`
|
Commitment *CommitmentTxBody `json:"commitment"` // обяз.
|
||||||
} `json:"body"`
|
} `json:"body"`
|
||||||
Signature string `json:"signature"`
|
Signature string `json:"signature"` // base64(ed25519(body_json))
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignedTx struct {
|
type SignedTx struct {
|
||||||
Body any `json:"body"` // TODO someday it should become less abstract
|
Body any `json:"body"`
|
||||||
Signature string `json:"signature"`
|
Signature string `json:"signature"` // base64
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue