// NOTE: This code will need to be modified in order to work correctly
        public static async Task <string> RegisterOnENS(this WonkaBizRulesEngine poEngine)
        {
            var durationInDays = 365;                                   // how long we are going to rent the domain for

            var ourName = "supersillynameformonkeys";                   // Our xxxxx.eth domain name
            var owner   = "0x12890d2cce102216644c59dae5baed380d84830c"; // Owner of the domain
            var secret  = "animals in the forest";                      //This is the commitment secret,

            // it should be unique and remember it to be able to finalise your registration
            var account = new Nethereum.Web3.Accounts.Account("YOURPRIVATE KEY");
            var web3    = new Web3(account, "https://mainnet.infura.io/v3/7238211010344719ad14a89db874158c");

            var ethTLSService = new EthTLSService(web3);
            await ethTLSService.InitialiseAsync();             // Initialising to retrieve the controller

            //How much is going to cost
            var price = await ethTLSService.CalculateRentPriceInEtherAsync(ourName, durationInDays);

            Console.WriteLine(price);

            //Calculate the commitment that will be submitted for reservation
            var commitment = await ethTLSService.CalculateCommitmentAsync(ourName, owner, secret);

            Console.WriteLine(commitment.ToHex());

            //You can now create your commitment and wait for it to be included on the chain
            var commitTransactionReceipt = await ethTLSService.CommitRequestAndWaitForReceiptAsync(commitment);

            // Once is on chain you can complete the registration
            var txnHash = await ethTLSService.RegisterRequestAsync(ourName, owner, durationInDays, secret, price);

            return(txnHash);
        }
예제 #2
0
        public async void ShouldFindEthControllerFromMainnet()
        {
            var web3          = new Web3.Web3("https://mainnet.infura.io/v3/7238211010344719ad14a89db874158c");
            var ethTLSService = new EthTLSService(web3);
            await ethTLSService.InitialiseAsync();

            var controllerAddress = ethTLSService.TLSControllerAddress;

            Assert.True("0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5".IsTheSameAddress(controllerAddress));
        }
예제 #3
0
        public async void ShouldFindEthControllerFromMainnet()
        {
            var web3          = _ethereumClientIntegrationFixture.GetInfuraWeb3(InfuraNetwork.Mainnet);
            var ethTLSService = new EthTLSService(web3);
            await ethTLSService.InitialiseAsync();

            var controllerAddress = ethTLSService.TLSControllerAddress;

            Assert.True("0x283Af0B28c62C092C9727F1Ee09c02CA627EB7F5".IsTheSameAddress(controllerAddress));
        }
예제 #4
0
        public async void ShouldBeAbleToCalculateRentPriceAndCommitment()
        {
            var durationInDays = 365;
            var ourName        = "supersillynameformonkeys";
            var tls            = "eth";
            var owner          = "0x12890D2cce102216644c59daE5baed380d84830c";
            var secret         = "animals in the forest";


            var web3          = new Web3.Web3("https://mainnet.infura.io/v3/7238211010344719ad14a89db874158c");
            var ethTLSService = new EthTLSService(web3);
            await ethTLSService.InitialiseAsync();

            var price = await ethTLSService.CalculateRentPriceInEtherAsync(ourName, durationInDays);

            Assert.True(price > 0);

            var commitment = await ethTLSService.CalculateCommitmentAsync(ourName, owner, secret);

            Assert.Equal("0x546d078db03381f4a33a33600cf1b91e00815b572c944f4a19624c8d9aaa9c14", commitment.ToHex(true));
        }
예제 #5
0
        public async void ShouldBeAbleToCalculateRentPriceAndCommitment()
        {
            var durationInDays = 365;
            var ourName        = "supersillynameformonkeys";
            var tls            = "eth";
            var owner          = "0x12890D2cce102216644c59daE5baed380d84830c";
            var secret         = "animals in the forest";


            var web3          = _ethereumClientIntegrationFixture.GetInfuraWeb3(InfuraNetwork.Mainnet);
            var ethTLSService = new EthTLSService(web3);
            await ethTLSService.InitialiseAsync();

            var price = await ethTLSService.CalculateRentPriceInEtherAsync(ourName, durationInDays);

            Assert.True(price > 0);

            var commitment = await ethTLSService.CalculateCommitmentAsync(ourName, owner, secret);

            Assert.Equal("0x546d078db03381f4a33a33600cf1b91e00815b572c944f4a19624c8d9aaa9c14", commitment.ToHex(true));
        }
예제 #6
0
        public async void ShouldBeAbleToRegisterExample()
        {
            var durationInDays = 365;
            var ourName        = "lllalalalal"; //enter owner name
            var tls            = "eth";
            var owner          = "0x111F530216fBB0377B4bDd4d303a465a1090d09d";
            var secret         = "Today is gonna be the day That theyre gonna throw it back to you"; //make your own


            var web3          = new Web3.Web3(new Account(""), "https://mainnet.infura.io/v3/7238211010344719ad14a89db874158c");
            var ethTLSService = new EthTLSService(web3);
            await ethTLSService.InitialiseAsync();

            var price = await ethTLSService.CalculateRentPriceInEtherAsync(ourName, durationInDays);

            Assert.True(price > 0);

            var commitment = await ethTLSService.CalculateCommitmentAsync(ourName, owner, secret);

            var commitTransactionReceipt = await ethTLSService.CommitRequestAndWaitForReceiptAsync(commitment);

            var txnHash = await ethTLSService.RegisterRequestAsync(ourName, owner, durationInDays, secret, price);
        }
예제 #7
0
        public async void ShouldBeAbleToRegisterExample()
        {
            var durationInDays = 365;
            var ourName        = "lllalalalal"; //enter owner name
            var tls            = "eth";
            var owner          = "0x111F530216fBB0377B4bDd4d303a465a1090d09d";
            var secret         = "Today is gonna be the day That theyre gonna throw it back to you"; //make your own


            var web3          = _ethereumClientIntegrationFixture.GetInfuraWeb3(InfuraNetwork.Mainnet);
            var ethTLSService = new EthTLSService(web3);
            await ethTLSService.InitialiseAsync();

            var price = await ethTLSService.CalculateRentPriceInEtherAsync(ourName, durationInDays);

            Assert.True(price > 0);

            var commitment = await ethTLSService.CalculateCommitmentAsync(ourName, owner, secret);

            var commitTransactionReceipt = await ethTLSService.CommitRequestAndWaitForReceiptAsync(commitment);

            var txnHash = await ethTLSService.RegisterRequestAsync(ourName, owner, durationInDays, secret, price);
        }