From 6c22e09a68716a3424c276282507e92538d5567a Mon Sep 17 00:00:00 2001
From: Christopher Schuchardt <8141309+cschuchardt88@users.noreply.github.com>
Date: Thu, 23 Jul 2026 10:06:42 -0400
Subject: [PATCH] Rewrite README and add XML docs for public APIs.
Align the project README with Rapid Loop positioning and Neo protocol
compatibility. Document public types and members across src/ so NuGet
XML docs and IntelliSense cover the modular platform packages.
(cherry picked from commit 76718f35405dc61ede162d302718e2d3fa5746e9)
---
README.md | 114 +++---
.../BlockchainBackupOptions.cs | 10 +
.../BlockchainStoreOptions.cs | 10 +
.../Converters/JsonIPEndPointConverter.cs | 20 +
.../Converters/JsonStringAddressConverter.cs | 18 +
.../JsonStringByteArrayConverter.cs | 17 +
.../Converters/JsonStringECPointConverter.cs | 19 +
.../JsonStringHexFormatConverter.cs | 17 +
.../Converters/JsonStringUInt160Converter.cs | 19 +
src/Neo.Configuration/Json/JsonDefaults.cs | 7 +
src/Neo.Configuration/Json/JsonModel.cs | 29 ++
.../ProtocolSettingsOptions.cs | 41 +++
src/Neo.Core/Blockchain/Block.cs | 35 ++
src/Neo.Core/Blockchain/BlockHeader.cs | 32 ++
.../Blockchain/Interface/IInventory.cs | 6 +
.../Blockchain/Interface/IVerifiable.cs | 3 +
src/Neo.Core/Blockchain/Signer.cs | 31 ++
src/Neo.Core/Blockchain/Transaction.cs | 44 +++
.../Blockchain/TransactionAttribute.cs | 15 +
.../Blockchain/TransactionAttributeType.cs | 3 +
src/Neo.Core/Blockchain/Witness.cs | 24 ++
src/Neo.Core/Blockchain/WitnessCondition.cs | 15 +
src/Neo.Core/Blockchain/WitnessContract.cs | 7 +
src/Neo.Core/Blockchain/WitnessRule.cs | 28 ++
src/Neo.Core/CoreUtilities.cs | 54 +++
src/Neo.Core/Cryptography/ECC/ECCurve.cs | 18 +
src/Neo.Core/Cryptography/ECC/ECCurveName.cs | 6 +
src/Neo.Core/Cryptography/ECC/ECPoint.cs | 114 ++++++
src/Neo.Core/Cryptography/MerkleTree.cs | 8 +
src/Neo.Core/Cryptography/ProtectedString.cs | 64 ++++
src/Neo.Core/Cryptography/RipeMD160.cs | 11 +
src/Neo.Core/Cryptography/SCrypt.cs | 36 +-
.../Extensions/BigIntegerExtensions.cs | 17 +-
src/Neo.Core/Extensions/ByteExtensions.cs | 44 +++
.../Extensions/DictionaryExtensions.cs | 28 ++
.../Extensions/EnumerableExtensions.cs | 10 +
.../Extensions/INeoSerializableExtensions.cs | 8 +
src/Neo.Core/Extensions/IntegerExtensions.cs | 9 +
src/Neo.Core/Extensions/ListExtensions.cs | 17 +
src/Neo.Core/Extensions/MemoryExtensions.cs | 55 ++-
src/Neo.Core/Extensions/ObjectExtensions.cs | 9 +
src/Neo.Core/Extensions/SpanExtensions.cs | 58 ++-
src/Neo.Core/Extensions/StreamExtensions.cs | 114 ++++++
src/Neo.Core/Extensions/StringExtensions.cs | 18 +
src/Neo.Core/Extensions/TryCatchExtensions.cs | 73 ++++
src/Neo.Core/Extensions/TypeExtensions.cs | 11 +
src/Neo.Core/Extensions/UInt160Extensions.cs | 3 +
src/Neo.Core/Factory/RandomNumberFactory.cs | 162 ++++++++
src/Neo.Core/Interfaces/IMap.cs | 8 +
src/Neo.Core/Json/LowerCaseNamingPolicy.cs | 8 +
.../Message/ArchivalNodeCapabilityMessage.cs | 9 +
.../DisableCompressionCapabilityMessage.cs | 9 +
.../Net/Message/FullNodeCapabilityMessage.cs | 19 +
.../Net/Message/NodeCapabilityMessage.cs | 10 +
src/Neo.Core/Net/Message/PingMessage.cs | 31 ++
src/Neo.Core/Net/Message/ProtocolMessage.cs | 23 ++
.../Net/Message/ServerCapabilityMessage.cs | 19 +
src/Neo.Core/Net/Message/VersionMessage.cs | 52 +++
src/Neo.Core/Net/NodeCapabilityType.cs | 3 +
src/Neo.Core/Net/NodeConnection.cs | 30 ++
src/Neo.Core/Net/NodeHandshake.cs | 11 +
src/Neo.Core/Net/NodeServerListener.cs | 28 ++
src/Neo.Core/Net/ProtocolMessageFlags.cs | 3 +
src/Neo.Core/ProtocolSettings.cs | 8 +
.../Serialization/INeoSerializable.cs | 3 +
src/Neo.Core/Storage/IReadOnlyStore.cs | 27 ++
src/Neo.Core/Storage/IStore.cs | 24 ++
src/Neo.Core/Storage/IStoreBackup.cs | 17 +
src/Neo.Core/Storage/IStoreSnapshot.cs | 9 +
src/Neo.Core/Text/Base58.cs | 3 +
.../Types/Converter/ECPointTypeConverter.cs | 12 +
.../Types/Converter/IPAddressTypeConverter.cs | 18 +
.../Converter/IPEndPointTypeConverter.cs | 18 +
src/Neo.Core/UInt160.cs | 69 ++++
src/Neo.Core/UInt256.cs | 69 ++++
.../Attributes/MethodDescriptorAttribute.cs | 9 +
.../VM/Attributes/OpCodePriceAttribute.cs | 6 +
src/Neo.Core/VM/ExecutionEngineLimits.cs | 3 +
src/Neo.Core/VM/HardFork.cs | 34 ++
src/Neo.Core/VM/Interface/IVMComponent.cs | 10 +
src/Neo.Core/VM/MethodDescriptor.cs | 31 +-
src/Neo.Core/VM/OpCodeInst.cs | 59 +++
src/Neo.Core/VM/ScriptBuilder.cs | 53 +++
.../VM/SmartContract/MethodParameterType.cs | 3 +
src/Neo.Core/VM/Specs/GasTable.cs | 21 +-
src/Neo.IO/Data/BloomFIlter.cs | 45 +++
src/Neo.IO/Hashing/Murmur128.cs | 46 +++
src/Neo.IO/Hashing/Murmur32.cs | 46 +++
src/Neo.Localization/ResourceFactory.cs | 6 +
.../VM/VirtualMachineLocalizer.cs | 9 +
.../VM/VirtualMachineMessageNames.cs | 14 +
src/Neo.Platform.CLI/Commands/EmptyHandler.cs | 9 +
.../Commands/ProgramRootCommand.cs | 6 +
src/Neo.Platform.CLI/Commands/ShowCommand.cs | 16 +
.../BlockchainStoreNames.cs | 23 ++
.../Builder/PlatformCommandLineBuilder.cs | 42 +++
.../ConfigurationBuilderExtensions.cs | 12 +
.../NeoEnvironmentConfigurationSource.cs | 11 +
.../Factory/NeoHostingFactory.cs | 19 +
.../HostEnvironmentExtensions.cs | 27 ++
src/Neo.Platform.Hosting/HostingExtensions.cs | 37 +-
.../Logging/LoggingBuilderExtensions.cs | 14 +
.../Logging/NeoPlatformLogger.cs | 54 +++
.../Logging/NeoPlatformLoggerOptions.cs | 18 +
.../Logging/NeoPlatformLoggerProvider.cs | 15 +
.../Middleware/CommandLineMiddleware.cs | 5 +
.../NeoHostingEnvironments.cs | 15 +
.../NeoPlatformLifetime.cs | 31 ++
.../NeoPlatformLifetimeOptions.cs | 7 +
.../PlatformCommandLine.cs | 14 +
.../ProtocolSettingNames.cs | 49 +++
src/Neo.Platform.Storage/BlockchainStore.cs | 73 ++++
.../BlockchainStoreBackup.cs | 39 ++
.../BlockchainStoreSnapshot.cs | 70 ++++
src/Neo.Platform.Storage/ColumnFamilyNames.cs | 6 +
.../Extensions/StorageKeyBuilderExtensions.cs | 16 +
.../Logging/LoggingExtensions.cs | 33 ++
.../Logging/StoreEventId.cs | 12 +
src/Neo.Platform.Storage/StorageKeyBuilder.cs | 346 ++++++++++++++++++
src/Neo.Platform.Storage/StoreExtensions.cs | 32 ++
src/Neo.VM/Builder/VirtualMachineBuilder.cs | 47 +++
.../Builder/VirtualMachinePipelineBuilder.cs | 11 +
src/Neo.VM/Core/ExecutionContext.cs | 84 ++++-
src/Neo.VM/Core/StackFrame.cs | 104 +++++-
src/Neo.VM/Core/VirtualTable.cs | 30 ++
src/Neo.VM/Extensions/DictionaryExtensions.cs | 10 +
.../Extensions/ExecutionContextExtensions.cs | 11 +-
src/Neo.VM/Extensions/LoggerExtensions.cs | 18 +
src/Neo.VM/Extensions/ObjectExtensions.cs | 11 +
.../Extensions/ServiceCollectionExtensions.cs | 32 ++
src/Neo.VM/Logging/VirtualMachineEventId.cs | 24 ++
src/Neo.VM/Middleware/DebuggerMiddleware.cs | 30 ++
.../Middleware/ExecuteLoggerMiddleware.cs | 9 +
src/Neo.VM/Middleware/IEngineMiddleware.cs | 25 +-
src/Neo.VM/Types/VMArray.cs | 92 +++++
src/Neo.VM/Types/VMBoolean.cs | 17 +
src/Neo.VM/Types/VMBuffer.cs | 69 ++++
src/Neo.VM/Types/VMByteArray.cs | 43 +++
src/Neo.VM/Types/VMInteger.cs | 64 ++++
src/Neo.VM/Types/VMInteropInterface.cs | 46 +++
src/Neo.VM/Types/VMMap.cs | 111 ++++++
src/Neo.VM/Types/VMNull.cs | 25 ++
src/Neo.VM/Types/VMObject.cs | 76 +++-
src/Neo.VM/Types/VMPointer.cs | 44 +++
src/Neo.VM/Types/VMStruct.cs | 10 +
src/Neo.VM/VirtualMachineEngine.cs | 40 ++
src/Neo.Wallet/ChainWallet.cs | 45 +++
.../Cryptography/ScryptParameters.cs | 4 +
src/Neo.Wallet/DevWallet.cs | 43 +++
src/Neo.Wallet/DevWalletAccount.cs | 69 ++++
src/Neo.Wallet/IWallet.cs | 98 +++++
src/Neo.Wallet/IWalletAccount.cs | 49 +++
src/Neo.Wallet/Json/ContractModel.cs | 16 +
src/Neo.Wallet/Json/ContractParameterModel.cs | 13 +
src/Neo.Wallet/Json/DevWalletAccountModel.cs | 13 +
src/Neo.Wallet/Json/DevWalletModel.cs | 7 +
src/Neo.Wallet/Json/Nep6WalletAccountModel.cs | 6 +
src/Neo.Wallet/Json/Nep6WalletModel.cs | 7 +
src/Neo.Wallet/Json/SCryptModel.cs | 10 +
src/Neo.Wallet/Json/WalletAccountModel.cs | 25 ++
src/Neo.Wallet/Json/WalletModel.cs | 20 +
src/Neo.Wallet/Nep6Wallet.cs | 45 +++
src/Neo.Wallet/Nep6WalletAccount.cs | 82 +++++
163 files changed, 5024 insertions(+), 108 deletions(-)
diff --git a/README.md b/README.md
index 291bf3a..9293398 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# NEO Platform - C# Blockchain SDK
+# NEO Platform
[](https://github.com/Rapid-Loop/neo-platform/blob/master/LICENSE)
[](https://github.com/Rapid-Loop/neo-platform/stargazers)
@@ -7,105 +7,115 @@
[](https://github.com/Rapid-Loop/neo-platform/commits/master)
[](https://github.com/Rapid-Loop/neo-platform/actions/workflows/verify.yml)
-**Official Rapid Loop fork and enterprise-enhanced rebuild of the NEO Blockchain Smart Economy Platform.**
+**Modular Neo blockchain platform for C# / .NET** — maintained by [Rapid Loop](https://github.com/Rapid-Loop).
-A modern, high-performance C# library for building on the **Neo blockchain** — designed for developers and enterprises who need reliability, scalability, and seamless integration.
+A high-performance library set for building on **Neo**: core types, virtual machine, wallets, storage, and hosting integration. Aimed at developers and enterprises that need reliable packaging and a modern .NET experience.
+
+This repository is **compatible with Neo protocol semantics**. It is Rapid Loop’s platform packaging and engineering work — **not** an “official Neo Foundation” product unless separately stated by Neo.
+
+**Neo docs:** [developers.neo.org](https://developers.neo.org/) · **Neo site:** [neo.org](https://neo.org)
---
-## 🌟 About This Project
+## About
-**neo-platform** is Rapid Loop's actively maintained fork of the Neo blockchain C# ecosystem. We are rebuilding and enhancing the Neo platform with enterprise-grade improvements for:
+**neo-platform** is Rapid Loop’s actively developed Neo C# stack: modular packages, enterprise-friendly configuration and logging hooks, and a cleaner project layout for real systems.
-- Better performance and scalability
-- Modern developer experience
-- Seamless integration with existing business systems
-- Enhanced security and tooling
+Use it when you need:
-Whether you're building decentralized applications (dApps), smart contracts, wallets, or enterprise blockchain solutions, this SDK provides the core building blocks.
+- Core blockchain types and serialization
+- Neo VM execution
+- Wallet formats (e.g. NEP-6) and account management
+- RocksDB-backed blockchain storage
+- .NET Generic Host / CLI integration
-**Official Neo Website**: [neo.org](https://neo.org)
+Led by a [neo-project](https://github.com/neo-project) contributor with core Neo development experience. Rapid Loop commercial work (integration, review, support) is separate from open-source contribution — see [Rapid-Loop](https://github.com/Rapid-Loop).
---
-## ✨ Key Features
+## Packages
-- **Full Neo Compatibility** — Core blockchain, VM, cryptography, and wallet functionality
-- **Enterprise Ready** — Robust configuration, logging, and integration tools
-- **Modular Architecture** — Clean separation across packages:
- - `Neo.Core` — Core blockchain logic
- - `Neo.VM` — Virtual Machine
- - `Neo.Cryptography` — Secure cryptographic primitives
- - `Neo.Wallet` — Wallet management
- - And more...
-- **High Performance** — Optimized for real-world usage
-- **Comprehensive Testing** — Full test suite included
-- **NuGet Ready** — Easy package distribution
+| Project | Role |
+|---------|------|
+| `Neo.Core` | Protocol types, crypto, P2P messages, serialization, VM opcodes / limits |
+| `Neo.VM` | Execution engine, stack types, middleware pipeline |
+| `Neo.Wallet` | Wallet abstractions, NEP-6 / dev wallets |
+| `Neo.IO` | I/O helpers (hashing, bloom filter) |
+| `Neo.Configuration` | Options and JSON converters for protocol / store settings |
+| `Neo.Platform.Storage` | Blockchain store, snapshots, backups (RocksDB) |
+| `Neo.Platform.Hosting` | Hosting, configuration, logging, command-line wiring |
+| `Neo.Platform.CLI` | Sample / entry CLI host |
+| `Neo.Localization` | Localized VM messages |
---
-## 📁 Repository Structure
+## Repository layout
-```bash
+```text
neo-platform/
-├── src/ # Source code (multiple projects)
-│ ├── Neo.Core/
-│ ├── Neo.VM/
-│ ├── Neo.Cryptography/
-│ ├── Neo.Wallet/
-│ └── ...
-├── tests/ # Unit and integration tests
-├── pkgs/ # Package distribution
-├── .github/workflows/ # CI/CD pipelines
-├── .images/ # Logos and assets
-└── All.slnx # Solution file
+├── src/ # Library and host projects
+├── tests/ # Unit and integration tests
+├── pkgs/ # NuGet package output
+├── .github/workflows/ # CI
+├── .images/ # Package / branding assets
+└── All.slnx # Solution
```
---
-## 🚀 Quick Start
+## Quick start
+
+### Clone
-### 1. Clone the repository
```bash
git clone https://github.com/Rapid-Loop/neo-platform.git
cd neo-platform
```
-### 2. Build the solution
+### Build
+
```bash
dotnet build All.slnx
```
-### 3. Run tests
+### Test
+
```bash
-dotnet test
+dotnet test All.slnx
```
---
-## 🛠️ Tech Stack
+## Tech stack
-- **Language**: `C# (.NET)`
-- **Build System**: `dotnet`
-- **CI/CD**: `GitHub Actions`
+- **Language:** C# (.NET)
+- **Build:** `dotnet` / `All.slnx`
+- **CI:** GitHub Actions
---
-## 📖 Documentation
+## Documentation
-- [Neo Official Documentation](https://developers.neo.org/)
-- Check individual project folders for more details.
+- [Neo developer documentation](https://developers.neo.org/)
+- Public APIs use XML documentation comments (`///`) in source under `src/`
+- Contribution guide: [CONTRIBUTING.md](CONTRIBUTING.md)
---
-## 🤝 Contributing
+## Contributing
-We welcome contributions! See our [Contributing Guidelines](CONTRIBUTING.md) (create this file if needed).
+Contributions are welcome. See [CONTRIBUTING.md](CONTRIBUTING.md) and the [Code of Conduct](CODE_OF_CONDUCT.md).
---
-## 📜 License
+## License
-This project is licensed under the **BSD-2-Clause License** — see the [LICENSE](LICENSE) file for details.
+**BSD-2-Clause** — see [LICENSE](LICENSE).
---
+
+## Contact
+
+- **Org:** [github.com/Rapid-Loop](https://github.com/Rapid-Loop)
+- **Website:** [rapidloop.net](https://rapidloop.net)
+- **Email:** [github@rapidloop.net](mailto:github@rapidloop.net)
diff --git a/src/Neo.Configuration/BlockchainBackupOptions.cs b/src/Neo.Configuration/BlockchainBackupOptions.cs
index 06cd81d..effd294 100644
--- a/src/Neo.Configuration/BlockchainBackupOptions.cs
+++ b/src/Neo.Configuration/BlockchainBackupOptions.cs
@@ -26,10 +26,20 @@
namespace Neo.Configuration
{
+ ///
+ /// Configuration options for blockchain store backups.
+ ///
public class BlockchainBackupOptions : JsonModel
{
+ ///
+ /// The directory path where backup files are stored.
+ /// Defaults to data/backups under the application base directory.
+ ///
public string BackupPath { get; init; } = Path.Combine(AppContext.BaseDirectory, "data", "backups");
+ ///
+ /// The maximum number of backup files to retain. Defaults to 3.
+ ///
public int MaxBackups { get; init; } = 3;
}
}
diff --git a/src/Neo.Configuration/BlockchainStoreOptions.cs b/src/Neo.Configuration/BlockchainStoreOptions.cs
index adaaf5d..5954230 100644
--- a/src/Neo.Configuration/BlockchainStoreOptions.cs
+++ b/src/Neo.Configuration/BlockchainStoreOptions.cs
@@ -26,10 +26,20 @@
namespace Neo.Configuration
{
+ ///
+ /// Configuration options for the blockchain store database.
+ ///
public class BlockchainStoreOptions : JsonModel
{
+ ///
+ /// The directory path of the blockchain database.
+ /// Defaults to data/chain under the application base directory.
+ ///
public string DatabasePath { get; init; } = Path.Combine(AppContext.BaseDirectory, "data", "chain");
+ ///
+ /// Whether to create the database if it does not already exist. Defaults to .
+ ///
public bool CreateIfMissing { get; init; } = true;
}
}
diff --git a/src/Neo.Configuration/Json/Converters/JsonIPEndPointConverter.cs b/src/Neo.Configuration/Json/Converters/JsonIPEndPointConverter.cs
index 5a8658e..4a3213e 100644
--- a/src/Neo.Configuration/Json/Converters/JsonIPEndPointConverter.cs
+++ b/src/Neo.Configuration/Json/Converters/JsonIPEndPointConverter.cs
@@ -28,8 +28,22 @@
namespace Neo.Configuration.Json.Converters
{
+ ///
+ /// Converts values to and from JSON strings.
+ /// Supports IP address and hostname forms (for example, 127.0.0.1:20333).
+ ///
public class JsonIPEndPointConverter : JsonConverter
{
+ ///
+ /// Reads an from a JSON string token.
+ ///
+ /// The reader positioned at the JSON value.
+ /// The type to convert.
+ /// The serializer options.
+ ///
+ /// The parsed endpoint; when the string is empty or cannot be resolved, .
+ ///
+ /// Thrown when the token is not a JSON string.
public override IPEndPoint? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.String)
@@ -71,6 +85,12 @@ public class JsonIPEndPointConverter : JsonConverter
return default;
}
+ ///
+ /// Writes an as a JSON string, or JSON null when the value is .
+ ///
+ /// The writer to which the value is written.
+ /// The endpoint to write.
+ /// The serializer options.
public override void Write(Utf8JsonWriter writer, IPEndPoint? value, JsonSerializerOptions options)
{
if (value is null)
diff --git a/src/Neo.Configuration/Json/Converters/JsonStringAddressConverter.cs b/src/Neo.Configuration/Json/Converters/JsonStringAddressConverter.cs
index 5ac9861..5da5e09 100644
--- a/src/Neo.Configuration/Json/Converters/JsonStringAddressConverter.cs
+++ b/src/Neo.Configuration/Json/Converters/JsonStringAddressConverter.cs
@@ -28,8 +28,20 @@
namespace Neo.Configuration.Json.Converters
{
+ ///
+ /// Converts script hashes to and from NEO address JSON strings
+ /// using address version.
+ ///
public class JsonStringAddressConverter : JsonConverter
{
+ ///
+ /// Reads a from a NEO address string.
+ ///
+ /// The reader positioned at the JSON value.
+ /// The type to convert.
+ /// The serializer options.
+ /// The script hash, or when the string is empty.
+ /// Thrown when the token is not a JSON string.
public override UInt160? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.String)
@@ -44,6 +56,12 @@ public class JsonStringAddressConverter : JsonConverter
return valueString.ToScriptHash(ProtocolSettings.Default.AddressVersion);
}
+ ///
+ /// Writes a as a NEO address string, or JSON null when the value is .
+ ///
+ /// The writer to which the value is written.
+ /// The script hash to write.
+ /// The serializer options.
public override void Write(Utf8JsonWriter writer, UInt160? value, JsonSerializerOptions options)
{
// TODO: Remove `ProtocolSettings.Default` and get from active ProtocolSettings.
diff --git a/src/Neo.Configuration/Json/Converters/JsonStringByteArrayConverter.cs b/src/Neo.Configuration/Json/Converters/JsonStringByteArrayConverter.cs
index 1d1d3d9..62994ec 100644
--- a/src/Neo.Configuration/Json/Converters/JsonStringByteArrayConverter.cs
+++ b/src/Neo.Configuration/Json/Converters/JsonStringByteArrayConverter.cs
@@ -27,8 +27,19 @@
namespace Neo.Configuration.Json.Converters
{
+ ///
+ /// Converts values to and from UTF-8 encoded JSON strings.
+ ///
public class JsonStringByteArrayConverter : JsonConverter
{
+ ///
+ /// Reads a byte array from a UTF-8 JSON string.
+ ///
+ /// The reader positioned at the JSON value.
+ /// The type to convert.
+ /// The serializer options.
+ /// The UTF-8 bytes of the string, or when the string is empty.
+ /// Thrown when the token is not a JSON string.
public override byte[]? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.String)
@@ -42,6 +53,12 @@ public class JsonStringByteArrayConverter : JsonConverter
return Encoding.UTF8.GetBytes(valueString);
}
+ ///
+ /// Writes a byte array as a UTF-8 JSON string, or JSON null when the value is .
+ ///
+ /// The writer to which the value is written.
+ /// The bytes to write.
+ /// The serializer options.
public override void Write(Utf8JsonWriter writer, byte[]? value, JsonSerializerOptions options)
{
if (value is null)
diff --git a/src/Neo.Configuration/Json/Converters/JsonStringECPointConverter.cs b/src/Neo.Configuration/Json/Converters/JsonStringECPointConverter.cs
index 3cf8b9a..014d256 100644
--- a/src/Neo.Configuration/Json/Converters/JsonStringECPointConverter.cs
+++ b/src/Neo.Configuration/Json/Converters/JsonStringECPointConverter.cs
@@ -27,8 +27,21 @@
namespace Neo.Configuration.Json.Converters
{
+ ///
+ /// Converts values to and from hex-encoded JSON strings on the secp256r1 curve.
+ ///
public class JsonStringECPointConverter : JsonConverter
{
+ ///
+ /// Reads an from a hex-encoded JSON string.
+ ///
+ /// The reader positioned at the JSON value.
+ /// The type to convert.
+ /// The serializer options.
+ /// The parsed point, or when the string is empty.
+ ///
+ /// Thrown when the token is not a JSON string, or the string is not a valid secp256r1 point.
+ ///
public override ECPoint? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.String)
@@ -45,6 +58,12 @@ public class JsonStringECPointConverter : JsonConverter
return value;
}
+ ///
+ /// Writes an as a hex-encoded JSON string, or JSON null when the value is .
+ ///
+ /// The writer to which the value is written.
+ /// The point to write.
+ /// The serializer options.
public override void Write(Utf8JsonWriter writer, ECPoint? value, JsonSerializerOptions options)
{
if (value is null)
diff --git a/src/Neo.Configuration/Json/Converters/JsonStringHexFormatConverter.cs b/src/Neo.Configuration/Json/Converters/JsonStringHexFormatConverter.cs
index 477e1a4..027dacc 100644
--- a/src/Neo.Configuration/Json/Converters/JsonStringHexFormatConverter.cs
+++ b/src/Neo.Configuration/Json/Converters/JsonStringHexFormatConverter.cs
@@ -26,8 +26,19 @@
namespace Neo.Configuration.Json.Converters
{
+ ///
+ /// Converts values to and from lowercase hexadecimal JSON strings.
+ ///
public class JsonStringHexFormatConverter : JsonConverter
{
+ ///
+ /// Reads a byte array from a hexadecimal JSON string.
+ ///
+ /// The reader positioned at the JSON value.
+ /// The type to convert.
+ /// The serializer options.
+ /// The decoded bytes, or when the string is empty.
+ /// Thrown when the token is not a JSON string.
public override byte[]? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.String)
@@ -41,6 +52,12 @@ public class JsonStringHexFormatConverter : JsonConverter
return Convert.FromHexString(valueString);
}
+ ///
+ /// Writes a byte array as a lowercase hexadecimal JSON string, or JSON null when the value is .
+ ///
+ /// The writer to which the value is written.
+ /// The bytes to write.
+ /// The serializer options.
public override void Write(Utf8JsonWriter writer, byte[]? value, JsonSerializerOptions options)
{
if (value is null)
diff --git a/src/Neo.Configuration/Json/Converters/JsonStringUInt160Converter.cs b/src/Neo.Configuration/Json/Converters/JsonStringUInt160Converter.cs
index 150215f..991a92f 100644
--- a/src/Neo.Configuration/Json/Converters/JsonStringUInt160Converter.cs
+++ b/src/Neo.Configuration/Json/Converters/JsonStringUInt160Converter.cs
@@ -27,8 +27,21 @@
namespace Neo.Configuration.Json.Converters
{
+ ///
+ /// Converts values to and from hex-encoded JSON strings.
+ ///
public class JsonStringUInt160Converter : JsonConverter
{
+ ///
+ /// Reads a from a hex-encoded JSON string.
+ ///
+ /// The reader positioned at the JSON value.
+ /// The type to convert.
+ /// The serializer options.
+ /// The parsed script hash, or when the string is empty.
+ ///
+ /// Thrown when the token is not a JSON string, or the string is not a valid .
+ ///
public override UInt160? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType != JsonTokenType.String)
@@ -45,6 +58,12 @@ public class JsonStringUInt160Converter : JsonConverter
return scriptHash;
}
+ ///
+ /// Writes a as a hex-encoded JSON string, or JSON null when the value is .
+ ///
+ /// The writer to which the value is written.
+ /// The script hash to write.
+ /// The serializer options.
public override void Write(Utf8JsonWriter writer, UInt160? value, JsonSerializerOptions options)
{
if (value is null)
diff --git a/src/Neo.Configuration/Json/JsonDefaults.cs b/src/Neo.Configuration/Json/JsonDefaults.cs
index 6a34d92..504c068 100644
--- a/src/Neo.Configuration/Json/JsonDefaults.cs
+++ b/src/Neo.Configuration/Json/JsonDefaults.cs
@@ -27,8 +27,15 @@
namespace Neo.Configuration.Json
{
+ ///
+ /// Provides default used by configuration models.
+ ///
public static class JsonDefaults
{
+ ///
+ /// The default serializer options for Neo configuration JSON, including camel-case naming
+ /// and converters for enums, , , and .
+ ///
public static readonly JsonSerializerOptions SerializerOptions = new()
{
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
diff --git a/src/Neo.Configuration/Json/JsonModel.cs b/src/Neo.Configuration/Json/JsonModel.cs
index 2b499a7..4bcddec 100644
--- a/src/Neo.Configuration/Json/JsonModel.cs
+++ b/src/Neo.Configuration/Json/JsonModel.cs
@@ -27,23 +27,52 @@
namespace Neo.Configuration.Json
{
+ ///
+ /// Base type for configuration models that can be serialized to and deserialized from JSON.
+ ///
public abstract class JsonModel
{
protected JsonSerializerOptions _jsonSerializerOptions = JsonDefaults.SerializerOptions;
+ ///
+ /// Serializes this model to a JSON string using the specified options, or the instance defaults when omitted.
+ ///
+ /// Optional serializer options; when , instance defaults are used.
+ /// The JSON representation of this model.
[return: NotNull]
public virtual string? ToString(JsonSerializerOptions? options = default) =>
ToJson(options);
+ ///
+ /// Serializes this model to a JSON string.
+ ///
+ /// Optional serializer options; when , instance defaults are used.
+ /// The JSON representation of this model.
public virtual string ToJson(JsonSerializerOptions? options) =>
JsonSerializer.Serialize