lbc_sdk/types.go

46 lines
1.7 KiB
Go
Raw Normal View History

2025-08-10 13:25:13 +03:00
package types
2025-08-10 15:38:44 +03:00
// Нормализовано под ER: без старых полей и алиасов.
2025-08-10 13:25:13 +03:00
type CommiterTxBody struct {
2025-08-10 15:38:44 +03:00
Type string `json:"type"` // "commiter"
ID string `json:"id"` // "commiter:<base64(pubkey)>"
2025-08-10 13:25:13 +03:00
Name string `json:"name"`
2025-08-10 15:38:44 +03:00
CommiterPubKey string `json:"commiter_pubkey"` // base64
2025-08-10 13:25:13 +03:00
}
2025-08-10 15:05:23 +03:00
type BeneficiaryTxBody struct {
2025-08-10 15:38:44 +03:00
Type string `json:"type"` // "beneficiary"
ID string `json:"id"` // "beneficiary:<uuid>"
2025-08-10 15:05:23 +03:00
Name string `json:"name"`
}
2025-08-10 13:25:13 +03:00
type PromiseTxBody struct {
2025-08-10 15:38:44 +03:00
Type string `json:"type"` // "promise"
ID string `json:"id"` // "promise:<uuid>"
Text string `json:"text"` // обяз.
Due int64 `json:"due"` // unix seconds, обяз.
BeneficiaryID string `json:"beneficiary_id"` // "beneficiary:<uuid>", обяз.
ParentPromiseID *string `json:"parent_promise_id"` // "promise:<uuid>", опц.
2025-08-10 13:25:13 +03:00
}
type CommitmentTxBody struct {
2025-08-10 15:38:44 +03:00
Type string `json:"type"` // "commitment"
ID string `json:"id"` // "commitment:<uuid>"
PromiseID string `json:"promise_id"` // "promise:<uuid>"
CommiterID string `json:"commiter_id"` // "commiter:<base64(pubkey)>"
Due int64 `json:"due"` // unix seconds, обяз.
2025-08-10 13:25:13 +03:00
}
type CompoundTx struct {
Body struct {
2025-08-10 15:38:44 +03:00
Promise *PromiseTxBody `json:"promise"` // обяз.
Commitment *CommitmentTxBody `json:"commitment"` // обяз.
2025-08-10 13:25:13 +03:00
} `json:"body"`
2025-08-10 15:38:44 +03:00
Signature string `json:"signature"` // base64(ed25519(body_json))
2025-08-10 13:25:13 +03:00
}
type SignedTx struct {
2025-08-10 15:38:44 +03:00
Body any `json:"body"`
Signature string `json:"signature"` // base64
2025-08-10 13:25:13 +03:00
}