Skip to content

4.16.0 β˜€οΈβ˜€οΈπŸžπŸž

Compare
Choose a tag to compare
@juanfranblanco juanfranblanco released this 14 Aug 08:38
· 119 commits to master since this release

Nethereum.DataServices

New DataServices package, adding support to external (or local) data services starting with Etherscan, 4ByteDirectory and Sourcify.

Usage:

  1. Add the package Nethereum.DataServices
  2. Add the namespaces from Nethereum.DataServices

Etherscan example

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);

Sourcify example

 var sourcifyApiService = new Sourcify.SourcifyApiService();
            var compilationMetadata = await sourcifyApiService.GetCompilationMetadataAsync(1, "0xC36442b4a4522E871399CD717aBDD847Ab11FE88");

4Bytes Example

 var fourByteDirectoryService = new FourByteDirectoryService();
var signature = await fourByteDirectoryService.GetFunctionSignatureByHexSignatureAsync("0x722713f7");

Commits:
226371c, 96290cf, 0fbcfa0, 4868317,

Nethereum.ABI

  • Fix Decoding, multidimentional array of structs of non dynamic structs will only decode first element as it needed to be initialise by iterating all the types. 929c336
  • Compilation metadata parsing and objects
  • Extensions to ABI Model (FunctionABI, EventABI, ErrorABI) to simplify decoding, selection and finding
  • AbiInfo, AbiInfoStorage and AbiInfoInMemoryStorage to maintain in memory or externally abi information.
  • Extensions to Transactions, Logs, RpcException to find FunctionAbis, EventAbis and ErrorAbis and facilitate decoding
    Commits:
  • 6847eb7, 657390b, 04e9494, 8464988, b5a82f4, 4a92caf

Nethereum.EVM

Adding revert message to Evm simulator
Commit: 9d3ce60

 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());

Nethereum.RPC

Bath requests added to common rpc methods
EthGetBlockWithTransactionsHashesByHash, EthGetBlockWithTransactionsByNumber, EthGetBlockWithTransactionsHashesByNumber, EthGetBalance, EthCall, EthGetTransactionByHash, EthGetTransactionReceipt, have now SendBatchRequestAsync included with an array of parameters

Commit: b031a3b

Nethereum.Contracts

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: 4.15.0...4.16.0

Unity Package (.net472 AOT)

You can now use the latest release directly from a package in this repository: https://github.com/Nethereum/Nethereum.Unity

Unity DLLs (attached)

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