Ethereum .Net cross platform integration library
WIP
Diamonds support as a Standard contract, including factory extensions to create Facets from service contracts.
New ServiceContractBase and ServiceContractWeb3Base these should be complemented normally by the new code generation changes, this include helpers to get all the contract signatures, abis or types.
Service code generation changes, to support the new ServiceContractWeb3Base and implement supporting functions to get all abi FunctionTypes, EventTypes and ErrorTypes these can be complimented with the Diamonds to create the Facet cuts, or handle errors specific to the that contract, etc.
WalletConnect host provider, adding switchchain, addchain to the interceptor, support the current account and changes to selected chain and selected account. Examples upgraded for Avalonia and Blazor.
Use IWeb3 instead of Web3 to deploy contracts by @Magehernan in https://github.com/Nethereum/Nethereum/pull/1000
Fixes to signing in the NethereumWalletConnectInterceptor
by @skibitsky in https://github.com/Nethereum/Nethereum/pull/1017
CI workflow to call the nuget.bat and build the "development" nuget packages by @webwarrior-ws in https://github.com/Nethereum/Nethereum/pull/1018
Unity releases WIP
Full Changelog: https://github.com/Nethereum/Nethereum/compare/4.19.0...4.20.0
Full Changelog: https://github.com/Nethereum/Nethereum/compare/4.18.0...4.19.0
All projects target .net8 where possible/
Legacy2930 Transaction support to Sign, Recover and reconstruct RLP (As it is legacy this is not part of the normal TransactionManager flow)
Commits: https://github.com/Nethereum/Nethereum/commit/7c7d86b4c516f22db284b7de210c7cb0f8848898. https://github.com/Nethereum/Nethereum/commit/a812ef29a22d267946136a383337ce076d8499cd
This simplifies the creation of batches as per:
var web3 = _ethereumClientIntegrationFixture.GetWeb3();
var batchRequest = new RpcRequestResponseBatch();
var batchItem1 = web3.Eth.GetBalance.CreateBatchItem(EthereumClientIntegrationFixture.AccountAddress, BlockParameter.CreateLatest(), 1);
var batchItem2 = web3.Eth.GetBalance.CreateBatchItem(EthereumClientIntegrationFixture.AccountAddress, BlockParameter.CreateLatest(), 2);
batchRequest.BatchItems.Add(batchItem1);
batchRequest.BatchItems.Add(batchItem2);
var response = await web3.Client.SendBatchRequestAsync(batchRequest);
Assert.Equal(batchItem1.Response.Value, batchItem2.Response.Value);
Commit: https://github.com/Nethereum/Nethereum/commit/33329012143ed5589e83cc905f5a767403abc162
Integration of Wallet connect libraries with Nethereum
Usage:
Commits: https://github.com/Nethereum/Nethereum/commit/27e5c938e133c14ccb6f0ccf1bc32b940de48b6e, https://github.com/Nethereum/Nethereum/commit/71535323728439d38b54b9f29ceb0ac98a9ac1dc, https://github.com/Nethereum/Nethereum/commit/b3e617dcac52a63dada7bf5e57381b8cbc02568c, https://github.com/Nethereum/Nethereum/commit/8fa81e1ea9d6f54c93c20c8a2cbafaa9229857cd, https://github.com/Nethereum/Nethereum/commit/6324189c5b15bc18bd4a0166c630fcb19fd8508c
Enhancements and fix on tuples (New methods HashStruct, GetEncodedType, GetEncodedTypeDomainSeparator, HashDomainSeparator) See unit test for example: https://github.com/Nethereum/Nethereum/blob/894aaf6421106465a56ea6dbc12a030c155f8e25/tests/Nethereum.Signer.IntegrationTests/EIP712IntegrationTestRaribleExample.cs Commits: https://github.com/Nethereum/Nethereum/commit/894aaf6421106465a56ea6dbc12a030c155f8e25, https://github.com/Nethereum/Nethereum/commit/0d35d8cd25b74ecd1c5b5427691401e6e625f258
Added support to indexed values, when decoding default values to json, object dictionary, string dynamic dictionary support for indexed values that are hashed
Commit: https://github.com/Nethereum/Nethereum/commit/3ea051a5718960cd00bea06a053ace8857b013d8
Full Changelog: https://github.com/Nethereum/Nethereum/compare/4.16.0...4.17.1
See 4.17.1
Full Changelog: https://github.com/Nethereum/Nethereum/compare/4.16.0...4.17.0
New DataServices package, adding support to external (or local) data services starting with Etherscan, 4ByteDirectory and Sourcify.
Usage:
var etherscanService = new EtherscanApiService();
var result = await etherscanService.Contracts.GetSourceCodeAsync("0xC36442b4a4522E871399CD717aBDD847Ab11FE88");
Assert.Equal("1", result.Status);
var contract = result.Result.First();
Assert.True(contract.ContainsSourceCodeCompilationMetadata());
var compilationMetadata = contract.DeserialiseCompilationMetadata();
var contractSource = compilationMetadata.GetLocalSourceCode(contract.ContractName);
var sourcifyApiService = new Sourcify.SourcifyApiService();
var compilationMetadata = await sourcifyApiService.GetCompilationMetadataAsync(1, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88");
var fourByteDirectoryService = new FourByteDirectoryService();
var signature = await fourByteDirectoryService.GetFunctionSignatureByHexSignatureAsync("0x722713f7");
Commits: https://github.com/Nethereum/Nethereum/commit/226371cf5fb28ac37af69abdca3d8b0a8490ab87, https://github.com/Nethereum/Nethereum/commit/96290cf1e2ff0d71fb3355d3c484958fd30ca1e2, https://github.com/Nethereum/Nethereum/commit/0fbcfa0895f829b49da24a2fb8dd6007d813bb22, https://github.com/Nethereum/Nethereum/commit/4868317e84131c7d82af883f68aae34921af32e4,
Adding revert message to Evm simulator Commit: https://github.com/Nethereum/Nethereum/commit/9d3ce60628ce1f7d1756327b45c477b4185aa605
var transactionHash = "0xf3d2a323110370a4dc72c04c738bf9b45d14b03603ed70372128a3966c54fca6";
var web3 = _ethereumClientIntegrationFixture.GetInfuraWeb3(InfuraNetwork.Mainnet);
var txn = await web3.Eth.Transactions.GetTransactionByHash.SendRequestAsync(transactionHash);
var txnReceipt = await web3.Eth.Transactions.GetTransactionReceipt.SendRequestAsync(transactionHash);
var block = await web3.Eth.Blocks.GetBlockWithTransactionsHashesByNumber.SendRequestAsync(txn.BlockNumber);
var code = await web3.Eth.GetCode.SendRequestAsync(txn.To); // runtime code;
Program program = await ExecuteProgramAsync(web3, txn, block, code, null);
Assert.NotNull(program.ProgramResult.GetRevertMessage());
Bath requests added to common rpc methods EthGetBlockWithTransactionsHashesByHash, EthGetBlockWithTransactionsByNumber, EthGetBlockWithTransactionsHashesByNumber, EthGetBalance, EthCall, EthGetTransactionByHash, EthGetTransactionReceipt, have now SendBatchRequestAsync included with an array of parameters
Commit: https://github.com/Nethereum/Nethereum/commit/b031a3b3290ef43c6be4969cc1e9fbd98851ce77
MultiQueryBatchRpcHandler creates a multi query handler, to enable execute a single request combining multiple queries to multiple contracts using rpc batches
This uses the same IMulticallInputOutput as per the contract multiquery enabling to easily switch between them (although the contract version can handle errors in the calls)
//Connecting to Ethereum mainnet using Infura
var web3 = _ethereumClientIntegrationFixture.GetInfuraWeb3(InfuraNetwork.Mainnet);
//Setting the owner https://etherscan.io/tokenholdings?a=0x8ee7d9235e01e6b42345120b5d270bdb763624c7
var balanceOfMessage1 = new BalanceOfFunction()
{ Owner = "0x5d3a536e4d6dbd6114cc1ead35777bab948e3643" }; //compound
var call1 = new MulticallInputOutput<BalanceOfFunction, BalanceOfOutputDTO>(balanceOfMessage1,
"0x6b175474e89094c44da98b954eedeac495271d0f"); //dai
var balanceOfMessage2 = new BalanceOfFunction()
{ Owner = "0x6c6bc977e13df9b0de53b251522280bb72383700" }; //uni
var call2 = new MulticallInputOutput<BalanceOfFunction, BalanceOfOutputDTO>(balanceOfMessage2,
"0x6b175474e89094c44da98b954eedeac495271d0f"); //dai
await web3.Eth.GetMultiQueryBatchRpcHandler().MultiCallAsync(call1, call2);
Assert.True(call1.Output.Balance > 0);
Assert.True(call2.Output.Balance > 0);
Full Changelog: https://github.com/Nethereum/Nethereum/compare/4.15.0...4.16.0
You can now use the latest release directly from a package in this repository: https://github.com/Nethereum/Nethereum.Unity
net472UnityCommonAOT Includes all the Common used net472 AOT dlls, if you need extra libraries just copy them from net472dllsAOT. net472dllsAOT: Includes all the net472 AOT dlls, this includes libraries like Nethereum.Geth, Nethereum.Besu etc that are not Common
netStandardMinimalWebglUnityAOT Includes a minimal set of netStandard dlls to work with webgl, it excludes libraries like Nethereum.Web3 and Nethereum.JsonRpc.RpcClient which cannot be used in webgl but instead is required to use Nethereum.Unity with coroutines. netStandardCommonUnityAOT Includes all the Common dlls / libraries used in netstandard AOT, if you need extra libraries just copy them from netStandardUnityCommonAOT. netStandardUnityCommonAOT Includes all the netstandard AOT dlls, this includes libraries like Nethereum.Geth, Nethereum.Besu etc that are not Common, this may include duplicated libraries like UnityEngine or Newtonsoft.Json.dll
net461dllsAOT Includes all the net461 AOT dlls, this includes libraries like Nethereum.Geth, Nethereum.Besu etc that are not Common, this may include duplicated libraries like UnityEngine or Newtonsoft.Json.dll
New RPC Extensions package, adding support initially to development nodes like Ganache, Hardhat and Anvil custom RPC methods.
Usage:
csharp using Nethereum.RPC.Extensions;
var incresedBlockNumber = await web3.Eth.Hardhat().IncreaseTimeAsync(1); //hardhat
await web3.Eth.Anvil().ImpersonateAccount.SendRequestAsync("xxxx"); //anvil same as hardhat
await web3.Eth.DevToolsEvm().SetNextBlockTimestamp.SendRequestAsync(); //Ganache Evm included in DevToolsEvm.
Commits: https://github.com/Nethereum/Nethereum/commit/5bf06fcc1b90c49fc4578d7bfbfd4503deada678, https://github.com/Nethereum/Nethereum/commit/cfd9eb35f051f39afb10bd4d353c141f5030b0d9, https://github.com/Nethereum/Nethereum/commit/d9f7404ce726df5ec9e2874c7f90e653245e790e, https://github.com/Nethereum/Nethereum/commit/62ac6121f648d753ecaa58b79c481d0283f300fa, https://github.com/Nethereum/Nethereum/commit/a6050dfe8ce94d3a1b8a572797e35c42b902da37
New Package to enable the simulation of specific contracts currently for ERC20 using the Nethereum EVM https://www.nuget.org/packages/Nethereum.EVM.Contracts
Example usage:
[Fact]
public async void ShouldCalculateBalanceSlot()
{
var web3 = _ethereumClientIntegrationFixture.GetInfuraWeb3(InfuraNetwork.Mainnet);
var contractAddress = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
var senderAddress = "0x0000000000000000000000000000000000000001";
var simulator = new Nethereum.EVM.Contracts.ERC20.ERC20Simulator(web3, 1, contractAddress);
var slot = await simulator.CalculateMappingBalanceSlotAsync(senderAddress, 100);
Assert.Equal(9, slot);
}
[Fact]
public async void ShouldSimulateTransferAndBalanceState()
{
var web3 = _ethereumClientIntegrationFixture.GetInfuraWeb3(InfuraNetwork.Mainnet);
var contractAddress = "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48";
var senderAddress = "0x0000000000000000000000000000000000000001";
var receiverAddress = "0x0000000000000000000000000000000000000025";
var simulator = new Nethereum.EVM.Contracts.ERC20.ERC20Simulator(web3, 1, contractAddress);
var simulationResult = await simulator.SimulateTransferAndBalanceStateAsync(senderAddress, receiverAddress, 100);
Assert.Equal(simulationResult.BalanceSenderAfter, simulationResult.BalanceSenderBefore - 100);
Assert.Equal(simulationResult.BalanceSenderStorageAfter, simulationResult.BalanceSenderBefore - 100);
Assert.Equal(simulationResult.BalanceReceiverAfter, simulationResult.BalanceReceiverBefore + 100);
Assert.Equal(simulationResult.BalanceReceiverStorageAfter, simulationResult.BalanceReceiverBefore + 100);
}
Commits: https://github.com/Nethereum/Nethereum/commit/15c4b2263b2eaa3ea1de4d428bdb4f302a1813e5, https://github.com/Nethereum/Nethereum/commit/a3dc5287e830acb7afd8b4ae2ef72165ff7a5b35, https://github.com/Nethereum/Nethereum/commit/3843f7dabcfdaae4d9713b764b405321f37b5b71
Full support of ENSIP-15 by replacing implementation used with IdnMapping in System.Globalization with the new package created by @adraffy AdRaffy.EnsNormalise, which also enables ENS normalisation support for older frameworks like netstandard1.1 and net35.
Commits: https://github.com/Nethereum/Nethereum/commit/2ebbd8a2fac2ea477232aff6b55c2fc15206142f, https://github.com/Nethereum/Nethereum/commit/14f75dc724816f49e040cdc5ed63ebec248c9390
Full Changelog: https://github.com/Nethereum/Nethereum/compare/4.14.0...4.15.0
Commits: https://github.com/Nethereum/Nethereum/commit/0c87c3436dfa224dc6794381c3372db56e617247, https://github.com/Nethereum/Nethereum/commit/a375d5a3352cff31895da52a17f23d972aa98ac4
Commits: https://github.com/Nethereum/Nethereum/commit/82e9bce09761bd91ee3b83efca4b60e8e4750c51, https://github.com/Nethereum/Nethereum/commit/2a033e89093bbad7e4dbea9a83e34cd50d8173d0, https://github.com/Nethereum/Nethereum/commit/82d86a837916d6e0badc886701be521e047cd233, https://github.com/Nethereum/Nethereum/commit/b353706bb144971694ced135dc309adb3ac98dfa, https://github.com/Nethereum/Nethereum/commit/f34937fac22fabd42c9848d5cd2b080ace378516
Nethereum.Templates.Pack: 2.0 Includes all the new updates for SmartContract, OpenZeppelin, Blazor and Siwe https://github.com/Nethereum/Nethereum.Templates.Pack and nuget: https://www.nuget.org/packages/Nethereum.Templates.Pack/ SmartContract Template: (Included in the pack) Upgrade to the latest version https://github.com/Nethereum/Nethereum.Templates.SmartContractDefault Erc721, 1555 Open Zeppelin Template: (Included in the pack) Upgrade to the latest version https://github.com/Nethereum/Nethereum.Templates.SmartContracts.OZ-Erc721-Erc1155 Blazor Metamask: (Included in the pack) Changes on dependency injection, package upgrade and small fix https://github.com/Nethereum/Nethereum.Templates.Metamask.Blazor Blazor Siwe: (Included in the pack) Changes on dependency injection, package upgrade https://github.com/Nethereum/Nethereum.Templates.Siwe
Unity3d Sample Template: Includes now Web3 / Task samples, ERC20 samples as these can work now in WebGL and all the changes for Nethereum UI / Unity https://github.com/Nethereum/Unity3dSampleTemplate Unity3d WebGl Template: Upgrade to new version
Full Changelog: https://github.com/Nethereum/Nethereum/compare/4.13.0...4.14.0
net472UnityCommonAOT Includes all the Common used net472 AOT dlls, if you need extra libraries just copy them from net472dllsAOT. net472dllsAOT: Includes all the net472 AOT dlls, this includes libraries like Nethereum.Geth, Nethereum.Besu etc that are not Common
netStandardMinimalWebglUnityAOT Includes a minimal set of netStandard dlls to work with webgl, it excludes libraries like Nethereum.Web3 and Nethereum.JsonRpc.RpcClient which cannot be used in webgl but instead is required to use Nethereum.Unity with coroutines. netStandardCommonUnityAOT Includes all the Common dlls / libraries used in netstandard AOT, if you need extra libraries just copy them from netStandardUnityCommonAOT. netStandardUnityCommonAOT Includes all the netstandard AOT dlls, this includes libraries like Nethereum.Geth, Nethereum.Besu etc that are not Common, this may include duplicated libraries like UnityEngine or Newtonsoft.Json.dll
net461dllsAOT Includes all the net461 AOT dlls, this includes libraries like Nethereum.Geth, Nethereum.Besu etc that are not Common, this may include duplicated libraries like UnityEngine or Newtonsoft.Json.dll
Commits: https://github.com/Nethereum/Nethereum/commit/0796f97cfd1ce3f3f7106f4d756f374b351077d9 https://github.com/Nethereum/Nethereum/commit/0d07bb476dfee5cb6b93e0e616c284b173247907
Commits: https://github.com/Nethereum/Nethereum/commit/485986e3c44d5d0cb960281399f3f4d6260ebc4f https://github.com/Nethereum/Nethereum/commit/c521c3d6e3473dacf5d46fc1c30569cdb26b0886 https://github.com/Nethereum/Nethereum/commit/f2829724da0bb23eca09ad267ce30abc27d269e5
Breaking change:
Commits: https://github.com/Nethereum/Nethereum/commit/937f1da63a1c3a33cb0c41795b29afe8b10cd054
This requires to use the extension WebGLThreadingPatcher https://github.com/VolodymyrBS/WebGLThreadingPatcher Thanks to the great job of @VVolodymyrBS. There is a new updated preview template on https://github.com/Nethereum/Unity3dSampleTemplate
Commits: https://github.com/Nethereum/Nethereum/commit/3bca8716afe6b598da2637e9d01a1427ac438f75
Full Changelog: https://github.com/Nethereum/Nethereum/compare/4.12.0...4.13.0
Commits: https://github.com/Nethereum/Nethereum/commit/64b70c8faf6685c0199ed3cf2111dd70f9cbbf6f https://github.com/Nethereum/Nethereum/commit/d17378b944df15ab8424697ef789ed6a19dc4d1a https://github.com/Nethereum/Nethereum/commit/6cac70c9fa511b6852bea07511c57a29201bb22d https://github.com/Nethereum/Nethereum/commit/fa08c265737b44f5b56f149f4a08fcebe98bf15b https://github.com/Nethereum/Nethereum/commit/2c4f1e8ad722efe3afb5d3f775b77ab98803265f
Full Changelog: https://github.com/Nethereum/Nethereum/compare/4.11.0...4.12.0 Nuget Web3: https://www.nuget.org/packages/Nethereum.Web3 All Nugets: https://www.nuget.org/profiles/nethereum
net472UnityCommonAOT Includes all the Common used net472 AOT dlls, if you need extra libraries just copy them from net472dllsAOT. net472dllsAOT: Includes all the net472 AOT dlls, this includes libraries like Nethereum.Geth, Nethereum.Besu etc that are not Common
netStandardMinimalWebglUnityAOT Includes a minimal set of netStandard dlls to work with webgl, it excludes libraries like Nethereum.Web3 and Nethereum.JsonRpc.RpcClient which cannot be used in webgl but instead is required to use Nethereum.Unity with coroutines. netStandardCommonUnityAOT Includes all the Common dlls / libraries used in netstandard AOT, if you need extra libraries just copy them from netStandardUnityCommonAOT. netStandardUnityCommonAOT Includes all the netstandard AOT dlls, this includes libraries like Nethereum.Geth, Nethereum.Besu etc that are not Common, this may include duplicated libraries like UnityEngine or Newtonsoft.Json.dll
net461dllsAOT Includes all the net461 AOT dlls, this includes libraries like Nethereum.Geth, Nethereum.Besu etc that are not Common, this may include duplicated libraries like UnityEngine or Newtonsoft.Json.dll
Note: If you need the net351 dlls for older versions of unity, please let us know in discord.