Example #1
0
        /// <summary>
        /// Creates middleware that adds a nonce to transactions for given public key.
        /// </summary>
        /// <param name="publicKey">Public key for which the nonce should be set.</param>
        /// <param name="client">Client that should be used to retrieve the nonce.</param>
        public NonceTxMiddleware(byte[] publicKey, DAppChainClient client)
        {
            PublicKey = publicKey;
            Client    = client;

            publicKeyHex = CryptoUtils.BytesToHexString(this.PublicKey);
        }
Example #2
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="contractName">Name of the contract.</param>
 /// <param name="callerAddr">Address of the caller, generated from the public key of the tx signer.</param>
 public Contract(DAppChainClient client, Address contractAddr, string contractName, Address callerAddr)
 {
     this.client  = client;
     this.Address = contractAddr;
     this.Name    = contractName;
     this.Caller  = callerAddr;
 }
Example #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);
     }
 }
Example #4
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 transaction 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.LocalAddress);
     this.topicToEventName = new Dictionary <string, string>();
     foreach (EventABI eventAbi in this.contractBuilder.ContractABI.Events)
     {
         this.topicToEventName.Add(eventAbi.Sha33Signature, eventAbi.Name);
     }
 }
Example #5
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>
 public Contract(DAppChainClient client, Address contractAddr, Address callerAddr)
 {
     this.client  = client;
     this.Address = contractAddr;
     this.Caller  = callerAddr;
 }
Example #6
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 transaction signer.</param>
 public Contract(DAppChainClient client, Address contractAddr, Address callerAddr) : base(client, contractAddr, callerAddr)
 {
 }
Example #7
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);
 }
Example #8
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 transaction signer.</param>
 protected ContractBase(DAppChainClient client, Address contractAddr, Address callerAddr)
 {
     this.client  = client;
     this.Address = contractAddr;
     this.Caller  = callerAddr;
 }