/// <summary> /// Creates an Address instance from a hex string representing an address. /// </summary> /// <param name="hexAddressStr">Hex encoded string, may start with "0x".</param> /// <param name="chainId">Identifier of a DAppChain.</param> /// <returns>An address</returns> public static Address FromHexString(string hexAddressStr, string chainId = "default") { return(new Address { ChainId = chainId, Local = ByteString.CopyFrom(CryptoUtils.HexStringToBytes(hexAddressStr)) }); }
private static Internal.Protobuf.Address AddressToProtobufAddress(Address address) { return(new Internal.Protobuf.Address { ChainId = address.ChainId, Local = ByteString.CopyFrom(CryptoUtils.HexStringToBytes(address.LocalAddress)) }); }
/// <summary> /// Constructor. /// </summary> /// <param name="client">Client to use to communicate with the contract.</param> /// <param name="contractAddr">Address of a contract on the Loom DAppChain.</param> /// <param name="callerAddr">Address of the caller, generated from the public key of the tx signer.</param> /// <param name="abi">Contract Application Binary Interface as JSON object string.</param> public EvmContract(DAppChainClient client, Address contractAddr, Address callerAddr, string abi) : base(client, contractAddr, callerAddr) { this.contractBuilder = new ContractBuilder(abi, contractAddr.LocalAddressHexString); this.topicToEventName = new Dictionary <byte[], string>(new ByteArrayComparer()); foreach (EventABI eventAbi in this.contractBuilder.ContractABI.Events) { this.topicToEventName.Add(CryptoUtils.HexStringToBytes(eventAbi.Sha33Signature), eventAbi.Name); } }
private async Task <byte[]> StaticCallAsyncByteArray(string callInput) { return(await this.client.QueryAsync <byte[]>(this.Address, CryptoUtils.HexStringToBytes(callInput), this.Caller, VMType.Evm)); }
protected Transaction CreateContractMethodCallTx(string hexData, VMType vmType) { return(CreateContractMethodCallTx(ByteString.CopyFrom(CryptoUtils.HexStringToBytes(hexData)), vmType)); }