Esempio n. 1
0
        static long?CreateNFT(string nftName, string nftUrl, string metadataHash)
        {
            if (act.Address.ToString() != reliableAddress)
            {
                Console.WriteLine("只有可信赖的地址生成的NFT会被本程序识别!");
                return(0);
            }

            var transParams = algodApiInstance.TransactionParams();

            // Create the Asset
            // Total number of this asset available for circulation
            //var ap = new AssetParams(creator: act.Address.ToString(), name: nftName, unitName: "NFT", total: 1,
            //    decimals: 0, url: nftUrl, metadataHash: Encoding.ASCII.GetBytes(metadataHash))
            var ap = new AssetParams(creator: act.Address.ToString(), name: nftName, unitName: "NFT", total: 1,
                                     decimals: 0, url: nftUrl,
                                     metadataHash: Encoding.ASCII.GetBytes(StrToHexByte(metadataHash.Substring(0, 48))));

            var tx = Utils.GetCreateAssetTransaction(ap, transParams, "NFT creation transaction");

            // Sign the Transaction by sender
            SignedTransaction signedTx = act.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            long?assetID = 0;

            try
            {
                var id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id);
                Console.WriteLine("Confirmed Round is: " +
                                  Utils.WaitTransactionToComplete(algodApiInstance, id.TxId).ConfirmedRound);
                // Now that the transaction is confirmed we can get the assetID
                var ptx = algodApiInstance.PendingTransactionInformation(id.TxId);
                assetID = ptx.AssetIndex;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                return(0);
            }
            Console.WriteLine("AssetID = " + assetID);
            // now the asset already created
            return(assetID);
        }
Esempio n. 2
0
        /// <summary>
        /// Count the element in each file
        /// </summary>
        /// <param name="revitDoc"></param>
        /// <param name="assetParams"></param>
        /// <param name="results"></param>
        internal static void ExtractAssets(Document revitDoc, AssetParams assetParams, ref AssetCollection assets)
        {
            if (assetParams.DuctTerminal)
            {
                Console.WriteLine("Extract DuctTerminal...");
                FilteredElementCollector collector  = new FilteredElementCollector(revitDoc);
                ICollection <Element>    collection = collector.OfClass(typeof(FamilyInstance))
                                                      .OfCategory(BuiltInCategory.OST_DuctTerminal)
                                                      .ToElements();

                int index = 1;
                foreach (var element in collection)
                {
                    AssetInfo asset = new AssetInfo();
                    // those values are just for showcase, in real case, please get these value from proper parameters
                    asset.Id         = @"DuctTerminal-" + index;
                    asset.CategoryId = element.Category.Name;
                    // TBD: StatusId is fixed at this momentent
                    asset.StatusId    = "Specified";
                    asset.Description = element.Name;
                    asset.Barcode     = element.UniqueId;


                    FamilyInstance instance = element as FamilyInstance;
                    FamilySymbol   symbol   = instance.Symbol;
                    if (symbol != null)
                    {
                        Parameter manufacturer = symbol.get_Parameter(BuiltInParameter.ALL_MODEL_MANUFACTURER);

                        asset.Manufacturer = (manufacturer != null)? manufacturer.AsString() : "Not Specified";

                        Parameter model = symbol.get_Parameter(BuiltInParameter.ALL_MODEL_MODEL);
                        asset.Model = (model != null) ? model.AsString() : "Not Specified";
                    }
                    assets.AssetList.Add(asset);

                    index++;
                }
            }

            String[] paths = Directory.GetCurrentDirectory().Split('\\');
            assets.Workitem = paths[paths.Length - 1];
            Console.WriteLine(assets.AssetList.ToString());
            Console.WriteLine(assets.Workitem);
        }
Esempio n. 3
0
        /// <summary>
        /// count the elements depends on the input parameter in params.json
        /// </summary>
        /// <param name="rvtApp"></param>
        /// <param name="inputModelPath"></param>
        /// <param name="doc"></param>
        /// <returns></returns>
        public static bool ExportAssetsInModel(Application rvtApp, string inputModelPath, Document doc)
        {
            if (rvtApp == null)
            {
                return(false);
            }

            if (!File.Exists(inputModelPath))
            {
                return(false);
            }

            if (doc == null)
            {
                return(false);
            }

            Console.WriteLine("Start to execute the job");

            // For CountIt workItem: If RvtParameters is null, count all types
            AssetParams     assetParams = AssetParams.Parse("params.json");
            AssetCollection assets      = new AssetCollection();

            List <Document> allDocs = GetHostAndLinkDocuments(doc);

            foreach (Document curDoc in allDocs)
            {
                Console.WriteLine(@"Start to handle Document" + curDoc.PathName);
                ExtractAssets(curDoc, assetParams, ref assets);
            }

            using (StreamWriter sw = File.CreateText("result.json"))
            {
                sw.WriteLine(JsonConvert.SerializeObject(assets));
                sw.Close();
            }

            Console.WriteLine("Finished to execute the job");

            return(true);
        }
Esempio n. 4
0
        public static void RenderInput_bk(Asset asset, InputContext context)
        {
            //------------------------------------
            // Global
            //------------------------------------
            Dictionary<string, string> dicSiteType = new Dictionary<string, string>();
            dicSiteType.Add("Single Site", "single");
            dicSiteType.Add("Site Collection", "collection");
            dicSiteType.Add("Site Collection with TMF", "collection_tmf");

            Dictionary<string, string> dicMobile = new Dictionary<string, string>();
            dicMobile.Add("None", "no");
            dicMobile.Add("Responsive", "responsive");
            dicMobile.Add("Dual Output", "dual_output");
            dicMobile.Add("Dedicated", "dedicated");

            Dictionary<string, string> dicSelectOptions = new Dictionary<string, string>();
            dicSelectOptions.Add("Dropdown", "dropdown");
            dicSelectOptions.Add("Create New", "create_new");

            ShowAcquireParams sapModel = new ShowAcquireParams();
            sapModel.DefaultFolder = "/System/Models/";
            sapModel.ShowUpload = false;

            //Country data
            FilterParams fpCountry = new FilterParams();
            fpCountry.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Country Sites Config");
            Asset aCountryFolder = Asset.Load("/System/Translation Model Framework/Global/Country Sites Config/");
            Dictionary<string, string> dicCountries = new Dictionary<string, string>();
            if (aCountryFolder.IsLoaded)
            {
                foreach (Asset aFile in aCountryFolder.GetFilterList(fpCountry))
                {
                    if (!dicCountries.Keys.Contains(aFile.Label))
                    {
                        dicCountries.Add(aFile.Label, aFile.Label);
                    }
                }
            }

            //Language Data
            FilterParams fpLanguage = new FilterParams();
            fpLanguage.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Language");
            Asset aLanguageFolder = Asset.Load("/System/Translation Model Framework/Global/Languages Config/");
            Dictionary<string, string> dicLanguages = new Dictionary<string, string>();
            if (aLanguageFolder.IsLoaded)
            {
                foreach (Asset aFile in aLanguageFolder.GetFilterList(fpLanguage))
                {
                    if (!dicLanguages.Keys.Contains(aFile.Label))
                    {
                        dicLanguages.Add(aFile.Label, aFile.Label);
                    }
                }
            }

            //CP public sites
            Dictionary<string, string> dicCPSites = new Dictionary<string, string>();
            string szPublicSiteXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-public/site-list.xml");
            if (szPublicSiteXML.Contains("<sites>"))
            {
                List<XmlNode> lsXml = Util.LoadXml(szPublicSiteXML, "file");
                foreach (XmlNode xNode in lsXml)
                {
                    dicCPSites.Add(xNode.Attributes["name"], xNode.Value);
                }
            }

            //CP Training
            Dictionary<string, string> dicCPTraining = new Dictionary<string, string>();
            string szTrainingXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-training/site-list.xml");
            if (szTrainingXML.Contains("<sites>"))
            {
                List<XmlNode> lsXml = Util.LoadXml(szTrainingXML, "file");
                foreach (XmlNode xNode in lsXml)
                {
                    dicCPTraining.Add(xNode.Attributes["name"], xNode.Value);
                }
            }

            //Partner Private sites
            Dictionary<string, string> dicPrivateSites = new Dictionary<string, string>();
            if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"]))
            {
                string szPrivateSiteXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/partner/" + asset.Raw["private_key"] + "/site-list.xml");
                if (szPrivateSiteXML.Contains("<sites>"))
                {
                    List<XmlNode> lsXml = Util.LoadXml(szPrivateSiteXML, "file");
                    foreach (XmlNode xNode in lsXml)
                    {
                        dicPrivateSites.Add(xNode.Attributes["name"], xNode.Value);
                    }
                }
            }

            //------------------------------------
            // Input Form
            //------------------------------------
            Input.StartTabbedPanel("Import Setup", "Configuration");
            //Input.ShowRadioButton("Technology Stacks", "language_type", new Dictionary<string, string> { { "HTML", "html" }, { "NET", "net" }, { "PHP(Coming Soon)", "" }, { "Java(Coming Soon)", "" } }, "html");

            Input.StartDropDownContainer("Technology List Options", "technology_list_option", new Dictionary<string, string>() { { "CP Public", "public" }, { "CP Training", "training" }, { "Private", "private" } }, "public");
            //-----------------------------------------
            // CP Public Sites
            //-----------------------------------------
            Input.ShowDropDown("CrownPeak Technology Stacks", "cp_language_type", dicCPSites);

            Input.ShowDropDown("Create in a separate project", "new_project", new Dictionary<string, string>() { { "Yes", "yes" }, { "No", "no" } }, Util.MakeList("yes"));

            //TMF
            Input.StartDropDownContainer("Site Type", "site_type_option", dicSiteType, "single");
            //Single Site
            Input.ShowMessage("Creates a single site");
            Input.ShowTextBox("Site Name", "single_site_name");

            Input.ShowHeader("Mobile");
            Input.ShowCheckBox("", "single_site_mobile", "true", "Dual Output", "Creates output_mobile.aspx within the template", "", false);

            Input.ShowHeader("Extension");
            Input.StartHorizontalWrapContainer();
            Input.ShowCheckBox("", "single_site_module_blog", "true", "Blog(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.ShowCheckBox("", "single_site_module_release", "true", "Release Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.ShowCheckBox("", "single_site_module_metadata", "true", "Metadata Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.EndHorizontalWrapContainer();
            Input.NextDropDownContainer();
            //Site Collection
            Input.ShowMessage("Creates collection of sites with their own templates and models");
            Input.ShowTextBox("Collection Name", "collection_name");
            while (Input.NextPanel("collection_panel", displayName: "Site List"))
            {
                Input.ShowTextBox("Site Name", "collection_site_name");

                Input.ShowHeader("Mobile");
                Input.ShowCheckBox("", "collection_site_mobile", "true", "Dual Output", "Creates output_mobile.aspx within the template", "", false);

                Input.ShowHeader("Extension");
                Input.StartHorizontalWrapContainer();
                Input.ShowCheckBox("", "collection_site_module_blog", "true", "Blog(Coming Soon)", unCheckedValue: "", defaultChecked: false);
                Input.ShowCheckBox("", "collection_site_module_release", "true", "Release Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
                Input.ShowCheckBox("", "collection_site_module_metadata", "true", "Metadata Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
                Input.EndHorizontalWrapContainer();
            }
            Input.NextDropDownContainer();
            //Site Collection with TMF
            Input.ShowMessage("Creates collection of sites with TMF. Templates are shared");
            Input.ShowTextBox("Site Name", "collection_tmf_name");

            Input.ShowHeader("Mobile");
            Input.ShowCheckBox("", "collection_tmf_mobile", "true", "Dual Output", "Creates output_mobile.aspx within the template", "", false);

            Input.ShowHeader("Extension");
            Input.StartHorizontalWrapContainer();
            Input.ShowCheckBox("", "collection_tmf_module_blog", "true", "Blog(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.ShowCheckBox("", "collection_tmf_module_release", "true", "Release Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.ShowCheckBox("", "collection_tmf_module_metadata", "true", "Metadata Management(Coming Soon)", unCheckedValue: "", defaultChecked: false);
            Input.EndHorizontalWrapContainer();

            while (Input.NextPanel("tmf_panel", displayName: "TMF List"))
            {
                Input.ShowCheckBox("", "master_site", "true", "Master Site", unCheckedValue: "false", defaultChecked: false);

                Input.StartHorizontalWrapContainer();
                Input.StartDropDownContainer("Country Select", "tmf_country_option", dicSelectOptions, "dropdown");
                Input.ShowDropDown("Country", "tmf_country_select", dicCountries);
                Input.NextDropDownContainer();
                Input.ShowTextBox("Country Name", "new_country_name", width: 30, helpMessage: "United States, England, etc");
                Input.EndDropDownContainer();

                Input.StartDropDownContainer("Language Select", "tmf_language_option", dicSelectOptions, "dropdown");
                Input.ShowDropDown("Language", "tmf_lang_select", dicLanguages);
                Input.NextDropDownContainer();
                Input.ShowTextBox("Language Name", "new_language_name", width: 30, helpMessage: "English, Spanish, etc");
                Input.EndDropDownContainer();
                Input.EndHorizontalWrapContainer();

                Input.ShowTextBox("Locale Name", "locale_name", helpMessage: "US-EN, AR-ES, etc");
            }
            Input.EndDropDownContainer();

            Input.NextDropDownContainer();
            //-----------------------------
            // CP Training Sites
            //-----------------------------
            Input.ShowDropDown("Training Technology Stacks", "training_language_type", dicCPTraining);
            Input.ShowDropDown("Project Level", "project_level", new Dictionary<string, string> { { "Root", "root" }, { "Nested", "nested" }, { "System", "system" } }, Util.MakeList("root"));

            Input.StartDropDownContainer("Collection Folder", "collection_folder_type", new Dictionary<string, string> { { "New", "new" }, { "Select", "select" } }, "new");
            Input.ShowTextBox("New Folder", "collection_new");
            Input.NextDropDownContainer();
            Input.ShowSelectFolder("Select", "collection_select");
            Input.EndDropDownContainer();

            Input.ShowTextBox("Site Root Name", "site_root_name");
            Input.ShowTextBox("Project Name", "project_name");
            Input.NextDropDownContainer();
            //-----------------------------
            // Partner Private Folder
            //-----------------------------
            if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"]))
            {
                Input.ShowDropDown("Private Technology Stacks", "private_language_type", dicPrivateSites);
                Input.AddHiddenField("private_language_exist", "true");
            }
            else
            {
                Input.AddHiddenField("private_language_exist", "false");
                Input.ShowMessage("Enter private key in Configuration tab, save and refesh the form");
                Input.ShowMessage("Ask CrownPeak support how to set up a private key");
            }
            Input.EndDropDownContainer();

            Input.StartControlPanel("Workflow");
            Dictionary<string, string> dicWorkflow = new Dictionary<string, string>();
            AssetParams apWorkflow = new AssetParams();
            apWorkflow.ExcludeProjectTypes = false;
            foreach (Asset aWorkflow in Asset.Load("/System/Workflows/").GetFileList(apWorkflow))
            {
                dicWorkflow.Add(aWorkflow.Label, aWorkflow.Label);
            }
            //Input.ShowTextBox("Workflow Name", "workflow_name", helpMessage: "Leaving blank will create assets without any workflow");
            Input.ShowDropDown("Workflow", "workflow_name", dicWorkflow);
            Input.EndControlPanel();

            /*
            //Mobile
            Input.StartDropDownContainer("Mobile", "include_mobile", dicMobile, "no");
            Input.NextDropDownContainer();
            //Responsive
                Input.ShowMessage("Responsive Mobile");
            Input.NextDropDownContainer();
            //Dual output
                Input.ShowMessage("Dual output shares one input template");
            Input.NextDropDownContainer();
            //Dedicated
                Input.ShowMessage("Dedicated mobile has separate templates and models");
            Input.EndDropDownContainer();
            */
            //Input.NextTabbedPanel();
            //    Input.ShowAcquireDocument("Developer Model", "model_developer", sapModel);
            //    Input.ShowAcquireDocument("File Model", "model_file", sapModel);
            //    Input.ShowAcquireDocument("Folder Model", "model_folder", sapModel);
            //    Input.ShowTextBox("Workflow Name", "workflow_name");

            Input.NextTabbedPanel();
            Input.ShowMessage("Enter private key, save and refesh the form");
            Input.ShowTextBox("Private Site Key", "private_key");
            Input.EndTabbedPanel();
        }
Esempio n. 5
0
        public static void RenderInput(Asset asset, InputContext context)
        {
            //------------------------------------
            // Global
            //------------------------------------
            Dictionary<string, string> dicSiteType = new Dictionary<string, string>();
            dicSiteType.Add("Single Site", "single");
            dicSiteType.Add("Site Collection", "collection");
            dicSiteType.Add("Site Collection with TMF", "collection_tmf");

            Dictionary<string, string> dicMobile = new Dictionary<string, string>();
            dicMobile.Add("None", "no");
            dicMobile.Add("Responsive", "responsive");
            dicMobile.Add("Dual Output", "dual_output");
            dicMobile.Add("Dedicated", "dedicated");

            Dictionary<string, string> dicSelectOptions = new Dictionary<string, string>();
            dicSelectOptions.Add("Dropdown", "dropdown");
            dicSelectOptions.Add("Create New", "create_new");

            ShowAcquireParams sapModel = new ShowAcquireParams();
            sapModel.DefaultFolder = "/System/Models/";
            sapModel.ShowUpload = false;

            //Country data
            FilterParams fpCountry = new FilterParams();
            fpCountry.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Country Sites Config");
            Asset aCountryFolder = Asset.Load("/System/Translation Model Framework/Global/Country Sites Config/");
            Dictionary<string, string> dicCountries = new Dictionary<string, string>();
            if (aCountryFolder.IsLoaded)
            {
                foreach (Asset aFile in aCountryFolder.GetFilterList(fpCountry))
                {
                    if (!dicCountries.Keys.Contains(aFile.Label))
                    {
                        dicCountries.Add(aFile.Label, aFile.Label);
                    }
                }
            }

            //Language Data
            FilterParams fpLanguage = new FilterParams();
            fpLanguage.Add(AssetPropertyNames.TemplateLabel, Comparison.Equals, "Language");
            Asset aLanguageFolder = Asset.Load("/System/Translation Model Framework/Global/Languages Config/");
            Dictionary<string, string> dicLanguages = new Dictionary<string, string>();
            if (aLanguageFolder.IsLoaded)
            {
                foreach (Asset aFile in aLanguageFolder.GetFilterList(fpLanguage))
                {
                    if (!dicLanguages.Keys.Contains(aFile.Label))
                    {
                        dicLanguages.Add(aFile.Label, aFile.Label);
                    }
                }
            }

            //CP public sites
            Dictionary<string, string> dicCPSites = new Dictionary<string, string>();
            string szPublicSiteXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-public/site-list.xml");
            if (szPublicSiteXML.Contains("<sites>"))
            {
                List<XmlNode> lsXml = Util.LoadXml(szPublicSiteXML, "file");
                foreach (XmlNode xNode in lsXml)
                {
                    dicCPSites.Add(xNode.Attributes["name"], xNode.Value);
                }
            }

            //CP Training
            Dictionary<string, string> dicCPTraining = new Dictionary<string, string>();
            string szTrainingXML = GetPageSource("http://mtistage.cp-access.com/sitebuilder/cp-training/site-list.xml");
            if (szTrainingXML.Contains("<sites>"))
            {
                List<XmlNode> lsXml = Util.LoadXml(szTrainingXML, "file");
                foreach (XmlNode xNode in lsXml)
                {
                    dicCPTraining.Add(xNode.Attributes["name"], xNode.Value);
                }
            }

            //Partner Private sites
            Dictionary<string, string> dicPrivateSites = new Dictionary<string, string>();
            if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"]))
            {
                string szPrivateSiteXML = GetPageSource(asset.Raw["private_key"]);
                if (szPrivateSiteXML.Contains("<sites>"))
                {
                    List<XmlNode> lsXml = Util.LoadXml(szPrivateSiteXML, "file");
                    foreach (XmlNode xNode in lsXml)
                    {
                        dicPrivateSites.Add(xNode.Attributes["name"], xNode.Value);
                    }
                }
            }

            //------------------------------------
            // Input Form
            //------------------------------------
            Input.StartTabbedPanel("Import Setup", "Configuration");

            string szLog = GetPageSource("http://mtistage.cp-access.com/SiteBuilder/Import-Log.xml");
            if (!string.IsNullOrWhiteSpace(szLog))
            {
                Input.StartControlPanel("Log");
                Input.ShowTextBox("", "log_message", szLog, height: 20, readOnly: true);
                Input.EndControlPanel();
            }

            Input.StartDropDownContainer("Site Builder Type", "sitebuilder_type", new Dictionary<string, string> { { "Build Site", "site_build" }, { "Add Extension", "site_extension" } });

                Input.StartDropDownContainer("Technology List Options", "technology_list_option", new Dictionary<string, string>() { { "CP Public", "public" }, { "CP Training", "training" }, { "Private", "private" }, { "Local", "local" } }, "public");
                //-----------------------------------------
                // CP Public Sites
                //-----------------------------------------
                    Input.ShowDropDown("CrownPeak Technology Stacks", "cp_language_type", dicCPSites);

                Input.NextDropDownContainer();
                //-----------------------------
                // CP Training Sites
                //-----------------------------
                    Input.ShowDropDown("Training Technology Stacks", "training_language_type", dicCPTraining);

                Input.NextDropDownContainer();
                //-----------------------------
                // Partner Private Folder
                //-----------------------------
                    if (!string.IsNullOrWhiteSpace(asset.Raw["private_key"]))
                    {
                        Input.ShowDropDown("Private Technology Stacks", "private_language_type", dicPrivateSites);
                        Input.AddHiddenField("private_language_exist", "true");
                    }
                    else
                    {
                        Input.AddHiddenField("private_language_exist", "false");
                        Input.ShowMessage("Enter private key in Configuration tab, save and refesh the form");
                        Input.ShowMessage("Ask CrownPeak support how to set up a private key");
                    }
                //-----------------------------
                // Local File
                //-----------------------------
                Input.NextDropDownContainer();
                    Input.ShowAcquireDocument("Select a File", "local_file", helpMessage: "Select a local XML file");
                Input.EndDropDownContainer();

                //-----------------------------
                // Site Structure Setting
                //-----------------------------
                Input.ShowDropDown("Project Level", "project_level", new Dictionary<string, string> { { "Root", "root" }, { "Nested", "nested" }, { "System", "system" } }, Util.MakeList("root"));

                Input.StartDropDownContainer("Collection Folder", "collection_folder_type", new Dictionary<string, string> { { "New", "new" }, { "Select", "select" } }, "new");
                Input.ShowTextBox("New Folder", "collection_new");
                Input.NextDropDownContainer();
                Input.ShowSelectFolder("Select", "collection_select");
                Input.EndDropDownContainer();

                Input.ShowTextBox("Site Root Name", "site_root_name");
                Input.ShowTextBox("Project Name", "project_name");

            //-----------------------------
            // Add Extension
            //-----------------------------
            Input.NextDropDownContainer();
                Dictionary<string, string> dicExtensionTypes = new Dictionary<string, string>();
                dicExtensionTypes.Add("TMF", "ext_tmf");
                dicExtensionTypes.Add("Blog", "ext_blog");
                dicExtensionTypes.Add("Release management", "ext_release_management");
                dicExtensionTypes.Add("Metadata Management", "ext_metadata_management");
                dicExtensionTypes.Add("Deep Clone Site", "ext_deep_clone");
                dicExtensionTypes.Add("Clone and Convert", "ext_clone_convert");

                Input.StartDropDownContainer("Extension Type", "extension_types", dicExtensionTypes);
                    Input.ShowSelectFolder("Project Folder", "tmf_project_folder", "/", helpMessage: "Skip if the site doesn't use any Project folder");
                    Input.StartControlPanel("Master Site");
                        Input.StartHorizontalWrapContainer();
                        Input.StartDropDownContainer("Country Select", "tmf_master_country_option", dicSelectOptions, "dropdown");
                        Input.ShowDropDown("Country", "tmf_master_country_select", dicCountries);
                        Input.NextDropDownContainer();
                        Input.ShowTextBox("Country Name", "new_master_country_name", width: 30, helpMessage: "United States, England, etc");
                        Input.EndDropDownContainer();

                        Input.StartDropDownContainer("Language Select", "tmf_master_language_option", dicSelectOptions, "dropdown");
                        Input.ShowDropDown("Language", "tmf_master_lang_select", dicLanguages);
                        Input.NextDropDownContainer();
                        Input.ShowTextBox("Language Name", "new_master_language_name", width: 30, helpMessage: "English, Spanish, etc");
                        Input.EndDropDownContainer();
                        Input.EndHorizontalWrapContainer();

                        Input.ShowSelectFolder("Main Site", "tmf_master_main_site", "/");
                        Input.ShowTextBox("Rename Main Site", "tmf_master_main_site_rename");
                    Input.EndControlPanel();
                    while (Input.NextPanel("tmf_locale_panel", displayName: "Locale List"))
                    {
                        Input.StartHorizontalWrapContainer();
                        Input.StartDropDownContainer("Country Select", "tmf_country_option", dicSelectOptions, "dropdown");
                        Input.ShowDropDown("Country", "tmf_country_select", dicCountries);
                        Input.NextDropDownContainer();
                        Input.ShowTextBox("Country Name", "new_country_name", width: 30, helpMessage: "United States, England, etc");
                        Input.EndDropDownContainer();

                        Input.StartDropDownContainer("Language Select", "tmf_language_option", dicSelectOptions, "dropdown");
                        Input.ShowDropDown("Language", "tmf_lang_select", dicLanguages);
                        Input.NextDropDownContainer();
                        Input.ShowTextBox("Language Name", "new_language_name", width: 30, helpMessage: "English, Spanish, etc");
                        Input.EndDropDownContainer();
                        Input.EndHorizontalWrapContainer();

                        Input.ShowTextBox("Locale Name", "locale_name", helpMessage: "US-EN, AR-ES, etc");
                    }

                Input.NextDropDownContainer();
                Input.NextDropDownContainer();
                Input.NextDropDownContainer();
                Input.NextDropDownContainer();
                Input.NextDropDownContainer();
                Input.EndDropDownContainer();

            Input.EndDropDownContainer();

            Input.StartControlPanel("Workflow");
            Dictionary<string, string> dicWorkflow = new Dictionary<string, string>();
            AssetParams apWorkflow = new AssetParams();
            apWorkflow.ExcludeProjectTypes = false;
            foreach (Asset aWorkflow in Asset.Load("/System/Workflows/").GetFileList(apWorkflow))
            {
                if (!dicWorkflow.Keys.Contains(aWorkflow.Label))
                    dicWorkflow.Add(aWorkflow.Label, aWorkflow.Label);
            }
                //Input.ShowTextBox("Workflow Name", "workflow_name", helpMessage: "Leaving blank will create assets without any workflow");
                Input.ShowDropDown("Workflow", "workflow_name", dicWorkflow);
            Input.EndControlPanel();

            Input.NextTabbedPanel();
                Input.ShowMessage("Enter private key, save and refesh the form");
                Input.ShowTextBox("Private Site Key", "private_key");
            Input.EndTabbedPanel();
        }
Esempio n. 6
0
        // Utility function for sending a raw signed transaction to the network
        public static void Main(params string[] args) //throws Exception
        {
            string algodApiAddrTmp = args[0];

            if (algodApiAddrTmp.IndexOf("//") == -1)
            {
                algodApiAddrTmp = "http://" + algodApiAddrTmp;
            }

            string ALGOD_API_ADDR  = algodApiAddrTmp;
            string ALGOD_API_TOKEN = args[1];

            AlgodApi algodApiInstance = new AlgodApi(ALGOD_API_ADDR, ALGOD_API_TOKEN);

            // Shown for demonstration purposes. NEVER reveal secret mnemonics in practice.
            // These three accounts are for testing purposes
            string account1_mnemonic = "portion never forward pill lunch organ biology"
                                       + " weird catch curve isolate plug innocent skin grunt"
                                       + " bounce clown mercy hole eagle soul chunk type absorb trim";
            string account2_mnemonic = "place blouse sad pigeon wing warrior wild script"
                                       + " problem team blouse camp soldier breeze twist mother"
                                       + " vanish public glass code arrow execute convince ability"
                                       + " there";
            string account3_mnemonic = "image travel claw climb bottom spot path roast "
                                       + "century also task cherry address curious save item "
                                       + "clean theme amateur loyal apart hybrid steak about blanket";

            Account acct1 = new Account(account1_mnemonic);
            Account acct2 = new Account(account2_mnemonic);
            Account acct3 = new Account(account3_mnemonic);
            // get last round and suggested tx fee
            // We use these to get the latest round and tx fees
            // These parameters will be required before every
            // Transaction
            // We will account for changing transaction parameters
            // before every transaction in this example
            var transParams = algodApiInstance.TransactionParams();

            // The following parameters are asset specific
            // and will be re-used throughout the example.

            // Create the Asset
            // Total number of this asset available for circulation
            var ap = new AssetParams(creator: acct1.Address.ToString(), name: "latikum22", unitName: "LAT", total: 10000,
                                     decimals: 0, url: "http://this.test.com", metadataHash: Encoding.ASCII.GetBytes("16efaa3924a6fd9d3a4880099a4ac65d"))
            {
                Manager = acct2.Address.ToString()
            };

            // Specified address can change reserve, freeze, clawback, and manager
            // you can leave as default, by default the sender will be manager/reserve/freeze/clawback
            // the following code only set the freeze to acct1
            var tx = Utils.GetCreateAssetTransaction(ap, transParams, "asset tx message");

            // Sign the Transaction by sender
            SignedTransaction signedTx = acct1.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            long?assetID = 0;

            try
            {
                var id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // Now that the transaction is confirmed we can get the assetID
                var ptx = algodApiInstance.PendingTransactionInformation(id.TxId);
                assetID = ptx.AssetIndex;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                return;
            }
            Console.WriteLine("AssetID = " + assetID);
            // now the asset already created


            // Change Asset Configuration:
            // Next we will change the asset configuration
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            Asset ast = algodApiInstance.GetAssetByID(assetID);

            // Note that configuration changes must be done by
            // The manager account, which is currently acct2
            // Note in this transaction we are re-using the asset
            // creation parameters and only changing the manager
            // and transaction parameters like first and last round
            // now update the manager to acct1
            ast.Params.Manager = acct1.Address.ToString();
            tx = Utils.GetConfigAssetTransaction(acct2.Address, ast, transParams, "config trans");

            // The transaction must be signed by the current manager account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct2.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                var id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id.TxId);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
            }
            catch (Exception e)
            {
                //e.printStackTrace();
                Console.WriteLine(e.Message);
                return;
            }

            // Next we will list the newly created asset
            // Get the asset information for the newly changed asset
            ast = algodApiInstance.GetAssetByID(assetID);
            //The manager should now be the same as the creator
            Console.WriteLine(ap);



            // Opt in to Receiving the Asset
            // Opting in to transact with the new asset
            // All accounts that want recieve the new asset
            // Have to opt in. To do this they send an asset transfer
            // of the new asset to themseleves with an ammount of 0
            // In this example we are setting up the 3rd recovered account to
            // receive the new asset
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            tx          = Utils.GetAssetOptingInTransaction(acct3.Address, assetID, transParams, "opt in transaction");

            // The transaction must be signed by the current manager account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct3.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            Algorand.V2.Model.Account act = null;
            try
            {
                var id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id.TxId);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct3
                // and see that it can accept the new asseet
                act = algodApiInstance.AccountInformation(acct3.Address.ToString());
                Console.WriteLine(act);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }

            // Transfer the Asset:
            // Now that account3 can recieve the new asset
            // we can tranfer assets in from the creator
            // to account3
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            // Next we set asset xfer specific parameters
            // We set the assetCloseTo to null so we do not close the asset out
            Address assetCloseTo = new Address();
            ulong   assetAmount  = 10;

            tx = Utils.GetTransferAssetTransaction(acct1.Address, acct3.Address, assetID, assetAmount, transParams, null, "transfer message");
            // The transaction must be signed by the sender account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct1.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                var id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id.TxId);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct3
                // and see that it now has 5 of the new asset
                act = algodApiInstance.AccountInformation(acct3.Address.ToString());
                Console.WriteLine(act.Assets.Find(h => h.AssetId == assetID).Amount);
            }
            catch (Exception e)
            {
                //e.printStackTrace();
                Console.WriteLine(e.Message);
                return;
            }

            // Freeze the Asset:
            // The asset was created and configured to allow freezing an account
            // If the freeze address is blank, it will no longer be possible to do this.
            // In this example we will now freeze account3 from transacting with the
            // The newly created asset.
            // Thre freeze transaction is sent from the freeze acount
            // Which in this example is account2
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            // Next we set asset xfer specific parameters
            // The sender should be freeze account acct2
            // Theaccount to freeze should be set to acct3
            tx = Utils.GetFreezeAssetTransaction(acct2.Address, acct3.Address, assetID, true, transParams, "freeze transaction");
            // The transaction must be signed by the freeze account acct2
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct2.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                var id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id.TxId);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct3
                // and see that it now frozen
                // Note--currently no getter method for frozen state
                act = algodApiInstance.AccountInformation(acct3.Address.ToString());
                Console.WriteLine(act.Assets.Find(h => h.AssetId == assetID));
            }
            catch (Exception e)
            {
                //e.printStackTrace();
                Console.WriteLine(e.Message);
                return;
            }


            // Revoke the asset:
            // The asset was also created with the ability for it to be revoked by
            // clawbackaddress. If the asset was created or configured by the manager
            // not allow this by setting the clawbackaddress to a blank address
            // then this would not be possible.
            // We will now clawback the 10 assets in account3. Account2
            // is the clawbackaccount and must sign the transaction
            // The sender will be be the clawback adress.
            // the recipient will also be be the creator acct1 in this case
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            // Next we set asset xfer specific parameters
            assetAmount = 10;
            tx          = Utils.GetRevokeAssetTransaction(acct2.Address, acct3.Address, acct1.Address, assetID, assetAmount, transParams, "revoke transaction");
            // The transaction must be signed by the clawback account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct2.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                var id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct3
                // and see that it now has 0 of the new asset
                act = algodApiInstance.AccountInformation(acct3.Address.ToString());
                Console.WriteLine(act.Assets.Find(h => h.AssetId == assetID).Amount);
            }
            catch (Exception e)
            {
                //e.printStackTrace();
                Console.WriteLine(e.Message);
                return;
            }

            // Destroy the Asset:
            // All of the created assets should now be back in the creators
            // Account so we can delete the asset.
            // If this is not the case the asset deletion will fail
            // The address for the from field must be the creator
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            // Next we set asset xfer specific parameters
            // The manager must sign and submit the transaction
            // This is currently set to acct1
            tx = Utils.GetDestroyAssetTransaction(acct1.Address, assetID, transParams, "destroy transaction");
            // The transaction must be signed by the manager account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct1.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                var id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id);
                //waitForTransactionToComplete(algodApiInstance, signedTx.transactionID);
                //Console.ReadKey();
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct1
                // and see that the asset is no longer there
                act = algodApiInstance.AccountInformation(acct1.Address.ToString());
                //Console.WriteLine("Does AssetID: " + assetID + " exist? " +
                //    act.Thisassettotal.ContainsKey(assetID));
            }
            catch (Exception e)
            {
                //e.printStackTrace();
                Console.WriteLine(e.Message);
                return;
            }
            Console.WriteLine("You have successefully arrived the end of this test, please press and key to exist.");
            Console.ReadKey();
        }
Esempio n. 7
0
        private async void CreateAsset_click(System.Object sender, System.EventArgs e)
        {
            CreateAsset.Opacity = .2;
            HtmlWebViewSource htmlSource = new HtmlWebViewSource();

            var transParams = algodApiInstance.TransactionParams();

            // The following parameters are asset specific
            // and will be re-used throughout the example.

            // Create the Asset
            // Total number of this asset available for circulation = 10000

            var ap = new AssetParams(creator: account1.Address.ToString(),
                                     name: "latikum22",
                                     unitName: "LAT", defaultFrozen: false, total: 10000,
                                     decimals: 0, url: "http://this.test.com",
                                     metadataHash: Encoding.ASCII.GetBytes("16efaa3924a6fd9d3a4880099a4ac65d"))
            {
                Manager = account2.Address.ToString()
            };

            // Specified address can change reserve, freeze, clawback, and manager
            // you can leave as default, by default the sender will be manager/reserve/freeze/clawback

            var tx = Utils.GetCreateAssetTransaction(ap, transParams, "asset tx message");

            // Sign the Transaction by sender
            SignedTransaction signedTx = account1.SignTransaction(tx);

            // send the transaction to the network and
            // wait for the transaction to be confirmed

            try
            {
                PostTransactionsResponse id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id.TxId);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // Now that the transaction is confirmed we can get the assetID
                var ptx = algodApiInstance.PendingTransactionInformation(id.TxId);
                assetID = ptx.AssetIndex;


                var assetIDstr = assetID.ToString();
                await SecureStorage.SetAsync(helper.StorageAssetIDName, assetIDstr);

                await SecureStorage.SetAsync(helper.StorageLastASAButton, "create");

                buttonstate("create");
                CreateAsset.Opacity = 1;
                var act = algodApiInstance.GetAssetByID(assetID).ToJson();
                //   var act = algodApiInstance.AssetInformation((long?)assetID).ToJson();

                htmlSource.Html = @"<html><body><h3>" + "AssetID = " + assetID.ToString() + "</h3>" +
                                  "<h3>" + "Asset Info = " + act.ToString() + "</h3>" +
                                  "</body></html>";

                myWebView.Source = htmlSource;
            }
            catch (Exception err)
            {
                Console.WriteLine(err.StackTrace);
                CreateAsset.Opacity = 1;
                htmlSource.Html     = @"<html><body><h3>" + "Error = " + err.Message + "</h3>" +
                                      "</body></html>";
                myWebView.Source = htmlSource;
                return;
            }
            Console.WriteLine("AssetID = " + assetID);
            // now the asset already created
        }
Esempio n. 8
0
        // Utility function for sending a raw signed transaction to the network
        public static void Run(params string[] args) //throws Exception
        {
            string   ALGOD_API_ADDR   = "https://testnet-algorand.api.purestake.io/ps1";
            string   ALGOD_API_TOKEN  = "GeHdp7CCGt7ApLuPNppXN4LtrW07Mm1kaFNJ5Ovr";
            AlgodApi algodApiInstance = new AlgodApi(ALGOD_API_ADDR, ALGOD_API_TOKEN);

            // 这三个账号只用于演示,在实际使用时永远不要直接将助记词放在代码中
            string account1_mnemonic = "portion never forward pill lunch organ biology"
                                       + " weird catch curve isolate plug innocent skin grunt"
                                       + " bounce clown mercy hole eagle soul chunk type absorb trim";
            string account2_mnemonic = "place blouse sad pigeon wing warrior wild script"
                                       + " problem team blouse camp soldier breeze twist mother"
                                       + " vanish public glass code arrow execute convince ability"
                                       + " there";
            string account3_mnemonic = "image travel claw climb bottom spot path roast "
                                       + "century also task cherry address curious save item "
                                       + "clean theme amateur loyal apart hybrid steak about blanket";

            Account acct1 = new Account(account1_mnemonic);
            Account acct2 = new Account(account2_mnemonic);
            Account acct3 = new Account(account3_mnemonic);
            // get last round and suggested tx fee
            // We use these to get the latest round and tx fees
            // These parameters will be required before every
            // Transaction
            // We will account for changing transaction parameters
            // before every transaction in this example
            var transParams = algodApiInstance.TransactionParams();

            // The following parameters are asset specific
            // and will be re-used throughout the example.

            // Create the Asset(创建ASA)
            // Total number of this asset available for circulation
            var ap = new AssetParams(creator: acct1.Address.ToString(), assetname: "latikum22",
                                     unitname: "LAT", defaultfrozen: false, total: 10000,
                                     url: "http://this.test.com", metadatahash: Convert.ToBase64String(
                                         Encoding.ASCII.GetBytes("16efaa3924a6fd9d3a4880099a4ac65d")))
            {
                // 每种地址的意义请参照https://developer.algorand.org/docs/features/asa/
                // 默认情况下manager/reserve/freeze/clawback账号都是sender
                // 如果设置了manager,其他没有设置的地址reserve/freeze/clawback都会是manager
                Managerkey   = acct1.Address.ToString(),
                Clawbackaddr = acct2.Address.ToString(),
                Freezeaddr   = acct1.Address.ToString(),
                Reserveaddr  = acct1.Address.ToString()
            };

            var tx = Utils.GetCreateAssetTransaction(ap, transParams, "asset tx message");

            // Sign the Transaction by sender
            SignedTransaction signedTx = acct1.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            ulong?assetID = 0;

            try
            {
                TransactionID id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // Now that the transaction is confirmed we can get the assetID
                Algorand.Algod.Client.Model.Transaction ptx = algodApiInstance.PendingTransactionInformation(id.TxId);
                assetID = ptx.Txresults.Createdasset;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.StackTrace);
                return;
            }
            Console.WriteLine("AssetID = " + assetID);
            // 现在ASA已经创建


            // 修改ASA的设置
            // Next we will change the asset configuration
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            ap          = algodApiInstance.AssetInformation((long?)assetID);

            // 修改ASA设置必须由manager账号执行,在本例是中acct2
            // Note in this transaction we are re-using the asset
            // creation parameters and only changing the manager
            // and transaction parameters like first and last round
            // now update the manager to acct1
            ap.Managerkey = acct2.Address.ToString();
            tx            = Utils.GetConfigAssetTransaction(acct1.Address, assetID, ap, transParams, "config trans");

            // The transaction must be signed by the current manager account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct1.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                TransactionID id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id.TxId);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
            }
            catch (Exception e)
            {
                //e.printStackTrace();
                Console.WriteLine(e.Message);
                return;
            }

            // Next we will list the newly created asset
            // Get the asset information for the newly changed asset
            ap = algodApiInstance.AssetInformation((long?)assetID);
            //The manager should now be the same as the creator
            Console.WriteLine(ap);


            // 激活(Opting in)某种ASA
            // 如果你需要给其他用户转ASA,那么对方必须先激活
            // 然后才能接收ASA
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            tx          = Utils.GetActivateAssetTransaction(acct3.Address, assetID, transParams, "opt in transaction");

            // The transaction must be signed by the current manager account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct3.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            Algorand.Algod.Client.Model.Account act = null;
            try
            {
                TransactionID id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id.TxId);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct3
                // and see that it can accept the new asseet
                act = algodApiInstance.AccountInformation(acct3.Address.ToString());
                Console.WriteLine(act);
            }
            catch (Exception e)
            {
                //e.printStackTrace();
                Console.WriteLine(e.Message);
                return;
            }

            // ASA转账
            // 激活后account3就可以接收ASA了
            // 现在我们从acctout1向account3转账
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            // Next we set asset xfer specific parameters
            // We set the assetCloseTo to null so we do not close the asset out
            ulong assetAmount = 10;

            tx = Utils.GetTransferAssetTransaction(acct1.Address, acct3.Address, assetID, assetAmount, transParams, null, "transfer message");
            // The transaction must be signed by the sender account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct1.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                TransactionID id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id.TxId);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct3
                // and see that it now has 5 of the new asset
                act = algodApiInstance.AccountInformation(acct3.Address.ToString());
                Console.WriteLine(act.GetHolding(assetID).Amount);
            }
            catch (Exception e)
            {
                //e.printStackTrace();
                Console.WriteLine(e.Message);
                return;
            }

            // 冻结资产
            // 如果freeze address当时没有设置,则无法冻结资产
            // 此例中冻结account3中的资产
            // 冻结事件须由freeze acount来发出,本例中为account1
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            // Next we set asset xfer specific parameters
            // The sender should be freeze account acct2
            // Theaccount to freeze should be set to acct3
            tx = Utils.GetFreezeAssetTransaction(acct1.Address, acct3.Address, assetID, true, transParams, "freeze transaction");
            // The transaction must be signed by the freeze account acct2
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct1.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                TransactionID id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id.TxId);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct3
                // and see that it now frozen
                // Note--currently no getter method for frozen state
                act = algodApiInstance.AccountInformation(acct3.Address.ToString());
                Console.WriteLine(act.GetHolding(assetID).ToString());
            }
            catch (Exception e)
            {
                //e.printStackTrace();
                Console.WriteLine(e.Message);
                return;
            }

            // 撤回转账
            // 撤加转账必须由clawbackaddress发起。
            // 如果资产的manager将clawbackaddress设为空,则此操作不可执行
            // 本例中会将10个资产从account3撤回到account1
            // 此操作需要由clawbackaccount(account2)进行签名
            // 此操作发送者为原操作的发起者(acct1)
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            // Next we set asset xfer specific parameters
            assetAmount = 10;
            tx          = Utils.GetRevokeAssetTransaction(acct2.Address, acct3.Address, acct1.Address, assetID, assetAmount, transParams, "revoke transaction");
            // The transaction must be signed by the clawback account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct2.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                TransactionID id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct3
                // and see that it now has 0 of the new asset
                act = algodApiInstance.AccountInformation(acct3.Address.ToString());
                Console.WriteLine(act.GetHolding(assetID).Amount);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }

            // 销毁资产
            // 销毁资产前所有资产需要回到创建者账号中
            // 销毁资产需要由Manage Addr进行操作
            // First we update standard Transaction parameters
            // To account for changes in the state of the blockchain
            transParams = algodApiInstance.TransactionParams();
            // Next we set asset xfer specific parameters
            // The manager must sign and submit the transaction
            // This is currently set to acct2
            tx = Utils.GetDestroyAssetTransaction(acct2.Address, assetID, transParams, "destroy transaction");
            // The transaction must be signed by the manager account
            // We are reusing the signedTx variable from the first transaction in the example
            signedTx = acct2.SignTransaction(tx);
            // send the transaction to the network and
            // wait for the transaction to be confirmed
            try
            {
                TransactionID id = Utils.SubmitTransaction(algodApiInstance, signedTx);
                Console.WriteLine("Transaction ID: " + id);
                Console.WriteLine(Utils.WaitTransactionToComplete(algodApiInstance, id.TxId));
                // We can now list the account information for acct1
                // and see that the asset is no longer there
                act = algodApiInstance.AccountInformation(acct1.Address.ToString());
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return;
            }
            Console.WriteLine("You have successefully arrived the end of this test, please press and key to exist.");
            Console.ReadKey();
        }