AElf.Contract.SourceGenerator
0.0.3
dotnet add package AElf.Contract.SourceGenerator --version 0.0.3
NuGet\Install-Package AElf.Contract.SourceGenerator -Version 0.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AElf.Contract.SourceGenerator" Version="0.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AElf.Contract.SourceGenerator --version 0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AElf.Contract.SourceGenerator, 0.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install AElf.Contract.SourceGenerator as a Cake Addin #addin nuget:?package=AElf.Contract.SourceGenerator&version=0.0.3 // Install AElf.Contract.SourceGenerator as a Cake Tool #tool nuget:?package=AElf.Contract.SourceGenerator&version=0.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Usage
- Create a C# Class Library project.
- Reference package:
<ItemGroup>
<PackageReference Include="AElf.Contract.SourceGenerator" Version="0.0.2"
OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
- Rebuild your project.
- Create/Put your contract proto file to
Protobuf/Proto/contract
directory. - Clean and rebuild your project after you finished the contract proto file.
Demo of contract proto file
syntax = "proto3";
import "aelf/options.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/wrappers.proto";
// The namespace of this class
option csharp_namespace = "AElf.Contracts.HelloWorld";
service HelloWorld {
// The name of the state class the smart contract is going to use to access blockchain state
option (aelf.csharp_state) = "AElf.Contracts.HelloWorld.HelloWorldState";
rpc Initialize (google.protobuf.Empty) returns (google.protobuf.Empty) {
}
// Actions (methods that modify contract state)
// Stores the value in contract state
rpc Update (google.protobuf.StringValue) returns (google.protobuf.Empty) {
}
// Views (methods that don't modify contract state)
// Get the value stored from contract state
rpc Read (google.protobuf.Empty) returns (google.protobuf.StringValue) {
option (aelf.is_view) = true;
}
}
// An event that will be emitted from contract method call
message MessageUpdated {
option (aelf.is_event) = true;
string value = 1;
}
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
net6.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.