Exemplo n.º 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)
        {
            this.PublicKey = publicKey;
            this.Client    = client;

            this.publicKeyHex = CryptoUtils.BytesToHexString(this.PublicKey);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="client">Client to use to communicate with the contract.</param>
 /// <param name="contractAddress">Address of a contract on the Loom DAppChain.</param>
 /// <param name="callerAddress">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 contractAddress, Address callerAddress, string abi) : base(client, contractAddress, callerAddress)
 {
     this.contractBuilder  = new ContractBuilder(abi, contractAddress.LocalAddress);
     this.topicToEventName = new Dictionary <string, string>();
     foreach (EventABI eventAbi in this.contractBuilder.ContractABI.Events)
     {
         this.topicToEventName.Add("0x" + eventAbi.Sha33Signature, eventAbi.Name);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="client">Client to use to communicate with the contract.</param>
        /// <param name="contractAddress">Address of a contract on the Loom DAppChain.</param>
        /// <param name="callerAddress">Address of the caller, generated from the public key of the transaction signer.</param>
        protected ContractBase(DAppChainClient client, Address contractAddress, Address callerAddress)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }

            this.Client  = client;
            this.Address = contractAddress;
            this.Caller  = callerAddress;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="client">Client to use to communicate with the contract.</param>
        /// <param name="contractAddress">Address of a contract on the Loom DAppChain.</param>
        /// <param name="callerAddress">Address of the caller, generated from the public key of the transaction signer.</param>
        /// <param name="contractBuilder">Contract Builder object representing the contract's interface.</param>
        public EvmContract(DAppChainClient client, Address contractAddress, Address callerAddress, ContractBuilder contractBuilder) : base(client, contractAddress, callerAddress)
        {
            if (contractBuilder == null)
            {
                throw new ArgumentNullException(nameof(contractBuilder));
            }

            this.contractBuilder  = contractBuilder;
            this.topicToEventName = new Dictionary <string, string>();
            foreach (EventABI eventAbi in this.contractBuilder.ContractABI.Events)
            {
                this.topicToEventName.Add("0x" + eventAbi.Sha3Signature, eventAbi.Name);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="client">Client to use to communicate with the contract.</param>
 /// <param name="contractAddress">Address of a contract on the Loom DAppChain.</param>
 /// <param name="callerAddress">Address of the caller, generated from the public key of the transaction signer.</param>
 protected ContractBase(DAppChainClient client, Address contractAddress, Address callerAddress)
 {
     this.Client  = client;
     this.Address = contractAddress;
     this.Caller  = callerAddress;
 }
Exemplo n.º 6
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="client">Client to use to communicate with the contract.</param>
 /// <param name="contractAddress">Address of a contract on the Loom DAppChain.</param>
 /// <param name="callerAddress">Address of the caller, generated from the public key of the transaction signer.</param>
 /// <param name="abi">Deserialized Contract Application Binary Interface representation.</param>
 public EvmContract(DAppChainClient client, Address contractAddress, Address callerAddress, ContractABI abi)
     : this(client, contractAddress, callerAddress, CreateContractBuilderWithContractAbi(contractAddress, abi))
 {
 }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="client">Client to use to communicate with the contract.</param>
 /// <param name="contractAddress">Address of a contract on the Loom DAppChain.</param>
 /// <param name="callerAddress">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 contractAddress, Address callerAddress, string abi)
     : this(client, contractAddress, callerAddress, new ContractBuilder(abi, contractAddress.LocalAddress))
 {
 }
Exemplo n.º 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>
 public Contract(DAppChainClient client, Address contractAddr, Address callerAddr) : base(client, contractAddr, callerAddr)
 {
 }