diff --git a/docs/devtools/contract-sdk/aelf-core-csharp.md b/docs/devtools/contract-sdk/aelf-core-csharp.md new file mode 100644 index 0000000..ce6f46b --- /dev/null +++ b/docs/devtools/contract-sdk/aelf-core-csharp.md @@ -0,0 +1,295 @@ +# AElf.CSharp.Core + +## Builder `type` +**Namespace:** AElf.CSharp.Core.ServerServiceDefinition + +Builder class for ServerServiceDefinition. + +## ctor() `constructor` +Creates a new instance of builder. + +## AddMethod``2(method, handler) `method` +Adds a definition for a single request - single response method. + +### Returns: +This builder instance. + +### Parameters: +| Name | Type | Description | +|---------|-----------------------------|--------------------------| +| method | AElf.CSharp.Core.Method | The method. | +| handler | AElf.CSharp.Core.UnaryServerMethod | The method handler. | + +## Build() `method` +Creates an immutable ServerServiceDefinition from this builder. + +### Returns +The ServerServiceDefinition object. + +## EncodingHelper `type` +**Namespace:** AElf.CSharp.Core.Utils + +Helper class for serializing strings. + +## EncodeUtf8(str) `method` +Serializes a UTF-8 string to a byte array. + +### Returns +The serialized string. + +### Parameters +| Name | Type | Description | +|------|-------------------|-------------------| +| str | System.String | The string to encode. | + +### IMethod `type` +**Namespace:** AElf.CSharp.Core + +A non-generic representation of a remote method. + +## FullName `property` +Gets the fully qualified name of the method. On the server side, methods are dispatched based on this name. + +## Name `property` +Gets the unqualified name of the method. + +## ServiceName `property` +Gets the name of the service to which this method belongs. + +## Type `property` +Gets the type of the method. + +## Marshaller `type` +**Namespace:** AElf.CSharp.Core + +Encapsulates the logic for serializing and deserializing messages. + +## ctor(serializer, deserializer) `constructor` +Initializes a new marshaller from simple serialize/deserialize functions. + +### Parameters +| Name | Type | Description | +|-------------|---------------------------|---------------------------------------| +| serializer | System.Func | Function for serializing messages. | +| deserializer| System.Func | Function for deserializing messages. | + +## Deserializer `property` +Gets the deserializer function. + +## Serializer `property` +Gets the serializer function. + +## Marshallers `type` +**Namespace:** AElf.CSharp.Core + +Utilities for creating marshallers. + +## StringMarshaller `property` +Returns a marshaller for string type. Useful for testing. + +## Create() `method` +Creates a marshaller from specified serializer and deserializer. + + +## MethodType `type` +**Namespace:** AElf.CSharp.Core + +Constants for method types. + +## Action `constants` +Indicates the method modifies the contract state. + +## View `constants` +Indicates the method doesn't modify the contract state. + +## Method `type` +**Namespace:** AElf.CSharp.Core + +A description of a remote method. + +## ctor(type, serviceName, name, requestMarshaller, responseMarshaller) `constructor` +Initializes a new instance of the Method class. + +### Parameters +| Name | Type | Description | +|------------------|---------------------------|--------------------------------------| +| type | AElf.CSharp.Core.Method | Type of method. | +| serviceName | System.String | Name of service this method belongs to. | +| name | System.String | Unqualified name of the method. | +| requestMarshaller| AElf.CSharp.Core.Marshaller | Marshaller used for request messages. | +| responseMarshaller| AElf.CSharp.Core.Marshaller| Marshaller used for response messages.| + +## FullName `property` +Gets the fully qualified name of the method. On the server side, methods are dispatched based on this name. + +## Name `property` +Gets the unqualified name of the method. + +## RequestMarshaller `property` +Gets the marshaller used for request messages. + +## ResponseMarshaller `property` +Gets the marshaller used for response messages. + +## ServiceName `property` +Gets the name of the service to which this method belongs. + +## Type `property` +Gets the type of the method. + +## GetFullName() `method` +Gets the full name of the method including the service name. + +## Preconditions `type` +**Namespace:** AElf.CSharp.Core.Utils + +Utilities for checking preconditions. + +## CheckNotNull(reference) `method` +Throws ArgumentNullException if reference is null. + +### Parameters +| Name | Type | Description | +|------------|---------------|------------------| +| reference | Any | The reference. | + +## CheckNotNull(reference, paramName) `method` +Throws ArgumentNullException if reference is null. + +### Parameters +| Name | Type | Description | +|------------|---------------|------------------| +| reference | Any | The reference. | +| paramName | System.String | The parameter name. | + +## SafeMath `type` +**Namespace:** AElf.CSharp.Core + +Helper methods for safe math operations that explicitly check for overflow. + +## ServerServiceDefinition `type` +**Namespace:** AElf.CSharp.Core + +Stores mapping of methods to server call handlers. Normally, created by the BindService factory method. + +## BindService() `method` +Forwards all the previously stored AddMethod calls to the service binder. + +## CreateBuilder() `method` +Creates a new builder object for ServerServiceDefinition. + +### Returns +The builder object. + +## ServiceBinderBase `type` +**Namespace:** AElf.CSharp.Core + +Allows binding server-side method implementations in alternative serving stacks. + +## AddMethod(method, handler) `method` +Adds a definition for a single request - single response method. + +### Parameters +| Name | Type | Description | +|---------|-----------------------------|--------------------------| +| method | AElf.CSharp.Core.Method | The method. | +| handler | AElf.CSharp.Core.UnaryServerMethod | The method handler. | + +## TimestampExtensions `type` +**Namespace:** AElf.CSharp.Core.Extension + +Helper methods for dealing with protobuf timestamps. + +## AddDays(timestamp, days) `method` +Adds a given amount of days to a timestamp. Returns a new instance. + +### Returns +A new timestamp instance. + +### Parameters + | Name | Type | Description | + |-----------|------------------------------------|--------------------| + | timestamp | Google.Protobuf.WellKnownTypes.Timestamp | The timestamp. | + | days | System.Int64 | The amount of days.| + +## AddHours(timestamp, hours) `method` +Adds a given amount of hours to a timestamp. Returns a new instance. + +### Returns +A new timestamp instance. + +### Parameters + | Name | Type | Description | + |-----------|------------------------------------|---------------------| + | timestamp | Google.Protobuf.WellKnownTypes.Timestamp | The timestamp. | + | hours | System.Int64 | The amount of hours.| + +## AddMilliseconds(timestamp, milliseconds) `method` +Adds a given amount of milliseconds to a timestamp. Returns a new instance. + +### Returns +A new timestamp instance. + +### Parameters +| Name | Type | Description | +|----------------|------------------------------------|--------------------------| +| timestamp | Google.Protobuf.WellKnownTypes.Timestamp | The timestamp. | +| milliseconds | System.Int64 | The amount of milliseconds.| + +## AddMinutes(timestamp, minutes) `method` +Adds a given amount of minutes to a timestamp. Returns a new instance. + +### Returns +A new timestamp instance. + +### Parameters +| Name | Type | Description | +|-----------|------------------------------------|---------------------| +| timestamp | Google.Protobuf.WellKnownTypes.Timestamp | The timestamp. | +| minutes | System.Int64 | The amount of minutes.| + +## AddSeconds(timestamp, seconds) `method` +Adds a given amount of seconds to a timestamp. Returns a new instance. + +### Returns +A new timestamp instance. + +### Parameters +| Name | Type | Description | +|-----------|------------------------------------|---------------------| +| timestamp | Google.Protobuf.WellKnownTypes.Timestamp | The timestamp. | +| seconds | System.Int64 | The amount of seconds.| + +## Max(timestamp1, timestamp2) `method` +Compares two timestamps and returns the greater one. + +### Returns +The greater timestamp. + +### Parameters +| Name | Type | Description | +|--------------|------------------------------------|-----------------------| +| timestamp1 | Google.Protobuf.WellKnownTypes.Timestamp | The first timestamp. | +| timestamp2 | Google.Protobuf.WellKnownTypes.Timestamp | The second timestamp. | + +## Milliseconds(duration) `method` +Converts a protobuf duration to long. + +### Returns +The duration represented as a long. + +### Parameters +| Name | Type | Description | +|-----------|------------------------------------|--------------------| +| duration | Google.Protobuf.WellKnownTypes.Duration | The duration to convert. | + +## UnaryServerMethod `type` +**Namespace:** AElf.CSharp.Core + +Handler for a contract method. + +## Generic Types +| Name | Description | +|-----------|--------------------| +| TRequest | Request message type for this method | +| TResponse | Response message type for this method | \ No newline at end of file diff --git a/docs/devtools/contract-sdk/aelf-sdk-csharp.md b/docs/devtools/contract-sdk/aelf-sdk-csharp.md new file mode 100644 index 0000000..26a56bb --- /dev/null +++ b/docs/devtools/contract-sdk/aelf-sdk-csharp.md @@ -0,0 +1,646 @@ +# AElf.Sdk.CSharp + +## BoolState `type` +**Namespace:** AElf.Sdk.CSharp.State + +Wrapper for boolean values in smart contract state. + +## BytesState `type` +**Namespace:** AElf.Sdk.CSharp.State + +Wrapper for byte arrays in smart contract state. + +## CSharpSmartContractContext `type` +**Namespace:** AElf.Sdk.CSharp + +Represents the transaction execution context in a smart contract. Available in the base class for smart contracts (Context property). Provides access to properties and methods useful for implementing smart contract logic. + +### ChainId `property` +The chain ID of the chain where the contract runs. + +### CurrentBlockTime `property` +The time included in the current block's header. + +### CurrentHeight `property` +The height of the block containing the currently executing transaction. + +### Origin `property` +The address of the sender (signer) of the transaction. This value is constant, even for nested inline calls. It represents the entity that created the transaction (user or smart contract). + +### PreviousBlockHash `property` +The hash of the block preceding the current one in the blockchain. + +### Self `property` +The address of the contract currently being executed. This changes with every transaction and inline transaction. + +### Sender `property` +The sender of the currently executing transaction. + +### StateProvider `property` +Provides access to the underlying state provider. + +### TransactionId `property` +The ID of the currently executing transaction. + +### Variables `property` +Provides access to variables of the bridge. + +### Transaction `property` +Includes transaction info. + +### Call(fromAddress, toAddress, methodName, args) `method` +Calls a method on another contract. + +**Returns:** +The result of the call. + +**Parameters:** +| Name | Type | Description | +|-------------|-----------------------|----------------------------------------------------------------------------| +| fromAddress | AElf.Types.Address | The address to use as sender. | +| toAddress | AElf.Types.Address | The address of the contract you’re seeking to interact with. | +| methodName | System.String | The name of the method you want to call. | +| args | Google.Protobuf.ByteString | The input arguments for calling that method. This is usually generated from the protobuf definition of the input type. | + +**Generic Types:** +| Name | Description | +|-------------|----------------------------------------------------------------------------| +| T | The type of the return message | + +## ConvertHashToInt64(hash, start, end) `method` +Converts the input hash to a 64-bit signed integer. + +### Returns +The 64-bit signed integer. + +### Parameters +| Name | Type | Description | +|-------|-------------------|--------------------------------------------------| +| hash | AElf.Types.Hash | The hash. | +| start | System.Int64 | Inclusive lower bound of the number returned. | +| end | System.Int64 | Exclusive upper bound of the number returned. | + +### Exceptions +| Name | Description | +|--------------------------|----------------------------------------------------| +| System.ArgumentException | startValue is less than 0 or greater than endValue.| + +## ConvertVirtualAddressToContractAddress(virtualAddress) `method` +Converts a virtual address to a contract address. + +### Returns +The converted address. + +### Parameters +| Name | Type | Description | +|----------------|------------------|------------------------------| +| virtualAddress | AElf.Types.Hash | The virtual address to convert.| + +## ConvertVirtualAddressToContractAddress(virtualAddress, contractAddress) `method` +Converts a virtual address to a contract address with the contract address. + +### Returns +The converted address. + +### Parameters +| Name | Type | Description | +|----------------|-------------------|-------------------------------| +| virtualAddress | AElf.Types.Hash | The virtual address to convert.| +| contractAddress| AElf.Types.Address| The contract address. | + +## ConvertVirtualAddressToContractAddressWithContractHashName(virtualAddress) `method` +Converts a virtual address to a contract address with the current contract hash name. + +### Returns +The converted address. + +### Parameters +| Name | Type | Description | +|----------------|------------------|------------------------------| +| virtualAddress | AElf.Types.Hash | The virtual address to convert.| + +## ConvertVirtualAddressToContractAddressWithContractHashName(virtualAddress, contractAddress) `method` +Converts a virtual address to a contract address with the contract hash name. + +### Returns +The converted address. + +### Parameters +| Name | Type | Description | +|----------------|-------------------|-------------------------------| +| virtualAddress | AElf.Types.Hash | The virtual address to convert.| +| contractAddress| AElf.Types.Address| The contract address. | + +## DeployContract(address, registration, name) `method` +Deploy a new smart contract (only the genesis contract can call it). + +### Parameters +| Name | Type | Description | +|--------------|------------------------------------|-------------------------------------| +| address | AElf.Types.Address | The address of the new smart contract.| +| registration | AElf.Types.SmartContractRegistration| The registration of the new smart contract.| +| name | AElf.Types.Hash | The hash value of the smart contract name.| + +## FireLogEvent(logEvent) `method` +This method is used to produce logs that can be found in the transaction result after execution. + +### Parameters +| Name | Type | Description | +|----------|--------------------|---------------------| +| logEvent | AElf.Types.LogEvent| The event to fire. | + +## GenerateId(contractAddress, bytes) `method` +Generate a hash type id based on the contract address and the bytes. + +### Returns +The generated hash type id. + +### Parameters +| Name | Type | Description | +|----------------|--------------------------------------------|------------------------------------------| +| contractAddress| AElf.Types.Address | The contract address for id generation. | +| bytes | System.Collections.Generic.IEnumerable| The bytes for id generation. | + +## GetContractAddressByName(hash) `method` +Get the address of a system contract by its name hash. These hashes are in the SmartContractConstants.cs file. + +### Returns +The address of the system contract. + +### Parameters +| Name | Type | Description | +|------|------------------|---------------------------| +| hash | AElf.Types.Hash | The hash of the name. | + +## GetPreviousBlockTransactions() `method` +Returns the transactions included in the previous block. + +### Returns +A list of transactions. + +## GetRandomHash(fromHash) `method` +Gets a random hash based on the input hash. + +### Returns +Random hash. + +### Parameters +| Name | Type | Description | +|----------|-----------------|-------------| +| fromHash | AElf.Types.Hash | Hash. | + +## GetSystemContractNameToAddressMapping() `method` +Get the mapping of system contract addresses to their name hashes. + +### Returns +The addresses with their hashes. + +## GetZeroSmartContractAddress() `method` +Returns the address of the Genesis contract (smart contract zero) of the current chain. + +### Returns +The address of the genesis contract. + +## GetZeroSmartContractAddress(chainId) `method` +Returns the address of the Genesis contract (smart contract zero) of the specified chain. + +### Returns +The address of the genesis contract for the given chain. + +### Parameters +| Name | Type | Description | +|---------|--------------|-----------------| +| chainId | System.Int32 | The chain’s ID. | + +## LogDebug(func) `method` +Logs information for debugging. Visible only when the node is in debug mode. + +### Parameters +| Name | Type | Description | +|------|----------------------------|-----------------------------------------| +| func | System.Func | The logic for logging purposes. | + +## RecoverPublicKey() `method` +Recovers the public key of the transaction sender. + +### Returns +A byte array representing the public key. + +## SendInline(toAddress, methodName, args) `method` +Sends an inline transaction to another contract. + +### Parameters +| Name | Type | Description | +|------------|-------------------------|---------------------------------------------------------| +| toAddress | AElf.Types.Address | The address of the contract to interact with. | +| methodName | System.String | The name of the method to call. | +| args | Google.Protobuf.ByteString | The input arguments, usually generated from protobuf. | + +## SendVirtualInline(fromVirtualAddress, toAddress, methodName, args) `method` +Sends a virtual inline transaction to another contract. + +### Parameters +| Name | Type | Description | +|-------------------|-------------------------|---------------------------------------------------------| +| fromVirtualAddress| AElf.Types.Hash | The hash for generating the virtual address. | +| toAddress | AElf.Types.Address | The address of the contract to interact with. | +| methodName | System.String | The name of the method to call. | +| args | Google.Protobuf.ByteString | The input arguments, usually generated from protobuf. | + +## SendVirtualInline(fromVirtualAddress, toAddress, methodName, args, logTransaction) `method` +Sends a virtual inline transaction to another contract and logs the transaction. + +### Parameters +| Name | Type | Description | +|-------------------|-------------------------|---------------------------------------------------------| +| fromVirtualAddress| AElf.Types.Hash | The hash for generating the virtual address. | +| toAddress | AElf.Types.Address | The address of the contract to interact with. | +| methodName | System.String | The name of the method to call. | +| args | Google.Protobuf.ByteString | The input arguments, usually generated from protobuf. | +| logTransaction | System.Boolean | Whether to log the inline transaction. | + +## SendVirtualInlineBySystemContract(fromVirtualAddress, toAddress, methodName, args) `method` +Sends a virtual inline transaction using a system smart contract. + +### Parameters +| Name | Type | Description | +|-------------------|-------------------------|---------------------------------------------------------| +| fromVirtualAddress| AElf.Types.Hash | The hash for generating the virtual address. | +| toAddress | AElf.Types.Address | The address of the contract to interact with. | +| methodName | System.String | The name of the method to call. | +| args | Google.Protobuf.ByteString | The input arguments, usually generated from protobuf. | + +## SendVirtualInlineBySystemContract(fromVirtualAddress, toAddress, methodName, args, logTransaction) `method` +Sends a virtual inline transaction using a system smart contract and logs the transaction. + +### Parameters +| Name | Type | Description | +|-------------------|-------------------------|---------------------------------------------------------| +| fromVirtualAddress| AElf.Types.Hash | The hash for generating the virtual address. | +| toAddress | AElf.Types.Address | The address of the contract to interact with. | +| methodName | System.String | The name of the method to call. | +| args | Google.Protobuf.ByteString | The input arguments, usually generated from protobuf. | +| logTransaction | System.Boolean | Whether to log the inline transaction. | + +## UpdateContract(address, registration, name) `method` +Updates a smart contract (only the genesis contract can call it). + +### Parameters +| Name | Type | Description | +|--------------|-----------------------------------|--------------------------------------| +| address | AElf.Types.Address | The address of the smart contract. | +| registration | AElf.Types.SmartContractRegistration | The registration of the contract. | +| name | AElf.Types.Hash | The hash value of the contract name. | + +## ValidateStateSize(obj) `method` +Verifies that the state size is within the valid limit. + +### Returns +The state. + +### Parameters +| Name | Type | Description | +|------|---------------|-------------| +| obj | System.Object | The state. | + +### Exceptions +| Name | Description | +|------------------------------------------|--------------------------------------| +| AElf.Kernel.SmartContract.StateOverSizeException | The state size exceeds the limit. | + +## VerifySignature(tx) `method` +Checks if the transaction is well-formed and the signature is correct. + +### Returns +The verification result. + +### Parameters +| Name | Type | Description | +|------|---------------------|------------------------| +| tx | AElf.Types.Transaction | The transaction to verify. | + +## CheckContractVersion(previousContractVersion, registration) `method` +Checks the contract version when updating the contract (only the genesis contract can call it). + +### Returns +| Name | Type | Description | +|---------------------|----------------|-------------------------------------| +| IsSubsequentVersion | System.Boolean | Whether the contract version is subsequent. | + +### Parameters +| Name | Type | Description | +|-----------------------|-----------------------------------|--------------------------------------| +| previousContractVersion | System.String | The previous contract version. | +| registration | AElf.Types.SmartContractRegistration | The registration of the contract. | + +## DeploySmartContract(address, registration, name) `method` +Deploys a new smart contract with a version (only the genesis contract can call it). + +### Returns +| Name | Type | Description | +|---------------------|----------------|-------------------------------------| +| ContractVersion | System.String | The version of the smart contract. | +| IsSubsequentVersion | System.Boolean | Whether the contract version is subsequent. | + +### Parameters +| Name | Type | Description | +|--------------|-----------------------------------|--------------------------------------| +| address | AElf.Types.Address | The address of the new smart contract. | +| registration | AElf.Types.SmartContractRegistration | The registration of the contract. | +| name | AElf.Types.Hash | The hash value of the contract name. | + +## UpdateSmartContract(address, registration, name, previousContractVersion) `method` +Updates a smart contract with a version (only the genesis contract can call it). + +### Returns +| Name | Type | Description | +|---------------------|----------------|-------------------------------------| +| ContractVersion | System.String | The version of the smart contract. | +| IsSubsequentVersion | System.Boolean | Whether the contract version is subsequent. | + +### Parameters +| Name | Type | Description | +|-----------------------|-----------------------------------|--------------------------------------| +| address | AElf.Types.Address | The address of the smart contract. | +| registration | AElf.Types.SmartContractRegistration | The registration of the contract. | +| name | AElf.Types.Hash | The hash value of the contract name. | +| previousContractVersion | System.String | The previous contract version. | + +## ECVrfVerify(pubKey, alpha, pi, beta) `method` +Verifies the ECVrf proof. + +### Returns +The verification result and the VRF hash output. + +### Parameters +| Name | Type | Description | +|--------|----------|----------------------------| +| pubKey | byte[] | The public key. | +| alpha | byte[] | The VRF hash input. | +| pi | byte[] | The proof to be verified. | +| beta | byte[] | The VRF hash output. | + +## CSharpSmartContract `type` +**Namespace**: AElf.Sdk.CSharp + +Base class for contracts written in C#. Generated code from protobuf definitions inherits from this class. + +### Generic Types +| Name | Description | +|---------------|-------------------------------------| +| TContractState| Type of the state class defined by the contract author. | + +### Context `property` +Represents the transaction execution context in a smart contract. Provides access to properties and methods for implementing the contract logic. + +### State `property` +Provides access to the State class instance. + +### ContractState `type` +**Namespace**: AElf.Sdk.CSharp.State + +Base class for the state class in smart contracts. + +### Int32State `type` +**Namespace**: AElf.Sdk.CSharp.State + +Wrapper around 32-bit integer values for use in smart contract state. + +### Int64State `type` +**Namespace**: AElf.Sdk.CSharp.State + +Wrapper around 64-bit integer values for use in smart contract state. + +### MappedState `type` + +**Namespace**: AElf.Sdk.CSharp.State + +Key-value pair data structure used for representing state in contracts. + +### Generic Types +| Name | Description | +|-------|-----------------------| +| TKey | The type of the key. | +| TEntity | The type of the value. | + +## SingletonState `type` +**Namespace:** AElf.Sdk.CSharp.State + +Represents single values of a given type for use in smart contract state. + +## SmartContractBridgeContextExtensions `type` +**Namespace:** AElf.Sdk.CSharp + +Extension methods to interact with the smart contract execution context. + +## Call(context, address, methodName, message) `method` +Calls a method on another contract. + +### Returns: +The result of the call. + +### Parameters: +| Name | Type | Description | +|------------|---------------------------------------------------------------|--------------------------------------------| +| context | AElf.Kernel.SmartContract.ISmartContractBridgeContext | The virtual address to use as sender. | +| address | AElf.Types.Address | The contract address to interact with. | +| methodName | System.String | The name of the method to call. | +| message | Google.Protobuf.ByteString | The input arguments for the method. | + +### Generic Types: +| Name | Description | +|------|-----------------------| +| T | The return type of the call. | + +## Call(context, address, methodName, message) `method` +Calls a method on another contract. + +### Returns: +The result of the call. + +### Parameters: +| Name | Type | Description | +|------------|-------------------------------------------------|----------------------------------------| +| context | AElf.Sdk.CSharp.CSharpSmartContractContext | An instance of ISmartContractBridgeContext. | +| address | AElf.Types.Address | The contract address to interact with. | +| methodName | System.String | The name of the method to call. | +| message | Google.Protobuf.ByteString | The input arguments for the method. | + +### Generic Types: +| Name | Description | +|------|-----------------------| +| T | The return type of the call. | + +## Call(context, fromAddress, toAddress, methodName, message) `method` +Calls a method on another contract. + +### Returns: +The result of the call. + +### Parameters: +| Name | Type | Description | +|-------------|-------------------------------------------------|--------------------------------------------| +| context | AElf.Sdk.CSharp.CSharpSmartContractContext | An instance of ISmartContractBridgeContext. | +| fromAddress | AElf.Types.Address | The address to use as sender. | +| toAddress | AElf.Types.Address | The contract address to interact with. | +| methodName | System.String | The name of the method to call. | +| message | Google.Protobuf.ByteString | The input arguments for the method. | + +### Generic Types: +| Name | Description | +|------|-----------------------| +| T | The return type of the call. | + +## ConvertToByteString(message) `method` +Serializes a protobuf message to a ByteString. + +### Returns: +ByteString.Empty if the message is null. + +### Parameters: +| Name | Type | Description | +|---------|----------------------------|----------------------------| +| message | Google.Protobuf.IMessage | The message to serialize. | + +## ConvertVirtualAddressToContractAddress(this, virtualAddress) `method` +Converts a virtual address to a contract address. + +### Parameters +| Name | Type | Description | +|---------------|---------------------------------------------------------|--------------------------------------------| +| this | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | +| virtualAddress| AElf.Types.Hash Address | The virtual address to convert. | + +## ConvertVirtualAddressToContractAddressWithContractHashName(this, virtualAddress) `method` +Converts a virtual address to a contract address with the current contract address. + +### Parameters: +| Name | Type | Description | +|---------------|---------------------------------------------------------|--------------------------------------------| +| this | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | +| virtualAddress| AElf.Types.Hash Address | The virtual address to convert. | + +## Fire(context, eventData) `method` +Logs an event during a transaction. + +## Parameters: +| Name | Type | Description | +|-----------|-------------------------------------------------|--------------------------------------------| +| context | AElf.Sdk.CSharp.CSharpSmartContractContext | An instance of ISmartContractBridgeContext. | +| eventData | | The event to log. | + +### Generic Types: +| Name | Description | +|------|-----------------------| +| T | The type of the event. | + +## GenerateId(this, bytes) `method` +Generates a hash type ID based on the current contract address and the bytes. + +### Returns: The generated hash type ID. + +### Parameters: +| Name | Type | Description | +|-------|---------------------------------------------------------|----------------------------------------------| +| this | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | +| bytes | System.Collections.Generic.IEnumerable{System.Byte} | The bytes for ID generation. | + +## GenerateId(this, token) `method` +Generates a hash type ID based on the current contract address and the token. + +### Returns: +The generated hash type ID. + +### Parameters: +| Name | Type | Description | +|-------|---------------------------------------------------------|----------------------------------------------| +| this | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | +| token | System.String | The token for ID generation. | + +## GenerateId(this, token) `method` +Generates a hash type ID based on the current contract address and the hash type token. + +### Returns: The generated hash type ID. + +### Parameters: +| Name | Type | Description | +|-------|---------------------------------------------------------|----------------------------------------------| +| this | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | +| token | AElf.Types.Hash | The hash type token for ID generation. | + +## GenerateId(this) `method` +Generates a hash type ID based on the current contract address. + +### Returns: The generated hash type ID. + +### Parameters: +| Name | Type | Description | +|-------|---------------------------------------------------------|----------------------------------------------| +| this | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | + +## GenerateId(this, address, token) `method` +Generates a hash type ID based on the address and the bytes. + +### Returns: +The generated hash type ID. + +### Parameters: +| Name | Type | Description | +|---------|---------------------------------------------------------|----------------------------------------------| +| this | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | +| address | AElf.Types.Address | The address for ID generation. | +| token | AElf.Types.Hash | The hash type token for ID generation. | + +## SendInline(context, toAddress, methodName, message) `method` +Sends an inline transaction to another contract. + +### Parameters: +| Name | Type | Description | +|------------|---------------------------------------------------------|--------------------------------------------| +| context | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | +| toAddress | AElf.Types.Address | The contract address to interact with. | +| methodName | System.String | The name of the method to call. | +| message | Google.Protobuf.ByteString | The input arguments for the method. | + +## SendInline(context, toAddress, methodName, message) `method` +Sends a virtual inline transaction to another contract. + +### Parameters: +| Name | Type | Description | +|------------|---------------------------------------------------------|--------------------------------------------| +| context | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | +| toAddress | AElf.Types.Address | The contract address to interact with. | +| methodName | System.String | The name of the method to call. | +| message | Google.Protobuf.ByteString | The input arguments for the method. | + +## SendVirtualInline(context, fromVirtualAddress, toAddress, methodName, message) `method` +Sends a virtual inline transaction to another contract. + +### Parameters: +| Name | Type | Description | +|------------------|---------------------------------------------------------|--------------------------------------------| +| context | AElf.Kernel.SmartContract.ISmartContractBridgeContext | An instance of ISmartContractBridgeContext. | +| fromVirtualAddress | AElf.Types.Hash | The virtual address to use as sender. | +| toAddress | AElf.Types.Address | The contract address to interact with. | +| methodName | System.String | The name of the method to call. | +| message | Google.Protobuf.ByteString | The input arguments for the method. | + +## SmartContractConstants `type` +**Namespace:** AElf.Sdk.CSharp + +Static class containing the hashes built from contract names. + +## StringState `type` +**Namespace:** AElf.Sdk.CSharp.State + +Wrapper around string values for use in smart contract state. + +## UInt32State `type` +**Namespace:** AElf.Sdk.CSharp.State + +Wrapper around unsigned 32-bit integer values for use in smart contract state. + +## UInt64State `type` +**Namespace:** AElf.Sdk.CSharp.State + +Wrapper around unsigned 64-bit integer values for use in smart contract state. \ No newline at end of file