diff --git a/types.go b/types.go index 93591dc..74d0dfe 100644 --- a/types.go +++ b/types.go @@ -1,51 +1,46 @@ package types -// Types module -// Can be used for an import -// TODO someday it could be migrated onto generated types - +// Нормализовано под ER: без старых полей и алиасов. type CommiterTxBody struct { - Type string `json:"type"` - ID string `json:"id"` + Type string `json:"type"` // "commiter" + ID string `json:"id"` // "commiter:" Name string `json:"name"` - CommiterPubKey string `json:"commiter_pubkey"` + CommiterPubKey string `json:"commiter_pubkey"` // base64 } type BeneficiaryTxBody struct { - Type string `json:"type"` - ID string `json:"id"` + Type string `json:"type"` // "beneficiary" + ID string `json:"id"` // "beneficiary:" Name string `json:"name"` } type PromiseTxBody struct { - Type string `json:"type"` - ID string `json:"id"` - Description string `json:"description"` - Timestamp int64 `json:"timestamp,omitempty"` // ← чтобы понимать клиент - Title string `json:"title,omitempty"` // ← опционально, если когда-нибудь пригодится - Deadline string `json:"deadline,omitempty"` + Type string `json:"type"` // "promise" + ID string `json:"id"` // "promise:" + Text string `json:"text"` // обяз. + Due int64 `json:"due"` // unix seconds, обяз. + BeneficiaryID string `json:"beneficiary_id"` // "beneficiary:", обяз. + ParentPromiseID *string `json:"parent_promise_id"` // "promise:", опц. } type CommitmentTxBody struct { - Type string `json:"type"` - ID string `json:"id"` - PromiseID string `json:"promise_id"` - CommiterID string `json:"commiter_id"` - CommiterSig string `json:"commiter_sig,omitempty"` + Type string `json:"type"` // "commitment" + ID string `json:"id"` // "commitment:" + PromiseID string `json:"promise_id"` // "promise:" + CommiterID string `json:"commiter_id"` // "commiter:" + Due int64 `json:"due"` // unix seconds, обяз. } type CompoundTx struct { Body struct { - Promise *PromiseTxBody `json:"promise"` - Commitment *CommitmentTxBody `json:"commitment"` + Promise *PromiseTxBody `json:"promise"` // обяз. + Commitment *CommitmentTxBody `json:"commitment"` // обяз. } `json:"body"` - Signature string `json:"signature"` + Signature string `json:"signature"` // base64(ed25519(body_json)) } type SignedTx struct { - Body any `json:"body"` // TODO someday it should become less abstract - Signature string `json:"signature"` + Body any `json:"body"` + Signature string `json:"signature"` // base64 } - -