MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / ToJSON

Method ToJSON

model/transaction.go:92–103  ·  view source on GitHub ↗

ToJSON serializes the transaction to JSON bytes.

()

Source from the content-addressed store, hash-verified

90
91// ToJSON serializes the transaction to JSON bytes.
92func (transaction *Transaction) ToJSON() ([]byte, error) {
93 _, span := tracer.Start(context.Background(), "ToJSON")
94 defer span.End()
95
96 data, err := json.Marshal(transaction)
97 if err != nil {
98 span.RecordError(err)
99 return nil, err
100 }
101 span.AddEvent("Transaction serialized to JSON")
102 return data, nil
103}
104
105// PrecisionBankersRound applies banker's rounding (round half to even) at the given precision scale factor.
106func PrecisionBankersRound(num float64, precision float64) float64 {

Callers 1

TestTransaction_ToJSONFunction · 0.95

Calls 1

StartMethod · 0.45

Tested by 1

TestTransaction_ToJSONFunction · 0.76