INNER CODE UNIT · Go

fromJSON

wavesplatform/gowaves · cmd/convert/main.go:92

func fromJSON(data []byte, cfg config) (proto.Transaction, error) {
	tt := proto.TransactionTypeVersion{}
	if err := json.Unmarshal(data, &tt); err != nil {
		return nil, fmt.Errorf("failed read transaction from JSON: %w", err)
	}
	tx, err := proto.GuessTransactionType(&tt)
	if err != nil {
		return nil, fmt.Errorf("failed read transaction from JSON: %w", err)
	}
	if umErr := proto.UnmarshalTransactionFromJSON(data, cfg.scheme, tx); umErr != nil {
		return nil, fmt.Errorf("failed read transaction from JSON: %w", umErr)
	}
	return tx, nil
}

func toJSON(tx proto.Transaction, cfg config) error {
	js, err := json.Marshal(tx)
	if err != nil {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…