//void StatefulExamples() //{ // //string ALGOD_API_ADDR = "https://testnet-algorand.api.purestake.io/idx2"; // //string ALGOD_API_TOKEN = "GeHdp7CCGt7ApLuPNppXN4LtrW07Mm1kaFNJ5Ovr"; // //string ALGOD_API_ADDR = "http://localhost:4001"; // //string ALGOD_API_TOKEN = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; // //string ALGOD_API_ADDR = "http://hackathon.algodev.network:9100"; // //string ALGOD_API_TOKEN = "ef920e2e7e002953f4b29a8af720efe8e4ecc75ff102b165e0472834b25832c1"; // //var creatorMnemonic = "benefit once mutual legal marble hurdle dress toe fuel country prepare canvas barrel divide major square name captain calm flock crumble receive economy abandon power"; // //var userMnemonic = "pledge become mouse fantasy matrix bunker ask tissue prepare vocal unit patient cliff index train network intact company across stage faculty master mom abstract above"; // //// create two account to create and user the stateful contract // //creator = new Account(creatorMnemonic); // //user = new Account(userMnemonic); // //client = new AlgodApi(ALGOD_API_ADDR, ALGOD_API_TOKEN); //} private void compileTealPrograms() { // initial approval program without date/time arg string approvalProgramSourceInitial = ExtractResourceText("algorandapp.Assets.stateful_approval_init.teal"); // user declared approval program (refactored) with date/time arg string approvalProgramSourceRefactored = ExtractResourceText("algorandapp.Assets.stateful_approval_refact.teal"); // declare clear state program source string clearProgramSource = ExtractResourceText("algorandapp.Assets.stateful_clear.teal"); // note: the approvalProgramSourceInitial and approvalProgramSourceRefactored // need to have the user address changed thrughout the Teal Console.WriteLine("NOTE: Edit the initial and refactored TEAL programs to use this user account: " + user.Address); approvalProgram = client.TealCompile(Encoding.UTF8.GetBytes(approvalProgramSourceInitial)); clearProgram = client.TealCompile(Encoding.UTF8.GetBytes(clearProgramSource)); approvalProgramRefactored = client.TealCompile(Encoding.UTF8.GetBytes(approvalProgramSourceRefactored)); }
public CompileResponse CompileCode(CompileRequest request) { try { return(CompileResponse.ForSuccess(Executor.ExecuteSnippet(request.Snippet))); } catch (DynamicCompilationException e) { return(CompileResponse.ForError(e)); } }