Ejemplo n.º 1
0
 /// <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))
     });
 }
Ejemplo n.º 2
0
 private static Internal.Protobuf.Address AddressToProtobufAddress(Address address)
 {
     return(new Internal.Protobuf.Address
     {
         ChainId = address.ChainId,
         Local = ByteString.CopyFrom(CryptoUtils.HexStringToBytes(address.LocalAddress))
     });
 }
Ejemplo n.º 3
0
 /// <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);
     }
 }
Ejemplo n.º 4
0
 private async Task <byte[]> StaticCallAsyncByteArray(string callInput)
 {
     return(await this.client.QueryAsync <byte[]>(this.Address, CryptoUtils.HexStringToBytes(callInput), this.Caller, VMType.Evm));
 }
Ejemplo n.º 5
0
 protected Transaction CreateContractMethodCallTx(string hexData, VMType vmType)
 {
     return(CreateContractMethodCallTx(ByteString.CopyFrom(CryptoUtils.HexStringToBytes(hexData)), vmType));
 }