/// <summary>
        /// Retrieves the current owners of the multisig contract.
        /// </summary>
        /// <param name="web3">The web3 interface instance to use.</param>
        /// <param name="contractAddress">The address of the deployed multisig wallet contract.</param>
        /// <returns>A list of owner accounts represented as strings.</returns>
        public static async Task <List <string> > GetOwnersAsync(Web3 web3, string contractAddress)
        {
            var getOwnersFunctionMessage = new GetOwnersFunction()
            {
            };

            IContractQueryHandler <GetOwnersFunction> ownerHandler = web3.Eth.GetContractQueryHandler <GetOwnersFunction>();
            List <string> owners = await ownerHandler.QueryAsync <List <string> >(contractAddress, getOwnersFunctionMessage).ConfigureAwait(false);

            return(owners);
        }
        public static async Task <string> GetOwnerAsync(Web3 web3, string contractAddress)
        {
            var ownerFunctionMessage = new OwnerFunction()
            {
            };

            IContractQueryHandler <OwnerFunction> ownerHandler = web3.Eth.GetContractQueryHandler <OwnerFunction>();
            string owner = await ownerHandler.QueryAsync <string>(contractAddress, ownerFunctionMessage).ConfigureAwait(false);

            return(owner);
        }
Beispiel #3
0
        public async Task <BigInteger> QueryPReviousContractState(IAccount account)
        {
            BalanceOfFunction balanceOfFunctionMessage = new BalanceOfFunction()
            {
                Owner = account.Address,
            };

            IContractQueryHandler <BalanceOfFunction> balanceHandler = bcNode.Eth.GetContractQueryHandler <BalanceOfFunction>();
            BalanceOfOutputDTO balanceOutput = await balanceHandler.QueryDeserializingToObjectAsync <BalanceOfOutputDTO>(balanceOfFunctionMessage, contractAddress, new Nethereum.RPC.Eth.DTOs.BlockParameter(transactionReceipt.BlockNumber));

            return(balanceOutput.Balance);
        }
Beispiel #4
0
        public async Task <BigInteger> QueryChain(IAccount account)
        {
            BalanceOfFunction balanceOfFunctionMessage = new BalanceOfFunction()
            {
                Owner = account.Address,
            };

            IContractQueryHandler <BalanceOfFunction> balanceHandler = bcNode.Eth.GetContractQueryHandler <BalanceOfFunction>();
            BalanceOfOutputDTO balanceOutput = await balanceHandler.QueryDeserializingToObjectAsync <BalanceOfOutputDTO>(balanceOfFunctionMessage, contractAddress);

            return(balanceOutput.Balance);
        }
Beispiel #5
0
        public async Task <BigInteger> QuerySingleContract(IAccount account)
        {
            BalanceOfFunction balanceOfFunctionMessage = new BalanceOfFunction()
            {
                Owner = account.Address,
            };

            IContractQueryHandler <BalanceOfFunction> balanceHandler = bcNode.Eth.GetContractQueryHandler <BalanceOfFunction>();
            BigInteger balance = await balanceHandler.QueryAsync <BigInteger>(contractAddress, balanceOfFunctionMessage);

            return(balance);
        }
        public static async Task <BigInteger> GetConfirmationCountAsync(Web3 web3, string contractAddress, BigInteger transactionId)
        {
            var getConfirmationCountFunctionMessage = new GetConfirmationCountFunction()
            {
                TransactionId = transactionId
            };

            IContractQueryHandler <GetConfirmationCountFunction> confirmationHandler = web3.Eth.GetContractQueryHandler <GetConfirmationCountFunction>();
            BigInteger confirmations = await confirmationHandler.QueryAsync <BigInteger>(contractAddress, getConfirmationCountFunctionMessage).ConfigureAwait(false);

            return(confirmations);
        }
        public static async Task <string> GetDestinationAddressAsync(Web3 web3, string contractAddress, string addressToQuery)
        {
            var withdrawalAddressesFunctionMessage = new WithdrawalAddressesFunction()
            {
                Address = addressToQuery
            };

            IContractQueryHandler <WithdrawalAddressesFunction> queryHandler = web3.Eth.GetContractQueryHandler <WithdrawalAddressesFunction>();
            string destinationAddress = await queryHandler.QueryAsync <string>(contractAddress, withdrawalAddressesFunctionMessage).ConfigureAwait(false);

            return(destinationAddress);
        }
        public static async Task <BigInteger> GetErc20BalanceAsync(Web3 web3, string contractAddress, string addressToQuery)
        {
            var balanceOfFunctionMessage = new BalanceOfFunction()
            {
                Owner = addressToQuery
            };

            IContractQueryHandler <BalanceOfFunction> balanceHandler = web3.Eth.GetContractQueryHandler <BalanceOfFunction>();
            BigInteger balance = await balanceHandler.QueryAsync <BigInteger>(contractAddress, balanceOfFunctionMessage).ConfigureAwait(false);

            return(balance);
        }
Beispiel #9
0
 public MinetokenService(IWeb3 web3)
 {
     _balanceHandler = web3.Eth.GetContractQueryHandler <BalanceOfFunction>();
 }